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

action_built.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_BUILT_H__
31 #define __ACTION_BUILT_H__
32 
33 #include "actions.h"
34 
36 
37 class COrder_Built : public COrder
38 {
39  friend COrder *COrder::NewActionBuilt(CUnit &builder, CUnit &unit);
40 public:
41  COrder_Built() : COrder(UnitActionBuilt), ProgressCounter(0), IsCancelled(false), Frame(NULL) {}
42 
43  virtual COrder_Built *Clone() const { return new COrder_Built(*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 void Cancel(CUnit &unit);
52  virtual PixelPos Show(const CViewport &vp, const PixelPos &lastScreenPos) const;
54 
55  virtual void UpdateUnitVariables(CUnit &unit) const;
56  virtual void FillSeenValues(CUnit &unit) const;
57  virtual void AiUnitKilled(CUnit &unit);
58 
59  void Progress(CUnit &unit, int amount);
60  void ProgressHp(CUnit &unit, int amount);
61 
62  const CConstructionFrame &GetFrame() const { return *Frame; }
63  const CUnitPtr &GetWorker() const { return Worker; }
64  CUnit *GetWorkerPtr() { return Worker; }
65 
66 private:
67  void Boost(CUnit &building, int amount, int varIndex) const;
68  void UpdateConstructionFrame(CUnit &unit);
69 
70 private:
71  CUnitPtr Worker;
72  int ProgressCounter;
73  bool IsCancelled;
74  const CConstructionFrame *Frame;
75 };
76 
78 
79 #endif // !__ACTION_BUILT_H__
COrder_Built::UpdateUnitVariables
virtual void UpdateUnitVariables(CUnit &unit) const
Definition: action_built.cpp:294
COrder_Built::AiUnitKilled
virtual void AiUnitKilled(CUnit &unit)
Definition: action_built.cpp:316
COrder_Built::ProgressHp
void ProgressHp(CUnit &unit, int amount)
Definition: action_built.cpp:370
CUnitPtr
Definition: unitptr.h:41
COrder_Built::COrder_Built
COrder_Built()
Definition: action_built.h:41
COrder
Definition: actions.h:94
COrder_Built::GetWorkerPtr
CUnit * GetWorkerPtr()
Definition: action_built.h:64
COrder_Built
Definition: action_built.h:37
CViewport
Definition: viewport.h:63
Vec2T
Definition: vec2i.h:36
COrder_Built::Save
virtual void Save(CFile &file, const CUnit &unit) const
Definition: action_built.cpp:74
COrder_Built::Cancel
virtual void Cancel(CUnit &unit)
Definition: action_built.cpp:289
PathFinderInput
Definition: pathfinder.h:67
COrder_Built::GetFrame
const CConstructionFrame & GetFrame() const
Definition: action_built.h:62
COrder_Built::Show
virtual PixelPos Show(const CViewport &vp, const PixelPos &lastScreenPos) const
Definition: action_built.cpp:127
actions.h
COrder_Built::ParseSpecificData
virtual bool ParseSpecificData(lua_State *l, int &j, const char *value, const CUnit &unit)
Definition: action_built.cpp:96
COrder_Built::Execute
virtual void Execute(CUnit &unit)
Definition: action_built.cpp:253
COrder_Built::UpdatePathFinderData
virtual void UpdatePathFinderData(PathFinderInput &input)
Definition: action_built.h:53
COrder_Built::FillSeenValues
virtual void FillSeenValues(CUnit &unit) const
Definition: action_built.cpp:307
COrder::NewActionBuilt
static COrder * NewActionBuilt(CUnit &builder, CUnit &unit)
Definition: action_built.cpp:55
COrder_Built::Progress
void Progress(CUnit &unit, int amount)
Definition: action_built.cpp:361
COrder_Built::GetWorker
const CUnitPtr & GetWorker() const
Definition: action_built.h:63
CConstructionFrame
Construction frame.
Definition: construct.h:112
COrder_Built::IsValid
virtual bool IsValid() const
Definition: action_built.cpp:122
COrder::UpdatePathFinderData_NotCalled
void UpdatePathFinderData_NotCalled(PathFinderInput &input)
Definition: actions.cpp:114
UnitActionBuilt
@ UnitActionBuilt
building is researching spell
Definition: actions.h:66
COrder_Built::Clone
virtual COrder_Built * Clone() const
Definition: action_built.h:43
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.