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);
if (herbsfound > herbs) herbsfound = herbs;
rsetherbs(r, (short) (rherbs(r) - herbsfound));
rsetherbs(r, rherbs(r) - herbsfound);
if (herbsfound) {
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)
{
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;
}

View File

@ -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));
}

View File

@ -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;
}

View File

@ -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;

View File

@ -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;