Skip to content

Commit

Permalink
improve: fix circular dependencies on iologindata.hpp (#3093)
Browse files Browse the repository at this point in the history
  • Loading branch information
dudantas authored Nov 9, 2024
1 parent 030f3c3 commit 4367cd1
Show file tree
Hide file tree
Showing 15 changed files with 30 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/creatures/players/player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "creatures/players/player.hpp"

#include "account/account.hpp"
#include "config/configmanager.hpp"
#include "core.hpp"
#include "creatures/appearance/mounts/mounts.hpp"
Expand Down Expand Up @@ -1773,8 +1774,8 @@ std::shared_ptr<DepotLocker> Player::getDepotLocker(uint32_t depotId) {
depotLocker->internalAddThing(marketItem);
depotLocker->internalAddThing(inbox);
if (createSupplyStash) {
const auto &supplyStash = Item::CreateItem(ITEM_SUPPLY_STASH);
depotLocker->internalAddThing(supplyStash);
const auto &supplyStashPtr = Item::CreateItem(ITEM_SUPPLY_STASH);
depotLocker->internalAddThing(supplyStashPtr);
}
const auto &depotChest = Item::CreateItemAsContainer(ITEM_DEPOT, static_cast<uint16_t>(g_configManager().getNumber(DEPOT_BOXES)));
for (uint32_t i = g_configManager().getNumber(DEPOT_BOXES); i > 0; i--) {
Expand Down
1 change: 1 addition & 0 deletions src/creatures/players/vip/player_vip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "creatures/players/vip/player_vip.hpp"

#include "account/account.hpp"
#include "creatures/players/grouping/groups.hpp"
#include "creatures/players/player.hpp"
#include "io/iologindata.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/game/scheduling/save_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "io/iologindata.hpp"
#include "kv/kv.hpp"
#include "lib/di/container.hpp"
#include "creatures/players/player.hpp"

SaveManager::SaveManager(ThreadPool &threadPool, KVStore &kvStore, Logger &logger, Game &game) :
threadPool(threadPool), kv(kvStore), logger(logger), game(game) { }
Expand Down
3 changes: 3 additions & 0 deletions src/io/functions/iologindata_load_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

#include "io/functions/iologindata_load_player.hpp"

#include "account/account.hpp"
#include "config/configmanager.hpp"
#include "creatures/combat/condition.hpp"
#include "database/database.hpp"
#include "creatures/monsters/monsters.hpp"
#include "creatures/players/achievement/player_achievement.hpp"
#include "creatures/players/cyclopedia/player_badge.hpp"
Expand All @@ -29,6 +31,7 @@
#include "items/containers/inbox/inbox.hpp"
#include "items/containers/rewards/reward.hpp"
#include "items/containers/rewards/rewardchest.hpp"
#include "creatures/players/player.hpp"
#include "utils/tools.hpp"

void IOLoginDataLoad::loadItems(ItemsMap &itemsMap, const DBResult_ptr &result, const std::shared_ptr<Player> &player) {
Expand Down
4 changes: 4 additions & 0 deletions src/io/functions/iologindata_load_player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

#include "io/iologindata.hpp"

class Player;
class DBResult;
using DBResult_ptr = std::shared_ptr<DBResult>;

class IOLoginDataLoad : public IOLoginData {
public:
static bool loadPlayerBasicInfo(const std::shared_ptr<Player> &player, const DBResult_ptr &result);
Expand Down
1 change: 1 addition & 0 deletions src/io/functions/iologindata_save_player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "items/containers/depot/depotchest.hpp"
#include "items/containers/inbox/inbox.hpp"
#include "items/containers/rewards/reward.hpp"
#include "creatures/players/player.hpp"

bool IOLoginDataSave::saveItems(const std::shared_ptr<Player> &player, const ItemBlockList &itemList, DBInsert &query_insert, PropWriteStream &propWriteStream) {
if (!player) {
Expand Down
1 change: 1 addition & 0 deletions src/io/functions/iologindata_save_player.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include "io/iologindata.hpp"

class PropWriteStream;
class DBInsert;

class IOLoginDataSave : public IOLoginData {
public:
Expand Down
3 changes: 3 additions & 0 deletions src/io/iologindata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,15 @@

#include "io/iologindata.hpp"

#include "account/account.hpp"
#include "config/configmanager.hpp"
#include "database/database.hpp"
#include "io/functions/iologindata_load_player.hpp"
#include "io/functions/iologindata_save_player.hpp"
#include "game/game.hpp"
#include "creatures/monsters/monster.hpp"
#include "creatures/players/wheel/player_wheel.hpp"
#include "creatures/players/player.hpp"
#include "lib/metrics/metrics.hpp"
#include "enums/account_type.hpp"
#include "enums/account_errors.hpp"
Expand Down
11 changes: 7 additions & 4 deletions src/io/iologindata.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@

#pragma once

#include "account/account.hpp"
#include "creatures/players/player.hpp"
#include "database/database.hpp"
class Player;
class Item;
class DBResult;

struct VIPEntry;
struct VIPGroupEntry;

using ItemBlockList = std::list<std::pair<int32_t, std::shared_ptr<Item>>>;

Expand All @@ -21,7 +24,7 @@ class IOLoginData {
static uint8_t getAccountType(uint32_t accountId);
static bool loadPlayerById(const std::shared_ptr<Player> &player, uint32_t id, bool disableIrrelevantInfo = true);
static bool loadPlayerByName(const std::shared_ptr<Player> &player, const std::string &name, bool disableIrrelevantInfo = true);
static bool loadPlayer(const std::shared_ptr<Player> &player, const DBResult_ptr &result, bool disableIrrelevantInfo = false);
static bool loadPlayer(const std::shared_ptr<Player> &player, const std::shared_ptr<DBResult> &result, bool disableIrrelevantInfo = false);
static bool savePlayer(const std::shared_ptr<Player> &player);
static uint32_t getGuidByName(const std::string &name);
static bool getGuidByNameEx(uint32_t &guid, bool &specialVip, std::string &name);
Expand Down
1 change: 1 addition & 0 deletions src/io/iomarket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "game/scheduling/save_manager.hpp"
#include "io/iologindata.hpp"
#include "items/containers/inbox/inbox.hpp"
#include "creatures/players/player.hpp"

uint8_t IOMarket::getTierFromDatabaseTable(const std::string &string) {
auto tier = static_cast<uint8_t>(std::atoi(string.c_str()));
Expand Down
1 change: 1 addition & 0 deletions src/items/bed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "game/scheduling/save_manager.hpp"
#include "io/iologindata.hpp"
#include "server/network/protocol/protocolgame.hpp"
#include "creatures/players/player.hpp"

BedItem::BedItem(uint16_t id) :
Item(id) {
Expand Down
1 change: 1 addition & 0 deletions src/lua/functions/creatures/player/player_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "lua/functions/creatures/player/player_functions.hpp"

#include "account/account.hpp"
#include "creatures/appearance/mounts/mounts.hpp"
#include "creatures/combat/spells.hpp"
#include "creatures/creature.hpp"
Expand Down
1 change: 1 addition & 0 deletions src/lua/functions/map/house_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "game/movement/position.hpp"
#include "io/iologindata.hpp"
#include "map/house/house.hpp"
#include "creatures/players/player.hpp"

int HouseFunctions::luaHouseCreate(lua_State* L) {
// House(id)
Expand Down
1 change: 1 addition & 0 deletions src/map/house/house.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "items/containers/inbox/inbox.hpp"
#include "lib/metrics/metrics.hpp"
#include "utils/pugicast.hpp"
#include "creatures/players/player.hpp"

House::House(uint32_t houseId) :
id(houseId) { }
Expand Down
1 change: 1 addition & 0 deletions src/server/network/protocol/protocolgame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include "server/network/protocol/protocolgame.hpp"

#include "account/account.hpp"
#include "config/configmanager.hpp"
#include "core.hpp"
#include "creatures/appearance/mounts/mounts.hpp"
Expand Down

0 comments on commit 4367cd1

Please sign in to comment.