_________ __                 __
        /   _____//  |_____________ _/  |______     ____  __ __  ______
        \_____  \\   __\_  __ \__  \\   __\__  \   / ___\|  |  \/  ___/
        /        \|  |  |  | \// __ \|  |  / __ \_/ /_/  >  |  /\___ \
       /_______  /|__|  |__|  (____  /__| (____  /\___  /|____//____  >
               \/                  \/          \//_____/            \/
    ______________________                           ______________________
                          T H E   W A R   B E G I N S
                   Stratagus - A free fantasy real time strategy game engine

upgrade.h
Go to the documentation of this file.
1 // _________ __ __
2 // / _____// |_____________ _/ |______ ____ __ __ ______
3 // \_____ \\ __\_ __ \__ \\ __\__ \ / ___\| | \/ ___/
4 // / \| | | | \// __ \| | / __ \_/ /_/ > | /\___ |
5 // /_______ /|__| |__| (____ /__| (____ /\___ /|____//____ >
6 // \/ \/ \//_____/ \/
7 // ______________________ ______________________
8 // T H E W A R B E G I N S
9 // Stratagus - A free fantasy real time strategy game engine
10 //
12 //
13 // (c) Copyright 1999-2015 by Vladi Belperchinov-Shabanski, Jimmy Salmon
14 // and Andrettin
15 //
16 // This program is free software; you can redistribute it and/or modify
17 // it under the terms of the GNU General Public License as published by
18 // the Free Software Foundation; only version 2 of the License.
19 //
20 // This program is distributed in the hope that it will be useful,
21 // but WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 // GNU General Public License for more details.
24 //
25 // You should have received a copy of the GNU General Public License
26 // along with this program; if not, write to the Free Software
27 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
28 // 02111-1307, USA.
29 //
30 
31 #ifndef __UPGRADE_H__
32 #define __UPGRADE_H__
33 
35 
36 /*----------------------------------------------------------------------------
37 -- Declarations
38 ----------------------------------------------------------------------------*/
39 
40 class CFile;
41 class CPlayer;
42 class CUpgrade;
43 class CUnit;
44 class CUpgradeModifier;
45 
46 /*----------------------------------------------------------------------------
47 -- Variables
48 ----------------------------------------------------------------------------*/
49 
51 #define UPGRADE_MODIFIERS_MAX (UpgradeMax * 4)
52 
54 
55 extern int NumUpgradeModifiers;
56 
57 /*----------------------------------------------------------------------------
58 -- Functions
59 ----------------------------------------------------------------------------*/
60 
62 extern void InitUpgrades();
64 extern void SaveUpgrades(CFile &file);
66 extern void CleanUpgrades();
67 
69 extern void UpgradesCclRegister();
70 
71 /*----------------------------------------------------------------------------
72 -- General/Map functions
73 ----------------------------------------------------------------------------*/
74 
75 // AllowStruct and UpgradeTimers will be static in the player so will be
76 // load/saved with the player struct
77 
78 extern int UnitTypeIdByIdent(const std::string &sid);
79 extern int UpgradeIdByIdent(const std::string &sid);
80 
81 /*----------------------------------------------------------------------------
82 -- Upgrades
83 ----------------------------------------------------------------------------*/
84 
86 extern void UpgradeAcquire(CPlayer &player, const CUpgrade *upgrade);
88 extern void UpgradeLost(CPlayer &player, int id);
90 extern void ApplyUpgrades();
91 
92 extern void ApplyIndividualUpgradeModifier(CUnit &unit, const CUpgradeModifier *um);
93 extern void IndividualUpgradeAcquire(CUnit &unit, const CUpgrade *upgrade);
94 extern void IndividualUpgradeLost(CUnit &unit, const CUpgrade *upgrade);
95 
96 /*----------------------------------------------------------------------------
97 -- Allow(s)
98 ----------------------------------------------------------------------------*/
99 
100 // all the following functions are just map handlers, no specific notes
101 // id -- unit type id, af -- `A'llow/`F'orbid
102 
103 extern int UnitIdAllowed(const CPlayer &player, int id);
104 extern void AllowUpgradeId(CPlayer &player, int id, char af);
105 
106 extern char UpgradeIdAllowed(const CPlayer &player, int id);
107 extern char UpgradeIdentAllowed(const CPlayer &player, const std::string &ident);
108 
110 
111 #endif // !__UPGRADE_H__
CPlayer
Diplomacy states for CommandDiplomacy.
Definition: player.h:83
CleanUpgrades
void CleanUpgrades()
cleanup upgrade module
Definition: upgrade.cpp:183
NumUpgradeModifiers
int NumUpgradeModifiers
Number of upgrades modifiers used.
Definition: upgrade.cpp:73
UnitTypeIdByIdent
int UnitTypeIdByIdent(const std::string &sid)
Definition: upgrade.cpp:458
SaveUpgrades
void SaveUpgrades(CFile &file)
save the upgrades
Definition: upgrade.cpp:207
UpgradeIdAllowed
char UpgradeIdAllowed(const CPlayer &player, int id)
Definition: upgrade.cpp:1100
CUpgrade
Definition: upgrade_structs.h:154
UpgradeAcquire
void UpgradeAcquire(CPlayer &player, const CUpgrade *upgrade)
Upgrade will be acquired.
Definition: upgrade.cpp:935
InitUpgrades
void InitUpgrades()
init upgrade/allow structures
Definition: upgrade.cpp:176
IndividualUpgradeLost
void IndividualUpgradeLost(CUnit &unit, const CUpgrade *upgrade)
Make a unit acquire in individual upgrade.
Definition: upgrade.cpp:1027
UPGRADE_MODIFIERS_MAX
#define UPGRADE_MODIFIERS_MAX
How many upgrades modifiers supported.
Definition: upgrade.h:51
ApplyUpgrades
void ApplyUpgrades()
Apply researched upgrades when map is loading.
Definition: upgrade.cpp:985
UpgradesCclRegister
void UpgradesCclRegister()
Register CCL features for upgrades.
Definition: upgrade.cpp:438
UpgradeModifiers
CUpgradeModifier * UpgradeModifiers[UPGRADE_MODIFIERS_MAX]
The main user useable upgrades.
Definition: upgrade.cpp:71
UpgradeIdentAllowed
char UpgradeIdentAllowed(const CPlayer &player, const std::string &ident)
Definition: upgrade.cpp:1116
UpgradeLost
void UpgradeLost(CPlayer &player, int id)
Upgrade will be lost.
Definition: upgrade.cpp:962
IndividualUpgradeAcquire
void IndividualUpgradeAcquire(CUnit &unit, const CUpgrade *upgrade)
Apply upgrade modifier of an individual upgrade.
Definition: upgrade.cpp:1007
ApplyIndividualUpgradeModifier
void ApplyIndividualUpgradeModifier(CUnit &unit, const CUpgradeModifier *um)
Definition: upgrade.cpp:862
CUpgradeModifier
Definition: upgrade_structs.h:182
UnitIdAllowed
int UnitIdAllowed(const CPlayer &player, int id)
Make a unit lose in individual upgrade.
Definition: upgrade.cpp:1086
UpgradeIdByIdent
int UpgradeIdByIdent(const std::string &sid)
Definition: upgrade.cpp:475
AllowUpgradeId
void AllowUpgradeId(CPlayer &player, int id, char af)
Definition: upgrade.cpp:1072
CFile
Definition: iolib.h:102
CUnit
The big unit structure.
Definition: unit.h:135
(C) Copyright 1998-2012 by The Stratagus Project under the GNU General Public License.
All trademarks and copyrights on this page are owned by their respective owners.