From 84275d52b0f6e1f53f365f03be6a55b1e2c95d20 Mon Sep 17 00:00:00 2001 From: Cyp Date: Sat, 27 Feb 2010 23:20:38 +0100 Subject: [PATCH] newnet: Fix crash due to "forgetting" to pass a parameter to a function. Remove some ridiculous duplication of function declarations instead of including the headers. --- lib/netplay/netplay.c | 20 +++++--------------- lib/netplay/netplay.h | 3 +++ src/multiint.c | 38 ++++++++------------------------------ src/multiint.h | 2 ++ 4 files changed, 18 insertions(+), 45 deletions(-) diff --git a/lib/netplay/netplay.c b/lib/netplay/netplay.c index 5df2e18a6..22fca442f 100644 --- a/lib/netplay/netplay.c +++ b/lib/netplay/netplay.c @@ -42,6 +42,10 @@ #include "miniupnpc/upnpcommands.h" #include "lib/exceptionhandler/dumpinfo.h" +#include "src/multistat.h" +#include "src/multijoin.h" +#include "src/multiint.h" + #ifdef WZ_OS_LINUX #include // Nonfatal runtime backtraces. #endif //WZ_OS_LINUX @@ -127,15 +131,6 @@ static unsigned int masterserver_port = 0, gameserver_port = 0; */ #define NET_BUFFER_SIZE (MaxMsgSize) // Would be 16K -// HACK(s) to allow us to call a src/multi*.c function -extern void recvMultiStats(void); // from src/multistat.c -extern BOOL sendTextMessage(const char *pStr, BOOL all); // from src/multiplay.c -extern BOOL MultiPlayerJoin(UDWORD playerIndex); // from src/multijoin.c -extern BOOL MultiPlayerLeave(UDWORD playerIndex); // from src/multijoin.c -extern void ShowMOTD(void); // from src/multijoin.c -extern void kickPlayer(uint32_t player_id, const char *reason, LOBBY_ERROR_TYPES type); // from src/multiinit.c -extern void setLobbyError (LOBBY_ERROR_TYPES error_type); // from src/multiinit.c -extern LOBBY_ERROR_TYPES getLobbyError(void); // from src/multiinit.c // //////////////////////////////////////////////////////////////////////// // Function prototypes static void NETplayerLeaving(UDWORD player); // Cleanup sockets on player leaving (nicely) @@ -144,11 +139,6 @@ static void NETregisterServer(int state); static void NETallowJoining(void); static void NET_InitPlayer(int i); -void NETGameLocked( bool flag); -void NETresetGamePassword(void); - -void NETGameLocked( bool flag); -void NETresetGamePassword(void); /* * Network globals, these are part of the new network API */ @@ -2400,7 +2390,7 @@ static BOOL NETprocessSystemMessage(NETQUEUE playerQueue, uint8_t type) } case NET_PLAYER_STATS: { - recvMultiStats(); + recvMultiStats(playerQueue); netPlayersUpdated = true; break; } diff --git a/lib/netplay/netplay.h b/lib/netplay/netplay.h index b76171bcb..fff54fb5c 100644 --- a/lib/netplay/netplay.h +++ b/lib/netplay/netplay.h @@ -318,6 +318,9 @@ extern bool NETisCorrectVersion(uint32_t game_version_major, uint32_t game_versi extern bool NETgameIsCorrectVersion(GAMESTRUCT* check_game); extern void NET_InitPlayers(void); +void NETGameLocked(bool flag); +void NETresetGamePassword(void); + const char *messageTypeToString(unsigned messageType); /// Sync debugging. Only prints anything, if different players would print different things. diff --git a/src/multiint.c b/src/multiint.c index 53916d46c..be2ba1ad8 100644 --- a/src/multiint.c +++ b/src/multiint.c @@ -142,17 +142,6 @@ extern GLuint FBOdepthbuffer; // Our handle to the depth render buffer extern BOOL bFboProblem; // hack to work around people with bad drivers. (*cough*intel*cough*) extern BOOL bSendingMap; // used to indicate we are sending a map -extern void intDisplayTemplateButton(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); -extern void NETsetGamePassword(const char *password); // in netplay.c -extern void NETresetGamePassword(void); // in netplay.c -extern void NETGameLocked(bool flag); // in netplay.c -extern void NETsetGamePassword(const char *password); // in netplay.c -extern void NETresetGamePassword(void); // in netplay.c -extern void NETGameLocked(bool flag); // in netplay.c -extern void NETsetGamePassword(const char *password); // in netplay.c -extern void NETresetGamePassword(void); // in netplay.c -extern void NETGameLocked(bool flag); // in netplay.c - BOOL bHosted = false; //we have set up a game char sPlayer[128]; // player name (to be used) static int colourChooserUp = -1; @@ -181,20 +170,18 @@ static void drawReadyButton(UDWORD player); static void displayPasswordEditBox(WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, WZ_DECL_UNUSED PIELIGHT *pColours); // Drawing Functions -void displayChatEdit (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); -void displayMultiBut (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); -void intDisplayFeBox (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); -void displayRemoteGame (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); -void displayPlayer (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); -void displayTeamChooser (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); -void displayMultiEditBox (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); -void setLockedTeamsMode (void); +static void displayChatEdit (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); +static void displayMultiBut (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); +static void intDisplayFeBox (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); +static void displayRemoteGame (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); +static void displayPlayer (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); +static void displayTeamChooser (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); +static void displayMultiEditBox (WIDGET *psWidget, UDWORD xOffset, UDWORD yOffset, PIELIGHT *pColours); +static void setLockedTeamsMode (void); // find games static void addGames (void); static void removeGames (void); -void runGameFind (void); -void startGameFind (void); // password form functions static void hidePasswordForm(void); @@ -202,21 +189,14 @@ static void showPasswordForm(void); // Connection option functions static void addConnections (UDWORD); -void runConnectionScreen (void); -BOOL startConnectionScreen (void); // Game option functions static void addGameOptions (BOOL bRedo); // options (rhs) boxV -UDWORD addPlayerBox (BOOL); // players (mid) box static void addChatBox (void); static void disableMultiButs (void); static void processMultiopWidgets(UDWORD); static void SendFireUp (void); -void runMultiOptions (void); -BOOL startMultiOptions (BOOL); -void frontendMultiMessages(void); - static UDWORD bestPlayer (UDWORD); static void decideWRF (void); @@ -226,8 +206,6 @@ static BOOL SendColourRequest (UBYTE player, UBYTE col); static BOOL SendPositionRequest (UBYTE player, UBYTE chosenPlayer); static BOOL safeToUseColour (UDWORD player,UDWORD col); static BOOL changeReadyStatus (UBYTE player, BOOL bReady); -void resetReadyStatus (bool bSendOptions); -void initTeams( void ); static void stopJoining(void); // //////////////////////////////////////////////////////////////////////////// // map previews.. diff --git a/src/multiint.h b/src/multiint.h index 13e582d68..983e0ea4b 100644 --- a/src/multiint.h +++ b/src/multiint.h @@ -24,6 +24,8 @@ #ifndef __INCLUDED_SRC_MULTIINT_H__ #define __INCLUDED_SRC_MULTIINT_H__ +#include "lib/widget/widgbase.h" + #ifdef __cplusplus extern "C" {