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

action_repair.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_REPAIR_H__
31 #define __ACTION_REPAIR_H__
32 
33 #include "actions.h"
34 
36 
37 class COrder_Repair : public COrder
38 {
39  friend COrder *COrder::NewActionRepair(CUnit &unit, CUnit &target);
40  friend COrder *COrder::NewActionRepair(const Vec2i &pos);
41 public:
42  COrder_Repair() : COrder(UnitActionRepair), State(0), RepairCycle(0)
43  {
44  goalPos.x = -1;
45  goalPos.y = -1;
46  }
47 
48  virtual COrder_Repair *Clone() const { return new COrder_Repair(*this); }
49 
50  virtual bool IsValid() const;
51 
52  virtual void Save(CFile &file, const CUnit &unit) const;
53  virtual bool ParseSpecificData(lua_State *l, int &j, const char *value, const CUnit &unit);
54 
55  virtual void Execute(CUnit &unit);
56  virtual PixelPos Show(const CViewport &vp, const PixelPos &lastScreenPos) const;
57  virtual void UpdatePathFinderData(PathFinderInput &input);
58 
59  const CUnitPtr &GetReparableTarget() const { return ReparableTarget; }
60  virtual const Vec2i GetGoalPos() const;
61 private:
62  bool RepairUnit(const CUnit &unit, CUnit &goal);
63 private:
64  CUnitPtr ReparableTarget;
65  unsigned int State;
66  unsigned int RepairCycle;
67  Vec2i goalPos;
68 };
69 
70 
72 
73 #endif // !__ACTION_REPAIR_H__
COrder_Repair::IsValid
virtual bool IsValid() const
Definition: action_repair.cpp:127
CUnitPtr
Definition: unitptr.h:41
COrder_Repair::Save
virtual void Save(CFile &file, const CUnit &unit) const
Definition: action_repair.cpp:81
COrder
Definition: actions.h:94
Vec2T::y
T y
Definition: vec2i.h:43
CViewport
Definition: viewport.h:63
COrder_Repair::GetReparableTarget
const CUnitPtr & GetReparableTarget() const
Definition: action_repair.h:59
Vec2T< short int >
COrder_Repair
Definition: action_repair.h:37
COrder_Repair::Show
virtual PixelPos Show(const CViewport &vp, const PixelPos &lastScreenPos) const
Definition: action_repair.cpp:132
COrder_Repair::UpdatePathFinderData
virtual void UpdatePathFinderData(PathFinderInput &input)
Definition: action_repair.cpp:147
PathFinderInput
Definition: pathfinder.h:67
UnitActionRepair
@ UnitActionRepair
unit explores map
Definition: actions.h:75
actions.h
COrder_Repair::GetGoalPos
virtual const Vec2i GetGoalPos() const
Definition: action_repair.cpp:325
COrder_Repair::ParseSpecificData
virtual bool ParseSpecificData(lua_State *l, int &j, const char *value, const CUnit &unit)
Definition: action_repair.cpp:103
COrder_Repair::COrder_Repair
COrder_Repair()
Definition: action_repair.h:42
COrder_Repair::Execute
virtual void Execute(CUnit &unit)
Definition: action_repair.cpp:238
COrder_Repair::Clone
virtual COrder_Repair * Clone() const
Definition: action_repair.h:48
COrder::NewActionRepair
static COrder * NewActionRepair(CUnit &unit, CUnit &target)
Definition: action_repair.cpp:58
Vec2T::x
T x
Definition: vec2i.h:42
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.