eliminate another call to old_race.

This commit is contained in:
Enno Rehling 2016-09-19 18:28:44 +02:00
parent 1f100a1b6c
commit 043ff40d02
1 changed files with 16 additions and 14 deletions

View File

@ -2731,21 +2731,23 @@ static int sp_firewall(castorder * co)
*/ */
static race *unholy_race(const race *rc) { static race *unholy_race(const race *rc) {
race *target_race = NULL; static int cache;
switch (old_race(rc)) { static race * rc_skeleton, *rc_zombie, *rc_ghoul;
case RC_SKELETON: if (rc_changed(&cache)) {
target_race = get_race(RC_SKELETON_LORD); rc_skeleton = get_race(RC_SKELETON);
break; rc_zombie = get_race(RC_ZOMBIE);
case RC_ZOMBIE: rc_ghoul = get_race(RC_GHOUL);
target_race = get_race(RC_ZOMBIE_LORD);
break;
case RC_GHOUL:
target_race = get_race(RC_GHOUL_LORD);
break;
default:
target_race = NULL;
} }
return target_race; if (rc == rc_skeleton) {
return get_race(RC_SKELETON_LORD);
}
if (rc == rc_zombie) {
return get_race(RC_ZOMBIE_LORD);
}
if (rc == rc_ghoul) {
return get_race(RC_GHOUL_LORD);
}
return NULL;
} }
static int sp_unholypower(castorder * co) static int sp_unholypower(castorder * co)