From 5f5362cece5a94d5615594e2d17d05cc9724d835 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 27 Sep 2009 13:53:40 -0400 Subject: [PATCH] Make sweep require capability sweep Before, sweep accepted any plane. Planes without capability sweep flew an ordinary recon mission. Partial fix for #1388263. --- info/sweep.t | 26 ++++++++++---------------- src/lib/commands/reco.c | 6 +++--- 2 files changed, 13 insertions(+), 19 deletions(-) diff --git a/info/sweep.t b/info/sweep.t index 91527152..1fba8eca 100644 --- a/info/sweep.t +++ b/info/sweep.t @@ -2,14 +2,14 @@ .NA sweep "Use planes to remove mines from sea sectors" .LV Expert .SY "sweep route|destination" -The \*Qsweep\*U command is identical to the recon command, except -that if you use planes capable of minesweeping, they will sweep -sea mines from sectors along their route. +The \*Qsweep\*U command is used to sweep sea mines from the sectors +along the route. .s1 represents a list of planes which are to perform the -intelligence gathering operation. -Only planes with sufficient mobility, based in a sector stocked with -petrol, will be successfully selected for the mission. +mine-sweeping mission. +Only planes with capability sweep and sufficient mobility, based in a +sector stocked with petrol, will be successfully selected for the +mission. .s1 represent a list of fighter planes which are capable of escorting the transports all the way to the target. @@ -38,20 +38,14 @@ info \*QIntercept\*U. If the destination sector is not an airport, then all planes in the mission must have V/STOL capability. .s1 -Planes with the ASW ability will -perform a sonar search on each sector as they fly through it. -Each sub contact will be reported only once, giving the sector and number -of the sub, from the sector in which it -is first detected (which may not be the sector the sub is in, as plane -sonar has a range dependent on acc, and a chance of finding a sub of -((100-acc)-(4-sub visib)*10))+((100-effic)/5) percent. -The sub being sonared may detect the sonar ping. -.s1 -Planes with the sweep ability will +Planes will automatically attempt to sweep sea mines in sea sectors they overfly. Their chance of sweeping is (100-acc), and they can only sweep 1 mine per overflight of the sector. .s1 +The planes will additionally gather intelligence, just like they do on +a recon mission. See info \*Qrecon\*U. +.s1 Note that a plane must be at least 40% efficient before it can leave the ground. .s1 diff --git a/src/lib/commands/reco.c b/src/lib/commands/reco.c index 18981d93..17163286 100644 --- a/src/lib/commands/reco.c +++ b/src/lib/commands/reco.c @@ -41,6 +41,7 @@ int reco(void) { + int mission_flags = player->argp[0][0] == 's' ? PM_R | PM_S : PM_R; coord tx, ty; coord ax, ay; int ap_to_target; @@ -81,7 +82,7 @@ reco(void) * select planes within range */ pln_sel(&ni_bomb, &bomb_list, &ap_sect, ap_to_target, - 1, wantflags, P_M | P_O); + 1, wantflags | (mission_flags & PM_S ? P_SWEEP : 0), P_M | P_O); if (QEMPTY(&bomb_list)) { pr("No planes could be equipped for the mission.\n"); return RET_FAIL; @@ -101,8 +102,7 @@ reco(void) return RET_FAIL; } pln_arm(&esc_list, ap_to_target, 'e', NULL); - ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath, - *player->argp[0] == 's' ? PM_R | PM_S : PM_R); + ac_encounter(&bomb_list, &esc_list, ax, ay, flightpath, mission_flags); if (QEMPTY(&bomb_list)) { pr("No planes got through fighter defenses\n"); } else {