From 889bd06ffc4efe8e169898eb4c1ba5eeec4a2e1f Mon Sep 17 00:00:00 2001 From: Yoann Guillot Date: Sun, 16 Nov 2014 13:00:38 +0100 Subject: [PATCH 1/2] ruby: fix windows platform detection --- plugins/ruby/ruby.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/ruby/ruby.rb b/plugins/ruby/ruby.rb index 21e1a29ff..850ca0912 100644 --- a/plugins/ruby/ruby.rb +++ b/plugins/ruby/ruby.rb @@ -241,7 +241,7 @@ end # load autogenned file require './hack/ruby/ruby-autogen-defs' -require(RUBY_PLATFORM =~ /mswin/i ? './hack/ruby/ruby-autogen-win' : './hack/ruby/ruby-autogen-gcc') +require(RUBY_PLATFORM =~ /mswin|mingw|cygwin/i ? './hack/ruby/ruby-autogen-win' : './hack/ruby/ruby-autogen-gcc') # load all modules Dir['./hack/ruby/*.rb'].each { |m| require m.chomp('.rb') if m !~ /ruby-autogen/ } From c43685ae76d158ba0a4c638a8a5b9567e27d7a3b Mon Sep 17 00:00:00 2001 From: Yoann Guillot Date: Sun, 16 Nov 2014 13:06:14 +0100 Subject: [PATCH 2/2] superdwarf: remove ruby global function --- scripts/superdwarf.rb | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/scripts/superdwarf.rb b/scripts/superdwarf.rb index e4e90434b..0592e83fd 100644 --- a/scripts/superdwarf.rb +++ b/scripts/superdwarf.rb @@ -3,13 +3,6 @@ $superdwarf_onupdate ||= nil $superdwarf_ids ||= [] -def unregister - unless $superdwarf_onupdate.nil? - df.onupdate_unregister($superdwarf_onupdate) - $superdwarf_onupdate = nil - end -end - case $script_args[0] when 'add' if u = df.unit_find @@ -17,7 +10,8 @@ when 'add' $superdwarf_onupdate ||= df.onupdate_register('superdwarf', 1) { if $superdwarf_ids.empty? - unregister() + df.onupdate_unregister($superdwarf_onupdate) + $superdwarf_onupdate = nil else $superdwarf_ids.each { |id| if u = df.unit_find(id) and not u.flags1.dead @@ -32,11 +26,11 @@ when 'add' when :Job2 a.data.job2.timer = 1 when :Attack - # Attack execution timer; fires when reaches zero. + # Attack execution timer; fires when reaches zero. a.data.attack.timer1 = 1 - # Attack completion timer: finishes action at zero. - # An action must complete before target re-seleciton - # occurs. + # Attack completion timer: finishes action at zero. + # An action must complete before target re-seleciton + # occurs. a.data.attack.timer2 = 0 end } @@ -67,13 +61,8 @@ when 'del' puts "Select a creature using 'v'" end - if $superdwarf_ids.empty? - unregister() - end - when 'clear' $superdwarf_ids.clear - unregister() when 'list' puts "current superdwarves:", $superdwarf_ids.map { |id| df.unit_find(id).name }