Der server mag es nicht, wenn Rassen ein space im internal name haben, weil

trigger den rassennamen ohne "" schreiben. also operiere ich die mal raus,
spaces soll man da auch nicht haben.
This commit is contained in:
Enno Rehling 2005-08-21 09:24:14 +00:00
parent 923ea5bcf8
commit b252b00163
4 changed files with 66 additions and 53 deletions

View File

@ -85,6 +85,10 @@ rc_new(const char * zName)
{ {
char zBuffer[80]; char zBuffer[80];
race * rc = calloc(sizeof(race), 1); race * rc = calloc(sizeof(race), 1);
if (strchr(zName, ' ')!=NULL) {
log_error(("race '%s' has an invalid name. remove spaces\n", zName));
assert(strchr(zName, ' ')==NULL);
}
strcpy(zBuffer, zName); strcpy(zBuffer, zName);
rc->_name[0] = strdup(zBuffer); rc->_name[0] = strdup(zBuffer);
sprintf(zBuffer, "%s_p", zName); sprintf(zBuffer, "%s_p", zName);

View File

@ -1063,8 +1063,17 @@ readunit(FILE * F)
u->race = new_race[(race_t)ri(F)]; u->race = new_race[(race_t)ri(F)];
u->irace = new_race[(race_t)ri(F)]; u->irace = new_race[(race_t)ri(F)];
} else { } else {
char * space;
rs(F, buf); rs(F, buf);
if (strcmp(buf, "giant turtle")==0) strcpy(buf, "giantturtle"); space = strchr(buf, ' ');
while (space!=NULL) {
strcpy(space, space+1);
space=strchr(space, ' ');
}
/* if (strcmp(buf, "giant turtle")==0) strcpy(buf, "giantturtle");
if (strcmp(buf, "young dragon")==0) strcpy(buf, "youngdragon");
if (strcmp(buf, "young dragon")==0) strcpy(buf, "youngdragon"); */
u->race = rc_find(buf); u->race = rc_find(buf);
assert(u->race); assert(u->race);
rs(F, buf); rs(F, buf);