From e4026e0f6bc537df7591387113d59be52b81cf83 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Thu, 27 Aug 2015 16:59:39 +0200 Subject: [PATCH] eliminate more non-critical arguments. --- src/economy.c | 12 ++++++------ src/kernel/build.c | 12 ++++++------ src/kernel/build.h | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/economy.c b/src/economy.c index 8e790f666..e01d7b79b 100644 --- a/src/economy.c +++ b/src/economy.c @@ -1526,7 +1526,7 @@ int make_cmd(unit * u, struct order *ord) const char * s = gettoken(token, sizeof(token)); direction_t d = s ? get_direction(s, u->faction->locale) : NODIRECTION; if (d != NODIRECTION) { - build_road(r, u, m, d); + build_road(u, m, d); } else { /* Die Richtung wurde nicht erkannt */ @@ -1541,7 +1541,7 @@ int make_cmd(unit * u, struct order *ord) cmistake(u, ord, 276, MSG_PRODUCE); } else { - continue_ship(r, u, m); + continue_ship(u, m); } return 0; } @@ -1597,7 +1597,7 @@ int make_cmd(unit * u, struct order *ord) cmistake(u, ord, 276, MSG_PRODUCE); } else { - create_ship(r, u, stype, m, ord); + create_ship(u, stype, m, ord); } } else if (btype != NOBUILDING) { @@ -2437,15 +2437,15 @@ static void breedtrees(unit * u, int raw) } /* züchte pferde */ -static void breedhorses(region * r, unit * u) +static void breedhorses(unit * u) { int n, c, breed = 0; struct building *b = inside_building(u); const struct building_type *btype = b ? b->type : NULL; const struct resource_type *rhorse = get_resourcetype(R_HORSE); int horses, effsk; + assert(rhorse && rhorse->itype); - assert(r == u->region); // TODO: param r is unnecessary if (btype != bt_find("stables")) { cmistake(u, u->thisorder, 122, MSG_PRODUCE); return; @@ -2524,7 +2524,7 @@ static void breed_cmd(unit * u, struct order *ord) break; } } - breedhorses(r, u); + breedhorses(u); break; } } diff --git a/src/kernel/build.c b/src/kernel/build.c index a8c42063d..4ce08c39a 100644 --- a/src/kernel/build.c +++ b/src/kernel/build.c @@ -261,13 +261,13 @@ int destroy_cmd(unit * u, struct order *ord) /* ------------------------------------------------------------- */ -void build_road(region * r, unit * u, int size, direction_t d) +void build_road(unit * u, int size, direction_t d) { + region *r = u->region; int n, left, effsk; region *rn = rconnect(r, d); assert(u->number); - assert(r == u->region); // TODO: param r is unnecessary effsk = effskill(u, SK_ROAD_BUILDING, 0); if (!effsk) { cmistake(u, u->thisorder, 103, MSG_PRODUCE); @@ -880,15 +880,15 @@ static void build_ship(unit * u, ship * sh, int want) } void -create_ship(region * r, unit * u, const struct ship_type *newtype, int want, +create_ship(unit * u, const struct ship_type *newtype, int want, order * ord) { ship *sh; int msize; const construction *cons = newtype->construction; order *new_order; + region * r = u->region; - assert(u->region == r); // TODO: param r is unnecessary if (!effskill(u, SK_SHIPBUILDING, 0)) { cmistake(u, ord, 100, MSG_PRODUCE); return; @@ -931,13 +931,13 @@ order * ord) build_ship(u, sh, want); } -void continue_ship(region * r, unit * u, int want) +void continue_ship(unit * u, int want) { const construction *cons; ship *sh; int msize; + region * r = u->region; - assert(u->region == r); // TODO: param r is unnecessary if (!effskill(u, SK_SHIPBUILDING, 0)) { cmistake(u, u->thisorder, 100, MSG_PRODUCE); return; diff --git a/src/kernel/build.h b/src/kernel/build.h index 1e3d59bd5..5e231b198 100644 --- a/src/kernel/build.h +++ b/src/kernel/build.h @@ -68,10 +68,10 @@ extern "C" { extern int destroy_cmd(struct unit *u, struct order *ord); extern int leave_cmd(struct unit *u, struct order *ord); - void build_road(struct region *r, struct unit *u, int size, direction_t d); - void create_ship(struct region *r, struct unit *u, - const struct ship_type *newtype, int size, struct order *ord); - void continue_ship(struct region *r, struct unit *u, int size); + void build_road(struct unit *u, int size, direction_t d); + void create_ship(struct unit *u, const struct ship_type *newtype, + int size, struct order *ord); + void continue_ship(struct unit *u, int size); struct building *getbuilding(const struct region *r); struct ship *getship(const struct region *r);