Revert "switch to int64 for the StationId typedef, and use the StationId typedef everywhere. Note that the Archive.h in this commit really needs to use a centralized Types.h or FoundationTypes.h file, as do many others...in this case I just typedefed at the top"

This reverts commit 8fb01069e1.
This commit is contained in:
DarthArgus
2018-05-17 17:55:22 +00:00
parent fc52ba532a
commit 1fcbbaeb40
17 changed files with 38 additions and 72 deletions
@@ -1233,7 +1233,7 @@ void CentralServer::receiveMessage(const MessageDispatch::Emitter & source, cons
DEBUG_REPORT_LOG(true, ("Pending character %lu is logging in or dropping\n", m.getAccountNumber()));
// Once they're logged in, Central doesn't need to know about them anymore:
removeSuidFromAccountConnectionMap(m.getAccountNumber());
removeFromAccountConnectionMap(m.getAccountNumber());
break;
}
case constcrc("CharacterListMessage") : {
@@ -3419,7 +3419,7 @@ void CentralServer::addToAccountConnectionMap(StationId suid, ConnectionServerCo
// ----------------------------------------------------------------------
void CentralServer::removeSuidFromAccountConnectionMap(StationId suid)
void CentralServer::removeFromAccountConnectionMap(StationId suid)
{
ConnectionServerSUIDMap::iterator i=m_accountConnectionMap.find(suid);
if (i!=m_accountConnectionMap.end())
@@ -169,7 +169,7 @@ public:
void getCharacterMatchStatistics(int & numberOfCharacterMatchRequests, int & numberOfCharacterMatchResultsPerRequest, int & timeSpentPerCharacterMatchRequestMs);
void removeSuidFromAccountConnectionMap(StationId suid);
void removeFromAccountConnectionMap(StationId suid);
private:
void handleRequestGameServerForLoginMessage (const RequestGameServerForLoginMessage & msg);
@@ -254,7 +254,7 @@ void ConnectionServerConnection::onReceive(const Archive::ByteStream & message)
s_pseudoClientConnectionMap[info.getValue().first] = std::make_pair(static_cast<TransferRequestMoveValidation::TransferRequestSource>(info.getValue().second), this);
// remove corresponding "non pseudo client connection"
CentralServer::getInstance().removeSuidFromAccountConnectionMap(static_cast<StationId>(info.getValue().first));
CentralServer::getInstance().removeFromAccountConnectionMap(static_cast<StationId>(info.getValue().first));
break;
}
case constcrc("DestroyPseudoClientConnection") :
@@ -443,4 +443,4 @@ void ConnectionServerConnection::removeFromAccountConnectionMap(unsigned int sta
{
s_pseudoClientConnectionMap.erase(f);
}
}
}
@@ -161,7 +161,7 @@ void ConnectionServer::addGameConnection(unsigned long gameServerId, GameConnect
//-----------------------------------------------------------------------
bool
ConnectionServer::decryptToken(const KeyShare::Token &token, StationId &stationUserId, bool &secure, std::string &accountName) {
ConnectionServer::decryptToken(const KeyShare::Token &token, uint32 &stationUserId, bool &secure, std::string &accountName) {
static ConnectionServer &cs = instance();
//Also the sizeof(int) is likewise magic from the session api
@@ -179,7 +179,7 @@ ConnectionServer::decryptToken(const KeyShare::Token &token, StationId &stationU
char *tmpBuffer = new char[MAX_ACCOUNT_NAME_LENGTH + 1];
memset(tmpBuffer, 0, MAX_ACCOUNT_NAME_LENGTH + 1);
memcpy(&stationUserId, keyBufferPointer, sizeof(StationId));
memcpy(&stationUserId, keyBufferPointer, sizeof(uint32));
keyBufferPointer += sizeof(uint32);
memcpy(&secure, keyBufferPointer, sizeof(bool));
keyBufferPointer += sizeof(bool);
@@ -48,7 +48,7 @@ class ConnectionServer : public MessageDispatch::Receiver
static void addNewClient(ClientConnection* cconn, const NetworkId &oid, GameConnection* gconn, const std::string &sceneName, bool sendToStarport );
static void addConnectedClient(uint32 suid, ClientConnection* conn);
static void addGameConnection(unsigned long gameServerId, GameConnection* gc);
static bool decryptToken(const KeyShare::Token & token, StationId & stationUserId, bool & secure, std::string & accountName);
static bool decryptToken(const KeyShare::Token & token, uint32 & stationUserId, bool & secure, std::string & accountName);
static bool decryptToken(const KeyShare::Token & token, char* sessionKey, StationId & stationId);
static CentralConnection * getCentralConnection();
static void dropClient(ClientConnection * conn, const std::string &description);
@@ -14,7 +14,6 @@
#include "sharedDatabaseInterface/BindableNetworkId.h"
#include "sharedDatabaseInterface/DbQuery.h"
#include "serverDatabase/ObjectLocator.h"
#include "sharedFoundation/StationId.h"
#include <vector>
// ======================================================================
@@ -64,7 +63,7 @@ class CharacterNameLocator : public ObjectLocator
private:
std::vector<NetworkId> m_characterIds;
std::vector<StationId> m_stationIds;
std::vector<int> m_stationIds;
std::vector<std::string> m_characterNames;
std::vector<std::string> m_characterFullNames;
std::vector<int> m_characterCreateTime;
@@ -189,7 +189,7 @@ int NameManager::getTotalPlayerCount() const
// ----------------------------------------------------------------------
void NameManager::addPlayer(const NetworkId &id, StationId stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers)
void NameManager::addPlayer(const NetworkId &id, uint32 stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers)
{
std::string normalizedName(normalizeName(name));
@@ -221,14 +221,14 @@ void NameManager::addPlayer(const NetworkId &id, StationId stationId, const std:
if (notifyOtherServers)
{
std::vector<NetworkId> ids;
std::vector<StationId> stationIds;
std::vector<int> stationIds;
std::vector<std::string> characterNames;
std::vector<std::string> characterFullNames;
std::vector<int> characterCreateTimes;
std::vector<int> characterLastLoginTimes;
ids.push_back(id);
stationIds.push_back(stationId);
stationIds.push_back(static_cast<int>(stationId));
characterNames.push_back(normalizedName);
characterFullNames.push_back(fullName);
characterCreateTimes.push_back(static_cast<int>(createTime));
@@ -247,7 +247,7 @@ void NameManager::addPlayer(const NetworkId &id, StationId stationId, const std:
void NameManager::renamePlayer(const NetworkId &id, const Unicode::String &name, const Unicode::String &fullName)
{
StationId stationId = 0;
uint32 stationId = 0;
time_t createTime = 0;
time_t lastLoginTime = 0;
@@ -279,7 +279,7 @@ const NetworkId & NameManager::getPlayerId(const std::string &name) const
// ----------------------------------------------------------------------
StationId NameManager::getPlayerStationId(const NetworkId &id) const
uint32 NameManager::getPlayerStationId(const NetworkId &id) const
{
IdToCharacterDataMapType::const_iterator i=m_idToCharacterDataMap->find(id);
if (i==m_idToCharacterDataMap->end())
@@ -464,7 +464,7 @@ void NameManager::releasePlayerName(const NetworkId &id)
// ----------------------------------------------------------------------
void NameManager::addPlayers(const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int> &createTimes, const std::vector<int> &lastLoginTimes)
void NameManager::addPlayers(const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int> &createTimes, const std::vector<int> &lastLoginTimes)
{
DEBUG_FATAL(ids.size() != stationIds.size(),("Programmer bug: Vectors ids and stationIds must be the same size.\n"));
DEBUG_FATAL(ids.size() != names.size(),("Programmer bug: Vectors ids and names must be the same size.\n"));
@@ -483,7 +483,7 @@ void NameManager::addPlayers(const std::vector<NetworkId> &ids, const std::vecto
void NameManager::sendAllNamesToServer (std::vector<uint32> const & servers) const
{
std::vector<NetworkId> ids;
std::vector<StationId> stationIds;
std::vector<int> stationIds;
std::vector<std::string> characterNames;
std::vector<std::string> characterFullNames;
std::vector<int> characterCreateTimes;
@@ -492,7 +492,7 @@ void NameManager::sendAllNamesToServer (std::vector<uint32> const & servers) con
for (IdToCharacterDataMapType::const_iterator i=m_idToCharacterDataMap->begin(); i!=m_idToCharacterDataMap->end(); ++i)
{
ids.push_back(i->first);
stationIds.push_back(i->second.stationId);
stationIds.push_back(static_cast<int>(i->second.stationId));
characterNames.push_back(i->second.characterName);
characterFullNames.push_back(i->second.characterFullName);
characterCreateTimes.push_back(static_cast<int>(i->second.createTime));
@@ -8,8 +8,6 @@
#ifndef INCLUDED_NameManager_H
#define INCLUDED_NameManager_H
#include "sharedFoundation/StationId.h"
// ======================================================================
class NameGenerator;
@@ -34,13 +32,13 @@ class NameManager
public:
int getTotalPlayerCount () const;
void addPlayer (const NetworkId &id, StationId stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers);
void addPlayers (const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int> &createTimes, const std::vector<int> &lastLoginTimes);
void addPlayer (const NetworkId &id, uint32 stationId, const std::string &name, const std::string &fullName, time_t createTime, time_t lastLoginTime, bool notifyOtherServers);
void addPlayers (const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &names, const std::vector<std::string> &fullNames, const std::vector<int> &createTimes, const std::vector<int> &lastLoginTimes);
void renamePlayer (const NetworkId &id, const Unicode::String &name, const Unicode::String &fullName);
std::string debugGetNameList () const;
bool isPlayer (NetworkId const & possiblePlayer) const;
const NetworkId & getPlayerId (const std::string &name) const;
StationId getPlayerStationId (const NetworkId &id) const;
uint32 getPlayerStationId (const NetworkId &id) const;
const std::string & getPlayerName (const NetworkId &id) const;
const std::string & getPlayerFullName (const NetworkId &id) const;
int getPlayerCreateTime (const NetworkId &id) const;
@@ -80,7 +78,7 @@ class NameManager
struct CharacterData
{
StationId stationId;
uint32 stationId;
std::string characterName;
std::string characterFullName;
time_t createTime;
@@ -10,7 +10,7 @@
// ======================================================================
CharacterNamesMessage::CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int> &createTimes, const std::vector<int> &loginTimes) :
CharacterNamesMessage::CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int> &createTimes, const std::vector<int> &loginTimes) :
GameNetworkMessage("CharacterNamesMessage"),
m_ids(),
m_stationIds(),
@@ -8,7 +8,6 @@
#ifndef INCLUDED_CharacterNamesMessage_H
#define INCLUDED_CharacterNamesMessage_H
#include "sharedFoundation/StationId.h"
#include "sharedNetworkMessages/GameNetworkMessage.h"
// ======================================================================
@@ -22,12 +21,12 @@
class CharacterNamesMessage : public GameNetworkMessage
{
public:
CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<StationId> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int> &createTimes, const std::vector<int> &loginTimes);
CharacterNamesMessage(const std::vector<NetworkId> &ids, const std::vector<int> &stationIds, const std::vector<std::string> &characterNames, const std::vector<std::string> &characterFullNames, const std::vector<int> &createTimes, const std::vector<int> &loginTimes);
CharacterNamesMessage(Archive::ReadIterator & source);
~CharacterNamesMessage();
const std::vector<NetworkId> &getIds() const;
const std::vector<StationId> &getStationIds() const;
const std::vector<int> &getStationIds() const;
const std::vector<std::string> &getNames() const;
const std::vector<std::string> &getFullNames() const;
const std::vector<int> &getCreateTimes() const;
@@ -35,7 +34,7 @@ class CharacterNamesMessage : public GameNetworkMessage
private:
Archive::AutoArray<NetworkId> m_ids;
Archive::AutoArray<StationId> m_stationIds;
Archive::AutoArray<int> m_stationIds;
Archive::AutoArray<std::string> m_names;
Archive::AutoArray<std::string> m_fullNames;
Archive::AutoArray<int> m_createTimes;
@@ -58,7 +57,7 @@ inline const std::vector<NetworkId> & CharacterNamesMessage::getIds() const
// ----------------------------------------------------------------------
inline const std::vector<StationId> & CharacterNamesMessage::getStationIds() const
inline const std::vector<int> & CharacterNamesMessage::getStationIds() const
{
return m_stationIds.get();
}
@@ -10,7 +10,7 @@
// ======================================================================
typedef int64 StationId;
typedef uint32 StationId;
// ======================================================================
@@ -10,8 +10,6 @@
#define PLATFORM_LINUX
#include <cstdio>
#include <sys/bitypes.h>
// ======================================================================
// basic types that we assume to be around
@@ -22,12 +20,11 @@ typedef unsigned long uint32;
typedef signed char int8;
typedef signed short int16;
typedef signed long int32;
typedef signed long long int int64;
typedef unsigned long long int uint64;
typedef float real;
typedef FILE* FILE_HANDLE;
typedef int64_t int64;
typedef u_int64_t uint64;
#endif
@@ -7,8 +7,6 @@
//
// ======================================================================
#include <sys/bitypes.h>
#ifndef INCLUDED_FoundationTypesWin32_H
#define INCLUDED_FoundationTypesWin32_H
@@ -30,10 +28,6 @@ typedef signed long int32;
typedef signed __int64 int64;
typedef int FILE_HANDLE;
typedef int64_t int64;
typedef u_int64_t uint64;
// ======================================================================
#endif
@@ -49,6 +49,11 @@ namespace soe
typedef u_int32_t uint32;
typedef int64_t int64;
typedef u_int64_t uint64;
//! the previous seem erroneous
// typedef signed int int32;
// typedef unsigned int uint32;
// typedef signed long long int64;
// typedef unsigned long long uint64;
#endif
}
+1 -27
View File
@@ -9,28 +9,12 @@
#include <deque>
#include <set>
// TODO: this is retarded, we have like 30-50 places where we define types...
// we must do something abou tthis
#include <sys/bitypes.h>
typedef int64_t int64;
typedef u_int64_t uint64;
typedef int64 StationId;
//---------------------------------------------------------------------
namespace Archive {
//---------------------------------------------------------------------
inline void get(ByteStream::ReadIterator & source, uint64 & target)
{
source.get(&target, 8);
}
inline void get(ByteStream::ReadIterator & source, int64 & target)
{
source.get(&target, 8);
}
inline void get(ReadIterator & source, double & target)
{
@@ -231,16 +215,6 @@ template<typename A> inline void get(ReadIterator & source, A * target, int leng
//---------------------------------------------------------------------
inline void put(ByteStream & target, const uint64 & source)
{
target.put(&source, 8);
}
inline void put(ByteStream & target, const int64 & source)
{
target.put(&source, 8);
}
inline void put(ByteStream & target, const double & source)
{
target.put(&source, 8);
@@ -23,7 +23,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 +80,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: