[Repositories] Fix datetime zero-value save behavior (#3976)

This commit is contained in:
Chris Miles
2024-01-14 00:10:13 -06:00
committed by GitHub
parent e40267b9b8
commit 14509fcc4e
133 changed files with 3647 additions and 3658 deletions
@@ -211,29 +211,29 @@ public:
if (results.RowCount() == 1) {
Traps e{};
e.id = static_cast<int32_t>(atoi(row[0]));
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.zone = row[1] ? row[1] : "";
e.version = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
e.x = static_cast<int32_t>(atoi(row[3]));
e.y = static_cast<int32_t>(atoi(row[4]));
e.z = static_cast<int32_t>(atoi(row[5]));
e.chance = static_cast<int8_t>(atoi(row[6]));
e.x = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
e.y = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
e.z = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
e.chance = row[6] ? static_cast<int8_t>(atoi(row[6])) : 0;
e.maxzdiff = row[7] ? strtof(row[7], nullptr) : 0;
e.radius = row[8] ? strtof(row[8], nullptr) : 0;
e.effect = static_cast<int32_t>(atoi(row[9]));
e.effectvalue = static_cast<int32_t>(atoi(row[10]));
e.effectvalue2 = static_cast<int32_t>(atoi(row[11]));
e.effect = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
e.effectvalue = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
e.effectvalue2 = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
e.message = row[12] ? row[12] : "";
e.skill = static_cast<int32_t>(atoi(row[13]));
e.skill = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
e.level = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 1;
e.respawn_time = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 60;
e.respawn_var = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
e.triggered_number = static_cast<int8_t>(atoi(row[17]));
e.group = static_cast<int8_t>(atoi(row[18]));
e.despawn_when_triggered = static_cast<int8_t>(atoi(row[19]));
e.undetectable = static_cast<int8_t>(atoi(row[20]));
e.min_expansion = static_cast<int8_t>(atoi(row[21]));
e.max_expansion = static_cast<int8_t>(atoi(row[22]));
e.triggered_number = row[17] ? static_cast<int8_t>(atoi(row[17])) : 0;
e.group = row[18] ? static_cast<int8_t>(atoi(row[18])) : 0;
e.despawn_when_triggered = row[19] ? static_cast<int8_t>(atoi(row[19])) : 0;
e.undetectable = row[20] ? static_cast<int8_t>(atoi(row[20])) : 0;
e.min_expansion = row[21] ? static_cast<int8_t>(atoi(row[21])) : -1;
e.max_expansion = row[22] ? static_cast<int8_t>(atoi(row[22])) : -1;
e.content_flags = row[23] ? row[23] : "";
e.content_flags_disabled = row[24] ? row[24] : "";
@@ -426,29 +426,29 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
Traps e{};
e.id = static_cast<int32_t>(atoi(row[0]));
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.zone = row[1] ? row[1] : "";
e.version = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
e.x = static_cast<int32_t>(atoi(row[3]));
e.y = static_cast<int32_t>(atoi(row[4]));
e.z = static_cast<int32_t>(atoi(row[5]));
e.chance = static_cast<int8_t>(atoi(row[6]));
e.x = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
e.y = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
e.z = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
e.chance = row[6] ? static_cast<int8_t>(atoi(row[6])) : 0;
e.maxzdiff = row[7] ? strtof(row[7], nullptr) : 0;
e.radius = row[8] ? strtof(row[8], nullptr) : 0;
e.effect = static_cast<int32_t>(atoi(row[9]));
e.effectvalue = static_cast<int32_t>(atoi(row[10]));
e.effectvalue2 = static_cast<int32_t>(atoi(row[11]));
e.effect = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
e.effectvalue = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
e.effectvalue2 = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
e.message = row[12] ? row[12] : "";
e.skill = static_cast<int32_t>(atoi(row[13]));
e.skill = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
e.level = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 1;
e.respawn_time = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 60;
e.respawn_var = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
e.triggered_number = static_cast<int8_t>(atoi(row[17]));
e.group = static_cast<int8_t>(atoi(row[18]));
e.despawn_when_triggered = static_cast<int8_t>(atoi(row[19]));
e.undetectable = static_cast<int8_t>(atoi(row[20]));
e.min_expansion = static_cast<int8_t>(atoi(row[21]));
e.max_expansion = static_cast<int8_t>(atoi(row[22]));
e.triggered_number = row[17] ? static_cast<int8_t>(atoi(row[17])) : 0;
e.group = row[18] ? static_cast<int8_t>(atoi(row[18])) : 0;
e.despawn_when_triggered = row[19] ? static_cast<int8_t>(atoi(row[19])) : 0;
e.undetectable = row[20] ? static_cast<int8_t>(atoi(row[20])) : 0;
e.min_expansion = row[21] ? static_cast<int8_t>(atoi(row[21])) : -1;
e.max_expansion = row[22] ? static_cast<int8_t>(atoi(row[22])) : -1;
e.content_flags = row[23] ? row[23] : "";
e.content_flags_disabled = row[24] ? row[24] : "";
@@ -475,29 +475,29 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) {
Traps e{};
e.id = static_cast<int32_t>(atoi(row[0]));
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.zone = row[1] ? row[1] : "";
e.version = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 0;
e.x = static_cast<int32_t>(atoi(row[3]));
e.y = static_cast<int32_t>(atoi(row[4]));
e.z = static_cast<int32_t>(atoi(row[5]));
e.chance = static_cast<int8_t>(atoi(row[6]));
e.x = row[3] ? static_cast<int32_t>(atoi(row[3])) : 0;
e.y = row[4] ? static_cast<int32_t>(atoi(row[4])) : 0;
e.z = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
e.chance = row[6] ? static_cast<int8_t>(atoi(row[6])) : 0;
e.maxzdiff = row[7] ? strtof(row[7], nullptr) : 0;
e.radius = row[8] ? strtof(row[8], nullptr) : 0;
e.effect = static_cast<int32_t>(atoi(row[9]));
e.effectvalue = static_cast<int32_t>(atoi(row[10]));
e.effectvalue2 = static_cast<int32_t>(atoi(row[11]));
e.effect = row[9] ? static_cast<int32_t>(atoi(row[9])) : 0;
e.effectvalue = row[10] ? static_cast<int32_t>(atoi(row[10])) : 0;
e.effectvalue2 = row[11] ? static_cast<int32_t>(atoi(row[11])) : 0;
e.message = row[12] ? row[12] : "";
e.skill = static_cast<int32_t>(atoi(row[13]));
e.skill = row[13] ? static_cast<int32_t>(atoi(row[13])) : 0;
e.level = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 1;
e.respawn_time = row[15] ? static_cast<uint32_t>(strtoul(row[15], nullptr, 10)) : 60;
e.respawn_var = row[16] ? static_cast<uint32_t>(strtoul(row[16], nullptr, 10)) : 0;
e.triggered_number = static_cast<int8_t>(atoi(row[17]));
e.group = static_cast<int8_t>(atoi(row[18]));
e.despawn_when_triggered = static_cast<int8_t>(atoi(row[19]));
e.undetectable = static_cast<int8_t>(atoi(row[20]));
e.min_expansion = static_cast<int8_t>(atoi(row[21]));
e.max_expansion = static_cast<int8_t>(atoi(row[22]));
e.triggered_number = row[17] ? static_cast<int8_t>(atoi(row[17])) : 0;
e.group = row[18] ? static_cast<int8_t>(atoi(row[18])) : 0;
e.despawn_when_triggered = row[19] ? static_cast<int8_t>(atoi(row[19])) : 0;
e.undetectable = row[20] ? static_cast<int8_t>(atoi(row[20])) : 0;
e.min_expansion = row[21] ? static_cast<int8_t>(atoi(row[21])) : -1;
e.max_expansion = row[22] ? static_cast<int8_t>(atoi(row[22])) : -1;
e.content_flags = row[23] ? row[23] : "";
e.content_flags_disabled = row[24] ? row[24] : "";