forked from github/server
- Bugfix Patzermeldungen,
- Entfernte Befehle kriegen next=NULL, assert desselben.
This commit is contained in:
parent
df476c5d7c
commit
075ab8d997
8 changed files with 93 additions and 88 deletions
|
@ -3210,66 +3210,67 @@ new_units (void)
|
|||
unit *u, *u2;
|
||||
|
||||
/* neue einheiten werden gemacht und ihre befehle (bis zum "ende" zu
|
||||
* ihnen rueberkopiert, damit diese einheiten genauso wie die alten
|
||||
* einheiten verwendet werden koennen. */
|
||||
|
||||
* ihnen rueberkopiert, damit diese einheiten genauso wie die alten
|
||||
* einheiten verwendet werden koennen. */
|
||||
|
||||
for (r = regions; r; r = r->next) {
|
||||
for (u = r->units; u; u = u->next) {
|
||||
order ** ordp = &u->orders;
|
||||
while (*ordp) {
|
||||
order * makeord = *ordp;
|
||||
if (get_keyword(makeord) == K_MAKE) {
|
||||
init_tokens(makeord);
|
||||
skip_token();
|
||||
if (getparam(u->faction->locale) == P_TEMP) {
|
||||
char * name;
|
||||
int g, alias;
|
||||
int mu = maxunits(u->faction);
|
||||
order ** newordersp;
|
||||
|
||||
if(u->faction->no_units >= mu) {
|
||||
sprintf(buf, "Eine Partei darf aus nicht mehr als %d "
|
||||
"Einheiten bestehen.", mu);
|
||||
mistake(u, makeord, buf, MSG_PRODUCE);
|
||||
ordp = &makeord->next;
|
||||
|
||||
while (*ordp) {
|
||||
order * ord = *ordp;
|
||||
if (get_keyword(ord) == K_END) break;
|
||||
*ordp = ord->next;
|
||||
free_order(ord);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
alias = getid();
|
||||
|
||||
name = strdup(getstrtoken());
|
||||
if (name && strlen(name)==0) name = NULL;
|
||||
u2 = create_unit(r, u->faction, 0, u->faction->race, alias, name, u);
|
||||
if (name!=NULL) free(name);
|
||||
fset(u2, UFL_ISNEW);
|
||||
|
||||
a_add(&u2->attribs, a_new(&at_alias))->data.i = alias;
|
||||
|
||||
g = getguard(u);
|
||||
if (g) setguard(u2, g);
|
||||
else setguard(u, GUARD_NONE);
|
||||
|
||||
ordp = &makeord->next;
|
||||
newordersp = &u2->orders;
|
||||
while (*ordp) {
|
||||
order * ord = *ordp;
|
||||
if (get_keyword(ord) == K_END) break;
|
||||
*ordp = ord->next;
|
||||
ord->next = NULL;
|
||||
*newordersp = ord;
|
||||
newordersp = &ord->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*ordp==makeord) ordp=&makeord->next;
|
||||
}
|
||||
}
|
||||
for (u = r->units; u; u = u->next) {
|
||||
order ** ordp = &u->orders;
|
||||
while (*ordp) {
|
||||
order * makeord = *ordp;
|
||||
if (get_keyword(makeord) == K_MAKE) {
|
||||
init_tokens(makeord);
|
||||
skip_token();
|
||||
if (getparam(u->faction->locale) == P_TEMP) {
|
||||
char * name;
|
||||
int g, alias;
|
||||
int mu = maxunits(u->faction);
|
||||
order ** newordersp;
|
||||
|
||||
if(u->faction->no_units >= mu) {
|
||||
sprintf(buf, "Eine Partei darf aus nicht mehr als %d "
|
||||
"Einheiten bestehen.", mu);
|
||||
mistake(u, makeord, buf, MSG_PRODUCE);
|
||||
ordp = &makeord->next;
|
||||
|
||||
while (*ordp) {
|
||||
order * ord = *ordp;
|
||||
if (get_keyword(ord) == K_END) break;
|
||||
*ordp = ord->next;
|
||||
ord->next = NULL;
|
||||
free_order(ord);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
alias = getid();
|
||||
|
||||
name = strdup(getstrtoken());
|
||||
if (name && strlen(name)==0) name = NULL;
|
||||
u2 = create_unit(r, u->faction, 0, u->faction->race, alias, name, u);
|
||||
if (name!=NULL) free(name);
|
||||
fset(u2, UFL_ISNEW);
|
||||
|
||||
a_add(&u2->attribs, a_new(&at_alias))->data.i = alias;
|
||||
|
||||
g = getguard(u);
|
||||
if (g) setguard(u2, g);
|
||||
else setguard(u, GUARD_NONE);
|
||||
|
||||
ordp = &makeord->next;
|
||||
newordersp = &u2->orders;
|
||||
while (*ordp) {
|
||||
order * ord = *ordp;
|
||||
if (get_keyword(ord) == K_END) break;
|
||||
*ordp = ord->next;
|
||||
ord->next = NULL;
|
||||
*newordersp = ord;
|
||||
newordersp = &ord->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*ordp==makeord) ordp=&makeord->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3543,6 +3544,7 @@ defaultorders (void)
|
|||
set_order(&u->lastorder, parse_order(getstrtoken(), u->faction->locale));
|
||||
free_order(u->lastorder); /* parse_order & set_order have both increased the refcount */
|
||||
*ordp = ord->next;
|
||||
ord->next = NULL;
|
||||
free_order(ord);
|
||||
}
|
||||
else ordp = &ord->next;
|
||||
|
|
|
@ -437,7 +437,7 @@ set_movement_order(unit * u, const region * target, int moves, boolean (*allowed
|
|||
}
|
||||
|
||||
set_order(&u->lastorder, parse_order(buf, u->faction->locale));
|
||||
free_order(u->lastorder); /* parse_order & set_order have both increased the refcount */
|
||||
free_order(u->lastorder); /* parse_order & set_order have both increased the refcount */
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -765,7 +765,7 @@ learn_monster(unit *u)
|
|||
sprintf(buf, "%s %s", locale_string(u->faction->locale, keywords[K_STUDY]),
|
||||
skillname(sv->id, u->faction->locale));
|
||||
set_order(&u->thisorder, parse_order(buf, u->faction->locale));
|
||||
free_order(u->thisorder); /* parse_order & set_order have both increased the refcount */
|
||||
free_order(u->thisorder); /* parse_order & set_order have both increased the refcount */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1384,7 +1384,7 @@ randomevents(void)
|
|||
|
||||
name_unit(u);
|
||||
set_order(&u->lastorder, parse_order(keywords[K_WAIT], u->faction->locale));
|
||||
free_order(u->lastorder); /* parse_order & set_order have each increased the refcount */
|
||||
free_order(u->lastorder); /* parse_order & set_order have each increased the refcount */
|
||||
|
||||
/* add message to the region */
|
||||
ADDMSG(&r->msgs,
|
||||
|
@ -1451,8 +1451,8 @@ randomevents(void)
|
|||
u->hp = unit_max_hp(u) * u->number;
|
||||
|
||||
deathcounts(r, -undead);
|
||||
set_order(&u->lastorder, parse_order(keywords[K_WAIT], u->faction->locale));
|
||||
free_order(u->lastorder); /* parse_order & set_order have each increased the refcount */
|
||||
set_order(&u->lastorder, parse_order(keywords[K_WAIT], u->faction->locale));
|
||||
free_order(u->lastorder); /* parse_order & set_order have each increased the refcount */
|
||||
name_unit(u);
|
||||
|
||||
log_printf("%d %s in %s.\n", u->number,
|
||||
|
@ -1527,8 +1527,8 @@ randomevents(void)
|
|||
rsettrees(r, trees);
|
||||
#endif
|
||||
u = createunit(r, findfaction(MONSTER_FACTION),treemen, new_race[RC_TREEMAN]);
|
||||
set_order(&u->lastorder, parse_order(keywords[K_WAIT], u->faction->locale));
|
||||
free_order(u->lastorder); /* parse_order & set_order have each increased the refcount */
|
||||
set_order(&u->lastorder, parse_order(keywords[K_WAIT], u->faction->locale));
|
||||
free_order(u->lastorder); /* parse_order & set_order have each increased the refcount */
|
||||
/* guard(u, GUARD_ALL); kein auto-guard! erst in monster.c! */
|
||||
|
||||
set_level(u, SK_OBSERVATION, 2);
|
||||
|
|
|
@ -925,7 +925,7 @@ build_building(unit * u, const building_type * btype, int want)
|
|||
else
|
||||
sprintf(buffer, "%s %d %s %s", locale_string(u->faction->locale, keywords[K_MAKE]), want-built, string2, buildingid(b));
|
||||
set_order(&u->lastorder, parse_order(buffer, u->faction->locale));
|
||||
free_order(u->lastorder);
|
||||
free_order(u->lastorder);
|
||||
|
||||
b->size += built;
|
||||
update_lighthouse(b);
|
||||
|
@ -1248,6 +1248,7 @@ do_misc(boolean lasttry)
|
|||
* erfolgreich und wir löschen ihn, damit er im
|
||||
* zweiten Versuch nicht nochmal ausgeführt wird. */
|
||||
*ordp = ord->next;
|
||||
ord->next = NULL;
|
||||
free_order(ord);
|
||||
leave(r, u);
|
||||
u->building = b;
|
||||
|
|
|
@ -832,7 +832,7 @@ cycle_route(unit *u, int gereist)
|
|||
|
||||
strcat(neworder, tail);
|
||||
set_order(&u->lastorder, parse_order(neworder, u->faction->locale));
|
||||
free_order(u->lastorder); /* parse_order & set_order have each increased the refcount */
|
||||
free_order(u->lastorder); /* parse_order & set_order have each increased the refcount */
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1926,7 +1926,7 @@ piracy_cmd(unit *u, struct order * ord)
|
|||
sprintf(buf, "%s %s", locale_string(u->faction->locale, keywords[K_MOVE]),
|
||||
locale_string(u->faction->locale, directions[target_dir]));
|
||||
set_order(&u->thisorder, parse_order(buf, u->faction->locale));
|
||||
free_order(u->thisorder); /* parse_order & set_order have each increased the refcount */
|
||||
free_order(u->thisorder); /* parse_order & set_order have each increased the refcount */
|
||||
|
||||
/* Bewegung ausführen */
|
||||
init_tokens(u->thisorder);
|
||||
|
|
|
@ -63,6 +63,7 @@ void
|
|||
free_order(order * ord)
|
||||
{
|
||||
if (ord!=NULL && --ord->_refcount==0) {
|
||||
assert(ord->next==NULL);
|
||||
if (ord->_str!=NULL) free(ord->_str);
|
||||
free(ord);
|
||||
}
|
||||
|
@ -89,6 +90,7 @@ free_orders(order ** olist)
|
|||
while (*olist) {
|
||||
order * ord = *olist;
|
||||
*olist = ord->next;
|
||||
ord->next = NULL;
|
||||
free_order(ord);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -195,11 +195,11 @@ magicanalyse_region(region *r, unit *mage, double force)
|
|||
if (chance(probability)) { /* Analyse geglückt */
|
||||
if(c->flag & CURSE_NOAGE) {
|
||||
ADDMSG(&mage->faction->msgs, msg_message(
|
||||
"analyse_region_noage", "mage region spell",
|
||||
"analyse_region_noage", "mage region curse",
|
||||
mage, r, LOC(lang, mkname("spell", c->type->cname))));
|
||||
} else {
|
||||
ADDMSG(&mage->faction->msgs, msg_message(
|
||||
"analyse_region_age", "mage region spell months",
|
||||
"analyse_region_age", "mage region curse months",
|
||||
mage, r, LOC(lang, mkname("spell", c->type->cname)), mon));
|
||||
}
|
||||
} else {
|
||||
|
@ -236,11 +236,11 @@ magicanalyse_unit(unit *u, unit *mage, double force)
|
|||
if (chance(probability)) { /* Analyse geglückt */
|
||||
if(c->flag & CURSE_NOAGE){
|
||||
ADDMSG(&mage->faction->msgs, msg_message(
|
||||
"analyse_unit_noage", "mage unit spell",
|
||||
"analyse_unit_noage", "mage unit curse",
|
||||
mage, u, LOC(lang, mkname("spell", c->type->cname))));
|
||||
}else{
|
||||
ADDMSG(&mage->faction->msgs, msg_message(
|
||||
"analyse_unit_age", "mage unit spell months",
|
||||
"analyse_unit_age", "mage unit curse months",
|
||||
mage, u, LOC(lang, mkname("spell", c->type->cname)), mon));
|
||||
}
|
||||
} else {
|
||||
|
@ -278,11 +278,11 @@ magicanalyse_building(building *b, unit *mage, double force)
|
|||
if (chance(probability)) { /* Analyse geglückt */
|
||||
if(c->flag & CURSE_NOAGE){
|
||||
ADDMSG(&mage->faction->msgs, msg_message(
|
||||
"analyse_building_age", "mage building spell",
|
||||
"analyse_building_age", "mage building curse",
|
||||
mage, b, LOC(lang, mkname("spell", c->type->cname))));
|
||||
}else{
|
||||
ADDMSG(&mage->faction->msgs, msg_message(
|
||||
"analyse_building_age", "mage building spell months",
|
||||
"analyse_building_age", "mage building curse months",
|
||||
mage, b, LOC(lang, mkname("spell", c->type->cname)), mon));
|
||||
}
|
||||
} else {
|
||||
|
@ -320,11 +320,11 @@ magicanalyse_ship(ship *sh, unit *mage, double force)
|
|||
if (chance(probability)) { /* Analyse geglückt */
|
||||
if(c->flag & CURSE_NOAGE){
|
||||
ADDMSG(&mage->faction->msgs, msg_message(
|
||||
"analyse_ship_noage", "mage ship spell",
|
||||
"analyse_ship_noage", "mage ship curse",
|
||||
mage, sh, LOC(lang, mkname("spell", c->type->cname))));
|
||||
}else{
|
||||
ADDMSG(&mage->faction->msgs, msg_message(
|
||||
"analyse_ship_age", "mage ship spell months",
|
||||
"analyse_ship_age", "mage ship curse months",
|
||||
mage, sh, LOC(lang, mkname("spell", c->type->cname)), mon));
|
||||
}
|
||||
} else {
|
||||
|
@ -8534,7 +8534,7 @@ static spell spelldaten[] =
|
|||
},
|
||||
{
|
||||
SPL_DRAIG_DESTROY_MAGIC, "draigdestroymagic", NULL,
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Pentagramm\' REGIONn"
|
||||
"ZAUBERE [REGION x y] [STUFE n] \'Pentagramm\' REGION\n"
|
||||
"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>",
|
||||
|
|
|
@ -1025,7 +1025,7 @@
|
|||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
<arg name="ship" type="ship"/>
|
||||
<arg name="spell" type="string"/>
|
||||
<arg name="curse" type="string"/>
|
||||
<arg name="months" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) fand heraus, dass auf $ship($ship) der Zauber $spell liegt, der noch etwa $int($months) Wochen bestehen bleibt."</text>
|
||||
|
@ -1036,7 +1036,7 @@
|
|||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
<arg name="building" type="building"/>
|
||||
<arg name="spell" type="string"/>
|
||||
<arg name="curse" type="string"/>
|
||||
<arg name="months" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) fand heraus, dass auf $building($building) der Zauber $spell liegt, der noch etwa $int($months) Wochen bestehen bleibt."</text>
|
||||
|
@ -1047,7 +1047,7 @@
|
|||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="spell" type="string"/>
|
||||
<arg name="curse" type="string"/>
|
||||
<arg name="months" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) fand heraus, dass auf $unit($unit) der Zauber $spell liegt, der noch etwa $int($months) Wochen bestehen bleibt."</text>
|
||||
|
@ -1058,7 +1058,7 @@
|
|||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
<arg name="region" type="region"/>
|
||||
<arg name="spell" type="string"/>
|
||||
<arg name="curse" type="string"/>
|
||||
<arg name="months" type="int"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) fand heraus, dass auf $region($region) der Zauber $spell liegt, der noch etwa $int($months) Wochen bestehen bleibt."</text>
|
||||
|
@ -1069,7 +1069,7 @@
|
|||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
<arg name="ship" type="ship"/>
|
||||
<arg name="spell" type="string"/>
|
||||
<arg name="curse" type="string"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) fand heraus, dass auf $ship($ship) der Zauber $spell liegt, dessen Kraft ausreicht, um noch Jahrhunderte bestehen zu bleiben."</text>
|
||||
<text locale="fr">"$unit($mage) discovers that $ship($ship) is charmed with $spell, which will last for centuries."</text>
|
||||
|
@ -1079,7 +1079,7 @@
|
|||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
<arg name="building" type="building"/>
|
||||
<arg name="spell" type="string"/>
|
||||
<arg name="curse" type="string"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) fand heraus, dass auf $building($building) der Zauber $spell liegt, dessen Kraft ausreicht, um noch Jahrhunderte bestehen zu bleiben."</text>
|
||||
<text locale="fr">"$unit($mage) discovers that $building($building) is charmed with $spell, which will last for centuries."</text>
|
||||
|
@ -1089,7 +1089,7 @@
|
|||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
<arg name="unit" type="unit"/>
|
||||
<arg name="spell" type="string"/>
|
||||
<arg name="curse" type="string"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) fand heraus, dass auf $unit($unit) der Zauber $spell liegt, dessen Kraft ausreicht, um noch Jahrhunderte bestehen zu bleiben."</text>
|
||||
<text locale="fr">"$unit($mage) discovers that $unit($unit) is charmed with $spell, which will last for centuries."</text>
|
||||
|
@ -1099,7 +1099,7 @@
|
|||
<type>
|
||||
<arg name="mage" type="unit"/>
|
||||
<arg name="region" type="region"/>
|
||||
<arg name="spell" type="string"/>
|
||||
<arg name="curse" type="string"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($mage) fand heraus, dass auf $region($region) der Zauber $spell liegt, dessen Kraft ausreicht, um noch Jahrhunderte bestehen zu bleiben."</text>
|
||||
<text locale="fr">"$unit($mage) discovers that $region($region) is charmed with $spell, which will last for centuries."</text>
|
||||
|
@ -1274,8 +1274,8 @@
|
|||
<arg name="region" type="region"/>
|
||||
<arg name="spell" type="spell"/>
|
||||
</type>
|
||||
<text locale="de">"$unit($unit) unterläuft in $region($region) beim Zaubern von $spell ein Patzer:"</text>
|
||||
<text locale="en">"$unit($unit) fumbles while casting $spell in $region($region):"</text>
|
||||
<text locale="de">"$unit($unit) unterläuft in $region($region) beim Zaubern von $spell($spell) ein Patzer:"</text>
|
||||
<text locale="en">"$unit($unit) fumbles while casting $spell($spell) in $region($region):"</text>
|
||||
</message>
|
||||
<message name="patzer3" section="magic">
|
||||
<type>
|
||||
|
|
Loading…
Reference in a new issue