Fission FSN
Loading...
Searching...
No Matches
gfCParkClearComponent.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: gfCParkClearComponent.h
4*
5* Purpose: Transient "clear forest" tool. Lives on its own short-lived
6* entity, spawned by gfCParkHudGui when the player arms the clear
7* tool. Markers show the forest cells that a tap will clear.
8* The tool stays armed until the HUD toggles it off.
9*
10*********************************************************************/
11
12#ifndef gfCParkClearComponenthdr
13#define gfCParkClearComponenthdr
14
15#include <vector>
16
18
20
21class fsCEntity;
22struct fsPoint;
23
24
26{
27 friend class fsCComponentFactory;
28
29public:
30
31 static const fsCUniqueId mTypeId;
32
33 // Arm the tool and show the hover marker. Called right after componentAdd.
34 void clearBegin();
35
36 // Cancel the tool when the HUD clear toggle is switched off. Destroys the
37 // marker and this component's host entity - clearing already persisted per tap.
38 void clearEnd();
39
40 virtual ~gfCParkClearComponent();
41
42protected:
43
44 void listenersRegisterDo() override;
45 void listenersDeregisterDo() override;
46 fsBool messageProcessDo(const fsCUniqueId& pMessageType,
47 const fsIMessageDispatcher::sMessageParameters& pParam) override;
48
49 static fsIComponent* const create(fsCEntity* const pParent);
50 gfCParkClearComponent(fsCEntity* const pParent);
51
52private:
53
54 void previewCreate();
55 void previewDestroy();
56 // Recompute the hovered cell and marker colour for a screen position. Returns
57 // true when the brush has affordable forest tiles to clear.
58 fsBool previewUpdate(const fsPoint& pScreenPos);
59
60 std::vector<fsCEntity*> mPreviewEntities;
61 fsS32 mHoverCol;
62 fsS32 mHoverRow;
63};
64
65#endif
Definition fsCEntity.h:39
Definition fsCUniqueId.h:21
fsIComponent(fsCEntity *pParent)
Definition fsIComponent.cpp:86
fsIMessageListenerComponent(fsCEntity *pParent)
Definition fsIMessageListenerComponent.cpp:9
void clearEnd()
Definition gfCParkClearComponent.cpp:92
static fsIComponent *const create(fsCEntity *const pParent)
Definition gfCParkClearComponent.cpp:239
fsBool messageProcessDo(const fsCUniqueId &pMessageType, const fsIMessageDispatcher::sMessageParameters &pParam) override
Definition gfCParkClearComponent.cpp:185
static const fsCUniqueId mTypeId
Definition gfCParkClearComponent.h:31
friend class fsCComponentFactory
Definition gfCParkClearComponent.h:27
void listenersDeregisterDo() override
Definition gfCParkClearComponent.cpp:232
void listenersRegisterDo() override
Definition gfCParkClearComponent.cpp:225
virtual ~gfCParkClearComponent()
Definition gfCParkClearComponent.cpp:251
gfCParkClearComponent(fsCEntity *const pParent)
Definition gfCParkClearComponent.cpp:244
void clearBegin()
Definition gfCParkClearComponent.cpp:86
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsIMessageDispatcher.h:32
Definition fsPoint.h:17