mirror of
https://bitbucket.org/theswgsource/src-1.2.git
synced 2026-07-31 01:15:48 -04:00
this is a more "clean" conversion to 64 bit than the type-fixups branch, which does borrow some elements from it but has far less find and replace...it is about 98-99% done, notes to follow later
This commit is contained in:
+2
-2
@@ -27,7 +27,7 @@ ServerTrackObject::ServerTrackObject(unsigned mapped_track, unsigned real_track,
|
||||
|
||||
//----------------------------------------
|
||||
GenericAPICore::GenericAPICore(const char *host,
|
||||
short port,
|
||||
int16_t port,
|
||||
unsigned reqTimeout,
|
||||
unsigned reconnectTimeout,
|
||||
unsigned noDataTimeoutSecs,
|
||||
@@ -52,7 +52,7 @@ GenericAPICore::GenericAPICore(const char *host,
|
||||
|
||||
//----------------------------------------
|
||||
GenericAPICore::GenericAPICore(const char *game, const char *hosts[],
|
||||
const short port[],
|
||||
const int16_t port[],
|
||||
unsigned arraySize,
|
||||
unsigned reqTimeout,
|
||||
unsigned reconnectTimeout,
|
||||
|
||||
+3
-3
@@ -51,7 +51,7 @@ public:
|
||||
friend class GenericConnection;
|
||||
|
||||
GenericAPICore(const char *host,
|
||||
short port,
|
||||
int16_t port,
|
||||
unsigned reqTimeout,
|
||||
unsigned reconnectTimeout,
|
||||
unsigned noDataTimeoutSecs = 5,
|
||||
@@ -66,7 +66,7 @@ public:
|
||||
* ALSO: cannot specify a 0 array size.
|
||||
*/
|
||||
GenericAPICore(const char *game, const char *hosts[],
|
||||
const short port[],
|
||||
const int16_t port[],
|
||||
unsigned arraySize,
|
||||
unsigned reqTimeout,
|
||||
unsigned reconnectTimeout,
|
||||
@@ -80,7 +80,7 @@ public:
|
||||
virtual ~GenericAPICore();
|
||||
|
||||
void process();
|
||||
virtual void responseCallback(short type, Base::ByteStream::ReadIterator &iter, GenericConnection *con) = 0;
|
||||
virtual void responseCallback(int16_t type, Base::ByteStream::ReadIterator &iter, GenericConnection *con) = 0;
|
||||
virtual void responseCallback(GenericResponse *R) = 0;
|
||||
|
||||
virtual void OnDisconnect(GenericConnection *con) = 0;
|
||||
|
||||
+3
-3
@@ -19,7 +19,7 @@ namespace NAMESPACE
|
||||
using namespace std;
|
||||
using namespace Base;
|
||||
|
||||
GenericConnection::GenericConnection(const char *host, short port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB)
|
||||
GenericConnection::GenericConnection(const char *host, int16_t port, GenericAPICore *apiCore, unsigned reconnectTimeout, unsigned noDataTimeoutSecs, unsigned noAckTimeoutSecs, unsigned incomingBufSizeInKB, unsigned outgoingBufSizeInKB, unsigned keepAlive, unsigned maxRecvMessageSizeInKB)
|
||||
: m_bConnected(CON_NONE),
|
||||
m_apiCore(apiCore),
|
||||
m_con(nullptr),
|
||||
@@ -83,7 +83,7 @@ namespace NAMESPACE
|
||||
|
||||
void GenericConnection::OnRoutePacket(TcpConnection *con, const unsigned char *data, int dataLen)
|
||||
{
|
||||
short type;
|
||||
int16_t type;
|
||||
unsigned track;
|
||||
|
||||
ByteStream msg(data, dataLen);
|
||||
@@ -164,7 +164,7 @@ namespace NAMESPACE
|
||||
// identifying us
|
||||
// m_apiCore->OnConnect(this);
|
||||
Base::ByteStream msg;
|
||||
put(msg, (short)CTService::CTGAME_REQUEST_CONNECT);
|
||||
put(msg, (int16_t)CTService::CTGAME_REQUEST_CONNECT);
|
||||
put(msg, (unsigned)0); // track
|
||||
put(msg, (unsigned)API_VERSION_CODE);
|
||||
put(msg, m_apiCore->getGameCode());
|
||||
|
||||
+3
-3
@@ -39,7 +39,7 @@ class GenericConnection : public TcpConnectionHandler
|
||||
{
|
||||
public:
|
||||
GenericConnection(const char *host,
|
||||
short port,
|
||||
int16_t port,
|
||||
GenericAPICore *apiCore,
|
||||
unsigned reconnectTimeout,
|
||||
unsigned noDataTimeoutSecs = 5,
|
||||
@@ -55,7 +55,7 @@ class GenericConnection : public TcpConnectionHandler
|
||||
virtual void OnTerminated(TcpConnection *con);
|
||||
void Send(Base::ByteStream &msg);
|
||||
inline const char *getHost() const { return m_host.c_str(); }
|
||||
inline const short getPort() const { return m_port; }
|
||||
inline const int16_t getPort() const { return m_port; }
|
||||
|
||||
inline eConnectStatus isConnected() { return m_bConnected; }
|
||||
void disconnect();
|
||||
@@ -67,7 +67,7 @@ private:
|
||||
TcpManager *m_manager;
|
||||
TcpConnection *m_con;
|
||||
std::string m_host;
|
||||
short m_port;
|
||||
int16_t m_port;
|
||||
unsigned m_lastTrack;
|
||||
eConState m_conState;
|
||||
time_t m_conTimeout;
|
||||
|
||||
+2
-2
@@ -16,14 +16,14 @@ namespace NAMESPACE
|
||||
using namespace Base;
|
||||
|
||||
//-------------------------------------------
|
||||
GenericRequest::GenericRequest(short type, unsigned server_track)
|
||||
GenericRequest::GenericRequest(int16_t type, unsigned server_track)
|
||||
: m_type(type), m_server_track(server_track), m_track(0), m_timeout(100)
|
||||
//-------------------------------------------
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------
|
||||
GenericResponse::GenericResponse(short type, unsigned result, void *user)
|
||||
GenericResponse::GenericResponse(int16_t type, unsigned result, void *user)
|
||||
: m_type(type), m_result(result), m_user(user), m_track(0), m_timeout(100)
|
||||
//-------------------------------------------
|
||||
{
|
||||
|
||||
+6
-6
@@ -22,11 +22,11 @@ class GenericRequest
|
||||
//-------------------------------------------
|
||||
{
|
||||
public:
|
||||
GenericRequest(short type, unsigned server_track = 0);
|
||||
GenericRequest(int16_t type, unsigned server_track = 0);
|
||||
virtual ~GenericRequest() {};
|
||||
|
||||
virtual void pack(Base::ByteStream &msg) = 0;
|
||||
short getType() const { return m_type; }
|
||||
int16_t getType() const { return m_type; }
|
||||
void setTimeout(time_t t) { m_timeout = t; }
|
||||
time_t getTimeout() { return m_timeout; }
|
||||
void setTrack(unsigned t) { m_track = t; }
|
||||
@@ -35,7 +35,7 @@ public:
|
||||
inline void setServerTrack(unsigned track) { m_server_track = track; }
|
||||
|
||||
protected:
|
||||
short m_type;
|
||||
int16_t m_type;
|
||||
unsigned m_track;
|
||||
time_t m_timeout;
|
||||
unsigned m_server_track;
|
||||
@@ -49,11 +49,11 @@ class GenericResponse
|
||||
//-------------------------------------------
|
||||
{
|
||||
public:
|
||||
GenericResponse(short type, unsigned result, void *user);
|
||||
GenericResponse(int16_t type, unsigned result, void *user);
|
||||
virtual ~GenericResponse() {};
|
||||
virtual void unpack(Base::ByteStream::ReadIterator &iter);
|
||||
|
||||
short getType() const { return m_type; }
|
||||
int16_t getType() const { return m_type; }
|
||||
void setTimeout(time_t t) { m_timeout = t; }
|
||||
time_t getTimeout() { return m_timeout; }
|
||||
void setTrack(unsigned t) { m_track = t; }
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
void setResult(unsigned res) { m_result = res; }
|
||||
void * getUser() const { return m_user; }
|
||||
protected:
|
||||
short m_type;
|
||||
int16_t m_type;
|
||||
unsigned m_track;
|
||||
unsigned m_result;
|
||||
void *m_user;
|
||||
|
||||
Reference in New Issue
Block a user