Fixed a null-pointer crash in randenc.

Dead code in economy removed.
This commit is contained in:
Enno Rehling 2005-10-02 07:33:21 +00:00
parent e240860486
commit dd9c6e50c2
2 changed files with 13 additions and 20 deletions

View File

@ -1001,15 +1001,6 @@ gebaeude_stuerzt_ein(region * r, building * b)
} }
} }
/* Falls Karawanserei, Damm oder Tunnel einstürzen, wird die schon
* gebaute Straße zur Hälfte vernichtet */
if (b->type == bt_find("caravan") || b->type == bt_find("dam") || b->type == bt_find("tunnel")) {
for (d=0;d!=MAXDIRECTIONS;++d) if (rroad(r, d) > 0) {
road = 1;
/* vernichtung findet erst in destroy_building statt! */
break;
}
}
msg = msg_message("buildingcrash", "region building opfer road", r, b, opfer, road); msg = msg_message("buildingcrash", "region building opfer road", r, b, opfer, road);
add_message(&r->msgs, msg); add_message(&r->msgs, msg);
for (u=r->units; u; u=u->next) { for (u=r->units; u; u=u->next) {

View File

@ -455,19 +455,21 @@ get_allies(region * r, unit * u)
break; break;
} }
u_setfaction(newunit, u->faction); if (newunit!=NULL) {
set_racename(&newunit->attribs, get_racename(u->attribs)); u_setfaction(newunit, u->faction);
if(u->race->flags & RCF_SHAPESHIFT) { set_racename(&newunit->attribs, get_racename(u->attribs));
newunit->irace = u->irace; if(u->race->flags & RCF_SHAPESHIFT) {
} newunit->irace = u->irace;
if (fval(u, UFL_PARTEITARNUNG)) fset(newunit, UFL_PARTEITARNUNG); }
fset(newunit, UFL_ISNEW); if (fval(u, UFL_PARTEITARNUNG)) fset(newunit, UFL_PARTEITARNUNG);
fset(newunit, UFL_ISNEW);
sprintf(buf, "Plötzlich stolper%c %s über einige %s. Nach kurzem " sprintf(buf, "Plötzlich stolper%c %s über einige %s. Nach kurzem "
"Zögern entschließen sich die %s, sich Deiner Partei anzuschließen.", "Zögern entschließen sich die %s, sich Deiner Partei anzuschließen.",
u->number == 1 ? 't' : 'n', unitname(u), newunit->name, newunit->name); u->number == 1 ? 't' : 'n', unitname(u), newunit->name, newunit->name);
addmessage(r, u->faction, buf, MSG_EVENT, ML_IMPORTANT); addmessage(r, u->faction, buf, MSG_EVENT, ML_IMPORTANT);
}
} }
static void static void