____ _ __
/ __ )____ _____ | | / /___ ___________
/ __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
/ /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
/_____/\____/____/ |__/|__/\__,_/_/ /____/
A futuristic real-time strategy game.
This file is part of Bos Wars.
(C) Copyright 2001-2007 by the Bos Wars and Stratagus Project.
Distributed under the "GNU General Public License"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stratagus.h"
#include "map.h"
#include "minimap.h"
#include "player.h"
#include "unit.h"
#include "unittype.h"
#include "upgrade.h"
#include "pathfinder.h"
#include "ui.h"
#include "font.h"
#include "sound.h"
#include "sound_server.h"
#include "interface.h"
#include "cursor.h"
#include "spells.h"
#include "construct.h"
#include "actions.h"
#include "network.h"
#include "netconnect.h"
#include "missile.h"
#include "settings.h"
#include "results.h"
#include "trigger.h"
#include "replay.h"
#include "iolib.h"
#include "iocompat.h"
#include "script.h"
Go to the source code of this file.
Functions | |
| static void | LoadStratagusMap (const std::string &smpname, const std::string &mapname, CMap *map) |
| static int | WriteMapPresentation (const std::string &mapname, CMap *map) |
| int | WriteMapSetup (const char *mapSetup, CMap *map) |
| int | SaveStratagusMap (const std::string &mapName, CMap *map) |
| < 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 () |
| Set the game speed. | |
| void | SetGameSpeed (int speed) |
| Get the game speed. | |
| int | GetGameSpeed () |
| static void | GameTypeFreeForAll (void) |
| static void | GameTypeTopVsBottom (void) |
| static void | GameTypeLeftVsRight (void) |
| static void | GameTypeManVsMachine (void) |
| static void | GameTypeManTeamVsMachine (void) |
| void | CreateGame (const std::string &filename, CMap *map) |
| Init Setting to default values. | |
| void | InitSettings (void) |
Variables | |
| Settings | GameSettings |
| Game Settings. | |
| static int | LcmPreventRecurse |
| prevent recursion through LoadGameMap | |
| GameResults | GameResult |
| Outcome of the game. | |
Definition in file game.cpp.
| void CreateGame | ( | const std::string & | filename, | |
| CMap * | map | |||
| ) |
Init Setting to default values.
CreateGame.
Load map, graphics, sounds, etc
| filename | map filename | |
| map | map loaded |
Definition at line 518 of file game.cpp.
References CallbackMusicOn, CViewport::Center(), CVideo::ClearScreen(), CUnit::Colors, CommandLog(), CMinimap::Create(), CreatePlayer(), CurrentMapPath, DebugPlayers(), DebugPrint, FastForwardCycle, CMapInfo::Filename, FlagRevealMap, FlushCommands, GameCycle, GameNoResult, GamePaused, GameResult, Settings::GameType, GameTypeFreeForAll(), GameTypeLeftVsRight(), GameTypeManTeamVsMachine(), GameTypeManVsMachine(), GameTypeTopVsBottom(), CMap::Info, CMap::Init(), InitButtons(), InitConstructions(), InitGroups(), InitIcons(), InitMissileTypes(), InitNetwork2(), InitPathfinder(), InitPlayers(), InitSelections(), InitSoundClient(), InitSpells(), InitSyncRand(), InitTriggers(), InitUnitTypes(), InitUserInterface(), InitVisionTable(), IsNetworkGame, LibraryFileName(), CUserInterface::Load(), LoadConstructions(), LoadCursors(), LoadDecorations(), LoadIcons(), LoadMap(), LoadMissileSprites(), LoadUnitSounds(), LoadUnitTypes(), LocalPlayerName, LuaLoadFile(), Map, MapUnitSounds(), CUserInterface::Minimap, CUserInterface::NormalFontColor, NoUnitP, NumUnits, CUnit::Player, PlayerMax, PlayersInitAi(), CMapInfo::PlayerType, Settings::Presets, CUnit::RescuedFrom, CMap::Reveal(), CUserInterface::ReverseFontColor, SaveGameLoading, CUserInterface::SelectedViewport, SetDefaultTextColors(), CPlayer::SetName(), SetPlayersPalette(), SettingsGameTypeFreeForAll, SettingsGameTypeLeftVsRight, SettingsGameTypeManTeamVsMachine, SettingsGameTypeManVsMachine, SettingsGameTypeMapDefault, SettingsGameTypeMelee, SettingsGameTypeTopVsBottom, SettingsPresetMapDefault, SoundEnabled(), CPlayer::StartX, CPlayer::StartY, strcasestr(), strcpy_s(), SyncHash, ThisPlayer, TileSizeX, TileSizeY, SettingsPresets::Type, UI, CPlayer::UnitColors, Units, UnitUnderCursor, Video, and CUserInterface::Viewports.
Referenced by CEditor::Init(), and StartMap().
| static void GameTypeFreeForAll | ( | void | ) | [static] |
Free for all
Definition at line 381 of file game.cpp.
References CommandDiplomacy(), DiplomacyEnemy, and PlayerMax.
Referenced by CreateGame().
| static void GameTypeLeftVsRight | ( | void | ) | [static] |
Left vs Right
Definition at line 425 of file game.cpp.
References CommandDiplomacy(), DiplomacyAllied, DiplomacyEnemy, CMap::Info, Map, CMapInfo::MapWidth, PlayerMax, Players, CPlayer::SharedVision, and CPlayer::StartX.
Referenced by CreateGame().
| static void GameTypeManTeamVsMachine | ( | void | ) | [static] |
Man vs Machine whith Humans on a Team
Definition at line 477 of file game.cpp.
References CommandDiplomacy(), DiplomacyAllied, DiplomacyEnemy, PlayerComputer, PlayerMax, PlayerPerson, Players, CPlayer::SharedVision, and CPlayer::Team.
Referenced by CreateGame().
| static void GameTypeManVsMachine | ( | void | ) | [static] |
Man vs Machine
Definition at line 452 of file game.cpp.
References CommandDiplomacy(), DiplomacyAllied, DiplomacyEnemy, PlayerComputer, PlayerMax, PlayerPerson, Players, and CPlayer::SharedVision.
Referenced by CreateGame().
| static void GameTypeTopVsBottom | ( | void | ) | [static] |
Top vs Bottom
Definition at line 398 of file game.cpp.
References CommandDiplomacy(), DiplomacyAllied, DiplomacyEnemy, CMap::Info, Map, CMapInfo::MapHeight, PlayerMax, Players, CPlayer::SharedVision, and CPlayer::StartY.
Referenced by CreateGame().
| bool GetGamePaused | ( | ) |
Set the game speed.
Get the game paused or unpaused
Definition at line 346 of file game.cpp.
References GamePaused.
Referenced by tolua_get_GamePaused(), and tolua_stratagus_GetGamePaused00().
| int GetGameSpeed | ( | ) |
Get the game speed
Definition at line 369 of file game.cpp.
References CYCLES_PER_SECOND, and VideoSyncSpeed.
Referenced by tolua_get_GameSpeed(), and tolua_stratagus_GetGameSpeed00().
| void InitSettings | ( | void | ) |
Init Game Setting to default values
Definition at line 710 of file game.cpp.
References Settings::Difficulty, Settings::GameType, Settings::MapRichness, Settings::NetGameType, Settings::NumUnits, Settings::Opponents, PlayerMax, Settings::Presets, Settings::Resources, SettingsPresetMapDefault, SettingsSinglePlayerGame, SettingsPresets::Team, and SettingsPresets::Type.
Referenced by PreMenuSetup().
| static void LoadMap | ( | const std::string & | filename, | |
| CMap * | map | |||
| ) | [static] |
Load any map.
| filename | map filename | |
| map | map loaded |
Definition at line 304 of file game.cpp.
References Assert, CMap::Create(), ExitFatal(), CMapInfo::Filename, CMap::Info, LoadStratagusMap(), and LoadStratagusMapInfo().
Referenced by CreateGame().
| static void LoadStratagusMap | ( | const std::string & | smpname, | |
| const std::string & | mapname, | |||
| CMap * | map | |||
| ) | [static] |
Load a Stratagus map.
| smpname | smp filename | |
| mapname | map filename | |
| map | map loaded |
Definition at line 92 of file game.cpp.
References CL_OPEN_READ, CFile::close(), ExitFatal(), CMapInfo::Filename, CMap::Info, InitPlayers(), LcmPreventRecurse, LuaLoadFile(), Map, CMapInfo::MapHeight, CMapInfo::MapWidth, CFile::open(), StratagusLibPath, strcat_s(), strcpy_s(), and ThisPlayer.
Referenced by LoadMap().
| int SaveStratagusMap | ( | const std::string & | mapName, | |
| CMap * | map | |||
| ) |
< Save a stratagus map (smp format)
Save a Stratagus map.
| mapName | map filename | |
| map | map to save |
Definition at line 273 of file game.cpp.
References ExitFatal(), CMap::Info, CMapInfo::MapHeight, CMapInfo::MapWidth, WriteMapPresentation(), and WriteMapSetup().
Referenced by EditorSaveMap().
| void SetGamePaused | ( | bool | paused | ) |
< Set the game paused or unpaused
Set the game paused or unpaused
| paused | True to pause game, false to unpause. |
Definition at line 336 of file game.cpp.
References GamePaused.
Referenced by tolua_set_GamePaused(), and tolua_stratagus_SetGamePaused00().
| void SetGameSpeed | ( | int | speed | ) |
Get the game speed.
Set the game speed
| speed | New game speed. |
Definition at line 356 of file game.cpp.
References CYCLES_PER_SECOND, FastForwardCycle, GameCycle, SetVideoSync(), and VideoSyncSpeed.
Referenced by tolua_set_GameSpeed(), and tolua_stratagus_SetGameSpeed00().
| static int WriteMapPresentation | ( | const std::string & | mapname, | |
| CMap * | map | |||
| ) | [static] |
Definition at line 165 of file game.cpp.
References CreateFileWriter(), CMapInfo::Description, CMap::Info, CMapInfo::MapHeight, CMapInfo::MapUID, CMapInfo::MapWidth, PlayerMax, PlayerNobody, PlayerPerson, CMapInfo::PlayerType, and FileWriter::printf().
Referenced by SaveStratagusMap().
| int WriteMapSetup | ( | const char * | mapSetup, | |
| CMap * | map | |||
| ) |
Write the map setup file.
| mapSetup | map filename | |
| map | map to save |
Definition at line 218 of file game.cpp.
References CreateFileWriter(), Map, NumUnits, CMap::PatchManager, PlayerMax, Players, FileWriter::printf(), CPatchManager::savePatches(), and Units.
Referenced by SaveStratagusMap().
Outcome of the game.
Definition at line 75 of file game.cpp.
Referenced by CreateGame(), StopGame(), tolua_get_GameResult(), and tolua_set_GameResult().
Game Settings.
Game settings.
Definition at line 73 of file game.cpp.
Referenced by ApplyReplaySettings(), CEditor::Init(), NetworkGamePrepareGameSettings(), StartReplay(), tolua_get_GameSettings(), and tolua_set_GameSettings().
int LcmPreventRecurse [static] |
prevent recursion through LoadGameMap
Definition at line 74 of file game.cpp.
Referenced by LoadStratagusMap().
1.5.6