Skip to content

Commit

Permalink
fix: charge house rent (#1814)
Browse files Browse the repository at this point in the history
Closes #987
  • Loading branch information
luan authored Nov 13, 2023
1 parent ccfa6cb commit 1e3a04d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/map/house/house.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,15 +763,15 @@ void Houses::payHouses(RentPeriod_t rentPeriod) const {
continue;
}

std::shared_ptr<Player> player = std::make_shared<Player>(nullptr);
if (!IOLoginData::loadPlayerById(player, ownerId)) {
auto player = g_game().getPlayerByGUID(ownerId, true);
if (!player) {
// Player doesn't exist, reset house owner
house->setOwner(0);
continue;
}

if (player->getBankBalance() >= rent) {
player->setBankBalance(player->getBankBalance() - rent);
g_game().removeMoney(player, rent, 0, true);

time_t paidUntil = currentTime;
switch (rentPeriod) {
Expand Down

0 comments on commit 1e3a04d

Please sign in to comment.