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

stratagus.h File Reference
#include <string>
#include <vector>
#include "util.h"
#include "settings.h"

Go to the source code of this file.

stratagus.h - The main header file.

#define omp_get_thread_num()   0
 
#define omp_get_num_threads()   1
 
#define UNUSED(var)   (var)
 
#define PRINTF_VAARG_ATTRIBUTE(a, b)
 
#define _C_   ,
 
#define PrintFunction()   PrintLocation(__FILE__, __LINE__, __func__);
 Print function in debug macros. More...
 
#define Assert(cond)   do { if (EnableAssert && !(cond)) { AbortAt(__FILE__, __LINE__, __func__, #cond); }} while (0)
 
#define DebugPrint(args)   do { if (EnableDebugPrint) { PrintFunction(); PrintOnStdOut(args); } } while (0)
 
bool EnableDebugPrint
 
bool EnableAssert
 if enabled, print the debug messages More...
 
bool EnableUnitDebug
 if enabled, halt on assertion failures More...
 
bool IsRestart
 if enabled, a unit info dump will be created More...
 
bool IsDebugEnabled
 
bool EnableWallsInSinglePlayer
 Is debug enabled? Flag to pass into lua code. More...
 
std::vector< std::string > OriginalArgv
 if true, the game skips some things like title screens More...
 
const char NameLine []
 Text string: Name, Version, Copyright. More...
 
std::string StratagusLibPath
 
std::string MenuRace
 Location of stratagus data. More...
 
unsigned long GameCycle
 
unsigned long FastForwardCycle
 Game simulation cycle counter. More...
 
void PrintLocation (const char *file, int line, const char *funcName)
 
void AbortAt (const char *file, int line, const char *funcName, const char *conditionStr)
 
void PrintOnStdOut (const char *format,...)
 
char * new_strdup (const char *str)
 
void Exit (int err)
 Game Replay Fast Forward Counter. More...
 
void ExitFatal (int err)
 Exit. More...
 
void UpdateDisplay ()
 Exit with fatal error. More...
 
void DrawMapArea ()
 Game display update. More...
 
void GameMainLoop ()
 Draw the map area. More...
 
int stratagusMain (int argc, char **argv)
 Game main loop. More...
 

Macro Definition Documentation

◆ _C_

#define _C_   ,

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

◆ Assert

#define Assert (   cond)    do { if (EnableAssert && !(cond)) { AbortAt(__FILE__, __LINE__, __func__, #cond); }} while (0)

Assert a condition. If cond is not true abort with file,line.

◆ DebugPrint

#define DebugPrint (   args)    do { if (EnableDebugPrint) { PrintFunction(); PrintOnStdOut(args); } } while (0)

Print debug information with function name.

◆ omp_get_num_threads

#define omp_get_num_threads ( )    1

◆ omp_get_thread_num

#define omp_get_thread_num ( )    0

◆ PRINTF_VAARG_ATTRIBUTE

#define PRINTF_VAARG_ATTRIBUTE (   a,
 
)

◆ PrintFunction

#define PrintFunction ( )    PrintLocation(__FILE__, __LINE__, __func__);

Print function in debug macros.

◆ UNUSED

#define UNUSED (   var)    (var)

Function Documentation

◆ AbortAt()

void AbortAt ( const char *  file,
int  line,
const char *  funcName,
const char *  conditionStr 
)

◆ DrawMapArea()

void DrawMapArea ( )

Game display update.

Draw map area

◆ Exit()

void Exit ( int  err)

Game Replay Fast Forward Counter.

Exit the game.

Parameters
errError code to pass to shell.

◆ ExitFatal()

void ExitFatal ( int  err)

Exit.

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

Parameters
errError code to pass to shell.

◆ GameMainLoop()

void GameMainLoop ( )

Draw the map area.

Game main loop.

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

◆ new_strdup()

char* new_strdup ( const char *  str)
inline

◆ PrintLocation()

void PrintLocation ( const char *  file,
int  line,
const char *  funcName 
)

◆ PrintOnStdOut()

void PrintOnStdOut ( const char *  format,
  ... 
)

◆ stratagusMain()

int stratagusMain ( int  argc,
char **  argv 
)

Game main loop.

The main program: initialise, parse options and arguments.

Parameters
argcNumber of arguments.
argvVector of arguments.

◆ UpdateDisplay()

void UpdateDisplay ( )

Exit with fatal error.

Display update.

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

Variable Documentation

◆ EnableAssert

bool EnableAssert

if enabled, print the debug messages

◆ EnableDebugPrint

bool EnableDebugPrint

◆ EnableUnitDebug

bool EnableUnitDebug

if enabled, halt on assertion failures

◆ EnableWallsInSinglePlayer

bool EnableWallsInSinglePlayer

Is debug enabled? Flag to pass into lua code.

◆ FastForwardCycle

unsigned long FastForwardCycle

Game simulation cycle counter.

◆ GameCycle

unsigned long GameCycle

◆ IsDebugEnabled

bool IsDebugEnabled

◆ IsRestart

bool IsRestart

if enabled, a unit info dump will be created

◆ MenuRace

std::string MenuRace

Location of stratagus data.

Location of stratagus data.

◆ NameLine

const char NameLine[]

Text string: Name, Version, Copyright.

Text string: Name, Version, Copyright.

Name, Version, Copyright

◆ OriginalArgv

std::vector<std::string> OriginalArgv

if true, the game skips some things like title screens

◆ StratagusLibPath

std::string StratagusLibPath
(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.