diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-07-01 20:41:31 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-07-01 20:41:31 -0300 |
| commit | aaf198773fd8e041b0976cc0682e83f8acf394d0 (patch) | |
| tree | 5fcf0b6b1b927dda842ae98b041463cdafd14126 /src/query.hh | |
| parent | 11ae3d0e42293d01b4d729ed5b6fceb8f0ec3fa5 (diff) | |
| download | game-aaf198773fd8e041b0976cc0682e83f8acf394d0.tar.gz game-aaf198773fd8e041b0976cc0682e83f8acf394d0.zip | |
beginning of `query.cc`
Diffstat (limited to 'src/query.hh')
| -rw-r--r-- | src/query.hh | 39 |
1 files changed, 35 insertions, 4 deletions
diff --git a/src/query.hh b/src/query.hh index a69413a..8bdd527 100644 --- a/src/query.hh +++ b/src/query.hh @@ -4,8 +4,43 @@ #include "common.hh" #include "threads.hh" +enum : int { + QUERY_OK = 0, + QUERY_ERROR = 1, + QUERY_FAILED = 3, +}; + struct TQueryManagerConnection{ TQueryManagerConnection(int QueryBufferSize); + ~TQueryManagerConnection(void); + + void connect(void); + void disconnect(void); + int write(const uint8 *Buffer, int Size); + int read(uint8 *Buffer, int Size, int Timeout); + bool isConnected(void){ + return this->Socket != -1; + } + + void prepareQuery(int QueryType); + void sendFlag(bool Flag); + void sendByte(uint8 Byte); + void sendWord(uint16 Word); + void sendQuad(uint32 Quad); + void sendString(const char *String); + void sendBytes(const uint8 *Buffer, int Count); + + bool getFlag(void); + uint8 getByte(void); + uint16 getWord(void); + uint32 getQuad(void); + void getString(char *Buffer, int MaxLength); + void getBytes(uint8 *Buffer, int Count); + + int executeQuery(int Timeout, bool AutoReconnect); + +//== + int loadWorldConfig(int *WorldType, int *RebootTime, int *IPAddress, int *Port, int *MaxPlayers, int *PremiumPlayerBuffer, @@ -71,10 +106,6 @@ struct TQueryManagerConnection{ int insertHouseOwner(uint16 HouseID, uint32 OwnerID, int PaidUntil); int updateHouseOwner(uint16 HouseID, uint32 OwnerID, int PaidUntil); - bool isConnected(void){ - return this->Socket >= 0; - } - // DATA // ================= int BufferSize; |
