Clean out some excess global defines.

git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@3753 4a71c877-e1ca-e34f-864e-861f7616d084
master
Per Inge Mathisen 2008-02-11 16:23:20 +00:00
parent 907f684f8a
commit 917187ca7d
9 changed files with 8 additions and 26 deletions

View File

@ -62,6 +62,7 @@
#include <physfs.h> #include <physfs.h>
extern UDWORD selectedPlayer; extern UDWORD selectedPlayer;
#define MAX_PLAYERS 8 /**< Maximum number of players in the game. */
/** Initialise the frame work library */ /** Initialise the frame work library */
extern BOOL frameInitialise( extern BOOL frameInitialise(

View File

@ -315,7 +315,7 @@ UDWORD NETplayerInfo(void)
return 1; return 1;
} }
memset(NetPlay.players, 0, (sizeof(PLAYER)*MaxNumberOfPlayers)); // reset player info memset(NetPlay.players, 0, sizeof(PLAYER) * MAX_PLAYERS); // reset player info
for (i = 0; i < MAX_CONNECTED_PLAYERS; ++i) for (i = 0; i < MAX_CONNECTED_PLAYERS; ++i)
{ {
@ -511,13 +511,11 @@ BOOL NETinit(BOOL bFirstCall)
NetPlay.bHost = 0; NetPlay.bHost = 0;
NetPlay.bComms = TRUE; NetPlay.bComms = TRUE;
for(i=0;i<MaxNumberOfPlayers;i++) for(i = 0; i < MAX_PLAYERS; i++)
{ {
memset(&NetPlay.players[i], 0, sizeof(PLAYER)); memset(&NetPlay.players[i], 0, sizeof(PLAYER));
memset(&NetPlay.games[i], 0, sizeof(GAMESTRUCT)); memset(&NetPlay.games[i], 0, sizeof(GAMESTRUCT));
} }
//GAME_GUID = g;
NetPlay.bComms = TRUE; NetPlay.bComms = TRUE;
NETstartLogging(); NETstartLogging();
} }

View File

@ -32,11 +32,8 @@
// Include this file in your game to add multiplayer facilities. // Include this file in your game to add multiplayer facilities.
// Constants // Constants
#define MaxNumberOfPlayers 8 // max number of players in a game.
#define MaxMsgSize 8000 // max size of a message in bytes. #define MaxMsgSize 8000 // max size of a message in bytes.
#define StringSize 64 // size of strings used. #define StringSize 64 // size of strings used.
#define ConnectionSize 255 // max size of a connection description.
#define MaxProtocols 12 // max number of returnable protocols.
#define MaxGames 12 // max number of concurrently playable games to allow. #define MaxGames 12 // max number of concurrently playable games to allow.
#define SESSION_JOINDISABLED 1 #define SESSION_JOINDISABLED 1
@ -91,7 +88,7 @@ typedef struct {
// all the luvly Netplay info.... // all the luvly Netplay info....
typedef struct { typedef struct {
GAMESTRUCT games[MaxGames]; // the collection of games GAMESTRUCT games[MaxGames]; // the collection of games
PLAYER players[MaxNumberOfPlayers]; // the array of players. PLAYER players[MAX_PLAYERS]; // the array of players.
uint32_t playercount; // number of players in game. uint32_t playercount; // number of players in game.
uint32_t dpidPlayer; // ID of player created uint32_t dpidPlayer; // ID of player created

View File

@ -26,16 +26,9 @@
#ifndef _deliverance_h #ifndef _deliverance_h
#define _deliverance_h #define _deliverance_h
#define MAX_PLAYERS 8 /*Utterly arbitrary at the moment!! */
/* TC said I could do this - GJ */
#define MAX_NAME_SIZE 60 #define MAX_NAME_SIZE 60
#define MAX_STR_SIZE 20 #define MAX_STR_SIZE 20
#define MAX_STR_LENGTH 256 #define MAX_STR_LENGTH 256
//used to flag for some script code whilst work in progress
#define SCRIPTS
#endif #endif

View File

@ -4338,9 +4338,7 @@ void intProcessDesign(UDWORD id)
/* save template if valid */ /* save template if valid */
if (saveTemplate()) if (saveTemplate())
{ {
#ifdef SCRIPTS
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DROIDDESIGNED); eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DROIDDESIGNED);
#endif
} }
switch ( desCompMode ) switch ( desCompMode )

View File

@ -553,7 +553,7 @@ static bool serializeNetPlay(PHYSFS_file* fileHandle, const NETPLAY* serializeNe
return false; return false;
} }
for (i = 0; i < MaxNumberOfPlayers; ++i) for (i = 0; i < MAX_PLAYERS; ++i)
{ {
if (!serializePlayer(fileHandle, &serializeNetPlay->players[i])) if (!serializePlayer(fileHandle, &serializeNetPlay->players[i]))
return false; return false;
@ -579,7 +579,7 @@ static bool deserializeNetPlay(PHYSFS_file* fileHandle, NETPLAY* serializeNetPla
return false; return false;
} }
for (i = 0; i < MaxNumberOfPlayers; ++i) for (i = 0; i < MAX_PLAYERS; ++i)
{ {
if (!deserializePlayer(fileHandle, &serializeNetPlay->players[i])) if (!deserializePlayer(fileHandle, &serializeNetPlay->players[i]))
return false; return false;
@ -3985,7 +3985,7 @@ static void endian_SaveGameV(SAVE_GAME* psSaveGame, UDWORD version)
endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwUser3); endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwUser3);
endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwUser4); endian_sdword(&psSaveGame->sNetPlay.games[i].desc.dwUser4);
} }
for(i = 0; i < MaxNumberOfPlayers; i++) for(i = 0; i < MAX_PLAYERS; i++)
endian_udword(&psSaveGame->sNetPlay.players[i].dpid); endian_udword(&psSaveGame->sNetPlay.players[i].dpid);
endian_udword(&psSaveGame->sNetPlay.playercount); endian_udword(&psSaveGame->sNetPlay.playercount);
endian_udword(&psSaveGame->sNetPlay.dpidPlayer); endian_udword(&psSaveGame->sNetPlay.dpidPlayer);

View File

@ -182,7 +182,6 @@ GAMECODE gameLoop(void)
{ {
if (!scriptPaused()) if (!scriptPaused())
{ {
#ifdef SCRIPTS
/* Update the event system */ /* Update the event system */
if (!bInTutorial) if (!bInTutorial)
{ {
@ -192,7 +191,6 @@ GAMECODE gameLoop(void)
{ {
eventProcessTriggers(gameTime2/SCR_TICKRATE); eventProcessTriggers(gameTime2/SCR_TICKRATE);
} }
#endif
} }
/* Run the in game interface and see if it grabbed any mouse clicks */ /* Run the in game interface and see if it grabbed any mouse clicks */

View File

@ -1871,7 +1871,6 @@ void researchResult(UDWORD researchIndex, UBYTE player, BOOL bDisplay,
} }
} }
#ifdef SCRIPTS
if ((bMultiPlayer || player == selectedPlayer) && bDisplay) if ((bMultiPlayer || player == selectedPlayer) && bDisplay)
{ {
psCBLastResearch = pResearch; psCBLastResearch = pResearch;
@ -1882,7 +1881,6 @@ void researchResult(UDWORD researchIndex, UBYTE player, BOOL bDisplay,
CBResFacilityOwner = -1; CBResFacilityOwner = -1;
psCBLastResearch = NULL; psCBLastResearch = NULL;
} }
#endif
#ifdef DEBUG #ifdef DEBUG
/*this just checks that there are not more than 32 weapons now available for /*this just checks that there are not more than 32 weapons now available for

View File

@ -2714,12 +2714,11 @@ static BOOL structPlaceDroid(STRUCTURE *psStructure, DROID_TEMPLATE *psTempl,
{ {
assignFactoryCommandDroid(psStructure, psNewDroid); assignFactoryCommandDroid(psStructure, psNewDroid);
} }
#ifdef SCRIPTS
if ( psNewDroid->player == selectedPlayer ) if ( psNewDroid->player == selectedPlayer )
{ {
eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DROIDBUILT); eventFireCallbackTrigger((TRIGGER_TYPE)CALL_DROIDBUILT);
} }
#endif
return TRUE; return TRUE;
} }
else else