$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

src/game/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.

CTimer GameTimer
static int Trigger
 The game timer.
static bool * ActiveTriggers
TriggerDataType TriggerData
 Some data accessible for script during the game.
typedef int(* CompareFunction )(int, int)
int TriggerGetPlayer (lua_State *l)
const CUnitTypeTriggerGetUnitType (lua_State *l)
 get player number.
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.
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
void TriggerCclRegister ()
 test triggers
void SaveTriggers (CFile &file)
 Register ccl features.
void InitTriggers ()
 Save the trigger module.
void CleanTriggers ()
 Setup triggers.

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:
op The 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:
file Open 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:
script Script to execute
Returns:
1 if the trigger should be removed

int TriggerGetPlayer ( lua_State *  l  ) 

Get player number.

Parameters:
l Lua state.
Returns:
The player number, -1 matches any.

const CUnitType* TriggerGetUnitType ( lua_State *  l  ) 

get player number.

Get the unit-type.

Parameters:
l Lua state.
Returns:
The unit-type pointer.

static void TriggerRemoveTrigger ( int  trig  )  [static]

Remove a trigger

Parameters:
trig Current trigger

void TriggersEachCycle (  ) 

get the unit-type

Check trigger each game cycle.


Variable Documentation

bool* ActiveTriggers [static]

int Trigger [static]

The game timer.

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.