From efeb10adcc606ad261782a260c8ef86e77ea0608 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Sat, 21 Jun 2025 03:35:13 -0300 Subject: `connections.cc` --- reference/game.c | 980 ------------------------------------------------------- 1 file changed, 980 deletions(-) (limited to 'reference/game.c') diff --git a/reference/game.c b/reference/game.c index c954698..7958431 100644 --- a/reference/game.c +++ b/reference/game.c @@ -26681,986 +26681,6 @@ void __static_initialization_and_destruction_0(int __initialize_p,int __priority return; } - - -// DWARF original prototype: void TConnection(TConnection * this) - -void __thiscall TConnection::TConnection(TConnection *this) - -{ - TXTEASymmetricKey::TXTEASymmetricKey(&this->SymmetricKey); - this->State = CONNECTION_FREE; - return; -} - - - -// DWARF original prototype: void TConnection(TConnection * this) - -void __thiscall TConnection::TConnection(TConnection *this) - -{ - TXTEASymmetricKey::TXTEASymmetricKey(&this->SymmetricKey); - this->State = CONNECTION_FREE; - return; -} - - - -// DWARF original prototype: void Process(TConnection * this) - -void __thiscall TConnection::Process(TConnection *this) - -{ - ulong uVar1; - bool bVar2; - CONNECTIONSTATE CVar3; - int Time; - int iVar4; - TPlayer *this_00; - TConnection *pTVar5; - int i; - - CVar3 = this->State; - if (CVar3 == CONNECTION_LOGIN) { - bVar2 = GameRunning(); - if ((!bVar2) || (this->ConnectionIsOk == false)) { - if (this->State < CONNECTION_CONNECTED) { - error(&DAT_08108420,this->State); - } - iVar4 = 0x95; - pTVar5 = this; - do { - if (pTVar5->KnownCreatureTable[0].State != KNOWNCREATURE_FREE) { - UnchainKnownCreature(this,pTVar5->KnownCreatureTable[0].CreatureID); - } - pTVar5->KnownCreatureTable[0].Connection = this; - pTVar5->KnownCreatureTable[0].State = KNOWNCREATURE_FREE; - pTVar5->KnownCreatureTable[0].CreatureID = 0; - pTVar5 = (TConnection *)(pTVar5->InData + 0x10); - iVar4 = iVar4 + -1; - } while (-1 < iVar4); - this->ConnectionIsOk = false; - this->State = CONNECTION_DISCONNECTED; - kill(this->PID,1); - } - CVar3 = this->State; - } - if (1 < CVar3 - CONNECTION_GAME) goto LAB_080cae41; - iVar4 = RoundNr - this->TimeStamp; - if (iVar4 == 0x1e) { - SendPing(this); - } - if (iVar4 == 0x3c) { - SendPing(this); - } - if ((RoundNr - 900 == this->TimeStampAction) && - (bVar2 = CheckRight(this->CharacterID,NO_LOGOUT_BLOCK), !bVar2)) { - SendMessage(this,0x12, - "You have been idle for %d minutes. You will be disconnected in one minute if you are still idle then." - ,0xf); - } - bVar2 = GameRunning(); - if ((bVar2) && - ((RoundNr - this->TimeStampAction < 0x3c0 || - (bVar2 = CheckRight(this->CharacterID,NO_LOGOUT_BLOCK), bVar2)))) { - if ((this->ConnectionIsOk == false) || (0x59 < iVar4)) { - if (2 < this->State - CONNECTION_GAME) { - error(&DAT_08108460,this->State); - } - this->State = CONNECTION_LOGOUT; - this_00 = (TPlayer *)0x0; - if (this->CharacterID != 0) { - this_00 = ::GetPlayer(this->CharacterID); - } - if (this_00 != (TPlayer *)0x0) { - TPlayer::ClearConnection(this_00); - bVar2 = false; - goto LAB_080cae11; - } - goto LAB_080cae21; - } - } - else { - if (2 < this->State - CONNECTION_GAME) { - error(&DAT_08108460,this->State); - } - this_00 = (TPlayer *)0x0; - this->State = CONNECTION_LOGOUT; - if (this->CharacterID != 0) { - this_00 = ::GetPlayer(this->CharacterID); - } - if (this_00 != (TPlayer *)0x0) { - TPlayer::ClearConnection(this_00); - bVar2 = true; -LAB_080cae11: - TCreature::StartLogout(&this_00->super_TCreature,false,bVar2); - } -LAB_080cae21: - uVar1 = RoundNr; - this->CharacterID = 0; - this->TimeStamp = uVar1; - this->ClosingIsDelayed = false; - } - CVar3 = this->State; -LAB_080cae41: - if ((CVar3 == CONNECTION_LOGOUT) && - (((bVar2 = GameRunning(), !bVar2 || (this->ConnectionIsOk == false)) || - (this->TimeStamp <= RoundNr)))) { - if (this->State < CONNECTION_CONNECTED) { - error(&DAT_08108420,this->State); - } - iVar4 = 0x95; - pTVar5 = this; - do { - if (pTVar5->KnownCreatureTable[0].State != KNOWNCREATURE_FREE) { - UnchainKnownCreature(this,pTVar5->KnownCreatureTable[0].CreatureID); - } - pTVar5->KnownCreatureTable[0].Connection = this; - pTVar5->KnownCreatureTable[0].State = KNOWNCREATURE_FREE; - pTVar5->KnownCreatureTable[0].CreatureID = 0; - pTVar5 = (TConnection *)(pTVar5->InData + 0x10); - iVar4 = iVar4 + -1; - } while (-1 < iVar4); - this->ConnectionIsOk = false; - this->State = CONNECTION_DISCONNECTED; - kill(this->PID,1); - } - return; -} - - - -// DWARF original prototype: void ResetTimer(TConnection * this, int Command) - -void __thiscall TConnection::ResetTimer(TConnection *this,int Command) - -{ - if ((((this->State - CONNECTION_GAME < 2) && (this->TimeStamp = RoundNr, Command != 0x69)) && - (Command != 0xbe)) && (((Command != 0xc9 && (Command != 0xca)) && (Command != 0x1e)))) { - this->TimeStampAction = RoundNr; - } - return; -} - - - -// DWARF original prototype: void EmergencyPing(TConnection * this) - -void __thiscall TConnection::EmergencyPing(TConnection *this) - -{ - if (this->State - CONNECTION_GAME < 2) { - if (RoundNr - this->TimeStamp < 0x50) { - this->TimeStamp = RoundNr - 100; - } - SendPing(this); - return; - } - return; -} - - - -// DWARF original prototype: pid_t GetPID(TConnection * this) - -pid_t __thiscall TConnection::GetPID(TConnection *this) - -{ - pid_t pVar1; - - if (this->State == CONNECTION_FREE) { - error("TConnection::GetPID: Verbindung ist nicht zugewiesen.\n"); - pVar1 = 0; - } - else { - pVar1 = this->PID; - } - return pVar1; -} - - - -// DWARF original prototype: int GetSocket(TConnection * this) - -int __thiscall TConnection::GetSocket(TConnection *this) - -{ - int iVar1; - - if (this->State < CONNECTION_CONNECTED) { - error("TConnection::GetSocket: Verbindung ist nicht angeschlossen.\n"); - iVar1 = -1; - } - else { - iVar1 = this->Socket; - } - return iVar1; -} - - - -// DWARF original prototype: char * GetIPAddress(TConnection * this) - -char * __thiscall TConnection::GetIPAddress(TConnection *this) - -{ - char *pcVar1; - - if (this->State < CONNECTION_CONNECTED) { - error("TConnection::GetIPAddress: Verbindung ist nicht angeschlossen.\n"); - pcVar1 = "Unknown"; - } - else { - pcVar1 = this->IPAddress; - } - return pcVar1; -} - - - -// DWARF original prototype: void Free(TConnection * this) - -void __thiscall TConnection::Free(TConnection *this) - -{ - this->State = CONNECTION_FREE; - return; -} - - - -// DWARF original prototype: void Assign(TConnection * this) - -void __thiscall TConnection::Assign(TConnection *this) - -{ - __pid_t _Var1; - - if (this->State != CONNECTION_FREE) { - error("TConnection::Assign: Verbindung ist nicht frei.\n"); - } - this->State = CONNECTION_ASSIGNED; - _Var1 = getpid(); - this->PID = _Var1; - return; -} - - - -// DWARF original prototype: void Connect(TConnection * this, int _Socket) - -void __thiscall TConnection::Connect(TConnection *this,int _Socket) - -{ - char *__src; - uint uVar1; - socklen_t local_30; - socklen_t addrlen; - sockaddr_in inaddr; - sockaddr peer; - - if (this->State != CONNECTION_ASSIGNED) { - error("TConnection::Connect: Verbindung ist keinem Thread zugewiesen .\n"); - } - this->State = CONNECTION_CONNECTED; - this->ConnectionIsOk = true; - this->ClosingIsDelayed = true; - this->Socket = _Socket; - local_30 = 0x10; - getpeername(this->Socket,(sockaddr *)(inaddr.sin_zero + 4),&local_30); - addrlen._0_1_ = inaddr.sin_zero[4]; - addrlen._1_1_ = inaddr.sin_zero[5]; - addrlen._2_1_ = inaddr.sin_zero[6]; - addrlen._3_1_ = inaddr.sin_zero[7]; - __src = inet_ntoa((in_addr)peer._0_4_); - strcpy(this->IPAddress,__src); - uVar1 = rand(); - this->RandomSeed = uVar1; - return; -} - - - -// DWARF original prototype: void Login(TConnection * this) - -void __thiscall TConnection::Login(TConnection *this) - -{ - if (this->State != CONNECTION_CONNECTED) { - error(&DAT_08108680,this->State); - } - this->State = CONNECTION_LOGIN; - return; -} - - - -// WARNING: Removing unreachable block (ram,0x080cb3a6) -// WARNING: Removing unreachable block (ram,0x080cb640) -// DWARF original prototype: bool JoinGame(TConnection * this, TReadBuffer * Buffer) - -bool __thiscall TConnection::JoinGame(TConnection *this,TReadBuffer *Buffer) - -{ - uint uVar1; - ulong uVar2; - TPlayer *this_00; - TPlayer *pl; - TConnection *pTVar3; - int i; - int iVar4; - char *Text; - TPlayer *local_14; - - if (this->State != CONNECTION_LOGIN) { - error(&DAT_081086c0,this->State); - } - iVar4 = 0x95; - pTVar3 = this; - do { - pTVar3->KnownCreatureTable[0].Connection = this; - pTVar3->KnownCreatureTable[0].State = KNOWNCREATURE_FREE; - pTVar3->KnownCreatureTable[0].CreatureID = 0; - pTVar3 = (TConnection *)(pTVar3->InData + 0x10); - iVar4 = iVar4 + -1; - } while (-1 < iVar4); - // try { // try from 080cb3d8 to 080cb3ee has its CatchHandler @ 080cb657 - uVar1 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); - this->TerminalType = uVar1 & 0xffff; - uVar1 = (*(Buffer->super_TReadStream)._vptr_TReadStream[2])(Buffer); - iVar4 = this->TerminalType; - this->TerminalVersion = uVar1 & 0xffff; - if ((iVar4 < 0) || ((1 < iVar4 && (iVar4 != 2)))) { - error("TConnection::JoinGame: Unbekannter Terminal-Typ %d.\n",iVar4); - } - else { - this->TerminalOffsetX = 8; - this->TerminalOffsetY = 6; - this->TerminalWidth = 0x12; - this->TerminalHeight = 0xe; - // try { // try from 080cb45a to 080cb45c has its CatchHandler @ 080cb687 - uVar2 = (*(Buffer->super_TReadStream)._vptr_TReadStream[3])(Buffer); - this->CharacterID = uVar2; - this_00 = ::GetPlayer(uVar2); - if (this_00 == (TPlayer *)0x0) { - this_00 = (TPlayer *)operator_new(0xde8); - // try { // try from 080cb60d to 080cb611 has its CatchHandler @ 080cb6a6 - TPlayer::TPlayer(this_00,this,this->CharacterID); - if (this_00 == (TPlayer *)0x0) { - return false; - } - if (this_00->ConstructError == NOERROR) { -LAB_080cb54c: - strcpy(this->Name,(this_00->super_TCreature).Name); - this->TimeStamp = RoundNr; - this->TimeStampAction = RoundNr; - return true; - } - (*(this_00->super_TCreature)._vptr_TCreature[1])(this_00); - } - else { - if ((this_00->super_TCreature).IsDead == false) { - if (((this_00->super_TCreature).LoggingOut == false) || - (iVar4 = TCreature::LogoutPossible(&this_00->super_TCreature), iVar4 != 0)) { - pTVar3 = (this_00->super_TCreature).Connection; - TPlayer::ClearConnection(this_00); - if (pTVar3 != (TConnection *)0x0) { - pTVar3->CharacterID = 0; - if (2 < pTVar3->State - CONNECTION_GAME) { - error(&DAT_08108460,pTVar3->State); - } - pTVar3->State = CONNECTION_LOGOUT; - local_14 = (TPlayer *)0x0; - if (pTVar3->CharacterID != 0) { - local_14 = ::GetPlayer(pTVar3->CharacterID); - } - if (local_14 != (TPlayer *)0x0) { - TPlayer::ClearConnection(local_14); - TCreature::StartLogout(&local_14->super_TCreature,false,true); - } - uVar2 = RoundNr; - pTVar3->CharacterID = 0; - pTVar3->TimeStamp = uVar2; - pTVar3->ClosingIsDelayed = false; - } - DecrementIsOnlineOrder(this->CharacterID); - TPlayer::TakeOver(this_00,this); - goto LAB_080cb54c; - } - Text = "Spieler %s loggt gerade aus - Einloggen gescheitert.\n"; - } - else { - Text = "Spieler %s ist gerade am Sterben - Einloggen gescheitert.\n"; - } - Log("game",Text,(this_00->super_TCreature).Name); - DecreasePlayerPoolSlotSticky(this->CharacterID); - } - } - return false; -} - - - -// DWARF original prototype: void EnterGame(TConnection * this) - -void __thiscall TConnection::EnterGame(TConnection *this) - -{ - if (this->State != CONNECTION_LOGIN) { - error(&DAT_08108800,this->State); - } - this->State = CONNECTION_GAME; - return; -} - - - -// DWARF original prototype: void Die(TConnection * this) - -void __thiscall TConnection::Die(TConnection *this) - -{ - if (this->State == CONNECTION_GAME) { - this->State = CONNECTION_DEAD; - } - return; -} - - - -// WARNING: Variable defined which should be unmapped: StopFight_local -// DWARF original prototype: void Logout(TConnection * this, int Delay, bool StopFight) - -void __thiscall TConnection::Logout(TConnection *this,int Delay,bool StopFight) - -{ - ulong uVar1; - TPlayer *this_00; - bool StopFight_local; - - if (2 < this->State - CONNECTION_GAME) { - error(&DAT_08108460,this->State); - } - this_00 = (TPlayer *)0x0; - this->State = CONNECTION_LOGOUT; - if (this->CharacterID != 0) { - this_00 = ::GetPlayer(this->CharacterID); - } - if (this_00 != (TPlayer *)0x0) { - TPlayer::ClearConnection(this_00); - TCreature::StartLogout(&this_00->super_TCreature,false,StopFight); - } - uVar1 = RoundNr; - this->CharacterID = 0; - this->TimeStamp = Delay + uVar1; - this->ClosingIsDelayed = false; - return; -} - - - -// DWARF original prototype: void Close(TConnection * this, bool Delay) - -void __thiscall TConnection::Close(TConnection *this,bool Delay) - -{ - CONNECTIONSTATE CVar1; - - CVar1 = this->State; - if (CVar1 < CONNECTION_CONNECTED) { - error(&DAT_08108420,CVar1); - CVar1 = this->State; - } - this->ConnectionIsOk = false; - this->ClosingIsDelayed = Delay; - if (CVar1 == CONNECTION_CONNECTED) { - this->State = CONNECTION_DISCONNECTED; - } - return; -} - - - -// DWARF original prototype: void Disconnect(TConnection * this) - -void __thiscall TConnection::Disconnect(TConnection *this) - -{ - TConnection *pTVar1; - int i; - int iVar2; - - if (this->State < CONNECTION_CONNECTED) { - error(&DAT_08108420,this->State); - } - iVar2 = 0x95; - pTVar1 = this; - do { - if (pTVar1->KnownCreatureTable[0].State != KNOWNCREATURE_FREE) { - UnchainKnownCreature(this,pTVar1->KnownCreatureTable[0].CreatureID); - } - pTVar1->KnownCreatureTable[0].Connection = this; - pTVar1->KnownCreatureTable[0].State = KNOWNCREATURE_FREE; - pTVar1->KnownCreatureTable[0].CreatureID = 0; - pTVar1 = (TConnection *)(pTVar1->InData + 0x10); - iVar2 = iVar2 + -1; - } while (-1 < iVar2); - this->ConnectionIsOk = false; - this->State = CONNECTION_DISCONNECTED; - kill(this->PID,1); - return; -} - - - -// DWARF original prototype: TPlayer * GetPlayer(TConnection * this) - -TPlayer * __thiscall TConnection::GetPlayer(TConnection *this) - -{ - TPlayer *pTVar1; - - if (this->State - CONNECTION_LOGIN < 4) { - if (this->CharacterID != 0) { - pTVar1 = ::GetPlayer(this->CharacterID); - return pTVar1; - } - } - else { - error(&DAT_08108840,this->State); - } - return (TPlayer *)0x0; -} - - - -// DWARF original prototype: char * GetName(TConnection * this) - -char * __thiscall TConnection::GetName(TConnection *this) - -{ - char *pcVar1; - - if (this->State - CONNECTION_LOGIN < 4) { - pcVar1 = this->Name; - } - else { - error(&DAT_08108880,this->State); - pcVar1 = ""; - } - return pcVar1; -} - - - -// DWARF original prototype: void GetPosition(TConnection * this, int * x, int * y, int * z) - -void __thiscall TConnection::GetPosition(TConnection *this,int *x,int *y,int *z) - -{ - TPlayer *pTVar1; - - if (this->State - CONNECTION_LOGIN < 4) { - pTVar1 = (TPlayer *)0x0; - if (this->CharacterID != 0) { - pTVar1 = ::GetPlayer(this->CharacterID); - } - } - else { - error(&DAT_08108840,this->State); - pTVar1 = (TPlayer *)0x0; - } - if (pTVar1 == (TPlayer *)0x0) { - *x = 0; - *y = 0; - *z = 0; - } - else { - *x = (pTVar1->super_TCreature).posx; - *y = (pTVar1->super_TCreature).posy; - *z = (pTVar1->super_TCreature).posz; - } - return; -} - - - -// WARNING: Variable defined which should be unmapped: posz -// DWARF original prototype: bool IsVisible(TConnection * this, int x, int y, int z) - -bool __thiscall TConnection::IsVisible(TConnection *this,int x,int y,int z) - -{ - bool bVar1; - int dz; - int iVar2; - int iVar3; - int local_1c; - int posx; - int posy; - int posz; - - GetPosition(this,&local_1c,&posx,&posy); - if (posy < 8) { - if (7 < z) { - return false; - } - if (posy < 8) goto LAB_080cba8a; - } - if (4 < (z - posy) + 2U) { - return false; - } -LAB_080cba8a: - iVar2 = ((y + this->TerminalOffsetY) - posx) - (posy - z); - iVar3 = ((x + this->TerminalOffsetX) - local_1c) - (posy - z); - if ((((iVar3 < 0) || (this->TerminalWidth <= iVar3)) || (iVar2 < 0)) || - (this->TerminalHeight <= iVar2)) { - bVar1 = false; - } - else { - bVar1 = true; - } - return bVar1; -} - - - -// DWARF original prototype: KNOWNCREATURESTATE KnownCreature(TConnection * this, ulong ID, bool -// UpdateFollows) - -KNOWNCREATURESTATE __thiscall -TConnection::KnownCreature(TConnection *this,ulong ID,bool UpdateFollows) - -{ - KNOWNCREATURESTATE KVar1; - int i; - int iVar2; - - iVar2 = 0; - while (this->KnownCreatureTable[0].CreatureID != ID) { - iVar2 = iVar2 + 1; - this = (TConnection *)(this->InData + 0x10); - if (0x95 < iVar2) { - return KNOWNCREATURE_FREE; - } - } - KVar1 = this->KnownCreatureTable[0].State; - if (KVar1 != KNOWNCREATURE_OUTDATED) { - return KVar1; - } - if (!UpdateFollows) { - return KNOWNCREATURE_OUTDATED; - } - this->KnownCreatureTable[0].State = KNOWNCREATURE_UPTODATE; - return KNOWNCREATURE_OUTDATED; -} - - - -// WARNING: Variable defined which should be unmapped: OldID -// WARNING: Variable defined which should be unmapped: FreeEntry -// DWARF original prototype: ulong NewKnownCreature(TConnection * this, ulong NewID) - -ulong __thiscall TConnection::NewKnownCreature(TConnection *this,ulong NewID) - -{ - int iVar1; - ulong uVar2; - bool bVar3; - ulong *puVar4; - TCreature *pTVar5; - TKnownCreature *pTVar6; - TCreature *cr; - int iVar7; - TConnection *pTVar8; - int i_1; - int local_1c; - int i_2; - int FreeEntry; - ulong OldID; - - iVar7 = 0; - i_2 = -1; - FreeEntry = 0; - puVar4 = &this->KnownCreatureTable[0].CreatureID; - do { - iVar1 = iVar7; - uVar2 = NewID; - if (*puVar4 == NewID) break; - iVar7 = iVar7 + 1; - puVar4 = puVar4 + 4; - iVar1 = i_2; - uVar2 = FreeEntry; - } while (iVar7 < 0x96); - FreeEntry = uVar2; - i_2 = iVar1; - if (i_2 == -1) { - iVar7 = 0; - pTVar6 = this->KnownCreatureTable; - pTVar8 = this; - do { - if (pTVar6->State == KNOWNCREATURE_FREE) { - FreeEntry = pTVar8->KnownCreatureTable[0].CreatureID; - i_2 = iVar7; - break; - } - iVar7 = iVar7 + 1; - pTVar6 = pTVar6 + 1; - pTVar8 = (TConnection *)(pTVar8->InData + 0x10); - } while (iVar7 < 0x96); - if (i_2 == -1) { - local_1c = 0; - puVar4 = &this->KnownCreatureTable[0].CreatureID; - do { - pTVar5 = GetCreature(*puVar4); - if (pTVar5 == (TCreature *)0x0) { - error("TUserCom::NewKnownCreature: Bekannte Kreatur existiert nicht.\n"); -LAB_080cbc81: - if ((pTVar5 == (TCreature *)0x0) || - (bVar3 = IsVisible(this,pTVar5->posx,pTVar5->posy,pTVar5->posz), !bVar3)) { - i_2 = local_1c; - FreeEntry = *puVar4; - UnchainKnownCreature(this,FreeEntry); - break; - } - } - else { - bVar3 = IsVisible(this,pTVar5->posx,pTVar5->posy,pTVar5->posz); - if (!bVar3) goto LAB_080cbc81; - } - local_1c = local_1c + 1; - puVar4 = puVar4 + 4; - } while (local_1c < 0x96); - if (i_2 == -1) { - print(); - return 0; - } - } - } - if (this->KnownCreatureTable[i_2].State != KNOWNCREATURE_FREE) { - error(&DAT_08108900); - } - this->KnownCreatureTable[i_2].CreatureID = NewID; - this->KnownCreatureTable[i_2].State = KNOWNCREATURE_UPTODATE; - pTVar5 = GetCreature(NewID); - if (pTVar5 == (TCreature *)0x0) { - error("TUserCom::NewKnownCreature: Kreatur %lu existiert nicht.\n",NewID); - } - else { - this->KnownCreatureTable[i_2].Next = pTVar5->FirstKnowingConnection; - pTVar5->FirstKnowingConnection = this->KnownCreatureTable + i_2; - } - return FreeEntry; -} - - - -// WARNING: Variable defined which should be unmapped: Unchain_local -// DWARF original prototype: void ClearKnownCreatureTable(TConnection * this, bool Unchain) - -void __thiscall TConnection::ClearKnownCreatureTable(TConnection *this,bool Unchain) - -{ - TConnection *pTVar1; - int i; - int iVar2; - bool Unchain_local; - - iVar2 = 0x95; - pTVar1 = this; - do { - if ((Unchain) && (pTVar1->KnownCreatureTable[0].State != KNOWNCREATURE_FREE)) { - UnchainKnownCreature(this,pTVar1->KnownCreatureTable[0].CreatureID); - } - pTVar1->KnownCreatureTable[0].Connection = this; - pTVar1->KnownCreatureTable[0].State = KNOWNCREATURE_FREE; - pTVar1->KnownCreatureTable[0].CreatureID = 0; - pTVar1 = (TConnection *)(pTVar1->InData + 0x10); - iVar2 = iVar2 + -1; - } while (-1 < iVar2); - return; -} - - - -// DWARF original prototype: void UnchainKnownCreature(TConnection * this, ulong ID) - -void __thiscall TConnection::UnchainKnownCreature(TConnection *this,ulong ID) - -{ - TKnownCreature *pTVar1; - TCreature *pTVar2; - TCreature *cr; - TKnownCreature *KnownCreature; - TKnownCreature *pTVar3; - - pTVar2 = GetCreature(ID); - if (pTVar2 == (TCreature *)0x0) { - this = (TConnection *)s_TUserCom__UnchainKnownCreature__K_08108a40; - } - else { - pTVar1 = pTVar2->FirstKnowingConnection; - if (pTVar1 != (TKnownCreature *)0x0) { - if (pTVar1->Connection == this) { - pTVar1->State = KNOWNCREATURE_FREE; - pTVar2->FirstKnowingConnection = pTVar1->Next; - } - else { - do { - pTVar3 = pTVar1; - pTVar1 = pTVar3->Next; - if (pTVar1 == (TKnownCreature *)0x0) { - this = (TConnection *)s_TUserCom__UnchainKnownCreature__K_081089c0; - goto LAB_080cbe0d; - } - } while (pTVar1->Connection != this); - pTVar1->State = KNOWNCREATURE_FREE; - pTVar3->Next = pTVar1->Next; - } - return; - } - this = (TConnection *)s_TUserCom__UnchainKnownCreature__K_08108a00; - } -LAB_080cbe0d: - error((char *)this); - return; -} - - - -// WARNING: Unknown calling convention -- yet parameter storage is locked - -TConnection * AssignFreeConnection(void) - -{ - int i; - int iVar1; - __pid_t _Var2; - TConnection *pTVar3; - - pTVar3 = Connections; - Semaphore::down(&ConnectionMutex); - iVar1 = 0; - do { - if (pTVar3->State == CONNECTION_FREE) { - pTVar3->State = CONNECTION_ASSIGNED; - _Var2 = getpid(); - pTVar3->PID = _Var2; - Semaphore::up(&ConnectionMutex); - return pTVar3; - } - iVar1 = iVar1 + 1; - pTVar3 = pTVar3 + 1; - } while (iVar1 < 0x44c); - Semaphore::up(&ConnectionMutex); - return (TConnection *)0x0; -} - - - -// WARNING: Unknown calling convention -- yet parameter storage is locked - -TConnection * GetFirstConnection(void) - -{ - TConnection *pTVar1; - - ConnectionIterator = -1; - pTVar1 = (TConnection *)(PlayerDataPool[0x7cd].QuestValues + 0x9a); - do { - ConnectionIterator = ConnectionIterator + 1; - if (pTVar1[1].State != CONNECTION_FREE) { - return pTVar1 + 1; - } - pTVar1 = pTVar1 + 1; - } while (ConnectionIterator < 1099); - return (TConnection *)0x0; -} - - - -// WARNING: Unknown calling convention -- yet parameter storage is locked - -TConnection * GetNextConnection(void) - -{ - TConnection *pTVar1; - - if (ConnectionIterator < 1099) { - pTVar1 = Connections + ConnectionIterator; - do { - ConnectionIterator = ConnectionIterator + 1; - if (pTVar1[1].State != CONNECTION_FREE) { - return pTVar1 + 1; - } - pTVar1 = pTVar1 + 1; - } while (ConnectionIterator < 1099); - } - return (TConnection *)0x0; -} - - - -// WARNING: Unknown calling convention -- yet parameter storage is locked - -void ProcessConnections(void) - -{ - TConnection *Connection; - TConnection *this; - TConnection *pTVar1; - - this = GetFirstConnection(); -joined_r0x080cbf6d: - do { - if (this == (TConnection *)0x0) { - return; - } - TConnection::Process(this); - if (ConnectionIterator < 1099) { - pTVar1 = Connections + ConnectionIterator; - do { - this = pTVar1 + 1; - ConnectionIterator = ConnectionIterator + 1; - if (pTVar1[1].State != CONNECTION_FREE) goto joined_r0x080cbf6d; - pTVar1 = this; - } while (ConnectionIterator < 1099); - } - this = (TConnection *)0x0; - } while( true ); -} - - - -// WARNING: Unknown calling convention -- yet parameter storage is locked - -void InitConnections(void) - -{ - CONNECTIONSTATE *pCVar1; - - pCVar1 = &Connections[0].State; - do { - *pCVar1 = CONNECTION_FREE; - pCVar1 = pCVar1 + 0x147e; - } while ((int)pCVar1 < 0xa67ef89); - FirstSendingConnection = (TConnection *)0x0; - return; -} - - - -// WARNING: Unknown calling convention -- yet parameter storage is locked - -void ExitConnections(void) - -{ - return; -} - - - void __tcf_0(void *param_1) { -- cgit v1.2.3