2010-04-22 01:13:39 +02:00
|
|
|
|
// ==============================================================
|
|
|
|
|
// This file is part of Glest (www.glest.org)
|
|
|
|
|
//
|
|
|
|
|
// Copyright (C) 2001-2005 Marti<74>o Figueroa
|
|
|
|
|
//
|
|
|
|
|
// You can redistribute this code and/or modify it under
|
|
|
|
|
// the terms of the GNU General Public License as published
|
|
|
|
|
// by the Free Software Foundation; either version 2 of the
|
|
|
|
|
// License, or (at your option) any later version
|
|
|
|
|
// ==============================================================
|
|
|
|
|
|
|
|
|
|
#ifndef _GLEST_GAME_MENUSTATECONNECTEDGAME_H_
|
|
|
|
|
#define _GLEST_GAME_MENUSTATECONNECTEDGAME_H_
|
|
|
|
|
|
|
|
|
|
#include "main_menu.h"
|
|
|
|
|
#include "chat_manager.h"
|
2010-09-14 08:10:48 +02:00
|
|
|
|
#include "map_preview.h"
|
2010-12-29 02:10:53 +01:00
|
|
|
|
#include "miniftpclient.h"
|
2010-09-07 07:25:40 +02:00
|
|
|
|
#include "leak_dumper.h"
|
2010-04-22 01:13:39 +02:00
|
|
|
|
|
2010-09-14 08:10:48 +02:00
|
|
|
|
namespace Glest { namespace Game {
|
2010-04-22 01:13:39 +02:00
|
|
|
|
|
2010-09-14 08:10:48 +02:00
|
|
|
|
enum JoinMenu {
|
2010-05-09 23:23:13 +02:00
|
|
|
|
jmSimple,
|
|
|
|
|
jmMasterserver,
|
|
|
|
|
|
|
|
|
|
jmCount
|
|
|
|
|
};
|
|
|
|
|
|
2011-01-01 01:50:10 +01:00
|
|
|
|
enum FTPMessageType {
|
|
|
|
|
ftpmsg_MissingNone,
|
|
|
|
|
ftpmsg_MissingMap,
|
2011-03-10 00:09:32 +01:00
|
|
|
|
ftpmsg_MissingTileset,
|
|
|
|
|
ftpmsg_MissingTechtree
|
2011-01-01 01:50:10 +01:00
|
|
|
|
};
|
2010-05-09 23:23:13 +02:00
|
|
|
|
|
2010-04-22 01:13:39 +02:00
|
|
|
|
// ===============================
|
|
|
|
|
// class MenuStateConnectedGame
|
|
|
|
|
// ===============================
|
|
|
|
|
|
2010-12-29 02:10:53 +01:00
|
|
|
|
class MenuStateConnectedGame: public MenuState, public FTPClientCallbackInterface {
|
2010-04-22 01:13:39 +02:00
|
|
|
|
private:
|
|
|
|
|
GraphicButton buttonDisconnect;
|
|
|
|
|
GraphicLabel labelControl;
|
2010-11-09 00:15:50 +01:00
|
|
|
|
GraphicLabel labelRMultiplier;
|
2010-04-22 01:13:39 +02:00
|
|
|
|
GraphicLabel labelFaction;
|
|
|
|
|
GraphicLabel labelTeam;
|
|
|
|
|
GraphicLabel labelMap;
|
|
|
|
|
GraphicLabel labelFogOfWar;
|
|
|
|
|
GraphicLabel labelTechTree;
|
|
|
|
|
GraphicLabel labelTileset;
|
|
|
|
|
GraphicLabel labelMapInfo;
|
|
|
|
|
GraphicLabel labelStatus;
|
|
|
|
|
GraphicLabel labelInfo;
|
|
|
|
|
|
2010-08-05 01:39:12 +02:00
|
|
|
|
|
|
|
|
|
GraphicLabel labelEnableObserverMode;
|
|
|
|
|
GraphicListBox listBoxEnableObserverMode;
|
2011-10-23 12:49:36 +02:00
|
|
|
|
//GraphicLabel labelEnableServerControlledAI;
|
|
|
|
|
//GraphicListBox listBoxEnableServerControlledAI;
|
|
|
|
|
//GraphicLabel labelNetworkPauseGameForLaggedClients;
|
|
|
|
|
//GraphicListBox listBoxNetworkPauseGameForLaggedClients;
|
2010-08-28 01:08:35 +02:00
|
|
|
|
|
2011-10-23 12:49:36 +02:00
|
|
|
|
//GraphicListBox listBoxNetworkFramePeriod;
|
|
|
|
|
//GraphicLabel labelNetworkFramePeriod;
|
2010-08-05 01:39:12 +02:00
|
|
|
|
|
2010-08-28 01:08:35 +02:00
|
|
|
|
GraphicLabel labelPathFinderType;
|
|
|
|
|
GraphicListBox listBoxPathFinderType;
|
2010-12-29 02:10:53 +01:00
|
|
|
|
|
2010-08-28 01:08:35 +02:00
|
|
|
|
GraphicLabel labelMapPlayerCount;
|
|
|
|
|
GraphicListBox listBoxMapPlayerCount;
|
2010-12-29 02:10:53 +01:00
|
|
|
|
|
2010-08-28 01:08:35 +02:00
|
|
|
|
GraphicLabel labelAdvanced;
|
|
|
|
|
GraphicListBox listBoxAdvanced;
|
2010-12-29 02:10:53 +01:00
|
|
|
|
|
2010-04-22 01:13:39 +02:00
|
|
|
|
GraphicListBox listBoxMap;
|
|
|
|
|
GraphicListBox listBoxFogOfWar;
|
|
|
|
|
GraphicListBox listBoxTechTree;
|
|
|
|
|
GraphicListBox listBoxTileset;
|
|
|
|
|
GraphicLabel labelPlayers[GameConstants::maxPlayers];
|
2010-08-21 15:04:52 +02:00
|
|
|
|
GraphicLabel labelPlayerNames[GameConstants::maxPlayers];
|
2010-04-22 01:13:39 +02:00
|
|
|
|
GraphicListBox listBoxControls[GameConstants::maxPlayers];
|
2010-11-09 00:15:50 +01:00
|
|
|
|
GraphicListBox listBoxRMultiplier[GameConstants::maxPlayers];
|
2010-04-22 01:13:39 +02:00
|
|
|
|
GraphicListBox listBoxFactions[GameConstants::maxPlayers];
|
|
|
|
|
GraphicListBox listBoxTeams[GameConstants::maxPlayers];
|
|
|
|
|
GraphicLabel labelNetStatus[GameConstants::maxPlayers];
|
2010-04-29 01:59:37 +02:00
|
|
|
|
GraphicButton grabSlotButton[GameConstants::maxPlayers];
|
2010-08-21 15:04:52 +02:00
|
|
|
|
|
2011-03-11 12:11:46 +01:00
|
|
|
|
GraphicListBox listBoxPlayerStatus;
|
|
|
|
|
GraphicLabel labelPlayerStatus[GameConstants::maxPlayers];
|
|
|
|
|
|
2010-09-04 03:24:17 +02:00
|
|
|
|
GraphicLabel labelAllowObservers;
|
|
|
|
|
GraphicListBox listBoxAllowObservers;
|
|
|
|
|
|
2010-08-21 15:04:52 +02:00
|
|
|
|
GraphicLabel *activeInputLabel;
|
|
|
|
|
|
2011-01-09 05:49:21 +01:00
|
|
|
|
time_t timerLabelFlash;
|
|
|
|
|
GraphicLabel labelDataSynchInfo;
|
|
|
|
|
|
2010-04-22 01:13:39 +02:00
|
|
|
|
MapInfo mapInfo;
|
2011-04-13 03:11:23 +02:00
|
|
|
|
Texture2D *mapPreviewTexture;
|
2010-04-22 01:13:39 +02:00
|
|
|
|
|
|
|
|
|
bool needToSetChangedGameSettings;
|
|
|
|
|
time_t lastSetChangedGameSettings;
|
2010-08-22 10:00:05 +02:00
|
|
|
|
bool updateDataSynchDetailText;
|
2010-04-22 01:13:39 +02:00
|
|
|
|
|
2011-04-15 03:05:36 +02:00
|
|
|
|
//Console console;
|
2010-04-22 01:13:39 +02:00
|
|
|
|
ChatManager chatManager;
|
2010-06-09 00:50:37 +02:00
|
|
|
|
bool showFullConsole;
|
2010-12-29 02:10:53 +01:00
|
|
|
|
|
2010-04-23 01:18:04 +02:00
|
|
|
|
string currentFactionName;
|
|
|
|
|
string currentMap;
|
2010-05-09 23:23:13 +02:00
|
|
|
|
JoinMenu returnMenuInfo;
|
2010-04-23 01:18:04 +02:00
|
|
|
|
bool settingsReceivedFromServer;
|
2010-07-09 19:12:57 +02:00
|
|
|
|
time_t lastNetworkSendPing;
|
2010-07-09 20:49:01 +02:00
|
|
|
|
int pingCount;
|
2010-08-05 02:48:46 +02:00
|
|
|
|
bool initialSettingsReceivedFromServer;
|
2010-12-29 02:10:53 +01:00
|
|
|
|
|
2010-08-22 10:00:05 +02:00
|
|
|
|
string lastMapDataSynchError;
|
|
|
|
|
string lastTileDataSynchError;
|
|
|
|
|
string lastTechtreeDataSynchError;
|
2010-12-29 02:10:53 +01:00
|
|
|
|
|
2010-08-23 06:33:21 +02:00
|
|
|
|
int8 switchSetupRequestFlagType;
|
|
|
|
|
string defaultPlayerName;
|
|
|
|
|
|
2010-08-31 22:31:20 +02:00
|
|
|
|
bool enableFactionTexturePreview;
|
2010-09-26 23:34:00 +02:00
|
|
|
|
bool enableMapPreview;
|
2010-10-30 05:29:29 +02:00
|
|
|
|
|
|
|
|
|
string currentTechName_factionPreview;
|
|
|
|
|
string currentFactionName_factionPreview;
|
2010-08-31 08:38:27 +02:00
|
|
|
|
string currentFactionLogo;
|
|
|
|
|
Texture2D *factionTexture;
|
|
|
|
|
|
2010-09-14 08:10:48 +02:00
|
|
|
|
MapPreview mapPreview;
|
|
|
|
|
|
2010-09-17 08:37:08 +02:00
|
|
|
|
GraphicMessageBox mainMessageBox;
|
|
|
|
|
int mainMessageBoxState;
|
|
|
|
|
|
2010-09-17 10:26:22 +02:00
|
|
|
|
std::string lastMissingMap;
|
2010-09-17 10:46:34 +02:00
|
|
|
|
std::string lastMissingTechtree;
|
|
|
|
|
std::string lastMissingTileSet;
|
2010-12-29 02:10:53 +01:00
|
|
|
|
|
2011-03-10 00:09:32 +01:00
|
|
|
|
vector<string> mapFiles;
|
|
|
|
|
vector<string> techTreeFiles;
|
|
|
|
|
vector<string> tilesetFiles;
|
|
|
|
|
vector<string> factionFiles;
|
2010-09-17 10:26:22 +02:00
|
|
|
|
|
2011-09-24 09:46:56 +02:00
|
|
|
|
vector<string> playerSortedMaps[GameConstants::maxPlayers+1];
|
|
|
|
|
vector<string> formattedPlayerSortedMaps[GameConstants::maxPlayers+1];
|
|
|
|
|
vector<string> formattedMapFiles;
|
|
|
|
|
|
2010-12-29 20:31:51 +01:00
|
|
|
|
GraphicMessageBox ftpMessageBox;
|
2010-12-29 02:10:53 +01:00
|
|
|
|
FTPClientThread *ftpClientThread;
|
2011-01-01 01:50:10 +01:00
|
|
|
|
FTPMessageType ftpMissingDataType;
|
|
|
|
|
|
2010-12-29 07:11:06 +01:00
|
|
|
|
string getMissingMapFromFTPServer;
|
2010-12-29 09:10:22 +01:00
|
|
|
|
bool getMissingMapFromFTPServerInProgress;
|
2010-12-29 02:10:53 +01:00
|
|
|
|
|
2011-01-01 01:50:10 +01:00
|
|
|
|
string getMissingTilesetFromFTPServer;
|
|
|
|
|
bool getMissingTilesetFromFTPServerInProgress;
|
|
|
|
|
|
2011-03-10 00:09:32 +01:00
|
|
|
|
string getMissingTechtreeFromFTPServer;
|
|
|
|
|
bool getMissingTechtreeFromFTPServerInProgress;
|
|
|
|
|
|
2011-03-19 06:11:36 +01:00
|
|
|
|
string lastCheckedCRCTilesetName;
|
|
|
|
|
string lastCheckedCRCTechtreeName;
|
|
|
|
|
string lastCheckedCRCMapName;
|
|
|
|
|
int32 lastCheckedCRCTilesetValue;
|
|
|
|
|
int32 lastCheckedCRCTechtreeValue;
|
|
|
|
|
int32 lastCheckedCRCMapValue;
|
2011-03-19 13:04:18 +01:00
|
|
|
|
vector<pair<string,int32> > factionCRCList;
|
2011-03-19 06:11:36 +01:00
|
|
|
|
|
2011-01-04 09:44:00 +01:00
|
|
|
|
std::map<string,pair<int,string> > fileFTPProgressList;
|
2011-04-15 02:09:38 +02:00
|
|
|
|
GraphicButton buttonCancelDownloads;
|
2011-01-04 09:44:00 +01:00
|
|
|
|
|
2011-09-21 08:51:28 +02:00
|
|
|
|
GraphicLabel labelEnableSwitchTeamMode;
|
|
|
|
|
GraphicListBox listBoxEnableSwitchTeamMode;
|
|
|
|
|
GraphicLabel labelAISwitchTeamAcceptPercent;
|
|
|
|
|
GraphicListBox listBoxAISwitchTeamAcceptPercent;
|
|
|
|
|
|
2011-09-24 09:46:56 +02:00
|
|
|
|
GraphicButton buttonPlayNow;
|
|
|
|
|
|
2011-10-22 02:19:38 +02:00
|
|
|
|
bool needToBroadcastServerSettings;
|
|
|
|
|
time_t broadcastServerSettingsDelayTimer;
|
|
|
|
|
int lastGameSettingsReceivedCount;
|
|
|
|
|
|
2010-04-22 01:13:39 +02:00
|
|
|
|
public:
|
2010-09-14 08:10:48 +02:00
|
|
|
|
|
2010-05-09 23:23:13 +02:00
|
|
|
|
MenuStateConnectedGame(Program *program, MainMenu *mainMenu, JoinMenu joinMenuInfo=jmSimple, bool openNetworkSlots= false);
|
2010-08-31 08:38:27 +02:00
|
|
|
|
~MenuStateConnectedGame();
|
2010-04-22 01:13:39 +02:00
|
|
|
|
|
|
|
|
|
void mouseClick(int x, int y, MouseButton mouseButton);
|
|
|
|
|
void mouseMove(int x, int y, const MouseState *mouseState);
|
|
|
|
|
void render();
|
|
|
|
|
void update();
|
|
|
|
|
|
2011-06-26 03:55:08 +02:00
|
|
|
|
virtual void keyDown(SDL_KeyboardEvent key);
|
|
|
|
|
virtual void keyPress(SDL_KeyboardEvent c);
|
|
|
|
|
virtual void keyUp(SDL_KeyboardEvent key);
|
2010-04-22 01:13:39 +02:00
|
|
|
|
|
2011-04-20 18:25:16 +02:00
|
|
|
|
virtual bool isInSpecialKeyCaptureEvent();
|
2010-07-29 07:24:51 +02:00
|
|
|
|
|
2011-10-25 20:39:11 +02:00
|
|
|
|
virtual void reloadUI();
|
|
|
|
|
|
2010-04-22 01:13:39 +02:00
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
bool hasNetworkGameSettings();
|
2010-06-03 08:03:41 +02:00
|
|
|
|
bool loadFactions(const GameSettings *gameSettings,bool errorOnNoFactions);
|
2010-05-09 23:23:13 +02:00
|
|
|
|
void returnToJoinMenu();
|
2010-08-21 15:04:52 +02:00
|
|
|
|
string getHumanPlayerName();
|
|
|
|
|
void setActiveInputLabel(GraphicLabel *newLable);
|
2010-08-31 08:38:27 +02:00
|
|
|
|
|
|
|
|
|
void loadFactionTexture(string filepath);
|
2010-09-17 10:26:22 +02:00
|
|
|
|
bool loadMapInfo(string file, MapInfo *mapInfo, bool loadMapPreview);
|
2010-09-17 08:37:08 +02:00
|
|
|
|
void showMessageBox(const string &text, const string &header, bool toggle);
|
2010-08-31 08:38:27 +02:00
|
|
|
|
|
2010-12-29 20:31:51 +01:00
|
|
|
|
void showFTPMessageBox(const string &text, const string &header, bool toggle);
|
2011-03-25 11:11:16 +01:00
|
|
|
|
virtual void FTPClient_CallbackEvent(string itemName,
|
|
|
|
|
FTP_Client_CallbackType type, pair<FTP_Client_ResultType,string> result,void *userdata);
|
2011-03-11 12:11:46 +01:00
|
|
|
|
|
|
|
|
|
int32 getNetworkPlayerStatus();
|
2011-04-13 03:11:23 +02:00
|
|
|
|
void cleanupMapPreviewTexture();
|
2011-09-24 09:46:56 +02:00
|
|
|
|
|
|
|
|
|
void mouseClickAdmin(int x, int y, MouseButton mouseButton);
|
|
|
|
|
string getCurrentMapFile();
|
|
|
|
|
void loadGameSettings(GameSettings *gameSettings);
|
|
|
|
|
void reloadFactions(bool keepExistingSelectedItem);
|
|
|
|
|
void PlayNow(bool saveGame);
|
|
|
|
|
bool isMasterserverAdmin();
|
2011-10-22 02:19:38 +02:00
|
|
|
|
void broadCastGameSettingsToMasterserver(bool forceNow);
|
2011-09-27 03:11:11 +02:00
|
|
|
|
void updateResourceMultiplier(const int index);
|
2010-04-22 01:13:39 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}}//end namespace
|
|
|
|
|
|
|
|
|
|
#endif
|