re-add (disabled) air crash disaster
authorMichael Gernoth <michael@gernoth.net>
Thu, 24 Jan 2008 17:13:09 +0000 (18:13 +0100)
committerMichael Gernoth <michael@gernoth.net>
Thu, 24 Jan 2008 17:13:09 +0000 (18:13 +0100)
edit src/sim/makefile and remove -DNO_AIRCRASH from DEFINES to enable it

res/whead.tcl
src/sim/makefile
src/sim/s_disast.c
src/sim/w_sim.c
src/sim/w_sprite.c

index 1255d5b..7e9df1f 100644 (file)
@@ -269,6 +269,11 @@ bind $win.col1.w1.f1.disasters.m <Mod2-Key> {tk_traverseToMenu %W %A}
   $win.col1.w1.f1.disasters.m add command\
     -label {Meltdown}\
     -command "UIDisaster $win \"sim MakeMeltdown\" \"have a nuclear meltdown?\""
+  if {[sim HasAirCrash]} {
+    $win.col1.w1.f1.disasters.m add command\
+      -label {Air Crash}\
+      -command "UIDisaster $win \"sim MakeAirCrash\" \"crash an airplane?\""
+  }
   $win.col1.w1.f1.disasters.m add command\
     -label {Tornado}\
     -command "UIDisaster $win \"sim MakeTornado\" \"spin up a tornado?\""
index a08847e..13c22c5 100644 (file)
@@ -11,7 +11,7 @@ OPTFLAGS = -O3
 #OPTFLAGS = -g
 
 #DEFINES = -DIS_LINUX -DCAM -DNET
-DEFINES = -DIS_LINUX
+DEFINES = -DIS_LINUX -DNO_AIRCRASH
 
 CFLAGS = $(OPTFLAGS) $(DEFINES)
 
index 691e4f3..384e152 100644 (file)
@@ -97,6 +97,7 @@ DoDisasters(void)
       MakeFlood();
       break;
     case 4:
+      MakeAirCrash();
       break;
     case 5:
       MakeTornado();
index 71f2f1a..c256e1e 100644 (file)
@@ -145,6 +145,7 @@ SIMCMD_CALL(StartBulldozer)
 SIMCMD_CALL(StopBulldozer)
 SIMCMD_CALL(MakeFire)
 SIMCMD_CALL(MakeFlood)
+SIMCMD_CALL(MakeAirCrash)
 SIMCMD_CALL(MakeTornado)
 SIMCMD_CALL(MakeEarthquake)
 SIMCMD_CALL(MakeMonster)
@@ -1511,6 +1512,22 @@ int SimCmdSugarMode(ARGS)
   return (TCL_OK);
 }
 
+int SimCmdHasAirCrash(ARGS)
+{
+  int aircrash = 0;
+
+  if (argc != 2) {
+    return (TCL_ERROR);
+  }
+
+#ifndef NO_AIRCRASH
+  aircrash = 1;
+#endif
+
+  sprintf(interp->result, "%d", aircrash);
+  return (TCL_OK);
+}
+
 
 /************************************************************************/
 
@@ -1567,6 +1584,7 @@ sim_command_init()
   SIM_CMD(StopBulldozer);
   SIM_CMD(MakeFire);
   SIM_CMD(MakeFlood);
+  SIM_CMD(MakeAirCrash);
   SIM_CMD(MakeTornado);
   SIM_CMD(MakeEarthquake);
   SIM_CMD(MakeMonster);
@@ -1674,4 +1692,5 @@ sim_command_init()
   SIM_CMD(NeedRest);
   SIM_CMD(MultiPlayerMode);
   SIM_CMD(SugarMode);
+  SIM_CMD(HasAirCrash);
 }
index 22688e5..ff1e679 100644 (file)
@@ -1588,6 +1588,23 @@ GeneratePlane(int x, int y)
 }
 
 
+MakeAirCrash(void)
+{
+#ifndef NO_AIRCRASH
+  if (GetSprite(AIR) == NULL) {
+    short x, y;
+
+    x = Rand(WORLD_X - 20) + 10;
+    y = Rand(WORLD_Y - 10) + 5;
+
+    GeneratePlane(x, y);
+  }
+
+  ExplodeSprite(GetSprite(AIR));
+#endif
+}
+
+
 MakeTornado(void)
 {
   short x, y;
Impressum, Datenschutz