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)
|
static int movement_speed(unit * u)
|
||||||
{
|
{
|
||||||
int mp = BP_WALKING;
|
int mp = BP_WALKING;
|
||||||
static const curse_type *speed_ct;
|
|
||||||
static bool init = false;
|
|
||||||
double dk = u_race(u)->speed;
|
double dk = u_race(u)->speed;
|
||||||
|
|
||||||
assert(u->number);
|
assert(u->number);
|
||||||
|
@ -1482,15 +1480,14 @@ static int movement_speed(unit * u)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!init) {
|
if (u->attribs) {
|
||||||
init = true;
|
const curse_type *speed_ct = ct_find("speed");
|
||||||
speed_ct = ct_find("speed");
|
if (speed_ct) {
|
||||||
}
|
curse *c = get_curse(u->attribs, speed_ct);
|
||||||
if (speed_ct) {
|
if (c != NULL) {
|
||||||
curse *c = get_curse(u->attribs, speed_ct);
|
int men = get_cursedmen(u, c);
|
||||||
if (c != NULL) {
|
dk *= 1.0 + (double)men / (double)u->number;
|
||||||
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;
|
const item *itm, *items = u->items;
|
||||||
int n = 0; /* number of results */
|
int n = 0; /* number of results */
|
||||||
bool itemcloak = false;
|
|
||||||
const curse_type *itemcloak_ct = ct_find("itemcloak");
|
|
||||||
|
|
||||||
assert(owner == NULL || viewer != owner->faction);
|
assert(owner == NULL || viewer != owner->faction);
|
||||||
assert(size);
|
assert(size);
|
||||||
|
|
||||||
if (itemcloak_ct) {
|
if (u->attribs) {
|
||||||
curse * cu = get_curse(u->attribs, itemcloak_ct);
|
const curse_type *itemcloak_ct = ct_find("itemcloak");
|
||||||
itemcloak = cu && curse_active(cu);
|
if (itemcloak_ct) {
|
||||||
}
|
curse * cu = get_curse(u->attribs, itemcloak_ct);
|
||||||
if (itemcloak) {
|
if (cu && curse_active(cu)) {
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for (itm = items; itm; itm = itm->next) {
|
for (itm = items; itm; itm = itm->next) {
|
||||||
item *ishow;
|
item *ishow;
|
||||||
|
|
Loading…
Reference in New Issue