____                _       __
    / __ )____  _____   | |     / /___ ___________
   / __  / __ \/ ___/   | | /| / / __ `/ ___/ ___/
  / /_/ / /_/ (__  )    | |/ |/ / /_/ / /  (__  )
 /_____/\____/____/     |__/|__/\__,_/_/  /____/

       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"

stratagus.h File Reference

The main header file. More...

#include <stdlib.h>
#include <string>
#include "util.h"
#include "translate.h"

Go to the source code of this file.

Defines

#define _C_   ,
 Debug , to simulate vararg macros.
#define PrintFunction()   do { fprintf(stdout, "%s:%d: ", __FILE__, __LINE__); } while (0)
#define Assert(cond)
#define DebugPrint(args)
#define _(str)   Translate(str)
#define N_(str)   str
#define STRATAGUS_LIB_PATH   "."
 Where to find the data files.
#define STRATAGUS_HOME_PATH   ".boswars/"
#define PlayerMax   9
 How many players are supported.
#define UnitTypeMax   257
 How many unit types supported.
#define UnitMax   2048
 How many units supported.
#define FRAMES_PER_SECOND   30
 < Frames per second to display
#define CYCLES_PER_SECOND   30

Functions

void LoadGame (const std::string &filename)
 Load saved game.
void SaveGame (const std::string &filename)
 Save game.
void Exit (int err)
 Exit.
void ExitFatal (int err)
 Exit with fatal error.
void UpdateDisplay (void)
 Game display update.
void InitModules (void)
 Initialize all modules.
void LoadModules (void)
 Load all modules.
void CleanModules (void)
 Cleanup all modules.
void DrawMapArea (void)
 Draw the map area.
void GameMainLoop (void)
 Game main loop.
void ShowLoadProgress (const char *fmt,...)

Variables

std::string UserDirectory
 Directory containing user settings and data.
std::string StratagusLibPath
 Location of stratagus data.
std::string ClickMissile
 Missile to show when you click.
std::string DamageMissile
 Missile to show damage caused.
int SpeedBuild
 Speed factor for building.
int SpeedTrain
 Speed factor for training.
unsigned long GameCycle
 Game simulation cycle counter.
unsigned long FastForwardCycle
 Game Replay Fast Forward Counter.
std::string CompileOptions
 Compile options.
bool SaveGameLoading
 Save game is in progress of loading.


Detailed Description

The main header file.

Definition in file stratagus.h.


Define Documentation

#define _ ( str   )     Translate(str)

#define _C_   ,

Debug , to simulate vararg macros.

This simulates vararg macros. Example: DebugPrint("Test %d %d\n" _C_ 1 _C_ 2); Print function in debug macros

Definition at line 88 of file stratagus.h.

Referenced by AddButton(), AiCanNotBuild(), AiCountUnitBuilders(), AiFindBuildingPlace(), AiFindTarget(), AiHelpMe(), AiInit(), AiMakeUnit(), AiPlanAttack(), AiRepairUnit(), AiTrainingComplete(), AiUnitKilled(), AiWorkComplete(), AttackTarget(), Summon::Cast(), Ccl2Condition(), CclAiAttackWithForce(), CclAiForce(), CclAiForceRole(), CclAiWait(), CclAiWaitForce(), CclDefineAi(), CclDefineAiHelper(), CclDefineAiPlayer(), CclDefineAllow(), CclDefineAnimations(), CclDefineButton(), CclDefineButtonStyle(), CclDefineConstruction(), CclDefineCursor(), CclDefineDecorations(), CclDefineGameSounds(), CclDefineMissileType(), CclDefinePlayerColors(), CclDefinePlayerTypes(), CclDefineSpell(), CclDefineSprites(), CclDefineUnitAllow(), CclDefineUnitType(), CclDefineVariables(), CclDefineViewports(), CclGarbageCollect(), CclGetResourceByName(), CclGetUnitVariable(), CclIfNearUnit(), CclIfRescuedNearUnit(), CclLoad(), CclLog(), CclMissile(), CclOrderUnit(), CclParseBuilt(), CclParseHarvest(), CclParseMove(), CclParseOrder(), CclParseTrain(), CclPlayer(), CclReplayLog(), CclSavedGameInfo(), CclSetTitleScreens(), CclSetUnitVariable(), CclSlotUsage(), CclSpellAction(), CclSpellAutocast(), CclSpellCondition(), CclSpellMissileLocation(), CclStratagusMap(), CclUnit(), CheckVersions(), ClientParseAsync(), ClientParseConnected(), ClientParseConnecting(), ClientParseDetaching(), ClientParseGoAhead(), ClientParseMapInfo(), ClientParseStarted(), ClientParseSynced(), CommandCancelTraining(), CommandSpellCast(), ConstructionByIdent(), CreatePlayer(), CursorByIdent(), DebugPlayers(), DefineVariableField(), DoNextReplay(), CUnit::Draw(), Exit(), ExitNetwork1(), FindLabel(), FindNewResource(), FireMissile(), GatherResource(), CIcon::Get(), CFontColor::Get(), CFont::Get(), HandleActionBuilt(), HandleActionNone(), HandleActionPatrol(), HandleBuffs(), HandleMouseOn(), InitNetwork1(), InitNetwork2(), InitSdlSound(), KickDeadClient(), LibraryFileName(), LoadIcons(), MakeSound(), MakeSoundGroup(), MakeTextures2(), MakeUnit(), NetworkEvent(), NetworkExecCommands(), NetworkExitServerConnect(), NetworkGamePrepareGameSettings(), NetworkParseMenuPacket(), NetworkProcessClientRequest(), NetworkProcessServerRequest(), NetworkSendCommands(), NetworkSendRateLimitedClientMessage(), NetworkServerStartGame(), NetworkSetupServerAddress(), NextPathElement(), ParseAnimationFrame(), ParseBuildingRules(), ParseButtonStyleProperties(), ParseCommand(), ParseExtendedCommand(), ParseNetworkCommand(), PlayMusic(), CUnit::Release(), CUnit::Remove(), ResourceGiveUp(), SendCommand(), SendSpellCast(), ServerParseGoodBye(), ServerParseHello(), ServerParseMap(), ServerParseResync(), ServerParseSeeYou(), ServerParseState(), ServerParseWaiting(), SetVideoSync(), ShowLoadProgress(), ShowSingleOrder(), SoundForName(), SpellCast(), StartEditor(), StartMap(), TriggerGetPlayer(), UIHandleButtonDown(), UiToggleGrabMouse(), UnitLost(), UnitTypeIdByIdent(), and UpdateUnitVariables().

#define Assert ( cond   ) 

Definition at line 112 of file stratagus.h.

Referenced by CPatchManager::add(), AddAnimationToArray(), AddButton(), CUnit::AddInContainer(), AddToGroup(), CPlayer::AddToUnitsConsumingResources(), AiAssignHarvester(), AiCanNotBuild(), AiCanNotReach(), AiHelperInsert(), AiNeedMoreSupply(), AiReduceMadeInBuilt(), AiRemoveFromBuilt(), AiRemoveFromBuilt2(), AiTrainingComplete(), AiUnitKilled(), AiWorkComplete(), AllocNCQ(), AnimateActionHarvest(), AStarRemoveMinimum(), AttackTarget(), AttackUnitsInRange(), AttackUnitsInReactRange(), AutoAttack(), CalculateCosts(), CalculateDamage(), CalculateMaxIconSize(), CanMove(), AdjustVitals::Cast(), CclAiWaitForce(), CclDefineAiPlayer(), CclDefineCursor(), CclDefineDecorations(), CclLog(), CclMissile(), CclParseBuilt(), CclReplayLog(), CclSlotUsage(), CclSpellMissileLocation(), CclUnit(), ChangeSelectedUnits(), ChangeTeamSelectedUnits(), CheckForTargetInRange(), CleanButtons(), ClearGroup(), ClipViewport(), CMap::CoastOnMap(), CommandAttack(), CommandAttackGround(), CommandMove(), CommandMoveOrder(), CommandPatrolUnit(), CommandSpellCast(), CommandStopUnit(), CostMoveTo(), CMap::Create(), CSmokeParticle::CSmokeParticle(), DefaultResourceNumber(), DoActionMove(), CButtonPanel::DoClicked(), DoDrawText(), DoNextReplay(), DoRepair(), DoRightButton(), CUnit::Draw(), CDecoVarSpriteBar::Draw(), CButtonPanel::Draw(), linedraw_gl::DrawCircle(), linedraw_gl::DrawCircleClip(), DrawDecoration(), linedraw_gl::DrawLineClip(), Missile::DrawMissile(), DrawShadow(), DropOutAll(), DropOutNearest(), FillChannel(), FindRangeAttack(), FireMissile(), CGraphic::Free(), GameMainLoop(), GetButtonStatus(), CPatchType::getFlag(), getUnitTypeFromString(), GraphicAnimation::GraphicAnimation(), GraphicPlayerPixels(), HandleActionAttack(), HandleActionDie(), HandleActionFollow(), HandleActionMove(), HandleMouseOn(), HandleUnitAction(), HitUnit(), COrder::Init(), CUnit::Init(), InitAStar(), InitUnitTypes(), CUnitCache::Insert(), InvalidateArea(), IsButtonAllowed(), CUnit::IsVisibleInViewport(), CursorConfig::Load(), IconConfig::Load(), CGraphic::Load(), LoadMap(), MissileType::LoadMissileSprite(), LoadWav(), LuaCallback::LuaCallback(), main(), MakeSound(), MapMarkTileRadar(), MapMarkTileRadarJammer(), MapMarkTileSight(), MapUnmarkTileRadar(), MapUnmarkTileRadarJammer(), MapUnmarkTileSight(), MissileHit(), MissileHitsGoal(), MissileInitMove(), MissileNewHeadingFromXY(), MissilesActionLoop(), MixChannelsToStereo32(), MixMusicToStereo32(), MixSampleToStereo32(), MoveToDropZone(), MoveToLocation(), MoveToTarget(), MoveToTransporter(), CUnit::MoveToXY(), NetResolveHost(), NetworkExecCommands(), NetworkGamePrepareGameSettings(), NetworkProcessSelection(), NetworkSendCommand(), NetworkServerStartGame(), CPlayerColorGraphic::New(), CGraphic::New(), CFile::open(), ParabolicMissile(), ParseBuildingRules(), ParseCommand(), ParseNetworkCommand(), CUnit::Place(), PlaceReachable(), PointToPointMissile(), CUnit::RefsDecrease(), CUnit::RefsIncrease(), CUnit::Release(), CUnitCache::Remove(), RemoveOrder(), RemoveUnitFromContainer(), RemoveUnitFromGroups(), CGraphic::Resize(), RestoreSavedOrder(), SaveGlobal(), SaveUnit(), CUnitCache::Select(), SelectGroup(), SelectTargetUnitsOfAutoCast(), SelectUnitsByType(), SetClipping(), CPatchType::setFlag(), SetGroup(), SoundForName(), SpellMoveToTarget(), StartBuilding(), StartGathering(), StaticParticle::StaticParticle(), MenuScreen::stop(), UIHandleButtonDown(), UnitCanBeAt(), UnitIdAllowed(), UnitLost(), UnitShowAnimationScaled(), UnitsOnTileUnmarkSeen(), UnitTypeCanBeAt(), UnitTypeIdByIdent(), UnloadUnit(), UnSelectUnit(), UpdateButtonPanelMultipleUnits(), UpdateButtonPanelSingleUnit(), UpdateStatusLineForButton(), UpdateUnitSightRange(), UpdateUnitVariables(), and CMap::WaterOnMap().

#define CYCLES_PER_SECOND   30

#define DebugPrint ( args   ) 

Definition at line 113 of file stratagus.h.

Referenced by AddButton(), AiAttackWithForce(), AiCanNotBuild(), AiCountUnitBuilders(), AiFindBuildingPlace(), AiFindTarget(), AiForceAttacks(), AiForceManager(), AiHelpMe(), AiInit(), AiMakeUnit(), AiMarkWaterTransporter(), AiPlanAttack(), AiRemoveFromBuilt(), AiRepairUnit(), AiTrainingComplete(), AiUnitKilled(), AiWorkComplete(), AttackTarget(), Summon::Cast(), SpawnPortal::Cast(), CclAiWait(), CclCreateUnit(), CclDefineAi(), CclDefineAiPlayer(), CclDefineAllow(), CclDefineMissileType(), CclDefineSpell(), CclDefineUnitAllow(), CclDefineUnitType(), CclDefineVariables(), CclGarbageCollect(), CclLoad(), CclParseOrder(), CclSavedGameInfo(), CclSpellAction(), CclUnit(), CUnit::ChangeOwner(), CheckVersions(), CleanSpells(), ClientParseAsync(), ClientParseConnected(), ClientParseConnecting(), ClientParseDetaching(), ClientParseGoAhead(), ClientParseMapInfo(), ClientParseStarted(), ClientParseSynced(), ClosestFreeCoast(), CommandAttackGround(), CommandCancelTraining(), CommandDismiss(), CommandSpellCast(), ConstructionByIdent(), CreateGame(), CreatePlayer(), CursorByIdent(), DebugPlayers(), DoDrawText(), DoNextReplay(), DoRightButton(), CUnit::Draw(), EditorActionPlaceUnit(), EnterTransporter(), Exit(), ExitNetwork1(), FindNewResource(), FireMissile(), GatherResource(), CIcon::Get(), CFontColor::Get(), CFont::Get(), GetUTF8(), HandleActionAttack(), HandleActionBuilt(), HandleActionFollow(), HandleActionMove(), HandleActionNone(), HandleActionPatrol(), HandleActionSpellCast(), HandleActionTrain(), HandleBuffs(), HandleCheats(), HandleCommandKey(), HandleMouseOn(), HandleUnitAction(), HitUnit(), InitNetwork1(), InitNetwork2(), InitSdlSound(), KickDeadClient(), LeaveTransporter(), LetUnitDie(), LibraryFileName(), LoadIcons(), MakeSound(), MakeSoundGroup(), MakeTextures2(), MakeUnit(), MissileHit(), MoveToLocation(), NetSocketSetSocketReady(), NetworkEvent(), NetworkExecCommands(), NetworkExitServerConnect(), NetworkGamePrepareGameSettings(), NetworkParseMenuPacket(), NetworkProcessClientRequest(), NetworkProcessServerRequest(), NetworkSendCommands(), NetworkSendRateLimitedClientMessage(), NetworkServerStartGame(), NetworkSetupServerAddress(), CFile::open(), ParseCommand(), ParseExtendedCommand(), ParseNetworkCommand(), PlayMusic(), CUnit::Release(), CUnit::Remove(), RepairUnit(), ResourceGiveUp(), SaveAi(), SaveOrder(), SavePlayers(), SelectTargetUnitsOfAutoCast(), SelectUnit(), SendCommand(), SendRepair(), SendSpellCast(), ServerParseGoodBye(), ServerParseHello(), ServerParseMap(), ServerParseResync(), ServerParseSeeYou(), ServerParseState(), ServerParseWaiting(), SetVideoSync(), SetViewportMode(), SetViewportModeQuad(), SetViewportModeSingle(), SetViewportModeSplitHoriz(), SetViewportModeSplitHoriz3(), SetViewportModeSplitVert(), ShowLoadProgress(), ShowSingleOrder(), SoundForName(), SpellCast(), StartEditor(), StartMap(), UIHandleButtonDown(), UiToggleGrabMouse(), UnitLost(), UnitTypeIdByIdent(), UpdateStats(), UpdateUnitVariables(), WaitForTransporter(), and CFile::~CFile().

#define FRAMES_PER_SECOND   30

< Frames per second to display

Game cycles per second to simulate

Definition at line 162 of file stratagus.h.

Referenced by DoScrollArea(), EditorMainLoop(), NetworkRecover(), and CMinimap::Update().

#define N_ ( str   )     str

Definition at line 130 of file stratagus.h.

#define PlayerMax   9

How many players are supported.

Definition at line 153 of file stratagus.h.

Referenced by ApplyReplaySettings(), CclDefineAiPlayer(), CclDefineAllow(), CclDefinePlayerColorIndex(), CclDefinePlayerTypes(), CclDefineUnitAllow(), CclPlayer(), CclReplayLog(), CclSetAllPlayersBuildingLimit(), CclSetAllPlayersTotalUnitLimit(), CclSetAllPlayersUnitLimit(), CclUnit(), CleanAi(), CleanPlayers(), CleanSelections(), ClientParseAsync(), ClientParseConnecting(), CreateGame(), CreatePlayer(), DebugPlayers(), CInitMessage::Deserialize(), CServerSetup::Deserialize(), DrawInfoPanelNoneSelected(), DrawPlayers(), DrawStartLocations(), DrawUnitSelection(), EditorCallbackMouse(), CGraphic::Free(), FreeOpenGLGraphics(), GameTypeFreeForAll(), GameTypeLeftVsRight(), GameTypeManTeamVsMachine(), GameTypeManVsMachine(), GameTypeTopVsBottom(), GetNumOpponents(), CEditor::Init(), InitNetwork1(), InitPlayers(), InitSelections(), InitSettings(), InputKey(), IsTileRadarVisible(), CMap::IsTileVisible(), CUnit::IsVisible(), KickDeadClient(), NetListenTCP(), NetworkExitServerConnect(), NetworkGamePrepareGameSettings(), NetworkInitClientConnect(), NetworkInitServerConnect(), NetworkParseMenuPacket(), NetworkProcessServerRequest(), NetworkSendSelection(), NetworkServerResyncClients(), NetworkServerStartGame(), ReloadGraphics(), ReplayEachCycle(), RestoreSelection(), CMap::Reveal(), CMap::Save(), SaveAiPlayers(), SaveFullLog(), SavePlayers(), SaveSelection(), SaveUnit(), SaveUpgrades(), CInitMessage::Serialize(), CServerSetup::Serialize(), ServerParseHello(), ServerParseResync(), ServerParseState(), ServerParseWaiting(), SetPlayersPalette(), CServerSetup::Size(), StartReplay(), tolua_get_stratagus_CMapInfo_PlayerType(), tolua_get_stratagus_CServerSetup_CompOpt(), tolua_get_stratagus_CServerSetup_LastFrame(), tolua_get_stratagus_CServerSetup_Ready(), tolua_get_stratagus_Hosts(), tolua_get_stratagus_Players(), tolua_get_stratagus_Settings_Presets(), tolua_set_stratagus_CMapInfo_PlayerType(), tolua_set_stratagus_CServerSetup_CompOpt(), tolua_set_stratagus_CServerSetup_LastFrame(), tolua_set_stratagus_CServerSetup_Ready(), tolua_set_stratagus_Hosts(), tolua_set_stratagus_Players(), tolua_set_stratagus_Settings_Presets(), tolua_stratagus_open(), TriggerGetPlayer(), UnitCountSeen(), UnitsOnTileMarkSeen(), UnitsOnTileUnmarkSeen(), UnSelectUnit(), UpdateStats(), WriteMapPresentation(), WriteMapSetup(), and CUnitType::~CUnitType().

 
#define PrintFunction (  )     do { fprintf(stdout, "%s:%d: ", __FILE__, __LINE__); } while (0)

Definition at line 91 of file stratagus.h.

Referenced by NetRecvUDP().

#define STRATAGUS_HOME_PATH   ".boswars/"

Definition at line 145 of file stratagus.h.

Referenced by CreateUserDirectories().

#define STRATAGUS_LIB_PATH   "."

Where to find the data files.

Definition at line 136 of file stratagus.h.

Referenced by main().

#define UnitMax   2048

#define UnitTypeMax   257


Function Documentation

void CleanModules ( void   ) 

void DrawMapArea ( void   ) 

Draw the map area.

Draw map area

Definition at line 162 of file mainloop.cpp.

References NoUnitP, CUserInterface::NumViewports, TileSizeX, TileSizeY, UI, UnitActionDie, and CUserInterface::Viewports.

Referenced by EditorUpdateDisplay(), and UpdateDisplay().

void Exit ( int  err  ) 

void ExitFatal ( int  err  ) 

Exit with fatal error.

Do a fatal exit. Called on out of memory or crash.

Parameters:
err Error code to pass to shell.

Definition at line 601 of file stratagus.cpp.

Referenced by CPlayerColorGraphic::ForceNew(), CGraphic::ForceNew(), IconConfig::Load(), CGraphic::Load(), LoadCcl(), LoadMap(), LoadStratagusMap(), LuaLoadBuffer(), main(), CPlayerColorGraphic::New(), CGraphic::New(), NewUnitTypeSlot(), FileWriter::printf(), and SaveStratagusMap().

void GameMainLoop ( void   ) 

void InitModules ( void   ) 

void LoadGame ( const std::string &  filename  ) 

void LoadModules ( void   ) 

void SaveGame ( const std::string &  filename  ) 

void ShowLoadProgress ( const char *  fmt,
  ... 
)

void UpdateDisplay ( void   ) 


Variable Documentation

std::string ClickMissile

Missile to show when you click.

Definition at line 56 of file script_ui.cpp.

Referenced by CclSetClickMissile(), UIHandleButtonDown(), and UISelectStateButtonDown().

std::string CompileOptions

Compile options.

Definition at line 231 of file stratagus.cpp.

Referenced by CclGetCompileFeature(), main(), and PrintHeader().

std::string DamageMissile

Missile to show damage caused.

Definition at line 57 of file script_ui.cpp.

Referenced by CclSetDamageMissile(), and HitUnit().

unsigned long FastForwardCycle

Game Replay Fast Forward Counter.

Definition at line 247 of file stratagus.cpp.

Referenced by CreateGame(), GameMainLoop(), InitModules(), InputKey(), SetGameSpeed(), UiDecreaseGameSpeed(), and UiIncreaseGameSpeed().

unsigned long GameCycle

Speed factor for building.

Definition at line 239 of file stratagus.cpp.

Referenced by CclGetSpeedBuild(), CclSetSpeedBuild(), CclSetSpeeds(), DoRepair(), HandleActionBuilt(), and SaveCcl().

Speed factor for training.

Definition at line 240 of file stratagus.cpp.

Referenced by CclGetSpeedTrain(), CclSetSpeeds(), CclSetSpeedTrain(), HandleActionTrain(), and SaveCcl().

std::string StratagusLibPath

std::string UserDirectory


Generated on Sat Feb 21 00:28:19 2009 for Bos Wars by  doxygen 1.5.6