Fehler in Bugfix Spell-Parameter Parsing

This commit is contained in:
Enno Rehling 2005-02-16 00:19:52 +00:00
parent ddf45ee534
commit b9aabcc944

View file

@ -1855,26 +1855,28 @@ static spellparameter *
add_spellparameter(region *target_r, unit *u, const char *syntax, char ** param, int size, struct order * ord) add_spellparameter(region *target_r, unit *u, const char *syntax, char ** param, int size, struct order * ord)
{ {
boolean fail = false; boolean fail = false;
int i = 0; int i = 0;
int p = 0; int p = 0;
const char * c = syntax; const char * c;
spellparameter *par; spellparameter *par;
int minlen = 0; int minlen = 0;
while (*c!=0) if (*c++!='+' && *c++!='k') ++minlen; for (c=syntax;*c!=0;++c) {
if (*c!='+' && *c!='k') ++minlen;
}
c = syntax; c = syntax;
/* mindestens ein Ziel (Ziellose Zauber werden nicht /* mindestens ein Ziel (Ziellose Zauber werden nicht
* geparst) */ * geparst) */
if (size==0) { if (size==0) {
/* Fehler: Ziel vergessen */ /* Fehler: Ziel vergessen */
cmistake(u, ord, 203, MSG_MAGIC); cmistake(u, ord, 203, MSG_MAGIC);
return 0; return 0;
} }
par = malloc(sizeof(spellparameter)); par = malloc(sizeof(spellparameter));
par->length = size; par->length = size;
par->param = malloc(size * sizeof(spllprm *)); par->param = malloc(size * sizeof(spllprm *));
while (!fail && *c && i<size && param[i]!=NULL) { while (!fail && *c && i<size && param[i]!=NULL) {
spllprm * spobj = NULL; spllprm * spobj = NULL;