tParsing of configuration files relaxed to allow "old-style" (non-quoted) strin… | |
git clone git://src.adamsgaard.dk/vaccinewars | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit 297d354ef85bc0a228bfece05fe8aad0c7eb35c1 | |
parent b0542e47a9251335615fedb5f2e8f7f5752d1a2b | |
Author: Ben Webb <[email protected]> | |
Date: Mon, 29 Jan 2001 01:15:55 +0000 | |
Parsing of configuration files relaxed to allow "old-style" (non-quoted) strings | |
Diffstat: | |
M src/dopewars.c | 20 +++++++++++++++++--- | |
1 file changed, 17 insertions(+), 3 deletions(-) | |
--- | |
diff --git a/src/dopewars.c b/src/dopewars.c | |
t@@ -1243,7 +1243,6 @@ gboolean ParseNextConfig(GScanner *scanner) { | |
PrintConfigValue(GlobalIndex,index,IndexGiven,scanner); | |
return TRUE; | |
} else if (token==G_TOKEN_EQUAL_SIGN) { | |
- token=g_scanner_get_next_token(scanner); | |
if (CountPlayers(FirstServer)>0) { | |
g_warning( | |
_("Configuration can only be changed interactively when no\n" | |
t@@ -1359,13 +1358,13 @@ void SetConfigValue(int GlobalIndex,int StructIndex,gb… | |
int IntVal,NewNum; | |
Player *tmp; | |
GSList *list,*StartList; | |
- token=scanner->token; | |
if (!CheckMaxIndex(scanner,GlobalIndex,StructIndex,IndexGiven)) return; | |
if (Globals[GlobalIndex].NameStruct[0]) { | |
GlobalName=g_strdup_printf("%s[%d].%s",Globals[GlobalIndex].NameStruct, | |
StructIndex,Globals[GlobalIndex].Name); | |
} else GlobalName=Globals[GlobalIndex].Name; | |
if (Globals[GlobalIndex].IntVal) { | |
+ token=g_scanner_get_next_token(scanner); | |
if (token==G_TOKEN_INT) { | |
IntVal=(int)scanner->value.v_int; | |
if (Globals[GlobalIndex].ResizeFunc) { | |
t@@ -1386,6 +1385,7 @@ void SetConfigValue(int GlobalIndex,int StructIndex,gboo… | |
NULL,NULL,FALSE); return; | |
} | |
} else if (Globals[GlobalIndex].PriceVal) { | |
+ token=g_scanner_get_next_token(scanner); | |
if (token==G_TOKEN_INT) { | |
*((price_t *)GetGlobalPointer(GlobalIndex,StructIndex))= | |
(price_t)scanner->value.v_int; | |
t@@ -1394,14 +1394,28 @@ void SetConfigValue(int GlobalIndex,int StructIndex,gb… | |
NULL,NULL,FALSE); return; | |
} | |
} else if (Globals[GlobalIndex].StringVal) { | |
+ scanner->config->identifier_2_string=TRUE; | |
+ scanner->config->cset_identifier_first= | |
+ G_CSET_a_2_z " ._0123456789" G_CSET_A_2_Z G_CSET_LATINS G_CSET_LATIN… | |
+ scanner->config->cset_identifier_nth= | |
+ G_CSET_a_2_z " ._0123456789" G_CSET_A_2_Z G_CSET_LATINS G_CSET_LATIN… | |
+ token=g_scanner_get_next_token(scanner); | |
if (token==G_TOKEN_STRING) { | |
AssignName((gchar **)GetGlobalPointer(GlobalIndex,StructIndex), | |
scanner->value.v_string); | |
+ } else if (token==G_TOKEN_IDENTIFIER) { | |
+ AssignName((gchar **)GetGlobalPointer(GlobalIndex,StructIndex), | |
+ scanner->value.v_identifier); | |
} else { | |
g_scanner_unexp_token(scanner,G_TOKEN_STRING,NULL,NULL, | |
- NULL,NULL,FALSE); return; | |
+ NULL,NULL,FALSE); | |
} | |
+ scanner->config->identifier_2_string=FALSE; | |
+ scanner->config->cset_identifier_first=G_CSET_a_2_z "_" G_CSET_A_2_Z; | |
+ scanner->config->cset_identifier_nth= | |
+ G_CSET_a_2_z "._0123456789" G_CSET_A_2_Z; | |
} else if (Globals[GlobalIndex].StringList) { | |
+ token=g_scanner_get_next_token(scanner); | |
if (IndexGiven) { | |
if (token==G_TOKEN_STRING) { | |
AssignName(&(*(Globals[GlobalIndex].StringList))[StructIndex-1], |