Skip to content

Commit

Permalink
Code format - (Clang-format)
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 1, 2024
1 parent 5b189a0 commit 65a122e
Show file tree
Hide file tree
Showing 13 changed files with 32 additions and 31 deletions.
4 changes: 2 additions & 2 deletions src/creatures/combat/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ LuaScriptInterface* BaseSpell::getScriptInterface() const {
}

bool BaseSpell::loadScriptId() {
LuaScriptInterface& luaInterface = g_scripts().getScriptInterface();
LuaScriptInterface &luaInterface = g_scripts().getScriptInterface();
m_scriptId = luaInterface.getEvent();
if (m_scriptId == -1) {
g_logger().error("[MoveEvent::loadScriptId] Failed to load event. Script name: '{}', Module: '{}'", luaInterface.getLoadingScriptName(), luaInterface.getInterfaceName());
Expand Down Expand Up @@ -1316,7 +1316,7 @@ LuaScriptInterface* RuneSpell::getScriptInterface() const {
}

bool RuneSpell::loadScriptId() {
LuaScriptInterface& luaInterface = g_scripts().getScriptInterface();
LuaScriptInterface &luaInterface = g_scripts().getScriptInterface();
m_scriptId = luaInterface.getEvent();
if (m_scriptId == -1) {
g_logger().error("[MoveEvent::loadScriptId] Failed to load event. Script name: '{}', Module: '{}'", luaInterface.getLoadingScriptName(), luaInterface.getInterfaceName());
Expand Down
4 changes: 2 additions & 2 deletions src/creatures/combat/spells.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class BaseSpell {
bool loadScriptId();
int32_t getScriptId() const;
void setScriptId(int32_t newScriptId);
bool isLoadedScriptId() const ;
bool isLoadedScriptId() const;

int32_t m_scriptId {};

Expand Down Expand Up @@ -318,7 +318,7 @@ class RuneSpell final : public Action, public Spell {
bool loadScriptId();
int32_t getScriptId() const;
void setScriptId(int32_t newScriptId);
bool isLoadedScriptId() const ;
bool isLoadedScriptId() const;

ReturnValue canExecuteAction(const std::shared_ptr<Player> &player, const Position &toPos) override;
bool hasOwnErrorHandler() override;
Expand Down
2 changes: 1 addition & 1 deletion src/creatures/monsters/spawns/spawn_monster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ void SpawnMonster::scheduleSpawn(uint32_t spawnMonsterId, spawnBlock_t &sb, cons
}

void SpawnMonster::cleanup() {
for (auto it = spawnedMonsterMap.begin(); it != spawnedMonsterMap.end(); ) {
for (auto it = spawnedMonsterMap.begin(); it != spawnedMonsterMap.end();) {
const auto &monster = it->second;
if (!monster || monster->isRemoved()) {
auto spawnIt = spawnMonsterMap.find(it->first);
Expand Down
2 changes: 1 addition & 1 deletion src/items/weapons/weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ LuaScriptInterface* Weapon::getScriptInterface() const {
}

bool Weapon::loadScriptId() {
LuaScriptInterface& luaInterface = g_scripts().getScriptInterface();
LuaScriptInterface &luaInterface = g_scripts().getScriptInterface();
m_scriptId = luaInterface.getEvent();
if (m_scriptId == -1) {
g_logger().error("[MoveEvent::loadScriptId] Failed to load event. Script name: '{}', Module: '{}'", luaInterface.getLoadingScriptName(), luaInterface.getInterfaceName());
Expand Down
5 changes: 3 additions & 2 deletions src/lua/callbacks/event_callback.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
*
* @see Script
*/
EventCallback::EventCallback(const std::string &callbackName, bool skipDuplicationCheck) : m_callbackName(callbackName), m_skipDuplicationCheck(skipDuplicationCheck) { }
EventCallback::EventCallback(const std::string &callbackName, bool skipDuplicationCheck) :
m_callbackName(callbackName), m_skipDuplicationCheck(skipDuplicationCheck) { }

LuaScriptInterface* EventCallback::getScriptInterface() const {
return &g_scripts().getScriptInterface();
}

bool EventCallback::loadScriptId() {
LuaScriptInterface& luaInterface = g_scripts().getScriptInterface();
LuaScriptInterface &luaInterface = g_scripts().getScriptInterface();
m_scriptId = luaInterface.getEvent();
if (m_scriptId == -1) {
g_logger().error("[EventCallback::loadScriptId] Failed to load event. Script name: '{}', Module: '{}'", luaInterface.getLoadingScriptName(), luaInterface.getInterfaceName());
Expand Down
2 changes: 1 addition & 1 deletion src/lua/creature/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -508,7 +508,7 @@ LuaScriptInterface* Action::getScriptInterface() const {
}

bool Action::loadScriptId() {
LuaScriptInterface& luaInterface = g_scripts().getScriptInterface();
LuaScriptInterface &luaInterface = g_scripts().getScriptInterface();
m_scriptId = luaInterface.getEvent();
if (m_scriptId == -1) {
g_logger().error("[MoveEvent::loadScriptId] Failed to load event. Script name: '{}', Module: '{}'", luaInterface.getLoadingScriptName(), luaInterface.getInterfaceName());
Expand Down
2 changes: 1 addition & 1 deletion src/lua/creature/creatureevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ LuaScriptInterface* CreatureEvent::getScriptInterface() const {
}

bool CreatureEvent::loadScriptId() {
LuaScriptInterface& luaInterface = g_scripts().getScriptInterface();
LuaScriptInterface &luaInterface = g_scripts().getScriptInterface();
m_scriptId = luaInterface.getEvent();
if (m_scriptId == -1) {
g_logger().error("[MoveEvent::loadScriptId] Failed to load event. Script name: '{}', Module: '{}'", luaInterface.getLoadingScriptName(), luaInterface.getInterfaceName());
Expand Down
26 changes: 13 additions & 13 deletions src/lua/creature/movement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ LuaScriptInterface* MoveEvent::getScriptInterface() const {
}

bool MoveEvent::loadScriptId() {
LuaScriptInterface& luaInterface = g_scripts().getScriptInterface();
LuaScriptInterface &luaInterface = g_scripts().getScriptInterface();
m_scriptId = luaInterface.getEvent();
if (m_scriptId == -1) {
g_logger().error("[MoveEvent::loadScriptId] Failed to load event. Script name: '{}', Module: '{}'", luaInterface.getLoadingScriptName(), luaInterface.getInterfaceName());
Expand Down Expand Up @@ -737,12 +737,12 @@ bool MoveEvent::executeStep(const std::shared_ptr<Creature> &creature, const std
if (!LuaScriptInterface::reserveScriptEnv()) {
if (item != nullptr) {
g_logger().error("[MoveEvent::executeStep - Creature {} item {}, position {}] "
"Call stack overflow. Too many lua script calls being nested.",
creature->getName(), item->getName(), pos.toString());
"Call stack overflow. Too many lua script calls being nested.",
creature->getName(), item->getName(), pos.toString());
} else {
g_logger().error("[MoveEvent::executeStep - Creature {}, position {}] "
"Call stack overflow. Too many lua script calls being nested.",
creature->getName(), pos.toString());
"Call stack overflow. Too many lua script calls being nested.",
creature->getName(), pos.toString());
}
return false;
}
Expand Down Expand Up @@ -781,8 +781,8 @@ bool MoveEvent::executeEquip(const std::shared_ptr<Player> &player, const std::s
// onDeEquip(player, item, slot, isCheck)
if (!LuaScriptInterface::reserveScriptEnv()) {
g_logger().error("[MoveEvent::executeEquip - Player {} item {}] "
"Call stack overflow. Too many lua script calls being nested.",
player->getName(), item->getName());
"Call stack overflow. Too many lua script calls being nested.",
player->getName(), item->getName());
return false;
}

Expand Down Expand Up @@ -814,9 +814,9 @@ bool MoveEvent::executeAddRemItem(const std::shared_ptr<Item> &item, const std::
// onRemoveItem(moveitem, tileitem, pos)
if (!LuaScriptInterface::reserveScriptEnv()) {
g_logger().error("[MoveEvent::executeAddRemItem - "
"Item {} item on tile x: {} y: {} z: {}] "
"Call stack overflow. Too many lua script calls being nested.",
item->getName(), pos.getX(), pos.getY(), pos.getZ());
"Item {} item on tile x: {} y: {} z: {}] "
"Call stack overflow. Too many lua script calls being nested.",
item->getName(), pos.getX(), pos.getY(), pos.getZ());
return false;
}

Expand Down Expand Up @@ -846,9 +846,9 @@ bool MoveEvent::executeAddRemItem(const std::shared_ptr<Item> &item, const Posit
// onRemoveItem(moveitem, pos)
if (!LuaScriptInterface::reserveScriptEnv()) {
g_logger().error("[MoveEvent::executeAddRemItem - "
"Item {} item on tile x: {} y: {} z: {}] "
"Call stack overflow. Too many lua script calls being nested.",
item->getName(), pos.getX(), pos.getY(), pos.getZ());
"Item {} item on tile x: {} y: {} z: {}] "
"Call stack overflow. Too many lua script calls being nested.",
item->getName(), pos.getX(), pos.getY(), pos.getZ());
return false;
}

Expand Down
8 changes: 4 additions & 4 deletions src/lua/creature/movement.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class MoveEvents {

bool hasPosition(Position position) const {
if (const auto it = positionsMap.find(position);
it != positionsMap.end()) {
it != positionsMap.end()) {
return true;
}
return false;
Expand All @@ -60,7 +60,7 @@ class MoveEvents {

bool hasItemId(int32_t itemId) const {
if (const auto it = itemIdMap.find(itemId);
it != itemIdMap.end()) {
it != itemIdMap.end()) {
return true;
}
return false;
Expand All @@ -76,7 +76,7 @@ class MoveEvents {

bool hasUniqueId(int32_t uniqueId) const {
if (const auto it = uniqueIdMap.find(uniqueId);
it != uniqueIdMap.end()) {
it != uniqueIdMap.end()) {
return true;
}
return false;
Expand All @@ -92,7 +92,7 @@ class MoveEvents {

bool hasActionId(int32_t actionId) const {
if (const auto it = actionIdMap.find(actionId);
it != actionIdMap.end()) {
it != actionIdMap.end()) {
return true;
}
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/lua/creature/talkaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ LuaScriptInterface* TalkAction::getScriptInterface() const {
}

bool TalkAction::loadScriptId() {
LuaScriptInterface& luaInterface = g_scripts().getScriptInterface();
LuaScriptInterface &luaInterface = g_scripts().getScriptInterface();
m_scriptId = luaInterface.getEvent();
if (m_scriptId == -1) {
g_logger().error("[MoveEvent::loadScriptId] Failed to load event. Script name: '{}', Module: '{}'", luaInterface.getLoadingScriptName(), luaInterface.getInterfaceName());
Expand Down
2 changes: 1 addition & 1 deletion src/lua/global/globalevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ LuaScriptInterface* GlobalEvent::getScriptInterface() const {
}

bool GlobalEvent::loadScriptId() {
LuaScriptInterface& luaInterface = g_scripts().getScriptInterface();
LuaScriptInterface &luaInterface = g_scripts().getScriptInterface();
m_scriptId = luaInterface.getEvent();
if (m_scriptId == -1) {
g_logger().error("[MoveEvent::loadScriptId] Failed to load event. Script name: '{}', Module: '{}'", luaInterface.getLoadingScriptName(), luaInterface.getInterfaceName());
Expand Down
2 changes: 1 addition & 1 deletion src/lua/scripts/scripts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Scripts::Scripts() :
scriptInterface.initState();
}

Scripts& Scripts::getInstance() {
Scripts &Scripts::getInstance() {
static Scripts instance;
return instance;
}
Expand Down
2 changes: 1 addition & 1 deletion src/lua/scripts/scripts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Scripts {
Scripts(const Scripts &) = delete;
Scripts &operator=(const Scripts &) = delete;

static Scripts& getInstance();
static Scripts &getInstance();

void clearAllScripts() const;

Expand Down

0 comments on commit 65a122e

Please sign in to comment.