diff options
| author | fusion32 <marcopuzziello@gmail.com> | 2025-07-01 07:21:10 -0300 |
|---|---|---|
| committer | fusion32 <marcopuzziello@gmail.com> | 2025-07-01 07:21:10 -0300 |
| commit | 6243967f1fac3af8ed3e72790cabed0f79978bdb (patch) | |
| tree | 35f0d27b4c280622c368a9fa94815b8deb7a990f /src/houses.cc | |
| parent | 6c8aa85b8b578db03a8c5f0dc0b7e80605592d45 (diff) | |
| download | game-6243967f1fac3af8ed3e72790cabed0f79978bdb.tar.gz game-6243967f1fac3af8ed3e72790cabed0f79978bdb.zip | |
fix `operator=` for `TChannel`, `TParty`, and `THouse`
I had focused on copying the `vector` fields for theses structs
but, being the copy operator, you need to copy everything over.
Diffstat (limited to 'src/houses.cc')
| -rw-r--r-- | src/houses.cc | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/houses.cc b/src/houses.cc index 16bc0ee..b47138e 100644 --- a/src/houses.cc +++ b/src/houses.cc @@ -20,6 +20,46 @@ static int MaxHouseY; static TQueryManagerConnection *QueryManagerConnection; static int PaymentExtension; +THouse::THouse(void) : Subowner(0, 4, 5), Guest(0, 9, 10) { + // no-op +} + +THouse::THouse(const THouse &Other) : THouse() { + this->operator=(Other); +} + +void THouse::operator=(const THouse &Other){ + this->ID = Other.ID; + memcpy(this->Name, Other.Name, sizeof(this->Name)); + memcpy(this->Description, Other.Description, sizeof(this->Description)); + this->Size = Other.Size; + this->Rent = Other.Rent; + this->DepotNr = Other.DepotNr; + this->NoAuction = Other.NoAuction; + this->GuildHouse = Other.GuildHouse; + this->ExitX = Other.ExitX; + this->ExitY = Other.ExitY; + this->ExitZ = Other.ExitZ; + this->CenterX = Other.CenterX; + this->CenterY = Other.CenterY; + this->CenterZ = Other.CenterZ; + this->OwnerID = Other.OwnerID; + memcpy(this->OwnerName, Other.OwnerName, sizeof(this->OwnerName)); + this->LastTransition = Other.LastTransition; + this->PaidUntil = Other.PaidUntil; + this->Help = Other.Help; + + this->Subowners = Other.Subowners; + for(int i = 0; i < Other.Subowners; i += 1){ + *this->Subowner.at(i) = Other.Subowner.copyAt(i); + } + + this->Guests = Other.Guests; + for(int i = 0; i < Other.Guests; i += 1){ + *this->Guest.at(i) = Other.Guest.copyAt(i); + } +} + THouseArea *GetHouseArea(uint16 ID){ THouseArea *Result = NULL; for(int i = 0; i < HouseAreas; i += 1){ |
