small cleanup + fix sigaction flags
This commit is contained in:
parent
6d498fe17d
commit
638244fd07
@ -17,13 +17,13 @@
|
|||||||
// NOTE(fusion): We seem to add this value of 48 every time `NetLoad` is called,
|
// NOTE(fusion): We seem to add this value of 48 every time `NetLoad` is called,
|
||||||
// and I assume it is to account for IPv4 (20 bytes) and TCP (20 bytes) headers
|
// and I assume it is to account for IPv4 (20 bytes) and TCP (20 bytes) headers
|
||||||
// although there are still 8 bytes on the table that I'm not sure where are
|
// although there are still 8 bytes on the table that I'm not sure where are
|
||||||
// comming from.
|
// coming from.
|
||||||
#define PACKET_AVERAGE_SIZE_OVERHEAD 48
|
#define PACKET_AVERAGE_SIZE_OVERHEAD 48
|
||||||
|
|
||||||
#define MAX_COMMUNICATION_THREADS 1100
|
#define MAX_COMMUNICATION_THREADS 1100
|
||||||
#define COMMUNICATION_THREAD_STACK_SIZE ((int)KB(64))
|
#define COMMUNICATION_THREAD_STACK_SIZE ((int)KB(64))
|
||||||
|
|
||||||
static int TERMINALVERSION[] = {770, 770, 770};
|
static const int TERMINALVERSION[] = {770, 770, 770};
|
||||||
static int TCPSocket;
|
static int TCPSocket;
|
||||||
static ThreadHandle AcceptorThread;
|
static ThreadHandle AcceptorThread;
|
||||||
static pid_t AcceptorThreadPID;
|
static pid_t AcceptorThreadPID;
|
||||||
|
|||||||
15
src/main.cc
15
src/main.cc
@ -34,16 +34,11 @@ static sighandler_t handler(int signr, sighandler_t sighandler){
|
|||||||
// signals that share the same handler.
|
// signals that share the same handler.
|
||||||
sigemptyset(&act.sa_mask);
|
sigemptyset(&act.sa_mask);
|
||||||
|
|
||||||
// TODO(fusion): We had this weird logic in the decompiled version of this
|
if(signr == SIGALRM){
|
||||||
// function but it looks like some GLIBC internal thing, since these values
|
act.sa_flags = SA_INTERRUPT;
|
||||||
// would mask signals 1020 and 1021 which don't really make sense.
|
}else{
|
||||||
//
|
act.sa_flags = SA_RESTART;
|
||||||
//if(signr == SIGALRM){
|
}
|
||||||
// act.sa_mask.__val[0x1f] = 0x20000000;
|
|
||||||
//}else{
|
|
||||||
// act.sa_mask.__val[0x1f] = 0x10000000;
|
|
||||||
//}
|
|
||||||
//
|
|
||||||
|
|
||||||
if(sigaction(signr, &act, &oldact) == 0){
|
if(sigaction(signr, &act, &oldact) == 0){
|
||||||
return oldact.sa_handler;
|
return oldact.sa_handler;
|
||||||
|
|||||||
242
src/query.cc
242
src/query.cc
@ -93,9 +93,9 @@ void TQueryManagerConnection::connect(void){
|
|||||||
this->sendString(LoginData);
|
this->sendString(LoginData);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Ret = this->executeQuery(30, false);
|
int Status = this->executeQuery(30, false);
|
||||||
if(Ret != 0){
|
if(Status != QUERY_STATUS_OK){
|
||||||
print(2, "TQueryManagerConnection::connect: Anmeldung fehlgeschlagen (%d).\n", Ret);
|
print(2, "TQueryManagerConnection::connect: Anmeldung fehlgeschlagen (%d).\n", Status);
|
||||||
this->disconnect();
|
this->disconnect();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -299,7 +299,7 @@ int TQueryManagerConnection::executeQuery(int Timeout, bool AutoReconnect){
|
|||||||
PacketSize += 4;
|
PacketSize += 4;
|
||||||
if(PacketSize > this->BufferSize){
|
if(PacketSize > this->BufferSize){
|
||||||
error("TQueryManagerConnection::executeQuery: Puffer zu klein.\n");
|
error("TQueryManagerConnection::executeQuery: Puffer zu klein.\n");
|
||||||
return QUERY_FAILED;
|
return QUERY_STATUS_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(&this->Buffer[6], &this->Buffer[2], PayloadSize);
|
memmove(&this->Buffer[6], &this->Buffer[2], PayloadSize);
|
||||||
@ -309,13 +309,13 @@ int TQueryManagerConnection::executeQuery(int Timeout, bool AutoReconnect){
|
|||||||
|
|
||||||
if(!this->QueryOk){
|
if(!this->QueryOk){
|
||||||
error("TQueryManagerConnection::executeQuery: Fehler beim Zusammenbauen der Anfrage.\n");
|
error("TQueryManagerConnection::executeQuery: Fehler beim Zusammenbauen der Anfrage.\n");
|
||||||
return QUERY_FAILED;
|
return QUERY_STATUS_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
for(int Attempt = 0; true; Attempt += 1){
|
for(int Attempt = 0; true; Attempt += 1){
|
||||||
if(!this->isConnected()){
|
if(!this->isConnected()){
|
||||||
if(!AutoReconnect){
|
if(!AutoReconnect){
|
||||||
return QUERY_FAILED;
|
return QUERY_STATUS_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(fusion): There was also a "fast" path that allocated on the
|
// TODO(fusion): There was also a "fast" path that allocated on the
|
||||||
@ -329,7 +329,7 @@ int TQueryManagerConnection::executeQuery(int Timeout, bool AutoReconnect){
|
|||||||
delete[] TempBuffer;
|
delete[] TempBuffer;
|
||||||
|
|
||||||
if(!this->isConnected()){
|
if(!this->isConnected()){
|
||||||
return QUERY_FAILED;
|
return QUERY_STATUS_FAILED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -337,7 +337,7 @@ int TQueryManagerConnection::executeQuery(int Timeout, bool AutoReconnect){
|
|||||||
this->disconnect();
|
this->disconnect();
|
||||||
if(Attempt > 0){
|
if(Attempt > 0){
|
||||||
error("TQueryManagerConnection::executeQuery: Fehler beim Abschicken der Anfrage.\n");
|
error("TQueryManagerConnection::executeQuery: Fehler beim Abschicken der Anfrage.\n");
|
||||||
return QUERY_FAILED;
|
return QUERY_STATUS_FAILED;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -347,7 +347,7 @@ int TQueryManagerConnection::executeQuery(int Timeout, bool AutoReconnect){
|
|||||||
if(BytesRead != 2){
|
if(BytesRead != 2){
|
||||||
this->disconnect();
|
this->disconnect();
|
||||||
if(BytesRead == -2 || Attempt > 0){
|
if(BytesRead == -2 || Attempt > 0){
|
||||||
return QUERY_FAILED;
|
return QUERY_STATUS_FAILED;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -356,7 +356,7 @@ int TQueryManagerConnection::executeQuery(int Timeout, bool AutoReconnect){
|
|||||||
if(ResponseSize == 0xFFFF){
|
if(ResponseSize == 0xFFFF){
|
||||||
if(this->read(Help, 4, Timeout) != 4){
|
if(this->read(Help, 4, Timeout) != 4){
|
||||||
this->disconnect();
|
this->disconnect();
|
||||||
return QUERY_FAILED;
|
return QUERY_STATUS_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
ResponseSize = ((int)Help[0]) | ((int)Help[1] << 8)
|
ResponseSize = ((int)Help[0]) | ((int)Help[1] << 8)
|
||||||
@ -366,19 +366,19 @@ int TQueryManagerConnection::executeQuery(int Timeout, bool AutoReconnect){
|
|||||||
if(ResponseSize <= 0 || ResponseSize > this->BufferSize){
|
if(ResponseSize <= 0 || ResponseSize > this->BufferSize){
|
||||||
this->disconnect();
|
this->disconnect();
|
||||||
error("TQueryManagerConnection::executeQuery: Ungültige Datengröße %d.\n", ResponseSize);
|
error("TQueryManagerConnection::executeQuery: Ungültige Datengröße %d.\n", ResponseSize);
|
||||||
return QUERY_FAILED;
|
return QUERY_STATUS_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(this->read(this->Buffer, ResponseSize, Timeout) != ResponseSize){
|
if(this->read(this->Buffer, ResponseSize, Timeout) != ResponseSize){
|
||||||
this->disconnect();
|
this->disconnect();
|
||||||
error("TQueryManagerConnection::executeQuery: Fehler beim Auslesen der Daten.\n");
|
error("TQueryManagerConnection::executeQuery: Fehler beim Auslesen der Daten.\n");
|
||||||
return QUERY_FAILED;
|
return QUERY_STATUS_FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->ReadBuffer.Size = ResponseSize;
|
this->ReadBuffer.Size = ResponseSize;
|
||||||
this->ReadBuffer.Position = 0;
|
this->ReadBuffer.Position = 0;
|
||||||
int Status = this->getByte();
|
int Status = this->getByte();
|
||||||
if(Status == QUERY_FAILED){
|
if(Status == QUERY_STATUS_FAILED){
|
||||||
error("TQueryManagerConnection::executeQuery: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::executeQuery: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -393,8 +393,8 @@ int TQueryManagerConnection::checkAccountPassword(uint32 AccountID,
|
|||||||
this->sendString(Password);
|
this->sendString(Password);
|
||||||
this->sendString(IPAddress);
|
this->sendString(IPAddress);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_ERROR){
|
if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode >= 1 && ErrorCode <= 4){
|
if(ErrorCode >= 1 && ErrorCode <= 4){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
@ -412,8 +412,8 @@ int TQueryManagerConnection::loginAdmin(uint32 AccountID, bool PrivateWorld,
|
|||||||
this->sendQuad(AccountID);
|
this->sendQuad(AccountID);
|
||||||
this->sendFlag(PrivateWorld);
|
this->sendFlag(PrivateWorld);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*NumberOfCharacters = this->getByte();
|
*NumberOfCharacters = this->getByte();
|
||||||
for(int i = 0; i < *NumberOfCharacters; i += 1){
|
for(int i = 0; i < *NumberOfCharacters; i += 1){
|
||||||
this->getString(Characters[i], 30);
|
this->getString(Characters[i], 30);
|
||||||
@ -422,7 +422,7 @@ int TQueryManagerConnection::loginAdmin(uint32 AccountID, bool PrivateWorld,
|
|||||||
Ports[i] = this->getWord();
|
Ports[i] = this->getWord();
|
||||||
}
|
}
|
||||||
*PremiumDaysLeft = this->getWord();
|
*PremiumDaysLeft = this->getWord();
|
||||||
}else if(Status == QUERY_ERROR){
|
}else if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode == 1){
|
if(ErrorCode == 1){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
@ -438,8 +438,8 @@ int TQueryManagerConnection::loadWorldConfig(int *WorldType, int *RebootTime,
|
|||||||
int *MaxNewbies, int *PremiumNewbieBuffer){
|
int *MaxNewbies, int *PremiumNewbieBuffer){
|
||||||
this->prepareQuery(53);
|
this->prepareQuery(53);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*WorldType = this->getByte();
|
*WorldType = this->getByte();
|
||||||
*RebootTime = (int)this->getByte() * 60;
|
*RebootTime = (int)this->getByte() * 60;
|
||||||
IPAddress[0] = this->getByte();
|
IPAddress[0] = this->getByte();
|
||||||
@ -679,8 +679,8 @@ int TQueryManagerConnection::loginGame(uint32 AccountID, char *PlayerName,
|
|||||||
this->sendFlag(PremiumAccountRequired);
|
this->sendFlag(PremiumAccountRequired);
|
||||||
this->sendFlag(GamemasterRequired);
|
this->sendFlag(GamemasterRequired);
|
||||||
int Status = this->executeQuery(120, true);
|
int Status = this->executeQuery(120, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*CharacterID = this->getQuad();
|
*CharacterID = this->getQuad();
|
||||||
this->getString(PlayerName, 30);
|
this->getString(PlayerName, 30);
|
||||||
*Sex = this->getByte();
|
*Sex = this->getByte();
|
||||||
@ -723,7 +723,7 @@ int TQueryManagerConnection::loginGame(uint32 AccountID, char *PlayerName,
|
|||||||
}
|
}
|
||||||
|
|
||||||
*PremiumAccountActivated = this->getFlag();
|
*PremiumAccountActivated = this->getFlag();
|
||||||
}else if(Status == QUERY_ERROR){
|
}else if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode >= 1 && ErrorCode <= 15){
|
if(ErrorCode >= 1 && ErrorCode <= 15){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
@ -744,7 +744,7 @@ int TQueryManagerConnection::logoutGame(uint32 CharacterID, int Level, const cha
|
|||||||
this->sendQuad((uint32)LastLoginTime);
|
this->sendQuad((uint32)LastLoginTime);
|
||||||
this->sendWord((uint16)TutorActivities);
|
this->sendWord((uint16)TutorActivities);
|
||||||
int Status = this->executeQuery(120, true);
|
int Status = this->executeQuery(120, true);
|
||||||
return (Status == QUERY_OK ? 0 : -1);
|
return (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TQueryManagerConnection::setNotation(uint32 GamemasterID, const char *PlayerName,
|
int TQueryManagerConnection::setNotation(uint32 GamemasterID, const char *PlayerName,
|
||||||
@ -756,10 +756,10 @@ int TQueryManagerConnection::setNotation(uint32 GamemasterID, const char *Player
|
|||||||
this->sendString(Reason);
|
this->sendString(Reason);
|
||||||
this->sendString(Comment);
|
this->sendString(Comment);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*BanishmentID = this->getQuad();
|
*BanishmentID = this->getQuad();
|
||||||
}else if(Status == QUERY_ERROR){
|
}else if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode >= 1 && ErrorCode <= 2){
|
if(ErrorCode >= 1 && ErrorCode <= 2){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
@ -781,15 +781,15 @@ int TQueryManagerConnection::setNamelock(uint32 GamemasterID, const char *Player
|
|||||||
this->sendString(Reason);
|
this->sendString(Reason);
|
||||||
this->sendString(Comment);
|
this->sendString(Comment);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_ERROR){
|
if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode >= 1 && ErrorCode <= 4){
|
if(ErrorCode >= 1 && ErrorCode <= 4){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
}else{
|
}else{
|
||||||
error("TQueryManagerConnection::setNamelock: Ungültiger Fehlercode %d.\n", ErrorCode);
|
error("TQueryManagerConnection::setNamelock: Ungültiger Fehlercode %d.\n", ErrorCode);
|
||||||
}
|
}
|
||||||
}else if(Status != QUERY_OK){
|
}else if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::setNamelock: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::setNamelock: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -806,15 +806,15 @@ int TQueryManagerConnection::banishAccount(uint32 GamemasterID, const char *Play
|
|||||||
this->sendString(Comment);
|
this->sendString(Comment);
|
||||||
this->sendFlag(*FinalWarning);
|
this->sendFlag(*FinalWarning);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*BanishmentID = this->getQuad();
|
*BanishmentID = this->getQuad();
|
||||||
*Days = this->getByte();
|
*Days = this->getByte();
|
||||||
*FinalWarning = this->getFlag();
|
*FinalWarning = this->getFlag();
|
||||||
if(*Days == 0xFF){
|
if(*Days == 0xFF){
|
||||||
*Days = -1;
|
*Days = -1;
|
||||||
}
|
}
|
||||||
}else if(Status == QUERY_ERROR){
|
}else if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode >= 1 && ErrorCode <= 3){
|
if(ErrorCode >= 1 && ErrorCode <= 3){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
@ -858,15 +858,15 @@ int TQueryManagerConnection::reportStatement(uint32 ReporterID, const char *Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Status = this->executeQuery(180, true);
|
int Status = this->executeQuery(180, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_ERROR){
|
if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode >= 1 && ErrorCode <= 2){
|
if(ErrorCode >= 1 && ErrorCode <= 2){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
}else{
|
}else{
|
||||||
error("TQueryManagerConnection::reportStatement: Ungültiger Fehlercode %d.\n", ErrorCode);
|
error("TQueryManagerConnection::reportStatement: Ungültiger Fehlercode %d.\n", ErrorCode);
|
||||||
}
|
}
|
||||||
}else if(Status != QUERY_OK){
|
}else if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::reportStatement: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::reportStatement: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -881,15 +881,15 @@ int TQueryManagerConnection::banishIPAddress(uint32 GamemasterID, const char *Pl
|
|||||||
this->sendString(Reason);
|
this->sendString(Reason);
|
||||||
this->sendString(Comment);
|
this->sendString(Comment);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_ERROR){
|
if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode >= 1 && ErrorCode <= 2){
|
if(ErrorCode >= 1 && ErrorCode <= 2){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
}else{
|
}else{
|
||||||
error("TQueryManagerConnection::banishIPAddress: Ungültiger Fehlercode %d.\n", ErrorCode);
|
error("TQueryManagerConnection::banishIPAddress: Ungültiger Fehlercode %d.\n", ErrorCode);
|
||||||
}
|
}
|
||||||
}else if(Status != QUERY_OK){
|
}else if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::banishIPAddress: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::banishIPAddress: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -905,8 +905,8 @@ int TQueryManagerConnection::logCharacterDeath(uint32 CharacterID, int Level,
|
|||||||
this->sendFlag(Unjustified);
|
this->sendFlag(Unjustified);
|
||||||
this->sendQuad((uint32)Time);
|
this->sendQuad((uint32)Time);
|
||||||
int Status = this->executeQuery(90, true);
|
int Status = this->executeQuery(90, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::logCharacterDeath: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::logCharacterDeath: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -917,8 +917,8 @@ int TQueryManagerConnection::addBuddy(uint32 AccountID, uint32 Buddy){
|
|||||||
this->sendQuad(AccountID);
|
this->sendQuad(AccountID);
|
||||||
this->sendQuad(Buddy);
|
this->sendQuad(Buddy);
|
||||||
int Status = this->executeQuery(90, true);
|
int Status = this->executeQuery(90, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::addBuddy: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::addBuddy: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -929,8 +929,8 @@ int TQueryManagerConnection::removeBuddy(uint32 AccountID, uint32 Buddy){
|
|||||||
this->sendQuad(AccountID);
|
this->sendQuad(AccountID);
|
||||||
this->sendQuad(Buddy);
|
this->sendQuad(Buddy);
|
||||||
int Status = this->executeQuery(90, true);
|
int Status = this->executeQuery(90, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::removeBuddy: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::removeBuddy: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -940,8 +940,8 @@ int TQueryManagerConnection::decrementIsOnline(uint32 CharacterID){
|
|||||||
this->prepareQuery(32);
|
this->prepareQuery(32);
|
||||||
this->sendQuad(CharacterID);
|
this->sendQuad(CharacterID);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::decrementIsOnline: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::decrementIsOnline: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -951,8 +951,8 @@ int TQueryManagerConnection::finishAuctions(int *NumberOfAuctions, uint16 *House
|
|||||||
uint32 *CharacterIDs, char (*CharacterNames)[30], int *Bids){
|
uint32 *CharacterIDs, char (*CharacterNames)[30], int *Bids){
|
||||||
this->prepareQuery(33);
|
this->prepareQuery(33);
|
||||||
int Status = this->executeQuery(60, true);
|
int Status = this->executeQuery(60, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
int MaxNumberOfAuctions = *NumberOfAuctions;
|
int MaxNumberOfAuctions = *NumberOfAuctions;
|
||||||
*NumberOfAuctions = this->getWord();
|
*NumberOfAuctions = this->getWord();
|
||||||
if(*NumberOfAuctions > MaxNumberOfAuctions){
|
if(*NumberOfAuctions > MaxNumberOfAuctions){
|
||||||
@ -978,8 +978,8 @@ int TQueryManagerConnection::excludeFromAuctions(uint32 CharacterID, bool Banish
|
|||||||
this->sendQuad(CharacterID);
|
this->sendQuad(CharacterID);
|
||||||
this->sendFlag(Banish);
|
this->sendFlag(Banish);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::excludeFromAuctions: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::excludeFromAuctions: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -989,8 +989,8 @@ int TQueryManagerConnection::transferHouses(int *NumberOfTransfers, uint16 *Hous
|
|||||||
uint32 *NewOwnerIDs, char (*NewOwnerNames)[30], int *Prices){
|
uint32 *NewOwnerIDs, char (*NewOwnerNames)[30], int *Prices){
|
||||||
this->prepareQuery(35);
|
this->prepareQuery(35);
|
||||||
int Status = this->executeQuery(60, true);
|
int Status = this->executeQuery(60, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
int MaxNumberOfTransfers = *NumberOfTransfers;
|
int MaxNumberOfTransfers = *NumberOfTransfers;
|
||||||
*NumberOfTransfers = this->getWord();
|
*NumberOfTransfers = this->getWord();
|
||||||
if(*NumberOfTransfers > MaxNumberOfTransfers){
|
if(*NumberOfTransfers > MaxNumberOfTransfers){
|
||||||
@ -1015,8 +1015,8 @@ int TQueryManagerConnection::cancelHouseTransfer(uint16 HouseID){
|
|||||||
this->prepareQuery(52);
|
this->prepareQuery(52);
|
||||||
this->sendWord(HouseID);
|
this->sendWord(HouseID);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::cancelHouseTransfer: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::cancelHouseTransfer: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -1026,8 +1026,8 @@ int TQueryManagerConnection::evictFreeAccounts(int *NumberOfEvictions,
|
|||||||
uint16 *HouseIDs, uint32 *OwnerIDs){
|
uint16 *HouseIDs, uint32 *OwnerIDs){
|
||||||
this->prepareQuery(36);
|
this->prepareQuery(36);
|
||||||
int Status = this->executeQuery(60, true);
|
int Status = this->executeQuery(60, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
int MaxNumberOfEvictions = *NumberOfEvictions;
|
int MaxNumberOfEvictions = *NumberOfEvictions;
|
||||||
*NumberOfEvictions = this->getWord();
|
*NumberOfEvictions = this->getWord();
|
||||||
if(*NumberOfEvictions > MaxNumberOfEvictions){
|
if(*NumberOfEvictions > MaxNumberOfEvictions){
|
||||||
@ -1049,8 +1049,8 @@ int TQueryManagerConnection::evictFreeAccounts(int *NumberOfEvictions,
|
|||||||
int TQueryManagerConnection::evictDeletedCharacters(int *NumberOfEvictions, uint16 *HouseIDs){
|
int TQueryManagerConnection::evictDeletedCharacters(int *NumberOfEvictions, uint16 *HouseIDs){
|
||||||
this->prepareQuery(37);
|
this->prepareQuery(37);
|
||||||
int Status = this->executeQuery(60, true);
|
int Status = this->executeQuery(60, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
int MaxNumberOfEvictions = *NumberOfEvictions;
|
int MaxNumberOfEvictions = *NumberOfEvictions;
|
||||||
*NumberOfEvictions = this->getWord();
|
*NumberOfEvictions = this->getWord();
|
||||||
if(*NumberOfEvictions > MaxNumberOfEvictions){
|
if(*NumberOfEvictions > MaxNumberOfEvictions){
|
||||||
@ -1079,8 +1079,8 @@ int TQueryManagerConnection::evictExGuildleaders(int NumberOfGuildhouses,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Status = this->executeQuery(60, true);
|
int Status = this->executeQuery(60, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*NumberOfEvictions = this->getWord();
|
*NumberOfEvictions = this->getWord();
|
||||||
for(int i = 0; i < *NumberOfEvictions; i += 1){
|
for(int i = 0; i < *NumberOfEvictions; i += 1){
|
||||||
HouseIDs[i] = this->getWord();
|
HouseIDs[i] = this->getWord();
|
||||||
@ -1097,8 +1097,8 @@ int TQueryManagerConnection::insertHouseOwner(uint16 HouseID, uint32 OwnerID, in
|
|||||||
this->sendQuad(OwnerID);
|
this->sendQuad(OwnerID);
|
||||||
this->sendQuad((uint32)PaidUntil);
|
this->sendQuad((uint32)PaidUntil);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::insertHouseOwner: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::insertHouseOwner: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -1110,8 +1110,8 @@ int TQueryManagerConnection::updateHouseOwner(uint16 HouseID, uint32 OwnerID, in
|
|||||||
this->sendQuad(OwnerID);
|
this->sendQuad(OwnerID);
|
||||||
this->sendQuad((uint32)PaidUntil);
|
this->sendQuad((uint32)PaidUntil);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::updateHouseOwner: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::updateHouseOwner: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -1121,8 +1121,8 @@ int TQueryManagerConnection::deleteHouseOwner(uint16 HouseID){
|
|||||||
this->prepareQuery(41);
|
this->prepareQuery(41);
|
||||||
this->sendWord(HouseID);
|
this->sendWord(HouseID);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::deleteHouseOwner: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::deleteHouseOwner: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -1132,8 +1132,8 @@ int TQueryManagerConnection::getHouseOwners(int *NumberOfOwners, uint16 *HouseID
|
|||||||
uint32 *OwnerIDs, char (*OwnerNames)[30], int *PaidUntils){
|
uint32 *OwnerIDs, char (*OwnerNames)[30], int *PaidUntils){
|
||||||
this->prepareQuery(42);
|
this->prepareQuery(42);
|
||||||
int Status = this->executeQuery(60, true);
|
int Status = this->executeQuery(60, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
int MaxNumberOfOwners = *NumberOfOwners;
|
int MaxNumberOfOwners = *NumberOfOwners;
|
||||||
*NumberOfOwners = this->getWord();
|
*NumberOfOwners = this->getWord();
|
||||||
if(*NumberOfOwners > MaxNumberOfOwners){
|
if(*NumberOfOwners > MaxNumberOfOwners){
|
||||||
@ -1157,8 +1157,8 @@ int TQueryManagerConnection::getHouseOwners(int *NumberOfOwners, uint16 *HouseID
|
|||||||
int TQueryManagerConnection::getAuctions(int *NumberOfAuctions, uint16 *HouseIDs){
|
int TQueryManagerConnection::getAuctions(int *NumberOfAuctions, uint16 *HouseIDs){
|
||||||
this->prepareQuery(43);
|
this->prepareQuery(43);
|
||||||
int Status = this->executeQuery(120, true);
|
int Status = this->executeQuery(120, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
int MaxNumberOfAuctions = *NumberOfAuctions;
|
int MaxNumberOfAuctions = *NumberOfAuctions;
|
||||||
*NumberOfAuctions = this->getWord();
|
*NumberOfAuctions = this->getWord();
|
||||||
if(*NumberOfAuctions > MaxNumberOfAuctions){
|
if(*NumberOfAuctions > MaxNumberOfAuctions){
|
||||||
@ -1180,8 +1180,8 @@ int TQueryManagerConnection::startAuction(uint16 HouseID){
|
|||||||
this->prepareQuery(44);
|
this->prepareQuery(44);
|
||||||
this->sendWord(HouseID);
|
this->sendWord(HouseID);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::startAuction: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::startAuction: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -1208,8 +1208,8 @@ int TQueryManagerConnection::insertHouses(int NumberOfHouses, uint16 *HouseIDs,
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Status = this->executeQuery(60, true);
|
int Status = this->executeQuery(60, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::insertHouses: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::insertHouses: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -1218,8 +1218,8 @@ int TQueryManagerConnection::insertHouses(int NumberOfHouses, uint16 *HouseIDs,
|
|||||||
int TQueryManagerConnection::clearIsOnline(int *NumberOfAffectedPlayers){
|
int TQueryManagerConnection::clearIsOnline(int *NumberOfAffectedPlayers){
|
||||||
this->prepareQuery(46);
|
this->prepareQuery(46);
|
||||||
int Status = this->executeQuery(120, true);
|
int Status = this->executeQuery(120, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*NumberOfAffectedPlayers = this->getWord();
|
*NumberOfAffectedPlayers = this->getWord();
|
||||||
}else{
|
}else{
|
||||||
error("TQueryManagerConnection::clearIsOnline: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::clearIsOnline: Anfrage fehlgeschlagen.\n");
|
||||||
@ -1243,8 +1243,8 @@ int TQueryManagerConnection::createPlayerlist(int NumberOfPlayers, const char **
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Status = this->executeQuery(240, true);
|
int Status = this->executeQuery(240, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*NewRecord = this->getFlag();
|
*NewRecord = this->getFlag();
|
||||||
}else{
|
}else{
|
||||||
error("TQueryManagerConnection::createPlayerlist: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::createPlayerlist: Anfrage fehlgeschlagen.\n");
|
||||||
@ -1264,8 +1264,8 @@ int TQueryManagerConnection::logKilledCreatures(int NumberOfRaces, const char **
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Status = this->executeQuery(240, true);
|
int Status = this->executeQuery(240, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::logKilledCreatures: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::logKilledCreatures: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -1276,8 +1276,8 @@ int TQueryManagerConnection::loadPlayers(uint32 MinimumCharacterID, int *NumberO
|
|||||||
this->prepareQuery(50);
|
this->prepareQuery(50);
|
||||||
this->sendQuad(MinimumCharacterID);
|
this->sendQuad(MinimumCharacterID);
|
||||||
int Status = this->executeQuery(900, true);
|
int Status = this->executeQuery(900, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
// TODO(fusion): This is called to fill the player index in `InitPlayerIndex`
|
// TODO(fusion): This is called to fill the player index in `InitPlayerIndex`
|
||||||
// but there is no explicit parameter that limits how many results are returned
|
// but there is no explicit parameter that limits how many results are returned
|
||||||
// which could be a problem.
|
// which could be a problem.
|
||||||
@ -1297,8 +1297,8 @@ int TQueryManagerConnection::getKeptCharacters(uint32 MinimumCharacterID,
|
|||||||
this->prepareQuery(200);
|
this->prepareQuery(200);
|
||||||
this->sendQuad(MinimumCharacterID);
|
this->sendQuad(MinimumCharacterID);
|
||||||
int Status = this->executeQuery(1800, true);
|
int Status = this->executeQuery(1800, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
// TODO(fusion): Same as `loadPlayers`.
|
// TODO(fusion): Same as `loadPlayers`.
|
||||||
*NumberOfPlayers = (int)this->getQuad();
|
*NumberOfPlayers = (int)this->getQuad();
|
||||||
for(int i = 0; i < *NumberOfPlayers; i += 1){
|
for(int i = 0; i < *NumberOfPlayers; i += 1){
|
||||||
@ -1315,8 +1315,8 @@ int TQueryManagerConnection::getDeletedCharacters(uint32 MinimumCharacterID,
|
|||||||
this->prepareQuery(201);
|
this->prepareQuery(201);
|
||||||
this->sendQuad(MinimumCharacterID);
|
this->sendQuad(MinimumCharacterID);
|
||||||
int Status = this->executeQuery(900, true);
|
int Status = this->executeQuery(900, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
// TODO(fusion): Same as `loadPlayers`.
|
// TODO(fusion): Same as `loadPlayers`.
|
||||||
*NumberOfPlayers = (int)this->getQuad();
|
*NumberOfPlayers = (int)this->getQuad();
|
||||||
for(int i = 0; i < *NumberOfPlayers; i += 1){
|
for(int i = 0; i < *NumberOfPlayers; i += 1){
|
||||||
@ -1332,8 +1332,8 @@ int TQueryManagerConnection::deleteOldCharacter(uint32 CharacterID){
|
|||||||
this->prepareQuery(202);
|
this->prepareQuery(202);
|
||||||
this->sendQuad(CharacterID);
|
this->sendQuad(CharacterID);
|
||||||
int Status = this->executeQuery(30, true);
|
int Status = this->executeQuery(30, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::deleteOldCharacter: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::deleteOldCharacter: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -1344,8 +1344,8 @@ int TQueryManagerConnection::getHiddenCharacters(uint32 MinimumCharacterID,
|
|||||||
this->prepareQuery(203);
|
this->prepareQuery(203);
|
||||||
this->sendQuad(MinimumCharacterID);
|
this->sendQuad(MinimumCharacterID);
|
||||||
int Status = this->executeQuery(120, true);
|
int Status = this->executeQuery(120, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
// TODO(fusion): Same as `loadPlayers`.
|
// TODO(fusion): Same as `loadPlayers`.
|
||||||
*NumberOfPlayers = (int)this->getQuad();
|
*NumberOfPlayers = (int)this->getQuad();
|
||||||
for(int i = 0; i < *NumberOfPlayers; i += 1){
|
for(int i = 0; i < *NumberOfPlayers; i += 1){
|
||||||
@ -1378,8 +1378,8 @@ int TQueryManagerConnection::createHighscores(int NumberOfPlayers, uint32 *Chara
|
|||||||
}
|
}
|
||||||
|
|
||||||
int Status = this->executeQuery(120, true);
|
int Status = this->executeQuery(120, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::createHighscores: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::createHighscores: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -1388,8 +1388,8 @@ int TQueryManagerConnection::createHighscores(int NumberOfPlayers, uint32 *Chara
|
|||||||
int TQueryManagerConnection::createCensus(void){
|
int TQueryManagerConnection::createCensus(void){
|
||||||
this->prepareQuery(205);
|
this->prepareQuery(205);
|
||||||
int Status = this->executeQuery(600, true);
|
int Status = this->executeQuery(600, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::createCensus: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::createCensus: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -1398,8 +1398,8 @@ int TQueryManagerConnection::createCensus(void){
|
|||||||
int TQueryManagerConnection::createKillStatistics(void){
|
int TQueryManagerConnection::createKillStatistics(void){
|
||||||
this->prepareQuery(206);
|
this->prepareQuery(206);
|
||||||
int Status = this->executeQuery(300, true);
|
int Status = this->executeQuery(300, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status != QUERY_OK){
|
if(Status != QUERY_STATUS_OK){
|
||||||
error("TQueryManagerConnection::createKillStatistics: Anfrage fehlgeschlagen.\n");
|
error("TQueryManagerConnection::createKillStatistics: Anfrage fehlgeschlagen.\n");
|
||||||
}
|
}
|
||||||
return Result;
|
return Result;
|
||||||
@ -1408,8 +1408,8 @@ int TQueryManagerConnection::createKillStatistics(void){
|
|||||||
int TQueryManagerConnection::getPlayersOnline(int *NumberOfWorlds, char (*Names)[30], uint16 *Players){
|
int TQueryManagerConnection::getPlayersOnline(int *NumberOfWorlds, char (*Names)[30], uint16 *Players){
|
||||||
this->prepareQuery(207);
|
this->prepareQuery(207);
|
||||||
int Status = this->executeQuery(120, true);
|
int Status = this->executeQuery(120, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*NumberOfWorlds = this->getByte();
|
*NumberOfWorlds = this->getByte();
|
||||||
for(int i = 0; i < *NumberOfWorlds; i += 1){
|
for(int i = 0; i < *NumberOfWorlds; i += 1){
|
||||||
this->getString(Names[i], 30);
|
this->getString(Names[i], 30);
|
||||||
@ -1424,8 +1424,8 @@ int TQueryManagerConnection::getPlayersOnline(int *NumberOfWorlds, char (*Names)
|
|||||||
int TQueryManagerConnection::getWorlds(int *NumberOfWorlds, char (*Names)[30]){
|
int TQueryManagerConnection::getWorlds(int *NumberOfWorlds, char (*Names)[30]){
|
||||||
this->prepareQuery(208);
|
this->prepareQuery(208);
|
||||||
int Status = this->executeQuery(120, true);
|
int Status = this->executeQuery(120, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*NumberOfWorlds = this->getByte();
|
*NumberOfWorlds = this->getByte();
|
||||||
for(int i = 0; i < *NumberOfWorlds; i += 1){
|
for(int i = 0; i < *NumberOfWorlds; i += 1){
|
||||||
this->getString(Names[i], 30);
|
this->getString(Names[i], 30);
|
||||||
@ -1441,8 +1441,8 @@ int TQueryManagerConnection::getServerLoad(const char *World, int Period, int *D
|
|||||||
this->sendString(World);
|
this->sendString(World);
|
||||||
this->sendByte((uint8)Period);
|
this->sendByte((uint8)Period);
|
||||||
int Status = this->executeQuery(360, true);
|
int Status = this->executeQuery(360, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
// TODO(fusion): Another hardcoded constant?
|
// TODO(fusion): Another hardcoded constant?
|
||||||
for(int i = 0; i < 600; i += 0){
|
for(int i = 0; i < 600; i += 0){
|
||||||
Data[i] = this->getWord();
|
Data[i] = this->getWord();
|
||||||
@ -1481,10 +1481,10 @@ int TQueryManagerConnection::insertPaymentDataOld(uint32 PurchaseNr, uint32 Refe
|
|||||||
this->sendString(Registrant);
|
this->sendString(Registrant);
|
||||||
this->sendQuad(AccountID);
|
this->sendQuad(AccountID);
|
||||||
int Status = this->executeQuery(360, true);
|
int Status = this->executeQuery(360, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*PaymentID = this->getQuad();
|
*PaymentID = this->getQuad();
|
||||||
}else if(Status == QUERY_ERROR){
|
}else if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode == 1){
|
if(ErrorCode == 1){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
@ -1505,10 +1505,10 @@ int TQueryManagerConnection::addPaymentOld(uint32 AccountID, const char *Descrip
|
|||||||
this->sendQuad(PaymentID);
|
this->sendQuad(PaymentID);
|
||||||
this->sendWord((uint16)Days);
|
this->sendWord((uint16)Days);
|
||||||
int Status = this->executeQuery(360, true);
|
int Status = this->executeQuery(360, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*ActionTaken = this->getByte();
|
*ActionTaken = this->getByte();
|
||||||
}else if(Status == QUERY_ERROR){
|
}else if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode >= 1 && ErrorCode <= 2){
|
if(ErrorCode >= 1 && ErrorCode <= 2){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
@ -1528,11 +1528,11 @@ int TQueryManagerConnection::cancelPaymentOld(uint32 PurchaseNr, uint32 Referenc
|
|||||||
this->sendQuad(ReferenceNr);
|
this->sendQuad(ReferenceNr);
|
||||||
this->sendQuad(AccountID);
|
this->sendQuad(AccountID);
|
||||||
int Status = this->executeQuery(360, true);
|
int Status = this->executeQuery(360, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*IllegalUse = this->getFlag();
|
*IllegalUse = this->getFlag();
|
||||||
this->getString(EMailAddress, 50);
|
this->getString(EMailAddress, 50);
|
||||||
}else if(Status == QUERY_ERROR){
|
}else if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode >= 1 && ErrorCode <= 2){
|
if(ErrorCode >= 1 && ErrorCode <= 2){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
@ -1570,10 +1570,10 @@ int TQueryManagerConnection::insertPaymentDataNew(uint32 PurchaseNr, uint32 Refe
|
|||||||
this->sendString(Registrant);
|
this->sendString(Registrant);
|
||||||
this->sendString(PaymentKey);
|
this->sendString(PaymentKey);
|
||||||
int Status = this->executeQuery(360, true);
|
int Status = this->executeQuery(360, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*PaymentID = this->getQuad();
|
*PaymentID = this->getQuad();
|
||||||
}else if(Status == QUERY_ERROR){
|
}else if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode == 1){
|
if(ErrorCode == 1){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
@ -1592,13 +1592,13 @@ int TQueryManagerConnection::addPaymentNew(const char *PaymentKey, uint32 Paymen
|
|||||||
this->sendString(PaymentKey);
|
this->sendString(PaymentKey);
|
||||||
this->sendQuad(PaymentID);
|
this->sendQuad(PaymentID);
|
||||||
int Status = this->executeQuery(360, true);
|
int Status = this->executeQuery(360, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*ActionTaken = this->getByte();
|
*ActionTaken = this->getByte();
|
||||||
if(*ActionTaken == 5){
|
if(*ActionTaken == 5){
|
||||||
this->getString(EMailReceiver, 100);
|
this->getString(EMailReceiver, 100);
|
||||||
}
|
}
|
||||||
}else if(Status == QUERY_ERROR){
|
}else if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode >= 1 && ErrorCode <= 3){
|
if(ErrorCode >= 1 && ErrorCode <= 3){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
@ -1618,12 +1618,12 @@ int TQueryManagerConnection::cancelPaymentNew(uint32 PurchaseNr, uint32 Referenc
|
|||||||
this->sendQuad(ReferenceNr);
|
this->sendQuad(ReferenceNr);
|
||||||
this->sendString(PaymentKey);
|
this->sendString(PaymentKey);
|
||||||
int Status = this->executeQuery(360, true);
|
int Status = this->executeQuery(360, true);
|
||||||
int Result = (Status == QUERY_OK ? 0 : -1);
|
int Result = (Status == QUERY_STATUS_OK ? 0 : -1);
|
||||||
if(Status == QUERY_OK){
|
if(Status == QUERY_STATUS_OK){
|
||||||
*IllegalUse = this->getFlag();
|
*IllegalUse = this->getFlag();
|
||||||
*Present = this->getFlag();
|
*Present = this->getFlag();
|
||||||
this->getString(EMailAddress, 50);
|
this->getString(EMailAddress, 50);
|
||||||
}else if(Status == QUERY_ERROR){
|
}else if(Status == QUERY_STATUS_ERROR){
|
||||||
int ErrorCode = this->getByte();
|
int ErrorCode = this->getByte();
|
||||||
if(ErrorCode == 1){
|
if(ErrorCode == 1){
|
||||||
Result = ErrorCode;
|
Result = ErrorCode;
|
||||||
|
|||||||
@ -5,9 +5,9 @@
|
|||||||
#include "threads.hh"
|
#include "threads.hh"
|
||||||
|
|
||||||
enum : int {
|
enum : int {
|
||||||
QUERY_OK = 0,
|
QUERY_STATUS_OK = 0,
|
||||||
QUERY_ERROR = 1,
|
QUERY_STATUS_ERROR = 1,
|
||||||
QUERY_FAILED = 3,
|
QUERY_STATUS_FAILED = 3,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct TQueryManagerConnection{
|
struct TQueryManagerConnection{
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user