Crashfixes for incompletely read data files (Debug support)

This commit is contained in:
Enno Rehling 2004-09-05 12:29:46 +00:00
parent fa0114b64c
commit f596ea5a8d
3 changed files with 17 additions and 15 deletions

View File

@ -190,7 +190,6 @@ static void
expandrecruit(region * r, request * recruitorders) expandrecruit(region * r, request * recruitorders)
{ {
/* Rekrutierung */ /* Rekrutierung */
int i, n, p = rpeasants(r), h = rhorses(r), uruks = 0; int i, n, p = rpeasants(r), h = rhorses(r), uruks = 0;
int rfrac = p / RECRUITFRACTION; int rfrac = p / RECRUITFRACTION;
unit * u; unit * u;
@ -293,6 +292,7 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
plane * pl; plane * pl;
request *o; request *o;
int recruitcost; int recruitcost;
const struct race * rc = u->faction->race;
#if GUARD_DISABLES_RECRUIT == 1 #if GUARD_DISABLES_RECRUIT == 1
/* this is a very special case because the recruiting unit may be empty /* this is a very special case because the recruiting unit may be empty
@ -304,7 +304,7 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
} }
#endif #endif
if (u->faction->race == new_race[RC_INSECT]) { if (rc == new_race[RC_INSECT]) {
if (month_season[month(0)] == 0 && rterrain(r) != T_DESERT) { if (month_season[month(0)] == 0 && rterrain(r) != T_DESERT) {
#ifdef INSECT_POTION #ifdef INSECT_POTION
boolean usepotion = false; boolean usepotion = false;
@ -334,11 +334,11 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
return; return;
} }
if (!(u->faction->race->ec_flags & ECF_REC_HORSES) && fval(r, RF_ORCIFIED)) { if (!(rc->ec_flags & ECF_REC_HORSES) && fval(r, RF_ORCIFIED)) {
#if RACE_ADJUSTMENTS #if RACE_ADJUSTMENTS
if (u->faction->race != new_race[RC_URUK]) if (rc != new_race[RC_URUK])
#else #else
if (u->faction->race != new_race[RC_ORC]) if (rc != new_race[RC_ORC])
#endif #endif
{ {
cmistake(u, ord, 238, MSG_EVENT); cmistake(u, ord, 238, MSG_EVENT);
@ -346,7 +346,7 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
} }
} }
recruitcost = u->faction->race->recruitcost; recruitcost = rc->recruitcost;
if (recruitcost) { if (recruitcost) {
pl = getplane(r); pl = getplane(r);
if (pl && fval(pl, PFL_NORECRUITS)) { if (pl && fval(pl, PFL_NORECRUITS)) {
@ -366,12 +366,12 @@ recruit(unit * u, struct order * ord, request ** recruitorders)
} }
/* snotlinge sollten hiermit bereits abgefangen werden, die /* snotlinge sollten hiermit bereits abgefangen werden, die
* parteirasse ist uruk oder ork*/ * parteirasse ist uruk oder ork*/
if (u->race != u->faction->race) { if (u->race != rc) {
if (u->number != 0) { if (u->number != 0) {
cmistake(u, ord, 139, MSG_EVENT); cmistake(u, ord, 139, MSG_EVENT);
return; return;
} }
else u->race = u->faction->race; else u->race = rc;
} }
init_tokens(ord); init_tokens(ord);

View File

@ -2489,7 +2489,7 @@ magic(void)
if (sp == NULL && is_familiar(u)) { if (sp == NULL && is_familiar(u)) {
familiar = u; familiar = u;
mage = get_familiar_mage(u); mage = get_familiar_mage(u);
sp = find_spellbyname(mage, s, mage->faction->locale); if (mage!=NULL) sp = find_spellbyname(mage, s, mage->faction->locale);
} }
if (sp == NULL) { if (sp == NULL) {

View File

@ -78,6 +78,7 @@ wormhole_age(struct attrib * a)
if (teure_talente(u)) continue; if (teure_talente(u)) continue;
if (u->building!=data->entry) continue; if (u->building!=data->entry) continue;
if (data->exit!=NULL) {
move_unit(u, data->exit->region, NULL); move_unit(u, data->exit->region, NULL);
maxtransport -= u->number; maxtransport -= u->number;
m = msg_message("wormhole_exit", "unit region", u, data->exit->region); m = msg_message("wormhole_exit", "unit region", u, data->exit->region);
@ -85,6 +86,7 @@ wormhole_age(struct attrib * a)
add_message(&u->faction->msgs, m); add_message(&u->faction->msgs, m);
msg_release(m); msg_release(m);
} }
}
/* it's important that destroy_building doesn't change b->region, because /* it's important that destroy_building doesn't change b->region, because
* otherwise the tunnel would no longer be bi-directional after this */ * otherwise the tunnel would no longer be bi-directional after this */