changeset 375:0ec57ac68a4c

one more parameter for ship speed.
author "Rex Tsai <chihchun@kalug.linux.org.tw>"
date Tue, 14 Apr 2009 17:01:49 +0800
parents e551351b18de
children 6ca0677a361e
files planner.pl
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/planner.pl	Tue Apr 14 17:01:17 2009 +0800
+++ b/planner.pl	Tue Apr 14 17:01:49 2009 +0800
@@ -58,9 +58,10 @@
 if($#ARGV < 2) {
     die("Usage: %s -n 1 -a 1 -v 21 targetCity navyCity armyCity wingman1.. wingman2..\n");
 }
-getopts('wa:n:v:');
+getopts('wa:n:v:s:');
 $opt_n = defined($opt_n) ? $opt_n : 1;
 $opt_a = defined($opt_a) ? $opt_a : 1;
+$opt_s = defined($opt_s) ? $opt_s : 33;
 my $vanguard =  defined($opt_v) ? $opt_v : 21;
 
 my $targetCityId = shift(@ARGV);
@@ -70,8 +71,8 @@
 foreach my $i (1..$opt_n) {
     my $navyCity = shift(@ARGV);
     my $city = LoadFile(sprintf("city-%s-dump.yaml", $navyCity));
-    $city->{travelTime} = travelTime($targetCity->island->x, $targetCity->island->y, $city->{island}->{x}, $city->{island}->{y}, 33);
-    $city->{distance}   = travelTime($targetCity->island->x, $targetCity->island->y, $city->{island}->{x}, $city->{island}->{y}, 33) + $vanguard;
+    $city->{travelTime} = travelTime($targetCity->island->x, $targetCity->island->y, $city->{island}->{x}, $city->{island}->{y}, $opt_s);
+    $city->{distance}   = travelTime($targetCity->island->x, $targetCity->island->y, $city->{island}->{x}, $city->{island}->{y}, $opt_s) + $vanguard;
     if($i == 1) {
         $city->{distance} += 8;
      } else {