$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
00001 // _________ __ __ 00002 // / _____// |_____________ _/ |______ ____ __ __ ______ 00003 // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/ 00004 // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ | 00005 // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ > 00006 // \/ \/ \//_____/ \/ 00007 // ______________________ ______________________ 00008 // T H E W A R B E G I N S 00009 // Stratagus - A free fantasy real time strategy game engine 00010 // 00012 // 00013 // (c) Copyright 1998-2007 by Lutz Sammer and Jimmy Salmon 00014 // 00015 // This program is free software; you can redistribute it and/or modify 00016 // it under the terms of the GNU General Public License as published by 00017 // the Free Software Foundation; only version 2 of the License. 00018 // 00019 // This program is distributed in the hope that it will be useful, 00020 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00021 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00022 // GNU General Public License for more details. 00023 // 00024 // You should have received a copy of the GNU General Public License 00025 // along with this program; if not, write to the Free Software 00026 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00027 // 02111-1307, USA. 00028 // 00029 00030 #ifndef __UNITTYPE_H__ 00031 #define __UNITTYPE_H__ 00032 00034 00035 /*---------------------------------------------------------------------------- 00036 -- Documentation 00037 ----------------------------------------------------------------------------*/ 00038 00513 /*---------------------------------------------------------------------------- 00514 -- Includes 00515 ----------------------------------------------------------------------------*/ 00516 00517 #include <SDL.h> 00518 #include <vector> 00519 #include <algorithm> 00520 #include <map> 00521 00522 #ifndef __UPGRADE_STRUCTS_H__ 00523 #include "upgrade_structs.h" 00524 #endif 00525 00526 #ifndef __UTIL_H__ 00527 #include "util.h" 00528 #endif 00529 00530 #ifndef __UNITSOUND_H__ 00531 #include "unitsound.h" 00532 #endif 00533 00534 #ifndef __ICONS_H__ 00535 #include "icons.h" 00536 #endif 00537 00538 #include "missileconfig.h" 00539 #include "vec2i.h" 00540 00541 /*---------------------------------------------------------------------------- 00542 -- Declarations 00543 ----------------------------------------------------------------------------*/ 00544 00545 class CAnimations; 00546 class CPlayerColorGraphic; 00547 class CConstruction; 00548 class MissileType; 00549 class CFile; 00550 struct lua_State; 00551 #ifdef USE_MNG 00552 class Mng; 00553 #endif 00554 class LuaCallback; 00555 00556 #define UnitSides 8 00557 #define MaxAttackPos 5 00558 00559 CUnitType *UnitTypeByIdent(const std::string &ident); 00560 00561 enum GroupSelectionMode { 00562 SELECTABLE_BY_RECTANGLE_ONLY = 0, 00563 NON_SELECTABLE_BY_RECTANGLE_ONLY, 00564 SELECT_ALL 00565 }; 00566 00567 class ResourceInfo 00568 { 00569 public: 00570 ResourceInfo() : WaitAtResource(0), ResourceStep(0), 00571 ResourceCapacity(0), WaitAtDepot(0), ResourceId(0), FinalResource(0), 00572 TerrainHarvester(0), LoseResources(0), HarvestFromOutside(0), 00573 SpriteWhenLoaded(NULL), SpriteWhenEmpty(NULL) 00574 {} 00575 00576 std::string FileWhenLoaded; 00577 std::string FileWhenEmpty; 00578 unsigned WaitAtResource; 00579 unsigned ResourceStep; 00580 int ResourceCapacity; 00581 unsigned WaitAtDepot; 00582 unsigned ResourceId; 00583 unsigned FinalResource; 00584 unsigned char TerrainHarvester; 00585 unsigned char LoseResources; 00586 unsigned char HarvestFromOutside; 00587 unsigned char RefineryHarvester; 00588 // Runtime info: 00589 CPlayerColorGraphic *SpriteWhenLoaded; 00590 CPlayerColorGraphic *SpriteWhenEmpty; 00591 }; 00592 00599 class CVariable 00600 { 00601 public: 00602 CVariable() : Max(0), Value(0), Increase(0), Enable(0) {} 00603 00604 bool operator ==(const CVariable &rhs) const { 00605 return this->Max == rhs.Max 00606 && this->Value == rhs.Value 00607 && this->Increase == rhs.Increase 00608 && this->Enable == rhs.Enable; 00609 } 00610 bool operator !=(const CVariable &rhs) const { return !(*this == rhs); } 00611 00612 public: 00613 int Max; 00614 int Value; 00615 char Increase; 00616 char Enable; 00617 }; 00618 00619 // Index for boolflag aready defined 00620 enum { 00621 COWARD_INDEX = 0, 00622 BUILDING_INDEX, 00623 FLIP_INDEX, 00624 REVEALER_INDEX, 00625 LANDUNIT_INDEX, 00626 AIRUNIT_INDEX, 00627 SEAUNIT_INDEX, 00628 EXPLODEWHENKILLED_INDEX, 00629 VISIBLEUNDERFOG_INDEX, 00630 PERMANENTCLOAK_INDEX, 00631 DETECTCLOAK_INDEX, 00632 ATTACKFROMTRANSPORTER_INDEX, 00633 VANISHES_INDEX, 00634 GROUNDATTACK_INDEX, 00635 SHOREBUILDING_INDEX, 00636 CANATTACK_INDEX, 00637 BUILDEROUTSIDE_INDEX, 00638 BUILDERLOST_INDEX, 00639 CANHARVEST_INDEX, 00640 HARVESTER_INDEX, 00641 SELECTABLEBYRECTANGLE_INDEX, 00642 ISNOTSELECTABLE_INDEX, 00643 DECORATION_INDEX, 00644 INDESTRUCTIBLE_INDEX, 00645 TELEPORTER_INDEX, 00646 SHIELDPIERCE_INDEX, 00647 SAVECARGO_INDEX, 00648 NONSOLID_INDEX, 00649 WALL_INDEX, 00650 NBARALREADYDEFINED 00651 }; 00652 00653 // Index for variable already defined. 00654 enum { 00655 HP_INDEX = 0, 00656 BUILD_INDEX, 00657 MANA_INDEX, 00658 TRANSPORT_INDEX, 00659 RESEARCH_INDEX, 00660 TRAINING_INDEX, 00661 UPGRADINGTO_INDEX, 00662 GIVERESOURCE_INDEX, 00663 CARRYRESOURCE_INDEX, 00664 XP_INDEX, 00665 KILL_INDEX, 00666 SUPPLY_INDEX, 00667 DEMAND_INDEX, 00668 ARMOR_INDEX, 00669 SIGHTRANGE_INDEX, 00670 ATTACKRANGE_INDEX, 00671 PIERCINGDAMAGE_INDEX, 00672 BASICDAMAGE_INDEX, 00673 POSX_INDEX, 00674 POSY_INDEX, 00675 RADAR_INDEX, 00676 RADARJAMMER_INDEX, 00677 AUTOREPAIRRANGE_INDEX, 00678 BLOODLUST_INDEX, 00679 HASTE_INDEX, 00680 SLOW_INDEX, 00681 INVISIBLE_INDEX, 00682 UNHOLYARMOR_INDEX, 00683 SLOT_INDEX, 00684 SHIELD_INDEX, 00685 POINTS_INDEX, 00686 MAXHARVESTERS_INDEX, 00687 NVARALREADYDEFINED 00688 }; 00689 00690 class CUnit; 00691 class CUnitType; 00692 class CFont; 00693 00700 class CDecoVar 00701 { 00702 public: 00703 00704 CDecoVar() {}; 00705 virtual ~CDecoVar() { 00706 }; 00707 00709 virtual void Draw(int x, int y, const CUnitType *Type, const CVariable &var) const = 0; 00710 00711 unsigned int Index; 00712 00713 int OffsetX; 00714 int OffsetY; 00715 00716 int OffsetXPercent; 00717 int OffsetYPercent; 00718 00719 bool IsCenteredInX; 00720 bool IsCenteredInY; 00721 00722 bool ShowIfNotEnable; 00723 bool ShowWhenNull; 00724 bool HideHalf; 00725 bool ShowWhenMax; 00726 bool ShowOnlySelected; 00727 00728 bool HideNeutral; 00729 bool HideAllied; 00730 bool ShowOpponent; 00731 }; 00732 00733 class CDecoVarBar : public CDecoVar 00734 { 00735 public: 00737 virtual void Draw(int x, int y, const CUnitType *type, const CVariable &var) const; 00738 00739 bool IsVertical; 00740 bool SEToNW; 00741 int Height; 00742 int Width; 00743 bool ShowFullBackground; 00744 char BorderSize; 00745 // FIXME color depend of percent (red, Orange, Yellow, Green...) 00746 Uint32 Color; 00747 Uint32 BColor; 00748 }; 00749 00750 class CDecoVarText : public CDecoVar 00751 { 00752 public: 00753 CDecoVarText() : Font(NULL) {}; 00755 virtual void Draw(int x, int y, const CUnitType *type, const CVariable &var) const; 00756 00757 CFont *Font; 00758 // FIXME : Add Color, format 00759 }; 00760 00762 class CDecoVarSpriteBar : public CDecoVar 00763 { 00764 public: 00765 CDecoVarSpriteBar() : NSprite(-1) {}; 00767 virtual void Draw(int x, int y, 00768 const CUnitType *Type, const CVariable &Variable) const; 00769 00770 char NSprite; 00771 // FIXME Sprite info. better way ? 00772 }; 00773 00775 class CDecoVarStaticSprite : public CDecoVar 00776 { 00777 public: 00778 CDecoVarStaticSprite() : NSprite(-1), n(0) {} 00780 virtual void Draw(int x, int y, const CUnitType *type, const CVariable &var) const; 00781 00782 // FIXME Sprite info. and Replace n with more appropriate var. 00783 char NSprite; 00784 int n; 00785 }; 00786 00787 enum UnitTypeType { 00788 UnitTypeLand, 00789 UnitTypeFly, 00790 UnitTypeNaval 00791 }; 00792 00793 enum DistanceTypeType { 00794 Equal, 00795 NotEqual, 00796 LessThan, 00797 LessThanEqual, 00798 GreaterThan, 00799 GreaterThanEqual 00800 }; 00801 00802 00803 class CBuildRestriction 00804 { 00805 public: 00806 virtual ~CBuildRestriction() {} 00807 virtual void Init() {}; 00808 virtual bool Check(const CUnit *builder, const CUnitType &type, const Vec2i &pos, CUnit *&ontoptarget) const = 0; 00809 }; 00810 00811 00812 class CBuildRestrictionAnd : public CBuildRestriction 00813 { 00814 public: 00815 00816 virtual ~CBuildRestrictionAnd() { 00817 for (std::vector<CBuildRestriction *>::const_iterator i = _or_list.begin(); 00818 i != _or_list.end(); ++i) { 00819 delete *i; 00820 } 00821 _or_list.clear(); 00822 } 00823 virtual void Init() { 00824 for (std::vector<CBuildRestriction *>::const_iterator i = _or_list.begin(); 00825 i != _or_list.end(); ++i) { 00826 (*i)->Init(); 00827 } 00828 } 00829 virtual bool Check(const CUnit *builder, const CUnitType &type, const Vec2i &pos, CUnit *&ontoptarget) const; 00830 00831 void push_back(CBuildRestriction *restriction) { _or_list.push_back(restriction); } 00832 public: 00833 std::vector<CBuildRestriction *> _or_list; 00834 }; 00835 00836 00837 00838 class CBuildRestrictionAddOn : public CBuildRestriction 00839 { 00840 class functor 00841 { 00842 public: 00843 functor(const CUnitType *type, const Vec2i &_pos): Parent(type), pos(_pos) {} 00844 inline bool operator()(const CUnit *const unit) const; 00845 private: 00846 const CUnitType *const Parent; 00847 const Vec2i pos; //functor work position 00848 }; 00849 public: 00850 CBuildRestrictionAddOn() : Offset(0, 0), Parent(NULL) {} 00851 virtual ~CBuildRestrictionAddOn() {} 00852 virtual void Init() {this->Parent = UnitTypeByIdent(this->ParentName);} 00853 virtual bool Check(const CUnit *builder, const CUnitType &type, const Vec2i &pos, CUnit *&ontoptarget) const; 00854 00855 Vec2i Offset; 00856 std::string ParentName; 00857 CUnitType *Parent; 00858 }; 00859 00860 class CBuildRestrictionOnTop : public CBuildRestriction 00861 { 00862 class functor 00863 { 00864 public: 00865 functor(const CUnitType *type, const Vec2i &_pos): ontop(0), Parent(type), pos(_pos) {} 00866 inline bool operator()(CUnit *const unit); 00867 CUnit *ontop; 00868 private: 00869 const CUnitType *const Parent; 00870 const Vec2i pos; //functor work position 00871 }; 00872 public: 00873 CBuildRestrictionOnTop() : Parent(NULL), ReplaceOnDie(0), ReplaceOnBuild(0) {}; 00874 virtual ~CBuildRestrictionOnTop() {}; 00875 virtual void Init() {this->Parent = UnitTypeByIdent(this->ParentName);}; 00876 virtual bool Check(const CUnit *builder, const CUnitType &type, const Vec2i &pos, CUnit *&ontoptarget) const; 00877 00878 std::string ParentName; 00879 CUnitType *Parent; 00880 int ReplaceOnDie: 1; 00881 int ReplaceOnBuild: 1; 00882 }; 00883 00884 class CBuildRestrictionDistance : public CBuildRestriction 00885 { 00886 public: 00887 CBuildRestrictionDistance() : Distance(0), RestrictType(NULL) {}; 00888 virtual ~CBuildRestrictionDistance() {}; 00889 virtual void Init() {this->RestrictType = UnitTypeByIdent(this->RestrictTypeName);}; 00890 virtual bool Check(const CUnit *builder, const CUnitType &type, const Vec2i &pos, CUnit *&ontoptarget) const; 00891 00892 int Distance; 00893 DistanceTypeType DistanceType; 00894 std::string RestrictTypeName; 00895 CUnitType *RestrictType; 00896 }; 00897 00900 class CUnitType 00901 { 00902 public: 00903 CUnitType(); 00904 ~CUnitType(); 00905 00906 Vec2i GetHalfTileSize() const { 00907 Vec2i res(TileWidth / 2, TileHeight / 2); 00908 00909 return res; 00910 } 00911 00912 PixelSize GetPixelSize() const; 00913 00914 std::string Ident; 00915 std::string Name; 00916 int Slot; 00917 std::string File; 00918 std::string ShadowFile; 00919 00920 int Width; 00921 int Height; 00922 int OffsetX; 00923 int OffsetY; 00924 int DrawLevel; 00925 int ShadowWidth; 00926 int ShadowHeight; 00927 int ShadowOffsetX; 00928 int ShadowOffsetY; 00929 PixelPos MissileOffsets[UnitSides][MaxAttackPos]; 00930 00931 CAnimations *Animations; 00932 int StillFrame; 00933 00934 IconConfig Icon; 00935 #ifdef USE_MNG 00936 struct _portrait_ { 00937 std::string *Files; 00938 int Num; 00939 Mng **Mngs; 00940 mutable int CurrMng; 00941 mutable int NumIterations; 00942 } Portrait; 00943 #endif 00944 MissileConfig Missile; 00945 MissileConfig Explosion; 00946 MissileConfig Impact[ANIMATIONS_DEATHTYPES + 2]; 00947 00948 LuaCallback *DeathExplosion; 00949 LuaCallback *OnHit; 00950 LuaCallback *OnEachCycle; 00951 LuaCallback *OnEachSecond; 00952 00953 std::string DamageType; 00954 00955 std::string CorpseName; 00956 CUnitType *CorpseType; 00957 00958 CConstruction *Construction; 00959 00960 int RepairHP; 00961 int RepairCosts[MaxCosts]; 00962 00963 int TileWidth; 00964 int TileHeight; 00965 int BoxWidth; 00966 int BoxHeight; 00967 int NumDirections; 00968 int MinAttackRange; 00969 int ReactRangeComputer; 00970 int ReactRangePerson; 00971 int Priority; 00972 int BurnPercent; 00973 int BurnDamageRate; 00974 int RepairRange; 00975 char *CanCastSpell; 00976 char *AutoCastActive; 00977 int AutoBuildRate; 00978 int RandomMovementProbability; 00979 int ClicksToExplode; 00980 int MaxOnBoard; 00981 int StartingResources; 00982 00983 UnitTypeType UnitType; 00984 int DecayRate; 00985 // TODO: not used 00986 int AnnoyComputerFactor; 00987 int MouseAction; 00988 #define MouseActionNone 0 00989 #define MouseActionAttack 1 00990 #define MouseActionMove 2 00991 #define MouseActionHarvest 3 00992 #define MouseActionSpellCast 5 00993 #define MouseActionSail 6 00994 int CanTarget; 00995 #define CanTargetLand 1 00996 #define CanTargetSea 2 00997 #define CanTargetAir 4 00998 00999 unsigned Flip : 1; 01000 unsigned Revealer : 1; 01001 unsigned LandUnit : 1; 01002 unsigned AirUnit : 1; 01003 unsigned SeaUnit : 1; 01004 unsigned ExplodeWhenKilled : 1; 01005 unsigned Building : 1; 01006 unsigned VisibleUnderFog : 1; 01007 unsigned PermanentCloak : 1; 01008 unsigned DetectCloak : 1; 01009 unsigned Coward : 1; 01010 unsigned AttackFromTransporter : 1; 01011 unsigned Vanishes : 1; 01012 unsigned GroundAttack : 1; 01013 unsigned ShoreBuilding : 1; 01014 unsigned CanAttack : 1; 01015 unsigned BuilderOutside : 1; 01016 unsigned BuilderLost : 1; 01017 unsigned CanHarvest : 1; 01018 unsigned Harvester : 1; 01019 unsigned Neutral : 1; 01020 01021 unsigned SelectableByRectangle : 1; 01022 unsigned IsNotSelectable : 1; 01023 unsigned Decoration : 1; 01024 unsigned Indestructible : 1; 01025 unsigned Teleporter : 1; 01026 unsigned ShieldPiercing : 1; 01027 unsigned SaveCargo : 1; 01028 unsigned NonSolid : 1; 01029 unsigned Wall : 1; 01030 01031 CUnitStats DefaultStat; 01032 struct BoolFlags { 01033 bool value; 01034 char CanTransport; 01035 char CanTargetFlag; 01036 char AiPriorityTarget; 01037 }; 01038 std::vector<BoolFlags> BoolFlag; 01039 01040 int CanStore[MaxCosts]; 01041 int GivesResource; 01042 ResourceInfo *ResInfo[MaxCosts]; 01043 std::vector<CBuildRestriction *> BuildingRules; 01044 std::vector<CBuildRestriction *> AiBuildingRules; 01045 SDL_Color NeutralMinimapColorRGB; 01046 01047 CUnitSound Sound; 01048 01049 int Supply; 01050 int Demand; 01051 01052 // --- FILLED UP --- 01053 01054 int ImproveIncomes[MaxCosts]; 01055 01056 unsigned FieldFlags; 01057 unsigned MovementMask; 01058 01060 CUnitStats Stats[PlayerMax]; 01061 01062 CPlayerColorGraphic *Sprite; 01063 CGraphic *ShadowSprite; 01064 01065 /* API */ 01066 01067 bool CheckUserBoolFlags(const char *BoolFlags) const; 01068 bool CanTransport() const { return MaxOnBoard > 0 && !GivesResource; } 01069 bool CanMove() const; 01070 01071 bool CanSelect(GroupSelectionMode mode = SELECTABLE_BY_RECTANGLE_ONLY) const { 01072 if (!IsNotSelectable) { 01073 switch (mode) { 01074 case SELECTABLE_BY_RECTANGLE_ONLY: 01075 return SelectableByRectangle; 01076 case NON_SELECTABLE_BY_RECTANGLE_ONLY: 01077 return !SelectableByRectangle; 01078 default: 01079 return true; 01080 } 01081 } 01082 return false; 01083 } 01084 }; 01085 01086 /*---------------------------------------------------------------------------- 01087 -- Variables 01088 ----------------------------------------------------------------------------*/ 01089 01090 extern std::vector<CUnitType *> UnitTypes; 01091 01093 extern CUnitType *UnitTypeHumanWall; 01094 extern CUnitType *UnitTypeOrcWall; 01095 01099 class CUnitTypeVar 01100 { 01101 public: 01102 01103 template <const unsigned int SIZE> 01104 struct CKeys { 01105 01106 struct DataKey { 01107 static bool key_pred(const DataKey &lhs, 01108 const DataKey &rhs) { 01109 return ((lhs.keylen == rhs.keylen) ? 01110 (strcmp(lhs.key, rhs.key) < 0) : (lhs.keylen < rhs.keylen)); 01111 } 01112 int offset; 01113 unsigned int keylen; 01114 const char *key; 01115 }; 01116 01117 CKeys(): TotalKeys(SIZE) {} 01118 01119 DataKey buildin[SIZE]; 01120 std::map<std::string, int> user; 01121 unsigned int TotalKeys; 01122 01123 void Init() { 01124 std::sort(buildin, buildin + SIZE, DataKey::key_pred); 01125 } 01126 01127 const char *operator[](int index) { 01128 for (unsigned int i = 0; i < SIZE; ++i) { 01129 if (buildin[i].offset == index) { 01130 return buildin[i].key; 01131 } 01132 } 01133 for (std::map<std::string, int>::iterator 01134 it(user.begin()), end(user.end()); 01135 it != end; ++it) { 01136 if ((*it).second == index) { 01137 return ((*it).first).c_str(); 01138 } 01139 } 01140 return NULL; 01141 } 01142 01150 int operator[](const char *const key) { 01151 DataKey k; 01152 k.key = key; 01153 k.keylen = strlen(key); 01154 const DataKey *p = std::lower_bound(buildin, buildin + SIZE, 01155 k, DataKey::key_pred); 01156 if ((p != buildin + SIZE) && p->keylen == k.keylen && 01157 0 == strcmp(p->key, key)) { 01158 return p->offset; 01159 } else { 01160 std::map<std::string, int>::iterator 01161 ret(user.find(key)); 01162 if (ret != user.end()) { 01163 return (*ret).second; 01164 } 01165 } 01166 return -1; 01167 } 01168 01169 int AddKey(const char *const key) { 01170 int index = this->operator[](key); 01171 if (index != -1) { 01172 DebugPrint("Warning, Key '%s' already defined\n" _C_ key); 01173 return index; 01174 } 01175 user[key] = TotalKeys++; 01176 return TotalKeys - 1; 01177 } 01178 01179 }; 01180 01181 struct CBoolKeys : public CKeys<NBARALREADYDEFINED> { 01182 CBoolKeys(); 01183 }; 01184 01185 struct CVariableKeys : public CKeys<NVARALREADYDEFINED> { 01186 CVariableKeys(); 01187 }; 01188 01189 CUnitTypeVar() {} 01190 01191 void Init(); 01192 void Clear(); 01193 01194 CBoolKeys BoolFlagNameLookup; 01195 CVariableKeys VariableNameLookup; 01196 01197 // EventType *Event; /// Array of functions sets to call when en event occurs. 01198 std::vector<CVariable> Variable; 01199 std::vector<CDecoVar *> DecoVar; 01200 01201 unsigned int GetNumberBoolFlag() const { 01202 return BoolFlagNameLookup.TotalKeys; 01203 } 01204 01205 unsigned int GetNumberVariable() const { 01206 return VariableNameLookup.TotalKeys; 01207 } 01208 }; 01209 01210 extern CUnitTypeVar UnitTypeVar; 01211 01212 /*---------------------------------------------------------------------------- 01213 -- Functions 01214 ----------------------------------------------------------------------------*/ 01215 extern CUnitType *CclGetUnitType(lua_State *l); 01216 extern void UnitTypeCclRegister(); 01217 01218 extern void UpdateStats(int reset_to_default); 01219 extern CUnitType *UnitTypeByIdent(const std::string &ident); 01220 01221 extern void SaveUnitTypes(CFile &file); 01222 extern CUnitType *NewUnitTypeSlot(const std::string &ident); 01223 01224 extern void DrawUnitType(const CUnitType &type, CPlayerColorGraphic *sprite, 01225 int player, int frame, const PixelPos &screenPos); 01226 01227 extern void InitUnitTypes(int reset_player_stats); 01228 extern void LoadUnitTypeSprite(CUnitType &unittype); 01229 extern void LoadUnitTypes(); 01230 extern void CleanUnitTypes(); 01231 01232 // in script_unittype.c 01233 01235 extern void DefineVariableField(lua_State *l, CVariable *var, int lua_index); 01236 01238 extern void UpdateUnitVariables(CUnit &unit); 01239 01241 01242 #endif // !__UNITTYPE_H__