forked from github/server
Zauber mit REGION als letztem Parameter beschwerten sich ueber fehlende Parameter.
This commit is contained in:
parent
03b2543d30
commit
c580b96da8
|
@ -1862,7 +1862,13 @@ add_spellparameter(region *target_r, unit *u, const char *syntax, char ** param,
|
|||
int minlen = 0;
|
||||
|
||||
for (c=syntax;*c!=0;++c) {
|
||||
if (*c!='+' && *c!='k') ++minlen;
|
||||
/* this makes sure that:
|
||||
* minlen("kc?") = 0
|
||||
* minlen("kc+") = 1
|
||||
* minlen("cccc+c?") = 4
|
||||
*/
|
||||
if (*c=='?') --minlen;
|
||||
else if (*c!='+' && *c!='k') ++minlen;
|
||||
}
|
||||
c = syntax;
|
||||
|
||||
|
@ -1883,78 +1889,84 @@ add_spellparameter(region *target_r, unit *u, const char *syntax, char ** param,
|
|||
param_t pword;
|
||||
int j = -1;
|
||||
switch (*c) {
|
||||
case '+':
|
||||
/* das vorhergehende Element kommt ein oder mehrmals vor, wir
|
||||
* springen zum key zurück */
|
||||
j = 0;
|
||||
--c;
|
||||
break;
|
||||
case 'u':
|
||||
/* Parameter ist eine Einheit, evtl. TEMP */
|
||||
j = addparam_unit(param+i, &spobj, u, ord);
|
||||
++c;
|
||||
break;
|
||||
case 'r':
|
||||
/* Parameter sind zwei Regionskoordinaten */
|
||||
j = addparam_region(param+i, &spobj, u, ord);
|
||||
++c;
|
||||
break;
|
||||
case 'b':
|
||||
/* Parameter ist eine Burgnummer */
|
||||
j = addparam_building(param+i, &spobj);
|
||||
++c;
|
||||
break;
|
||||
case 's':
|
||||
j = addparam_ship(param+i, &spobj);
|
||||
++c;
|
||||
break;
|
||||
case 'c':
|
||||
/* Text, wird im Spruch ausgewertet */
|
||||
j = addparam_string(param+i, &spobj);
|
||||
++c;
|
||||
break;
|
||||
case 'i': /* Zahl */
|
||||
j = addparam_int(param+i, &spobj);
|
||||
++c;
|
||||
break;
|
||||
case 'k':
|
||||
++c;
|
||||
pword = findparam(param[i++], u->faction->locale);
|
||||
switch (pword) {
|
||||
case P_REGION:
|
||||
spobj = malloc(sizeof(spllprm));
|
||||
spobj->flag = 0;
|
||||
spobj->typ = SPP_REGION;
|
||||
spobj->data.r = u->region;
|
||||
j = 0;
|
||||
++c;
|
||||
break;
|
||||
case P_UNIT:
|
||||
if (i<size) {
|
||||
j = addparam_unit(param+i, &spobj, u, ord);
|
||||
++c;
|
||||
}
|
||||
break;
|
||||
case P_BUILDING:
|
||||
case P_GEBAEUDE:
|
||||
if (i<size) {
|
||||
j = addparam_building(param+i, &spobj);
|
||||
++c;
|
||||
}
|
||||
break;
|
||||
case P_SHIP:
|
||||
if (i<size) {
|
||||
j = addparam_ship(param+i, &spobj);
|
||||
++c;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
j = -1;
|
||||
case '?':
|
||||
/* tja. das sollte moeglichst nur am Ende passieren,
|
||||
* weil sonst die kacke dampft. */
|
||||
++c;
|
||||
assert(*c==0);
|
||||
break;
|
||||
case '+':
|
||||
/* das vorhergehende Element kommt ein oder mehrmals vor, wir
|
||||
* springen zum key zurück */
|
||||
j = 0;
|
||||
--c;
|
||||
break;
|
||||
case 'u':
|
||||
/* Parameter ist eine Einheit, evtl. TEMP */
|
||||
j = addparam_unit(param+i, &spobj, u, ord);
|
||||
++c;
|
||||
break;
|
||||
case 'r':
|
||||
/* Parameter sind zwei Regionskoordinaten */
|
||||
j = addparam_region(param+i, &spobj, u, ord);
|
||||
++c;
|
||||
break;
|
||||
case 'b':
|
||||
/* Parameter ist eine Burgnummer */
|
||||
j = addparam_building(param+i, &spobj);
|
||||
++c;
|
||||
break;
|
||||
case 's':
|
||||
j = addparam_ship(param+i, &spobj);
|
||||
++c;
|
||||
break;
|
||||
case 'c':
|
||||
/* Text, wird im Spruch ausgewertet */
|
||||
j = addparam_string(param+i, &spobj);
|
||||
++c;
|
||||
break;
|
||||
case 'i': /* Zahl */
|
||||
j = addparam_int(param+i, &spobj);
|
||||
++c;
|
||||
break;
|
||||
case 'k':
|
||||
++c;
|
||||
pword = findparam(param[i++], u->faction->locale);
|
||||
switch (pword) {
|
||||
case P_REGION:
|
||||
spobj = malloc(sizeof(spllprm));
|
||||
spobj->flag = 0;
|
||||
spobj->typ = SPP_REGION;
|
||||
spobj->data.r = u->region;
|
||||
j = 0;
|
||||
++c;
|
||||
break;
|
||||
case P_UNIT:
|
||||
if (i<size) {
|
||||
j = addparam_unit(param+i, &spobj, u, ord);
|
||||
++c;
|
||||
}
|
||||
break;
|
||||
case P_BUILDING:
|
||||
case P_GEBAEUDE:
|
||||
if (i<size) {
|
||||
j = addparam_building(param+i, &spobj);
|
||||
++c;
|
||||
}
|
||||
break;
|
||||
case P_SHIP:
|
||||
if (i<size) {
|
||||
j = addparam_ship(param+i, &spobj);
|
||||
++c;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
j = -1;
|
||||
break;
|
||||
}
|
||||
if (j<0) fail = true;
|
||||
|
|
|
@ -8041,7 +8041,7 @@ static spell spelldaten[] =
|
|||
"ZAUBERE [REGION x y] [STUFE n] \'Geister bannen\' EINHEIT <Einheit-Nr>\n"
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Geister bannen\' GEBÄUDE <Gebäude-Nr>\n"
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Geister bannen\' SCHIFF <Schiff-Nr>",
|
||||
"kc",
|
||||
"kc?",
|
||||
M_DRUIDE,
|
||||
(FARCASTING | SPELLLEVEL | ONSHIPCAST | ONETARGET | TESTCANSEE),
|
||||
2, 8,
|
||||
|
@ -8522,7 +8522,7 @@ static spell spelldaten[] =
|
|||
"ZAUBERE [REGION x y] [STUFE n] \'Pentagramm\' EINHEIT <Einheit-Nr>\n"
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Pentagramm\' GEBÄUDE <Gebäude-Nr>\n"
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Pentagramm\' SCHIFF <Schiff-Nr>",
|
||||
"kc",
|
||||
"kc?",
|
||||
M_CHAOS,
|
||||
(FARCASTING | SPELLLEVEL | ONSHIPCAST | ONETARGET | TESTCANSEE),
|
||||
2, 10,
|
||||
|
@ -8877,7 +8877,7 @@ static spell spelldaten[] =
|
|||
"ZAUBERE [REGION x y] [STUFE n] \'Traumbilder entwirren\' EINHEIT <Einheit-Nr>\n"
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Traumbilder entwirren\' GEBÄUDE <Gebäude-Nr>\n"
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Traumbilder entwirren\' SCHIFF <Schiff-Nr>",
|
||||
"kc",
|
||||
"kc?",
|
||||
M_TRAUM,
|
||||
(FARCASTING | SPELLLEVEL | ONSHIPCAST | ONETARGET | TESTCANSEE),
|
||||
2, 8,
|
||||
|
@ -9354,7 +9354,7 @@ static spell spelldaten[] =
|
|||
"ZAUBERE [STUFE n] \'Lied des Ortes analysieren\' REGION\n"
|
||||
"ZAUBERE [STUFE n] \'Lied des Ortes analysieren\' GEBÄUDE <Gebäude-nr>\n"
|
||||
"ZAUBERE [STUFE n] \'Lied des Ortes analysieren\' SCHIFF <Schiff-nr>",
|
||||
"kc",
|
||||
"kc?",
|
||||
M_BARDE, (SPELLLEVEL|ONSHIPCAST), 5, 8,
|
||||
{
|
||||
{ R_AURA, 3, SPC_LEVEL },
|
||||
|
@ -9374,7 +9374,7 @@ static spell spelldaten[] =
|
|||
"ZAUBERE [REGION x y] [STUFE n] \'Lebenslied festigen\' EINHEIT <Einheit-Nr>\n"
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Lebenslied festigen\' GEBÄUDE <Gebäude-Nr>\n"
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Lebenslied festigen\' SCHIFF <Schiff-Nr>",
|
||||
"kc",
|
||||
"kc?",
|
||||
M_BARDE,
|
||||
(FARCASTING | SPELLLEVEL | ONSHIPCAST | ONETARGET | TESTCANSEE),
|
||||
2, 8,
|
||||
|
@ -9612,7 +9612,7 @@ static spell spelldaten[] =
|
|||
"ZAUBERE [STUFE n] \'Magie analysieren\' EINHEIT <Einheit-Nr>\n"
|
||||
"ZAUBERE [STUFE n] \'Magie analysieren\' GEBÄUDE <Gebäude-Nr>\n"
|
||||
"ZAUBERE [STUFE n] \'Magie analysieren\' SCHIFF <Schiff-Nr>",
|
||||
"kc",
|
||||
"kc?",
|
||||
M_ASTRAL, (SPELLLEVEL | UNITSPELL | ONSHIPCAST | TESTCANSEE), 5, 1,
|
||||
{
|
||||
{ R_AURA, 1, SPC_LEVEL },
|
||||
|
@ -9830,7 +9830,7 @@ static spell spelldaten[] =
|
|||
"ZAUBERE [REGION x y] [STUFE n] \'Magiefresser\' EINHEIT <Einheit-Nr>\n"
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Magiefresser\' GEBÄUDE <Gebäude-Nr>\n"
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Magiefresser\' SCHIFF <Schiff-Nr>",
|
||||
"kc",
|
||||
"kc?",
|
||||
M_ASTRAL,
|
||||
(FARCASTING | SPELLLEVEL | ONSHIPCAST | ONETARGET | TESTCANSEE),
|
||||
2, 5,
|
||||
|
|
Loading…
Reference in New Issue