Fission FSN
Loading...
Searching...
No Matches
gfCParkPlacementComponent.h
Go to the documentation of this file.
1/********************************************************************
2*
3* File: gfCParkPlacementComponent.h
4*
5* Purpose: Transient "tycoon build" placement mode. Lives on its own
6* short-lived entity, spawned by gfCPurchaseActionDecorationPlace
7* after a decoration is bought. The purchased art follows the
8* pointer, snaps to the map grid and is tinted red while its
9* footprint is illegal. A valid tap drops it and destroys the
10* entity - one placement per purchase.
11*
12* Decorations do not create service slots, but their asset-defined
13* appeal contributes to the park's visitor demand after placement.
14*
15*********************************************************************/
16
17#ifndef gfCParkPlacementComponenthdr
18#define gfCParkPlacementComponenthdr
19
21#include <fsCore/fsStr.h>
22
24
25class fsCEntity;
26struct fsPoint;
27
28
30{
31 friend class fsCComponentFactory;
32
33public:
34
35 static const fsCUniqueId mTypeId;
36
37 // The decoration art to preview and drop on the next valid grid cell. Called
38 // right after componentAdd.
39 void placementBegin(const fsStr& pDecorationImage, fsS32 pDrawWidth,
40 fsS32 pFootprintColumns, fsS32 pFootprintRows,
41 fsS32 pItemCost, fsS32 pVisitorAppeal = 0,
42 fsS32 pVisitorComfort = 0);
43
44 // Asset-defined service building: the next tap creates a persistent runtime
45 // slot at that point instead of a cosmetic decoration. The footprint is in
46 // map tiles and controls which grid anchor the placement snaps to.
47 void buildingPlacementBegin(const fsStr& pImage, const fsStr& pServiceType,
48 fsS32 pServiceTimeMs, fsS32 pMaxQueueLength, fsS32 pDrawWidth,
49 fsS32 pFootprintColumns, fsS32 pFootprintRows,
50 fsS32 pItemCost, fsS32 pVisitorQuota = 0,
51 fsS32 pVisitorAppeal = 0);
52
53 // Explicitly cancel the current tool when the HUD build toggle is switched
54 // off. No cost is charged until a placement actually succeeds.
55 void placementEnd();
56
58
59protected:
60
61 void listenersRegisterDo() override;
62 void listenersDeregisterDo() override;
63 fsBool messageProcessDo(const fsCUniqueId& pMessageType,
64 const fsIMessageDispatcher::sMessageParameters& pParam) override;
65
66 static fsIComponent* const create(fsCEntity* const pParent);
68
69private:
70
71 void placementPreviewCreate();
72 fsBool placementPreviewUpdate(const fsPoint& pScreenPos);
73 void placementPreviewDestroy();
74
75 enum class eMode
76 {
77 eDecoration,
78 eServiceBuilding
79 };
80
81 eMode mMode;
82 fsStr mDecorationImage;
83 fsStr mBuildingServiceType;
84 fsS32 mBuildingServiceTimeMs;
85 fsS32 mBuildingMaxQueueLength;
86 fsS32 mBuildingVisitorQuota;
87 fsS32 mBuildingVisitorAppeal;
88 fsS32 mDecorationVisitorAppeal;
89 fsS32 mDecorationVisitorComfort;
90 fsS32 mDrawWidth;
91 fsS32 mFootprintColumns;
92 fsS32 mFootprintRows;
93 fsS32 mItemCost;
94 fsCEntity* mPlacementPreviewEntity;
95 fsS32 mSnappedLocalX;
96 fsS32 mSnappedLocalY;
97 fsBool mPlacementValid;
98};
99
100#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 placementBegin(const fsStr &pDecorationImage, fsS32 pDrawWidth, fsS32 pFootprintColumns, fsS32 pFootprintRows, fsS32 pItemCost, fsS32 pVisitorAppeal=0, fsS32 pVisitorComfort=0)
Definition gfCParkPlacementComponent.cpp:131
void buildingPlacementBegin(const fsStr &pImage, const fsStr &pServiceType, fsS32 pServiceTimeMs, fsS32 pMaxQueueLength, fsS32 pDrawWidth, fsS32 pFootprintColumns, fsS32 pFootprintRows, fsS32 pItemCost, fsS32 pVisitorQuota=0, fsS32 pVisitorAppeal=0)
Definition gfCParkPlacementComponent.cpp:148
void listenersDeregisterDo() override
Definition gfCParkPlacementComponent.cpp:374
friend class fsCComponentFactory
Definition gfCParkPlacementComponent.h:31
gfCParkPlacementComponent(fsCEntity *const pParent)
Definition gfCParkPlacementComponent.cpp:386
static fsIComponent *const create(fsCEntity *const pParent)
Definition gfCParkPlacementComponent.cpp:381
void placementEnd()
Definition gfCParkPlacementComponent.cpp:169
fsBool messageProcessDo(const fsCUniqueId &pMessageType, const fsIMessageDispatcher::sMessageParameters &pParam) override
Definition gfCParkPlacementComponent.cpp:279
static const fsCUniqueId mTypeId
Definition gfCParkPlacementComponent.h:35
void listenersRegisterDo() override
Definition gfCParkPlacementComponent.cpp:367
virtual ~gfCParkPlacementComponent()
Definition gfCParkPlacementComponent.cpp:406
bool fsBool
Definition fsBaseTypes.h:26
int fsS32
Definition fsBaseTypes.h:20
Definition fsIMessageDispatcher.h:32
Definition fsPoint.h:17