Skip to content

Commit

Permalink
fix: transfer items house on server startup
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas committed Feb 24, 2024
1 parent c926ea5 commit 49ac33f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
8 changes: 6 additions & 2 deletions src/game/scheduling/save_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,9 @@ void SaveManager::schedulePlayer(std::weak_ptr<Player> playerPtr) {

// Disable save async if the config is set to false
if (!g_configManager().getBoolean(TOGGLE_SAVE_ASYNC, __FUNCTION__)) {
logger.debug("Saving player {}.", playerToSave->getName());
if (g_game().getGameState() == GAME_STATE_NORMAL) {
logger.debug("Saving player {}.", playerToSave->getName());
}
doSavePlayer(playerToSave);
return;
}
Expand Down Expand Up @@ -90,7 +92,9 @@ bool SaveManager::doSavePlayer(std::shared_ptr<Player> player) {
Benchmark bm_savePlayer;
Player::PlayerLock lock(player);
m_playerMap.erase(player->getGUID());
logger.debug("Saving player {}...", player->getName());
if (g_game().getGameState() == GAME_STATE_NORMAL) {
logger.debug("Saving player {}.", player->getName());
}

bool saveSuccess = IOLoginData::savePlayer(player);
if (!saveSuccess) {
Expand Down
5 changes: 3 additions & 2 deletions src/io/iomapserialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ void IOMapSerialize::loadHouseItems(Map* map) {

while (item_count--) {
if (auto houseTile = std::dynamic_pointer_cast<HouseTile>(tile)) {
const auto house = houseTile->getHouse();
if (house->getOwner() == 0) {
const auto &house = houseTile->getHouse();
auto isTransferOnRestart = g_configManager().getBoolean(TOGGLE_HOUSE_TRANSFER_ON_SERVER_RESTART, __FUNCTION__);
if (!isTransferOnRestart && house->getOwner() == 0) {
g_logger().trace("Skipping load item from house id: {}, position: {}, house does not have owner", house->getId(), house->getEntryPosition().toString());
house->clearHouseInfo(false);
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/items/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ Attr_ReadValue Item::readAttr(AttrTypes_t attr, PropStream &propStream) {
return ATTR_READ_ERROR;
}

g_logger().debug("Setting flag {} flags, to item id {}", flags, getID());
g_logger().trace("Setting obtain flag {} flags, to item id {}", flags, getID());
setAttribute(ItemAttribute_t::OBTAINCONTAINER, flags);
break;
}
Expand Down

0 comments on commit 49ac33f

Please sign in to comment.