$treeview $search $mathjax
Stratagus  2.2.7
$projectbrief
$projectbrief
$searchbox
-->
         _________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

src/game/game.cpp File Reference

#include <png.h>
#include "stratagus.h"
#include "game.h"
#include "actions.h"
#include "ai.h"
#include "animation.h"
#include "commands.h"
#include "construct.h"
#include "depend.h"
#include "editor.h"
#include "font.h"
#include "interface.h"
#include "iocompat.h"
#include "iolib.h"
#include "map.h"
#include "minimap.h"
#include "missile.h"
#include "netconnect.h"
#include "network.h"
#include "pathfinder.h"
#include "player.h"
#include "replay.h"
#include "results.h"
#include "settings.h"
#include "sound.h"
#include "sound_server.h"
#include "spells.h"
#include "trigger.h"
#include "ui.h"
#include "unit.h"
#include "unit_manager.h"
#include "unittype.h"
#include "upgrade.h"
#include "version.h"

game.cpp - The game set-up and creation.

Settings GameSettings
static int LcmPreventRecurse
 Game Settings.
GameResults GameResult
 prevent recursion through LoadGameMap
std::string GameName
 Outcome of the game.
std::string FullGameName
 Name of the game.
bool UseHPForXp = false
 Full Name of the game.
static void LoadStratagusMap (const std::string &smpname, const std::string &mapname)
 true if gain XP by dealing damage, false if by killing.
static void WriteMapPreview (const char *mapname, CMap &map)
static int WriteMapPresentation (const std::string &mapname, CMap &map, char *)
int WriteMapSetup (const char *mapSetup, CMap &map, int writeTerrain)
int SaveStratagusMap (const std::string &mapName, CMap &map, int writeTerrain)
 Save a stratagus map (smp format).
static void LoadMap (const std::string &filename, CMap &map)
void SetGamePaused (bool paused)
 Set the game paused or unpaused.
bool GetGamePaused ()
 Get the game paused or unpaused.
void SetGameSpeed (int speed)
 Set the game speed.
int GetGameSpeed ()
 Get the game speed.
static void GameTypeFreeForAll ()
static void GameTypeTopVsBottom ()
static void GameTypeLeftVsRight ()
static void GameTypeManVsMachine ()
static void GameTypeManTeamVsMachine ()
void CreateGame (const std::string &filename, CMap *map)
 Create a game.
void InitSettings ()
 Init Setting to default values.
static void CleanGame_Lua ()
void CleanGame ()
static int CclSetGameName (lua_State *l)
static int CclSetFullGameName (lua_State *l)
static int CclSetGodMode (lua_State *l)
static int CclGetGodMode (lua_State *l)
static int CclSetSpeedResourcesHarvest (lua_State *l)
static int CclSetSpeedResourcesReturn (lua_State *l)
static int CclSetSpeedBuild (lua_State *l)
static int CclGetSpeedBuild (lua_State *l)
static int CclSetSpeedTrain (lua_State *l)
static int CclGetSpeedTrain (lua_State *l)
static int CclSetSpeedUpgrade (lua_State *l)
static int CclSetSpeedResearch (lua_State *l)
static int CclSetSpeeds (lua_State *l)
static int CclDefineDefaultIncomes (lua_State *l)
static int CclDefineDefaultActions (lua_State *l)
static int CclDefineDefaultResourceNames (lua_State *l)
static int CclDefineDefaultResourceAmounts (lua_State *l)
static int CclDefineDefaultResourceMaxAmounts (lua_State *l)
static int ScriptSetUseHPForXp (lua_State *l)
static int CclSetLocalPlayerName (lua_State *l)
static int CclGetLocalPlayerName (lua_State *l)
static int CclGetStratagusVersion (lua_State *l)
static int CclGetStratagusHomepage (lua_State *l)
static int CclSetMenuRace (lua_State *l)
static int CclSavedGameInfo (lua_State *l)
void LuaRegisterModules ()
 Initialize all modules.

Function Documentation

static int CclDefineDefaultActions ( lua_State *  l  )  [static]

Define default action for the resources.

Parameters:
l Lua state.

static int CclDefineDefaultIncomes ( lua_State *  l  )  [static]

Define default incomes for a new player.

Parameters:
l Lua state.

static int CclDefineDefaultResourceAmounts ( lua_State *  l  )  [static]

Define default names for the resources.

Parameters:
l Lua state.

static int CclDefineDefaultResourceMaxAmounts ( lua_State *  l  )  [static]

Define max amounts for the resources.

Parameters:
l Lua state.

static int CclDefineDefaultResourceNames ( lua_State *  l  )  [static]

Define default names for the resources.

Parameters:
l Lua state.

static int CclGetGodMode ( lua_State *  l  )  [static]

Get God mode.

Parameters:
l Lua state.
Returns:
God mode.

static int CclGetLocalPlayerName ( lua_State *  l  )  [static]

Get the local player name

Parameters:
l Lua state.

static int CclGetSpeedBuild ( lua_State *  l  )  [static]

Get building speed (deprecated).

Parameters:
l Lua state.
Returns:
Building speed.

static int CclGetSpeedTrain ( lua_State *  l  )  [static]

Get training speed (deprecated).

Parameters:
l Lua state.
Returns:
Training speed.

static int CclGetStratagusHomepage ( lua_State *  l  )  [static]

Get Stratagus Homepage

static int CclGetStratagusVersion ( lua_State *  l  )  [static]

Get Stratagus Version

static int CclSavedGameInfo ( lua_State *  l  )  [static]

Load the SavedGameInfo Header

Parameters:
l Lua state.

static int CclSetFullGameName ( lua_State *  l  )  [static]

static int CclSetGameName ( lua_State *  l  )  [static]

Return of game name.

Parameters:
l Lua state.

static int CclSetGodMode ( lua_State *  l  )  [static]

Set God mode.

Parameters:
l Lua state.
Returns:
The old mode.

static int CclSetLocalPlayerName ( lua_State *  l  )  [static]

Set the local player name

Parameters:
l Lua state.

static int CclSetMenuRace ( lua_State *  l  )  [static]

static int CclSetSpeedBuild ( lua_State *  l  )  [static]

Set building speed (deprecated).

Parameters:
l Lua state.

static int CclSetSpeedResearch ( lua_State *  l  )  [static]

For debug increase researching speed (deprecated).

Parameters:
l Lua state.

static int CclSetSpeedResourcesHarvest ( lua_State *  l  )  [static]

Set resource harvesting speed (deprecated).

Parameters:
l Lua state.

static int CclSetSpeedResourcesReturn ( lua_State *  l  )  [static]

Set resource returning speed (deprecated).

Parameters:
l Lua state.

static int CclSetSpeeds ( lua_State *  l  )  [static]

For debug increase all speeds (deprecated).

Parameters:
l Lua state.

static int CclSetSpeedTrain ( lua_State *  l  )  [static]

Set training speed (deprecated).

Parameters:
l Lua state.

static int CclSetSpeedUpgrade ( lua_State *  l  )  [static]

For debug increase upgrading speed (deprecated).

Parameters:
l Lua state.

void CleanGame (  ) 

Cleanup game.

Call each module to clean up. Contrary to CleanModules, maps can be restarted without reloading all lua files.

static void CleanGame_Lua (  )  [static]

void CreateGame ( const std::string &  filename,
CMap map 
)

Create a game.

CreateGame.

Load map, graphics, sounds, etc

Parameters:
filename map filename
map map loaded
Todo:
FIXME: use in this function InitModules / LoadModules!!!

static void GameTypeFreeForAll (  )  [static]

Free for all

static void GameTypeLeftVsRight (  )  [static]

Left vs Right

static void GameTypeManTeamVsMachine (  )  [static]

Man vs Machine whith Humans on a Team

static void GameTypeManVsMachine (  )  [static]

Man vs Machine

static void GameTypeTopVsBottom (  )  [static]

Top vs Bottom

bool GetGamePaused (  ) 

Get the game paused or unpaused.

Get the game paused or unpaused

Returns:
True if the game is paused, false otherwise

int GetGameSpeed (  ) 

Get the game speed.

Get the game speed

Returns:
Game speed

void InitSettings (  ) 

Init Setting to default values.

Init Game Setting to default values

Todo:
FIXME: this should not be executed for restart levels!

static void LoadMap ( const std::string &  filename,
CMap map 
) [static]

Load any map.

Parameters:
filename map filename
map map loaded

static void LoadStratagusMap ( const std::string &  smpname,
const std::string &  mapname 
) [static]

true if gain XP by dealing damage, false if by killing.

Load a Stratagus map.

Parameters:
smpname smp filename
mapname map filename
map map loaded

void LuaRegisterModules (  ) 

Initialize all modules.

int SaveStratagusMap ( const std::string &  mapName,
CMap map,
int  writeTerrain 
)

Save a stratagus map (smp format).

Save a Stratagus map.

Parameters:
mapName map filename
map map to save
writeTerrain write the tiles map in the .sms

static int ScriptSetUseHPForXp ( lua_State *  l  )  [static]

Affect UseHPForXp.

Parameters:
l Lua state.
Returns:
0.

void SetGamePaused ( bool  paused  ) 

Set the game paused or unpaused.

Set the game paused or unpaused

Parameters:
paused True to pause game, false to unpause.

void SetGameSpeed ( int  speed  ) 

Set the game speed.

Set the game speed

Parameters:
speed New game speed.

static int WriteMapPresentation ( const std::string &  mapname,
CMap map,
char *   
) [static]

static void WriteMapPreview ( const char *  mapname,
CMap map 
) [static]

int WriteMapSetup ( const char *  mapSetup,
CMap map,
int  writeTerrain 
)

Write the map setup file.

Parameters:
mapsetup map filename
map map to save
writeTerrain write the tiles map in the .sms


Variable Documentation

std::string FullGameName

Name of the game.

std::string GameName

Outcome of the game.

Cleanup all modules.

prevent recursion through LoadGameMap

Game results.

int LcmPreventRecurse [static]

Game Settings.

bool UseHPForXp = false

Full Name of the game.

(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.