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

action_train.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_TRAIN_H__
31 #define __ACTION_TRAIN_H__
32 
33 #include "actions.h"
34 
36 
37 class COrder_Train : public COrder
38 {
39  friend COrder *COrder::NewActionTrain(CUnit &trainer, CUnitType &type);
40 public:
41  COrder_Train() : COrder(UnitActionTrain), Type(NULL), Ticks(0) {}
42 
43  virtual COrder_Train *Clone() const { return new COrder_Train(*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  virtual void UpdateUnitVariables(CUnit &unit) const;
55 
56  void ConvertUnitType(const CUnit &unit, CUnitType &newType);
57 
58  const CUnitType &GetUnitType() const { return *Type; }
59 private:
60  CUnitType *Type;
61  int Ticks;
62 };
63 
65 
66 #endif // !__ACTION_TRAIN_H__
COrder_Train::ConvertUnitType
void ConvertUnitType(const CUnit &unit, CUnitType &newType)
Definition: action_train.cpp:122
UnitActionTrain
@ UnitActionTrain
unit casts spell
Definition: actions.h:63
COrder
Definition: actions.h:94
CViewport
Definition: viewport.h:63
CUnitType
Definition: unittype.h:508
Vec2T
Definition: vec2i.h:36
COrder_Train::IsValid
virtual bool IsValid() const
Definition: action_train.cpp:95
PathFinderInput
Definition: pathfinder.h:67
actions.h
COrder_Train::Cancel
virtual void Cancel(CUnit &unit)
Definition: action_train.cpp:106
COrder_Train
Definition: action_train.h:37
COrder_Train::ParseSpecificData
virtual bool ParseSpecificData(lua_State *l, int &j, const char *value, const CUnit &unit)
Definition: action_train.cpp:81
COrder_Train::UpdateUnitVariables
virtual void UpdateUnitVariables(CUnit &unit) const
Definition: action_train.cpp:114
COrder_Train::Save
virtual void Save(CFile &file, const CUnit &unit) const
Definition: action_train.cpp:70
COrder_Train::GetUnitType
const CUnitType & GetUnitType() const
Definition: action_train.h:58
COrder::UpdatePathFinderData_NotCalled
void UpdatePathFinderData_NotCalled(PathFinderInput &input)
Definition: actions.cpp:114
COrder_Train::UpdatePathFinderData
virtual void UpdatePathFinderData(PathFinderInput &input)
Definition: action_train.h:53
COrder_Train::Execute
virtual void Execute(CUnit &unit)
Definition: action_train.cpp:177
COrder_Train::Show
virtual PixelPos Show(const CViewport &vp, const PixelPos &lastScreenPos) const
Definition: action_train.cpp:100
COrder_Train::Clone
virtual COrder_Train * Clone() const
Definition: action_train.h:43
COrder::NewActionTrain
static COrder * NewActionTrain(CUnit &trainer, CUnitType &type)
Definition: action_train.cpp:59
CFile
Definition: iolib.h:102
CUnit
The big unit structure.
Definition: unit.h:135
COrder_Train::COrder_Train
COrder_Train()
Definition: action_train.h:41
(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.