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

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
action_upgradeto.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 1998-2012 by Lutz Sammer and Jimmy Salmon
14 //
15 // This program is free software; you can redistribute it and/or modify
16 // it under the terms of the GNU General Public License as published by
17 // the Free Software Foundation; only version 2 of the License.
18 //
19 // This program is distributed in the hope that it will be useful,
20 // but WITHOUT ANY WARRANTY; without even the implied warranty of
21 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 // GNU General Public License for more details.
23 //
24 // You should have received a copy of the GNU General Public License
25 // along with this program; if not, write to the Free Software
26 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27 // 02111-1307, USA.
28 //
29 
30 #ifndef __ACTION_UPGRADETO_H__
31 #define __ACTION_UPGRADETO_H__
32 
33 #include "actions.h"
34 
36 
38 {
40 public:
42 
43  virtual COrder_TransformInto *Clone() const { return new COrder_TransformInto(*this); }
44 
45  virtual bool IsValid() const;
46 
47  virtual void Save(CFile &file, const CUnit &unit) const;
48  virtual bool ParseSpecificData(lua_State *l, int &j, const char *value, const CUnit &unit);
49 
50  virtual void Execute(CUnit &unit);
51  virtual PixelPos Show(const CViewport &vp, const PixelPos &lastScreenPos) const;
53 
54 private:
55  CUnitType *Type;
56 };
57 
58 
59 class COrder_UpgradeTo : public COrder
60 {
61  friend COrder *COrder::NewActionUpgradeTo(CUnit &unit, CUnitType &type);
62 public:
63  COrder_UpgradeTo() : COrder(UnitActionUpgradeTo), Type(NULL), Ticks(0) {}
64 
65  virtual COrder_UpgradeTo *Clone() const { return new COrder_UpgradeTo(*this); }
66 
67  virtual bool IsValid() const;
68 
69  virtual void Save(CFile &file, const CUnit &unit) const;
70  virtual bool ParseSpecificData(lua_State *l, int &j, const char *value, const CUnit &unit);
71 
72  virtual void Execute(CUnit &unit);
73  virtual void Cancel(CUnit &unit);
74  virtual PixelPos Show(const CViewport &vp, const PixelPos &lastScreenPos) const;
76 
77  virtual void UpdateUnitVariables(CUnit &unit) const;
78 
79  const CUnitType &GetUnitType() const { return *Type; }
80 private:
81  CUnitType *Type;
82  int Ticks;
83 };
84 
85 #endif // !__ACTIONS_H__
virtual COrder_TransformInto * Clone() const
Definition: action_upgradeto.h:43
virtual void Execute(CUnit &unit)
Definition: action_upgradeto.cpp:209
virtual void UpdatePathFinderData(PathFinderInput &input)
Definition: action_upgradeto.h:52
Definition: actions.h:93
virtual void UpdateUnitVariables(CUnit &unit) const
Definition: action_upgradeto.cpp:305
virtual bool ParseSpecificData(lua_State *l, int &j, const char *value, const CUnit &unit)
Definition: action_upgradeto.cpp:186
The big unit structure.
Definition: unit.h:119
Definition: pathfinder.h:67
virtual void Cancel(CUnit &unit)
Definition: action_upgradeto.cpp:298
const CUnitType & GetUnitType() const
Definition: action_upgradeto.h:79
static COrder * NewActionTransformInto(CUnitType &type)
Definition: action_upgradeto.cpp:59
COrder_UpgradeTo()
Definition: action_upgradeto.h:63
virtual PixelPos Show(const CViewport &vp, const PixelPos &lastScreenPos) const
Definition: action_upgradeto.cpp:203
Definition: action_upgradeto.h:59
virtual void Save(CFile &file, const CUnit &unit) const
Definition: action_upgradeto.cpp:176
Definition: viewport.h:63
Definition: unittype.h:467
Definition: iolib.h:101
unit harvesting resources
Definition: actions.h:76
Definition: action_upgradeto.h:37
virtual void Execute(CUnit &unit)
Definition: action_upgradeto.cpp:262
void UpdatePathFinderData_NotCalled(PathFinderInput &input)
Definition: actions.cpp:102
virtual bool IsValid() const
Definition: action_upgradeto.cpp:197
COrder_TransformInto()
Definition: action_upgradeto.h:41
static COrder * NewActionUpgradeTo(CUnit &unit, CUnitType &type)
Definition: action_upgradeto.cpp:67
virtual bool IsValid() const
Definition: action_upgradeto.cpp:244
virtual void UpdatePathFinderData(PathFinderInput &input)
Definition: action_upgradeto.h:75
virtual bool ParseSpecificData(lua_State *l, int &j, const char *value, const CUnit &unit)
Definition: action_upgradeto.cpp:230
building is training
Definition: actions.h:64
virtual PixelPos Show(const CViewport &vp, const PixelPos &lastScreenPos) const
Definition: action_upgradeto.cpp:249
virtual COrder_UpgradeTo * Clone() const
Definition: action_upgradeto.h:65
virtual void Save(CFile &file, const CUnit &unit) const
Definition: action_upgradeto.cpp:219
(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.