freg  0.3
Free-Roaming Elementary Game
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
DeferredAction.h
Go to the documentation of this file.
1  /* freg, Free-Roaming Elementary Game with open and interactive world
2  * Copyright (C) 2012-2014 Alexander 'mmaulwurff' Kromm
3  * mmaulwurff@gmail.com
4  *
5  * This file is part of FREG.
6  *
7  * FREG is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * FREG is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with FREG. If not, see <http://www.gnu.org/licenses/>. */
19 
20 #ifndef DEFERRED_ACTION_H
21 #define DEFERRED_ACTION_H
22 
23 #include "Xyz.h"
24 
35 };
36 
37 class Block;
38 class Animal;
39 class World;
40 
41 class DeferredAction final : private Xyz {
42  /** \class DeferredAction DeferredAction.h
43  * \brief Deferred Action is used when some action needs to be done at
44  * next physics turn.
45  *
46  * Xyz is action target coordinates. */
47 public:
48  explicit DeferredAction(Animal * attached);
49  DeferredAction & operator=(const DeferredAction &) = delete;
50  DeferredAction(const DeferredAction &) = delete;
51 
52  void SetGhostMove(int dir);
53  void SetMove(int dir);
54  void SetJump();
55  void SetDamage (int x, int y, int z);
56  void SetPour (int x, int y, int z, int slot);
57  void SetSetFire(int x, int y, int z);
58  /// Attached block should have inventory.
59  void SetBuild (int x, int y, int z, int builder_slot);
60  void SetThrow (int x, int y, int z,
61  int src_slot, int dest_slot, int unum);
62 
63  int GetActionType() const;
64  void MakeAction() const;
65 
66 private:
70  int num;
71 
72  void GhostMove() const;
73  void Move() const;
74  void Jump() const;
75  void Build() const;
76  void Damage() const;
77  void Throw() const;
78  void Pour() const;
79  void SetFire() const;
80 };
81 
82 #endif // DEFERRED_ACTION_H
void Pour() const
void Throw() const
DeferredAction & operator=(const DeferredAction &)=delete
void MakeAction() const
World provides global physics and shred connection.
Definition: World.h:52
int GetActionType() const
deferred_actions type
void SetSetFire(int x, int y, int z)
Deferred Action is used when some action needs to be done at next physics turn.
void SetMove(int dir)
void SetDamage(int x, int y, int z)
void SetFire() const
Definition: Animal.h:27
deferred_actions
void SetThrow(int x, int y, int z, int src_slot, int dest_slot, int unum)
void GhostMove() const
void SetBuild(int x, int y, int z, int builder_slot)
Attached block should have inventory.
void Build() const
Definition: Xyz.h:35
void SetGhostMove(int dir)
void Move() const
void Jump() const
Animal *const attachedBlock
DeferredAction(Animal *attached)
void Damage() const
Block without special physics and attributes.
Definition: Block.h:89
void SetPour(int x, int y, int z, int slot)