forked from github/server
eliminate new_race array in favor of a function (TODO: make it fast)
This commit is contained in:
parent
11a264742b
commit
c3dfbdea18
37 changed files with 289 additions and 260 deletions
|
@ -1534,7 +1534,7 @@ report_computer(const char *filename, report_context * ctx, const char *charset)
|
|||
fprintf(F, "%d;Anzahl Personen\n", count_all(f));
|
||||
fprintf(F, "\"%s\";Magiegebiet\n", magic_school[f->magiegebiet]);
|
||||
|
||||
if (f->race == new_race[RC_HUMAN]) {
|
||||
if (f->race == get_race(RC_HUMAN)) {
|
||||
fprintf(F, "%d;Anzahl Immigranten\n", count_migrants(f));
|
||||
fprintf(F, "%d;Max. Immigranten\n", count_maxmigrants(f));
|
||||
}
|
||||
|
|
|
@ -530,7 +530,7 @@ static void recruit(unit * u, struct order *ord, request ** recruitorders)
|
|||
}
|
||||
#endif
|
||||
|
||||
if (rc == new_race[RC_INSECT]) {
|
||||
if (rc == get_race(RC_INSECT)) {
|
||||
gamedate date;
|
||||
get_gamedate(turn, &date);
|
||||
if (date.season == 0 && r->terrain != newterrain(T_DESERT)) {
|
||||
|
@ -563,7 +563,7 @@ static void recruit(unit * u, struct order *ord, request ** recruitorders)
|
|||
}
|
||||
|
||||
if (!(rc->ec_flags & ECF_REC_HORSES) && fval(r, RF_ORCIFIED)) {
|
||||
if (rc != new_race[RC_ORC]) {
|
||||
if (rc != get_race(RC_ORC)) {
|
||||
cmistake(u, ord, 238, MSG_EVENT);
|
||||
return;
|
||||
}
|
||||
|
@ -755,7 +755,7 @@ static void give_cmd(unit * u, order * ord)
|
|||
return;
|
||||
}
|
||||
|
||||
if (u2 && u_race(u2) == new_race[RC_SPELL]) {
|
||||
if (u2 && u_race(u2) == get_race(RC_SPELL)) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "feedback_unit_not_found",
|
||||
""));
|
||||
return;
|
||||
|
@ -1967,7 +1967,7 @@ static void buy(unit * u, request ** buyorders, struct order *ord)
|
|||
return;
|
||||
}
|
||||
|
||||
if (u_race(u) == new_race[RC_INSECT]) {
|
||||
if (u_race(u) == get_race(RC_INSECT)) {
|
||||
/* entweder man ist insekt, oder... */
|
||||
if (r->terrain != newterrain(T_SWAMP) && r->terrain != newterrain(T_DESERT)
|
||||
&& !rbuildings(r)) {
|
||||
|
@ -2271,7 +2271,7 @@ static bool sell(unit * u, request ** sellorders, struct order *ord)
|
|||
}
|
||||
/* In der Region muß es eine Burg geben. */
|
||||
|
||||
if (u_race(u) == new_race[RC_INSECT]) {
|
||||
if (u_race(u) == get_race(RC_INSECT)) {
|
||||
if (r->terrain != newterrain(T_SWAMP) && r->terrain != newterrain(T_DESERT)
|
||||
&& !rbuildings(r)) {
|
||||
cmistake(u, ord, 119, MSG_COMMERCE);
|
||||
|
@ -2766,7 +2766,7 @@ static void steal_cmd(unit * u, struct order *ord, request ** stealorders)
|
|||
return;
|
||||
}
|
||||
|
||||
if (fval(r->terrain, SEA_REGION) && u_race(u) != new_race[RC_AQUARIAN]) {
|
||||
if (fval(r->terrain, SEA_REGION) && u_race(u) != get_race(RC_AQUARIAN)) {
|
||||
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "error_onlandonly", ""));
|
||||
return;
|
||||
}
|
||||
|
@ -2820,7 +2820,7 @@ static void steal_cmd(unit * u, struct order *ord, request ** stealorders)
|
|||
|
||||
if (n <= 0) {
|
||||
/* Wahrnehmung == Tarnung */
|
||||
if (u_race(u) != new_race[RC_GOBLIN] || eff_skill(u, SK_STEALTH, r) <= 3) {
|
||||
if (u_race(u) != get_race(RC_GOBLIN) || eff_skill(u, SK_STEALTH, r) <= 3) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("stealfail", "unit target", u, u2));
|
||||
if (n == 0) {
|
||||
ADDMSG(&u2->faction->msgs, msg_message("stealdetect", "unit", u2));
|
||||
|
@ -3227,10 +3227,10 @@ void produce(struct region *r)
|
|||
order *ord;
|
||||
bool trader = false;
|
||||
|
||||
if (u_race(u) == new_race[RC_SPELL] || fval(u, UFL_LONGACTION))
|
||||
if (u_race(u) == get_race(RC_SPELL) || fval(u, UFL_LONGACTION))
|
||||
continue;
|
||||
|
||||
if (u_race(u) == new_race[RC_INSECT] && r_insectstalled(r) &&
|
||||
if (u_race(u) == get_race(RC_INSECT) && r_insectstalled(r) &&
|
||||
!is_cursed(u->attribs, C_KAELTESCHUTZ, 0))
|
||||
continue;
|
||||
|
||||
|
@ -3266,7 +3266,7 @@ void produce(struct region *r)
|
|||
if (todo == NOKEYWORD)
|
||||
continue;
|
||||
|
||||
if (fval(r->terrain, SEA_REGION) && u_race(u) != new_race[RC_AQUARIAN]
|
||||
if (fval(r->terrain, SEA_REGION) && u_race(u) != get_race(RC_AQUARIAN)
|
||||
&& !(u_race(u)->flags & RCF_SWIM)
|
||||
&& todo != K_STEAL && todo != K_SPY && todo != K_SABOTAGE)
|
||||
continue;
|
||||
|
|
|
@ -188,7 +188,8 @@ void give_men(int n, unit * u, unit * u2, struct order *ord)
|
|||
return;
|
||||
} else if (u == u2) {
|
||||
error = 10;
|
||||
} else if (!u2 && u_race(u) == new_race[RC_SNOTLING]) {
|
||||
}
|
||||
else if (!u2 && u_race(u) == get_race(RC_SNOTLING)) {
|
||||
/* snotlings may not be given to the peasants. */
|
||||
error = 307;
|
||||
} else if (u2 && u2->number && (fval(u, UFL_HERO) != fval(u2, UFL_HERO))) {
|
||||
|
@ -236,7 +237,7 @@ void give_men(int n, unit * u, unit * u2, struct order *ord)
|
|||
if (u2->faction->newbies + n > MAXNEWBIES) {
|
||||
error = 129;
|
||||
} else if (u_race(u) != u2->faction->race) {
|
||||
if (u2->faction->race != new_race[RC_HUMAN]) {
|
||||
if (u2->faction->race != get_race(RC_HUMAN)) {
|
||||
error = 120;
|
||||
} else if (count_migrants(u2->faction) + n >
|
||||
count_maxmigrants(u2->faction)) {
|
||||
|
@ -298,7 +299,7 @@ void give_men(int n, unit * u, unit * u2, struct order *ord)
|
|||
} else {
|
||||
if (getunitpeasants) {
|
||||
#ifdef ORCIFICATION
|
||||
if (u_race(u) == new_race[RC_SNOTLING] && !fval(u->region, RF_ORCIFIED)) {
|
||||
if (u_race(u) == get_race(RC_SNOTLING) && !fval(u->region, RF_ORCIFIED)) {
|
||||
attrib *a = a_find(u->region->attribs, &at_orcification);
|
||||
if (!a)
|
||||
a = a_add(&u->region->attribs, a_new(&at_orcification));
|
||||
|
@ -393,7 +394,7 @@ void give_unit(unit * u, unit * u2, order * ord)
|
|||
return;
|
||||
}
|
||||
if (u_race(u) != u2->faction->race) {
|
||||
if (u2->faction->race != new_race[RC_HUMAN]) {
|
||||
if (u2->faction->race != get_race(RC_HUMAN)) {
|
||||
cmistake(u, ord, 120, MSG_COMMERCE);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -620,7 +620,7 @@ weapon_skill(const weapon_type * wtype, const unit * u, bool attacking)
|
|||
skill = effskill(u, SK_WEAPONLESS);
|
||||
if (skill <= 0) {
|
||||
/* wenn kein waffenloser kampf, dann den rassen-defaultwert */
|
||||
if (u_race(u) == new_race[RC_ORC]) {
|
||||
if (u_race(u) == get_race(RC_ORC)) {
|
||||
int sword = effskill(u, SK_MELEE);
|
||||
int spear = effskill(u, SK_SPEAR);
|
||||
skill = _max(sword, spear) - 3;
|
||||
|
@ -709,7 +709,7 @@ static int CavalryBonus(const unit * u, troop enemy, int type)
|
|||
if (skl > 0) {
|
||||
if (type == BONUS_DAMAGE) {
|
||||
int dmg = _min(skl, 8);
|
||||
if (u_race(enemy.fighter->unit) == new_race[RC_TROLL]) {
|
||||
if (u_race(enemy.fighter->unit) == get_race(RC_TROLL)) {
|
||||
dmg = dmg / 4;
|
||||
} else {
|
||||
dmg = dmg / 2;
|
||||
|
@ -1264,7 +1264,7 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
|
|||
|
||||
assert(dt.index < du->number);
|
||||
df->person[dt.index].hp -= rda;
|
||||
if (u_race(au) == new_race[RC_DAEMON]) {
|
||||
if (u_race(au) == get_race(RC_DAEMON)) {
|
||||
vampirism(at, rda);
|
||||
}
|
||||
|
||||
|
@ -1273,7 +1273,7 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
|
|||
fprintf(bdebug, "Damage %d, armor %d: %d -> %d HP\n",
|
||||
da, ar, df->person[dt.index].hp + rda, df->person[dt.index].hp);
|
||||
}
|
||||
if (u_race(au) == new_race[RC_DAEMON]) {
|
||||
if (u_race(au) == get_race(RC_DAEMON)) {
|
||||
#ifdef TODO_RUNESWORD
|
||||
if (select_weapon(dt, 0, -1) == WP_RUNESWORD)
|
||||
continue;
|
||||
|
@ -1288,7 +1288,7 @@ terminate(troop dt, troop at, int type, const char *damage, bool missile)
|
|||
}
|
||||
|
||||
/* Sieben Leben */
|
||||
if (u_race(du) == new_race[RC_CAT] && (chance(1.0 / 7))) {
|
||||
if (u_race(du) == get_race(RC_CAT) && (chance(1.0 / 7))) {
|
||||
assert(dt.index >= 0 && dt.index < du->number);
|
||||
df->person[dt.index].hp = unit_max_hp(du);
|
||||
return false;
|
||||
|
@ -1847,11 +1847,11 @@ int skilldiff(troop at, troop dt, int dist)
|
|||
skdiff += 2;
|
||||
|
||||
/* Effekte durch Rassen */
|
||||
if (awp != NULL && u_race(au) == new_race[RC_HALFLING] && dragonrace(u_race(du))) {
|
||||
if (awp != NULL && u_race(au) == get_race(RC_HALFLING) && dragonrace(u_race(du))) {
|
||||
skdiff += 5;
|
||||
}
|
||||
|
||||
if (u_race(au) == new_race[RC_GOBLIN]) {
|
||||
if (u_race(au) == get_race(RC_GOBLIN)) {
|
||||
static int goblin_bonus = -1;
|
||||
if (goblin_bonus < 0)
|
||||
goblin_bonus =
|
||||
|
@ -2355,7 +2355,7 @@ double fleechance(unit * u)
|
|||
c += (eff_skill(u, SK_STEALTH, r) * 0.05);
|
||||
c += horsebonus(u);
|
||||
|
||||
if (u_race(u) == new_race[RC_HALFLING]) {
|
||||
if (u_race(u) == get_race(RC_HALFLING)) {
|
||||
c += 0.20;
|
||||
c = _min(c, 0.90);
|
||||
} else {
|
||||
|
@ -3408,18 +3408,18 @@ fighter *make_fighter(battle * b, unit * u, side * s1, bool attack)
|
|||
if (fig->horses) {
|
||||
if (!fval(r->terrain, CAVALRY_REGION) || r_isforest(r)
|
||||
|| eff_skill(u, SK_RIDING, r) < CavalrySkill()
|
||||
|| u_race(u) == new_race[RC_TROLL] || fval(u, UFL_WERE))
|
||||
|| u_race(u) == get_race(RC_TROLL) || fval(u, UFL_WERE))
|
||||
fig->horses = 0;
|
||||
}
|
||||
|
||||
if (fig->elvenhorses) {
|
||||
if (eff_skill(u, SK_RIDING, r) < 5 || u_race(u) == new_race[RC_TROLL]
|
||||
if (eff_skill(u, SK_RIDING, r) < 5 || u_race(u) == get_race(RC_TROLL)
|
||||
|| fval(u, UFL_WERE))
|
||||
fig->elvenhorses = 0;
|
||||
}
|
||||
|
||||
/* Schauen, wie gut wir in Taktik sind. */
|
||||
if (tactics > 0 && u_race(u) == new_race[RC_INSECT])
|
||||
if (tactics > 0 && u_race(u) == get_race(RC_INSECT))
|
||||
tactics -= 1 - (int)log10(fig->side->size[SUM_ROW]);
|
||||
#ifdef TACTICS_MODIFIER
|
||||
if (tactics > 0 && statusrow(fig->status) == FIGHT_ROW)
|
||||
|
@ -4187,7 +4187,7 @@ static void battle_flee(battle * b)
|
|||
/* keine Flucht von Schiffen auf hoher See */
|
||||
continue;
|
||||
}
|
||||
if (fval(u_race(u), RCF_UNDEAD) || u_race(u) == new_race[RC_SHADOWKNIGHT]) {
|
||||
if (fval(u_race(u), RCF_UNDEAD) || u_race(u) == get_race(RC_SHADOWKNIGHT)) {
|
||||
/* Untote fliehen nicht. Warum eigentlich? */
|
||||
continue;
|
||||
}
|
||||
|
|
|
@ -312,7 +312,7 @@ void build_road(region * r, unit * u, int size, direction_t d)
|
|||
if (size > 0)
|
||||
left = _min(size, left);
|
||||
/* baumaximum anhand der rohstoffe */
|
||||
if (u_race(u) == new_race[RC_STONEGOLEM]) {
|
||||
if (u_race(u) == get_race(RC_STONEGOLEM)) {
|
||||
n = u->number * GOLEM_STONE;
|
||||
} else {
|
||||
n = get_pooled(u, get_resourcetype(R_STONE), GET_DEFAULT, left);
|
||||
|
@ -353,7 +353,7 @@ void build_road(region * r, unit * u, int size, direction_t d)
|
|||
* maximum. */
|
||||
rsetroad(r, d, rroad(r, d) + (short)n);
|
||||
|
||||
if (u_race(u) == new_race[RC_STONEGOLEM]) {
|
||||
if (u_race(u) == get_race(RC_STONEGOLEM)) {
|
||||
int golemsused = n / GOLEM_STONE;
|
||||
if (n % GOLEM_STONE != 0) {
|
||||
++golemsused;
|
||||
|
|
|
@ -49,7 +49,6 @@ static void test_build_building_with_golem(CuTest *tc) {
|
|||
test_create_world();
|
||||
|
||||
rc = test_create_race("stonegolem");
|
||||
new_race[RC_STONEGOLEM] = rc;
|
||||
rc->flags |= RCF_STONEGOLEM;
|
||||
btype = bt_find("castle");
|
||||
assert(btype && rc);
|
||||
|
|
|
@ -26,6 +26,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
#include "curse.h" /* für C_NOCOST */
|
||||
#include "unit.h"
|
||||
#include "faction.h"
|
||||
#include "race.h"
|
||||
#include "region.h"
|
||||
#include "skill.h"
|
||||
#include "magic.h"
|
||||
|
@ -612,7 +613,7 @@ int bt_effsize(const building_type * btype, const building * b, int bsize)
|
|||
if (b && get_param_int(global.parameters, "rules.dwarf_castles", 0)
|
||||
&& strcmp(btype->_name, "castle") == 0) {
|
||||
unit *u = building_owner(b);
|
||||
if (u && u->faction->race == new_race[RC_HALFLING]) {
|
||||
if (u && u->faction->race == get_race(RC_HALFLING)) {
|
||||
i = bsize * 10 / 8;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,6 @@ struct settings global = {
|
|||
bool lomem = false;
|
||||
FILE *logfile;
|
||||
FILE *updatelog;
|
||||
const struct race *new_race[MAXRACES];
|
||||
bool battledebug = false;
|
||||
int turn = -1;
|
||||
|
||||
|
@ -245,7 +244,7 @@ int LongHunger(const struct unit *u)
|
|||
if (!fval(u, UFL_HUNGER))
|
||||
return false;
|
||||
#ifdef NEW_DAEMONHUNGER_RULE
|
||||
if (u_race(u) == new_race[RC_DAEMON])
|
||||
if (u_race(u) == get_race(RC_DAEMON))
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
@ -284,8 +283,7 @@ race_t old_race(const struct race * rc)
|
|||
{
|
||||
race_t i;
|
||||
for (i = 0; i != MAXRACES; ++i) {
|
||||
if (new_race[i] == rc)
|
||||
return i;
|
||||
if (get_race(i) == rc) return i;
|
||||
}
|
||||
return NORACE;
|
||||
}
|
||||
|
@ -434,7 +432,7 @@ int max_magicians(const faction * f)
|
|||
if ((a = a_find(f->attribs, &at_maxmagicians)) != NULL) {
|
||||
m = a->data.i;
|
||||
}
|
||||
if (f->race == new_race[RC_ELF])
|
||||
if (f->race == get_race(RC_ELF))
|
||||
++m;
|
||||
return m;
|
||||
}
|
||||
|
@ -591,7 +589,7 @@ void verify_data(void)
|
|||
log_warning("Einheit %s hat %d Personen\n", unitid(u), u->number);
|
||||
}
|
||||
}
|
||||
if (f->no != 0 && ((mage > 3 && f->race != new_race[RC_ELF]) || mage > 4))
|
||||
if (f->no != 0 && ((mage > 3 && f->race != get_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);
|
||||
|
@ -1075,7 +1073,7 @@ int count_maxmigrants(const faction * f)
|
|||
}
|
||||
if (migrants == INT_MAX) {
|
||||
int x = 0;
|
||||
if (f->race == new_race[RC_HUMAN]) {
|
||||
if (f->race == get_race(RC_HUMAN)) {
|
||||
int nsize = count_all(f);
|
||||
if (nsize > 0) {
|
||||
x = (int)(log10(nsize / 50.0) * 20);
|
||||
|
@ -2078,8 +2076,8 @@ void remove_empty_units_in_region(region * r)
|
|||
}
|
||||
}
|
||||
}
|
||||
if ((u->number == 0 && u_race(u) != new_race[RC_SPELL]) || (u->age <= 0
|
||||
&& u_race(u) == new_race[RC_SPELL])) {
|
||||
if ((u->number == 0 && u_race(u) != get_race(RC_SPELL)) || (u->age <= 0
|
||||
&& u_race(u) == get_race(RC_SPELL))) {
|
||||
remove_unit(up, u);
|
||||
}
|
||||
if (*up == u)
|
||||
|
@ -2502,7 +2500,7 @@ default_wage(const region * r, const faction * f, const race * rc, int in_turn)
|
|||
|
||||
if (f != NULL) {
|
||||
int index = 0;
|
||||
if (rc == new_race[RC_ORC] || rc == new_race[RC_SNOTLING]) {
|
||||
if (rc == get_race(RC_ORC) || rc == get_race(RC_SNOTLING)) {
|
||||
index = 1;
|
||||
}
|
||||
wage = wagetable[esize][index];
|
||||
|
|
|
@ -371,10 +371,6 @@ int max_magicians(const struct faction * f);
|
|||
|
||||
extern const char *localenames[];
|
||||
|
||||
/** compatibility: **/
|
||||
race_t old_race(const struct race *);
|
||||
extern const struct race *new_race[];
|
||||
|
||||
/* globale settings des Spieles */
|
||||
typedef struct settings {
|
||||
const char *gamename;
|
||||
|
|
|
@ -252,13 +252,14 @@ unit *addplayer(region * r, faction * f)
|
|||
equip_unit(u, get_equipment(buffer));
|
||||
u->hp = unit_max_hp(u) * u->number;
|
||||
fset(u, UFL_ISNEW);
|
||||
if (f->race == new_race[RC_DAEMON]) {
|
||||
if (f->race == get_race(RC_DAEMON)) {
|
||||
race_t urc;
|
||||
race *rc;
|
||||
do {
|
||||
urc = (race_t) (rng_int() % MAXRACES);
|
||||
} while (new_race[urc] == NULL || urc == RC_DAEMON
|
||||
|| !playerrace(new_race[urc]));
|
||||
u->irace = new_race[urc];
|
||||
rc = get_race(urc);
|
||||
} while (rc == NULL || urc == RC_DAEMON || !playerrace(rc));
|
||||
u->irace = rc;
|
||||
}
|
||||
|
||||
return u;
|
||||
|
|
|
@ -103,7 +103,7 @@ static int res_changepeasants(unit * u, const resource_type * rtype, int delta)
|
|||
static int res_changeitem(unit * u, const resource_type * rtype, int delta)
|
||||
{
|
||||
int num;
|
||||
if (rtype == get_resourcetype(R_STONE) && u_race(u) == new_race[RC_STONEGOLEM]
|
||||
if (rtype == get_resourcetype(R_STONE) && u_race(u) == get_race(RC_STONEGOLEM)
|
||||
&& delta <= 0) {
|
||||
int reduce = delta / GOLEM_STONE;
|
||||
if (delta % GOLEM_STONE != 0)
|
||||
|
@ -111,7 +111,7 @@ static int res_changeitem(unit * u, const resource_type * rtype, int delta)
|
|||
scale_number(u, u->number + reduce);
|
||||
num = u->number;
|
||||
} else if (rtype == get_resourcetype(R_IRON)
|
||||
&& u_race(u) == new_race[RC_IRONGOLEM] && delta <= 0) {
|
||||
&& u_race(u) == get_race(RC_IRONGOLEM) && delta <= 0) {
|
||||
int reduce = delta / GOLEM_IRON;
|
||||
if (delta % GOLEM_IRON != 0)
|
||||
--reduce;
|
||||
|
@ -725,7 +725,7 @@ typedef struct t_item {
|
|||
static int
|
||||
mod_elves_only(const unit * u, const region * r, skill_t sk, int value)
|
||||
{
|
||||
if (u_race(u) == new_race[RC_ELF])
|
||||
if (u_race(u) == get_race(RC_ELF))
|
||||
return value;
|
||||
unused_arg(r);
|
||||
return -118;
|
||||
|
@ -734,8 +734,8 @@ mod_elves_only(const unit * u, const region * r, skill_t sk, int value)
|
|||
static int
|
||||
mod_dwarves_only(const unit * u, const region * r, skill_t sk, int value)
|
||||
{
|
||||
if (u_race(u) == new_race[RC_DWARF])
|
||||
return value;
|
||||
if (u_race(u) == get_race(RC_DWARF))
|
||||
return value;
|
||||
unused_arg(r);
|
||||
return -118;
|
||||
}
|
||||
|
@ -798,7 +798,7 @@ static int
|
|||
use_warmthpotion(struct unit *u, const struct item_type *itype, int amount,
|
||||
struct order *ord)
|
||||
{
|
||||
if (u->faction->race == new_race[RC_INSECT]) {
|
||||
if (u->faction->race == get_race(RC_INSECT)) {
|
||||
fset(u, UFL_WARMTH);
|
||||
} else {
|
||||
/* nur für insekten: */
|
||||
|
@ -840,7 +840,7 @@ static int
|
|||
use_bloodpotion(struct unit *u, const struct item_type *itype, int amount,
|
||||
struct order *ord)
|
||||
{
|
||||
if (u_race(u) == new_race[RC_DAEMON]) {
|
||||
if (u_race(u) == get_race(RC_DAEMON)) {
|
||||
change_effect(u, itype->rtype->ptype, 100 * amount);
|
||||
} else {
|
||||
const race *irace = u_irace(u);
|
||||
|
|
|
@ -1029,7 +1029,7 @@ spellpower(region * r, unit * u, const spell * sp, int cast_level, struct order
|
|||
|
||||
elf_power = get_param_int(global.parameters, "rules.magic.elfpower", 0);
|
||||
|
||||
if (elf_power && u_race(u) == new_race[RC_ELF] && r_isforest(r)) {
|
||||
if (elf_power && u_race(u) == get_race(RC_ELF) && r_isforest(r)) {
|
||||
++force;
|
||||
}
|
||||
rtype = rt_find("rop");
|
||||
|
@ -1370,7 +1370,7 @@ static void do_fumble(castorder * co)
|
|||
duration = rng_int() % level / 2;
|
||||
if (duration < 2) duration = 2;
|
||||
add_trigger(&u->attribs, "timer", trigger_timeout(duration, trestore));
|
||||
u_setrace(u, new_race[RC_TOAD]);
|
||||
u_setrace(u, get_race(RC_TOAD));
|
||||
u->irace = NULL;
|
||||
ADDMSG(&r->msgs, msg_message("patzer6", "unit region spell", u, r, sp));
|
||||
break;
|
||||
|
@ -2594,7 +2594,7 @@ static castorder *cast_cmd(unit * u, order * ord)
|
|||
* normalerweise nur Meermenschen, ausgenommen explizit als
|
||||
* OCEANCASTABLE deklarierte Sprüche */
|
||||
if (fval(r->terrain, SEA_REGION)) {
|
||||
if (u_race(u) != new_race[RC_AQUARIAN]
|
||||
if (u_race(u) != get_race(RC_AQUARIAN)
|
||||
&& !fval(u_race(u), RCF_SWIM)
|
||||
&& !(sp->sptyp & OCEANCASTABLE)) {
|
||||
/* Fehlermeldung */
|
||||
|
@ -2732,10 +2732,10 @@ void magic(void)
|
|||
for (u = r->units; u; u = u->next) {
|
||||
order *ord;
|
||||
|
||||
if (u->number <= 0 || u_race(u) == new_race[RC_SPELL])
|
||||
if (u->number <= 0 || u_race(u) == get_race(RC_SPELL))
|
||||
continue;
|
||||
|
||||
if (u_race(u) == new_race[RC_INSECT] && r_insectstalled(r) &&
|
||||
if (u_race(u) == get_race(RC_INSECT) && r_insectstalled(r) &&
|
||||
!is_cursed(u->attribs, C_KAELTESCHUTZ, 0))
|
||||
continue;
|
||||
|
||||
|
|
|
@ -295,7 +295,7 @@ int walkingcapacity(const struct unit *u)
|
|||
|
||||
n = wagen_mit_pferden * vcap;
|
||||
|
||||
if (u_race(u) == new_race[RC_TROLL]) {
|
||||
if (u_race(u) == get_race(RC_TROLL)) {
|
||||
/* 4 Trolle ziehen einen Wagen. */
|
||||
/* Unbesetzte Wagen feststellen */
|
||||
wagen_ohne_pferde = vehicles - wagen_mit_pferden;
|
||||
|
@ -351,7 +351,7 @@ static int canwalk(unit * u)
|
|||
get_transporters(u->items, &animals, &acap, &vehicles, &vcap);
|
||||
|
||||
maxwagen = effskill(u, SK_RIDING) * u->number * 2;
|
||||
if (u_race(u) == new_race[RC_TROLL]) {
|
||||
if (u_race(u) == get_race(RC_TROLL)) {
|
||||
maxwagen = _max(maxwagen, u->number / 4);
|
||||
}
|
||||
maxpferde = effskill(u, SK_RIDING) * u->number * 4 + u->number;
|
||||
|
@ -622,7 +622,7 @@ ship *move_ship(ship * sh, region * from, region * to, region_list * route)
|
|||
|
||||
static bool is_freezing(const unit * u)
|
||||
{
|
||||
if (u_race(u) != new_race[RC_INSECT])
|
||||
if (u_race(u) != get_race(RC_INSECT))
|
||||
return false;
|
||||
if (is_cursed(u->attribs, C_KAELTESCHUTZ, 0))
|
||||
return false;
|
||||
|
@ -1547,7 +1547,7 @@ static const region_list *travel_route(unit * u,
|
|||
}
|
||||
|
||||
/* unit is an insect and cannot move into a glacier */
|
||||
if (u_race(u) == new_race[RC_INSECT]) {
|
||||
if (u_race(u) == get_race(RC_INSECT)) {
|
||||
if (r_insectstalled(next) && is_freezing(u)) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("detectforbidden",
|
||||
"unit region", u, next));
|
||||
|
|
|
@ -62,6 +62,28 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|||
race *races;
|
||||
int num_races = 0;
|
||||
|
||||
static const char *racenames[MAXRACES] = {
|
||||
"dwarf", "elf", NULL, "goblin", "human", "troll", "demon", "insect",
|
||||
"halfling", "cat", "aquarian", "orc", "snotling", "undead", "illusion",
|
||||
"youngdragon", "dragon", "wyrm", "ent", "catdragon", "dracoid",
|
||||
"special", "spell", "irongolem", "stonegolem", "shadowdemon",
|
||||
"shadowmaster", "mountainguard", "alp", "toad", "braineater", "peasant",
|
||||
"wolf", NULL, NULL, NULL, NULL, "songdragon", NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL, NULL, NULL, "seaserpent",
|
||||
"shadowknight", "centaur", "skeleton", "skeletonlord", "zombie",
|
||||
"juju-zombie", "ghoul", "ghast", "museumghost", "gnome", "template",
|
||||
"clone"
|
||||
};
|
||||
|
||||
struct race *get_race(race_t rt) {
|
||||
assert(rt < MAXRACES);
|
||||
if (racenames[rt]) {
|
||||
return rc_get_or_create(racenames[rt]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
race_list *get_familiarraces(void)
|
||||
{
|
||||
static int init = 0;
|
||||
|
|
|
@ -43,6 +43,68 @@ extern "C" {
|
|||
struct param;
|
||||
struct spell;
|
||||
|
||||
typedef enum {
|
||||
RC_DWARF, /* 0 - Zwerg */
|
||||
RC_ELF,
|
||||
RC_GOBLIN = 3,
|
||||
RC_HUMAN,
|
||||
|
||||
RC_TROLL,
|
||||
RC_DAEMON,
|
||||
RC_INSECT,
|
||||
RC_HALFLING,
|
||||
RC_CAT,
|
||||
|
||||
RC_AQUARIAN,
|
||||
RC_ORC,
|
||||
RC_SNOTLING,
|
||||
RC_UNDEAD,
|
||||
RC_ILLUSION,
|
||||
|
||||
RC_FIREDRAGON,
|
||||
RC_DRAGON,
|
||||
RC_WYRM,
|
||||
RC_TREEMAN,
|
||||
RC_BIRTHDAYDRAGON,
|
||||
|
||||
RC_DRACOID,
|
||||
RC_SPECIAL,
|
||||
RC_SPELL,
|
||||
RC_IRONGOLEM,
|
||||
RC_STONEGOLEM,
|
||||
|
||||
RC_SHADOW,
|
||||
RC_SHADOWLORD,
|
||||
RC_IRONKEEPER,
|
||||
RC_ALP,
|
||||
RC_TOAD,
|
||||
|
||||
RC_HIRNTOETER,
|
||||
RC_PEASANT,
|
||||
RC_WOLF = 32,
|
||||
|
||||
RC_SONGDRAGON = 37,
|
||||
|
||||
RC_SEASERPENT = 51,
|
||||
RC_SHADOWKNIGHT,
|
||||
RC_CENTAUR,
|
||||
RC_SKELETON,
|
||||
|
||||
RC_SKELETON_LORD,
|
||||
RC_ZOMBIE,
|
||||
RC_ZOMBIE_LORD,
|
||||
RC_GHOUL,
|
||||
RC_GHOUL_LORD,
|
||||
|
||||
RC_MUS_SPIRIT,
|
||||
RC_GNOME,
|
||||
RC_TEMPLATE,
|
||||
RC_CLONE,
|
||||
|
||||
MAXRACES,
|
||||
NORACE = -1
|
||||
} race_t;
|
||||
|
||||
typedef struct att {
|
||||
int type;
|
||||
union {
|
||||
|
@ -107,8 +169,12 @@ extern "C" {
|
|||
extern void racelist_clear(struct race_list **rl);
|
||||
extern void racelist_insert(struct race_list **rl, const struct race *r);
|
||||
|
||||
extern struct race_list *get_familiarraces(void);
|
||||
extern struct race *races;
|
||||
|
||||
struct race_list *get_familiarraces(void);
|
||||
struct race *races;
|
||||
struct race *get_race(race_t rt);
|
||||
/** TODO: compatibility hacks: **/
|
||||
race_t old_race(const struct race *);
|
||||
|
||||
extern race *rc_get_or_create(const char *name);
|
||||
extern const race *rc_find(const char *);
|
||||
|
@ -170,11 +236,11 @@ extern "C" {
|
|||
extern const char *racename(const struct locale *lang, const struct unit *u,
|
||||
const race * rc);
|
||||
|
||||
#define omniscient(f) (((f)->race)==new_race[RC_ILLUSION] || ((f)->race)==new_race[RC_TEMPLATE])
|
||||
#define omniscient(f) ((f)->race==get_race(RC_ILLUSION) || (f)->race==get_race(RC_TEMPLATE))
|
||||
|
||||
#define playerrace(rc) (fval((rc), RCF_PLAYERRACE))
|
||||
#define dragonrace(rc) ((rc) == new_race[RC_FIREDRAGON] || (rc) == new_race[RC_DRAGON] || (rc) == new_race[RC_WYRM] || (rc) == new_race[RC_BIRTHDAYDRAGON])
|
||||
#define humanoidrace(rc) (fval((rc), RCF_UNDEAD) || (rc)==new_race[RC_DRACOID] || playerrace(rc))
|
||||
#define dragonrace(rc) ((rc) == get_race(RC_FIREDRAGON) || (rc) == get_race(RC_DRAGON) || (rc) == get_race(RC_WYRM) || (rc) == get_race(RC_BIRTHDAYDRAGON))
|
||||
#define humanoidrace(rc) (fval((rc), RCF_UNDEAD) || (rc)==get_race(RC_DRACOID) || playerrace(rc))
|
||||
#define illusionaryrace(rc) (fval(rc, RCF_ILLUSIONARY))
|
||||
|
||||
extern bool allowed_dragon(const struct region *src,
|
||||
|
|
|
@ -1527,7 +1527,7 @@ static void prepare_reports(void)
|
|||
prepare_lighthouse(u->building, u->faction);
|
||||
}
|
||||
|
||||
if (u_race(u) != new_race[RC_SPELL] || u->number == RS_FARVISION) {
|
||||
if (u_race(u) != get_race(RC_SPELL) || u->number == RS_FARVISION) {
|
||||
if (fval(u, UFL_DISBELIEVES)) {
|
||||
add_seen(u->faction->seen, r, see_unit, true);
|
||||
} else {
|
||||
|
|
|
@ -126,7 +126,7 @@ static unit *unitorders(FILE * F, int enc, struct faction *f)
|
|||
i = getid();
|
||||
u = findunitg(i, NULL);
|
||||
|
||||
if (u && u_race(u) == new_race[RC_SPELL])
|
||||
if (u && u_race(u) == get_race(RC_SPELL))
|
||||
return NULL;
|
||||
if (u && u->faction == f) {
|
||||
order **ordp;
|
||||
|
|
|
@ -107,12 +107,13 @@ int skill_mod(const race * rc, skill_t sk, const struct terrain_type *terrain)
|
|||
|
||||
result = rc->bonus[sk];
|
||||
|
||||
if (rc == new_race[RC_DWARF]) {
|
||||
if (rc == get_race(RC_DWARF)) {
|
||||
if (sk == SK_TACTICS) {
|
||||
if (terrain == newterrain(T_MOUNTAIN) || fval(terrain, ARCTIC_REGION))
|
||||
++result;
|
||||
}
|
||||
} else if (rc == new_race[RC_INSECT]) {
|
||||
}
|
||||
else if (rc == get_race(RC_INSECT)) {
|
||||
if (terrain == newterrain(T_MOUNTAIN) || fval(terrain, ARCTIC_REGION))
|
||||
--result;
|
||||
else if (terrain == newterrain(T_DESERT) || terrain == newterrain(T_SWAMP))
|
||||
|
@ -171,7 +172,7 @@ int rc_skillmod(const struct race *rc, const region * r, skill_t sk)
|
|||
mods = skill_mod(rc, sk, r->terrain);
|
||||
}
|
||||
#endif
|
||||
if (rc == new_race[RC_ELF] && r && r_isforest(r)) {
|
||||
if (rc == get_race(RC_ELF) && r && r_isforest(r)) {
|
||||
if (sk == SK_PERCEPTION || sk == SK_STEALTH) {
|
||||
++mods;
|
||||
} else if (sk == SK_TACTICS) {
|
||||
|
|
|
@ -158,7 +158,7 @@ void spawn_braineaters(float chance)
|
|||
if (next-- == 0) {
|
||||
unit *u =
|
||||
createunit(r, f0, 1 + rng_int() % 10 + rng_int() % 10,
|
||||
new_race[RC_HIRNTOETER]);
|
||||
get_race(RC_HIRNTOETER));
|
||||
equip_unit(u, get_equipment("monster_braineater"));
|
||||
|
||||
next = rng_int() % (int)(chance * 100);
|
||||
|
|
|
@ -180,70 +180,6 @@ enum {
|
|||
MAXOPTIONS
|
||||
};
|
||||
|
||||
/* ------------- Typ von Einheiten ----------------------------- */
|
||||
|
||||
typedef enum {
|
||||
RC_DWARF, /* 0 - Zwerg */
|
||||
RC_ELF,
|
||||
RC_GOBLIN = 3,
|
||||
RC_HUMAN,
|
||||
|
||||
RC_TROLL,
|
||||
RC_DAEMON,
|
||||
RC_INSECT,
|
||||
RC_HALFLING,
|
||||
RC_CAT,
|
||||
|
||||
RC_AQUARIAN,
|
||||
RC_ORC,
|
||||
RC_SNOTLING,
|
||||
RC_UNDEAD,
|
||||
RC_ILLUSION,
|
||||
|
||||
RC_FIREDRAGON,
|
||||
RC_DRAGON,
|
||||
RC_WYRM,
|
||||
RC_TREEMAN,
|
||||
RC_BIRTHDAYDRAGON,
|
||||
|
||||
RC_DRACOID,
|
||||
RC_SPECIAL,
|
||||
RC_SPELL,
|
||||
RC_IRONGOLEM,
|
||||
RC_STONEGOLEM,
|
||||
|
||||
RC_SHADOW,
|
||||
RC_SHADOWLORD,
|
||||
RC_IRONKEEPER,
|
||||
RC_ALP,
|
||||
RC_TOAD,
|
||||
|
||||
RC_HIRNTOETER,
|
||||
RC_PEASANT,
|
||||
RC_WOLF = 32,
|
||||
|
||||
RC_SONGDRAGON = 37,
|
||||
|
||||
RC_SEASERPENT = 51,
|
||||
RC_SHADOWKNIGHT,
|
||||
RC_CENTAUR,
|
||||
RC_SKELETON,
|
||||
|
||||
RC_SKELETON_LORD,
|
||||
RC_ZOMBIE,
|
||||
RC_ZOMBIE_LORD,
|
||||
RC_GHOUL,
|
||||
RC_GHOUL_LORD,
|
||||
|
||||
RC_MUS_SPIRIT,
|
||||
RC_GNOME,
|
||||
RC_TEMPLATE,
|
||||
RC_CLONE,
|
||||
|
||||
MAXRACES,
|
||||
NORACE = -1
|
||||
} race_t;
|
||||
|
||||
typedef enum {
|
||||
M_GRAY = 0, /* Gray */
|
||||
M_ILLAUN = 1, /* Illaun */
|
||||
|
|
|
@ -330,7 +330,7 @@ void make_zombie(unit * u)
|
|||
{
|
||||
u_setfaction(u, get_monsters());
|
||||
scale_number(u, 1);
|
||||
u_setrace(u, new_race[RC_ZOMBIE]);
|
||||
u_setrace(u, get_race(RC_ZOMBIE));
|
||||
u->irace = NULL;
|
||||
}
|
||||
|
||||
|
|
|
@ -578,6 +578,7 @@ static int parse_ships(xmlDocPtr doc)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void race_compat(void)
|
||||
{
|
||||
/* required for old_race, do not change order! */
|
||||
|
@ -612,6 +613,7 @@ static void race_compat(void)
|
|||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
static potion_type *xml_readpotion(xmlXPathContextPtr xpath, item_type * itype)
|
||||
{
|
||||
|
@ -1883,7 +1885,6 @@ static int parse_races(xmlDocPtr doc)
|
|||
|
||||
xmlXPathFreeContext(xpath);
|
||||
|
||||
race_compat();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
17
src/laws.c
17
src/laws.c
|
@ -288,7 +288,7 @@ void get_food(region * r)
|
|||
* bei fehlenden Bauern den Dämon hungern lassen
|
||||
*/
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u_race(u) == new_race[RC_DAEMON]) {
|
||||
if (u_race(u) == get_race(RC_DAEMON)) {
|
||||
int hungry = u->number;
|
||||
|
||||
/* use peasantblood before eating the peasants themselves */
|
||||
|
@ -310,7 +310,7 @@ void get_food(region * r)
|
|||
if (donor == u)
|
||||
donor = r->units;
|
||||
while (donor != NULL) {
|
||||
if (u_race(donor) == new_race[RC_DAEMON] && donor!=u) {
|
||||
if (u_race(donor) == get_race(RC_DAEMON) && donor != u) {
|
||||
if (get_effect(donor, pt_blood)) {
|
||||
/* if he's in our faction, drain him: */
|
||||
if (donor->faction == u->faction)
|
||||
|
@ -358,7 +358,7 @@ void get_food(region * r)
|
|||
|
||||
static void age_unit(region * r, unit * u)
|
||||
{
|
||||
if (u_race(u) == new_race[RC_SPELL]) {
|
||||
if (u_race(u) == get_race(RC_SPELL)) {
|
||||
if (--u->age <= 0) {
|
||||
remove_unit(&r->units, u);
|
||||
}
|
||||
|
@ -749,7 +749,7 @@ growing_trees(region * r, const int current_season, const int last_weeks_season)
|
|||
|
||||
if (current_season == SEASON_SUMMER || current_season == SEASON_AUTUMN) {
|
||||
double seedchance = 0.01F * RESOURCE_QUANTITY;
|
||||
int elves = count_race(r, new_race[RC_ELF]);
|
||||
int elves = count_race(r, get_race(RC_ELF));
|
||||
|
||||
a = a_find(r->attribs, &at_germs);
|
||||
if (a && last_weeks_season == SEASON_SPRING) {
|
||||
|
@ -2931,7 +2931,7 @@ int guard_on_cmd(unit * u, struct order *ord)
|
|||
if (fval(u, UFL_MOVED)) {
|
||||
cmistake(u, ord, 187, MSG_EVENT);
|
||||
} else if (fval(u_race(u), RCF_ILLUSIONARY)
|
||||
|| u_race(u) == new_race[RC_SPELL]) {
|
||||
|| u_race(u) == get_race(RC_SPELL)) {
|
||||
cmistake(u, ord, 95, MSG_EVENT);
|
||||
} else {
|
||||
/* Monster der Monsterpartei dürfen immer bewachen */
|
||||
|
@ -3395,7 +3395,7 @@ static void ageing(void)
|
|||
if (is_cursed(u->attribs, C_OLDRACE, 0)) {
|
||||
curse *c = get_curse(u->attribs, ct_find("oldrace"));
|
||||
if (c->duration == 1 && !(c_flags(c) & CURSE_NOAGE)) {
|
||||
u_setrace(u, new_race[curse_geteffect_int(c)]);
|
||||
u_setrace(u, get_race(curse_geteffect_int(c)));
|
||||
u->irace = NULL;
|
||||
}
|
||||
}
|
||||
|
@ -4262,7 +4262,8 @@ void process(void)
|
|||
if (porder->flags & PROC_LONGORDER) {
|
||||
if (u->number == 0) {
|
||||
ord = NULL;
|
||||
} else if (u_race(u) == new_race[RC_INSECT]
|
||||
}
|
||||
else if (u_race(u) == get_race(RC_INSECT)
|
||||
&& r_insectstalled(r)
|
||||
&& !is_cursed(u->attribs, C_KAELTESCHUTZ, 0)) {
|
||||
ord = NULL;
|
||||
|
@ -4275,7 +4276,7 @@ void process(void)
|
|||
*/
|
||||
ord = NULL;
|
||||
} else if (fval(r->terrain, SEA_REGION)
|
||||
&& u_race(u) != new_race[RC_AQUARIAN]
|
||||
&& u_race(u) != get_race(RC_AQUARIAN)
|
||||
&& !(u_race(u)->flags & RCF_SWIM)) {
|
||||
/* error message disabled by popular demand */
|
||||
ord = NULL;
|
||||
|
|
|
@ -341,7 +341,7 @@ static void guardian_faction(plane * pl, int id)
|
|||
f->passw = _strdup(itoa36(rng_int()));
|
||||
set_email(&f->email, "igjarjuk@eressea.de");
|
||||
f->name = _strdup("Igjarjuks Kundschafter");
|
||||
f->race = new_race[RC_ILLUSION];
|
||||
f->race = get_race(RC_ILLUSION);
|
||||
f->age = turn;
|
||||
f->locale = get_locale("de");
|
||||
f->options =
|
||||
|
@ -352,7 +352,7 @@ static void guardian_faction(plane * pl, int id)
|
|||
addlist(&factions, f);
|
||||
fhash(f);
|
||||
}
|
||||
if (f->race != new_race[RC_ILLUSION]) {
|
||||
if (f->race != get_race(RC_ILLUSION)) {
|
||||
assert(!"guardian id vergeben");
|
||||
exit(0);
|
||||
}
|
||||
|
@ -368,7 +368,7 @@ static void guardian_faction(plane * pl, int id)
|
|||
}
|
||||
if (u)
|
||||
continue;
|
||||
u = createunit(r, f, 1, new_race[RC_GOBLIN]);
|
||||
u = createunit(r, f, 1, get_race(RC_GOBLIN));
|
||||
set_string(&u->name, "Igjarjuks Auge");
|
||||
i_change(&u->items, it_find("roi"), 1);
|
||||
set_order(&u->thisorder, NULL);
|
||||
|
|
|
@ -47,8 +47,8 @@ int average_score_of_age(int age, int a)
|
|||
int sum = 0, count = 0;
|
||||
|
||||
for (f = factions; f; f = f->next) {
|
||||
if (!is_monsters(f) && f->race != new_race[RC_TEMPLATE] && f->age <= age + a
|
||||
&& f->age >= age - a) {
|
||||
if (!is_monsters(f) && f->age <= age + a
|
||||
&& f->age >= age - a && f->race != get_race(RC_TEMPLATE)) {
|
||||
sum += f->score;
|
||||
count++;
|
||||
}
|
||||
|
@ -106,8 +106,8 @@ void score(void)
|
|||
int i;
|
||||
faction *f = u->faction;
|
||||
|
||||
if (f == NULL || u_race(u) == new_race[RC_SPELL]
|
||||
|| u_race(u) == new_race[RC_BIRTHDAYDRAGON]) {
|
||||
if (f == NULL || u_race(u) == get_race(RC_SPELL)
|
||||
|| u_race(u) == get_race(RC_BIRTHDAYDRAGON)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ void score(void)
|
|||
|
||||
for (fc = factions; fc; fc = fc->next) {
|
||||
fc->score = fc->score / 5;
|
||||
if (!is_monsters(fc) && fc->race != new_race[RC_TEMPLATE]) {
|
||||
if (!is_monsters(fc) && fc->race != get_race(RC_TEMPLATE)) {
|
||||
allscores += fc->score;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -389,7 +389,7 @@ static int dragon_affinity_value(region * r, unit * u)
|
|||
{
|
||||
int m = all_money(r, u->faction);
|
||||
|
||||
if (u_race(u) == new_race[RC_FIREDRAGON]) {
|
||||
if (u_race(u) == get_race(RC_FIREDRAGON)) {
|
||||
return (int)(normalvariate(m, m / 2));
|
||||
} else {
|
||||
return (int)(normalvariate(m, m / 4));
|
||||
|
@ -497,7 +497,7 @@ static order *monster_seeks_target(region * r, unit * u)
|
|||
}
|
||||
|
||||
if (r == target->region) { /* Wir haben ihn! */
|
||||
if (u_race(u) == new_race[RC_ALP]) {
|
||||
if (u_race(u) == get_race(RC_ALP)) {
|
||||
alp_findet_opfer(u, r);
|
||||
} else {
|
||||
assert(!"Seeker-Monster hat keine Aktion fuer Ziel");
|
||||
|
@ -614,7 +614,7 @@ static void recruit_dracoids(unit * dragon, int size)
|
|||
region *r = dragon->region;
|
||||
const struct item *weapon = NULL;
|
||||
order *new_order = NULL;
|
||||
unit *un = createunit(r, f, size, new_race[RC_DRACOID]);
|
||||
unit *un = createunit(r, f, size, get_race(RC_DRACOID));
|
||||
|
||||
fset(un, UFL_ISNEW | UFL_MOVED);
|
||||
|
||||
|
@ -653,7 +653,7 @@ static order *plan_dragon(unit * u)
|
|||
}
|
||||
move |= chance(0.04); /* 4% chance to change your mind */
|
||||
|
||||
if (u_race(u) == new_race[RC_WYRM] && !move) {
|
||||
if (u_race(u) == get_race(RC_WYRM) && !move) {
|
||||
unit *u2;
|
||||
for (u2 = r->units; u2; u2 = u2->next) {
|
||||
/* wyrme sind einzelgänger */
|
||||
|
@ -715,7 +715,8 @@ static order *plan_dragon(unit * u)
|
|||
if (long_order == NULL) {
|
||||
/* money is gone, need a new target */
|
||||
set_new_dragon_target(u, u->region, DRAGON_RANGE);
|
||||
} else if (u_race(u) != new_race[RC_FIREDRAGON]) {
|
||||
}
|
||||
else if (u_race(u) != get_race(RC_FIREDRAGON)) {
|
||||
/* neue dracoiden! */
|
||||
if (r->land && !fval(r->terrain, FORBIDDEN_REGION)) {
|
||||
int ra = 20 + rng_int() % 100;
|
||||
|
@ -894,7 +895,7 @@ void spawn_dragons(void)
|
|||
unit *u;
|
||||
|
||||
if (fval(r->terrain, SEA_REGION) && rng_int() % 10000 < 1) {
|
||||
u = createunit(r, monsters, 1, new_race[RC_SEASERPENT]);
|
||||
u = createunit(r, monsters, 1, get_race(RC_SEASERPENT));
|
||||
fset(u, UFL_ISNEW | UFL_MOVED);
|
||||
equip_unit(u, get_equipment("monster_seaserpent"));
|
||||
}
|
||||
|
@ -904,9 +905,9 @@ void spawn_dragons(void)
|
|||
|| r->terrain == newterrain(T_DESERT))
|
||||
&& rng_int() % 10000 < (5 + 100 * chaosfactor(r))) {
|
||||
if (chance(0.80)) {
|
||||
u = createunit(r, monsters, nrand(60, 20) + 1, new_race[RC_FIREDRAGON]);
|
||||
u = createunit(r, monsters, nrand(60, 20) + 1, get_race(RC_FIREDRAGON));
|
||||
} else {
|
||||
u = createunit(r, monsters, nrand(30, 20) + 1, new_race[RC_DRAGON]);
|
||||
u = createunit(r, monsters, nrand(30, 20) + 1, get_race(RC_DRAGON));
|
||||
}
|
||||
fset(u, UFL_ISNEW | UFL_MOVED);
|
||||
equip_unit(u, get_equipment("monster_dragon"));
|
||||
|
@ -959,19 +960,19 @@ void spawn_undead(void)
|
|||
|
||||
switch (rng_int() % 3) {
|
||||
case 0:
|
||||
rc = new_race[RC_SKELETON];
|
||||
rc = get_race(RC_SKELETON);
|
||||
break;
|
||||
case 1:
|
||||
rc = new_race[RC_ZOMBIE];
|
||||
rc = get_race(RC_ZOMBIE);
|
||||
break;
|
||||
default:
|
||||
rc = new_race[RC_GHOUL];
|
||||
rc = get_race(RC_GHOUL);
|
||||
break;
|
||||
}
|
||||
|
||||
u = createunit(r, monsters, undead, rc);
|
||||
fset(u, UFL_ISNEW | UFL_MOVED);
|
||||
if ((rc == new_race[RC_SKELETON] || rc == new_race[RC_ZOMBIE])
|
||||
if ((rc == get_race(RC_SKELETON) || rc == get_race(RC_ZOMBIE))
|
||||
&& rng_int() % 10 < 4) {
|
||||
equip_unit(u, get_equipment("rising_undead"));
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <kernel/config.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/region.h>
|
||||
#include <kernel/unit.h>
|
||||
|
||||
|
@ -31,7 +32,7 @@ void age_firedragon(unit * u)
|
|||
{
|
||||
if (u->number > 0 && rng_int() % 100 < age_chance(u->age, DRAGONAGE, 1)) {
|
||||
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
||||
u_setrace(u, new_race[RC_DRAGON]);
|
||||
u_setrace(u, get_race(RC_DRAGON));
|
||||
u->irace = NULL;
|
||||
scale_number(u, 1);
|
||||
u->hp = (int)(unit_max_hp(u) * u->number * q);
|
||||
|
@ -42,7 +43,7 @@ void age_dragon(unit * u)
|
|||
{
|
||||
if (u->number > 0 && rng_int() % 100 < age_chance(u->age, WYRMAGE, 1)) {
|
||||
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
||||
u_setrace(u, new_race[RC_WYRM]);
|
||||
u_setrace(u, get_race(RC_WYRM));
|
||||
u->irace = NULL;
|
||||
u->hp = (int)(unit_max_hp(u) * u->number * q);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <kernel/config.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/messages.h>
|
||||
|
@ -28,7 +29,7 @@
|
|||
|
||||
void age_illusion(unit * u)
|
||||
{
|
||||
if (u->faction->race != new_race[RC_ILLUSION]) {
|
||||
if (u->faction->race != get_race(RC_ILLUSION)) {
|
||||
if (u->age == ILLUSIONMAX) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("warnillusiondissolve", "unit", u));
|
||||
} else if (u->age > ILLUSIONMAX) {
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#include <kernel/config.h>
|
||||
|
||||
/* kernel includes */
|
||||
#include <kernel/race.h>
|
||||
#include <kernel/unit.h>
|
||||
#include <kernel/faction.h>
|
||||
#include <kernel/region.h>
|
||||
|
@ -51,7 +52,7 @@ void age_undead(unit * u)
|
|||
if (rng_int() % 100 < UNDEAD_BREAKUP_FRACTION)
|
||||
++n;
|
||||
}
|
||||
u2 = create_unit(r, get_monsters(), 0, new_race[RC_UNDEAD], 0, NULL, u);
|
||||
u2 = create_unit(r, get_monsters(), 0, get_race(RC_UNDEAD), 0, NULL, u);
|
||||
make_undead_unit(u2);
|
||||
transfermen(u, u2, u->number - n);
|
||||
}
|
||||
|
@ -62,7 +63,7 @@ void age_skeleton(unit * u)
|
|||
if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
|
||||
int n = _max(1, u->number / 2);
|
||||
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
||||
u_setrace(u, new_race[RC_SKELETON_LORD]);
|
||||
u_setrace(u, get_race(RC_SKELETON_LORD));
|
||||
u->irace = NULL;
|
||||
scale_number(u, n);
|
||||
u->hp = (int)(unit_max_hp(u) * u->number * q);
|
||||
|
@ -74,7 +75,7 @@ void age_zombie(unit * u)
|
|||
if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
|
||||
int n = _max(1, u->number / 2);
|
||||
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
||||
u_setrace(u, new_race[RC_ZOMBIE_LORD]);
|
||||
u_setrace(u, get_race(RC_ZOMBIE_LORD));
|
||||
u->irace = NULL;
|
||||
scale_number(u, n);
|
||||
u->hp = (int)(unit_max_hp(u) * u->number * q);
|
||||
|
@ -86,7 +87,7 @@ void age_ghoul(unit * u)
|
|||
if (is_monsters(u->faction) && rng_int() % 100 < age_chance(u->age, 27, 1)) {
|
||||
int n = _max(1, u->number / 2);
|
||||
double q = (double)u->hp / (double)(unit_max_hp(u) * u->number);
|
||||
u_setrace(u, new_race[RC_GHOUL_LORD]);
|
||||
u_setrace(u, get_race(RC_GHOUL_LORD));
|
||||
u->irace = NULL;
|
||||
scale_number(u, n);
|
||||
u->hp = (int)(unit_max_hp(u) * u->number * q);
|
||||
|
|
|
@ -127,8 +127,8 @@ static void dissolve_units(void)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
if (u_race(u) == new_race[RC_STONEGOLEM]
|
||||
|| u_race(u) == new_race[RC_IRONGOLEM]) {
|
||||
if (u_race(u) == get_race(RC_STONEGOLEM)
|
||||
|| u_race(u) == get_race(RC_IRONGOLEM)) {
|
||||
msg =
|
||||
msg_message("dissolve_units_4", "unit region number race", u, r,
|
||||
n, u_race(u));
|
||||
|
@ -446,7 +446,7 @@ static unit *random_unit(const region * r)
|
|||
unit *u;
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u_race(u) != new_race[RC_SPELL]) {
|
||||
if (u_race(u) != get_race(RC_SPELL)) {
|
||||
c += u->number;
|
||||
}
|
||||
}
|
||||
|
@ -459,7 +459,7 @@ static unit *random_unit(const region * r)
|
|||
u = r->units;
|
||||
|
||||
while (u && c < n) {
|
||||
if (u_race(u) != new_race[RC_SPELL]) {
|
||||
if (u_race(u) != get_race(RC_SPELL)) {
|
||||
c += u->number;
|
||||
}
|
||||
u = u->next;
|
||||
|
@ -478,7 +478,7 @@ void chaos(region * r)
|
|||
if (u && playerrace(u_race(u))) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("chaos_disease", "unit", u));
|
||||
u_setfaction(u, get_monsters());
|
||||
u_setrace(u, new_race[RC_GHOUL]);
|
||||
u_setrace(u, get_race(RC_GHOUL));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
@ -491,19 +491,19 @@ void chaos(region * r)
|
|||
mfac = 100;
|
||||
u =
|
||||
createunit(r, get_monsters(), rng_int() % 8 + 1,
|
||||
new_race[RC_FIREDRAGON]);
|
||||
get_race(RC_FIREDRAGON));
|
||||
break;
|
||||
case 1:
|
||||
mfac = 500;
|
||||
u =
|
||||
createunit(r, get_monsters(), rng_int() % 4 + 1,
|
||||
new_race[RC_DRAGON]);
|
||||
get_race(RC_DRAGON));
|
||||
break;
|
||||
default:
|
||||
mfac = 1000;
|
||||
u =
|
||||
createunit(r, get_monsters(), rng_int() % 2 + 1,
|
||||
new_race[RC_WYRM]);
|
||||
get_race(RC_WYRM));
|
||||
break;
|
||||
}
|
||||
if (mfac)
|
||||
|
@ -537,7 +537,7 @@ void chaos(region * r)
|
|||
|
||||
for (up = &r->units; *up;) {
|
||||
unit *u = *up;
|
||||
if (u_race(u) != new_race[RC_SPELL] && u->ship == 0 && !canfly(u)) {
|
||||
if (u_race(u) != get_race(RC_SPELL) && u->ship == 0 && !canfly(u)) {
|
||||
ADDMSG(&u->faction->msgs, msg_message("tidalwave_kill",
|
||||
"region unit", r, u));
|
||||
remove_unit(up, u);
|
||||
|
@ -605,7 +605,7 @@ damage_unit(unit * u, const char *dam, bool physical, bool magic)
|
|||
double magres = magic_resistance(u);
|
||||
|
||||
assert(u->number);
|
||||
if (fval(u_race(u), RCF_ILLUSIONARY) || u_race(u) == new_race[RC_SPELL]) {
|
||||
if (fval(u_race(u), RCF_ILLUSIONARY) || u_race(u) == get_race(RC_SPELL)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -676,7 +676,7 @@ void drown(region * r)
|
|||
while (*up) {
|
||||
unit *u = *up;
|
||||
int amphibian_level = 0;
|
||||
if (u->ship || u_race(u) == new_race[RC_SPELL] || u->number == 0) {
|
||||
if (u->ship || u_race(u) == get_race(RC_SPELL) || u->number == 0) {
|
||||
up = &u->next;
|
||||
continue;
|
||||
}
|
||||
|
@ -1110,7 +1110,7 @@ static void demon_skillchanges(void)
|
|||
for (r = regions; r; r = r->next) {
|
||||
unit *u;
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u_race(u) == new_race[RC_DAEMON]) {
|
||||
if (u_race(u) == get_race(RC_DAEMON)) {
|
||||
skill *sv = u->skills;
|
||||
int upchance = 15;
|
||||
int downchance = 10;
|
||||
|
|
|
@ -1289,7 +1289,7 @@ static void statistics(FILE * F, const region * r, const faction * f)
|
|||
msg_release(m);
|
||||
}
|
||||
if (production(r) && (!fval(r->terrain, SEA_REGION)
|
||||
|| f->race == new_race[RC_AQUARIAN])) {
|
||||
|| f->race == get_race(RC_AQUARIAN))) {
|
||||
if (markets_module()) { /* hack */
|
||||
m =
|
||||
msg_message("nr_stat_salary_new", "max", wage(r, NULL, NULL, turn + 1));
|
||||
|
@ -2199,7 +2199,7 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
nr_render(m, f->locale, buf, sizeof(buf), f);
|
||||
msg_release(m);
|
||||
centre(F, buf, true);
|
||||
if (f->race == new_race[RC_HUMAN]) {
|
||||
if (f->race == get_race(RC_HUMAN)) {
|
||||
int maxmig = count_maxmigrants(f);
|
||||
if (maxmig > 0) {
|
||||
m =
|
||||
|
@ -2238,7 +2238,7 @@ report_plaintext(const char *filename, report_context * ctx,
|
|||
}
|
||||
|
||||
/* Insekten-Winter-Warnung */
|
||||
if (f->race == new_race[RC_INSECT]) {
|
||||
if (f->race == get_race(RC_INSECT)) {
|
||||
if (thisseason == 0) {
|
||||
centre(F, LOC(f->locale, "nr_insectwinter"), true);
|
||||
rnl(F);
|
||||
|
|
|
@ -104,7 +104,7 @@ int sp_summon_alp(struct castorder *co)
|
|||
unit *mage = co->magician.u;
|
||||
int cast_level = co->level;
|
||||
spellparameter *pa = co->par;
|
||||
const struct race *rc = new_race[RC_ALP];
|
||||
const struct race *rc = get_race(RC_ALP);
|
||||
struct faction *f = get_monsters();
|
||||
struct message *msg;
|
||||
|
||||
|
|
|
@ -832,7 +832,7 @@ int sp_wolfhowl(struct castorder * co)
|
|||
attrib *a;
|
||||
message *msg;
|
||||
int force = (int)(get_force(power, 3) / 2);
|
||||
const race * rc = new_race[RC_WOLF];
|
||||
const race * rc = get_race(RC_WOLF);
|
||||
if (force>0) {
|
||||
unit *u =
|
||||
create_unit(r, mage->faction, force, rc, 0, NULL, mage);
|
||||
|
@ -876,7 +876,7 @@ int sp_shadowknights(struct castorder * co)
|
|||
message *msg;
|
||||
|
||||
u =
|
||||
create_unit(r, mage->faction, force, new_race[RC_SHADOWKNIGHT], 0, NULL,
|
||||
create_unit(r, mage->faction, force, get_race(RC_SHADOWKNIGHT), 0, NULL,
|
||||
mage);
|
||||
setstatus(u, ST_FIGHT);
|
||||
|
||||
|
@ -1556,7 +1556,7 @@ int sp_reanimate(struct castorder * co)
|
|||
while (healable--) {
|
||||
fighter *tf = select_corpse(b, fi);
|
||||
if (tf != NULL && tf->side->casualties > 0
|
||||
&& u_race(tf->unit) != new_race[RC_DAEMON]
|
||||
&& u_race(tf->unit) != get_race(RC_DAEMON)
|
||||
&& (chance(c))) {
|
||||
assert(tf->alive < tf->unit->number);
|
||||
/* t.fighter->person[].hp beginnt mit t.index = 0 zu zählen,
|
||||
|
@ -1739,7 +1739,7 @@ int sp_undeadhero(struct castorder * co)
|
|||
|
||||
if (j > 0) {
|
||||
unit *u =
|
||||
create_unit(r, mage->faction, 0, new_race[RC_UNDEAD], 0, du->name,
|
||||
create_unit(r, mage->faction, 0, get_race(RC_UNDEAD), 0, du->name,
|
||||
du);
|
||||
|
||||
/* new units gets some stats from old unit */
|
||||
|
|
|
@ -881,7 +881,7 @@ static int sp_summonent(castorder * co)
|
|||
|
||||
ents = (int)_min(power * power, rtrees(r, 2));
|
||||
|
||||
u = create_unit(r, mage->faction, ents, new_race[RC_TREEMAN], 0, NULL, mage);
|
||||
u = create_unit(r, mage->faction, ents, get_race(RC_TREEMAN), 0, NULL, mage);
|
||||
|
||||
a = a_new(&at_unitdissolve);
|
||||
a->data.ca[0] = 2; /* An r->trees. */
|
||||
|
@ -1182,7 +1182,7 @@ static void fumble_ents(const castorder * co)
|
|||
}
|
||||
|
||||
ents = (int)(force * 10);
|
||||
u = create_unit(r, get_monsters(), ents, new_race[RC_TREEMAN], 0, NULL, NULL);
|
||||
u = create_unit(r, get_monsters(), ents, get_race(RC_TREEMAN), 0, NULL, NULL);
|
||||
|
||||
if (u) {
|
||||
message *unseen;
|
||||
|
@ -1634,7 +1634,7 @@ static int sp_great_drought(castorder * co)
|
|||
rsetterrain(r, T_OCEAN);
|
||||
/* Einheiten duerfen hier auf keinen Fall geloescht werden! */
|
||||
for (u = r->units; u; u = u->next) {
|
||||
if (u_race(u) != new_race[RC_SPELL] && u->ship == 0) {
|
||||
if (u_race(u) != get_race(RC_SPELL) && u->ship == 0) {
|
||||
set_number(u, 0);
|
||||
}
|
||||
}
|
||||
|
@ -2131,7 +2131,7 @@ static int sp_ironkeeper(castorder * co)
|
|||
}
|
||||
|
||||
keeper =
|
||||
create_unit(r, mage->faction, 1, new_race[RC_IRONKEEPER], 0, NULL, mage);
|
||||
create_unit(r, mage->faction, 1, get_race(RC_IRONKEEPER), 0, NULL, mage);
|
||||
|
||||
/*keeper->age = cast_level + 2; */
|
||||
setstatus(keeper, ST_AVOID); /* kaempft nicht */
|
||||
|
@ -2322,7 +2322,7 @@ void patzer_peasantmob(const castorder * co)
|
|||
assert(rpeasants(r) >= 0);
|
||||
|
||||
u =
|
||||
create_unit(r, f, n, new_race[RC_PEASANT], 0, LOC(f->locale, "angry_mob"),
|
||||
create_unit(r, f, n, get_race(RC_PEASANT), 0, LOC(f->locale, "angry_mob"),
|
||||
NULL);
|
||||
fset(u, UFL_ISNEW);
|
||||
/* guard(u, GUARD_ALL); hier zu frueh! Befehl BEWACHE setzten */
|
||||
|
@ -2548,23 +2548,23 @@ static int sp_summondragon(castorder * co)
|
|||
|
||||
for (time = 1; time < 7; time++) {
|
||||
if (rng_int() % 100 < 25) {
|
||||
switch (rng_int() % 3) {
|
||||
switch (rng_int() % 3) {
|
||||
case 0:
|
||||
race = new_race[RC_WYRM];
|
||||
number = 1;
|
||||
break;
|
||||
race = get_race(RC_WYRM);
|
||||
number = 1;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
race = new_race[RC_DRAGON];
|
||||
number = 2;
|
||||
break;
|
||||
race = get_race(RC_DRAGON);
|
||||
number = 2;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
default:
|
||||
race = new_race[RC_FIREDRAGON];
|
||||
number = 6;
|
||||
break;
|
||||
}
|
||||
race = get_race(RC_FIREDRAGON);
|
||||
number = 6;
|
||||
break;
|
||||
}
|
||||
{
|
||||
trigger *tsummon = trigger_createunit(r, f, race, number);
|
||||
add_trigger(&r->attribs, "timer", trigger_timeout(time, tsummon));
|
||||
|
@ -2577,7 +2577,7 @@ static int sp_summondragon(castorder * co)
|
|||
for (rl2 = rl; rl2; rl2 = rl2->next) {
|
||||
region *r2 = rl2->data;
|
||||
for (u = r2->units; u; u = u->next) {
|
||||
if (u_race(u) == new_race[RC_WYRM] || u_race(u) == new_race[RC_DRAGON]) {
|
||||
if (u_race(u) == get_race(RC_WYRM) || u_race(u) == get_race(RC_DRAGON)) {
|
||||
attrib *a = a_find(u->attribs, &at_targetregion);
|
||||
if (!a) {
|
||||
a = a_add(&u->attribs, make_targetregion(r));
|
||||
|
@ -2689,13 +2689,13 @@ static int sp_unholypower(castorder * co)
|
|||
|
||||
switch (old_race(u_race(u))) {
|
||||
case RC_SKELETON:
|
||||
target_race = new_race[RC_SKELETON_LORD];
|
||||
target_race = get_race(RC_SKELETON_LORD);
|
||||
break;
|
||||
case RC_ZOMBIE:
|
||||
target_race = new_race[RC_ZOMBIE_LORD];
|
||||
target_race = get_race(RC_ZOMBIE_LORD);
|
||||
break;
|
||||
case RC_GHOUL:
|
||||
target_race = new_race[RC_GHOUL_LORD];
|
||||
target_race = get_race(RC_GHOUL_LORD);
|
||||
break;
|
||||
default:
|
||||
cmistake(mage, co->order, 284, MSG_MAGIC);
|
||||
|
@ -2963,7 +2963,7 @@ static int sp_summonshadow(castorder * co)
|
|||
unit *u;
|
||||
int val, number = (int)(force * force);
|
||||
|
||||
u = create_unit(r, mage->faction, number, new_race[RC_SHADOW], 0, NULL, mage);
|
||||
u = create_unit(r, mage->faction, number, get_race(RC_SHADOW), 0, NULL, mage);
|
||||
|
||||
/* Bekommen Tarnung = (Magie+Tarnung)/2 und Wahrnehmung 1. */
|
||||
val = get_level(mage, SK_MAGIC) + get_level(mage, SK_STEALTH);
|
||||
|
@ -3004,7 +3004,7 @@ static int sp_summonshadowlords(castorder * co)
|
|||
int amount = (int)(force * force);
|
||||
|
||||
u =
|
||||
create_unit(r, mage->faction, amount, new_race[RC_SHADOWLORD], 0, NULL,
|
||||
create_unit(r, mage->faction, amount, get_race(RC_SHADOWLORD), 0, NULL,
|
||||
mage);
|
||||
|
||||
/* Bekommen Tarnung = Magie und Wahrnehmung 5. */
|
||||
|
@ -3257,7 +3257,7 @@ static int sp_summonundead(castorder * co)
|
|||
unit *mage = co->magician.u;
|
||||
int cast_level = co->level;
|
||||
int force = (int)(co->force * 10);
|
||||
const race *race = new_race[RC_SKELETON];
|
||||
const race *race = get_race(RC_SKELETON);
|
||||
|
||||
if (!r->land || deathcount(r) == 0) {
|
||||
ADDMSG(&mage->faction->msgs, msg_feedback(mage, co->order, "error_nograves",
|
||||
|
@ -3268,11 +3268,11 @@ static int sp_summonundead(castorder * co)
|
|||
undead = _min(deathcount(r), 2 + lovar(force));
|
||||
|
||||
if (cast_level <= 8) {
|
||||
race = new_race[RC_SKELETON];
|
||||
race = get_race(RC_SKELETON);
|
||||
} else if (cast_level <= 12) {
|
||||
race = new_race[RC_ZOMBIE];
|
||||
race = get_race(RC_ZOMBIE);
|
||||
} else {
|
||||
race = new_race[RC_GHOUL];
|
||||
race = get_race(RC_GHOUL);
|
||||
}
|
||||
|
||||
u = create_unit(r, mage->faction, undead, race, 0, NULL, mage);
|
||||
|
@ -3641,7 +3641,7 @@ static int sp_rallypeasantmob(castorder * co)
|
|||
|
||||
for (u = r->units; u; u = un) {
|
||||
un = u->next;
|
||||
if (is_monsters(u->faction) && u_race(u) == new_race[RC_PEASANT]) {
|
||||
if (is_monsters(u->faction) && u_race(u) == get_race(RC_PEASANT)) {
|
||||
rsetpeasants(r, rpeasants(r) + u->number);
|
||||
rsetmoney(r, rmoney(r) + get_money(u));
|
||||
set_money(u, 0);
|
||||
|
@ -3709,7 +3709,7 @@ static int sp_raisepeasantmob(castorder * co)
|
|||
assert(rpeasants(r) >= 0);
|
||||
|
||||
u =
|
||||
create_unit(r, monsters, n, new_race[RC_PEASANT], 0, LOC(monsters->locale,
|
||||
create_unit(r, monsters, n, get_race(RC_PEASANT), 0, LOC(monsters->locale,
|
||||
"furious_mob"), NULL);
|
||||
fset(u, UFL_ISNEW);
|
||||
guard(u, GUARD_ALL);
|
||||
|
@ -3984,7 +3984,7 @@ static int sp_bigrecruit(castorder * co)
|
|||
* Rekrutierungskosten mit einfliessen lassen. */
|
||||
|
||||
n = (int)force + lovar((force * force * 1000) / f->race->recruitcost);
|
||||
if (f->race == new_race[RC_ORC]) {
|
||||
if (f->race == get_race(RC_ORC)) {
|
||||
n = _min(2 * maxp, n);
|
||||
n = _max(n, 1);
|
||||
rsetpeasants(r, maxp - (n + 1) / 2);
|
||||
|
@ -4062,7 +4062,7 @@ static int sp_pump(castorder * co)
|
|||
}
|
||||
|
||||
u =
|
||||
create_unit(rt, mage->faction, RS_FARVISION, new_race[RC_SPELL], 0,
|
||||
create_unit(rt, mage->faction, RS_FARVISION, get_race(RC_SPELL), 0,
|
||||
"spell/pump", NULL);
|
||||
u->age = 2;
|
||||
set_level(u, SK_PERCEPTION, eff_skill(target, SK_PERCEPTION, u->region));
|
||||
|
@ -4288,7 +4288,7 @@ static int sp_raisepeasants(castorder * co)
|
|||
rsetpeasants(r, rpeasants(r) - bauern);
|
||||
|
||||
u2 =
|
||||
create_unit(r, mage->faction, bauern, new_race[RC_PEASANT], 0,
|
||||
create_unit(r, mage->faction, bauern, get_race(RC_PEASANT), 0,
|
||||
LOC(mage->faction->locale, "furious_mob"), mage);
|
||||
|
||||
fset(u2, UFL_LOCKED);
|
||||
|
@ -4672,7 +4672,7 @@ int sp_clonecopy(castorder * co)
|
|||
_snprintf(name, sizeof(name), (const char *)LOC(mage->faction->locale,
|
||||
"clone_of"), unitname(mage));
|
||||
clone =
|
||||
create_unit(target_region, mage->faction, 1, new_race[RC_CLONE], 0, name,
|
||||
create_unit(target_region, mage->faction, 1, get_race(RC_CLONE), 0, name,
|
||||
mage);
|
||||
setstatus(clone, ST_FLEE);
|
||||
fset(clone, UFL_LOCKED);
|
||||
|
@ -4723,7 +4723,7 @@ int sp_dreamreading(castorder * co)
|
|||
}
|
||||
|
||||
u2 =
|
||||
create_unit(u->region, mage->faction, RS_FARVISION, new_race[RC_SPELL], 0,
|
||||
create_unit(u->region, mage->faction, RS_FARVISION, get_race(RC_SPELL), 0,
|
||||
"spell/dreamreading", NULL);
|
||||
set_number(u2, 1);
|
||||
u2->age = 2; /* Nur fuer diese Runde. */
|
||||
|
@ -5518,7 +5518,7 @@ int sp_showastral(castorder * co)
|
|||
region *r2 = rl2->data;
|
||||
if (!is_cursed(r2->attribs, C_ASTRALBLOCK, 0)) {
|
||||
for (u = r2->units; u; u = u->next) {
|
||||
if (u_race(u) != new_race[RC_SPECIAL] && u_race(u) != new_race[RC_SPELL])
|
||||
if (u_race(u) != get_race(RC_SPECIAL) && u_race(u) != get_race(RC_SPELL))
|
||||
n++;
|
||||
}
|
||||
}
|
||||
|
@ -5538,7 +5538,7 @@ int sp_showastral(castorder * co)
|
|||
for (rl2 = rl; rl2; rl2 = rl2->next) {
|
||||
if (!is_cursed(rl2->data->attribs, C_ASTRALBLOCK, 0)) {
|
||||
for (u = rl2->data->units; u; u = u->next) {
|
||||
if (u_race(u) != new_race[RC_SPECIAL] && u_race(u) != new_race[RC_SPELL]) {
|
||||
if (u_race(u) != get_race(RC_SPECIAL) && u_race(u) != get_race(RC_SPELL)) {
|
||||
c++;
|
||||
scat(unitname(u));
|
||||
scat(" (");
|
||||
|
@ -5596,7 +5596,7 @@ int sp_viewreality(castorder * co)
|
|||
region *rt = rl2->data;
|
||||
if (!is_cursed(rt->attribs, C_ASTRALBLOCK, 0)) {
|
||||
u =
|
||||
create_unit(rt, mage->faction, RS_FARVISION, new_race[RC_SPELL], 0,
|
||||
create_unit(rt, mage->faction, RS_FARVISION, get_race(RC_SPELL), 0,
|
||||
"spell/viewreality", NULL);
|
||||
set_level(u, SK_PERCEPTION, co->level / 2);
|
||||
u->age = 2;
|
||||
|
@ -5678,7 +5678,7 @@ int sp_disruptastral(castorder * co)
|
|||
|
||||
if (trl != NULL) {
|
||||
for (u = r2->units; u; u = u->next) {
|
||||
if (u_race(u) != new_race[RC_SPELL]) {
|
||||
if (u_race(u) != get_race(RC_SPELL)) {
|
||||
region_list *trl2 = trl;
|
||||
region *tr;
|
||||
int c = rng_int() % inhab_regions;
|
||||
|
|
14
src/spy.c
14
src/spy.c
|
@ -238,16 +238,16 @@ int setstealth_cmd(unit * u, struct order *ord)
|
|||
trace = findrace(s, u->faction->locale);
|
||||
if (trace) {
|
||||
/* demons can cloak as other player-races */
|
||||
if (u_race(u) == new_race[RC_DAEMON]) {
|
||||
if (u_race(u) == get_race(RC_DAEMON)) {
|
||||
race_t allowed[] = { RC_DWARF, RC_ELF, RC_ORC, RC_GOBLIN, RC_HUMAN,
|
||||
RC_TROLL, RC_DAEMON, RC_INSECT, RC_HALFLING, RC_CAT, RC_AQUARIAN,
|
||||
NORACE
|
||||
};
|
||||
int i;
|
||||
for (i = 0; allowed[i] != NORACE; ++i)
|
||||
if (new_race[allowed[i]] == trace)
|
||||
if (get_race(allowed[i]) == trace)
|
||||
break;
|
||||
if (new_race[allowed[i]] == trace) {
|
||||
if (get_race(allowed[i]) == trace) {
|
||||
u->irace = trace;
|
||||
if (u_race(u)->flags & RCF_SHAPESHIFTANY && get_racename(u->attribs))
|
||||
set_racename(&u->attribs, NULL);
|
||||
|
@ -256,10 +256,10 @@ int setstealth_cmd(unit * u, struct order *ord)
|
|||
}
|
||||
|
||||
/* Singdrachen koennen sich nur als Drachen tarnen */
|
||||
if (u_race(u) == new_race[RC_SONGDRAGON]
|
||||
|| u_race(u) == new_race[RC_BIRTHDAYDRAGON]) {
|
||||
if (trace == new_race[RC_SONGDRAGON] || trace == new_race[RC_FIREDRAGON]
|
||||
|| trace == new_race[RC_DRAGON] || trace == new_race[RC_WYRM]) {
|
||||
if (u_race(u) == get_race(RC_SONGDRAGON)
|
||||
|| u_race(u) == get_race(RC_BIRTHDAYDRAGON)) {
|
||||
if (trace == get_race(RC_SONGDRAGON) || trace == get_race(RC_FIREDRAGON)
|
||||
|| trace == get_race(RC_DRAGON) || trace == get_race(RC_WYRM)) {
|
||||
u->irace = trace;
|
||||
if (u_race(u)->flags & RCF_SHAPESHIFTANY && get_racename(u->attribs))
|
||||
set_racename(&u->attribs, NULL);
|
||||
|
|
|
@ -95,7 +95,7 @@ bool is_migrant(unit * u)
|
|||
return false;
|
||||
if (is_familiar(u))
|
||||
return false;
|
||||
if (u_race(u) == new_race[RC_TOAD])
|
||||
if (u_race(u) == get_race(RC_TOAD))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
|
@ -104,7 +104,7 @@ bool is_migrant(unit * u)
|
|||
/* ------------------------------------------------------------- */
|
||||
bool magic_lowskill(unit * u)
|
||||
{
|
||||
return (u_race(u) == new_race[RC_TOAD]) ? true : false;
|
||||
return (u_race(u) == get_race(RC_TOAD)) ? true : false;
|
||||
}
|
||||
|
||||
/* ------------------------------------------------------------- */
|
||||
|
@ -574,7 +574,7 @@ int learn_cmd(unit * u, order * ord)
|
|||
}
|
||||
|
||||
/* snotlings koennen Talente nur bis T8 lernen */
|
||||
if (u_race(u) == new_race[RC_SNOTLING]) {
|
||||
if (u_race(u) == get_race(RC_SNOTLING)) {
|
||||
if (get_level(u, sk) >= 8) {
|
||||
cmistake(u, ord, 308, MSG_EVENT);
|
||||
return 0;
|
||||
|
|
|
@ -181,13 +181,14 @@ void report_summary(summary * s, summary * o, bool full)
|
|||
}
|
||||
|
||||
for (i = 0; i < MAXRACES; i++) {
|
||||
const race *rc = new_race[i];
|
||||
if (s->factionrace[i] && rc && playerrace(rc)
|
||||
&& i != RC_TEMPLATE && i != RC_CLONE) {
|
||||
fprintf(F, "%13s%s: %s\n", LOC(default_locale, rc_name(rc, 3)),
|
||||
LOC(default_locale, "stat_tribe_p"), pcomp(s->factionrace[i],
|
||||
o->factionrace[i]));
|
||||
}
|
||||
if (i != RC_TEMPLATE && i != RC_CLONE && s->factionrace[i]) {
|
||||
const race *rc = get_race(i);
|
||||
if (rc && playerrace(rc)) {
|
||||
fprintf(F, "%13s%s: %s\n", LOC(default_locale, rc_name(rc, 3)),
|
||||
LOC(default_locale, "stat_tribe_p"), pcomp(s->factionrace[i],
|
||||
o->factionrace[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (full) {
|
||||
|
@ -211,22 +212,23 @@ void report_summary(summary * s, summary * o, bool full)
|
|||
fprintf(F, "\n");
|
||||
if (full) {
|
||||
for (i = 0; i < MAXRACES; i++) {
|
||||
const race *rc = new_race[i];
|
||||
if (s->poprace[i]) {
|
||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(rc, 1)),
|
||||
const race *rc = get_race(i);
|
||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(rc, 1)),
|
||||
rcomp(s->poprace[i], o->poprace[i]));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < MAXRACES; i++) {
|
||||
const race *rc = new_race[i];
|
||||
if (s->poprace[i] && playerrace(rc)
|
||||
&& i != RC_TEMPLATE && i != RC_CLONE) {
|
||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(rc, 1)),
|
||||
rcomp(s->poprace[i], o->poprace[i]));
|
||||
for (i = 0; i < MAXRACES; i++) {
|
||||
if (i != RC_TEMPLATE && i != RC_CLONE && s->poprace[i]) {
|
||||
const race *rc = get_race(i);
|
||||
if (playerrace(rc)) {
|
||||
fprintf(F, "%20s: %s\n", LOC(default_locale, rc_name(rc, 1)),
|
||||
rcomp(s->poprace[i], o->poprace[i]));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (full) {
|
||||
fprintf(F, "\nWaffen: %s\n", pcomp(s->waffen, o->waffen));
|
||||
|
|
Loading…
Reference in a new issue