$treeview $search $mathjax
Stratagus  2.2.6
$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/include/stratagus.h File Reference

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

Go to the source code of this file.


Classes

class  Parameters
struct  DisplayAutoLocker

stratagus.h - The main header file.

#define _C_   ,
#define PrintFunction()   do { fprintf(stdout, "%s:%d: %s: ", __FILE__, __LINE__, __func__); } while (0)
 Print function in debug macros.
#define Assert(cond)
#define DebugPrint(args)
#define RefsAssert(cond)
#define _(str)   Translate(str)
#define N_(str)   str
#define PlayerMax   16
#define UnitTypeMax   2048
#define UpgradeMax   2048
#define UnitMax   65536
#define SCROLL_UP   15
 Scrolling area (<= 15 y).
#define SCROLL_DOWN   (Video.Height - 16)
 Scrolling area (>= VideoHeight - 16 y).
#define SCROLL_LEFT   15
 Scrolling area (<= 15 y).
#define SCROLL_RIGHT   (Video.Width - 16)
 Scrolling area (>= VideoWidth - 16 x).
#define FRAMES_PER_SECOND   30
 Frames per second to display (original 30-40).
#define CYCLES_PER_SECOND   30
 Game cycles per second to simulate (original 30-40).
#define CancelBuildingCostsFactor   75
 How many resources the player gets back if canceling building.
#define CancelTrainingCostsFactor   100
 How many resources the player gets back if canceling training.
#define CancelResearchCostsFactor   100
 How many resources the player gets back if canceling research.
#define CancelUpgradeCostsFactor   100
 How many resources the player gets back if canceling upgrade.
const char NameLine []
 Text string: Name, Version, Copyright.
std::string StratagusLibPath
std::string GameName
 Location of stratagus data.
std::string FullGameName
 Name of the game.
std::string ClickMissile
 Full Name of the game.
std::string DamageMissile
 Missile to show when you click.
std::string MenuRace
 Missile to show damage caused.
int SpeedBuild
 speed factor for returning resources
int SpeedTrain
 Speed factor for building.
int SpeedUpgrade
 Speed factor for training.
int SpeedResearch
 Speed factor for upgrading.
bool UseHPForXp
 Speed factor for researching.
unsigned long GameCycle
 true if gain XP by dealing damage, false if by killing.
unsigned long ResultGameCycle
 Game simulation cycle counter.
unsigned long FastForwardCycle
 Used in game result.
bool SaveGameLoading
 Delete save game.
const int CPU_NUM
 Editor callbacks.
char * new_strdup (const char *str)
void LoadGame (const std::string &filename)
 Game Replay Fast Forward Counter.
int SaveGame (const std::string &filename)
 Load saved game.
void DeleteSaveGame (const std::string &filename)
 Save game.
std::string SaveGlobal (lua_State *l, bool is_root)
void Exit (int err)
 For saving lua state.
void ExitFatal (int err)
 Exit.
void UpdateDisplay ()
 Exit with fatal error.
void InitModules ()
 Game display update.
void LoadModules ()
 Initialize all modules.
void CleanModules ()
 Load all modules.
void DrawMapArea ()
 Cleanup all modules.
void GameMainLoop ()
 Draw the map area.
void ShowLoadProgress (const char *fmt,...)
 Game main loop.
bool CanAccessFile (const char *filename)
 Counter for lua function.

Define Documentation

#define _ ( str   )     Translate(str)

#define _C_   ,

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

#define Assert ( cond   ) 

#define CancelBuildingCostsFactor   75

How many resources the player gets back if canceling building.

#define CancelResearchCostsFactor   100

How many resources the player gets back if canceling research.

#define CancelTrainingCostsFactor   100

How many resources the player gets back if canceling training.

#define CancelUpgradeCostsFactor   100

How many resources the player gets back if canceling upgrade.

#define CYCLES_PER_SECOND   30

Game cycles per second to simulate (original 30-40).

#define DebugPrint ( args   ) 

#define FRAMES_PER_SECOND   30

Frames per second to display (original 30-40).

#define N_ ( str   )     str

#define PlayerMax   16

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

Print function in debug macros.

#define RefsAssert ( cond   ) 

#define SCROLL_DOWN   (Video.Height - 16)

Scrolling area (>= VideoHeight - 16 y).

#define SCROLL_LEFT   15

Scrolling area (<= 15 y).

#define SCROLL_RIGHT   (Video.Width - 16)

Scrolling area (>= VideoWidth - 16 x).

#define SCROLL_UP   15

Scrolling area (<= 15 y).

#define UnitMax   65536

#define UnitTypeMax   2048

#define UpgradeMax   2048


Function Documentation

bool CanAccessFile ( const char *  filename  ) 

Counter for lua function.

void CleanModules (  ) 

Load all modules.

Cleanup modules.

Call each module to clean up.

void DeleteSaveGame ( const std::string &  filename  ) 

Save game.

Delete save game

Parameters:
filename Name of file to delete

void DrawMapArea (  ) 

Cleanup all modules.

Draw map area

void Exit ( int  err  ) 

For saving lua state.

Exit the game.

Parameters:
err Error code to pass to shell.

void ExitFatal ( int  err  ) 

Exit.

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

Parameters:
err Error code to pass to shell.

void GameMainLoop (  ) 

Draw the map area.

Game main loop.

Unit actions. Missile actions. Players (AI). Cyclic events (color cycle,...) Display update. Input/Network/Sound.

void InitModules (  ) 

Game display update.

Initialize all modules.

Call each module to initialize.

void LoadGame ( const std::string &  filename  ) 

Game Replay Fast Forward Counter.

Load a game to file.

Parameters:
filename File name to be loaded.

void LoadModules (  ) 

Initialize all modules.

Load all.

Call each module to load additional files (graphics,sounds).

char* new_strdup ( const char *  str  )  [inline]

int SaveGame ( const std::string &  filename  ) 

Load saved game.

Save a game to file.

Parameters:
filename File name to be stored.
Returns:
-1 if saving failed, 0 if all OK
Note:
Later we want to store in a more compact binary format.

std::string SaveGlobal ( lua_State *  l,
bool  is_root 
)

For saving lua state (table, number, string, bool, not function).

Parameters:
l lua_State to save.
is_root true for the main call, 0 for recursif call.
Returns:
"" if nothing could be saved. else a string that could be executed in lua to restore lua state
Todo:
do the output prettier (adjust indentation, newline)

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

Game main loop.

Show load progress

Game main loop.

Show load progress.

Parameters:
fmt printf format string.

void UpdateDisplay (  ) 

Exit with fatal error.

Display update.

This functions updates everything on screen. The map, the gui, the cursors.


Variable Documentation

std::string ClickMissile

Full Name of the game.

const int CPU_NUM

Editor callbacks.

std::string DamageMissile

Missile to show when you click.

unsigned long FastForwardCycle

Used in game result.

std::string FullGameName

Name of the game.

unsigned long GameCycle

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

std::string GameName

Location of stratagus data.

std::string MenuRace

Missile to show damage caused.

const char NameLine[]

Text string: Name, Version, Copyright.

Text string: Name, Version, Copyright.

Name, Version, Copyright

unsigned long ResultGameCycle

Game simulation cycle counter.

Delete save game.

speed factor for returning resources

Speed factor for upgrading.

Speed factor for building.

Speed factor for training.

std::string StratagusLibPath

bool UseHPForXp

Speed factor for researching.

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