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 deploys/recalls
6* staff to its slot (or dispatches a repairer - see
7* toggleStaffing). Also tints the building by state.
8* A small message listener rather than a HOG collectable
9* subclass, whose machinery doesn't apply here.
10*
11*********************************************************************/
12
13#ifndef gfCParkSlotStaffComponenthdr
14#define gfCParkSlotStaffComponenthdr
15
17#include <fsCore/fsStr.h>
18
20
21struct fsPoint;
22
24{
25 friend class fsCComponentFactory;
26
27public:
28
29 static const fsCUniqueId mTypeId;
30
31 // Called right after componentAdd() by whatever placed the building.
32 void slotNameSet(const fsStr& pSlotName);
33
35
36protected:
37
38 // Drives tintRefresh() - state changes (break/repair) are on the sim's
39 // schedule, not the player's, so the tint can't be tap-only.
40 void updateDo(fsS32 pDeltaMs) override;
41
42 void listenersRegisterDo() override;
43 void listenersDeregisterDo() override;
44 fsBool messageProcessDo(const fsCUniqueId& pMessageType,
45 const fsIMessageDispatcher::sMessageParameters& pParam) override;
46
47 static fsIComponent* const create(fsCEntity* const pParent);
49
50private:
51
52 fsBool hitTest(const fsPoint& pPointerPos) const;
53 void toggleStaffing();
54
55 // Applies the state colour, only on change (runs every frame).
56 void tintRefresh();
57
58 fsStr mSlotName;
59
60 // Last state the tint was applied for; -1 until the first refresh.
61 fsS32 mTintState;
62};
63
64#endif
Definition fsCEntity.h:39
Definition fsCUniqueId.h:21
fsIComponent(fsCEntity *pParent)
Definition fsIComponent.cpp:86
fsIMessageListenerComponent(fsCEntity *pParent)
Definition fsIMessageListenerComponent.cpp:9
Definition fsStr.h:23
void slotNameSet(const fsStr &pSlotName)
Definition gfCParkSlotStaffComponent.cpp:18
void updateDo(fsS32 pDeltaMs) override
Definition gfCParkSlotStaffComponent.cpp:35
friend class fsCComponentFactory
Definition gfCParkSlotStaffComponent.h:25
fsBool messageProcessDo(const fsCUniqueId &pMessageType, const fsIMessageDispatcher::sMessageParameters &pParam) override
Definition gfCParkSlotStaffComponent.cpp:134
static fsIComponent *const create(fsCEntity *const pParent)
Definition gfCParkSlotStaffComponent.cpp:161
gfCParkSlotStaffComponent(fsCEntity *const pParent)
Definition gfCParkSlotStaffComponent.cpp:166
void listenersDeregisterDo() override
Definition gfCParkSlotStaffComponent.cpp:155
static const fsCUniqueId mTypeId
Definition gfCParkSlotStaffComponent.h:29
virtual ~gfCParkSlotStaffComponent()
Definition gfCParkSlotStaffComponent.cpp:173
void listenersRegisterDo() override
Definition gfCParkSlotStaffComponent.cpp:149
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsIMessageDispatcher.h:32
Definition fsPoint.h:17