Prevent network games with a computer controlled player, and a decent error

when trying a network game with two network players.


git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2612 8092fc87-c524-0410-9efc-e669fe64eaf9
This commit is contained in:
meep-eep
2006-12-15 05:11:06 +00:00
parent fe2df30400
commit 580f853328
3 changed files with 29 additions and 2 deletions
+7
View File
@@ -2373,3 +2373,10 @@ Game aborted due to loss of synchronisation.
Game aborted by the remote player. Game aborted by the remote player.
#(Only one side at a time can be network controlled.)
Only one side at a time can be network controlled.
#(Netplay with a computer-controlled side is currently not possible.)
Netplay with a computer-controlled side is currently not possible.
+3 -2
View File
@@ -33,6 +33,7 @@
#include "settings.h" #include "settings.h"
#include "sounds.h" #include "sounds.h"
#include "libs/graphics/gfx_common.h" #include "libs/graphics/gfx_common.h"
#include "libs/log.h"
#include "libs/mathlib.h" #include "libs/mathlib.h"
@@ -361,14 +362,14 @@ selectAllShips (SIZE num_ships)
if (num_ships != 2) if (num_ships != 2)
{ {
fprintf(stderr, "More than two players is not supported.\n"); log_add (log_Error, "More than two players is not supported.\n");
return FALSE; return FALSE;
} }
if ((PlayerControl[0] & NETWORK_CONTROL) && if ((PlayerControl[0] & NETWORK_CONTROL) &&
(PlayerControl[1] & NETWORK_CONTROL)) (PlayerControl[1] & NETWORK_CONTROL))
{ {
fprintf(stderr, "Only one side at a time can be network " log_add (log_Error, "Only one side at a time can be network "
"controlled.\n"); "controlled.\n");
return FALSE; return FALSE;
} }
+19
View File
@@ -2149,6 +2149,25 @@ StartMeleeButtonPressed (PMELEE_STATE pMS)
PlayMenuSound (MENU_SOUND_FAILURE); PlayMenuSound (MENU_SOUND_FAILURE);
return; return;
} }
if ((PlayerControl[0] & NETWORK_CONTROL) &&
(PlayerControl[1] & NETWORK_CONTROL))
{
DrawMeleeStatusMessage (GAME_STRING (NETMELEE_STRING_BASE + 31));
// "Only one side at a time can be network controlled."
return;
}
if (((PlayerControl[0] & NETWORK_CONTROL) &&
(PlayerControl[1] & COMPUTER_CONTROL)) ||
((PlayerControl[0] & COMPUTER_CONTROL) &&
(PlayerControl[1] & NETWORK_CONTROL)))
{
DrawMeleeStatusMessage (GAME_STRING (NETMELEE_STRING_BASE + 32));
// "Netplay with a computer-controlled side is currently
// not possible."
return;
}
#ifdef NETPLAY #ifdef NETPLAY
// Check whether all network parties are ready; // Check whether all network parties are ready;