-
Notifications
You must be signed in to change notification settings - Fork 0
/
location.h
114 lines (110 loc) · 4.62 KB
/
location.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef LOCATION_H
#define LOCATION_H
#include <QPoint>
#include "json_macros.h"
#include "item.h"
#include "person.h"
class Location {
QList<Item> ItemsForSale;
QList<unsigned> EventIDs;
QList<unsigned> ButtonEventIDs;
//QList<LocationAddress> LstLocationAddress;
QList<Gender> AllowedGenders;
QHash<QString, Person> Occupants;
int lastSelectorTimestamp;
//readonly object occupantLock;
//readonly object pickupLock;
//QHash<Gender, WeightedRandomizer<Location>> locationSelector;
//object updateLocSelectorLock;
//QList<LocationJobDetails> AssociatedJobs;
public:
enum class RoomPopWeight
{
VerySparse = 1,
Sparse,
Normal = 5,
Crowded = 10,
VeryCrowded = 25
};
QString Name;
QString DisplayName;
QString Description;
//Region region;
QPoint worldEditorCoords;
bool IsIndoors;
bool IsClassroom;
OutfitType SpecialOutfit;
int TimeToCrossRoom;
QString Imagelocation;
bool Built;
//VisualEvent LocationMasterEvent;
QString RoomEventsLocation;
QString RoomSharedEventsLocation;
bool CanExitToWorldMap;
int SecurityLevel;
QString KeyName;
bool Known;
//InventoryCollection Inventory;
//PeopleAmount VisitFrequency;
//LocationModifierCollection LocationModifiers;
//LocationPropertyChange PropertyChange;
const QString get_InventoryName() const
{
return DisplayName.isEmpty() ? Name : DisplayName;
}
/*const SchoolSubject get_CurrentSubject() const
{
QHash<int, QString>::iterator it;
for (it = Game.ClassAssignments.AssignedClassrooms.begin();
it != Game.ClassAssignments.AssignedClassrooms.end(); ++it) {
subj = Game.ClassAssignments.AssignedClassrooms[it.Current];
if (subj.equals(Name))
return subj;
}
return NULL;
}*/
Location(QJsonObject *d = NULL)
{
if (d) init(d);
}
void init(QJsonObject *d)
{
for (QJsonObject::iterator it = d->begin(); it != d->end(); ++it) {
__IF_VAR_FROM_JSON_AS(it, Name, toString)
else __IF_VAR_FROM_JSON_AS(it, DisplayName, toString)
else __IF_VAR_FROM_JSON_AS(it, Description, toString)
//else __IF_OBJ_FROM_JSON_AS(it, Region)
else __IF_VAR_FROM_JSON_AS(it, IsIndoors, toBool)
else __IF_VAR_FROM_JSON_AS(it, IsClassroom, toBool)
else __IF_ENUM_FROM_JSON_AS(it, SpecialOutfit, OutfitType)
else __IF_VAR_FROM_JSON_AS(it, TimeToCrossRoom, toInt)
else __IF_VAR_FROM_JSON_AS(it, Imagelocation, toString)
else __IF_VAR_FROM_JSON_AS(it, Built, toBool)
//else __IF_OBJLIST_FROM_JSON(it, AssociatedJobs, LocationJobDetails)
//else __IF_OBJ_FROM_JSON_AS(it, LocationMasterEvent)
else __IF_VAR_FROM_JSON_AS(it, RoomEventsLocation, toString)
else __IF_VAR_FROM_JSON_AS(it, RoomSharedEventsLocation, toString)
else __IF_VAR_FROM_JSON_AS(it, CanExitToWorldMap, toBool)
else __IF_VAR_FROM_JSON_AS(it, SecurityLevel, toInt)
else __IF_VAR_FROM_JSON_AS(it, KeyName, toString)
else __IF_VAR_FROM_JSON_AS(it, Known, toBool)
else __IF_OBJLIST_FROM_JSON(it, ItemsForSale, Item)
//else __IF_OBJ_FROM_JSON_AS(it, Inventory)
else __IF_LIST_FROM_JSON_TYPED(it, EventIDs, toInt)
else __IF_LIST_FROM_JSON_TYPED(it, ButtonEventIDs, toInt)
//else __IF_OBJLIST_FROM_JSON(it, LstLocationAddress, LocationAddress)
//else __IF_OBJ_FROM_JSON_AS(it, VisitFrequency)
else __IF_LIST_FROM_JSON_ENUM(it, AllowedGenders, Gender)
//else __IF_OBJ_FROM_JSON_AS(it, LocationModifiers)
//else __IF_OBJ_FROM_JSON_AS(it, PropertyChange)
//else __IF_OBJ_FROM_JSON_AS(it, worldEditorCoords)
//QHash<QString, Person> Occupants
//else __IF_OBJ_FROM_JSON_AS(it, occupantLock)
//else __IF_OBJ_FROM_JSON_AS(it, pickupLock)
// QHash<Gender, WeightedRandomizer<Location>> locationSelector
else __IF_VAR_FROM_JSON_AS(it, lastSelectorTimestamp, toInt)
//else __IF_OBJ_FROM_JSON_AS(it, updateLocSelectorLock)
}
}
};
#endif // LOCATION_H