summaryrefslogtreecommitdiff
path: root/src/being.cpp
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-09 09:47:21 +0100
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2024-02-13 12:57:16 +0100
commitc70be70cab3615cb36cc5f244671cf5d39f1fda8 (patch)
treeb15e68552ffd6adda832a9ae5d38160ef8299d7f /src/being.cpp
parent717eb07c0d51098e319059883b11ba6e2bf4cbb8 (diff)
downloadmana-c70be70cab3615cb36cc5f244671cf5d39f1fda8.tar.gz
mana-c70be70cab3615cb36cc5f244671cf5d39f1fda8.tar.bz2
mana-c70be70cab3615cb36cc5f244671cf5d39f1fda8.tar.xz
mana-c70be70cab3615cb36cc5f244671cf5d39f1fda8.zip
General code cleanups
* Removing unused includes * Use member initialization * Use range-based for loops * Use nullptr * Removed no longer used aliases * Use override * Don't use else after return * Use '= delete' to remove implicit members * Use std::string::empty instead of comparing to ""
Diffstat (limited to 'src/being.cpp')
-rw-r--r--src/being.cpp37
1 files changed, 3 insertions, 34 deletions
diff --git a/src/being.cpp b/src/being.cpp
index ef07684f..9549b625 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -28,7 +28,6 @@
#include "effectmanager.h"
#include "event.h"
#include "game.h"
-#include "graphics.h"
#include "guild.h"
#include "localplayer.h"
#include "log.h"
@@ -36,7 +35,6 @@
#include "particle.h"
#include "party.h"
#include "playerrelations.h"
-#include "simpleanimation.h"
#include "sound.h"
#include "text.h"
@@ -51,8 +49,6 @@
#include "net/npchandler.h"
#include "resources/beinginfo.h"
-#include "resources/hairdb.h"
-#include "resources/emotedb.h"
#include "resources/image.h"
#include "resources/itemdb.h"
#include "resources/iteminfo.h"
@@ -63,30 +59,12 @@
#include "utils/stringutils.h"
-#include <cassert>
#include <cmath>
Being::Being(int id, Type type, int subtype, Map *map):
ActorSprite(id),
mInfo(BeingInfo::Unknown),
- mActionTime(0),
- mSpeechTime(0),
- mAttackSpeed(350),
- mAction(STAND),
- mSubType(0xFFFF),
- mDirection(DOWN),
- mSpriteDirection(DIRECTION_DOWN),
- mDispName(nullptr),
- mShowName(false),
- mEquippedWeapon(nullptr),
- mText(nullptr),
- mGender(GENDER_UNSPECIFIED),
- mParty(nullptr),
- mIsGM(false),
- mType(type),
- mSpeedPixelsPerTick(Vector(0.0f, 0.0f, 0.0f)),
- mDamageTaken(0),
- mIp(0)
+ mType(type)
{
setMap(map);
setSubtype(subtype);
@@ -512,15 +490,9 @@ void Being::removeGuild(int id)
Guild *Being::getGuild(const std::string &guildName) const
{
- std::map<int, Guild*>::const_iterator itr, itr_end = mGuilds.end();
- for (itr = mGuilds.begin(); itr != itr_end; ++itr)
- {
- Guild *guild = itr->second;
+ for (auto &[_, guild] : mGuilds)
if (guild->getName() == guildName)
- {
return guild;
- }
- }
return nullptr;
}
@@ -539,11 +511,8 @@ Guild *Being::getGuild(int id) const
void Being::clearGuilds()
{
- std::map<int, Guild*>::const_iterator itr, itr_end = mGuilds.end();
- for (itr = mGuilds.begin(); itr != itr_end; ++itr)
+ for (auto &[_, guild] : mGuilds)
{
- Guild *guild = itr->second;
-
if (this == local_player && socialWindow)
socialWindow->removeTab(guild);