diff --git a/src/battle.c b/src/battle.c index 835917e62..a0e03f1f9 100644 --- a/src/battle.c +++ b/src/battle.c @@ -104,8 +104,6 @@ const troop no_troop = { 0, 0 }; #define LOOT_KEEPLOOT (1<<4) #define DAMAGE_CRITICAL (1<<0) -#define DAMAGE_MELEE_BONUS (1<<1) -#define DAMAGE_MISSILE_BONUS (1<<2) /* deprecated */ #define DAMAGE_SKILL_BONUS (1<<4) static int max_turns; @@ -117,7 +115,7 @@ static int flee_chance_skill_bonus; static int skill_formula; static int rule_cavalry_skill; static int rule_population_damage; -static int rule_hero_speed; +static unsigned char rule_hero_speed; static bool rule_anon_battle; static bool rule_igjarjuk_curse; static int rule_goblin_bonus; @@ -139,7 +137,7 @@ static void init_rules(void) rule_nat_armor = config_get_int("rules.combat.nat_armor", 0); rule_tactics_formula = config_get_int("rules.tactics.formula", 0); rule_goblin_bonus = config_get_int("rules.combat.goblinbonus", 10); - rule_hero_speed = config_get_int("rules.combat.herospeed", 10); + rule_hero_speed = (unsigned char)config_get_int("rules.combat.herospeed", 10); rule_population_damage = config_get_int("rules.combat.populationdamage", 20); rule_anon_battle = config_get_int("rules.stealth.anon_battle", 1) != 0; rule_igjarjuk_curse = config_get_int("rules.combat.igjarjuk_curse", 0) != 0; @@ -157,12 +155,6 @@ static void init_rules(void) if (config_get_int("rules.combat.critical", 1)) { rule_damage |= DAMAGE_CRITICAL; } - if (config_get_int("rules.combat.melee_bonus", 1)) { - rule_damage |= DAMAGE_MELEE_BONUS; - } - if (config_get_int("rules.combat.missile_bonus", 1)) { /* deprecated */ - rule_damage |= DAMAGE_MISSILE_BONUS; - } if (config_get_int("rules.combat.skill_bonus", 1)) { rule_damage |= DAMAGE_SKILL_BONUS; } @@ -1304,9 +1296,7 @@ terminate(troop dt, troop at, int type, const char *damage_formula, bool missile if (awtype == NULL || !fval(awtype, WTF_MISSILE)) { /* melee bonus */ - if (rule_damage & DAMAGE_MELEE_BONUS) { - damage += af->person[at.index].damage; - } + damage += af->person[at.index].damage; } /* Skilldifferenzbonus */ @@ -3158,7 +3148,7 @@ fighter *make_fighter(battle * b, unit * u, side * s1, bool attack) fig->person[i].hp++; if (i < speeded) - fig->person[i].speed = speed; + fig->person[i].speed = (unsigned char) speed; else fig->person[i].speed = 1; diff --git a/src/battle.h b/src/battle.h index 0ce76bfea..83bcaf09a 100644 --- a/src/battle.h +++ b/src/battle.h @@ -81,9 +81,9 @@ extern "C" { int nsides; struct selist *meffects; int max_tactics; - int turn; + unsigned char turn; + signed char keeploot; /* keep (50 + keeploot) percent of items as loot */ bool has_tactics_turn; - int keeploot; bool reelarrow; int alive; struct { @@ -153,13 +153,13 @@ extern "C" { int catmsg; /* Merkt sich, ob Katapultmessage schon generiert. */ struct person { int hp; /* Trefferpunkte der Personen */ - int attack; - int defense; - int damage; int flags; - int speed; - int reload; - int last_action; + int attack; /* weapon skill bonus for attacker */ + int defense; /* weapon skill bonus for defender */ + char damage; /* bonus damage for melee attacks (e.g. troll belt) */ + unsigned char speed; + unsigned char reload; + unsigned char last_action; struct weapon *missile; /* missile weapon */ struct weapon *melee; /* melee weapon */ } *person; diff --git a/src/exparse.c b/src/exparse.c index 4160b32ba..a9c21b025 100644 --- a/src/exparse.c +++ b/src/exparse.c @@ -280,7 +280,7 @@ static void handle_weapon(parseinfo *pi, const XML_Char *el, const XML_Char **at wtype->defmod = xml_int(attr[i + 1]); } else if (xml_strequal(attr[i], "reload")) { - wtype->reload = xml_int(attr[i + 1]); + wtype->reload = (unsigned char) xml_int(attr[i + 1]); } else if (xml_strequal(attr[i], "skill")) { wtype->skill = findskill(attr[i + 1]); diff --git a/src/kernel/item.c b/src/kernel/item.c index 1533d65bc..0d2764412 100644 --- a/src/kernel/item.c +++ b/src/kernel/item.c @@ -260,7 +260,7 @@ luxury_type *new_luxurytype(item_type * itype, int price) weapon_type *new_weapontype(item_type * itype, int wflags, variant magres, const char *damage[], int offmod, int defmod, - int reload, skill_t sk) + unsigned char reload, skill_t sk) { weapon_type *wtype; diff --git a/src/kernel/item.h b/src/kernel/item.h index 0b90b7b1e..46b27505f 100644 --- a/src/kernel/item.h +++ b/src/kernel/item.h @@ -169,7 +169,7 @@ extern "C" { int offmod; int defmod; variant magres; - int reload; /* time to reload this weapon */ + unsigned char reload; /* time to reload this weapon */ weapon_mod *modifiers; /* --- functions --- */ bool(*attack) (const struct troop *, const struct weapon_type *, @@ -208,7 +208,7 @@ extern "C" { item_type *it_get_or_create(resource_type *rtype); luxury_type *new_luxurytype(item_type * itype, int price); weapon_type *new_weapontype(item_type * itype, int wflags, - variant magres, const char *damage[], int offmod, int defmod, int reload, + variant magres, const char *damage[], int offmod, int defmod, unsigned char reload, skill_t sk); void free_wtype(struct weapon_type *wtype); armor_type *new_armortype(item_type * itype, double penalty, diff --git a/src/spells/combatspells.c b/src/spells/combatspells.c index f4b8b6954..dea37345b 100644 --- a/src/spells/combatspells.c +++ b/src/spells/combatspells.c @@ -1378,7 +1378,7 @@ int sp_keeploot(struct castorder * co) message_all(b, m); msg_release(m); - b->keeploot = (int)fmax(25, b->keeploot + 5 * power); + b->keeploot = (signed char) fmax(25, b->keeploot + 5 * power); return level; }