forked from github/server
optimization: no need to look for a curse if unit has no attribs.
This commit is contained in:
parent
40d9ebfa94
commit
8ff26eb0e4
19
src/move.c
19
src/move.c
|
@ -1463,8 +1463,6 @@ static void make_route(unit * u, order * ord, region_list ** routep)
|
|||
static int movement_speed(unit * u)
|
||||
{
|
||||
int mp = BP_WALKING;
|
||||
static const curse_type *speed_ct;
|
||||
static bool init = false;
|
||||
double dk = u_race(u)->speed;
|
||||
|
||||
assert(u->number);
|
||||
|
@ -1482,15 +1480,14 @@ static int movement_speed(unit * u)
|
|||
break;
|
||||
}
|
||||
|
||||
if (!init) {
|
||||
init = true;
|
||||
speed_ct = ct_find("speed");
|
||||
}
|
||||
if (speed_ct) {
|
||||
curse *c = get_curse(u->attribs, speed_ct);
|
||||
if (c != NULL) {
|
||||
int men = get_cursedmen(u, c);
|
||||
dk *= 1.0 + (double)men / (double)u->number;
|
||||
if (u->attribs) {
|
||||
const curse_type *speed_ct = ct_find("speed");
|
||||
if (speed_ct) {
|
||||
curse *c = get_curse(u->attribs, speed_ct);
|
||||
if (c != NULL) {
|
||||
int men = get_cursedmen(u, c);
|
||||
dk *= 1.0 + (double)men / (double)u->number;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -270,18 +270,18 @@ report_items(const unit *u, item * result, int size, const unit * owner,
|
|||
{
|
||||
const item *itm, *items = u->items;
|
||||
int n = 0; /* number of results */
|
||||
bool itemcloak = false;
|
||||
const curse_type *itemcloak_ct = ct_find("itemcloak");
|
||||
|
||||
assert(owner == NULL || viewer != owner->faction);
|
||||
assert(size);
|
||||
|
||||
if (itemcloak_ct) {
|
||||
curse * cu = get_curse(u->attribs, itemcloak_ct);
|
||||
itemcloak = cu && curse_active(cu);
|
||||
}
|
||||
if (itemcloak) {
|
||||
return 0;
|
||||
if (u->attribs) {
|
||||
const curse_type *itemcloak_ct = ct_find("itemcloak");
|
||||
if (itemcloak_ct) {
|
||||
curse * cu = get_curse(u->attribs, itemcloak_ct);
|
||||
if (cu && curse_active(cu)) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
for (itm = items; itm; itm = itm->next) {
|
||||
item *ishow;
|
||||
|
|
Loading…
Reference in New Issue