From 9ed7a562025aa036ea144f24950db02e94a58e85 Mon Sep 17 00:00:00 2001 From: jj Date: Fri, 30 Nov 2012 15:50:35 +0100 Subject: [PATCH] deathcause: handle non-dead units --- scripts/deathcause.rb | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/scripts/deathcause.rb b/scripts/deathcause.rb index 0ed54d81a..ab3e44a39 100644 --- a/scripts/deathcause.rb +++ b/scripts/deathcause.rb @@ -25,12 +25,19 @@ else puts "Not a historical figure, cannot death find info" else events = df.world.history.events + found = false (0...events.length).reverse_each { |i| - if events[i].kind_of?(DFHack::HistoryEventHistFigureDiedst) and events[i].victim_hf == hf - display_death_event(events[i]) + e = events[i] + if e.kind_of?(DFHack::HistoryEventHistFigureDiedst) and e.victim_hf == hf + display_death_event(e) + found = true break end } + if not found + u = item.unit_tg + puts "#{u.name} is not dead yet !" if u and not u.flags1.dead + end end end