From 4247ef96b17dcab6a91997b5034d58810067bf5d Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 21 Jan 2018 11:14:55 +0100 Subject: [PATCH] why are we using the short type? --- src/alchemy.c | 2 +- src/bind_unit.c | 2 +- src/economy.c | 2 +- src/kernel/region.c | 6 +++--- src/kernel/region.h | 4 ++-- src/laws.c | 6 +++--- 6 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/alchemy.c b/src/alchemy.c index cf3d2b376..75212e34a 100644 --- a/src/alchemy.c +++ b/src/alchemy.c @@ -115,7 +115,7 @@ void herbsearch(unit * u, int max_take) (double)rherbs(r) / 100.0F, -0.01F); if (herbsfound > herbs) herbsfound = herbs; - rsetherbs(r, (short) (rherbs(r) - herbsfound)); + rsetherbs(r, rherbs(r) - herbsfound); if (herbsfound) { produceexp(u, SK_HERBALISM, u->number); diff --git a/src/bind_unit.c b/src/bind_unit.c index ec7a799f0..4dd6313d8 100644 --- a/src/bind_unit.c +++ b/src/bind_unit.c @@ -327,7 +327,7 @@ static int tolua_unit_get_age(lua_State * L) static int tolua_unit_set_age(lua_State * L) { unit *self = (unit *)tolua_tousertype(L, 1, 0); - self->age = (short)tolua_tonumber(L, 2, 0); + self->age = (int)tolua_tonumber(L, 2, 0); return 0; } diff --git a/src/economy.c b/src/economy.c index fcba85955..b675f0b09 100644 --- a/src/economy.c +++ b/src/economy.c @@ -2071,7 +2071,7 @@ static void plant(unit * u, int raw) /* Alles ok. Abziehen. */ use_pooled(u, rt_water, GET_DEFAULT, 1); use_pooled(u, itype->rtype, GET_DEFAULT, n); - rsetherbs(r, (short)(rherbs(r) + planted)); + rsetherbs(r, rherbs(r) + planted); ADDMSG(&u->faction->msgs, msg_message("plant", "unit region amount herb", u, r, planted, itype->rtype)); } diff --git a/src/kernel/region.c b/src/kernel/region.c index c7e99c735..3f25f156b 100644 --- a/src/kernel/region.c +++ b/src/kernel/region.c @@ -664,7 +664,7 @@ void rsetherbs(region *r, int value) assert(r->land || value==0); assert(value >= 0 && value<=SHRT_MAX); if (r->land) { - r->land->herbs = (short)value; + r->land->herbs = value; } } @@ -1190,7 +1190,7 @@ void terraform_region(region * r, const terrain_type * terrain) } if (itype != NULL) { rsetherbtype(r, itype); - rsetherbs(r, (short)(50 + rng_int() % 31)); + rsetherbs(r, 50 + rng_int() % 31); } else { rsetherbtype(r, NULL); @@ -1455,7 +1455,7 @@ int region_get_morale(const region * r) void region_set_morale(region * r, int morale, int turn) { if (r->land) { - r->land->morale = (short)morale; + r->land->morale = morale; if (turn >= 0 && r->land->ownership) { r->land->ownership->morale_turn = turn; } diff --git a/src/kernel/region.h b/src/kernel/region.h index 4c0fbc187..ce1f9ea94 100644 --- a/src/kernel/region.h +++ b/src/kernel/region.h @@ -102,8 +102,8 @@ extern "C" { char *display; demand *demands; const struct item_type *herbtype; - short herbs; - short morale; + int herbs; + int morale; int trees[3]; /* 0 -> seeds, 1 -> shoots, 2 -> trees */ int horses; int peasants; diff --git a/src/laws.c b/src/laws.c index 64749cca2..7b416f8a4 100644 --- a/src/laws.c +++ b/src/laws.c @@ -2530,12 +2530,12 @@ int group_cmd(unit * u, struct order *ord) int origin_cmd(unit * u, struct order *ord) { - short px, py; + int px, py; init_order_depr(ord); - px = (short)getint(); - py = (short)getint(); + px = getint(); + py = getint(); faction_setorigin(u->faction, getplaneid(u->region), px, py); return 0;