summaryrefslogtreecommitdiff
path: root/plugins/ruby/unit.rb
diff options
context:
space:
mode:
authorAlexander Gavrilov2012-09-27 10:36:14 +0400
committerAlexander Gavrilov2012-09-27 10:36:14 +0400
commit2e5f3c46201d8450a39b52117dbd4f1544771189 (patch)
tree1215abb52b93463c894b459462bb30cf36be8c81 /plugins/ruby/unit.rb
parentac9e78a6130d896510f186cc8f8ed5046cac45be (diff)
parent7cc29250f8622a317da464a2b7356a246082abc0 (diff)
downloaddfhack-2e5f3c46201d8450a39b52117dbd4f1544771189.tar.gz
dfhack-2e5f3c46201d8450a39b52117dbd4f1544771189.tar.bz2
dfhack-2e5f3c46201d8450a39b52117dbd4f1544771189.tar.xz
Merge remote-tracking branch 'jjyg/master'
Diffstat (limited to 'plugins/ruby/unit.rb')
-rw-r--r--plugins/ruby/unit.rb14
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins/ruby/unit.rb b/plugins/ruby/unit.rb
index 5289229a..139a375b 100644
--- a/plugins/ruby/unit.rb
+++ b/plugins/ruby/unit.rb
@@ -12,9 +12,15 @@ module DFHack
ref.unit_tg if ref.kind_of?(GeneralRefUnit)
when :viewscreen_unitlistst
v = curview
- # TODO fix xml to use enums everywhere
- page = DFHack::ViewscreenUnitlistst_TPage.int(v.page)
- v.units[page][v.cursor_pos[page]]
+ v.units[v.page][v.cursor_pos[v.page]]
+ when :viewscreen_petst
+ 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
case ui.main.mode
when :ViewUnits
@@ -48,7 +54,7 @@ module DFHack
}
end
- def unit_iscitizen(u)
+ def unit_iscitizen(u)
u.race == ui.race_id and u.civ_id == ui.civ_id and !u.flags1.dead and !u.flags1.merchant and !u.flags1.forest and
!u.flags1.diplomat and !u.flags2.resident and !u.flags3.ghostly and
!u.curse.add_tags1.OPPOSED_TO_LIFE and !u.curse.add_tags1.CRAZED and