fix for updated viewlist_petst

develop
jj 2012-09-26 18:13:01 +02:00
parent d975ce5135
commit 7cc29250f8
3 changed files with 12 additions and 6 deletions

@ -766,7 +766,7 @@ static df::unit *getAnyUnit(df::viewscreen *top)
{ {
case df::viewscreen_petst::List: case df::viewscreen_petst::List:
if (!vector_get(screen->is_vermin, screen->cursor)) if (!vector_get(screen->is_vermin, screen->cursor))
return (df::unit*)vector_get(screen->animal, screen->cursor); return vector_get(screen->animal, screen->cursor).unit;
return NULL; return NULL;
case df::viewscreen_petst::SelectTrainer: case df::viewscreen_petst::SelectTrainer:

@ -12,9 +12,15 @@ module DFHack
ref.unit_tg if ref.kind_of?(GeneralRefUnit) ref.unit_tg if ref.kind_of?(GeneralRefUnit)
when :viewscreen_unitlistst when :viewscreen_unitlistst
v = curview v = curview
# TODO fix xml to use enums everywhere v.units[v.page][v.cursor_pos[v.page]]
page = DFHack::ViewscreenUnitlistst_TPage.int(v.page) when :viewscreen_petst
v.units[page][v.cursor_pos[page]] v = curview
case v.mode
when :List
v.animal[v.cursor].unit if !v.is_vermin[v.cursor]
when :SelectTrainer
v.trainer_unit[v.trainer_cursor]
end
else else
case ui.main.mode case ui.main.mode
when :ViewUnits when :ViewUnits

@ -356,7 +356,7 @@ DEFINE_SORT_HANDLER(unit_sorters, pet, "/List", animals)
std::vector<df::unit*> units; std::vector<df::unit*> units;
for (size_t i = 0; i < animals->animal.size(); i++) for (size_t i = 0; i < animals->animal.size(); i++)
units.push_back(animals->is_vermin[i] ? NULL : (df::unit*)animals->animal[i]); units.push_back(animals->is_vermin[i] ? NULL : animals->animal[i].unit);
if (compute_order(*pout, L, top, &order, units)) if (compute_order(*pout, L, top, &order, units))
{ {