why are we using the short type?

This commit is contained in:
Enno Rehling 2018-01-21 11:14:55 +01:00
parent a8abca3f1c
commit 4247ef96b1
6 changed files with 11 additions and 11 deletions

View file

@ -115,7 +115,7 @@ void herbsearch(unit * u, int max_take)
(double)rherbs(r) / 100.0F, -0.01F); (double)rherbs(r) / 100.0F, -0.01F);
if (herbsfound > herbs) herbsfound = herbs; if (herbsfound > herbs) herbsfound = herbs;
rsetherbs(r, (short) (rherbs(r) - herbsfound)); rsetherbs(r, rherbs(r) - herbsfound);
if (herbsfound) { if (herbsfound) {
produceexp(u, SK_HERBALISM, u->number); produceexp(u, SK_HERBALISM, u->number);

View file

@ -327,7 +327,7 @@ static int tolua_unit_get_age(lua_State * L)
static int tolua_unit_set_age(lua_State * L) static int tolua_unit_set_age(lua_State * L)
{ {
unit *self = (unit *)tolua_tousertype(L, 1, 0); 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; return 0;
} }

View file

@ -2071,7 +2071,7 @@ static void plant(unit * u, int raw)
/* Alles ok. Abziehen. */ /* Alles ok. Abziehen. */
use_pooled(u, rt_water, GET_DEFAULT, 1); use_pooled(u, rt_water, GET_DEFAULT, 1);
use_pooled(u, itype->rtype, GET_DEFAULT, n); 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", ADDMSG(&u->faction->msgs, msg_message("plant", "unit region amount herb",
u, r, planted, itype->rtype)); u, r, planted, itype->rtype));
} }

View file

@ -664,7 +664,7 @@ void rsetherbs(region *r, int value)
assert(r->land || value==0); assert(r->land || value==0);
assert(value >= 0 && value<=SHRT_MAX); assert(value >= 0 && value<=SHRT_MAX);
if (r->land) { 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) { if (itype != NULL) {
rsetherbtype(r, itype); rsetherbtype(r, itype);
rsetherbs(r, (short)(50 + rng_int() % 31)); rsetherbs(r, 50 + rng_int() % 31);
} }
else { else {
rsetherbtype(r, NULL); rsetherbtype(r, NULL);
@ -1455,7 +1455,7 @@ int region_get_morale(const region * r)
void region_set_morale(region * r, int morale, int turn) void region_set_morale(region * r, int morale, int turn)
{ {
if (r->land) { if (r->land) {
r->land->morale = (short)morale; r->land->morale = morale;
if (turn >= 0 && r->land->ownership) { if (turn >= 0 && r->land->ownership) {
r->land->ownership->morale_turn = turn; r->land->ownership->morale_turn = turn;
} }

View file

@ -102,8 +102,8 @@ extern "C" {
char *display; char *display;
demand *demands; demand *demands;
const struct item_type *herbtype; const struct item_type *herbtype;
short herbs; int herbs;
short morale; int morale;
int trees[3]; /* 0 -> seeds, 1 -> shoots, 2 -> trees */ int trees[3]; /* 0 -> seeds, 1 -> shoots, 2 -> trees */
int horses; int horses;
int peasants; int peasants;

View file

@ -2530,12 +2530,12 @@ int group_cmd(unit * u, struct order *ord)
int origin_cmd(unit * u, struct order *ord) int origin_cmd(unit * u, struct order *ord)
{ {
short px, py; int px, py;
init_order_depr(ord); init_order_depr(ord);
px = (short)getint(); px = getint();
py = (short)getint(); py = getint();
faction_setorigin(u->faction, getplaneid(u->region), px, py); faction_setorigin(u->faction, getplaneid(u->region), px, py);
return 0; return 0;