summary refs log tree commit diff stats
path: root/tools/datapacker/container.cpp
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2025-08-12 16:55:17 -0400
committerStar Rauchenberger <fefferburbia@gmail.com>2025-08-12 16:55:17 -0400
commit4c8a38dfc0121343396d2a0d734cf1445d05b60c (patch)
treeccaf6dd1dc6fee60ced5ae19c5d0bb5db1217fcb /tools/datapacker/container.cpp
parent447a222b57e498f7904033c59e68d21d6a246abd (diff)
downloadlingo2-archipelago-4c8a38dfc0121343396d2a0d734cf1445d05b60c.tar.gz
lingo2-archipelago-4c8a38dfc0121343396d2a0d734cf1445d05b60c.tar.bz2
lingo2-archipelago-4c8a38dfc0121343396d2a0d734cf1445d05b60c.zip
Converted to proto2
This will let us use an older version of protobuf in Python, and allows
us to use the Godot protobuf implementation at all. Scalar fields with
custom defaults in data.proto were changed to not have a default,
because Godot doesn't handle it properly. The equivalent fields in
human.proto still have the defaults, and datapacker copies the default
value in if necessary. The Panel message in data.proto was also renamed
to PanelData because otherwise it conflicts with the native Godot class
named Panel. The double field in Letter was renamed to level2, because
Godot couldn't handle it well. Finally, common.proto was removed and
its contents were moved into data.proto, which allows us to generate
code for Python without needing to edit it.

NOTE: I had to slightly modify the Godot protobuf code generator. I'll
need to upload that somewhere.
Diffstat (limited to 'tools/datapacker/container.cpp')
-rw-r--r--tools/datapacker/container.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/datapacker/container.cpp b/tools/datapacker/container.cpp index bb58ec5..ffcb75a 100644 --- a/tools/datapacker/container.cpp +++ b/tools/datapacker/container.cpp
@@ -160,7 +160,7 @@ uint64_t Container::FindOrAddPanel(std::optional<std::string> map_name,
160 auto it = room_container.find(panel_name); 160 auto it = room_container.find(panel_name);
161 if (it == room_container.end()) { 161 if (it == room_container.end()) {
162 uint64_t new_id = all_objects_.panels_size(); 162 uint64_t new_id = all_objects_.panels_size();
163 Panel* panel = all_objects_.add_panels(); 163 PanelData* panel = all_objects_.add_panels();
164 panel->set_id(new_id); 164 panel->set_id(new_id);
165 panel->set_room_id(FindOrAddRoom(map_name, *room_name, std::nullopt)); 165 panel->set_room_id(FindOrAddRoom(map_name, *room_name, std::nullopt));
166 panel->set_name(panel_name); 166 panel->set_name(panel_name);
@@ -173,8 +173,8 @@ uint64_t Container::FindOrAddPanel(std::optional<std::string> map_name,
173 } 173 }
174} 174}
175 175
176uint64_t Container::FindOrAddLetter(std::string key, bool double_) { 176uint64_t Container::FindOrAddLetter(std::string key, bool level2) {
177 std::string letter_name = GetLetterName(key, double_); 177 std::string letter_name = GetLetterName(key, level2);
178 178
179 auto it = letter_id_by_name_.find(letter_name); 179 auto it = letter_id_by_name_.find(letter_name);
180 if (it == letter_id_by_name_.end()) { 180 if (it == letter_id_by_name_.end()) {
@@ -183,8 +183,8 @@ uint64_t Container::FindOrAddLetter(std::string key, bool double_) {
183 letter->set_id(new_id); 183 letter->set_id(new_id);
184 letter->set_key(key); 184 letter->set_key(key);
185 185
186 if (double_) { 186 if (level2) {
187 letter->set_double_(double_); 187 letter->set_level2(level2);
188 } 188 }
189 189
190 letter_id_by_name_[letter_name] = new_id; 190 letter_id_by_name_[letter_name] = new_id;