From: Michael Gernoth Date: Thu, 24 Jan 2008 17:13:09 +0000 (+0100) Subject: re-add (disabled) air crash disaster X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/micropolis/commitdiff_plain/368d83ae8d59a7368779f94b48b302c03e8cfa01?ds=sidebyside re-add (disabled) air crash disaster edit src/sim/makefile and remove -DNO_AIRCRASH from DEFINES to enable it --- diff --git a/res/whead.tcl b/res/whead.tcl index 1255d5b..7e9df1f 100644 --- a/res/whead.tcl +++ b/res/whead.tcl @@ -269,6 +269,11 @@ bind $win.col1.w1.f1.disasters.m {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?\"" diff --git a/src/sim/makefile b/src/sim/makefile index a08847e..13c22c5 100644 --- a/src/sim/makefile +++ b/src/sim/makefile @@ -11,7 +11,7 @@ OPTFLAGS = -O3 #OPTFLAGS = -g #DEFINES = -DIS_LINUX -DCAM -DNET -DEFINES = -DIS_LINUX +DEFINES = -DIS_LINUX -DNO_AIRCRASH CFLAGS = $(OPTFLAGS) $(DEFINES) diff --git a/src/sim/s_disast.c b/src/sim/s_disast.c index 691e4f3..384e152 100644 --- a/src/sim/s_disast.c +++ b/src/sim/s_disast.c @@ -97,6 +97,7 @@ DoDisasters(void) MakeFlood(); break; case 4: + MakeAirCrash(); break; case 5: MakeTornado(); diff --git a/src/sim/w_sim.c b/src/sim/w_sim.c index 71f2f1a..c256e1e 100644 --- a/src/sim/w_sim.c +++ b/src/sim/w_sim.c @@ -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); } diff --git a/src/sim/w_sprite.c b/src/sim/w_sprite.c index 22688e5..ff1e679 100644 --- a/src/sim/w_sprite.c +++ b/src/sim/w_sprite.c @@ -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;