findunitg was deprecated.

This commit is contained in:
Enno Rehling 2018-02-25 18:35:40 +01:00
parent 4181e23d15
commit 8c554edfee
6 changed files with 6 additions and 25 deletions

View File

@ -75,8 +75,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#define FIND_FOREIGN_TEMP
int weight(const unit * u) int weight(const unit * u)
{ {
int w = 0, n = 0, in_bag = 0; 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; 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 #define UMAXHASH MAXUNITS
static unit *unithash[UMAXHASH]; static unit *unithash[UMAXHASH];
static unit *delmarker = (unit *)unithash; /* a funny hack */ static unit *delmarker = (unit *)unithash; /* a funny hack */
@ -416,9 +401,6 @@ int remove_unit(unit ** ulist, unit * u)
u->next = deleted_units; u->next = deleted_units;
deleted_units = u; deleted_units = u;
#ifdef DMAXHASH
dhash(u->no, u->faction);
#endif
u->region = NULL; 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) for (u2 = r->units; u2; u2 = u2->next)
if (u2->faction == f && ualias(u2) == n) if (u2->faction == f && ualias(u2) == n)
return u2; return u2;
#ifdef FIND_FOREIGN_TEMP
for (u2 = r->units; u2; u2 = u2->next) for (u2 = r->units; u2; u2 = u2->next)
if (ualias(u2) == n) if (ualias(u2) == n)
return u2; return u2;
#endif
return 0; return 0;
} }

View File

@ -248,7 +248,6 @@ extern "C" {
void remove_empty_units_in_region(struct region * r); void remove_empty_units_in_region(struct region * r);
void remove_empty_units(void); void remove_empty_units(void);
struct unit *findunitg(int n, const struct region *hint);
struct unit *findunit(int n); struct unit *findunit(int n);
struct unit *findunitr(const struct region *r, int n); struct unit *findunitr(const struct region *r, int n);

View File

@ -772,7 +772,7 @@ void plan_monsters(faction * f)
} }
} }
else if (tu) { else if (tu) {
tu = findunitg(ta->data.i, NULL); tu = findunit(ta->data.i);
if (tu != NULL) { if (tu != NULL) {
long_order = make_movement_order(u, tu->region, 2, allowed_walk); long_order = make_movement_order(u, tu->region, 2, allowed_walk);
} }

View File

@ -27,7 +27,7 @@ static unit *unitorders(input *in, faction *f)
return NULL; return NULL;
i = getid(); i = getid();
u = findunitg(i, NULL); u = findunit(i);
if (u && u->faction == f) { if (u && u->faction == f) {
order **ordp; order **ordp;

View File

@ -113,7 +113,7 @@ int renumber_cmd(unit * u, order * ord)
break; break;
} }
if (findunitg(i, u->region)) { if (findunit(i)) {
cmistake(u, ord, 115, MSG_EVENT); cmistake(u, ord, 115, MSG_EVENT);
break; break;
} }

View File

@ -71,7 +71,7 @@ void expandstealing(region * r, econ_request * stealorders)
break; break;
} }
u = findunitg(requests[j]->type.steal.no, r); u = findunit(requests[j]->type.steal.no);
if (u && u->region == r) { if (u && u->region == r) {
n = get_pooled(u, rsilver, GET_ALL, INT_MAX); n = get_pooled(u, rsilver, GET_ALL, INT_MAX);