From 02d243c531a5c7886c89024e592a2ccdeab3d3b3 Mon Sep 17 00:00:00 2001 From: fusion32 Date: Wed, 28 May 2025 02:56:09 -0300 Subject: impl all remaining containers --- reference/game.c | 500 ----------------------------------------------------- reference/types.hh | 173 ------------------ 2 files changed, 673 deletions(-) (limited to 'reference') diff --git a/reference/game.c b/reference/game.c index 722a5aa..dff762d 100644 --- a/reference/game.c +++ b/reference/game.c @@ -3914,80 +3914,6 @@ void _GLOBAL__I_StaticStringTable(void) return; } - - -// DWARF original prototype: listnode * -// append(list * this) - -listnode<> * __thiscall list<>::append(list<> *this) - -{ - listnode<> *plVar1; - uint uVar2; - listnode<> *plVar3; - - plVar1 = (listnode<> *)operator_new(0x1000c); - uVar2 = 0x1000c; - plVar3 = plVar1; - if (((uint)plVar1 & 4) != 0) { - plVar1->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar1->prev; - uVar2 = 0x10008; - } - for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { - plVar3->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar3->prev; - } - plVar1->prev = (listnode<> *)0x0; - plVar1->next = (listnode<> *)0x0; - if (this->firstNode == (listnode<> *)0x0) { - this->firstNode = plVar1; - } - else { - this->lastNode->next = plVar1; - plVar1->prev = this->lastNode; - } - this->lastNode = plVar1; - return this->lastNode; -} - - - -// DWARF original prototype: listnode * -// append(list * this) - -listnode<> * __thiscall list<>::append(list<> *this) - -{ - listnode<> *plVar1; - uint uVar2; - listnode<> *plVar3; - - plVar1 = (listnode<> *)operator_new(0x8314); - uVar2 = 0x8314; - plVar3 = plVar1; - if (((uint)plVar1 & 4) != 0) { - plVar1->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar1->prev; - uVar2 = 0x8310; - } - for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { - plVar3->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar3->prev; - } - plVar1->prev = (listnode<> *)0x0; - plVar1->next = (listnode<> *)0x0; - if (this->firstNode == (listnode<> *)0x0) { - this->firstNode = plVar1; - } - else { - this->lastNode->next = plVar1; - plVar1->prev = this->lastNode; - } - this->lastNode = plVar1; - return this->lastNode; -} - void __static_initialization_and_destruction_0(int __initialize_p,int __priority) { @@ -50016,205 +49942,6 @@ void _GLOBAL__I_PlayerList(void) return; } -// WARNING: Variable defined which should be unmapped: i -// DWARF original prototype: TPlayerIndexLeafNode * getFreeItem(store * -// this) - -TPlayerIndexLeafNode * __thiscall store<>::getFreeItem(store<> *this) - -{ - int iVar1; - listnode<> *plVar2; - storeitem<> *psVar3; - storeunit<> *psVar4; - int iVar5; - int local_1c; - storeunit<> *local_18; - int local_14; - int i; - - psVar3 = this->firstFreeItem; - if (psVar3 == (storeitem<> *)0x0) { - plVar2 = list<>::append(this->Units); - local_14 = 0; - local_1c = 0; - iVar5 = 0; - do { - if (plVar2 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - local_18 = (storeunit<> *)0x0; - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar4 = (storeunit<> *)0x0; - } - else { - local_18 = &plVar2->data; - psVar4 = &plVar2->data; - } - iVar1 = local_1c + 0x170; - local_1c = local_1c + 0x170; - *(int *)((int)local_18->item + iVar5) = (int)psVar4->item + iVar1; - local_14 = local_14 + 1; - iVar5 = iVar5 + 0x170; - } while (local_14 < 99); - if (plVar2 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar4 = (storeunit<> *)0x0; - } - else { - psVar4 = &plVar2->data; - } - psVar4->item[99].next = (storeitem<> *)0x0; - if (plVar2 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar3 = (storeitem<> *)0x0; - } - else { - psVar3 = (plVar2->data).item; - } - this->firstFreeItem = psVar3; - } - this->firstFreeItem = psVar3->next; - return (TPlayerIndexLeafNode *)psVar3; -} - - - -// DWARF original prototype: TPlayerIndexInternalNode * -// getFreeItem(store * this) - -TPlayerIndexInternalNode * __thiscall store<>::getFreeItem(store<> *this) - -{ - int iVar1; - listnode<> *plVar2; - storeitem<> *psVar3; - storeunit<> *psVar4; - int i; - int iVar5; - int local_1c; - int local_18; - storeunit<> *local_14; - - psVar3 = this->firstFreeItem; - if (psVar3 == (storeitem<> *)0x0) { - plVar2 = list<>::append(this->Units); - local_18 = 0; - local_1c = 0; - iVar5 = 0x62; - do { - if (plVar2 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - local_14 = (storeunit<> *)0x0; - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar4 = (storeunit<> *)0x0; - } - else { - local_14 = &plVar2->data; - psVar4 = &plVar2->data; - } - iVar1 = local_18 + 0x70; - local_18 = local_18 + 0x70; - *(int *)((int)local_14->item + local_1c) = (int)psVar4->item + iVar1; - local_1c = local_1c + 0x70; - iVar5 = iVar5 + -1; - } while (-1 < iVar5); - if (plVar2 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar4 = (storeunit<> *)0x0; - } - else { - psVar4 = &plVar2->data; - } - psVar4->item[99].next = (storeitem<> *)0x0; - if (plVar2 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar3 = (storeitem<> *)0x0; - } - else { - psVar3 = (plVar2->data).item; - } - this->firstFreeItem = psVar3; - } - this->firstFreeItem = psVar3->next; - return (TPlayerIndexInternalNode *)psVar3; -} - - - -// DWARF original prototype: listnode_> * -// append(list_> * this) - -listnode<> * __thiscall list<>::append(list<> *this) - -{ - listnode<> *plVar1; - uint uVar2; - listnode<> *plVar3; - - plVar1 = (listnode<> *)operator_new(0x8fc8); - uVar2 = 0x8fc8; - plVar3 = plVar1; - if (((uint)plVar1 & 4) != 0) { - plVar1->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar1->prev; - uVar2 = 0x8fc4; - } - for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { - plVar3->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar3->prev; - } - plVar1->prev = (listnode<> *)0x0; - plVar1->next = (listnode<> *)0x0; - if (this->firstNode == (listnode<> *)0x0) { - this->firstNode = plVar1; - } - else { - this->lastNode->next = plVar1; - plVar1->prev = this->lastNode; - } - this->lastNode = plVar1; - return this->lastNode; -} - - - -// DWARF original prototype: listnode_> * -// append(list_> * this) - -listnode<> * __thiscall list<>::append(list<> *this) - -{ - listnode<> *plVar1; - uint uVar2; - listnode<> *plVar3; - - plVar1 = (listnode<> *)operator_new(0x2bc8); - uVar2 = 0x2bc8; - plVar3 = plVar1; - if (((uint)plVar1 & 4) != 0) { - plVar1->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar1->prev; - uVar2 = 0x2bc4; - } - for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { - plVar3->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar3->prev; - } - plVar1->prev = (listnode<> *)0x0; - plVar1->next = (listnode<> *)0x0; - if (this->firstNode == (listnode<> *)0x0) { - this->firstNode = plVar1; - } - else { - this->lastNode->next = plVar1; - plVar1->prev = this->lastNode; - } - this->lastNode = plVar1; - return this->lastNode; -} - - - void __static_initialization_and_destruction_0(int __initialize_p,int __priority) { @@ -58292,133 +58019,6 @@ ulong __thiscall TMonster::GetMaster(TMonster *this) return this->Master; } - - -// DWARF original prototype: TNode * getFreeItem(store * this) - -TNode * __thiscall store::getFreeItem(store *this) - -{ - listnode<> *plVar1; - storeitem *psVar2; - storeunit *psVar3; - int i; - int iVar4; - int iVar5; - storeunit *local_14; - - psVar2 = this->firstFreeItem; - if (psVar2 == (storeitem *)0x0) { - plVar1 = list<>::append(this->Units); - iVar4 = 0; - do { - if (plVar1 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - local_14 = (storeunit *)0x0; - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar3 = (storeunit *)0x0; - } - else { - local_14 = &plVar1->data; - psVar3 = &plVar1->data; - } - iVar5 = iVar4 + 1; - local_14->item[iVar4].next = psVar3->item + iVar4 + 1; - iVar4 = iVar5; - } while (iVar5 < 0xff); - if (plVar1 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar3 = (storeunit *)0x0; - } - else { - psVar3 = &plVar1->data; - } - psVar3->item[0xff].next = (storeitem *)0x0; - if (plVar1 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar2 = (storeitem *)0x0; - } - else { - psVar2 = (plVar1->data).item; - } - this->firstFreeItem = psVar2; - } - this->firstFreeItem = psVar2->next; - return (TNode *)psVar2; -} - -// DWARF original prototype: void remove(list_> * this, -// listnode_> * node) - -int __thiscall list<>::remove(list<> *this,char *__filename) - -{ - int iVar1; - int extraout_EAX; - listnode<> *plVar2; - - if (__filename != (char *)0x0) { - plVar2 = *(listnode<> **)(__filename + 4); - if (plVar2 == (listnode<> *)0x0) { - this->firstNode = *(listnode<> **)__filename; - plVar2 = *(listnode<> **)(__filename + 4); - } - else { - plVar2->next = *(listnode<> **)__filename; - } - iVar1 = *(int *)__filename; - if (iVar1 == 0) { - this->lastNode = plVar2; - } - else { - *(listnode<> **)(iVar1 + 4) = plVar2; - } - operator_delete(__filename); - return iVar1; - } - error("list::remove: node ist NULL.\n"); - return extraout_EAX; -} - - - -// DWARF original prototype: listnode_> * append(list_> -// * this) - -listnode<> * __thiscall list<>::append(list<> *this) - -{ - listnode<> *plVar1; - uint uVar2; - listnode<> *plVar3; - - plVar1 = (listnode<> *)operator_new(0x1008); - uVar2 = 0x1008; - plVar3 = plVar1; - if (((uint)plVar1 & 4) != 0) { - plVar1->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar1->prev; - uVar2 = 0x1004; - } - for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { - plVar3->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar3->prev; - } - plVar1->prev = (listnode<> *)0x0; - plVar1->next = (listnode<> *)0x0; - if (this->firstNode == (listnode<> *)0x0) { - this->firstNode = plVar1; - } - else { - this->lastNode->next = plVar1; - plVar1->prev = this->lastNode; - } - this->lastNode = plVar1; - return this->lastNode; -} - - - void __static_initialization_and_destruction_0(int __initialize_p,int __priority) { @@ -77129,106 +76729,6 @@ void _GLOBAL__I_TCPSocket(void) return; } - - -// DWARF original prototype: TWaitinglistEntry * getFreeItem(store * this) - -TWaitinglistEntry * __thiscall store<>::getFreeItem(store<> *this) - -{ - int iVar1; - listnode<> *plVar2; - storeitem<> *psVar3; - storeunit<> *psVar4; - int i; - int iVar5; - int local_1c; - int local_18; - storeunit<> *local_14; - - psVar3 = this->firstFreeItem; - if (psVar3 == (storeitem<> *)0x0) { - plVar2 = list<>::append(this->Units); - local_18 = 0; - local_1c = 0; - iVar5 = 0x62; - do { - if (plVar2 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - local_14 = (storeunit<> *)0x0; - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar4 = (storeunit<> *)0x0; - } - else { - local_14 = &plVar2->data; - psVar4 = &plVar2->data; - } - iVar1 = local_18 + 0x2c; - local_18 = local_18 + 0x2c; - *(int *)((int)local_14->item + local_1c) = (int)psVar4->item + iVar1; - local_1c = local_1c + 0x2c; - iVar5 = iVar5 + -1; - } while (-1 < iVar5); - if (plVar2 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar4 = (storeunit<> *)0x0; - } - else { - psVar4 = &plVar2->data; - } - psVar4->item[99].next = (storeitem<> *)0x0; - if (plVar2 == (listnode<> *)0x0) { - error("listIterator::operator*: Iterator ist NULL.\n"); - psVar3 = (storeitem<> *)0x0; - } - else { - psVar3 = (plVar2->data).item; - } - this->firstFreeItem = psVar3; - } - this->firstFreeItem = psVar3->next; - return (TWaitinglistEntry *)psVar3; -} - - - -// DWARF original prototype: listnode_> * -// append(list_> * this) - -listnode<> * __thiscall list<>::append(list<> *this) - -{ - listnode<> *plVar1; - uint uVar2; - listnode<> *plVar3; - - plVar1 = (listnode<> *)operator_new(0x1138); - uVar2 = 0x1138; - plVar3 = plVar1; - if (((uint)plVar1 & 4) != 0) { - plVar1->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar1->prev; - uVar2 = 0x1134; - } - for (uVar2 = uVar2 >> 2; uVar2 != 0; uVar2 = uVar2 - 1) { - plVar3->next = (listnode<> *)0x0; - plVar3 = (listnode<> *)&plVar3->prev; - } - plVar1->prev = (listnode<> *)0x0; - plVar1->next = (listnode<> *)0x0; - if (this->firstNode == (listnode<> *)0x0) { - this->firstNode = plVar1; - } - else { - this->lastNode->next = plVar1; - plVar1->prev = this->lastNode; - } - this->lastNode = plVar1; - return this->lastNode; -} - - - void __static_initialization_and_destruction_0(int __initialize_p,int __priority) { diff --git a/reference/types.hh b/reference/types.hh index b2c0719..2fc67a0 100644 --- a/reference/types.hh +++ b/reference/types.hh @@ -125,21 +125,6 @@ struct TPlayerIndexInternalNode { struct TPlayerIndexNode *Child[27]; }; -union storeitem { - union storeitem *next; - struct TPlayerIndexInternalNode data; -}; - -struct storeunit { - union storeitem item[100]; -}; - -struct listnode_> { // Original name: listnode > - struct listnode_> *next; - struct listnode_> *prev; - struct storeunit data; -}; - struct TPlayerIndexEntry { char Name[30]; ulong CharacterID; @@ -151,15 +136,6 @@ struct TPlayerIndexLeafNode { struct TPlayerIndexEntry Entry[10]; }; -union storeitem { - union storeitem *next; - struct TPlayerIndexLeafNode data; -}; - -struct storeunit { - union storeitem item[100]; -}; - struct TNode { int Type; int Data; @@ -167,21 +143,6 @@ struct TNode { struct TNode *Right; }; -union storeitem { - union storeitem *next; - struct TNode data; -}; - -struct store { - struct list_> *Units; - union storeitem *firstFreeItem; -}; - -struct list_> { // Original name: list > - struct listnode_> *firstNode; - struct listnode_> *lastNode; -}; - struct THouseGuest { char Name[60]; }; @@ -221,21 +182,6 @@ struct TWaitinglistEntry { bool Sleeping; }; -union storeitem { - union storeitem *next; - struct TWaitinglistEntry data; -}; - -struct storeunit { - union storeitem item[100]; -}; - -struct listnode_> { // Original name: listnode > - struct listnode_> *next; - struct listnode_> *prev; - struct storeunit data; -}; - struct TAttackWave { int x; int y; @@ -251,16 +197,6 @@ struct TAttackWave { struct vector ExtraItem; }; -struct store { - struct list_> *Units; - union storeitem *firstFreeItem; -}; - -struct list_> { // Original name: list > - struct listnode_> *firstNode; - struct listnode_> *lastNode; -}; - struct TDynamicStringTableBlock { int FreeEntries; int TotalTextLength; @@ -270,16 +206,6 @@ struct TDynamicStringTableBlock { char Text[32768]; }; -struct listnode { - struct listnode *next; - struct listnode *prev; - struct TDynamicStringTableBlock data; -}; - -struct listIterator { - struct listnode *actNode; -}; - struct TNonplayer { struct TCreature super_TCreature; // INHERITANCE? enum STATE State; @@ -299,13 +225,6 @@ struct TListener { ulong CharacterID; }; -struct fifo { - struct TListener *Entry; - int Size; - int Head; - int Tail; -}; - struct TDelayedMail { ulong CharacterID; int DepotNumber; @@ -313,38 +232,6 @@ struct TDelayedMail { int PacketSize; }; -struct list_> { // Original name: list > - struct listnode_> *firstNode; - struct listnode_> *lastNode; -}; - -struct listnode_> { // Original name: listnode > - struct listnode_> *next; - struct listnode_> *prev; - struct storeunit data; -}; - -struct store { - struct list_> *Units; - union storeitem *firstFreeItem; -}; - -struct listIterator_> { // Original name: listIterator > - struct listnode_> *actNode; -}; - - - -struct storeunit { - union storeitem item[256]; -}; - -struct listnode_> { // Original name: listnode > - struct listnode_> *next; - struct listnode_> *prev; - struct storeunit data; -}; - struct TShortwayPoint { int x; int y; @@ -372,26 +259,6 @@ struct TStaticStringTableBlock { char Text[65536]; }; -struct listnode { - struct listnode *next; - struct listnode *prev; - struct TStaticStringTableBlock data; -}; - -struct list { - struct listnode *firstNode; - struct listnode *lastNode; -}; - -struct listIterator { - struct listnode *actNode; -}; - -struct list_> { // Original name: list > - struct listnode_> *firstNode; - struct listnode_> *lastNode; -}; - struct TCondition { int Type; ulong Text; @@ -415,10 +282,6 @@ struct THelpDepot { int DepotNr; }; -struct listIterator_> { // Original name: listIterator > - struct listnode_> *actNode; -}; - struct TPlayerData { ulong CharacterID; pid_t Locked; @@ -527,25 +390,11 @@ struct TParty { int InvitedPlayers; }; -struct listIterator_> { // Original name: listIterator > - struct listnode_> *actNode; -}; - -struct store { - struct list_> *Units; - union storeitem *firstFreeItem; -}; - struct TMoveUseAction { enum ActionType Action; int Parameters[5]; }; -struct list { - struct listnode *firstNode; - struct listnode *lastNode; -}; - struct TMoveUseRule { int FirstCondition; int LastCondition; @@ -581,23 +430,6 @@ struct THouseArea { int DepotNr; }; -struct listIterator_> { // Original name: listIterator > - struct listnode_> *actNode; -}; - - -struct fifoIterator { - struct fifo *Fifo; - int Position; -}; - -struct fifo { - struct TStatement *Entry; - int Size; - int Head; - int Tail; -}; - struct TStatement { ulong StatementID; ulong TimeStamp; @@ -608,11 +440,6 @@ struct TStatement { bool Reported; }; -struct fifoIterator { - struct fifo *Fifo; - int Position; -}; - struct TDirectReplyData { ulong CharacterID; char Message[100]; -- cgit v1.2.3