generate string resource IDs from a list to avoid the trouble of keeping them sequential.

This commit is contained in:
ehouse 2009-04-11 15:40:01 +00:00
parent 848ccaaff7
commit d5afc6f252
2 changed files with 126 additions and 73 deletions

View file

@ -243,80 +243,9 @@
#define ID_BONUS_RES 9998 #define ID_BONUS_RES 9998
#define IDM_MAIN_COMMAND1 40001 #define IDM_MAIN_COMMAND1 40001
#define IDS_DUMMY 40002
#define IDS_MENU 40002 #include "genstrids_dot_h"
#define CE_FIRST_RES_ID IDS_MENU
#define IDS_DUMMY 40003
#define IDS_CANCEL 40004
#define IDS_OK 40005
#define IDS_ABOUT 40006
#define IDS_DONE 40007
#define IDS_DICTLOC 40008
#define IDS_SAVENAME 40009
#define IDS_DUPENAME 40010
#define IDS_RENAME 40011
#define IDS_REMAINING_TILES_ADD 40012
#define IDS_UNUSED_TILES_SUB 40013
#define IDS_BONUS_ALL 40014
#define IDS_TURN_SCORE 40015
#define IDS_COMMIT_CONFIRM 40016
#define IDS_LOCAL_NAME 40017
#define IDS_NONLOCAL_NAME 40018
#define IDS_TIME_PENALTY_SUB 40019
#define IDS_CUMULATIVE_SCORE 40020
#define IDS_MOVE_ACROSS 40021
#define IDS_MOVE_DOWN 40022
#define IDS_TRAY_AT_START 40023
#define IDS_NEW_TILES 40024
#define IDS_TRADED_FOR 40025
#define IDS_PASS 40026
#define IDS_PHONY_REJECTED 40027
#define IDS_ROBOT_TRADED 40028
#define IDS_ROBOT_MOVED 40029
#define IDS_REMOTE_MOVED 40030
#define IDS_PASSED 40031
#define IDS_SUMMARYSCORED 40032
#define IDS_TRADED 40033
#define IDS_LOSTTURN 40034
#ifndef XWFEATURE_STANDALONE_ONLY
# define IDS_LOCALPLAYERS 40035
#endif
#define IDS_TOTALPLAYERS 40036
#define IDS_VALUES_HEADER 40037
#define IDS_TILES_NOT_IN_LINE 40038
#define IDS_NO_EMPTIES_IN_TURN 40039
#define IDS_TWO_TILES_FIRST_MOVE 40040
#define IDS_TILES_MUST_CONTACT 40041
#define IDS_NOT_YOUR_TURN 40042
#define IDS_NO_PEEK_ROBOT_TILES 40043
#define IDS_CANT_TRADE_MID_MOVE 40044
#define IDS_TOO_FEW_TILES_LEFT_TO_TRADE 40045
#define IDS_CANT_UNDO_TILEASSIGN 40046
#define IDS_CANT_HINT_WHILE_DISABLED 40047
#ifndef XWFEATURE_STANDALONE_ONLY
# define IDS_NO_PEEK_REMOTE_TILES 40048
# define IDS_REG_UNEXPECTED_USER 40049
# define IDS_SERVER_DICT_WINS 40050
# define IDS_REG_SERVER_SANS_REMOTE 40051
#endif
#ifdef XWFEATURE_RELAY
# define IDS_XWRELAY_ERROR_TIMEOUT 40052
# define IDS_ERROR_HEART_YOU 40053
# define IDS_XWRELAY_ERROR_HEART_OTHER 40054
/* #define IDS_XWRELAY_ERROR_LOST_OTHER 40076 */
#endif
#define IDS_QUERY_TRADE 40055
#define IDS_DOUBLE_LETTER 40056
#define IDS_DOUBLE_WORD 40057
#define IDS_TRIPLE_LETTER 40058
#define IDS_TRIPLE_WORD 40059
#define IDS_INTRADE_MW 40060
#define CE_LAST_RES_ID IDS_INTRADE_MW
// These are in sets of three, and must be consecutive and in the right order within each set // These are in sets of three, and must be consecutive and in the right order within each set
#define PHONIES_COMBO 1200 #define PHONIES_COMBO 1200

View file

@ -0,0 +1,124 @@
/*
* Generates #defines that are best kept sequential
*/
#include <stdio.h>
static char* ids[] = {
"IDS_MENU"
,"IDS_CANCEL"
,"IDS_OK"
,"IDS_ABOUT"
,"IDS_DONE"
,"IDS_DICTLOC"
,"IDS_SAVENAME"
,"IDS_DUPENAME"
,"IDS_RENAME"
,"IDS_REMAINING_TILES_ADD"
,"IDS_UNUSED_TILES_SUB"
,"IDS_BONUS_ALL"
,"IDS_TURN_SCORE"
,"IDS_COMMIT_CONFIRM"
,"IDS_LOCAL_NAME"
,"IDS_NONLOCAL_NAME"
,"IDS_TIME_PENALTY_SUB"
,"IDS_CUMULATIVE_SCORE"
,"IDS_MOVE_ACROSS"
,"IDS_MOVE_DOWN"
,"IDS_TRAY_AT_START"
,"IDS_NEW_TILES"
,"IDS_TRADED_FOR"
,"IDS_PASS"
,"IDS_PHONY_REJECTED"
,"IDS_ROBOT_TRADED"
,"IDS_ROBOT_MOVED"
,"IDS_REMOTE_MOVED"
,"IDS_PASSED"
,"IDS_REMTILES_L"
,"IDS_SUMMARYSCORED"
,"IDS_TRADED"
,"IDS_LOSTTURN"
,"IDS_TOTALPLAYERS"
,"IDS_VALUES_HEADER"
,"IDS_TILES_NOT_IN_LINE"
,"IDS_NO_EMPTIES_IN_TURN"
,"IDS_TWO_TILES_FIRST_MOVE"
,"IDS_TILES_MUST_CONTACT"
,"IDS_NOT_YOUR_TURN"
,"IDS_NO_PEEK_ROBOT_TILES"
,"IDS_CANT_TRADE_MID_MOVE"
,"IDS_TOO_FEW_TILES_LEFT_TO_TRADE"
,"IDS_CANT_UNDO_TILEASSIGN"
,"IDS_CANT_HINT_WHILE_DISABLED"
,"IDS_QUERY_TRADE"
,"IDS_DOUBLE_LETTER"
,"IDS_DOUBLE_WORD"
,"IDS_TRIPLE_LETTER"
,"IDS_TRIPLE_WORD"
,"IDS_INTRADE_MW"
,"IDS_COUNTSVALS_L"
,"IDS_REMTIMES_L"
,"IDS_GAMEHIST_L"
,"IDS_FINALSCORE_L"
,"IDS_QUESTION_L"
,"IDS_FYI_L"
,"IDS_ILLEGALWRD_L"
,"IDS_WRDNOTFOUND"
,"IDS_USEANYWAY"
,"IDS_CANNOTOPEN_GAME"
,"IDS_NODICT_L"
,"IDS_ABOUT_L"
,"IDS_OVERWRITE"
,"IDS_ENDNOW"
,"IDS_CANNOTOPEN_DICT"
,"IDS_CONFIM_DELETE"
,"IDS_ROLE_STANDALONE"
,"IDS_ROLE_HOST"
,"IDS_ROLE_GUEST"
,"IDS_PLAYER_FORMAT"
,"IDS_UNTITLED_FORMAT"
,"IDS_CONN_RELAY"
,"IDS_CONN_DIRECT"
,"IDS_CONN_SMS"
#ifndef XWFEATURE_STANDALONE_ONLY
,"IDS_LOCALPLAYERS"
,"IDS_NO_PEEK_REMOTE_TILES"
,"IDS_REG_UNEXPECTED_USER"
,"IDS_SERVER_DICT_WINS"
,"IDS_REG_SERVER_SANS_REMOTE"
# ifdef XWFEATURE_RELAY
,"IDS_XWRELAY_ERROR_TIMEOUT"
,"IDS_ERROR_HEART_YOU"
,"IDS_XWRELAY_ERROR_HEART_OTHER"
,"IDS_XWRELAY_ERROR_LOST_OTHER"
# endif
#endif
};
#define FIRST_ID 40002
int
main( int argc, char** argv )
{
int firstID = FIRST_ID;
int ii;
printf( "/* -*- mode: c; -*- */\n" );
printf( "/***********************************************************\n" );
printf( " * GENERATED CODE; DO NOT EDIT\n" );
printf( " * (edit scripts/strids.c instead)\n" );
printf( " ***********************************************************/\n" );
printf( "\n" );
for ( ii = 0; ii < sizeof(ids)/sizeof(ids[0]); ++ii ) {
printf( "#define %s %d\n", ids[ii], firstID++ );
}
printf( "\n" );
printf( "#define %s %d\n", "CE_FIRST_RES_ID", FIRST_ID );
printf( "#define %s %d\n", "CE_LAST_RES_ID", FIRST_ID + ii - 1 );
return 0;
argc = argc;
argv = argv;
}