Fission FSN
Loading...
Searching...
No Matches
gfCParkSlotStaffComponent.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: gfCParkSlotStaffComponent.h
4*
5* Purpose: Attached to a placed building; a tap opens its info panel
6* (deploy/recall staff happens from a button there), unless
7* the tap is an instant repair action - see tapHandle().
8* Also tints the building by state. A small message listener
9* rather than a HOG collectable subclass, whose machinery
10* doesn't apply here.
11*
12*********************************************************************/
13
14#ifndef gfCParkSlotStaffComponenthdr
15#define gfCParkSlotStaffComponenthdr
16
18#include <fsCore/fsStr.h>
19
21
22struct fsPoint;
23
25{
26 friend class fsCComponentFactory;
27
28public:
29
30 static const fsCUniqueId mTypeId;
31
32 // Called right after componentAdd() by whatever placed the building.
33 void slotNameSet(const fsStr& pSlotName);
34 void buildingImageSet(const fsStr& pImage) { mBuildingImage = pImage; }
35
37
38protected:
39
40 // Drives tintRefresh() - state changes (break/repair) are on the sim's
41 // schedule, not the player's, so the tint can't be tap-only.
42 void updateDo(fsS32 pDeltaMs) override;
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);
51
52private:
53
54 fsBool hitTest(const fsPoint& pPointerPos) const;
55 void tapHandle();
56 void infoPanelOpen();
57
58 // Applies the state colour, only on change (runs every frame).
59 void tintRefresh();
60
61 fsStr mSlotName;
62 fsStr mBuildingImage;
63
64 // Last state the tint was applied for; -1 until the first refresh.
65 fsS32 mTintState;
66};
67
68#endif
Definition fsCEntity.h:39
Definition fsCUniqueId.h:21
Definition fsIComponent.h:26
fsIMessageListenerComponent(fsCEntity *pParent)
Definition fsIMessageListenerComponent.cpp:9
Definition fsStr.h:23
void buildingImageSet(const fsStr &pImage)
Definition gfCParkSlotStaffComponent.h:34
void slotNameSet(const fsStr &pSlotName)
Definition gfCParkSlotStaffComponent.cpp:25
void updateDo(fsS32 pDeltaMs) override
Definition gfCParkSlotStaffComponent.cpp:42
friend class fsCComponentFactory
Definition gfCParkSlotStaffComponent.h:26
fsBool messageProcessDo(const fsCUniqueId &pMessageType, const fsIMessageDispatcher::sMessageParameters &pParam) override
Definition gfCParkSlotStaffComponent.cpp:188
static fsIComponent *const create(fsCEntity *const pParent)
Definition gfCParkSlotStaffComponent.cpp:215
gfCParkSlotStaffComponent(fsCEntity *const pParent)
Definition gfCParkSlotStaffComponent.cpp:220
void listenersDeregisterDo() override
Definition gfCParkSlotStaffComponent.cpp:209
static const fsCUniqueId mTypeId
Definition gfCParkSlotStaffComponent.h:30
virtual ~gfCParkSlotStaffComponent()
Definition gfCParkSlotStaffComponent.cpp:227
void listenersRegisterDo() override
Definition gfCParkSlotStaffComponent.cpp:203
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsIMessageDispatcher.h:32
Definition fsPoint.h:17