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-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
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
2010-04-22 01:13:39 +02:00
|
|
|
|
// ===============================
|
|
|
|
|
// class MenuStateConnectedGame
|
|
|
|
|
// ===============================
|
|
|
|
|
|
2010-09-09 00:37:24 +02:00
|
|
|
|
class MenuStateConnectedGame: public MenuState {
|
2010-04-22 01:13:39 +02:00
|
|
|
|
private:
|
|
|
|
|
GraphicButton buttonDisconnect;
|
|
|
|
|
GraphicButton buttonPlayNow;
|
|
|
|
|
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;
|
|
|
|
|
GraphicLabel labelEnableServerControlledAI;
|
|
|
|
|
GraphicListBox listBoxEnableServerControlledAI;
|
|
|
|
|
GraphicLabel labelNetworkPauseGameForLaggedClients;
|
|
|
|
|
GraphicListBox listBoxNetworkPauseGameForLaggedClients;
|
2010-08-28 01:08:35 +02:00
|
|
|
|
|
2010-08-05 01:39:12 +02:00
|
|
|
|
GraphicListBox listBoxNetworkFramePeriod;
|
|
|
|
|
GraphicLabel labelNetworkFramePeriod;
|
|
|
|
|
|
2010-08-28 01:08:35 +02:00
|
|
|
|
GraphicLabel labelPathFinderType;
|
|
|
|
|
GraphicListBox listBoxPathFinderType;
|
|
|
|
|
|
|
|
|
|
GraphicLabel labelMapPlayerCount;
|
|
|
|
|
GraphicListBox listBoxMapPlayerCount;
|
|
|
|
|
|
|
|
|
|
GraphicLabel labelAdvanced;
|
|
|
|
|
GraphicListBox listBoxAdvanced;
|
|
|
|
|
|
|
|
|
|
|
2010-08-05 01:39:12 +02:00
|
|
|
|
|
2010-04-22 01:13:39 +02:00
|
|
|
|
GraphicListBox listBoxMap;
|
|
|
|
|
GraphicListBox listBoxFogOfWar;
|
|
|
|
|
GraphicListBox listBoxTechTree;
|
|
|
|
|
GraphicListBox listBoxTileset;
|
|
|
|
|
vector<string> mapFiles;
|
|
|
|
|
vector<string> techTreeFiles;
|
|
|
|
|
vector<string> tilesetFiles;
|
|
|
|
|
vector<string> factionFiles;
|
|
|
|
|
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
|
|
|
|
|
2010-09-04 03:24:17 +02:00
|
|
|
|
GraphicLabel labelAllowObservers;
|
|
|
|
|
GraphicListBox listBoxAllowObservers;
|
|
|
|
|
|
2010-08-21 15:04:52 +02:00
|
|
|
|
GraphicLabel *activeInputLabel;
|
|
|
|
|
|
2010-04-22 01:13:39 +02:00
|
|
|
|
MapInfo mapInfo;
|
|
|
|
|
|
|
|
|
|
bool needToSetChangedGameSettings;
|
|
|
|
|
time_t lastSetChangedGameSettings;
|
2010-08-22 10:00:05 +02:00
|
|
|
|
bool updateDataSynchDetailText;
|
2010-04-22 01:13:39 +02:00
|
|
|
|
|
|
|
|
|
Console console;
|
|
|
|
|
ChatManager chatManager;
|
2010-06-09 00:50:37 +02:00
|
|
|
|
bool showFullConsole;
|
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-04-23 01:18:04 +02:00
|
|
|
|
|
2010-08-22 10:00:05 +02:00
|
|
|
|
string lastMapDataSynchError;
|
|
|
|
|
string lastTileDataSynchError;
|
|
|
|
|
string lastTechtreeDataSynchError;
|
2010-04-29 01:59:37 +02: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;
|
|
|
|
|
|
|
|
|
|
std::vector<std::string> tileSets;
|
2010-09-17 10:26:22 +02:00
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
virtual void keyDown(char key);
|
|
|
|
|
virtual void keyPress(char c);
|
2010-06-08 02:00:28 +02:00
|
|
|
|
virtual void keyUp(char key);
|
2010-04-22 01:13:39 +02:00
|
|
|
|
|
2010-07-29 07:24:51 +02:00
|
|
|
|
virtual bool isInSpecialKeyCaptureEvent() { return chatManager.getEditEnabled(); }
|
|
|
|
|
|
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 cleanupFactionTexture();
|
|
|
|
|
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-04-22 01:13:39 +02:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}}//end namespace
|
|
|
|
|
|
|
|
|
|
#endif
|