Create game.h and move some stuff from stratagus.h into more appropriate header.

This commit is contained in:
joris 2012-08-11 14:19:13 +02:00
parent fd66a4c5ef
commit 62f36a96b3
18 changed files with 87 additions and 48 deletions

View file

@ -483,6 +483,7 @@ set(stratagus_generic_HDRS
src/include/depend.h src/include/depend.h
src/include/editor.h src/include/editor.h
src/include/font.h src/include/font.h
src/include/game.h
src/include/icons.h src/include/icons.h
src/include/interface.h src/include/interface.h
src/include/iocompat.h src/include/iocompat.h

View file

@ -41,6 +41,7 @@
#include "commands.h" #include "commands.h"
#include "font.h" #include "font.h"
#include "game.h"
#include "guichan.h" #include "guichan.h"
#include "interface.h" #include "interface.h"
#include "iocompat.h" #include "iocompat.h"

View file

@ -38,6 +38,8 @@
#include "stratagus.h" #include "stratagus.h"
#include "game.h"
#include "actions.h" #include "actions.h"
#include "ai.h" #include "ai.h"
#include "animation.h" #include "animation.h"

View file

@ -32,14 +32,13 @@
// Includes // Includes
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
#include <sstream>
#include <time.h>
#include "stratagus.h" #include "stratagus.h"
#include "replay.h" #include "replay.h"
#include "actions.h" #include "actions.h"
#include "commands.h" #include "commands.h"
#include "game.h"
#include "interface.h" #include "interface.h"
#include "iocompat.h" #include "iocompat.h"
#include "iolib.h" #include "iolib.h"
@ -55,6 +54,9 @@
#include "unittype.h" #include "unittype.h"
#include "version.h" #include "version.h"
#include <sstream>
#include <time.h>
extern void ExpandPath(std::string &newpath, const std::string &path); extern void ExpandPath(std::string &newpath, const std::string &path);
extern void StartMap(const std::string &filename, bool clean); extern void StartMap(const std::string &filename, bool clean);

View file

@ -33,12 +33,10 @@
-- Includes -- Includes
----------------------------------------------------------------------------*/ ----------------------------------------------------------------------------*/
#include <time.h>
#include <ctype.h>
#include <string>
#include "stratagus.h" #include "stratagus.h"
#include "game.h"
#include "actions.h" #include "actions.h"
#include "ai.h" #include "ai.h"
#include "iocompat.h" #include "iocompat.h"
@ -55,6 +53,8 @@
#include "upgrade.h" #include "upgrade.h"
#include "version.h" #include "version.h"
#include <time.h>
extern void StartMap(const std::string &filename, bool clean); extern void StartMap(const std::string &filename, bool clean);

52
src/include/game.h Normal file
View file

@ -0,0 +1,52 @@
// _________ __ __
// / _____// |_____________ _/ |______ ____ __ __ ______
// \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
// / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
// /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
// \/ \/ \//_____/ \/
// ______________________ ______________________
// T H E W A R B E G I N S
// Stratagus - A free fantasy real time strategy game engine
//
//
// (c) Copyright 2012 by Joris Dauphin
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; only version 2 of the License.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
#ifndef GAME_H
#define GAME_H
#include <string>
extern void LoadGame(const std::string &filename); /// Load saved game
extern int SaveGame(const std::string &filename); /// Save game
extern void DeleteSaveGame(const std::string &filename); /// Delete save game
extern bool SaveGameLoading; /// Save game is in progress of loading
extern void InitModules(); /// Initialize all modules
extern void LuaRegisterModules(); /// Register lua script of each modules
extern void LoadModules(); /// Load all modules
extern void CleanModules(); /// Cleanup all modules
extern std::string GameName; /// Name of the game
extern std::string FullGameName; /// Full Name of the game
extern bool UseHPForXp; /// true if gain XP by dealing damage, false if by killing.
#endif // GAME_H

View file

@ -204,31 +204,16 @@ public:
}; };
extern std::string StratagusLibPath; /// Location of stratagus data extern std::string StratagusLibPath; /// Location of stratagus data
extern std::string GameName; /// Name of the game
extern std::string FullGameName; /// Full Name of the game
extern std::string ClickMissile; /// Missile to show when you click
extern std::string DamageMissile; /// Missile to show damage caused
extern std::string MenuRace; extern std::string MenuRace;
extern bool UseHPForXp; /// true if gain XP by dealing damage, false if by killing.
extern unsigned long GameCycle; /// Game simulation cycle counter extern unsigned long GameCycle; /// Game simulation cycle counter
extern unsigned long ResultGameCycle; /// Used in game result extern unsigned long ResultGameCycle; /// Used in game result
extern unsigned long FastForwardCycle; /// Game Replay Fast Forward Counter extern unsigned long FastForwardCycle; /// Game Replay Fast Forward Counter
extern void LoadGame(const std::string &filename); /// Load saved game
extern int SaveGame(const std::string &filename); /// Save game
extern void DeleteSaveGame(const std::string &filename); /// Delete save game
extern bool SaveGameLoading; /// Save game is in progress of loading
extern void Exit(int err); /// Exit extern void Exit(int err); /// Exit
extern void ExitFatal(int err); /// Exit with fatal error extern void ExitFatal(int err); /// Exit with fatal error
extern void UpdateDisplay(); /// Game display update extern void UpdateDisplay(); /// Game display update
extern void InitModules(); /// Initialize all modules
extern void LuaRegisterModules(); /// Register lua script of each modules
extern void LoadModules(); /// Load all modules
extern void CleanModules(); /// Cleanup all modules
extern void DrawMapArea(); /// Draw the map area extern void DrawMapArea(); /// Draw the map area
extern void GameMainLoop(); /// Game main loop extern void GameMainLoop(); /// Game main loop

View file

@ -848,6 +848,10 @@ extern ButtonActionProxy CurrentButtons; /// Current Selected Buttons
extern CUserInterface UI; /// The user interface extern CUserInterface UI; /// The user interface
extern std::string ClickMissile; /// Missile to show when you click
extern std::string DamageMissile; /// Missile to show damage caused
/// Hash table of all the button styles /// Hash table of all the button styles
extern std::map<std::string, ButtonStyle *> ButtonStyleHash; extern std::map<std::string, ButtonStyle *> ButtonStyleHash;

View file

@ -48,6 +48,7 @@
#include "master.h" #include "master.h"
#include "game.h"
#include "iocompat.h" #include "iocompat.h"
#include "netconnect.h" #include "netconnect.h"
#include "network.h" #include "network.h"

View file

@ -34,6 +34,7 @@
#include "spell/spell_capture.h" #include "spell/spell_capture.h"
#include "game.h"
#include "script.h" #include "script.h"
#include "unit.h" #include "unit.h"

View file

@ -34,6 +34,7 @@
#include "spell/spell_polymorph.h" #include "spell/spell_polymorph.h"
#include "game.h"
#include "map.h" #include "map.h"
#include "script.h" #include "script.h"
#include "unit.h" #include "unit.h"

View file

@ -38,6 +38,7 @@
#include "iolib.h" #include "iolib.h"
#include "game.h"
#include "iocompat.h" #include "iocompat.h"
#include "map.h" #include "map.h"
#include "util.h" #include "util.h"

View file

@ -35,34 +35,18 @@
#include "stratagus.h" #include "stratagus.h"
#include "video.h"
#include "tileset.h"
#include "map.h"
#include "font.h"
#include "sound.h"
#include "sound_server.h"
#include "unitsound.h"
#include "unittype.h"
#include "player.h"
#include "unit.h"
#include "cursor.h"
#include "minimap.h"
#include "actions.h" #include "actions.h"
#include "missile.h"
#include "interface.h"
#include "menus.h"
#include "network.h"
#include "ui.h"
#include "unit.h"
#include "trigger.h"
#include "results.h"
#include "settings.h"
#include "commands.h"
#include "pathfinder.h"
#include "editor.h" #include "editor.h"
#include "sound.h" #include "game.h"
#include "replay.h" #include "map.h"
#include "missile.h"
#include "network.h"
#include "particle.h" #include "particle.h"
#include "replay.h"
#include "results.h"
#include "sound.h"
#include "trigger.h"
#include "ui.h"
#include <guichan.h> #include <guichan.h>
void DrawGuichanWidgets(); void DrawGuichanWidgets();

View file

@ -40,6 +40,7 @@
#include "script.h" #include "script.h"
#include "font.h" #include "font.h"
#include "game.h"
#include "iocompat.h" #include "iocompat.h"
#include "iolib.h" #include "iolib.h"
#include "map.h" #include "map.h"

View file

@ -196,6 +196,7 @@ extern int getopt(int argc, char *const *argv, const char *opt);
#include "cursor.h" #include "cursor.h"
#include "editor.h" #include "editor.h"
#include "font.h" #include "font.h"
#include "game.h"
#include "guichan.h" #include "guichan.h"
#include "interface.h" #include "interface.h"
#include "iocompat.h" #include "iocompat.h"

View file

@ -2,6 +2,7 @@ $#include "stratagus.h"
$#include "ai.h" $#include "ai.h"
$#include "font.h" $#include "font.h"
$#include "game.h"
$#include "iolib.h" $#include "iolib.h"
$#include "map.h" $#include "map.h"
$#include "minimap.h" $#include "minimap.h"

View file

@ -42,9 +42,9 @@
#include "animation.h" #include "animation.h"
#include "commands.h" #include "commands.h"
#include "construct.h" #include "construct.h"
#include "game.h"
#include "editor.h" #include "editor.h"
#include "interface.h" #include "interface.h"
#include "iolib.h"
#include "luacallback.h" #include "luacallback.h"
#include "map.h" #include "map.h"
#include "missile.h" #include "missile.h"

View file

@ -79,6 +79,7 @@
#include "editor.h" #include "editor.h"
#include "font.h" #include "font.h"
#include "game.h"
#include "interface.h" #include "interface.h"
#include "minimap.h" #include "minimap.h"
#include "network.h" #include "network.h"