From 216eb52e3c88a4afbd09b494d2b968dfb11e92b0 Mon Sep 17 00:00:00 2001 From: Giel van Schijndel Date: Fri, 13 Apr 2007 14:48:23 +0000 Subject: [PATCH] * Fix bug #8759 (in Skirmish mode it was possible to disable all AI players, we now check for that and make sure that at least one AI player is always available in Skirmish) git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@1451 4a71c877-e1ca-e34f-864e-861f7616d084 --- src/multiint.c | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/multiint.c b/src/multiint.c index 577daf679..c5a725f25 100644 --- a/src/multiint.c +++ b/src/multiint.c @@ -30,7 +30,6 @@ #include #include "lib/framework/frameresource.h" -#include "lib/framework/strres.h" #include "lib/framework/frameint.h" // FIXME Direct iVis implementation include! #include "lib/ivis_opengl/screen.h" @@ -51,7 +50,6 @@ #include "gateway.h" #include #include "lib/gamelib/gtime.h" -#include "text.h" #include "configuration.h" #include "intdisplay.h" #include "design.h" @@ -2291,6 +2289,24 @@ static void processMultiopWidgets(UDWORD id) disableMultiButs(); + // Ensure that Skirmish games have at least one AI player + if (game.type == SKIRMISH) + { + // Search for the first AI player we can find and make sure that it is enabled + for (i = 0; i < game.maxPlayers; ++i) + { + if (!isHumanPlayer(i)) + { + if (game.skDiff[i] == 0) + { + game.skDiff[i] = 10; + } + + break; + } + } + } + addPlayerBox(!ingame.bHostSetup || bHosted); //to make sure host can't skip player selection menu (sets game.skdiff to UBYTE_MAX for humans) break;