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

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
stratagus.h File Reference
#include <string.h>
#include "util.h"

Go to the source code of this file.

stratagus.h - The main header file.

#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)
 
#define PlayerMax   16
 
#define UnitTypeMax   2048
 
#define UpgradeMax   2048
 
#define MAX_RACES   8
 
#define FRAMES_PER_SECOND   30
 Frames per second to display (original 30-40) More...
 
#define CYCLES_PER_SECOND   30
 Game cycles per second to simulate (original 30-40) More...
 
bool EnableDebugPrint
 
bool EnableAssert
 if enabled, print the debug messages More...
 
bool EnableUnitDebug
 if enabled, halt on assertion failures 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)
 if enabled, a unit info dump will be created More...
 
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

#define _C_   ,

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

#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.

#define CYCLES_PER_SECOND   30

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

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

Print debug information with function name.

#define FRAMES_PER_SECOND   30

Frames per second to display (original 30-40)

#define MAX_RACES   8
#define PlayerMax   16
#define PRINTF_VAARG_ATTRIBUTE (   a,
 
)
#define PrintFunction ( )    PrintLocation(__FILE__, __LINE__, __func__);

Print function in debug macros.

#define UnitTypeMax   2048
#define UNUSED (   var)    (var)
#define UpgradeMax   2048

Function Documentation

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

Game display update.

Draw map area

void Exit ( int  err)

Game Replay Fast Forward Counter.

Exit the game.

Parameters
errError code to pass to shell.
void ExitFatal ( int  err)

Exit.

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

Parameters
errError 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.

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

if enabled, a unit info dump will be created

void PrintOnStdOut ( const char *  format,
  ... 
)
int stratagusMain ( int  argc,
char **  argv 
)

Game main loop.

The main program: initialise, parse options and arguments.

Parameters
argcNumber of arguments.
argvVector of arguments.
void UpdateDisplay ( )

Exit with fatal error.

Display update.

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

Variable Documentation

bool EnableAssert

if enabled, print the debug messages

bool EnableDebugPrint
Todo:

Needs code cleanup.

Needs compatibility checks.

Needs error message unification.

bool EnableUnitDebug

if enabled, halt on assertion failures

unsigned long FastForwardCycle

Game simulation cycle counter.

unsigned long GameCycle
std::string MenuRace

Location of stratagus data.

Location of stratagus data.

const char NameLine[]

Text string: Name, Version, Copyright.

Text string: Name, Version, Copyright.

Name, Version, Copyright

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.