new_race ist schneller als old_race

This commit is contained in:
Enno Rehling 2005-05-27 21:04:13 +00:00
parent 20bf8c2052
commit d8b7f5a32d
9 changed files with 24 additions and 24 deletions

View File

@ -513,7 +513,7 @@ build_road(region * r, unit * u, int size, direction_t d)
return;
}
}
if (!get_pooled(u, r, R_STONE) && old_race(u->race) != RC_STONEGOLEM) {
if (!get_pooled(u, r, R_STONE) && u->race != new_race[RC_STONEGOLEM]) {
cmistake(u, u->thisorder, 151, MSG_PRODUCE);
return;
}
@ -545,7 +545,7 @@ build_road(region * r, unit * u, int size, direction_t d)
} /* Auswirkung Schaffenstrunk */
/* und anhand der rohstoffe */
if (old_race(u->race) == RC_STONEGOLEM){
if (u->race == new_race[RC_STONEGOLEM]){
n = min(n, u->number * GOLEM_STONE);
} else {
n = use_pooled(u, r, R_STONE, n);
@ -556,7 +556,7 @@ build_road(region * r, unit * u, int size, direction_t d)
* maximum. */
rsetroad(r, d, rroad(r, d) + min(n, left));
if (old_race(u->race) == RC_STONEGOLEM){
if (u->race == new_race[RC_STONEGOLEM]){
int golemsused = n / GOLEM_STONE;
if (n%GOLEM_STONE != 0){
++golemsused;

View File

@ -1548,7 +1548,7 @@ sp_reanimate(fighter * fi, int level, double power, spell * sp)
while (healable--) {
fighter * tf = select_corpse(b, fi);
if (tf!=NULL && tf->side->casualties > 0
&& old_race(tf->unit->race) != RC_DAEMON
&& tf->unit->race != new_race[RC_DAEMON]
&& (chance(c)))
{
assert(tf->alive < tf->unit->number);

View File

@ -524,7 +524,7 @@ max_skill(faction * f, skill_t sk)
} else {
m = MAXMAGICIANS;
}
if (old_race(f->race) == RC_ELF) m += 1;
if (f->race == new_race[RC_ELF]) m += 1;
m += fspecial(f, FS_MAGOCRACY) * 2;
break;
case SK_ALCHEMY:
@ -594,8 +594,8 @@ shipspeed (const ship * sh, const unit * u)
if( curse_active(get_curse(sh->attribs, nodrift_ct)))
k += 1;
if (old_race(u->faction->race) == RC_AQUARIAN
&& old_race(u->race) == RC_AQUARIAN) {
if (u->faction->race == new_race[RC_AQUARIAN]
&& u->race == new_race[RC_AQUARIAN]) {
k += 1;
}
@ -737,7 +737,7 @@ verify_data(void)
log_warning(("Einheit %s hat %d Personen\n", unitid(u), u->number));
}
}
if (f->no != 0 && ((mage > 3 && old_race(f->race) != RC_ELF) || mage > 4))
if (f->no != 0 && ((mage > 3 && f->race != new_race[RC_ELF]) || mage > 4))
log_error(("Partei %s hat %d Magier.\n", factionid(f), mage));
if (alchemist > 3)
log_error(("Partei %s hat %d Alchemisten.\n", factionid(f), alchemist));
@ -1242,7 +1242,7 @@ int
count_maxmigrants(const faction * f)
{
int x = 0;
if (old_race(f->race) == RC_HUMAN) {
if (f->race == new_race[RC_HUMAN]) {
int nsize = count_all(f);
if (nsize>0) {
x = (int)(log10(nsize / 50.0) * 20);
@ -2705,7 +2705,7 @@ lifestyle(const unit * u)
need += 1;
if(fspecial(u->faction, FS_ADMINISTRATOR))
need += 1;
if(fspecial(u->faction, FS_WYRM) && old_race(u->race) == RC_WYRM)
if(fspecial(u->faction, FS_WYRM) && u->race == new_race[RC_WYRM])
need *= 500;
return need;
@ -2719,7 +2719,7 @@ hunger(int number, unit * u)
int hp = u->hp / u->number;
while (number--) {
int dam = old_race(u->race)==RC_HALFLING?15+rand()%14:(13+rand()%12);
int dam = u->race==new_race[RC_HALFLING]?15+rand()%14:(13+rand()%12);
if (dam >= hp) {
++dead;
} else {
@ -2886,7 +2886,7 @@ fwage(const region *r, const faction *f, boolean img)
if (b) esize = buildingeffsize(b, img);
if (f) {
wage = wagetable[esize][old_race(f->race) == RC_ORC];
wage = wagetable[esize][f->race == new_race[RC_ORC]];
if (fspecial(f, FS_URBAN)) {
wage += wagetable[esize][3];
}

View File

@ -142,7 +142,7 @@ addplayer(region *r, faction * f)
u = createunit(r, f, 1, f->race);
give_starting_equipment(r, u);
fset(u, UFL_ISNEW);
if (old_race(f->race) == RC_DAEMON) {
if (f->race == new_race[RC_DAEMON]) {
race_t urc;
do
urc = (race_t)(rand() % MAXRACES);

View File

@ -117,12 +117,12 @@ int
res_changeitem(unit * u, const resource_type * rtype, int delta)
{
int num;
if (rtype == oldresourcetype[R_STONE] && old_race(u->race)==RC_STONEGOLEM && delta<=0) {
if (rtype == oldresourcetype[R_STONE] && u->race==new_race[RC_STONEGOLEM] && delta<=0) {
int reduce = delta / GOLEM_STONE;
if (delta % GOLEM_STONE != 0) --reduce;
scale_number(u, u->number+reduce);
num = u->number;
} else if (rtype == oldresourcetype[R_IRON] && old_race(u->race) == RC_IRONGOLEM && delta<=0) {
} else if (rtype == oldresourcetype[R_IRON] && u->race==new_race[RC_IRONGOLEM] && delta<=0) {
int reduce = delta / GOLEM_IRON;
if (delta % GOLEM_IRON != 0) --reduce;
scale_number(u, u->number+reduce);

View File

@ -207,10 +207,10 @@ personcapacity(const unit *u)
#else
int cap = u->race->weight+540;
if (old_race(u->race) == RC_TROLL)
if (u->race == new_race[RC_TROLL])
cap += 540;
#if RACE_ADJUSTMENTS
else if(old_race(u->race) == RC_GOBLIN)
else if (u->race == new_race[RC_GOBLIN])
cap -= 100;
#endif
#endif
@ -281,7 +281,7 @@ walkingcapacity(const struct unit * u)
n = wagen_mit_pferden * WAGONCAPACITY;
if (old_race(u->race) == RC_TROLL) {
if (u->race == new_race[RC_TROLL]) {
/* 4 Trolle ziehen einen Wagen. */
/* Unbesetzte Wagen feststellen */
wagen_ohne_pferde = wagen - wagen_mit_pferden;
@ -329,7 +329,7 @@ canwalk(unit * u)
pferde = get_item(u, I_HORSE);
maxwagen = effskill(u, SK_RIDING) * u->number * 2;
if (old_race(u->race) == RC_TROLL) {
if (u->race == new_race[RC_TROLL]) {
maxwagen = max(maxwagen, u->number / 4);
}
maxpferde = effskill(u, SK_RIDING) * u->number * 4 + u->number;
@ -622,7 +622,7 @@ check_working_buildingtype(const region * r, const building_type * bt)
static boolean
is_freezing(const unit * u)
{
if (old_race(u->race)!=RC_INSECT) return false;
if (u->race!=new_race[RC_INSECT]) return false;
if (is_cursed(u->attribs, C_KAELTESCHUTZ, 0)) return false;
return true;
}
@ -1287,7 +1287,7 @@ travel_route(unit * u, region_list * route_begin, region_list * route_end, order
}
/* unit is an insect and cannot move into a glacier */
if (old_race(u->race)==RC_INSECT) {
if (u->race==new_race[RC_INSECT]) {
if (r_insectstalled(next) && is_freezing(u)) {
ADDMSG(&u->faction->msgs, msg_message("detectforbidden",
"unit region", u, next));

View File

@ -471,7 +471,7 @@ unitorders(FILE * F, struct faction * f)
i = getid();
u = findunitg(i, NULL);
if (u && old_race(u->race) == RC_SPELL) return NULL;
if (u && u->race == new_race[RC_SPELL]) return NULL;
if (u && u->faction == f) {
order ** ordp;

View File

@ -1733,7 +1733,7 @@ sp_great_drought(castorder *co)
rsetterrain(r, T_OCEAN);
/* Einheiten dürfen hier auf keinen Fall gelöscht werden! */
for (u = r->units; u; u = u->next) {
if (old_race(u->race) != RC_SPELL && u->ship == 0) {
if (u->race != new_race[RC_SPELL] && u->ship == 0) {
set_number(u, 0);
}
}

View File

@ -858,7 +858,7 @@ set_number(unit * u, int count)
assert (u->faction != 0 || u->number > 0);
#endif
if (u->faction && u->race != u->faction->race && playerrace(u->race)
&& old_race(u->race) != RC_SPELL && old_race(u->race) != RC_SPECIAL
&& u->race != new_race[RC_SPELL] && u->race != new_race[RC_SPECIAL]
&& !(is_cursed(u->attribs, C_SLAVE, 0)))
{
u->faction->num_migrants += count - u->number;