$treeview $search $mathjax
Stratagus
2.2.7
$projectbrief
|
$projectbrief
|
$searchbox |
_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include <signal.h>
#include "stratagus.h"
#include "script.h"
#include "font.h"
#include "game.h"
#include "iocompat.h"
#include "iolib.h"
#include "map.h"
#include "trigger.h"
#include "ui.h"
#include "unit.h"
Classes | |
struct | UStrInt |
script.cpp - The configuration language. | |
enum | UStrIntType { USTRINT_STR, USTRINT_INT, USTRINT_STR, USTRINT_INT } |
Counter for lua function. More... | |
lua_State * | Lua |
int | CclInConfigFile |
Structure to work with lua files. | |
NumberDesc * | Damage |
True while config file parsing. | |
static int | NumberCounter = 0 |
Damage calculation for missile. | |
static int | StringCounter = 0 |
Counter for lua function. | |
UStrInt | GetComponent (const CUnit &unit, int index, EnumVariable e, int t) |
Get component for unit variable. | |
UStrInt | GetComponent (const CUnitType &type, int index, EnumVariable e) |
Get component for unit type variable. | |
static void | lstop (lua_State *l, lua_Debug *ar) |
static void | laction (int i) |
static int | report (int status, bool exitOnError) |
static int | luatraceback (lua_State *L) |
int | LuaCall (int narg, int clear, bool exitOnError) |
static void | LuaLoadBuffer (const std::string &file, std::string &buffer) |
int | LuaLoadFile (const std::string &file) |
static int | CclSavePreferences (lua_State *l) |
static int | CclLoad (lua_State *l) |
static int | CclLoadBuffer (lua_State *l) |
const char * | LuaToString (lua_State *l, int narg) |
True while config file parsing. | |
int | LuaToNumber (lua_State *l, int narg) |
bool | LuaToBoolean (lua_State *l, int narg) |
void | CclGarbageCollect (int) |
static void | ParseBinOp (lua_State *l, BinOp *binop) |
static CUnit ** | Str2UnitRef (lua_State *l, const char *s) |
static CUnitType ** | Str2TypeRef (lua_State *l, const char *s) |
UnitDesc * | CclParseUnitDesc (lua_State *l) |
Parse a number description. | |
CUnitType ** | CclParseTypeDesc (lua_State *l) |
Parse a unit description. | |
static int | ParseLuaFunction (lua_State *l, const char *tablename, int *counter) |
static int | CallLuaNumberFunction (unsigned int handler) |
static std::string | CallLuaStringFunction (unsigned int handler) |
NumberDesc * | CclParseNumberDesc (lua_State *l) |
StringDesc * | CclParseStringDesc (lua_State *l) |
Parse a unit type description. | |
CUnit * | EvalUnit (const UnitDesc *unitdesc) |
Evaluate the number. | |
int | EvalNumber (const NumberDesc *number) |
Parse a string description. | |
std::string | EvalString (const StringDesc *s) |
Evaluate the unit. | |
void | FreeUnitDesc (UnitDesc *) |
Free number description content. (no pointer itself). | |
void | FreeNumberDesc (NumberDesc *number) |
Evaluate the string. | |
void | FreeStringDesc (StringDesc *s) |
Free unit description content. (no pointer itself). | |
static int | AliasTypeVar (lua_State *l, const char *s) |
static int | AliasUnitVar (lua_State *l, const char *s) |
static int | CclUnitAttackerVar (lua_State *l) |
static int | CclUnitDefenderVar (lua_State *l) |
static int | CclActiveUnitVar (lua_State *l) |
static int | CclActiveTypeVar (lua_State *l) |
static int | Alias (lua_State *l, const char *s) |
static int | CclAdd (lua_State *l) |
static int | CclSub (lua_State *l) |
static int | CclMul (lua_State *l) |
static int | CclDiv (lua_State *l) |
static int | CclMin (lua_State *l) |
static int | CclMax (lua_State *l) |
static int | CclRand (lua_State *l) |
static int | CclGreaterThan (lua_State *l) |
static int | CclGreaterThanOrEq (lua_State *l) |
static int | CclLessThan (lua_State *l) |
static int | CclLessThanOrEq (lua_State *l) |
static int | CclEqual (lua_State *l) |
static int | CclNotEqual (lua_State *l) |
static int | CclConcat (lua_State *l) |
static int | CclString (lua_State *l) |
static int | CclInverseVideo (lua_State *l) |
static int | CclUnitName (lua_State *l) |
static int | CclIf (lua_State *l) |
static int | CclSubString (lua_State *l) |
static int | CclLine (lua_State *l) |
static int | CclGameInfo (lua_State *l) |
static int | CclVideoTextLength (lua_State *l) |
static int | CclStringFind (lua_State *l) |
static void | AliasRegister () |
static int | CclStratagusLibraryPath (lua_State *l) |
static int | CclFilteredListDirectory (lua_State *l, int type, int mask) |
static int | CclListDirectory (lua_State *l) |
static int | CclListFilesInDirectory (lua_State *l) |
static int | CclListDirsInDirectory (lua_State *l) |
static int | CclSetDamageFormula (lua_State *l) |
static int | CclDebugPrint (lua_State *l) |
int | CclCommand (const std::string &command, bool exitOnError) |
Save user preferences. | |
int | tolua_stratagus_open (lua_State *tolua_S) |
void | InitLua () |
Perform garbage collection. | |
static std::string | ConcatTableString (const std::vector< std::string > &blockTableNames) |
static bool | IsAValidTableName (const std::string &key) |
static bool | ShouldGlobalTableBeSaved (const std::string &key) |
static bool | ShouldLocalTableBeSaved (const std::string &key) |
static bool | LuaValueToString (lua_State *l, std::string &value) |
static std::string | SaveGlobal (lua_State *l, bool is_root, std::vector< std::string > &blockTableNames) |
std::string | SaveGlobal (lua_State *l) |
void | SavePreferences () |
Load ccl config file. | |
void | LoadCcl (const std::string &filename) |
Initialise Lua. | |
void | ScriptRegister () |
enum UStrIntType |
static int Alias | ( | lua_State * | l, | |
const char * | s | |||
) | [static] |
Make alias for some function.
l | lua State. | |
s | FIXME: docu |
static void AliasRegister | ( | ) | [static] |
static int AliasTypeVar | ( | lua_State * | l, | |
const char * | s | |||
) | [static] |
Make alias for some unit type Variable function.
l | lua State. | |
s | FIXME: docu |
static int AliasUnitVar | ( | lua_State * | l, | |
const char * | s | |||
) | [static] |
Make alias for some unit Variable function.
l | lua State. | |
s | FIXME: docu |
static int CallLuaNumberFunction | ( | unsigned int | handler | ) | [static] |
Call a Lua handler
handler | handler of the lua function to call. |
static std::string CallLuaStringFunction | ( | unsigned int | handler | ) | [static] |
Call a Lua handler
handler | handler of the lua function to call. |
static int CclActiveTypeVar | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for . {"Type", {Type = "Active", Variable = arg1, Component = "Value" or arg2}}
l | Lua state. |
static int CclActiveUnitVar | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for . {"Unit", {Unit = "Active", Variable = arg1, Component = "Value" or arg2}}
l | Lua state. |
static int CclAdd | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for add. {"Add", {arg1, arg2}}
l | Lua state. |
int CclCommand | ( | const std::string & | command, | |
bool | exitOnError | |||
) |
Save user preferences.
Send command to ccl.
command | Zero terminated command string. |
static int CclConcat | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for Concat. {"Concat", {arg1}}
l | Lua state. |
static int CclDebugPrint | ( | lua_State * | l | ) | [static] |
Print debug message with info about current script name, line number and function.
l | Lua state. |
static int CclDiv | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for add. {"Div", {arg1, arg2}}
l | Lua state. |
static int CclEqual | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for Equal. {"Equal", {arg1, arg2}}
l | Lua state. |
static int CclFilteredListDirectory | ( | lua_State * | l, | |
int | type, | |||
int | mask | |||
) | [static] |
Return a table with the filtered items found in the subdirectory.
static int CclGameInfo | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for Line. {"Line", "arg1"}
l | Lua state. |
void CclGarbageCollect | ( | int | ) |
Perform CCL garbage collection
fast | set this flag to disable slow GC (during game) |
static int CclGreaterThan | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for GreaterThan. {"GreaterThan", {arg1, arg2}}
l | Lua state. |
static int CclGreaterThanOrEq | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for GreaterThanOrEq. {"GreaterThanOrEq", {arg1, arg2}}
l | Lua state. |
static int CclIf | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for If. {"If", {arg1}}
l | Lua state. |
static int CclInverseVideo | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for InverseVideo. {"InverseVideo", {arg1}}
l | Lua state. |
static int CclLessThan | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for LessThan. {"LessThan", {arg1, arg2}}
l | Lua state. |
static int CclLessThanOrEq | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for LessThanOrEq. {"LessThanOrEq", {arg1, arg2}}
l | Lua state. |
static int CclLine | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for Line. {"Line", {arg1, arg2[, arg3]}}
l | Lua state. |
static int CclListDirectory | ( | lua_State * | l | ) | [static] |
Return a table with the files or directories found in the subdirectory.
static int CclListDirsInDirectory | ( | lua_State * | l | ) | [static] |
Return a table with the files found in the subdirectory.
static int CclListFilesInDirectory | ( | lua_State * | l | ) | [static] |
Return a table with the files found in the subdirectory.
static int CclLoad | ( | lua_State * | l | ) | [static] |
Load a file and execute it.
l | Lua state. |
static int CclLoadBuffer | ( | lua_State * | l | ) | [static] |
Load a file into a buffer and return it.
l | Lua state. |
static int CclMax | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for add. {"Max", {arg1, arg2, argn}}
l | Lua state. |
static int CclMin | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for add. {"Min", {arg1, arg2}}
l | Lua state. |
static int CclMul | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for add. {"Mul", {arg1, arg2}}
l | Lua state. |
static int CclNotEqual | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for NotEqual. {"NotEqual", {arg1, arg2}}
l | Lua state. |
NumberDesc* CclParseNumberDesc | ( | lua_State * | l | ) |
Return number.
l | lua state. |
StringDesc* CclParseStringDesc | ( | lua_State * | l | ) |
Parse a unit type description.
Return String description.
l | lua state. |
CUnitType** CclParseTypeDesc | ( | lua_State * | l | ) |
Parse a unit description.
Return unit type referernce definition.
l | lua state. |
UnitDesc* CclParseUnitDesc | ( | lua_State * | l | ) |
Parse a number description.
Return unit referernce definition.
l | lua state. |
static int CclRand | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for add. {"Rand", {arg1}}
l | Lua state. |
static int CclSavePreferences | ( | lua_State * | l | ) | [static] |
Save preferences
l | Lua state. |
static int CclSetDamageFormula | ( | lua_State * | l | ) | [static] |
Set damage computation method.
l | Lua state. |
static int CclStratagusLibraryPath | ( | lua_State * | l | ) | [static] |
Return the stratagus library path.
l | Lua state. |
static int CclString | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for String. {"String", {arg1}}
l | Lua state. |
static int CclStringFind | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for StringFind. {"StringFind", {arg1, arg2}}
l | Lua state. |
static int CclSub | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for add. {"Div", {arg1, arg2}}
l | Lua state. |
static int CclSubString | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for SubString. {"SubString", {arg1, arg2, arg3}}
l | Lua state. |
static int CclUnitAttackerVar | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for . {"Unit", {Unit = "Attacker", Variable = arg1, Component = "Value" or arg2}}
l | Lua state. |
static int CclUnitDefenderVar | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for . {"Unit", {Unit = "Defender", Variable = arg1, Component = "Value" or arg2}}
l | Lua state. |
static int CclUnitName | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for UnitName. {"UnitName", {arg1}}
l | Lua state. |
static int CclVideoTextLength | ( | lua_State * | l | ) | [static] |
Return equivalent lua table for VideoTextLength. {"VideoTextLength", {Text = arg1, Font = arg2}}
l | Lua state. |
static std::string ConcatTableString | ( | const std::vector< std::string > & | blockTableNames | ) | [static] |
int EvalNumber | ( | const NumberDesc * | number | ) |
Parse a string description.
compute the number expression
number | struct with definition of the calculation. |
std::string EvalString | ( | const StringDesc * | s | ) |
Evaluate the unit.
compute the string expression
s | struct with definition of the calculation. |
Evaluate the number.
compute the Unit expression
unitdesc | struct with definition of the calculation. |
void FreeNumberDesc | ( | NumberDesc * | number | ) |
Evaluate the string.
Free the number expression content. (not the pointer itself).
number | struct to free |
void FreeStringDesc | ( | StringDesc * | s | ) |
Free unit description content. (no pointer itself).
Free the String expression content. (not the pointer itself).
s | struct to free |
void FreeUnitDesc | ( | UnitDesc * | ) |
Free number description content. (no pointer itself).
Free the unit expression content. (not the pointer itself).
unitdesc | struct to free |
UStrInt GetComponent | ( | const CUnitType & | type, | |
int | index, | |||
EnumVariable | e | |||
) |
Get component for unit type variable.
UStrInt GetComponent | ( | const CUnit & | unit, | |
int | index, | |||
EnumVariable | e, | |||
int | t | |||
) |
Get component for unit variable.
Return the value corresponding.
unit | Unit. | |
index | Index of the variable. | |
e | Component of the variable. | |
t | Which var use (0:unit, 1:Type, 2:Stats) |
void InitLua | ( | ) |
Perform garbage collection.
Initialize Lua
static bool IsAValidTableName | ( | const std::string & | key | ) | [static] |
static void laction | ( | int | i | ) | [static] |
FIXME: docu
void LoadCcl | ( | const std::string & | filename | ) |
Initialise Lua.
Load stratagus config file.
static void lstop | ( | lua_State * | l, | |
lua_Debug * | ar | |||
) | [static] |
FIXME: docu
int LuaCall | ( | int | narg, | |
int | clear, | |||
bool | exitOnError | |||
) |
Call a lua function
narg | Number of arguments | |
clear | Clear the return value(s) | |
exitOnError | Exit the program when an error occurs |
static void LuaLoadBuffer | ( | const std::string & | file, | |
std::string & | buffer | |||
) | [static] |
Load a file into a buffer
int LuaLoadFile | ( | const std::string & | file | ) |
Load a file and execute it
file | File to load and execute |
bool LuaToBoolean | ( | lua_State * | l, | |
int | narg | |||
) |
Convert lua boolean to bool. It also checks type and exits in case of error.
l | Lua state. | |
narg | Argument number. |
int LuaToNumber | ( | lua_State * | l, | |
int | narg | |||
) |
Convert lua number in C number. It checks also type and exit in case of error.
l | Lua state. | |
narg | Argument number. |
const char* LuaToString | ( | lua_State * | l, | |
int | narg | |||
) |
True while config file parsing.
Convert lua string in char*. It checks also type and exit in case of error.
l | Lua state. | |
narg | Argument number. |
static int luatraceback | ( | lua_State * | L | ) | [static] |
static bool LuaValueToString | ( | lua_State * | l, | |
std::string & | value | |||
) | [static] |
static void ParseBinOp | ( | lua_State * | l, | |
BinOp * | binop | |||
) | [static] |
Parse binary operation with number.
l | lua state. | |
binop | Where to stock info (must be malloced) |
static int ParseLuaFunction | ( | lua_State * | l, | |
const char * | tablename, | |||
int * | counter | |||
) | [static] |
Add a Lua handler
l | lua state. | |
tablename | name of the lua table. | |
counter | Counter for the handler |
static int report | ( | int | status, | |
bool | exitOnError | |||
) | [static] |
Check error status, and print error message and exit if status is different of 0.
status | status of the last lua call. (0: success) | |
exitOnError | exit the program on error |
std::string SaveGlobal | ( | lua_State * | l | ) |
static std::string SaveGlobal | ( | lua_State * | l, | |
bool | is_root, | |||
std::vector< std::string > & | blockTableNames | |||
) | [static] |
For saving lua state (table, number, string, bool, not function).
l | lua_State to save. | |
is_root | true for the main call, 0 for recursif call. |
void SavePreferences | ( | ) |
Load ccl config file.
Save user preferences
void ScriptRegister | ( | ) |
static bool ShouldGlobalTableBeSaved | ( | const std::string & | key | ) | [static] |
static bool ShouldLocalTableBeSaved | ( | const std::string & | key | ) | [static] |
static CUnitType** Str2TypeRef | ( | lua_State * | l, | |
const char * | s | |||
) | [static] |
Convert the string to the corresponding data (which is a unit type).
l | lua state. | |
s | Ident. |
static CUnit** Str2UnitRef | ( | lua_State * | l, | |
const char * | s | |||
) | [static] |
Convert the string to the corresponding data (which is a unit).
l | lua state. | |
s | Ident. |
TOLUA_API int tolua_stratagus_open | ( | lua_State * | tolua_S | ) |
int CclInConfigFile |
Structure to work with lua files.
True while config file parsing.
Burning building frames.
lua_State* Lua |
int NumberCounter = 0 [static] |
Damage calculation for missile.
int StringCounter = 0 [static] |
Counter for lua function.