diff --git a/src/kernel/unit.c b/src/kernel/unit.c index fd0918cc1..a6ab5c2f9 100644 --- a/src/kernel/unit.c +++ b/src/kernel/unit.c @@ -75,8 +75,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include -#define FIND_FOREIGN_TEMP - int weight(const unit * u) { int w = 0, n = 0, in_bag = 0; @@ -124,19 +122,6 @@ unit *findunitr(const region * r, int n) return (u && u->region == r) ? u : 0; } -/* TODO: deprecated, replace with findunit(n) */ -unit *findunitg(int n, const region * hint) -{ - UNUSED_ARG(hint); - /* Abfangen von Syntaxfehlern. */ - if (n <= 0) - return NULL; - - /* findunit global! */ - hint = 0; - return ufindhash(n); -} - #define UMAXHASH MAXUNITS static unit *unithash[UMAXHASH]; static unit *delmarker = (unit *)unithash; /* a funny hack */ @@ -416,9 +401,6 @@ int remove_unit(unit ** ulist, unit * u) u->next = deleted_units; deleted_units = u; -#ifdef DMAXHASH - dhash(u->no, u->faction); -#endif u->region = NULL; @@ -435,11 +417,11 @@ unit *findnewunit(const region * r, const faction * f, int n) for (u2 = r->units; u2; u2 = u2->next) if (u2->faction == f && ualias(u2) == n) return u2; -#ifdef FIND_FOREIGN_TEMP + for (u2 = r->units; u2; u2 = u2->next) if (ualias(u2) == n) return u2; -#endif + return 0; } diff --git a/src/kernel/unit.h b/src/kernel/unit.h index 91a3ec930..b70082a4b 100644 --- a/src/kernel/unit.h +++ b/src/kernel/unit.h @@ -248,7 +248,6 @@ extern "C" { void remove_empty_units_in_region(struct region * r); void remove_empty_units(void); - struct unit *findunitg(int n, const struct region *hint); struct unit *findunit(int n); struct unit *findunitr(const struct region *r, int n); diff --git a/src/monsters.c b/src/monsters.c index d1979414d..d2a7cc68f 100644 --- a/src/monsters.c +++ b/src/monsters.c @@ -772,7 +772,7 @@ void plan_monsters(faction * f) } } else if (tu) { - tu = findunitg(ta->data.i, NULL); + tu = findunit(ta->data.i); if (tu != NULL) { long_order = make_movement_order(u, tu->region, 2, allowed_walk); } diff --git a/src/orderfile.c b/src/orderfile.c index a82b599a0..ac80db0a2 100644 --- a/src/orderfile.c +++ b/src/orderfile.c @@ -27,7 +27,7 @@ static unit *unitorders(input *in, faction *f) return NULL; i = getid(); - u = findunitg(i, NULL); + u = findunit(i); if (u && u->faction == f) { order **ordp; diff --git a/src/renumber.c b/src/renumber.c index 1319eaa5f..45ee0cccc 100644 --- a/src/renumber.c +++ b/src/renumber.c @@ -113,7 +113,7 @@ int renumber_cmd(unit * u, order * ord) break; } - if (findunitg(i, u->region)) { + if (findunit(i)) { cmistake(u, ord, 115, MSG_EVENT); break; } diff --git a/src/steal.c b/src/steal.c index 9403b4fd8..68a4239ec 100644 --- a/src/steal.c +++ b/src/steal.c @@ -71,7 +71,7 @@ void expandstealing(region * r, econ_request * stealorders) break; } - u = findunitg(requests[j]->type.steal.no, r); + u = findunit(requests[j]->type.steal.no); if (u && u->region == r) { n = get_pooled(u, rsilver, GET_ALL, INT_MAX);