$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
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 1999-2007 by Vladi Belperchinov-Shabanski and 00014 // Jimmy Salmon 00015 // 00016 // This program is free software; you can redistribute it and/or modify 00017 // it under the terms of the GNU General Public License as published by 00018 // the Free Software Foundation; only version 2 of the License. 00019 // 00020 // This program is distributed in the hope that it will be useful, 00021 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00022 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00023 // GNU General Public License for more details. 00024 // 00025 // You should have received a copy of the GNU General Public License 00026 // along with this program; if not, write to the Free Software 00027 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 00028 // 02111-1307, USA. 00029 // 00030 00031 #ifndef __UPGRADE_STRUCTS_H__ 00032 #define __UPGRADE_STRUCTS_H__ 00033 00035 00036 /*---------------------------------------------------------------------------- 00037 -- Includes 00038 ----------------------------------------------------------------------------*/ 00039 00040 #include <vector> 00041 00042 /*---------------------------------------------------------------------------- 00043 -- Defines 00044 ----------------------------------------------------------------------------*/ 00045 00046 /*---------------------------------------------------------------------------- 00047 -- Declarations 00048 ----------------------------------------------------------------------------*/ 00049 00050 class CUnitType; 00051 class CVariable; 00052 class CIcon; 00053 00057 enum CostType { 00058 TimeCost, 00059 00060 // standard 00061 GoldCost, 00062 WoodCost, 00063 OilCost, 00064 // extensions 00065 Cost4, 00066 Cost5, 00067 Cost6, 00068 00069 MaxCosts 00070 }; 00071 00072 #define FoodCost MaxCosts 00073 #define ScoreCost (MaxCosts + 1) 00074 00078 extern int SpeedResourcesHarvest[MaxCosts]; 00079 00083 extern int SpeedResourcesReturn[MaxCosts]; 00084 00088 extern int DefaultResources[MaxCosts]; 00089 00093 extern int DefaultResourcesLow[MaxCosts]; 00094 00098 extern int DefaultResourcesMedium[MaxCosts]; 00099 00103 extern int DefaultResourcesHigh[MaxCosts]; 00104 00108 extern int DefaultIncomes[MaxCosts]; 00109 00113 extern std::string DefaultActions[MaxCosts]; 00114 00118 extern std::string DefaultResourceNames[MaxCosts]; 00119 00123 extern int DefaultResourceAmounts[MaxCosts]; 00124 00128 class CUnitStats { 00129 public: 00130 CUnitStats() : Variables(NULL) 00131 { 00132 memset(Costs, 0, sizeof(Costs)); 00133 } 00134 00135 CVariable *Variables; 00136 int Costs[MaxCosts]; 00137 }; 00138 00142 class CUpgrade { 00143 public: 00144 CUpgrade(const std::string &ident); 00145 ~CUpgrade(); 00146 00147 static CUpgrade *New(const std::string &ident); 00148 static CUpgrade *Get(const std::string &ident); 00149 00150 void SetIcon(CIcon *icon); 00151 00152 std::string Ident; 00153 int ID; 00154 int Costs[MaxCosts]; 00155 // TODO: not used by buttons 00156 CIcon *Icon; 00157 }; 00158 00159 /*---------------------------------------------------------------------------- 00160 -- upgrades and modifiers 00161 ----------------------------------------------------------------------------*/ 00162 00168 class CUpgradeModifier { 00169 public: 00170 CUpgradeModifier() : UpgradeId(0), ConvertTo(NULL) 00171 { 00172 memset(ChangeUnits, 0, sizeof(ChangeUnits)); 00173 memset(ChangeUpgrades, 0, sizeof(ChangeUpgrades)); 00174 memset(ApplyTo, 0, sizeof(ApplyTo)); 00175 } 00176 00177 int UpgradeId; 00178 00179 CUnitStats Modifier; 00180 00181 // allow/forbid bitmaps -- used as chars for example: 00182 // `?' -- leave as is, `F' -- forbid, `A' -- allow 00183 // TODO: see below allow more semantics? 00184 // TODO: pointers or ids would be faster and less memory use 00185 int ChangeUnits[UnitTypeMax]; 00186 char ChangeUpgrades[UpgradeMax]; 00187 char ApplyTo[UnitTypeMax]; 00188 00189 CUnitType *ConvertTo; 00190 00191 }; 00192 00206 class CAllow { 00207 public: 00208 CAllow() { this->Clear(); } 00209 00210 void Clear() { 00211 memset(Units, 0, sizeof(Units)); 00212 memset(Upgrades, 0, sizeof(Upgrades)); 00213 } 00214 00215 int Units[UnitTypeMax]; 00216 char Upgrades[UpgradeMax]; 00217 }; 00218 00223 class CUpgradeTimers { 00224 public: 00225 CUpgradeTimers() { this->Clear(); } 00226 00227 void Clear() { 00228 memset(Upgrades, 0, sizeof(Upgrades)); 00229 } 00230 00235 int Upgrades[UpgradeMax]; 00236 }; 00237 00238 /*---------------------------------------------------------------------------- 00239 -- Variables 00240 ----------------------------------------------------------------------------*/ 00241 00242 extern std::vector<CUpgrade *> AllUpgrades; 00243 00245 00246 #endif // !__UPGRADE_STRUCTS_H__