revert to using 32 bit ints for station id's because...it breaks legacy ones if we don't

This commit is contained in:
DarthArgus
2018-05-16 05:40:04 +00:00
parent 8cb5a17cd9
commit 1b49c7e742
8 changed files with 30 additions and 7 deletions
+18
View File
@@ -72,6 +72,24 @@ std::unordered_map<int, std::string> webAPI::getStringMap(const std::string &slo
return ret;
}
std::unordered_map<uint32_t, std::string> webAPI::getStringMapU32(const std::string &slot) {
std::unordered_map<uint32_t, std::string> ret = std::unordered_map<uint32_t, std::string>();
if (!responseData.empty() && !slot.empty() && responseData.count(slot) && !responseData[slot].is_null()) {
nlohmann::json j = responseData[slot];
for (nlohmann::json::iterator it = j.begin(); it != j.end(); ++it) {
uint32_t k = std::stoi(it.key());
std::string val = it.value();
ret.insert({k, val});
}
}
return ret;
}
std::unordered_map<int64_t, std::string> webAPI::getStringMap64(const std::string &slot) {
std::unordered_map<int64_t, std::string> ret = std::unordered_map<int64_t, std::string>();
+3
View File
@@ -66,6 +66,9 @@ namespace StellaBellum {
// get a vector of strings from a given slot
std::unordered_map<int, std::string> getStringMap(const std::string &slot);
// return the above as unsigned to make various things happy
std::unordered_map<uint32_t, std::string> getStringMapU32(const std::string &slot);
// get a 64 bit keyed vector of strings from a given slot
std::unordered_map<int64_t, std::string> getStringMap64(const std::string &slot);
+2 -1
View File
@@ -14,7 +14,8 @@
#include <sys/bitypes.h>
typedef int64_t int64;
typedef u_int64_t uint64;
typedef int64 StationId;
#include "../../../../../../engine/shared/library/sharedFoundation/src/shared/StationId.h"
//---------------------------------------------------------------------