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

depend.cpp File Reference
#include "stratagus.h"
#include "depend.h"
#include "interface.h"
#include "player.h"
#include "script.h"
#include "translate.h"
#include "trigger.h"
#include "unit.h"
#include "unittype.h"
#include "upgrade_structs.h"
#include "upgrade.h"

depend.cpp - The units/upgrade dependencies

static DependRuleDependHash [101]
 All dependencies hash. More...
 
static void AddDependency (const std::string &target, const std::string &required, int count, int or_flag)
 
static bool CheckDependByRule (const CPlayer &player, DependRule &rule)
 
std::string PrintDependencies (const CPlayer &player, const ButtonAction &button)
 Print all unit dependencies into string. More...
 
bool CheckDependByIdent (const CPlayer &player, const std::string &target)
 Check a dependency by identifier. More...
 
bool CheckDependByType (const CPlayer &player, const CUnitType &type)
 Check a dependency by unit type. More...
 
void InitDependencies ()
 Init the dependencies. More...
 
void CleanDependencies ()
 Cleanup dependencies module. More...
 
static int CclDefineDependency (lua_State *l)
 
static int CclGetDependency (lua_State *l)
 
static int CclCheckDependency (lua_State *l)
 
void DependenciesCclRegister ()
 Register CCL features for dependencies. More...
 

Function Documentation

◆ AddDependency()

static void AddDependency ( const std::string &  target,
const std::string &  required,
int  count,
int  or_flag 
)
static

Add a new dependency. If already exits append to and rule.

Parameters
targetTarget of the dependency.
requiredRequirement of the dependency.
countAmount of the required needed.
or_flagStart of or rule.

◆ CclCheckDependency()

static int CclCheckDependency ( lua_State *  l)
static

Checks if dependencies are met.

Returns
true if the dependencies are met.
Parameters
lLua state. Argument 1: player Argument 2: object which we want to check the dependencies of

◆ CclDefineDependency()

static int CclDefineDependency ( lua_State *  l)
static

Define a new dependency.

Parameters
lLua state.

◆ CclGetDependency()

static int CclGetDependency ( lua_State *  l)
static

Get the dependency.

Todo:
not written.
Parameters
lLua state.

◆ CheckDependByIdent()

bool CheckDependByIdent ( const CPlayer player,
const std::string &  target 
)

Check a dependency by identifier.

Check if this upgrade or unit is available.

Parameters
playerFor this player available.
targetUnit or Upgrade.
Returns
True if available, false otherwise.

◆ CheckDependByRule()

static bool CheckDependByRule ( const CPlayer player,
DependRule rule 
)
static

Check if this upgrade or unit is available.

Parameters
playerFor this player available.
rule.
Returns
True if available, false otherwise.

◆ CheckDependByType()

bool CheckDependByType ( const CPlayer player,
const CUnitType type 
)

Check a dependency by unit type.

Check if this upgrade or unit is available.

Parameters
playerFor this player available.
targetUnit or Upgrade.
Returns
True if available, false otherwise.

◆ CleanDependencies()

void CleanDependencies ( )

Cleanup dependencies module.

Clean up unit and upgrade dependencies.

◆ DependenciesCclRegister()

void DependenciesCclRegister ( )

Register CCL features for dependencies.

Register CCL features for dependencies.

◆ InitDependencies()

void InitDependencies ( )

Init the dependencies.

Initialize unit and upgrade dependencies.

◆ PrintDependencies()

std::string PrintDependencies ( const CPlayer player,
const ButtonAction button 
)

Print all unit dependencies into string.

Check if this upgrade or unit is available.

Parameters
playerFor this player available.
targetUnit or Upgrade.
Returns
True if available, false otherwise.

Variable Documentation

◆ DependHash

DependRule* DependHash[101]
static

All dependencies hash.

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