Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added/Removed spaces where needed #3796

Merged
1 commit merged into from
Nov 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/actions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ Actions::~Actions()

void Actions::clearMap(ActionUseMap& map, bool fromLua)
{
for (auto it = map.begin(); it != map.end(); ) {
for (auto it = map.begin(); it != map.end();) {
if (fromLua == it->second.fromLua) {
it = map.erase(it);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/fileloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const Node& Loader::parseTree()
parseStack.push(&root);

for (; it != fileContents.end(); ++it) {
switch(static_cast<uint8_t>(*it)) {
switch (static_cast<uint8_t>(*it)) {
case Node::START: {
auto& currentNode = getCurrentNode(parseStack);
if (currentNode.children.empty()) {
Expand Down
2 changes: 1 addition & 1 deletion src/globalevent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ GlobalEvents::~GlobalEvents()

void GlobalEvents::clearMap(GlobalEventMap& map, bool fromLua)
{
for (auto it = map.begin(); it != map.end(); ) {
for (auto it = map.begin(); it != map.end();) {
if (fromLua == it->second.fromLua) {
it = map.erase(it);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/iologindata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ bool IOLoginData::savePlayer(Player* player)
return false;
}

DBInsert spellsQuery("INSERT INTO `player_spells` (`player_id`, `name` ) VALUES ");
DBInsert spellsQuery("INSERT INTO `player_spells` (`player_id`, `name`) VALUES ");
for (const std::string& spellName : player->learnedInstantSpellList) {
if (!spellsQuery.addRow(fmt::format("{:d}, {:s}", player->getGUID(), db.escapeString(spellName)))) {
return false;
Expand Down
14 changes: 7 additions & 7 deletions src/luascript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -843,7 +843,7 @@ Thing* LuaScriptInterface::getThing(lua_State* L, int32_t arg)
Thing* thing;
if (lua_getmetatable(L, arg) != 0) {
lua_rawgeti(L, -1, 't');
switch(getNumber<uint32_t>(L, -1)) {
switch (getNumber<uint32_t>(L, -1)) {
case LuaData_Item:
thing = getUserdata<Item>(L, arg);
break;
Expand Down Expand Up @@ -1035,7 +1035,7 @@ void LuaScriptInterface::registerFunctions()
// getSubTypeName(subType)
lua_register(luaState, "getSubTypeName", LuaScriptInterface::luaGetSubTypeName);

//createCombatArea( {area}, <optional> {extArea} )
//createCombatArea({area}, <optional> {extArea})
lua_register(luaState, "createCombatArea", LuaScriptInterface::luaCreateCombatArea);

//doAreaCombat(cid, type, pos, area, min, max, effect[, origin = ORIGIN_SPELL[, blockArmor = false[, blockShield = false[, ignoreResistances = false]]]])
Expand Down Expand Up @@ -3418,7 +3418,7 @@ bool LuaScriptInterface::getArea(lua_State* L, std::vector<uint32_t>& vec, uint3

int LuaScriptInterface::luaCreateCombatArea(lua_State* L)
{
//createCombatArea( {area}, <optional> {extArea} )
//createCombatArea({area}, <optional> {extArea})
ScriptEnvironment* env = getScriptEnv();
if (env->getScriptId() != EVENT_ID_LOADING) {
reportErrorFunc(L, "This function can only be used while loading the script.");
Expand Down Expand Up @@ -11638,8 +11638,8 @@ int LuaScriptInterface::luaHouseGetItems(lua_State* L)
int index = 0;
for (Tile* tile : tiles) {
TileItemVector* itemVector = tile->getItemList();
if(itemVector) {
for(Item* item : *itemVector) {
if (itemVector) {
for (Item* item : *itemVector) {
pushUserdata<Item>(L, item);
setItemMetatable(L, -1, item);
lua_rawseti(L, -2, ++index);
Expand Down Expand Up @@ -16421,13 +16421,13 @@ int LuaScriptInterface::luaGlobalEventRegister(lua_State* L)
pushBoolean(L, false);
return 1;
}

if (globalevent->getEventType() == GLOBALEVENT_NONE && globalevent->getInterval() == 0) {
std::cout << "[Error - LuaScriptInterface::luaGlobalEventRegister] No interval for globalevent with name " << globalevent->getName() << std::endl;
pushBoolean(L, false);
return 1;
}

pushBoolean(L, g_globalEvents->registerLuaEvent(globalevent));
} else {
lua_pushnil(L);
Expand Down
4 changes: 2 additions & 2 deletions src/movement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void MoveEvents::clearMap(MoveListMap& map, bool fromLua)
for (auto it = map.begin(); it != map.end(); ++it) {
for (int eventType = MOVE_EVENT_STEP_IN; eventType < MOVE_EVENT_LAST; ++eventType) {
auto& moveEvents = it->second.moveEvent[eventType];
for (auto find = moveEvents.begin(); find != moveEvents.end(); ) {
for (auto find = moveEvents.begin(); find != moveEvents.end();) {
if (fromLua == find->fromLua) {
find = moveEvents.erase(find);
} else {
Expand All @@ -60,7 +60,7 @@ void MoveEvents::clearPosMap(MovePosListMap& map, bool fromLua)
for (auto it = map.begin(); it != map.end(); ++it) {
for (int eventType = MOVE_EVENT_STEP_IN; eventType < MOVE_EVENT_LAST; ++eventType) {
auto& moveEvents = it->second.moveEvent[eventType];
for (auto find = moveEvents.begin(); find != moveEvents.end(); ) {
for (auto find = moveEvents.begin(); find != moveEvents.end();) {
if (fromLua == find->fromLua) {
find = moveEvents.erase(find);
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/otserv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ bool argumentsHandler(const StringVector& args);
int main(int argc, char* argv[])
{
StringVector args = StringVector(argv, argv + argc);
if(argc > 1 && !argumentsHandler(args)) {
if (argc > 1 && !argumentsHandler(args)) {
return 0;
}

Expand Down
8 changes: 4 additions & 4 deletions src/script.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,20 +42,20 @@ bool Scripts::loadScripts(std::string folderName, bool isLib, bool reload)
namespace fs = boost::filesystem;

const auto dir = fs::current_path() / "data" / folderName;
if(!fs::exists(dir) || !fs::is_directory(dir)) {
if (!fs::exists(dir) || !fs::is_directory(dir)) {
std::cout << "[Warning - Scripts::loadScripts] Can not load folder '" << folderName << "'." << std::endl;
return false;
}

fs::recursive_directory_iterator endit;
std::vector<fs::path> v;
std::string disable = ("#");
for(fs::recursive_directory_iterator it(dir); it != endit; ++it) {
for (fs::recursive_directory_iterator it(dir); it != endit; ++it) {
auto fn = it->path().parent_path().filename();
if ((fn == "lib" && !isLib) || fn == "events") {
continue;
}
if(fs::is_regular_file(*it) && it->path().extension() == ".lua") {
if (fs::is_regular_file(*it) && it->path().extension() == ".lua") {
size_t found = it->path().filename().string().find(disable);
if (found != std::string::npos) {
if (g_config.getBoolean(ConfigManager::SCRIPTS_CONSOLE_LOGS)) {
Expand All @@ -80,7 +80,7 @@ bool Scripts::loadScripts(std::string folderName, bool isLib, bool reload)
}
}

if(scriptInterface.loadFile(scriptFile) == -1) {
if (scriptInterface.loadFile(scriptFile) == -1) {
std::cout << "> " << it->filename().string() << " [error]" << std::endl;
std::cout << "^ " << scriptInterface.getLastLuaError() << std::endl;
continue;
Expand Down
2 changes: 1 addition & 1 deletion src/signals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ void sigintHandler()
// https://github.com/otland/forgottenserver/pull/2473
void dispatchSignalHandler(int signal)
{
switch(signal) {
switch (signal) {
case SIGINT: //Shuts the server down
g_dispatcher.addTask(createTask(sigintHandler));
break;
Expand Down
4 changes: 2 additions & 2 deletions src/spells.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ TalkActionResult_t Spells::playerSaySpell(Player* player, std::string& words)

void Spells::clearMaps(bool fromLua)
{
for (auto instant = instants.begin(); instant != instants.end(); ) {
for (auto instant = instants.begin(); instant != instants.end();) {
if (fromLua == instant->second.fromLua) {
instant = instants.erase(instant);
} else {
++instant;
}
}

for (auto rune = runes.begin(); rune != runes.end(); ) {
for (auto rune = runes.begin(); rune != runes.end();) {
if (fromLua == rune->second.fromLua) {
rune = runes.erase(rune);
} else {
Expand Down
4 changes: 2 additions & 2 deletions src/talkaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ TalkActions::~TalkActions()

void TalkActions::clear(bool fromLua)
{
for (auto it = talkActions.begin(); it != talkActions.end(); ) {
for (auto it = talkActions.begin(); it != talkActions.end();) {
if (fromLua == it->second.fromLua) {
it = talkActions.erase(it);
} else {
Expand Down Expand Up @@ -100,7 +100,7 @@ bool TalkActions::registerLuaEvent(TalkAction* event)
TalkActionResult_t TalkActions::playerSaySpell(Player* player, SpeakClasses type, const std::string& words) const
{
size_t wordsLength = words.length();
for (auto it = talkActions.begin(); it != talkActions.end(); ) {
for (auto it = talkActions.begin(); it != talkActions.end();) {
const std::string& talkactionWords = it->first;
size_t talkactionLength = talkactionWords.length();
if (wordsLength < talkactionLength || strncasecmp(words.c_str(), talkactionWords.c_str(), talkactionLength) != 0) {
Expand Down
2 changes: 1 addition & 1 deletion src/weapons.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ const Weapon* Weapons::getWeapon(const Item* item) const

void Weapons::clear(bool fromLua)
{
for (auto it = weapons.begin(); it != weapons.end(); ) {
for (auto it = weapons.begin(); it != weapons.end();) {
if (fromLua == it->second->fromLua) {
it = weapons.erase(it);
} else {
Expand Down