2010-03-27 08:09:34 +01:00
|
|
|
|
// ==============================================================
|
|
|
|
|
// This file is part of Glest (www.glest.org)
|
|
|
|
|
//
|
2010-05-13 00:58:00 +02:00
|
|
|
|
// Copyright (C) 2001-2005 Marti<74>o Figueroa
|
2010-03-27 08:09:34 +01:00
|
|
|
|
//
|
|
|
|
|
// 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_MENUSTATECUSTOMGAME_H_
|
|
|
|
|
#define _GLEST_GAME_MENUSTATECUSTOMGAME_H_
|
|
|
|
|
|
|
|
|
|
#include "main_menu.h"
|
|
|
|
|
#include "chat_manager.h"
|
2010-05-13 08:43:56 +02:00
|
|
|
|
#include "simple_threads.h"
|
2010-03-27 08:09:34 +01:00
|
|
|
|
|
|
|
|
|
namespace Glest{ namespace Game{
|
|
|
|
|
// ===============================
|
|
|
|
|
// class MenuStateCustomGame
|
|
|
|
|
// ===============================
|
|
|
|
|
|
2010-05-13 08:43:56 +02:00
|
|
|
|
class MenuStateCustomGame : public MenuState, public SimpleTaskCallbackInterface {
|
2010-03-27 08:09:34 +01:00
|
|
|
|
private:
|
|
|
|
|
GraphicButton buttonReturn;
|
|
|
|
|
GraphicButton buttonPlayNow;
|
|
|
|
|
GraphicLabel labelControl;
|
|
|
|
|
GraphicLabel labelFaction;
|
|
|
|
|
GraphicLabel labelTeam;
|
|
|
|
|
GraphicLabel labelMap;
|
|
|
|
|
GraphicLabel labelFogOfWar;
|
|
|
|
|
GraphicLabel labelTechTree;
|
|
|
|
|
GraphicLabel labelTileset;
|
|
|
|
|
GraphicLabel labelMapInfo;
|
|
|
|
|
GraphicListBox listBoxMap;
|
|
|
|
|
GraphicListBox listBoxFogOfWar;
|
|
|
|
|
GraphicListBox listBoxTechTree;
|
|
|
|
|
GraphicListBox listBoxTileset;
|
|
|
|
|
vector<string> mapFiles;
|
|
|
|
|
vector<string> techTreeFiles;
|
|
|
|
|
vector<string> tilesetFiles;
|
|
|
|
|
vector<string> factionFiles;
|
|
|
|
|
GraphicLabel labelPlayers[GameConstants::maxPlayers];
|
|
|
|
|
GraphicListBox listBoxControls[GameConstants::maxPlayers];
|
|
|
|
|
GraphicListBox listBoxFactions[GameConstants::maxPlayers];
|
|
|
|
|
GraphicListBox listBoxTeams[GameConstants::maxPlayers];
|
|
|
|
|
GraphicLabel labelNetStatus[GameConstants::maxPlayers];
|
|
|
|
|
MapInfo mapInfo;
|
2010-05-13 00:58:00 +02:00
|
|
|
|
|
|
|
|
|
GraphicLabel labelPublishServer;
|
|
|
|
|
GraphicListBox listBoxPublishServer;
|
2010-05-17 01:03:22 +02:00
|
|
|
|
|
|
|
|
|
GraphicMessageBox mainMessageBox;
|
|
|
|
|
int mainMessageBoxState;
|
|
|
|
|
|
2010-03-27 08:09:34 +01:00
|
|
|
|
|
|
|
|
|
bool needToSetChangedGameSettings;
|
|
|
|
|
time_t lastSetChangedGameSettings;
|
2010-05-13 00:58:00 +02:00
|
|
|
|
time_t lastMasterserverPublishing;
|
2010-05-13 08:43:56 +02:00
|
|
|
|
bool needToRepublishToMasterserver;
|
2010-05-13 13:19:10 +02:00
|
|
|
|
bool needToBroadcastServerSettings;
|
2010-05-13 08:43:56 +02:00
|
|
|
|
string publishToServerInfo;
|
|
|
|
|
SimpleTaskThread *publishToMasterserverThread;
|
2010-05-16 18:40:21 +02:00
|
|
|
|
|
|
|
|
|
bool parentMenuIsMs;
|
|
|
|
|
bool soundConnectionCount;
|
2010-05-17 01:03:22 +02:00
|
|
|
|
|
|
|
|
|
bool showMasterserverError;
|
|
|
|
|
string masterServererErrorToShow;
|
|
|
|
|
|
2010-03-27 08:09:34 +01:00
|
|
|
|
Console console;
|
|
|
|
|
ChatManager chatManager;
|
|
|
|
|
|
|
|
|
|
public:
|
2010-05-16 18:40:21 +02:00
|
|
|
|
MenuStateCustomGame(Program *program, MainMenu *mainMenu ,bool openNetworkSlots= false, bool parentMenuIsMasterserver=false);
|
2010-05-13 08:43:56 +02:00
|
|
|
|
~MenuStateCustomGame();
|
2010-03-27 08:09:34 +01: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-05-13 08:43:56 +02:00
|
|
|
|
virtual void simpleTask();
|
|
|
|
|
|
2010-03-27 08:09:34 +01:00
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
bool hasNetworkGameSettings();
|
|
|
|
|
void loadGameSettings(GameSettings *gameSettings);
|
|
|
|
|
void loadMapInfo(string file, MapInfo *mapInfo);
|
|
|
|
|
void reloadFactions();
|
|
|
|
|
void updateControlers();
|
|
|
|
|
void closeUnusedSlots();
|
|
|
|
|
void updateNetworkSlots();
|
2010-05-13 00:58:00 +02:00
|
|
|
|
void publishToMasterserver();
|
2010-05-16 18:40:21 +02:00
|
|
|
|
void returnToParentMenu();
|
2010-05-17 01:03:22 +02:00
|
|
|
|
void showMessageBox(const string &text, const string &header, bool toggle);
|
2010-03-27 08:09:34 +01:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}}//end namespace
|
|
|
|
|
|
|
|
|
|
#endif
|