Vrash, wenn REGION keyword in Zaubern ohne angegebene Region.

This commit is contained in:
Enno Rehling 2004-07-03 10:30:25 +00:00
parent a960f790ad
commit 3f38bcb156
1 changed files with 19 additions and 13 deletions

View File

@ -1875,11 +1875,12 @@ add_spellparameter(region *target_r, unit *u, const char *syntax, char ** param,
while (!fail && *c && i<size && param[i]!=NULL) { while (!fail && *c && i<size && param[i]!=NULL) {
spllprm * spobj = NULL; spllprm * spobj = NULL;
param_t pword; param_t pword;
int j = 0; int j = -1;
switch (*c) { switch (*c) {
case '+': case '+':
/* das vorhergehende Element kommt ein oder mehrmals vor, wir /* das vorhergehende Element kommt ein oder mehrmals vor, wir
* springen zum key zurück */ * springen zum key zurück */
j = 0;
--c; --c;
break; break;
case 'u': case 'u':
@ -1913,38 +1914,42 @@ add_spellparameter(region *target_r, unit *u, const char *syntax, char ** param,
case 'k': case 'k':
++c; ++c;
pword = findparam(param[i++], u->faction->locale); pword = findparam(param[i++], u->faction->locale);
if (i>=size) pword = NOPARAM;
switch (pword) { switch (pword) {
case P_REGION: case P_REGION:
spobj = malloc(sizeof(spllprm)); spobj = malloc(sizeof(spllprm));
spobj->flag = 0; spobj->flag = 0;
spobj->typ = SPP_REGION; spobj->typ = SPP_REGION;
spobj->data.r = u->region; spobj->data.r = u->region;
j = 0;
++c; ++c;
break; break;
case P_UNIT: case P_UNIT:
if (i<size) {
j = addparam_unit(param+i, &spobj, u, ord); j = addparam_unit(param+i, &spobj, u, ord);
++c; ++c;
}
break; break;
case P_BUILDING: case P_BUILDING:
case P_GEBAEUDE: case P_GEBAEUDE:
if (i<size) {
j = addparam_building(param+i, &spobj); j = addparam_building(param+i, &spobj);
++c; ++c;
}
break; break;
case P_SHIP: case P_SHIP:
if (i<size) {
j = addparam_ship(param+i, &spobj); j = addparam_ship(param+i, &spobj);
++c; ++c;
break;
default:
/* Syntax Error. */
cmistake(u, ord, 209, MSG_MAGIC);
j = -1;
} }
break; break;
default: default:
/* Syntax Error. */
cmistake(u, ord, 209, MSG_MAGIC);
j = -1; j = -1;
break;
}
break;
default:
j = -1;
break;
} }
if (j<0) fail = true; if (j<0) fail = true;
else { else {
@ -1954,6 +1959,7 @@ add_spellparameter(region *target_r, unit *u, const char *syntax, char ** param,
} }
if (fail) { if (fail) {
cmistake(u, ord, 209, MSG_MAGIC);
free_spellparameter(par); free_spellparameter(par);
return NULL; return NULL;
} }