$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/script_unittype.cpp File Reference

#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "stratagus.h"
#include "video.h"
#include "tileset.h"
#include "map.h"
#include "sound.h"
#include "unitsound.h"
#include "unittype.h"
#include "animation.h"
#include "icons.h"
#include "missile.h"
#include "script.h"
#include "construct.h"
#include "spells.h"
#include "font.h"
#include "unit.h"
#include "unit_manager.h"
#include "player.h"
#include "luacallback.h"

Classes

struct  LabelsStruct
 Variables for UnitType and unit. More...
struct  LabelsLaterStruct

script_unittype.cpp - The unit-type ccl functions.

CAnimationAnimationsArray [ANIMATIONS_MAXANIM]
int NumAnimations
std::map< std::string,
CAnimations * > 
AnimationMap
 Hash table of all the animations.
CUnitTypeVar UnitTypeVar
 Animation map.
static std::vector< LabelsStructLabels
static std::vector
< LabelsLaterStruct
LabelsLater
static const char COWARD_KEY [] = "Coward"
static const char BUILDING_KEY [] = "Building"
static const char FLIP_KEY [] = "Flip"
static const char REVEALER_KEY [] = "Revealer"
static const char LANDUNIT_KEY [] = "LandUnit"
static const char AIRUNIT_KEY [] = "AirUnit"
static const char SEAUNIT_KEY [] = "SeaUnit"
static const char EXPLODEWHENKILLED_KEY [] = "ExplodeWhenKilled"
static const char VISIBLEUNDERFOG_KEY [] = "VisibleUnderFog"
static const char PERMANENTCLOACK_KEY [] = "PermanentCloack"
static const char DETECTCLOAK_KEY [] = "DetectCloak"
static const char ATTACKFROMTRANSPORTER_KEY [] = "AttackFromTransporter"
static const char VANISHES_KEY [] = "Vanishes"
static const char GROUNDATTACK_KEY [] = "GroundAttack"
static const char SHOREBUILDING_KEY [] = "ShoreBuilding"
static const char CANATTACK_KEY [] = "CanAttack"
static const char BUILDEROUTSIDE_KEY [] = "BuilderOutside"
static const char BUILDERLOST_KEY [] = "BuilderLost"
static const char CANHARVEST_KEY [] = "CanHarvest"
static const char HARVESTER_KEY [] = "Harvester"
static const char SELECTABLEBYRECTANGLE_KEY [] = "SelectableByRectangle"
static const char ISNOTSELECTABLE_KEY [] = "IsNotSelectable"
static const char DECORATION_KEY [] = "Decoration"
static const char INDESTRUCTIBLE_KEY [] = "Indestructible"
static const char TELEPORTER_KEY [] = "Teleporter"
static const char SHIELDPIERCE_KEY [] = "ShieldPiercing"
static const char SAVECARGO_KEY [] = "LoseCargo"
static const char HITPOINTS_KEY [] = "HitPoints"
static const char BUILD_KEY [] = "Build"
static const char MANA_KEY [] = "Mana"
static const char TRANSPORT_KEY [] = "Transport"
static const char RESEARCH_KEY [] = "Research"
static const char TRAINING_KEY [] = "Training"
static const char UPGRADETO_KEY [] = "UpgradeTo"
static const char GIVERESOURCE_KEY [] = "GiveResource"
static const char CARRYRESOURCE_KEY [] = "CarryResource"
static const char XP_KEY [] = "Xp"
static const char KILL_KEY [] = "Kill"
static const char SUPPLY_KEY [] = "Supply"
static const char DEMAND_KEY [] = "Demand"
static const char ARMOR_KEY [] = "Armor"
static const char SIGHTRANGE_KEY [] = "SightRange"
static const char ATTACKRANGE_KEY [] = "AttackRange"
static const char PIERCINGDAMAGE_KEY [] = "PiercingDamage"
static const char BASICDAMAGE_KEY [] = "BasicDamage"
static const char POSX_KEY [] = "PosX"
static const char POSY_KEY [] = "PosY"
static const char RADARRANGE_KEY [] = "RadarRange"
static const char RADARJAMMERRANGE_KEY [] = "RadarJammerRange"
static const char AUTOREPAIRRANGE_KEY [] = "AutoRepairRange"
static const char BLOODLUST_KEY [] = "Bloodlust"
static const char HASTE_KEY [] = "Haste"
static const char SLOW_KEY [] = "Slow"
static const char INVISIBLE_KEY [] = "Invisible"
static const char UNHOLYARMOR_KEY [] = "UnholyArmor"
static const char SLOT_KEY [] = "Slot"
static const char SHIELD_KEY [] = "ShieldPoints"
static const char POINTS_KEY [] = "Points"
static const char MAXHARVESTERS_KEY [] = "MaxHarvesters"
int GetSpriteIndex (const char *SpriteName)
CAnimationsAnimationsByIdent (const std::string &ident)
 Get the animations structure by ident.
void FreeAnimations ()
unsigned CclGetResourceByName (lua_State *l)
 Get resource by name.
static int ResourceIndex (lua_State *l, const char *resource)
int ExtraDeathIndex (const char *death)
static void ParseBuildingRules (lua_State *l, std::vector< CBuildRestriction * > &blist)
static int CclDefineUnitType (lua_State *l)
static int CclDefineUnitStats (lua_State *l)
CUnitTypeCclGetUnitType (lua_State *l)
static int CclUnitType (lua_State *l)
static int CclUnitTypeArray (lua_State *l)
static int CclGetUnitTypeIdent (lua_State *l)
static int CclGetUnitTypeName (lua_State *l)
static int CclSetUnitTypeName (lua_State *l)
static void AddLabel (lua_State *, CAnimation *anim, const std::string &name)
static CAnimationFindLabel (lua_State *l, const std::string &name)
static void FindLabelLater (lua_State *, CAnimation **anim, const std::string &name)
static void FixLabels (lua_State *l)
static void ParseAnimationFrame (lua_State *l, const char *str, CAnimation *anim)
static CAnimationParseAnimation (lua_State *l, int idx)
static void AddAnimationToArray (CAnimation *anim)
static int CclDefineAnimations (lua_State *l)
void DefineVariableField (lua_State *l, CVariable *var, int lua_index)
 Cleanup unit-type module.
static int CclDefineVariables (lua_State *l)
static int CclDefineBoolFlags (lua_State *l)
static int CclDefineDecorations (lua_State *l)
void UpdateUnitVariables (const CUnit &unit)
 Update custom Variables with other variable (like Hp, ...).
void UnitTypeCclRegister ()
 Access unit-type object.

Function Documentation

static void AddAnimationToArray ( CAnimation anim  )  [static]

Add animation to AnimationsArray

static void AddLabel ( lua_State *  ,
CAnimation anim,
const std::string &  name 
) [static]

Add a label

CAnimations* AnimationsByIdent ( const std::string &  ident  ) 

Get the animations structure by ident.

Get the animations structure by ident.

Parameters:
ident Identifier for the animation.
Returns:
Pointer to the animation structure.

static int CclDefineAnimations ( lua_State *  l  )  [static]

Define a unit-type animation set.

Parameters:
l Lua state.

static int CclDefineBoolFlags ( lua_State *  l  )  [static]

Define boolean flag.

Parameters:
l Lua state.

static int CclDefineDecorations ( lua_State *  l  )  [static]

Define Decorations for user variables

Parameters:
l Lua state.
Todo:
modify Assert with luastate with User Error.
Todo:
continue to add configuration.

static int CclDefineUnitStats ( lua_State *  l  )  [static]

Parse unit-stats.

Parameters:
l Lua state.

static int CclDefineUnitType ( lua_State *  l  )  [static]

Parse unit-type.

Parameters:
l Lua state.

static int CclDefineVariables ( lua_State *  l  )  [static]

Define user variables.

Parameters:
l Lua state.

unsigned CclGetResourceByName ( lua_State *  l  ) 

Get resource by name.

Get the resource ID from a SCM object.

Parameters:
l Lua state.
Returns:
the resource id

CUnitType* CclGetUnitType ( lua_State *  l  ) 

Access unit-type object

Parameters:
l Lua state.

static int CclGetUnitTypeIdent ( lua_State *  l  )  [static]

Get the ident of the unit-type structure.

Parameters:
l Lua state.
Returns:
The identifier of the unit-type.

static int CclGetUnitTypeName ( lua_State *  l  )  [static]

Get the name of the unit-type structure.

Parameters:
l Lua state.
Returns:
The name of the unit-type.

static int CclSetUnitTypeName ( lua_State *  l  )  [static]

Set the name of the unit-type structure.

Parameters:
l Lua state.
Returns:
The name of the unit-type.

static int CclUnitType ( lua_State *  l  )  [static]

Get unit-type structure.

Parameters:
l Lua state.
Returns:
Unit-type structure.

static int CclUnitTypeArray ( lua_State *  l  )  [static]

Get all unit-type structures.

Parameters:
l Lua state.
Returns:
An array of all unit-type structures.

void DefineVariableField ( lua_State *  l,
CVariable var,
int  lua_index 
)

Cleanup unit-type module.

Define the field of the UserDefined variables.

Parameters:
l Lua state.
var Variable to set.
lua_index Index of the table where are the infos

int ExtraDeathIndex ( const char *  death  ) 

Find the index of a extra death type

static CAnimation* FindLabel ( lua_State *  l,
const std::string &  name 
) [static]

Find a label

static void FindLabelLater ( lua_State *  ,
CAnimation **  anim,
const std::string &  name 
) [static]

Find a label later

static void FixLabels ( lua_State *  l  )  [static]

Fix labels

void FreeAnimations (  ) 

int GetSpriteIndex ( const char *  SpriteName  ) 

Return the index of the sprite named SpriteName.

Parameters:
SpriteName Name of the sprite.
Returns:
Index of the sprite. -1 if not found.

static CAnimation* ParseAnimation ( lua_State *  l,
int  idx 
) [static]

Parse an animation

static void ParseAnimationFrame ( lua_State *  l,
const char *  str,
CAnimation anim 
) [static]

Parse an animation frame

static void ParseBuildingRules ( lua_State *  l,
std::vector< CBuildRestriction * > &  blist 
) [static]

Parse BuildingRules

Parameters:
l Lua state.
blist BuildingRestriction to fill in

static int ResourceIndex ( lua_State *  l,
const char *  resource 
) [static]

Find the index of a resource

void UnitTypeCclRegister (  ) 

Access unit-type object.

Register CCL features for unit-type.

void UpdateUnitVariables ( const CUnit unit  ) 

Update custom Variables with other variable (like Hp, ...).

Update unit variables which are not user defined.


Variable Documentation

const char AIRUNIT_KEY[] = "AirUnit" [static]

std::map<std::string, CAnimations *> AnimationMap

Hash table of all the animations.

CAnimation* AnimationsArray[ANIMATIONS_MAXANIM]

const char ARMOR_KEY[] = "Armor" [static]

const char ATTACKFROMTRANSPORTER_KEY[] = "AttackFromTransporter" [static]

const char ATTACKRANGE_KEY[] = "AttackRange" [static]

const char AUTOREPAIRRANGE_KEY[] = "AutoRepairRange" [static]

const char BASICDAMAGE_KEY[] = "BasicDamage" [static]

const char BLOODLUST_KEY[] = "Bloodlust" [static]

const char BUILD_KEY[] = "Build" [static]

const char BUILDERLOST_KEY[] = "BuilderLost" [static]

const char BUILDEROUTSIDE_KEY[] = "BuilderOutside" [static]

const char BUILDING_KEY[] = "Building" [static]

const char CANATTACK_KEY[] = "CanAttack" [static]

const char CANHARVEST_KEY[] = "CanHarvest" [static]

const char CARRYRESOURCE_KEY[] = "CarryResource" [static]

const char COWARD_KEY[] = "Coward" [static]

const char DECORATION_KEY[] = "Decoration" [static]

const char DEMAND_KEY[] = "Demand" [static]

const char DETECTCLOAK_KEY[] = "DetectCloak" [static]

const char EXPLODEWHENKILLED_KEY[] = "ExplodeWhenKilled" [static]

const char FLIP_KEY[] = "Flip" [static]

const char GIVERESOURCE_KEY[] = "GiveResource" [static]

const char GROUNDATTACK_KEY[] = "GroundAttack" [static]

const char HARVESTER_KEY[] = "Harvester" [static]

const char HASTE_KEY[] = "Haste" [static]

const char HITPOINTS_KEY[] = "HitPoints" [static]

const char INDESTRUCTIBLE_KEY[] = "Indestructible" [static]

const char INVISIBLE_KEY[] = "Invisible" [static]

const char ISNOTSELECTABLE_KEY[] = "IsNotSelectable" [static]

const char KILL_KEY[] = "Kill" [static]

std::vector<LabelsStruct> Labels [static]

std::vector<LabelsLaterStruct> LabelsLater [static]

const char LANDUNIT_KEY[] = "LandUnit" [static]

const char MANA_KEY[] = "Mana" [static]

const char MAXHARVESTERS_KEY[] = "MaxHarvesters" [static]

const char PERMANENTCLOACK_KEY[] = "PermanentCloack" [static]

const char PIERCINGDAMAGE_KEY[] = "PiercingDamage" [static]

const char POINTS_KEY[] = "Points" [static]

const char POSX_KEY[] = "PosX" [static]

const char POSY_KEY[] = "PosY" [static]

const char RADARJAMMERRANGE_KEY[] = "RadarJammerRange" [static]

const char RADARRANGE_KEY[] = "RadarRange" [static]

const char RESEARCH_KEY[] = "Research" [static]

const char REVEALER_KEY[] = "Revealer" [static]

const char SAVECARGO_KEY[] = "LoseCargo" [static]

const char SEAUNIT_KEY[] = "SeaUnit" [static]

const char SELECTABLEBYRECTANGLE_KEY[] = "SelectableByRectangle" [static]

const char SHIELD_KEY[] = "ShieldPoints" [static]

const char SHIELDPIERCE_KEY[] = "ShieldPiercing" [static]

const char SHOREBUILDING_KEY[] = "ShoreBuilding" [static]

const char SIGHTRANGE_KEY[] = "SightRange" [static]

const char SLOT_KEY[] = "Slot" [static]

const char SLOW_KEY[] = "Slow" [static]

const char SUPPLY_KEY[] = "Supply" [static]

const char TELEPORTER_KEY[] = "Teleporter" [static]

const char TRAINING_KEY[] = "Training" [static]

const char TRANSPORT_KEY[] = "Transport" [static]

const char UNHOLYARMOR_KEY[] = "UnholyArmor" [static]

const char UPGRADETO_KEY[] = "UpgradeTo" [static]

const char VANISHES_KEY[] = "Vanishes" [static]

const char VISIBLEUNDERFOG_KEY[] = "VisibleUnderFog" [static]

const char XP_KEY[] = "Xp" [static]

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