forked from AdrienTD/c47edit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
classInfo.h
52 lines (39 loc) · 1.44 KB
/
classInfo.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
// c47edit - Scene editor for HM C47
// Copyright (C) 2018-2022 AdrienTD
// Licensed under the GPL3+.
// See LICENSE file for more details.
#pragma once
#include <map>
#include <string>
#include <string_view>
#include <vector>
struct GameObject;
extern std::map<std::string, int> g_classInfo_stringIdMap; // Class name -> ID map
namespace ClassInfo {
// Initialize the class info from the file
void ReadClassInfo();
// Get name of class from ID
const char *GetObjTypeString(int typeId);
// Get class category flags
uint16_t GetObjTypeCategory(int typeId);
struct ClassMember {
std::string type;
std::string name;
std::string defaultValue;
std::vector<std::string> valueChoices;
int arrayCount = 1;
bool isProtected = false;
};
struct ObjectMember {
const ClassMember* info;
int arrayIndex;
ObjectMember(const ClassMember* info, int arrayIndex = -1) : info(info), arrayIndex(arrayIndex) {}
};
// Parse a string containing a list of class members
std::vector<ClassMember> ProcessClassMemberListString(const std::string& membersString);
// Get an array of members for the DBL (arrays repeat the same member in the list)
void AddDBLMemberInfo(std::vector<ObjectMember>& members, const std::vector<ClassMember>& memlist);
// Return a list of names of all DBL members of the object
std::vector<ObjectMember> GetMemberNames(GameObject* obj);
}
extern std::map<std::string, std::vector<ClassInfo::ClassMember>> g_classMemberLists;