follow df-structure rename unit.unknown8 + able_stand_*

develop
jj 2012-12-10 22:50:33 +01:00
parent 0403e008d5
commit 6bc791d985
5 changed files with 19 additions and 16 deletions

@ -785,10 +785,10 @@ bool DFHack::Units::isSane(df::unit *unit)
if (unit->flags1.bits.dead ||
unit->flags3.bits.ghostly ||
isOpposedToLife(unit) ||
unit->unknown8.unk2)
unit->enemy.undead)
return false;
if (unit->unknown8.normal_race == unit->unknown8.were_race && isCrazed(unit))
if (unit->enemy.normal_race == unit->enemy.were_race && isCrazed(unit))
return false;
switch (unit->mood)
@ -839,7 +839,7 @@ bool DFHack::Units::isDwarf(df::unit *unit)
CHECK_NULL_POINTER(unit);
return unit->race == ui->race_id ||
unit->unknown8.normal_race == ui->race_id;
unit->enemy.normal_race == ui->race_id;
}
double DFHack::Units::getAge(df::unit *unit, bool true_age)
@ -1225,12 +1225,12 @@ int Units::computeMovementSpeed(df::unit *unit)
// Stance
if (!unit->flags1.bits.on_ground && unit->status2.able_stand > 2)
if (!unit->flags1.bits.on_ground && unit->status2.limbs_stand_max > 2)
{
// WTF
int as = unit->status2.able_stand;
int as = unit->status2.limbs_stand_max;
int x = (as-1) - (as>>1);
int y = as - unit->status2.able_stand_impair;
int y = as - unit->status2.limbs_stand_count;
if (unit->flags3.bits.on_crutch) y--;
y = y * 500 / x;
if (y > 0) speed += y;

@ -189,10 +189,10 @@ function healunit(unit)
unit.body.wounds:resize(0) -- memory leak here :/
unit.body.blood_count=unit.body.blood_max
--set flags for standing and grasping...
unit.status2.able_stand=4
unit.status2.able_stand_impair=4
unit.status2.able_grasp=4
unit.status2.able_grasp_impair=4
unit.status2.limbs_stand_max=4
unit.status2.limbs_stand_count=4
unit.status2.limbs_grasp_max=4
unit.status2.limbs_grasp_count=4
--should also set temperatures, and flags for breath etc...
unit.flags1.dead=false
unit.flags2.calculated_bodyparts=false
@ -240,4 +240,4 @@ function powerup(unit,labor_rating,military_rating,skills)
end
menu:add("Power up",powerup)
return _ENV
return _ENV

@ -76,7 +76,7 @@ module DFHack
u.mood == :Berserk or
unit_testflagcurse(u, :CRAZED) or
unit_testflagcurse(u, :OPPOSED_TO_LIFE) or
u.unknown8.unk2 or
u.enemy.undead or
u.flags3.ghostly or
u.flags1.marauder or u.flags1.active_invader or u.flags1.invader_origin or
u.flags1.forest or
@ -113,6 +113,9 @@ module DFHack
true
end
# merchant: df.ui.caravans.find { |cv| cv.entity == u.civ_id }
# diplomat: df.ui.dip_meeting_info.find { |m| m.diplomat_id == u.hist_figure_id or m.diplomat_id2 == u.hist_figure_id }
# list workers (citizen, not crazy / child / inmood / noble)
def unit_workers
world.units.active.find_all { |u|

@ -694,7 +694,7 @@ static int adjust_unit_divisor(int value) {
static bool can_spar(df::unit *unit) {
return unit->counters2.exhaustion <= 2000 && // actually 4000, but leave a gap
(unit->status2.able_grasp_impair > 0 || unit->status2.able_grasp == 0) &&
(unit->status2.limbs_grasp_count > 0 || unit->status2.limbs_grasp_max == 0) &&
(!unit->health || (unit->health->flags.whole&0x7FF) == 0) &&
(!unit->job.current_job || unit->job.current_job != job_type::Rest);
}

@ -38,9 +38,9 @@ def fixunit(unit)
end
# fix the 'is an enemy' cache matrix (mark to be recalculated by the game when needed)
if fixed and unit.unknown8.enemy_status_slot != -1
i = unit.unknown8.enemy_status_slot
unit.unknown8.enemy_status_slot = -1
if fixed and unit.enemy.enemy_status_slot != -1
i = unit.enemy.enemy_status_slot
unit.enemy.enemy_status_slot = -1
cache = df.world.enemy_status_cache
cache.slot_used[i] = false
cache.rel_map[i].map! { -1 }