$treeview $search $mathjax
Stratagus  2.2.6
$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/unit/depend.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "stratagus.h"
#include "upgrade_structs.h"
#include "upgrade.h"
#include "depend.h"
#include "player.h"
#include "script.h"
#include "unittype.h"

depend.cpp - The units/upgrade dependencies

static DependRuleDependHash [101]
 All dependencies hash.
static void AddDependency (const std::string &target, const std::string required, int count, int or_flag)
static bool CheckDependByRule (const CPlayer &player, DependRule &rule)
bool CheckDependByIdent (const CPlayer &player, const std::string &target)
 Check a dependency by identifier.
bool CheckDependByType (const CPlayer &player, const CUnitType &type)
 Check a dependency by unit type.
void InitDependencies ()
 Init the dependencies.
void CleanDependencies ()
 Cleanup dependencies module.
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.

Function Documentation

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:
target Target of the dependency.
required Requirement of the dependency.
count Amount of the required needed.
or_flag Start of or rule.

static int CclCheckDependency ( lua_State *  l  )  [static]

Check the dependency.

Todo:
not written.
Parameters:
l Lua state.

static int CclDefineDependency ( lua_State *  l  )  [static]

Define a new dependency.

Parameters:
l Lua state.

static int CclGetDependency ( lua_State *  l  )  [static]

Get the dependency.

Todo:
not written.
Parameters:
l Lua state.

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

Check a dependency by identifier.

Check if this upgrade or unit is available.

Parameters:
player For this player available.
target Unit or Upgrade.
Returns:
True if available, false otherwise.

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

Check if this upgrade or unit is available.

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

bool CheckDependByType ( const CPlayer player,
const CUnitType type 
)

Check a dependency by unit type.

Check if this upgrade or unit is available.

Parameters:
player For this player available.
target Unit or Upgrade.
Returns:
True if available, false otherwise.

void CleanDependencies (  ) 

Cleanup dependencies module.

Clean up unit and upgrade dependencies.

void DependenciesCclRegister (  ) 

Register CCL features for dependencies.

Register CCL features for dependencies.

void InitDependencies (  ) 

Init the dependencies.

Initialize unit and upgrade dependencies.


Variable Documentation

DependRule* DependHash[101] [static]

All dependencies hash.

(C) Copyright 1998-2011 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.