[Objects] Add fix_z column to ground spawns (#3992)

* [Objects] Add is_floating column to objects/ground spawns

# Notes
- Allows ground spawns/objects to float without having `FixZ()` called.

* Remove from object.

* Database version

* Fix

* Change to fix_z
This commit is contained in:
Alex King
2024-02-01 05:42:51 -05:00
committed by GitHub
parent 6297c56db2
commit 71f47dbcef
9 changed files with 368 additions and 232 deletions
@@ -33,6 +33,7 @@ public:
uint32_t max_allowed;
std::string comment;
uint32_t respawn_timer;
uint8_t fix_z;
int8_t min_expansion;
int8_t max_expansion;
std::string content_flags;
@@ -61,6 +62,7 @@ public:
"max_allowed",
"comment",
"respawn_timer",
"fix_z",
"min_expansion",
"max_expansion",
"content_flags",
@@ -85,6 +87,7 @@ public:
"max_allowed",
"comment",
"respawn_timer",
"fix_z",
"min_expansion",
"max_expansion",
"content_flags",
@@ -143,6 +146,7 @@ public:
e.max_allowed = 1;
e.comment = "";
e.respawn_timer = 300;
e.fix_z = 1;
e.min_expansion = -1;
e.max_expansion = -1;
e.content_flags = "";
@@ -197,10 +201,11 @@ public:
e.max_allowed = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 1;
e.comment = row[12] ? row[12] : "";
e.respawn_timer = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 300;
e.min_expansion = row[14] ? static_cast<int8_t>(atoi(row[14])) : -1;
e.max_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.content_flags = row[16] ? row[16] : "";
e.content_flags_disabled = row[17] ? row[17] : "";
e.fix_z = row[14] ? static_cast<uint8_t>(strtoul(row[14], nullptr, 10)) : 1;
e.min_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.max_expansion = row[16] ? static_cast<int8_t>(atoi(row[16])) : -1;
e.content_flags = row[17] ? row[17] : "";
e.content_flags_disabled = row[18] ? row[18] : "";
return e;
}
@@ -247,10 +252,11 @@ public:
v.push_back(columns[11] + " = " + std::to_string(e.max_allowed));
v.push_back(columns[12] + " = '" + Strings::Escape(e.comment) + "'");
v.push_back(columns[13] + " = " + std::to_string(e.respawn_timer));
v.push_back(columns[14] + " = " + std::to_string(e.min_expansion));
v.push_back(columns[15] + " = " + std::to_string(e.max_expansion));
v.push_back(columns[16] + " = '" + Strings::Escape(e.content_flags) + "'");
v.push_back(columns[17] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
v.push_back(columns[14] + " = " + std::to_string(e.fix_z));
v.push_back(columns[15] + " = " + std::to_string(e.min_expansion));
v.push_back(columns[16] + " = " + std::to_string(e.max_expansion));
v.push_back(columns[17] + " = '" + Strings::Escape(e.content_flags) + "'");
v.push_back(columns[18] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
auto results = db.QueryDatabase(
fmt::format(
@@ -286,6 +292,7 @@ public:
v.push_back(std::to_string(e.max_allowed));
v.push_back("'" + Strings::Escape(e.comment) + "'");
v.push_back(std::to_string(e.respawn_timer));
v.push_back(std::to_string(e.fix_z));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
@@ -333,6 +340,7 @@ public:
v.push_back(std::to_string(e.max_allowed));
v.push_back("'" + Strings::Escape(e.comment) + "'");
v.push_back(std::to_string(e.respawn_timer));
v.push_back(std::to_string(e.fix_z));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
@@ -384,10 +392,11 @@ public:
e.max_allowed = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 1;
e.comment = row[12] ? row[12] : "";
e.respawn_timer = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 300;
e.min_expansion = row[14] ? static_cast<int8_t>(atoi(row[14])) : -1;
e.max_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.content_flags = row[16] ? row[16] : "";
e.content_flags_disabled = row[17] ? row[17] : "";
e.fix_z = row[14] ? static_cast<uint8_t>(strtoul(row[14], nullptr, 10)) : 1;
e.min_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.max_expansion = row[16] ? static_cast<int8_t>(atoi(row[16])) : -1;
e.content_flags = row[17] ? row[17] : "";
e.content_flags_disabled = row[18] ? row[18] : "";
all_entries.push_back(e);
}
@@ -426,10 +435,11 @@ public:
e.max_allowed = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 1;
e.comment = row[12] ? row[12] : "";
e.respawn_timer = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 300;
e.min_expansion = row[14] ? static_cast<int8_t>(atoi(row[14])) : -1;
e.max_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.content_flags = row[16] ? row[16] : "";
e.content_flags_disabled = row[17] ? row[17] : "";
e.fix_z = row[14] ? static_cast<uint8_t>(strtoul(row[14], nullptr, 10)) : 1;
e.min_expansion = row[15] ? static_cast<int8_t>(atoi(row[15])) : -1;
e.max_expansion = row[16] ? static_cast<int8_t>(atoi(row[16])) : -1;
e.content_flags = row[17] ? row[17] : "";
e.content_flags_disabled = row[18] ? row[18] : "";
all_entries.push_back(e);
}
@@ -518,6 +528,7 @@ public:
v.push_back(std::to_string(e.max_allowed));
v.push_back("'" + Strings::Escape(e.comment) + "'");
v.push_back(std::to_string(e.respawn_timer));
v.push_back(std::to_string(e.fix_z));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
@@ -558,6 +569,7 @@ public:
v.push_back(std::to_string(e.max_allowed));
v.push_back("'" + Strings::Escape(e.comment) + "'");
v.push_back(std::to_string(e.respawn_timer));
v.push_back(std::to_string(e.fix_z));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");