@ -292,9 +292,9 @@ void DFHack::describeUnit(BasicUnitInfo *info, df::unit *unit,
if (!unit->custom_profession.empty())
info->set_custom_profession(unit->custom_profession);
if (unit->military.squad_index >= 0)
if (unit->military.squad_id >= 0)
{
info->set_squad_id(unit->military.squad_index);
info->set_squad_id(unit->military.squad_id);
info->set_squad_position(unit->military.squad_position);
}
@ -93,7 +93,7 @@ orders.race = {
orders.squad = {
key = function(unit)
local sidx = unit.military.squad_index
local sidx = unit.military.squad_id
if sidx >= 0 then
return sidx
end
@ -102,7 +102,7 @@ orders.squad = {
orders.squad_position = {
return sidx * 1000 + unit.military.squad_position
@ -115,4 +115,4 @@ orders.happiness = {
return _ENV
@ -92,7 +92,7 @@ module DFHack
# filter 'attend meeting'
not u.specific_refs.find { |s| s.type == :ACTIVITY } and
# filter soldiers (TODO check schedule)
u.military.squad_index == -1 and
u.military.squad_id == -1 and
# filter 'on break'
not u.status.misc_traits.find { |t| t.id == :OnBreak }
@ -640,7 +640,7 @@ struct military_assign_hook : df::viewscreen_layer_militaryst {
for (int y = y1, i = i1; i <= i2; i++, y++)
auto unit = vector_get(positions.candidates, i);
if (!unit || unit->military.squad_index < 0)
if (!unit || unit->military.squad_id < 0)
continue;
for (int x = x1; x <= x2; x++)
@ -89,7 +89,7 @@ end
for _,v in ipairs(df.global.world.units.active) do
local x,y,z = dfhack.units.getPosition(v)
if x and dfhack.units.isCitizen(v) and is_in_burrows(xyz2pos(x,y,z)) then
if not in_siege and v.military.squad_index < 0 then
if not in_siege and v.military.squad_id < 0 then
add_thought(v, df.unit_thought_type.LackProtection)
wake_unit(v)