mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-04 09:44:10 +00:00
chore: Eradicate C-style casts and further clean up some code (#1361)
* cast and code cleanup * cast cleanup * bug fixes and improvements * no getBoolField method exists * fixes * unbroke sg cannon scoring * removing comments * Remove the c-style cast warning I added from CMakeLists now that they're gone (it triggers on 3rd party dependencies and slows down compilation) * (Hopefully) fix MacOS compilation error * partially-implemented feedback * more updates to account for feedback * change bool default --------- Co-authored-by: jadebenn <jonahebenn@yahoo.com>
This commit is contained in:
@@ -10,7 +10,7 @@ void CDComponentsRegistryTable::LoadValuesFromDatabase() {
|
||||
entry.component_type = static_cast<eReplicaComponentType>(tableData.getIntField("component_type", 0));
|
||||
entry.component_id = tableData.getIntField("component_id", -1);
|
||||
|
||||
this->mappedEntries.insert_or_assign(((uint64_t)entry.component_type) << 32 | ((uint64_t)entry.id), entry.component_id);
|
||||
this->mappedEntries.insert_or_assign(static_cast<uint64_t>(entry.component_type) << 32 | static_cast<uint64_t>(entry.id), entry.component_id);
|
||||
this->mappedEntries.insert_or_assign(entry.id, 0);
|
||||
|
||||
tableData.nextRow();
|
||||
@@ -22,7 +22,7 @@ void CDComponentsRegistryTable::LoadValuesFromDatabase() {
|
||||
int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponentType componentType, int32_t defaultValue) {
|
||||
auto exists = mappedEntries.find(id);
|
||||
if (exists != mappedEntries.end()) {
|
||||
auto iter = mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id));
|
||||
auto iter = mappedEntries.find(static_cast<uint64_t>(componentType) << 32 | static_cast<uint64_t>(id));
|
||||
return iter == mappedEntries.end() ? defaultValue : iter->second;
|
||||
}
|
||||
|
||||
@@ -38,15 +38,14 @@ int32_t CDComponentsRegistryTable::GetByIDAndType(uint32_t id, eReplicaComponent
|
||||
entry.component_type = static_cast<eReplicaComponentType>(tableData.getIntField("component_type", 0));
|
||||
entry.component_id = tableData.getIntField("component_id", -1);
|
||||
|
||||
this->mappedEntries.insert_or_assign(((uint64_t)entry.component_type) << 32 | ((uint64_t)entry.id), entry.component_id);
|
||||
this->mappedEntries.insert_or_assign(static_cast<uint64_t>(entry.component_type) << 32 | static_cast<uint64_t>(entry.id), entry.component_id);
|
||||
|
||||
tableData.nextRow();
|
||||
}
|
||||
|
||||
mappedEntries.insert_or_assign(id, 0);
|
||||
|
||||
auto iter = this->mappedEntries.find(((uint64_t)componentType) << 32 | ((uint64_t)id));
|
||||
auto iter = this->mappedEntries.find(static_cast<uint64_t>(componentType) << 32 | static_cast<uint64_t>(id));
|
||||
|
||||
return iter == this->mappedEntries.end() ? defaultValue : iter->second;
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,7 @@ void CDMissionEmailTable::LoadValuesFromDatabase() {
|
||||
entry.notificationGroup = tableData.getIntField("notificationGroup", -1);
|
||||
entry.missionID = tableData.getIntField("missionID", -1);
|
||||
entry.attachmentLOT = tableData.getIntField("attachmentLOT", 0);
|
||||
entry.localize = (bool)tableData.getIntField("localize", -1);
|
||||
entry.localize = static_cast<bool>(tableData.getIntField("localize", 1));
|
||||
entry.locStatus = tableData.getIntField("locStatus", -1);
|
||||
entry.gate_version = tableData.getStringField("gate_version", "");
|
||||
|
||||
@@ -50,4 +50,3 @@ std::vector<CDMissionEmail> CDMissionEmailTable::Query(std::function<bool(CDMiss
|
||||
const std::vector<CDMissionEmail>& CDMissionEmailTable::GetEntries() const {
|
||||
return this->entries;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user