forked from github/server
Merge branch 'develop' of github.com:ennorehling/eressea into develop
This commit is contained in:
commit
69dd83a4b1
16
src/battle.c
16
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,10 +1296,8 @@ 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;
|
||||
}
|
||||
}
|
||||
|
||||
/* Skilldifferenzbonus */
|
||||
if (rule_damage & DAMAGE_SKILL_BONUS) {
|
||||
|
@ -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;
|
||||
|
||||
|
|
16
src/battle.h
16
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;
|
||||
|
|
|
@ -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]);
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -54,7 +54,7 @@ extern "C" {
|
|||
/* Flags, die gespeichert werden sollen: */
|
||||
#define UFL_SAVEMASK (UFL_DEFENDER|UFL_MOVED|UFL_NOAID|UFL_ANON_FACTION|UFL_LOCKED|UFL_HUNGER|UFL_TAKEALL|UFL_GUARD|UFL_STEALTH|UFL_GROUP|UFL_HERO)
|
||||
|
||||
#define UNIT_MAXSIZE 50000
|
||||
#define UNIT_MAXSIZE 128 * 1024
|
||||
extern int maxheroes(const struct faction *f);
|
||||
extern int countheroes(const struct faction *f);
|
||||
|
||||
|
|
54
src/move.c
54
src/move.c
|
@ -501,7 +501,7 @@ static double overload(const region * r, ship * sh)
|
|||
double ovl;
|
||||
|
||||
getshipweight(sh, &n, &p);
|
||||
ovl = n / (double)sh->type->cargo;
|
||||
ovl = n / (double)(sh->type->cargo * sh->number);
|
||||
if (mcabins) {
|
||||
ovl = fmax(ovl, p / (double)mcabins);
|
||||
}
|
||||
|
@ -746,7 +746,7 @@ double damage_overload(double overload)
|
|||
}
|
||||
|
||||
/* message to all factions in ship, start from firstu, end before lastu (may be NULL) */
|
||||
static void msg_to_ship_inmates(ship *sh, unit **firstu, unit **lastu, message *msg) {
|
||||
static void msg_to_passengers(ship *sh, unit **firstu, unit **lastu, message *msg) {
|
||||
unit *u, *shipfirst = NULL;
|
||||
for (u = *firstu; u != *lastu; u = u->next) {
|
||||
if (u->ship == sh) {
|
||||
|
@ -836,19 +836,19 @@ static void drifting_ships(region * r)
|
|||
|
||||
if (rnext && firstu) {
|
||||
message *msg = msg_message("ship_drift", "ship dir", sh, dir);
|
||||
msg_to_ship_inmates(sh, &firstu, &lastu, msg);
|
||||
msg_to_passengers(sh, &firstu, &lastu, msg);
|
||||
}
|
||||
|
||||
fset(sh, SF_DRIFTED);
|
||||
if (ovl >= overload_start()) {
|
||||
damage_ship(sh, damage_overload(ovl));
|
||||
msg_to_ship_inmates(sh, &firstu, &lastu, msg_message("massive_overload", "ship", sh));
|
||||
msg_to_passengers(sh, &firstu, &lastu, msg_message("massive_overload", "ship", sh));
|
||||
}
|
||||
else {
|
||||
damage_ship(sh, damage_drift);
|
||||
}
|
||||
if (sh->damage >= sh->size * DAMAGE_SCALE) {
|
||||
msg_to_ship_inmates(sh, &firstu, &lastu, msg_message("shipsink", "ship", sh));
|
||||
msg_to_passengers(sh, &firstu, &lastu, msg_message("shipsink", "ship", sh));
|
||||
sink_ship(sh);
|
||||
remove_ship(shp, sh);
|
||||
}
|
||||
|
@ -1683,12 +1683,13 @@ bool can_takeoff(const ship * sh, const region * from, const region * to)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
|
||||
static void sail(unit * u, order * ord, bool drifting)
|
||||
{
|
||||
region_list *route = NULL;
|
||||
region *starting_point = u->region;
|
||||
region *current_point, *last_point;
|
||||
int k, step = 0;
|
||||
region_list **iroute = routep;
|
||||
region_list **iroute = &route;
|
||||
ship *sh = u->ship;
|
||||
faction *f = u->faction;
|
||||
region *next_point = NULL;
|
||||
|
@ -1698,10 +1699,6 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
|
|||
int lighthouse_div = config_get_int("rules.storm.lighthouse.divisor", 0);
|
||||
const char *token = getstrtoken();
|
||||
|
||||
if (routep) {
|
||||
*routep = NULL;
|
||||
}
|
||||
|
||||
error = movewhere(u, token, starting_point, &next_point);
|
||||
if (error) {
|
||||
message *msg = movement_error(u, token, ord, error);
|
||||
|
@ -1940,7 +1937,7 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
|
|||
if (fval(u, UFL_FOLLOWING))
|
||||
caught_target(current_point, u);
|
||||
|
||||
move_ship(sh, starting_point, current_point, routep ? *routep : NULL);
|
||||
move_ship(sh, starting_point, current_point, route);
|
||||
|
||||
/* Hafengebuehren ? */
|
||||
|
||||
|
@ -1982,6 +1979,7 @@ static void sail(unit * u, order * ord, region_list ** routep, bool drifting)
|
|||
}
|
||||
}
|
||||
}
|
||||
free_regionlist(route);
|
||||
}
|
||||
|
||||
/* Segeln, Wandern, Reiten
|
||||
|
@ -2088,14 +2086,12 @@ static const region_list *travel_i(unit * u, const region_list * route_begin,
|
|||
/** traveling without ships
|
||||
* walking, flying or riding units use this function
|
||||
*/
|
||||
static void travel(unit * u, order *ord, region_list ** routep)
|
||||
static void travel(unit * u, order *ord)
|
||||
{
|
||||
region *r = u->region;
|
||||
region_list *route_begin;
|
||||
follower *followers = NULL;
|
||||
region_list *route = NULL;
|
||||
|
||||
assert(routep);
|
||||
*routep = NULL;
|
||||
region *r = u->region;
|
||||
follower *followers = NULL;
|
||||
|
||||
/* a few pre-checks that need not be done for each step: */
|
||||
if (!fval(r->terrain, SEA_REGION)) {
|
||||
|
@ -2131,12 +2127,10 @@ static void travel(unit * u, order *ord, region_list ** routep)
|
|||
return;
|
||||
}
|
||||
|
||||
make_route(u, ord, routep);
|
||||
route_begin = *routep;
|
||||
|
||||
if (route_begin) {
|
||||
make_route(u, ord, &route);
|
||||
if (route) {
|
||||
/* und ab die post: */
|
||||
travel_i(u, route_begin, NULL, ord, TRAVEL_NORMAL, &followers);
|
||||
travel_i(u, route, NULL, ord, TRAVEL_NORMAL, &followers);
|
||||
|
||||
/* followers */
|
||||
while (followers != NULL) {
|
||||
|
@ -2157,34 +2151,30 @@ static void travel(unit * u, order *ord, region_list ** routep)
|
|||
follow_order = create_order(K_FOLLOW, lang, "%s %i",
|
||||
s, ut->no);
|
||||
|
||||
route_end = reroute(uf, route_begin, route_end);
|
||||
travel_i(uf, route_begin, route_end, follow_order, TRAVEL_FOLLOWING,
|
||||
route_end = reroute(uf, route, route_end);
|
||||
travel_i(uf, route, route_end, follow_order, TRAVEL_FOLLOWING,
|
||||
&followers);
|
||||
caught_target(uf->region, uf);
|
||||
free_order(follow_order);
|
||||
}
|
||||
}
|
||||
free_regionlist(route);
|
||||
}
|
||||
}
|
||||
|
||||
void move_cmd(unit * u, order * ord)
|
||||
{
|
||||
region_list *route = NULL;
|
||||
|
||||
assert(u->number);
|
||||
if (u->ship && u == ship_owner(u->ship)) {
|
||||
bool drifting = (getkeyword(ord) == K_MOVE);
|
||||
sail(u, ord, &route, drifting);
|
||||
sail(u, ord, drifting);
|
||||
}
|
||||
else {
|
||||
travel(u, ord, &route);
|
||||
travel(u, ord);
|
||||
}
|
||||
|
||||
fset(u, UFL_LONGACTION | UFL_NOTMOVING);
|
||||
set_order(&u->thisorder, NULL);
|
||||
|
||||
if (route != NULL)
|
||||
free_regionlist(route);
|
||||
}
|
||||
|
||||
static void age_traveldir(region * r)
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue