Skip to content

Commit

Permalink
Cleanup & organize includes and PCH (#4019)
Browse files Browse the repository at this point in the history
  • Loading branch information
ranisalt committed Mar 18, 2022
1 parent ddfd4e8 commit c359649
Show file tree
Hide file tree
Showing 132 changed files with 401 additions and 401 deletions.
3 changes: 1 addition & 2 deletions src/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#include "configmanager.h"
#include "container.h"
#include "game.h"
#include "housetile.h"
#include "pugicast.h"
#include "spells.h"
#include <fmt/format.h>

extern Game g_game;
extern Spells* g_spells;
Expand Down Expand Up @@ -389,7 +389,6 @@ ReturnValue Actions::internalUseItem(Player* player, const Position& pos, uint8_
return RETURNVALUE_CANNOTUSETHISOBJECT;
}


static void showUseHotkeyMessage(Player* player, const Item* item, uint32_t count)
{
const ItemType& it = Item::items[item->getID()];
Expand Down
3 changes: 1 addition & 2 deletions src/ban.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
#include "otpch.h"

#include "ban.h"

#include "database.h"
#include "databasetasks.h"
#include "tools.h"

#include <fmt/format.h>

bool Ban::acceptConnection(uint32_t clientIP)
{
std::lock_guard<std::recursive_mutex> lockClass(lock);
Expand Down
2 changes: 1 addition & 1 deletion src/baseevents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "baseevents.h"

#include "pugicast.h"
#include "luascript.h"
#include "tools.h"

extern LuaEnvironment g_luaEnvironment;
Expand Down
2 changes: 1 addition & 1 deletion src/baseevents.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#ifndef FS_BASEEVENTS_H
#define FS_BASEEVENTS_H

#include "luascript.h"
class LuaScriptInterface;

class Event;
using Event_ptr = std::unique_ptr<Event>;
Expand Down
2 changes: 2 additions & 0 deletions src/bed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#include "otpch.h"

#include "bed.h"

#include "condition.h"
#include "game.h"
#include "iologindata.h"
#include "scheduler.h"
Expand Down
3 changes: 1 addition & 2 deletions src/chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
#include "otpch.h"

#include "chat.h"

#include "game.h"
#include "pugicast.h"
#include "scheduler.h"

#include <fmt/format.h>

extern Chat* g_chat;
extern Game g_game;

Expand Down
5 changes: 3 additions & 2 deletions src/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@

#include "combat.h"

#include "game.h"
#include "weapons.h"
#include "configmanager.h"
#include "events.h"
#include "game.h"
#include "spectators.h"
#include "weapons.h"

extern Game g_game;
extern Weapons* g_weapons;
Expand Down
11 changes: 5 additions & 6 deletions src/combat.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,18 @@
#ifndef FS_COMBAT_H
#define FS_COMBAT_H

#include "thing.h"
#include "condition.h"
#include "map.h"
#include "baseevents.h"
#include "condition.h"
#include "item.h"

#include <utility>
#include <valarray>

class Condition;
class Creature;
class Item;

class Player;
struct Position;
class SpectatorVec;
class Tile;

//for luascript callback
class ValueCallback final : public CallBack
Expand Down
3 changes: 3 additions & 0 deletions src/condition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
#include "otpch.h"

#include "condition.h"

#include "combat.h"
#include "game.h"
#include "spectators.h"

extern Game g_game;

Expand Down
4 changes: 3 additions & 1 deletion src/condition.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
#ifndef FS_CONDITION_H
#define FS_CONDITION_H

#include "fileloader.h"
#include "enums.h"

#include <limits>

class Creature;
class Player;
class PropStream;
class PropWriteStream;

enum ConditionAttr_t {
CONDITIONATTR_TYPE = 1,
Expand Down
11 changes: 5 additions & 6 deletions src/configmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,17 @@

#include "otpch.h"

#include <algorithm>
#include "configmanager.h"
#include "game.h"
#include "monster.h"
#include "pugicast.h"

#if __has_include("luajit/lua.hpp")
#include <luajit/lua.hpp>
#else
#include <lua.hpp>
#endif

#include "configmanager.h"
#include "game.h"
#include "monster.h"
#include "pugicast.h"

#if LUA_VERSION_NUM >= 502
#undef lua_strlen
#define lua_strlen lua_rawlen
Expand Down
3 changes: 0 additions & 3 deletions src/configmanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
#ifndef FS_CONFIGMANAGER_H
#define FS_CONFIGMANAGER_H

#include <utility>
#include <vector>

using ExperienceStages = std::vector<std::tuple<uint32_t, uint32_t, float>>;

class ConfigManager
Expand Down
5 changes: 3 additions & 2 deletions src/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@

#include "otpch.h"

#include "configmanager.h"
#include "connection.h"

#include "configmanager.h"
#include "outputmessage.h"
#include "protocol.h"
#include "scheduler.h"
#include "server.h"
#include "tasks.h"

extern ConfigManager g_config;

Expand Down
2 changes: 0 additions & 2 deletions src/connection.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
#ifndef FS_CONNECTION_H
#define FS_CONNECTION_H

#include <unordered_set>

#include "networkmessage.h"

enum ConnectionState_t {
Expand Down
8 changes: 7 additions & 1 deletion src/container.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,14 @@
#include "otpch.h"

#include "container.h"
#include "iomap.h"

#include "depotchest.h"
#include "game.h"
#include "housetile.h"
#include "inbox.h"
#include "iomap.h"
#include "spectators.h"
#include "storeinbox.h"

extern Game g_game;

Expand Down
3 changes: 0 additions & 3 deletions src/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,11 @@
#ifndef FS_CONTAINER_H
#define FS_CONTAINER_H

#include <queue>

#include "cylinder.h"
#include "item.h"
#include "tile.h"

class Container;
class DepotChest;
class DepotLocker;
class StoreInbox;

Expand Down
8 changes: 6 additions & 2 deletions src/creature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
#include "otpch.h"

#include "creature.h"

#include "combat.h"
#include "configmanager.h"
#include "game.h"
#include "monster.h"
#include "configmanager.h"
#include "party.h"
#include "scheduler.h"
#include "spectators.h"

double Creature::speedA = 857.36;
double Creature::speedB = 261.29;
Expand Down Expand Up @@ -888,7 +892,7 @@ BlockType_t Creature::blockHit(Creature* attacker, CombatType_t combatType, int3
damage = 0;
blockType = BLOCK_ARMOR;
}

attacker->onAttackedCreature(this);
attacker->onAttackedCreatureBlockHit(blockType);
}
Expand Down
23 changes: 10 additions & 13 deletions src/creature.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,19 @@
#ifndef FS_CREATURE_H
#define FS_CREATURE_H

#include "const.h"
#include "creatureevent.h"
#include "enums.h"
#include "map.h"
#include "position.h"
#include "condition.h"
#include "const.h"
#include "tile.h"
#include "enums.h"
#include "creatureevent.h"

class Condition;
class Container;
class Item;
class Monster;
class Npc;
class Player;

using ConditionList = std::list<Condition*>;
using CreatureEventList = std::list<CreatureEvent*>;
Expand Down Expand Up @@ -43,15 +49,6 @@ struct FindPathParams {
int32_t maxTargetDist = -1;
};

class Map;
class Thing;
class Container;
class Player;
class Monster;
class Npc;
class Item;
class Tile;

static constexpr int32_t EVENT_CREATURECOUNT = 10;
static constexpr int32_t EVENT_CREATURE_THINK_INTERVAL = 1000;
static constexpr int32_t EVENT_CHECK_CREATURE_INTERVAL = (EVENT_CREATURE_THINK_INTERVAL / EVENT_CREATURECOUNT);
Expand Down
3 changes: 2 additions & 1 deletion src/creatureevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
#include "otpch.h"

#include "creatureevent.h"

#include "item.h"
#include "tools.h"
#include "player.h"

CreatureEvents::CreatureEvents() :
scriptInterface("CreatureScript Interface")
Expand Down
2 changes: 1 addition & 1 deletion src/creatureevent.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
#ifndef FS_CREATUREEVENT_H
#define FS_CREATUREEVENT_H

#include "luascript.h"
#include "baseevents.h"
#include "enums.h"
#include "luascript.h"

class CreatureEvent;
using CreatureEvent_ptr = std::unique_ptr<CreatureEvent>;
Expand Down
2 changes: 1 addition & 1 deletion src/cylinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
#include "enums.h"
#include "thing.h"

class Item;
class Creature;
class Item;

static constexpr int32_t INDEX_WHEREEVER = -1;

Expand Down
3 changes: 2 additions & 1 deletion src/database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@

#include "otpch.h"

#include "configmanager.h"
#include "database.h"

#include "configmanager.h"

#include <mysql/errmsg.h>

extern ConfigManager g_config;
Expand Down
5 changes: 2 additions & 3 deletions src/databasemanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@

#include "otpch.h"

#include "configmanager.h"
#include "databasemanager.h"
#include "luascript.h"

#include <fmt/format.h>
#include "configmanager.h"
#include "luascript.h"

extern ConfigManager g_config;

Expand Down
1 change: 0 additions & 1 deletion src/databasemanager.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#ifndef FS_DATABASEMANAGER_H
#define FS_DATABASEMANAGER_H
#include "database.h"

class DatabaseManager
{
Expand Down
1 change: 1 addition & 0 deletions src/databasetasks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "otpch.h"

#include "databasetasks.h"

#include "tasks.h"

extern Dispatcher g_dispatcher;
Expand Down
6 changes: 3 additions & 3 deletions src/databasetasks.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#ifndef FS_DATABASETASKS_H
#define FS_DATABASETASKS_H

#include <condition_variable>
#include "thread_holder_base.h"
#include "database.h"
#include "enums.h"
#include "thread_holder_base.h"

#include <condition_variable>

struct DatabaseTask {
DatabaseTask(std::string&& query, std::function<void(DBResult_ptr, bool)>&& callback, bool store) :
Expand Down
1 change: 1 addition & 0 deletions src/depotchest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "otpch.h"

#include "depotchest.h"

#include "tools.h"

DepotChest::DepotChest(uint16_t type) :
Expand Down
2 changes: 2 additions & 0 deletions src/depotlocker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

#include "depotlocker.h"

#include "inbox.h"

DepotLocker::DepotLocker(uint16_t type) :
Container(type), depotId(0) {}

Expand Down
Loading

0 comments on commit c359649

Please sign in to comment.