_________ __ __ / _____// |_____________ _/ |______ ____ __ __ ______ \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ \ /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > \/ \/ \//_____/ \/ ______________________ ______________________ T H E W A R B E G I N S Stratagus - A free fantasy real time strategy game engine
#include "stratagus.h"
#include "unittype.h"
#include "animation.h"
#include "animation/animation_exactframe.h"
#include "animation/animation_frame.h"
#include "construct.h"
#include "iolib.h"
#include "luacallback.h"
#include "map.h"
#include "missile.h"
#include "player.h"
#include "script.h"
#include "sound.h"
#include "spells.h"
#include "tileset.h"
#include "translate.h"
#include "ui.h"
#include "unitsound.h"
#include "util.h"
#include "video.h"
#include <ctype.h>
#include <string>
#include <map>
unittype.cpp - The unit types. | |
std::vector< CUnitType * > | UnitTypes |
std::map< std::string, CUnitType * > | UnitTypeMap |
unit-types definition More... | |
CUnitType * | UnitTypeHumanWall |
All unit-types. More... | |
CUnitType * | UnitTypeOrcWall |
Human wall. More... | |
int | DefaultIncomes [MaxCosts] |
Orc wall. More... | |
std::string | DefaultActions [MaxCosts] |
std::string | DefaultResourceNames [MaxCosts] |
int | DefaultResourceAmounts [MaxCosts] |
int | DefaultResourceMaxAmounts [MaxCosts] |
std::string | ExtraDeathTypes [ANIMATIONS_DEATHTYPES] |
int | GetResourceIdByName (const char *resourceName) |
int | GetResourceIdByName (lua_State *l, const char *resourceName) |
void | UpdateUnitStats (CUnitType &type, int reset) |
Register ccl features. More... | |
void | UpdateStats (int reset) |
Update unit stats. More... | |
static bool | SaveUnitStats (const CUnitStats &stats, const CUnitType &type, int plynr, CFile &file) |
void | SaveUnitTypes (CFile &file) |
Get unit-type by ident. More... | |
CUnitType * | UnitTypeByIdent (const std::string &ident) |
Update unit stats. More... | |
CUnitType * | NewUnitTypeSlot (const std::string &ident) |
Save the unit-type table. More... | |
void | DrawUnitType (const CUnitType &type, CPlayerColorGraphic *sprite, int colorIndex, int frame, const PixelPos &screenPos) |
Draw the sprite frame of unit-type. More... | |
static int | GetStillFrame (const CUnitType &type) |
void | InitUnitTypes (int reset_player_stats) |
void | LoadUnitTypeSprite (CUnitType &type) |
Init unit-type table. More... | |
void | LoadUnitTypes () |
Load the sprite for a unittype. More... | |
void | CleanUnitTypes () |
Load the unit-type data. More... | |
void CleanUnitTypes | ( | ) |
Load the unit-type data.
Cleanup the unit-type module.
void DrawUnitType | ( | const CUnitType & | type, |
CPlayerColorGraphic * | sprite, | ||
int | colorIndex, | ||
int | frame, | ||
const PixelPos & | screenPos | ||
) |
Draw the sprite frame of unit-type.
Draw unit-type on map.
type | Unit-type pointer. |
sprite | Sprite to use for drawing |
player | Player number for color substitution. |
frame | Animation frame of unit-type. |
screenPos | Screen pixel (top left) position to draw unit-type. |
int GetResourceIdByName | ( | const char * | resourceName | ) |
int GetResourceIdByName | ( | lua_State * | l, |
const char * | resourceName | ||
) |
|
static |
Get the still animation frame
void InitUnitTypes | ( | int | reset_player_stats | ) |
Init unit types.
void LoadUnitTypes | ( | ) |
Load the sprite for a unittype.
Load the graphics for the unit-types.
Init unit-type table.
Loads the Sprite for a unit type
type | type of unit to load |
CUnitType* NewUnitTypeSlot | ( | const std::string & | ident | ) |
Save the unit-type table.
Allocate an empty unit-type slot.
ident | Identifier to identify the slot (malloced by caller!). |
|
static |
Save state of an unit-stats to file.
stats | Unit-stats to save. |
ident | Unit-type ident. |
plynr | Player number. |
file | Output file. |
Get unit-type by ident.
Save state of the unit-type table to file.
file | Output file. |
CUnitType* UnitTypeByIdent | ( | const std::string & | ident | ) |
Update unit stats.
Find unit-type by identifier.
ident | The unit-type identifier. |
void UpdateStats | ( | int | reset | ) |
Update unit stats.
Update the player stats for changed unit types.
reset | indicates wether default value should be set to each stat (level, upgrades) |
std::string DefaultActions[MaxCosts] |
Default action for the resources.
int DefaultIncomes[MaxCosts] |
Orc wall.
Default incomes for a new player.
int DefaultResourceAmounts[MaxCosts] |
Default amounts for the resources.
int DefaultResourceMaxAmounts[MaxCosts] |
Default max amounts for the resources.
std::string DefaultResourceNames[MaxCosts] |
Default names for the resources.
std::string ExtraDeathTypes[ANIMATIONS_DEATHTYPES] |
Default names for the resources.
CUnitType* UnitTypeHumanWall |
All unit-types.
Next unit type are used hardcoded in the source.
std::map<std::string, CUnitType *> UnitTypeMap |
unit-types definition
CUnitType* UnitTypeOrcWall |
Human wall.
std::vector<CUnitType *> UnitTypes |