_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          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
trigger.cpp File Reference
#include "stratagus.h"
#include "trigger.h"
#include "interface.h"
#include "iolib.h"
#include "map.h"
#include "player.h"
#include "results.h"
#include "script.h"
#include "unit.h"
#include "unit_find.h"
#include "unittype.h"

trigger.cpp - The trigger handling.

typedef int(* CompareFunction )(int, int)
 
CTimer GameTimer
 
static int Trigger
 The game timer. More...
 
static bool * ActiveTriggers
 
TriggerDataType TriggerData
 Some data accessible for script during the game. More...
 
int TriggerGetPlayer (lua_State *l)
 
const CUnitTypeTriggerGetUnitType (lua_State *l)
 get player number. More...
 
static int CompareEq (int a, int b)
 
static int CompareNEq (int a, int b)
 
static int CompareGrEq (int a, int b)
 
static int CompareGr (int a, int b)
 
static int CompareLeEq (int a, int b)
 
static int CompareLe (int a, int b)
 
static CompareFunction GetCompareFunction (const char *op)
 
static int CclGetNumUnitsAt (lua_State *l)
 
static int CclIfNearUnit (lua_State *l)
 
static int CclIfRescuedNearUnit (lua_State *l)
 
int GetNumOpponents (int player)
 
int GetTimer ()
 
void StopGame (GameResults result)
 Outcome of the game. More...
 
void ActionVictory ()
 
void ActionDefeat ()
 
void ActionDraw ()
 
void ActionSetTimer (int cycles, bool increasing)
 
void ActionStartTimer ()
 
void ActionStopTimer ()
 
static int CclAddTrigger (lua_State *l)
 
void SetTrigger (int trigger)
 
static int CclSetActiveTriggers (lua_State *l)
 
static int TriggerExecuteAction (int script)
 
static void TriggerRemoveTrigger (int trig)
 
void TriggersEachCycle ()
 get the unit-type More...
 
void TriggerCclRegister ()
 test triggers More...
 
void SaveTriggers (CFile &file)
 Register ccl features. More...
 
void InitTriggers ()
 Save the trigger module. More...
 
void CleanTriggers ()
 Setup triggers. More...
 

Typedef Documentation

typedef int(* CompareFunction)(int, int)

Function Documentation

void ActionDefeat ( )

Action condition player lose.

void ActionDraw ( )

Action condition player draw.

void ActionSetTimer ( int  cycles,
bool  increasing 
)

Action set timer

void ActionStartTimer ( )

Action start timer

void ActionStopTimer ( )

Action stop timer

void ActionVictory ( )

Action condition player wins.

static int CclAddTrigger ( lua_State *  l)
static

Add a trigger.

static int CclGetNumUnitsAt ( lua_State *  l)
static

Return the number of units of a given unit-type and player at a location.

static int CclIfNearUnit ( lua_State *  l)
static

Player has the quantity of unit-type near to unit-type.

static int CclIfRescuedNearUnit ( lua_State *  l)
static

Player has the quantity of rescued unit-type near to unit-type.

static int CclSetActiveTriggers ( lua_State *  l)
static

Set the active triggers

void CleanTriggers ( )

Setup triggers.

Clean up the trigger module.

static int CompareEq ( int  a,
int  b 
)
static
static int CompareGr ( int  a,
int  b 
)
static
static int CompareGrEq ( int  a,
int  b 
)
static
static int CompareLe ( int  a,
int  b 
)
static
static int CompareLeEq ( int  a,
int  b 
)
static
static int CompareNEq ( int  a,
int  b 
)
static
static CompareFunction GetCompareFunction ( const char *  op)
static

Returns a function pointer to the comparison function

Parameters
opThe operation
Returns
Function pointer to the compare function
int GetNumOpponents ( int  player)

Returns the number of opponents of a given player.

int GetTimer ( )

Check the timer value

void InitTriggers ( )

Save the trigger module.

Initialize the trigger module.

void SaveTriggers ( CFile file)

Register ccl features.

Save the trigger module.

Parameters
fileOpen file to print to
void SetTrigger ( int  trigger)

Set the trigger values

void StopGame ( GameResults  result)

Outcome of the game.

Stop the running game with a given result

void TriggerCclRegister ( )

test triggers

Register CCL features for triggers.

static int TriggerExecuteAction ( int  script)
static

Execute a trigger action

Parameters
scriptScript to execute
Returns
1 if the trigger should be removed
int TriggerGetPlayer ( lua_State *  l)

Get player number.

Parameters
lLua state.
Returns
The player number, -1 matches any.
const CUnitType* TriggerGetUnitType ( lua_State *  l)

get player number.

Get the unit-type.

Parameters
lLua state.
Returns
The unit-type pointer.
static void TriggerRemoveTrigger ( int  trig)
static

Remove a trigger

Parameters
trigCurrent trigger
void TriggersEachCycle ( )

get the unit-type

Check trigger each game cycle.

Variable Documentation

bool* ActiveTriggers
static
CTimer GameTimer
int Trigger
static

The game timer.

TriggerDataType TriggerData

Some data accessible for script during the game.

the game timer

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