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
@@ -181,7 +181,7 @@ void ClientConnection::validateClient(const std::string &id, const std::string &
authOK = true;
parentAccount = api.getString("mainAccount");
childAccounts = api.getStringMap64("subAccounts");
childAccounts = api.getStringMapU32("subAccounts");
if (!ConfigLoginServer::getUseOldSuidGenerator()) {
user_id = static_cast<StationId>(api.getNullableValue<StationId>("user_id"));
@@ -33,7 +33,7 @@ class CharacterNameLocator : public ObjectLocator
struct CharacterNameRow
{
DB::BindableNetworkId character_id;
DB::BindableInt64 character_station_id;
DB::BindableLong character_station_id;
DB::BindableString<127> character_name;
DB::BindableString<127> character_full_name;
DB::BindableInt64 character_create_time;
@@ -10,7 +10,7 @@
// ======================================================================
typedef int64 StationId;
typedef uint32_t StationId;
// ======================================================================
+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"
//---------------------------------------------------------------------
@@ -14,6 +14,7 @@
#include "sharedDatabaseInterface/BindableNetworkId.h"
#include "sharedDatabaseInterface/BufferString.h"
#include "sharedDatabaseInterface/DbRow.h"
#include "sharedFoundation/StationId.h"
namespace DBSchema
{
@@ -23,7 +24,7 @@ struct PlayerObjectRow : public DB::Row
enum {QUEST_DATA_SIZE=4000};
DB::BindableNetworkId object_id;
DB::BindableInt64 station_id;
DB::BindableLong station_id;
DB::BindableNetworkId house_id;
DB::BindableLong account_num_lots;
DB::BindableBool account_is_outcast;
@@ -80,7 +81,7 @@ struct PlayerObjectRow : public DB::Row
struct PlayerObjectBufferRow : public DB::Row
{
DB::BindableNetworkId object_id;
DB::BindableInt64 station_id;
DB::BindableLong station_id;
DB::BindableNetworkId house_id;
DB::BindableLong account_num_lots;
DB::BindableBool account_is_outcast;
@@ -45,7 +45,7 @@ class TaskRestoreCharacter:public DB::TaskRequest
//output:
DB::BindableLong result;
DB::BindableString<127> character_name;
DB::BindableInt64 account;
DB::BindableLong account;
DB::BindableLong template_id;
private: