summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-04-02 11:35:58 +0200
committerThorbjørn Lindeijer <bjorn@lindeijer.nl>2025-04-02 11:36:04 +0200
commitba8317a8172754fb422e559aadfddc3dd8b1ec5e (patch)
tree814935756526770cde8640398386de835933720b /src
parent0f8e03229b5aaa1727c612a55180945c7608ad2d (diff)
downloadmana-ba8317a8172754fb422e559aadfddc3dd8b1ec5e.tar.gz
mana-ba8317a8172754fb422e559aadfddc3dd8b1ec5e.tar.bz2
mana-ba8317a8172754fb422e559aadfddc3dd8b1ec5e.tar.xz
mana-ba8317a8172754fb422e559aadfddc3dd8b1ec5e.zip
Use a consistent naming style for enum class values
Sometimes I've used CamelCase and sometimes SNAKE_CASE for these values. Since "enum class" values are always prefixed with the enum name, which uses CamelCase, I find it more fitting to use it for the values as well. Also fixes compilation on Windows where 'ERROR' was conflicting with a define.
Diffstat (limited to 'src')
-rw-r--r--src/being.cpp16
-rw-r--r--src/being.h10
-rw-r--r--src/client.cpp10
-rw-r--r--src/client.h2
-rw-r--r--src/commandhandler.cpp12
-rw-r--r--src/configuration.cpp6
-rw-r--r--src/gui/charcreatedialog.cpp12
-rw-r--r--src/gui/charselectdialog.cpp2
-rw-r--r--src/gui/customserverdialog.cpp8
-rw-r--r--src/gui/gui.cpp34
-rw-r--r--src/gui/gui.h37
-rw-r--r--src/gui/ministatuswindow.cpp2
-rw-r--r--src/gui/popupmenu.cpp18
-rw-r--r--src/gui/register.cpp2
-rw-r--r--src/gui/selldialog.cpp2
-rw-r--r--src/gui/serverdialog.cpp10
-rw-r--r--src/gui/skilldialog.cpp2
-rw-r--r--src/gui/statuswindow.cpp2
-rw-r--r--src/gui/updaterwindow.cpp34
-rw-r--r--src/gui/updaterwindow.h10
-rw-r--r--src/gui/viewport.cpp10
-rw-r--r--src/gui/widgets/browserbox.cpp4
-rw-r--r--src/gui/widgets/window.cpp16
-rw-r--r--src/localplayer.cpp2
-rw-r--r--src/main.cpp2
-rw-r--r--src/map.cpp2
-rw-r--r--src/net/download.cpp10
-rw-r--r--src/net/download.h10
-rw-r--r--src/net/logindata.h4
-rw-r--r--src/net/manaserv/beinghandler.cpp6
-rw-r--r--src/net/manaserv/charhandler.cpp6
-rw-r--r--src/net/net.cpp12
-rw-r--r--src/net/serverinfo.h30
-rw-r--r--src/net/tmwa/beinghandler.cpp8
-rw-r--r--src/net/tmwa/charserverhandler.cpp4
-rw-r--r--src/net/tmwa/gamehandler.cpp2
-rw-r--r--src/net/tmwa/loginhandler.cpp4
-rw-r--r--src/net/tmwa/token.h2
-rw-r--r--src/party.cpp2
-rw-r--r--src/playerrelations.cpp10
-rw-r--r--src/playerrelations.h8
-rw-r--r--src/resources/beinginfo.cpp20
-rw-r--r--src/resources/beinginfo.h10
-rw-r--r--src/resources/itemdb.cpp16
-rw-r--r--src/resources/iteminfo.h4
-rw-r--r--src/resources/monsterdb.cpp10
-rw-r--r--src/resources/settingsmanager.cpp2
47 files changed, 224 insertions, 223 deletions
diff --git a/src/being.cpp b/src/being.cpp
index d239b9e8..db9a9deb 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -376,7 +376,7 @@ void Being::takeDamage(Being *attacker, int amount,
if (amount > 0)
{
- auto &hurtSfx = mInfo->getSound(SoundEvent::HURT);
+ auto &hurtSfx = mInfo->getSound(SoundEvent::Hurt);
if (attacker)
sound.playSfx(hurtSfx, attacker->getPixelX(), attacker->getPixelY());
else
@@ -449,14 +449,14 @@ void Being::handleAttack(Being *victim, int damage, int attackId)
if (!itemInfo)
itemInfo = &itemDb->get(-100 - mSubType);
- const auto event = damage > 0 ? EquipmentSoundEvent::HIT
- : EquipmentSoundEvent::STRIKE;
+ const auto event = damage > 0 ? EquipmentSoundEvent::Hit
+ : EquipmentSoundEvent::Strike;
const auto &soundFile = itemInfo->getSound(event);
sound.playSfx(soundFile, getPixelX(), getPixelY());
}
else
{
- const auto event = damage > 0 ? SoundEvent::HIT : SoundEvent::MISS;
+ const auto event = damage > 0 ? SoundEvent::Hit : SoundEvent::Miss;
const auto &soundFile = mInfo->getSound(event);
sound.playSfx(soundFile, getPixelX(), getPixelY());
}
@@ -675,7 +675,7 @@ void Being::setAction(Action action, int attackId)
break;
case DEAD:
currentAction = SpriteAction::DEAD;
- sound.playSfx(mInfo->getSound(SoundEvent::DIE),
+ sound.playSfx(mInfo->getSound(SoundEvent::Die),
getPixelX(), getPixelY());
break;
case STAND:
@@ -1042,14 +1042,14 @@ void Being::updateName()
{
if (config.showGender)
{
- if (getGender() == Gender::FEMALE)
+ if (getGender() == Gender::Female)
mDisplayName += " \u2640";
- else if (getGender() == Gender::MALE)
+ else if (getGender() == Gender::Male)
mDisplayName += " \u2642";
}
// Display the IP when under tmw-Athena (GM only).
- if (Net::getNetworkType() == ServerType::TMWATHENA && local_player
+ if (Net::getNetworkType() == ServerType::TmwAthena && local_player
&& local_player->getShowIp() && getIp())
{
mDisplayName += strprintf(" %s", ipToString(getIp()));
diff --git a/src/being.h b/src/being.h
index 38f5f149..96749651 100644
--- a/src/being.h
+++ b/src/being.h
@@ -56,10 +56,10 @@ class Text;
enum class Gender
{
- MALE = 0,
- FEMALE = 1,
- UNSPECIFIED = 2,
- HIDDEN = 3
+ Male = 0,
+ Female = 1,
+ Unspecified = 2,
+ Hidden = 3
};
class Being : public ActorSprite, public EventListener, public gcn::DeathListener
@@ -531,7 +531,7 @@ class Being : public ActorSprite, public EventListener, public gcn::DeathListene
std::vector<SpriteState> mSpriteStates;
bool mRestoreParticlesOnLogic = false;
- Gender mGender = Gender::UNSPECIFIED;
+ Gender mGender = Gender::Unspecified;
// Character guild information
std::map<int, Guild*> mGuilds;
diff --git a/src/client.cpp b/src/client.cpp
index 6017bbdc..99c5bbcf 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -350,12 +350,12 @@ Client::Client(const Options &options):
loginData.remember = config.remember;
loginData.registerLogin = false;
- if (mCurrentServer.type == ServerType::UNKNOWN && mCurrentServer.port != 0)
+ if (mCurrentServer.type == ServerType::Unknown && mCurrentServer.port != 0)
{
mCurrentServer.type = ServerInfo::defaultServerTypeForPort(mCurrentServer.port);
}
- if (mCurrentServer.type == ServerType::UNKNOWN)
+ if (mCurrentServer.type == ServerType::Unknown)
{
mCurrentServer.type = ServerInfo::parseType(
branding.getValue("defaultServerType", "tmwathena"));
@@ -680,10 +680,10 @@ int Client::exec()
switch (Net::getNetworkType())
{
- case ServerType::TMWATHENA:
+ case ServerType::TmwAthena:
itemDb = new TmwAthena::TaItemDB;
break;
- case ServerType::MANASERV:
+ case ServerType::ManaServ:
itemDb = new ManaServ::ManaServItemDB;
break;
default:
@@ -742,7 +742,7 @@ int Client::exec()
Net::getGameHandler()->connect();
mCurrentDialog = new ConnectionDialog(
_("Connecting to the game server"),
- Net::getNetworkType() == ServerType::TMWATHENA ?
+ Net::getNetworkType() == ServerType::TmwAthena ?
STATE_CHOOSE_SERVER : STATE_SWITCH_CHARACTER);
break;
diff --git a/src/client.h b/src/client.h
index 2bf1c906..a3e9c572 100644
--- a/src/client.h
+++ b/src/client.h
@@ -134,7 +134,7 @@ public:
std::string configDir;
std::string localDataDir;
std::string screenshotDir;
- ServerType serverType = ServerType::UNKNOWN;
+ ServerType serverType = ServerType::Unknown;
std::string serverName;
uint16_t serverPort = 0;
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index e1a0f6f9..dd4cb2c0 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -122,7 +122,7 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
{
handlePresent(args, tab);
}
- else if (type == "showip" && Net::getNetworkType() == ServerType::TMWATHENA)
+ else if (type == "showip" && Net::getNetworkType() == ServerType::TmwAthena)
{
handleShowIp(args, tab);
}
@@ -523,15 +523,15 @@ void CommandHandler::handleIgnore(const std::string &args, ChatTab *tab)
return;
}
- if (player_relations.getRelation(args) == PlayerRelation::IGNORED)
+ if (player_relations.getRelation(args) == PlayerRelation::Ignored)
{
tab->chatLog(_("Player already ignored!"), BY_SERVER);
return;
}
else
- player_relations.setRelation(args, PlayerRelation::IGNORED);
+ player_relations.setRelation(args, PlayerRelation::Ignored);
- if (player_relations.getRelation(args) == PlayerRelation::IGNORED)
+ if (player_relations.getRelation(args) == PlayerRelation::Ignored)
tab->chatLog(_("Player successfully ignored!"), BY_SERVER);
else
tab->chatLog(_("Player could not be ignored!"), BY_SERVER);
@@ -545,7 +545,7 @@ void CommandHandler::handleUnignore(const std::string &args, ChatTab *tab)
return;
}
- if (player_relations.getRelation(args) == PlayerRelation::IGNORED)
+ if (player_relations.getRelation(args) == PlayerRelation::Ignored)
player_relations.removePlayer(args);
else
{
@@ -553,7 +553,7 @@ void CommandHandler::handleUnignore(const std::string &args, ChatTab *tab)
return;
}
- if (player_relations.getRelation(args) != PlayerRelation::IGNORED)
+ if (player_relations.getRelation(args) != PlayerRelation::Ignored)
tab->chatLog(_("Player no longer ignored!"), BY_SERVER);
else
tab->chatLog(_("Player could not be unignored!"), BY_SERVER);
diff --git a/src/configuration.cpp b/src/configuration.cpp
index ead228c4..5b45a21d 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -302,9 +302,9 @@ static const char *serverTypeToString(ServerType type)
{
switch (type)
{
- case ServerType::TMWATHENA:
+ case ServerType::TmwAthena:
return "TmwAthena";
- case ServerType::MANASERV:
+ case ServerType::ManaServ:
return "ManaServ";
default:
return "";
@@ -550,7 +550,7 @@ void deserialize(XML::Node node, Config &config)
for (auto node : node.children()) {
if (node.name() == "player") {
std::string playerName;
- PlayerRelation relation = PlayerRelation::NEUTRAL;
+ PlayerRelation relation = PlayerRelation::Neutral;
for (auto node : node.children()) {
if (node.name() == "option") {
diff --git a/src/gui/charcreatedialog.cpp b/src/gui/charcreatedialog.cpp
index d5bdf3ca..cff7d822 100644
--- a/src/gui/charcreatedialog.cpp
+++ b/src/gui/charcreatedialog.cpp
@@ -50,7 +50,7 @@ CharCreateDialog::CharCreateDialog(CharSelectDialog *parent, int slot):
mSlot(slot)
{
mPlayer = new Being(0, ActorSprite::PLAYER, 0, nullptr);
- mPlayer->setGender(Gender::MALE);
+ mPlayer->setGender(Gender::Male);
const std::vector<int> &items = CharDB::getDefaultItems();
for (size_t i = 0; i < items.size(); ++i)
@@ -175,7 +175,7 @@ void CharCreateDialog::action(const gcn::ActionEvent &event)
{
if (event.getId() == "create")
{
- if (Net::getNetworkType() == ServerType::MANASERV
+ if (Net::getNetworkType() == ServerType::ManaServ
|| getName().length() >= 4)
{
// Attempt to create the character
@@ -183,7 +183,7 @@ void CharCreateDialog::action(const gcn::ActionEvent &event)
int characterSlot = mSlot;
// On Manaserv, the slots start at 1, so we offset them.
- if (Net::getNetworkType() == ServerType::MANASERV)
+ if (Net::getNetworkType() == ServerType::ManaServ)
++characterSlot;
// Should avoid the most common crash case
@@ -234,9 +234,9 @@ void CharCreateDialog::action(const gcn::ActionEvent &event)
else if (event.getId() == "gender")
{
if (mMale->isSelected())
- mPlayer->setGender(Gender::MALE);
+ mPlayer->setGender(Gender::Male);
else
- mPlayer->setGender(Gender::FEMALE);
+ mPlayer->setGender(Gender::Female);
}
}
@@ -376,7 +376,7 @@ void CharCreateDialog::setAttributes(const std::vector<std::string> &labels,
void CharCreateDialog::setDefaultGender(Gender gender)
{
- if (gender == Gender::FEMALE)
+ if (gender == Gender::Female)
{
mFemale->setSelected(true);
mMale->setSelected(false);
diff --git a/src/gui/charselectdialog.cpp b/src/gui/charselectdialog.cpp
index eb649c58..2485be69 100644
--- a/src/gui/charselectdialog.cpp
+++ b/src/gui/charselectdialog.cpp
@@ -266,7 +266,7 @@ void CharSelectDialog::setCharacters(const Net::Characters &characters)
{
// Slots Number start at 1 for Manaserv, so we offset them by one.
int characterSlot = character->slot;
- if (Net::getNetworkType() == ServerType::MANASERV && characterSlot > 0)
+ if (Net::getNetworkType() == ServerType::ManaServ && characterSlot > 0)
--characterSlot;
if (characterSlot >= (int)mCharacterEntries.size())
diff --git a/src/gui/customserverdialog.cpp b/src/gui/customserverdialog.cpp
index 5ed3a445..5524e459 100644
--- a/src/gui/customserverdialog.cpp
+++ b/src/gui/customserverdialog.cpp
@@ -104,7 +104,7 @@ CustomServerDialog::CustomServerDialog(ServerDialog *parent, int index):
mServerAddressField->setText(serverInfo.hostname);
mPortField->setText(toString(serverInfo.port));
#ifdef MANASERV_SUPPORT
- mTypeField->setSelected(serverInfo.type == ServerType::TMWATHENA ?
+ mTypeField->setSelected(serverInfo.type == ServerType::TmwAthena ?
0 : 1);
#endif
}
@@ -145,13 +145,13 @@ void CustomServerDialog::action(const gcn::ActionEvent &event)
switch (mTypeField->getSelected())
{
case 0:
- serverInfo.type = ServerType::TMWATHENA;
+ serverInfo.type = ServerType::TmwAthena;
break;
case 1:
- serverInfo.type = ServerType::MANASERV;
+ serverInfo.type = ServerType::ManaServ;
break;
default:
- serverInfo.type = ServerType::UNKNOWN;
+ serverInfo.type = ServerType::Unknown;
}
#else
serverInfo.type = ServerType::TMWATHENA;
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index f9a36472..d72bd56d 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -299,7 +299,7 @@ void Gui::loadCustomCursors()
0, targetCursorSize, targetCursorSize, 32,
rmask, gmask, bmask, amask);
- for (int i = 0; i <= static_cast<int>(Cursor::LAST); ++i)
+ for (int i = 0; i < static_cast<int>(Cursor::Count); ++i)
{
int x = i % columns * cursorSize;
int y = i / columns * cursorSize;
@@ -328,22 +328,22 @@ void Gui::loadSystemCursors()
constexpr struct {
Cursor cursor;
SDL_SystemCursor systemCursor;
- } cursors[static_cast<int>(Cursor::LAST) + 1] = {
- { Cursor::POINTER, SDL_SYSTEM_CURSOR_ARROW },
- { Cursor::RESIZE_ACROSS, SDL_SYSTEM_CURSOR_SIZEWE },
- { Cursor::RESIZE_DOWN, SDL_SYSTEM_CURSOR_SIZENS },
- { Cursor::RESIZE_DOWN_LEFT, SDL_SYSTEM_CURSOR_SIZENESW },
- { Cursor::RESIZE_DOWN_RIGHT, SDL_SYSTEM_CURSOR_SIZENWSE },
- { Cursor::FIGHT, SDL_SYSTEM_CURSOR_HAND },
- { Cursor::PICKUP, SDL_SYSTEM_CURSOR_HAND },
- { Cursor::TALK, SDL_SYSTEM_CURSOR_HAND },
- { Cursor::ACTION, SDL_SYSTEM_CURSOR_HAND },
- { Cursor::LEFT, SDL_SYSTEM_CURSOR_ARROW },
- { Cursor::UP, SDL_SYSTEM_CURSOR_ARROW },
- { Cursor::RIGHT, SDL_SYSTEM_CURSOR_ARROW },
- { Cursor::DOWN, SDL_SYSTEM_CURSOR_ARROW },
- { Cursor::DRAG, SDL_SYSTEM_CURSOR_SIZEALL },
- { Cursor::HAND, SDL_SYSTEM_CURSOR_HAND },
+ } cursors[static_cast<int>(Cursor::Count)] = {
+ { Cursor::Pointer, SDL_SYSTEM_CURSOR_ARROW },
+ { Cursor::ResizeAcross, SDL_SYSTEM_CURSOR_SIZEWE },
+ { Cursor::ResizeDown, SDL_SYSTEM_CURSOR_SIZENS },
+ { Cursor::ResizeDownLeft, SDL_SYSTEM_CURSOR_SIZENESW },
+ { Cursor::ResizeDownRight, SDL_SYSTEM_CURSOR_SIZENWSE },
+ { Cursor::Fight, SDL_SYSTEM_CURSOR_HAND },
+ { Cursor::PickUp, SDL_SYSTEM_CURSOR_HAND },
+ { Cursor::Talk, SDL_SYSTEM_CURSOR_HAND },
+ { Cursor::Action, SDL_SYSTEM_CURSOR_HAND },
+ { Cursor::Left, SDL_SYSTEM_CURSOR_ARROW },
+ { Cursor::Up, SDL_SYSTEM_CURSOR_ARROW },
+ { Cursor::Right, SDL_SYSTEM_CURSOR_ARROW },
+ { Cursor::Down, SDL_SYSTEM_CURSOR_ARROW },
+ { Cursor::Drag, SDL_SYSTEM_CURSOR_SIZEALL },
+ { Cursor::Hand, SDL_SYSTEM_CURSOR_HAND },
};
for (auto cursor : cursors)
diff --git a/src/gui/gui.h b/src/gui/gui.h
index 0441d18e..450514f5 100644
--- a/src/gui/gui.h
+++ b/src/gui/gui.h
@@ -50,23 +50,24 @@ class SDLInput;
* Cursors are in graphic order from left to right.
* CURSOR_POINTER should be left untouched.
*/
-enum class Cursor {
- POINTER = 0,
- RESIZE_ACROSS,
- RESIZE_DOWN,
- RESIZE_DOWN_LEFT,
- RESIZE_DOWN_RIGHT,
- FIGHT,
- PICKUP,
- TALK,
- ACTION,
- LEFT,
- UP,
- RIGHT,
- DOWN,
- DRAG,
- HAND,
- LAST = HAND,
+enum class Cursor
+{
+ Pointer = 0,
+ ResizeAcross,
+ ResizeDown,
+ ResizeDownLeft,
+ ResizeDownRight,
+ Fight,
+ PickUp,
+ Talk,
+ Action,
+ Left,
+ Up,
+ Right,
+ Down,
+ Drag,
+ Hand,
+ Count,
};
/**
@@ -148,7 +149,7 @@ class Gui final : public gcn::Gui, public EventListener
std::vector<SDL_Cursor *> mSystemMouseCursors;
std::vector<SDL_Cursor *> mCustomMouseCursors;
Timer mMouseActivityTimer;
- Cursor mCursorType = Cursor::POINTER;
+ Cursor mCursorType = Cursor::Pointer;
};
extern Gui *gui; /**< The GUI system */
diff --git a/src/gui/ministatuswindow.cpp b/src/gui/ministatuswindow.cpp
index 4e32848c..9d695954 100644
--- a/src/gui/ministatuswindow.cpp
+++ b/src/gui/ministatuswindow.cpp
@@ -143,7 +143,7 @@ void MiniStatusWindow::event(Event::Channel channel, const Event &event)
}
if (event.getType() == Event::UpdateStat)
{
- if (Net::getNetworkType() == ServerType::TMWATHENA &&
+ if (Net::getNetworkType() == ServerType::TmwAthena &&
event.getInt("id") == TmwAthena::MATK)
{
StatusWindow::updateMPBar(mMpBar);
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 64f4d753..4bafc074 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -91,12 +91,12 @@ void PopupMenu::showPopup(int x, int y, Being *being)
switch (player_relations.getRelation(name))
{
- case PlayerRelation::NEUTRAL:
+ case PlayerRelation::Neutral:
mBrowserBox->addRow(strprintf("@@friend|%s@@",
strprintf(_("Befriend %s"),
name.c_str()).c_str()));
- case PlayerRelation::FRIEND:
+ case PlayerRelation::Friend:
mBrowserBox->addRow(strprintf("@@disregard|%s@@",
strprintf(_("Disregard %s"),
name.c_str()).c_str()));
@@ -105,7 +105,7 @@ void PopupMenu::showPopup(int x, int y, Being *being)
name.c_str()).c_str()));
break;
- case PlayerRelation::DISREGARDED:
+ case PlayerRelation::Disregarded:
mBrowserBox->addRow(strprintf("@@unignore|%s@@",
strprintf(_("Unignore %s"),
name.c_str()).c_str()));
@@ -114,7 +114,7 @@ void PopupMenu::showPopup(int x, int y, Being *being)
name.c_str()).c_str()));
break;
- case PlayerRelation::IGNORED:
+ case PlayerRelation::Ignored:
mBrowserBox->addRow(strprintf("@@unignore|%s@@",
strprintf(_("Unignore %s"),
name.c_str()).c_str()));
@@ -126,7 +126,7 @@ void PopupMenu::showPopup(int x, int y, Being *being)
strprintf(_("Invite %s to join your guild"),
name.c_str()).c_str()));
if (local_player->isInParty() ||
- Net::getNetworkType() == ServerType::MANASERV)
+ Net::getNetworkType() == ServerType::ManaServ)
{
mBrowserBox->addRow(strprintf("@@party|%s@@",
strprintf(_("Invite %s to join your party"),
@@ -223,25 +223,25 @@ void PopupMenu::handleLink(const std::string &link)
else if (link == "unignore" && being &&
being->getType() == ActorSprite::PLAYER)
{
- player_relations.setRelation(being->getName(), PlayerRelation::NEUTRAL);
+ player_relations.setRelation(being->getName(), PlayerRelation::Neutral);
}
else if (link == "ignore" && being &&
being->getType() == ActorSprite::PLAYER)
{
- player_relations.setRelation(being->getName(), PlayerRelation::IGNORED);
+ player_relations.setRelation(being->getName(), PlayerRelation::Ignored);
}
else if (link == "disregard" && being &&
being->getType() == ActorSprite::PLAYER)
{
- player_relations.setRelation(being->getName(), PlayerRelation::DISREGARDED);
+ player_relations.setRelation(being->getName(), PlayerRelation::Disregarded);
}
else if (link == "friend" && being &&
being->getType() == ActorSprite::PLAYER)
{
- player_relations.setRelation(being->getName(), PlayerRelation::FRIEND);
+ player_relations.setRelation(being->getName(), PlayerRelation::Friend);
}
// Guild action
else if (link == "guild" && being &&
diff --git a/src/gui/register.cpp b/src/gui/register.cpp
index 685e4898..62114c10 100644
--- a/src/gui/register.cpp
+++ b/src/gui/register.cpp
@@ -225,7 +225,7 @@ void RegisterDialog::action(const gcn::ActionEvent &event)
mLoginData->password = mPasswordField->getText();
if (mFemaleButton)
mLoginData->gender = mFemaleButton->isSelected() ?
- Gender::FEMALE : Gender::MALE;
+ Gender::Female : Gender::Male;
if (mEmailField)
mLoginData->email = mEmailField->getText();
mLoginData->registerLogin = true;
diff --git a/src/gui/selldialog.cpp b/src/gui/selldialog.cpp
index 5f499982..4aeacd6f 100644
--- a/src/gui/selldialog.cpp
+++ b/src/gui/selldialog.cpp
@@ -205,7 +205,7 @@ void SellDialog::action(const gcn::ActionEvent &event)
sellCount = item->sellCurrentDuplicate(mAmountItems);
// For Manaserv, the Item id is to be given as index.
- if ((Net::getNetworkType() == ServerType::MANASERV))
+ if ((Net::getNetworkType() == ServerType::ManaServ))
itemIndex = item->getId();
Net::getNpcHandler()->sellItem(mNpcId, itemIndex, sellCount);
diff --git a/src/gui/serverdialog.cpp b/src/gui/serverdialog.cpp
index fa4087ce..d86d751a 100644
--- a/src/gui/serverdialog.cpp
+++ b/src/gui/serverdialog.cpp
@@ -351,20 +351,20 @@ void ServerDialog::logic()
auto state = mDownload->getState();
switch (state.status) {
- case DownloadStatus::IN_PROGRESS:
+ case DownloadStatus::InProgress:
mDownloadText->setCaption(strprintf(_("Downloading server list..."
"%2.0f%%"),
state.progress * 100));
break;
- case DownloadStatus::CANCELED:
- case DownloadStatus::ERROR:
+ case DownloadStatus::Canceled:
+ case DownloadStatus::Error:
mDownloadDone = true;
logger->log("Error retrieving server list: %s", mDownload->getError());
mDownloadText->setCaption(_("Error retrieving server list!"));
break;
- case DownloadStatus::COMPLETE:
+ case DownloadStatus::Complete:
mDownloadDone = true;
loadServers();
@@ -433,7 +433,7 @@ void ServerDialog::loadServer(XML::Node serverNode)
server.type = ServerInfo::parseType(type);
// Ignore unknown server types
- if (server.type == ServerType::UNKNOWN
+ if (server.type == ServerType::Unknown
#ifndef MANASERV_SUPPORT
|| server.type == ServerType::MANASERV
#endif
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 7f45ae9d..c1911ac5 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -292,7 +292,7 @@ void SkillDialog::loadSkills()
{
logger->log("Error loading skills file: %s", SKILLS_FILE);
- if (Net::getNetworkType() == ServerType::TMWATHENA)
+ if (Net::getNetworkType() == ServerType::TmwAthena)
{
auto model = std::make_unique<SkillModel>();
auto skill = std::make_unique<SkillInfo>();
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index ffcfa350..108d68cc 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -290,7 +290,7 @@ void StatusWindow::event(Event::Channel channel,
it->second->update();
}
- if (Net::getNetworkType() == ServerType::TMWATHENA &&
+ if (Net::getNetworkType() == ServerType::TmwAthena &&
id == TmwAthena::MATK)
{
updateMPBar(mMpBar, true);
diff --git a/src/gui/updaterwindow.cpp b/src/gui/updaterwindow.cpp
index d05a9299..5cfb45cd 100644
--- a/src/gui/updaterwindow.cpp
+++ b/src/gui/updaterwindow.cpp
@@ -210,7 +210,7 @@ void UpdaterWindow::keyPressed(gcn::KeyEvent &keyEvent)
bool UpdaterWindow::cancel()
{
// Skip the updating process
- if (mDialogState != DialogState::DONE)
+ if (mDialogState != DialogState::Done)
{
mDownload->cancel();
return true;
@@ -244,7 +244,7 @@ void UpdaterWindow::startDownload(const std::string &fileName,
else
mDownload->setFile(mUpdatesDir + "/" + fileName, adler32);
- if (mDialogState != DialogState::DOWNLOAD_RESOURCES)
+ if (mDialogState != DialogState::DownloadResources)
mDownload->noCache();
mDownload->start();
@@ -273,28 +273,28 @@ void UpdaterWindow::logic()
{
Window::logic();
- if (mDialogState == DialogState::DONE)
+ if (mDialogState == DialogState::Done)
return;
const auto state = mDownload->getState();
float progress = 0.0f;
switch (state.status) {
- case DownloadStatus::IN_PROGRESS: {
+ case DownloadStatus::InProgress: {
setLabel(mCurrentFile + " (" + toString((int) (state.progress * 100)) + "%)");
progress = state.progress;
break;
}
- case DownloadStatus::CANCELED:
- mDialogState = DialogState::DONE;
+ case DownloadStatus::Canceled:
+ mDialogState = DialogState::Done;
enablePlay();
setLabel(_("Download canceled"));
break;
- case DownloadStatus::ERROR: {
- mDialogState = DialogState::DONE;
+ case DownloadStatus::Error: {
+ mDialogState = DialogState::Done;
std::string error = "##1";
error += mDownload->getError();
@@ -311,7 +311,7 @@ void UpdaterWindow::logic()
break;
}
- case DownloadStatus::COMPLETE:
+ case DownloadStatus::Complete:
downloadCompleted();
break;
}
@@ -323,14 +323,14 @@ void UpdaterWindow::downloadCompleted()
{
switch (mDialogState)
{
- case DialogState::DOWNLOAD_NEWS:
+ case DialogState::DownloadNews:
loadNews();
- mDialogState = DialogState::DOWNLOAD_LIST;
+ mDialogState = DialogState::DownloadList;
startDownload(xmlUpdateFile, false);
break;
- case DialogState::DOWNLOAD_LIST:
+ case DialogState::DownloadList:
if (mCurrentFile == xmlUpdateFile)
{
mUpdateFiles = loadXMLFile(mUpdatesDir + "/" + xmlUpdateFile);
@@ -341,7 +341,7 @@ void UpdaterWindow::downloadCompleted()
xmlUpdateFile, txtUpdateFile);
// If the resources.xml file fails, fall back onto a older version
- mDialogState = DialogState::DOWNLOAD_LIST;
+ mDialogState = DialogState::DownloadList;
startDownload(txtUpdateFile, false);
break;
}
@@ -351,10 +351,10 @@ void UpdaterWindow::downloadCompleted()
mUpdateFiles = loadTxtFile(mUpdatesDir + "/" + txtUpdateFile);
}
- mDialogState = DialogState::DOWNLOAD_RESOURCES;
+ mDialogState = DialogState::DownloadResources;
break;
- case DialogState::DOWNLOAD_RESOURCES:
+ case DialogState::DownloadResources:
if (mUpdateIndex < mUpdateFiles.size())
{
const UpdateFile &thisFile = mUpdateFiles[mUpdateIndex];
@@ -390,13 +390,13 @@ void UpdaterWindow::downloadCompleted()
else
{
// Download of updates completed
- mDialogState = DialogState::DONE;
+ mDialogState = DialogState::Done;
enablePlay();
setLabel(_("Completed"));
}
break;
- case DialogState::DONE:
+ case DialogState::Done:
break;
}
}
diff --git a/src/gui/updaterwindow.h b/src/gui/updaterwindow.h
index 249da067..dd1400ba 100644
--- a/src/gui/updaterwindow.h
+++ b/src/gui/updaterwindow.h
@@ -102,14 +102,14 @@ private:
enum class DialogState
{
- DOWNLOAD_NEWS,
- DOWNLOAD_LIST,
- DOWNLOAD_RESOURCES,
- DONE,
+ DownloadNews,
+ DownloadList,
+ DownloadResources,
+ Done,
};
/** Status of the current download. */
- DialogState mDialogState = DialogState::DOWNLOAD_NEWS;
+ DialogState mDialogState = DialogState::DownloadNews;
/** Host where we get the updated files. */
std::string mUpdateHost;
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 8f4ee686..9e529063 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -305,10 +305,10 @@ void Viewport::_drawDebugPath(Graphics *graphics)
unsigned char walkMask;
switch (Net::getNetworkType())
{
- case ServerType::TMWATHENA:
+ case ServerType::TmwAthena:
walkMask = Map::BLOCKMASK_WALL | Map::BLOCKMASK_CHARACTER;
break;
- case ServerType::MANASERV:
+ case ServerType::ManaServ:
default:
walkMask = Map::BLOCKMASK_WALL;
break;
@@ -575,18 +575,18 @@ void Viewport::updateCursorType()
gui->setCursorType(mHoverBeing->getHoverCursor());
break;
default:
- gui->setCursorType(Cursor::POINTER);
+ gui->setCursorType(Cursor::Pointer);
break;
}
// Item mouseover
}
else if (mHoverItem)
{
- gui->setCursorType(Cursor::PICKUP);
+ gui->setCursorType(Cursor::PickUp);
}
else
{
- gui->setCursorType(Cursor::POINTER);
+ gui->setCursorType(Cursor::Pointer);
}
}
diff --git a/src/gui/widgets/browserbox.cpp b/src/gui/widgets/browserbox.cpp
index ef40d8c4..91366720 100644
--- a/src/gui/widgets/browserbox.cpp
+++ b/src/gui/widgets/browserbox.cpp
@@ -223,14 +223,14 @@ void BrowserBox::mousePressed(gcn::MouseEvent &event)
if (mHoveredLink) {
mLinkHandler->handleLink(mHoveredLink->link);
- gui->setCursorType(Cursor::POINTER);
+ gui->setCursorType(Cursor::Pointer);
}
}
void BrowserBox::mouseMoved(gcn::MouseEvent &event)
{
updateHoveredLink(event.getX(), event.getY());
- gui->setCursorType(mHoveredLink ? Cursor::HAND : Cursor::POINTER);
+ gui->setCursorType(mHoveredLink ? Cursor::Hand : Cursor::Pointer);
event.consume(); // Suppress mouse cursor change by parent
}
diff --git a/src/gui/widgets/window.cpp b/src/gui/widgets/window.cpp
index 7d6f61f3..61ed7896 100644
--- a/src/gui/widgets/window.cpp
+++ b/src/gui/widgets/window.cpp
@@ -67,7 +67,7 @@ Window::Window(const std::string &caption, bool modal, Window *parent)
if (mModal)
{
- gui->setCursorType(Cursor::POINTER);
+ gui->setCursorType(Cursor::Pointer);
requestModalFocus();
}
@@ -294,7 +294,7 @@ void Window::widgetResized(const gcn::Event &event)
void Window::widgetHidden(const gcn::Event &event)
{
if (gui)
- gui->setCursorType(Cursor::POINTER);
+ gui->setCursorType(Cursor::Pointer);
WidgetListIterator it;
@@ -385,7 +385,7 @@ void Window::mouseReleased(gcn::MouseEvent &event)
void Window::mouseExited(gcn::MouseEvent &event)
{
if (mGrip && !mouseResize)
- gui->setCursorType(Cursor::POINTER);
+ gui->setCursorType(Cursor::Pointer);
mCloseButtonHovered = false;
}
@@ -404,7 +404,7 @@ void Window::mouseMoved(gcn::MouseEvent &event)
return;
mCloseButtonHovered = getCloseButtonRect().isPointInRect(event.getX(), event.getY());
- Cursor cursor = Cursor::POINTER;
+ Cursor cursor = Cursor::Pointer;
// Changes the custom mouse cursor based on its current position.
if (!mCloseButtonHovered)
@@ -413,19 +413,19 @@ void Window::mouseMoved(gcn::MouseEvent &event)
{
case BOTTOM | RIGHT:
case TOP | LEFT:
- cursor = Cursor::RESIZE_DOWN_RIGHT;
+ cursor = Cursor::ResizeDownRight;
break;
case BOTTOM | LEFT:
case TOP | RIGHT:
- cursor = Cursor::RESIZE_DOWN_LEFT;
+ cursor = Cursor::ResizeDownLeft;
break;
case BOTTOM:
case TOP:
- cursor = Cursor::RESIZE_DOWN;
+ cursor = Cursor::ResizeDown;
break;
case RIGHT:
case LEFT:
- cursor = Cursor::RESIZE_ACROSS;
+ cursor = Cursor::ResizeAcross;
break;
default:
break;
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 5810ca21..043e9d25 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -904,7 +904,7 @@ void LocalPlayer::setAttackRange(int range)
{
mAttackRange = range;
}
- else if (Net::getNetworkType() == ServerType::TMWATHENA)
+ else if (Net::getNetworkType() == ServerType::TmwAthena)
{
// TODO: Fix this to be more generic
Item *weapon = PlayerInfo::getEquipment(TmwAthena::EQUIP_FIGHT1_SLOT);
diff --git a/src/main.cpp b/src/main.cpp
index 2eb970ba..3531356f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -169,7 +169,7 @@ static void parseOptions(int argc, char *argv[], Client::Options &options)
break;
case 'y':
options.serverType = ServerInfo::parseType(optarg);
- if (options.serverType == ServerType::UNKNOWN)
+ if (options.serverType == ServerType::Unknown)
{
std::cerr << _("Invalid server type, expected one of: tmwathena, manaserv") << std::endl;
options.exitWithError = true;
diff --git a/src/map.cpp b/src/map.cpp
index 835d400d..908d6178 100644
--- a/src/map.cpp
+++ b/src/map.cpp
@@ -843,7 +843,7 @@ Path Map::findPath(int startX, int startY, int destX, int destY,
// It costs extra to walk through a being (needs to be enough
// to make it more attractive to walk around).
// N.B.: Specific to TmwAthena for now.
- if (Net::getNetworkType() == ServerType::TMWATHENA &&
+ if (Net::getNetworkType() == ServerType::TmwAthena &&
occupied(x, y))
{
Gcost += 3 * basicCost;
diff --git a/src/net/download.cpp b/src/net/download.cpp
index 92656ac8..7aab3b2f 100644
--- a/src/net/download.cpp
+++ b/src/net/download.cpp
@@ -116,7 +116,7 @@ bool Download::start()
{
logger->log("%s", DOWNLOAD_ERROR_MESSAGE_THREAD);
strncpy(mError, DOWNLOAD_ERROR_MESSAGE_THREAD, CURL_ERROR_SIZE - 1);
- mState.lock()->status = DownloadStatus::ERROR;
+ mState.lock()->status = DownloadStatus::Error;
return false;
}
@@ -145,7 +145,7 @@ int Download::downloadProgress(void *clientp,
auto *d = reinterpret_cast<Download*>(clientp);
auto state = d->mState.lock();
- state->status = DownloadStatus::IN_PROGRESS;
+ state->status = DownloadStatus::InProgress;
state->progress = 0.0f;
if (dltotal > 0)
state->progress = static_cast<float>(dlnow) / dltotal;
@@ -300,11 +300,11 @@ int Download::downloadThread(void *ptr)
auto state = d->mState.lock();
if (d->mCancel)
- state->status = DownloadStatus::CANCELED;
+ state->status = DownloadStatus::Canceled;
else if (complete)
- state->status = DownloadStatus::COMPLETE;
+ state->status = DownloadStatus::Complete;
else
- state->status = DownloadStatus::ERROR;
+ state->status = DownloadStatus::Error;
return 0;
}
diff --git a/src/net/download.h b/src/net/download.h
index 20a7fc74..e9483fa5 100644
--- a/src/net/download.h
+++ b/src/net/download.h
@@ -30,10 +30,10 @@
enum class DownloadStatus
{
- IN_PROGRESS,
- CANCELED,
- ERROR,
- COMPLETE
+ InProgress,
+ Canceled,
+ Error,
+ Complete
};
struct SDL_Thread;
@@ -45,7 +45,7 @@ class Download
public:
struct State
{
- DownloadStatus status = DownloadStatus::IN_PROGRESS;
+ DownloadStatus status = DownloadStatus::InProgress;
float progress = 0.0f;
};
diff --git a/src/net/logindata.h b/src/net/logindata.h
index 3f2015f4..4af402ec 100644
--- a/src/net/logindata.h
+++ b/src/net/logindata.h
@@ -39,7 +39,7 @@ public:
std::string email;
std::string captchaResponse;
- Gender gender = Gender::UNSPECIFIED;
+ Gender gender = Gender::Unspecified;
bool remember; /**< Whether to store the username. */
bool registerLogin; /**< Whether an account is being registered. */
@@ -63,7 +63,7 @@ public:
updateHost.clear();
email.clear();
captchaResponse.clear();
- gender = Gender::UNSPECIFIED;
+ gender = Gender::Unspecified;
resetCharacterSlots();
}
};
diff --git a/src/net/manaserv/beinghandler.cpp b/src/net/manaserv/beinghandler.cpp
index d1eb67aa..9bb52ac1 100644
--- a/src/net/manaserv/beinghandler.cpp
+++ b/src/net/manaserv/beinghandler.cpp
@@ -153,13 +153,13 @@ void BeingHandler::handleBeingEnterMessage(MessageIn &msg)
int py = msg.readInt16();
auto direction = (BeingDirection)msg.readInt8();
- Gender gender = Gender::UNSPECIFIED;
+ Gender gender = Gender::Unspecified;
switch (getGender(msg.readInt8())) {
case GENDER_MALE:
- gender = Gender::MALE;
+ gender = Gender::Male;
break;
case GENDER_FEMALE:
- gender = Gender::FEMALE;
+ gender = Gender::Female;
break;
case GENDER_UNSPECIFIED:
break;
diff --git a/src/net/manaserv/charhandler.cpp b/src/net/manaserv/charhandler.cpp
index 8afbb90b..98591669 100644
--- a/src/net/manaserv/charhandler.cpp
+++ b/src/net/manaserv/charhandler.cpp
@@ -108,13 +108,13 @@ void CharHandler::handleCharacterInfo(MessageIn &msg)
info.name = msg.readString();
switch (getGender(msg.readInt8())) {
case GENDER_MALE:
- info.gender = Gender::MALE;
+ info.gender = Gender::Male;
break;
case GENDER_FEMALE:
- info.gender = Gender::FEMALE;
+ info.gender = Gender::Female;
break;
case GENDER_UNSPECIFIED:
- info.gender = Gender::UNSPECIFIED;
+ info.gender = Gender::Unspecified;
break;
}
info.hairStyle = msg.readInt8();
diff --git a/src/net/net.cpp b/src/net/net.cpp
index a2771244..1d157b3d 100644
--- a/src/net/net.cpp
+++ b/src/net/net.cpp
@@ -125,18 +125,18 @@ Net::TradeHandler *Net::getTradeHandler()
namespace Net
{
-static ServerType networkType = ServerType::UNKNOWN;
+static ServerType networkType = ServerType::Unknown;
void connectToServer(ServerInfo &server)
{
- if (server.type == ServerType::UNKNOWN)
+ if (server.type == ServerType::Unknown)
{
// TODO: Query the server about itself and choose the netcode based on
// that
if (server.port == 6901)
- server.type = ServerType::TMWATHENA;
+ server.type = ServerType::TmwAthena;
else if (server.port == 9601)
- server.type = ServerType::MANASERV;
+ server.type = ServerType::ManaServ;
else
logger->error(_("Unknown Server Type! Exiting."));
}
@@ -152,11 +152,11 @@ void connectToServer(ServerInfo &server)
switch (server.type)
{
#ifdef MANASERV_SUPPORT
- case ServerType::MANASERV:
+ case ServerType::ManaServ:
generalHandler = new ManaServ::GeneralHandler;
break;
#endif
- case ServerType::TMWATHENA:
+ case ServerType::TmwAthena:
generalHandler = new TmwAthena::GeneralHandler;
break;
default:
diff --git a/src/net/serverinfo.h b/src/net/serverinfo.h
index a9dc785c..ad862427 100644
--- a/src/net/serverinfo.h
+++ b/src/net/serverinfo.h
@@ -27,9 +27,9 @@
enum class ServerType
{
- UNKNOWN,
- MANASERV,
- TMWATHENA
+ Unknown,
+ ManaServ,
+ TmwAthena
};
class ServerInfo
@@ -37,7 +37,7 @@ class ServerInfo
public:
using VersionString = std::pair<int, std::string>;
- ServerType type = ServerType::UNKNOWN;
+ ServerType type = ServerType::Unknown;
std::string name;
std::string hostname;
uint16_t port = 0;
@@ -50,7 +50,7 @@ public:
bool isValid() const
{
- return !hostname.empty() && port != 0 && type != ServerType::UNKNOWN;
+ return !hostname.empty() && port != 0 && type != ServerType::Unknown;
}
void clear()
@@ -73,13 +73,13 @@ public:
static ServerType parseType(const std::string &type)
{
if (type == "tmwathena")
- return ServerType::TMWATHENA;
+ return ServerType::TmwAthena;
// Used for backward compatibility
if (type == "eathena")
- return ServerType::TMWATHENA;
+ return ServerType::TmwAthena;
if (type == "manaserv")
- return ServerType::MANASERV;
- return ServerType::UNKNOWN;
+ return ServerType::ManaServ;
+ return ServerType::Unknown;
}
static uint16_t defaultPortForServerType(ServerType type)
@@ -87,11 +87,11 @@ public:
switch (type)
{
default:
- case ServerType::UNKNOWN:
+ case ServerType::Unknown:
return 0;
- case ServerType::TMWATHENA:
+ case ServerType::TmwAthena:
return 6901;
- case ServerType::MANASERV:
+ case ServerType::ManaServ:
return 9601;
}
}
@@ -99,10 +99,10 @@ public:
static ServerType defaultServerTypeForPort(uint16_t port)
{
if (port == 6901)
- return ServerType::TMWATHENA;
+ return ServerType::TmwAthena;
if (port == 9601)
- return ServerType::MANASERV;
- return ServerType::UNKNOWN;
+ return ServerType::ManaServ;
+ return ServerType::Unknown;
}
};
diff --git a/src/net/tmwa/beinghandler.cpp b/src/net/tmwa/beinghandler.cpp
index 78685dfd..c5979e9f 100644
--- a/src/net/tmwa/beinghandler.cpp
+++ b/src/net/tmwa/beinghandler.cpp
@@ -303,8 +303,8 @@ void BeingHandler::handleMessage(MessageIn &msg)
if (dstBeing->getType() == ActorSprite::PLAYER)
{
- dstBeing->setGender(gender == 0 ? Gender::FEMALE
- : Gender::MALE);
+ dstBeing->setGender(gender == 0 ? Gender::Female
+ : Gender::Male);
// Set these after the gender, as the sprites may be gender-specific
dstBeing->setSprite(SPRITE_HAIR, hairStyle * -1,
hairDB.getHairColor(hairColor));
@@ -614,8 +614,8 @@ void BeingHandler::handleMessage(MessageIn &msg)
msg.readInt16(); // manner
opt3 = msg.readInt16();
msg.readInt8(); // karma
- dstBeing->setGender(msg.readInt8() == 0 ? Gender::FEMALE
- : Gender::MALE);
+ dstBeing->setGender(msg.readInt8() == 0 ? Gender::Female
+ : Gender::Male);
// Set these after the gender, as the sprites may be gender-specific
dstBeing->setSprite(SPRITE_WEAPON, weapon, "", true);
dstBeing->setSprite(SPRITE_SHIELD, shield);
diff --git a/src/net/tmwa/charserverhandler.cpp b/src/net/tmwa/charserverhandler.cpp
index 39155201..0ecbb135 100644
--- a/src/net/tmwa/charserverhandler.cpp
+++ b/src/net/tmwa/charserverhandler.cpp
@@ -268,7 +268,7 @@ void CharServerHandler::readPlayerData(MessageIn &msg, Net::Character *character
character->slot = msg.readInt8(); // character slot
const uint8_t sex = msg.readInt8();
- tempPlayer->setGender(sex ? Gender::MALE : Gender::FEMALE);
+ tempPlayer->setGender(sex ? Gender::Male : Gender::Female);
}
void CharServerHandler::setCharSelectDialog(CharSelectDialog *window)
@@ -400,7 +400,7 @@ void CharServerHandler::connect()
// [Fate] The next word is unused by the old char server, so we squeeze in
// mana client version information
outMsg.writeInt16(CLIENT_PROTOCOL_VERSION);
- outMsg.writeInt8(token.sex == Gender::MALE ? 1 : 0);
+ outMsg.writeInt8(token.sex == Gender::Male ? 1 : 0);
// We get 4 useless bytes before the real answer comes in (what are these?)
mNetwork->skip(4);
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index abc9c73c..0a3bb9d9 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -140,7 +140,7 @@ void GameHandler::connect()
outMsg.writeInt32(mCharID);
outMsg.writeInt32(token.session_ID1);
outMsg.writeInt32(token.session_ID2);
- outMsg.writeInt8(token.sex == Gender::MALE ? 1 : 0);
+ outMsg.writeInt8(token.sex == Gender::Male ? 1 : 0);
// We get 4 useless bytes before the real answer comes in (what are these?)
mNetwork->skip(4);
diff --git a/src/net/tmwa/loginhandler.cpp b/src/net/tmwa/loginhandler.cpp
index 069f9336..a7162ee6 100644
--- a/src/net/tmwa/loginhandler.cpp
+++ b/src/net/tmwa/loginhandler.cpp
@@ -124,7 +124,7 @@ void LoginHandler::handleMessage(MessageIn &msg)
mToken.account_ID = msg.readInt32();
mToken.session_ID2 = msg.readInt32();
msg.skip(30); // unused
- mToken.sex = msg.readInt8() ? Gender::MALE : Gender::FEMALE;
+ mToken.sex = msg.readInt8() ? Gender::Male : Gender::Female;
for (int i = 0; i < worldCount; i++)
{
@@ -304,7 +304,7 @@ void LoginHandler::chooseServer(unsigned int server)
void LoginHandler::registerAccount(LoginData *loginData)
{
std::string username = loginData->username;
- username.append(loginData->gender == Gender::FEMALE ? "_F" : "_M");
+ username.append(loginData->gender == Gender::Female ? "_F" : "_M");
sendLoginRegister(username, loginData->password);
}
diff --git a/src/net/tmwa/token.h b/src/net/tmwa/token.h
index 8c078c6c..b563bf65 100644
--- a/src/net/tmwa/token.h
+++ b/src/net/tmwa/token.h
@@ -35,6 +35,6 @@ struct Token
account_ID = 0;
session_ID1 = 0;
session_ID2 = 0;
- sex = Gender::UNSPECIFIED;
+ sex = Gender::Unspecified;
}
};
diff --git a/src/party.cpp b/src/party.cpp
index 92b6c22f..8db773fd 100644
--- a/src/party.cpp
+++ b/src/party.cpp
@@ -45,7 +45,7 @@ Party::~Party()
PartyMember *Party::addMember(int id, const std::string &name)
{
PartyMember *m;
- if (Net::getNetworkType() == ServerType::TMWATHENA && (m = getMember(id)))
+ if (Net::getNetworkType() == ServerType::TmwAthena && (m = getMember(id)))
{
return m;
}
diff --git a/src/playerrelations.cpp b/src/playerrelations.cpp
index bec1d081..8da6c06b 100644
--- a/src/playerrelations.cpp
+++ b/src/playerrelations.cpp
@@ -80,11 +80,11 @@ unsigned int PlayerRelationsManager::checkPermissionSilently(
switch (getRelation(playerName))
{
- case PlayerRelation::NEUTRAL:
+ case PlayerRelation::Neutral:
break;
// widen permissions for friends
- case PlayerRelation::FRIEND:
+ case PlayerRelation::Friend:
permissions |=
PlayerPermissions::EMOTE |
PlayerPermissions::SPEECH_FLOAT |
@@ -94,12 +94,12 @@ unsigned int PlayerRelationsManager::checkPermissionSilently(
break;
// narrow permissions for disregarded and ignored players
- case PlayerRelation::DISREGARDED:
+ case PlayerRelation::Disregarded:
permissions &=
PlayerPermissions::EMOTE |
PlayerPermissions::SPEECH_FLOAT;
break;
- case PlayerRelation::IGNORED:
+ case PlayerRelation::Ignored:
permissions &= 0;
break;
}
@@ -163,7 +163,7 @@ void PlayerRelationsManager::removePlayer(const std::string &name)
PlayerRelation PlayerRelationsManager::getRelation(const std::string &name) const
{
auto it = mRelations.find(name);
- return it != mRelations.end() ? it->second : PlayerRelation::NEUTRAL;
+ return it != mRelations.end() ? it->second : PlayerRelation::Neutral;
}
////////////////////////////////////////
diff --git a/src/playerrelations.h b/src/playerrelations.h
index e2ce51d5..0d2ee8d8 100644
--- a/src/playerrelations.h
+++ b/src/playerrelations.h
@@ -30,10 +30,10 @@ class Being;
enum class PlayerRelation
{
- NEUTRAL = 0,
- FRIEND = 1,
- DISREGARDED = 2,
- IGNORED = 3
+ Neutral = 0,
+ Friend = 1,
+ Disregarded = 2,
+ Ignored = 3
};
constexpr unsigned int RELATIONS_NR = 4;
diff --git a/src/resources/beinginfo.cpp b/src/resources/beinginfo.cpp
index 17e270dc..20c24d4f 100644
--- a/src/resources/beinginfo.cpp
+++ b/src/resources/beinginfo.cpp
@@ -52,15 +52,15 @@ static std::optional<ActorSprite::TargetCursorSize> targetCursorSizeFromString(c
static std::optional<Cursor> cursorFromString(const std::string &cursor)
{
- if (cursor == "pointer") return Cursor::POINTER;
- if (cursor == "attack") return Cursor::FIGHT;
- if (cursor == "pickup") return Cursor::PICKUP;
- if (cursor == "talk") return Cursor::TALK;
- if (cursor == "action") return Cursor::ACTION;
- if (cursor == "left") return Cursor::LEFT;
- if (cursor == "up") return Cursor::UP;
- if (cursor == "right") return Cursor::RIGHT;
- if (cursor == "down") return Cursor::DOWN;
+ if (cursor == "pointer") return Cursor::Pointer;
+ if (cursor == "attack") return Cursor::Fight;
+ if (cursor == "pickup") return Cursor::PickUp;
+ if (cursor == "talk") return Cursor::Talk;
+ if (cursor == "action") return Cursor::Action;
+ if (cursor == "left") return Cursor::Left;
+ if (cursor == "up") return Cursor::Up;
+ if (cursor == "right") return Cursor::Right;
+ if (cursor == "down") return Cursor::Down;
return {};
}
@@ -87,7 +87,7 @@ void BeingInfo::setHoverCursor(const std::string &cursorName)
logger->log("Unknown hoverCursor value \"%s\" for %s",
cursorName.c_str(), name.c_str());
}
- hoverCursor = cursor.value_or(Cursor::POINTER);
+ hoverCursor = cursor.value_or(Cursor::Pointer);
}
void BeingInfo::addSound(SoundEvent event, const std::string &filename)
diff --git a/src/resources/beinginfo.h b/src/resources/beinginfo.h
index fbeec491..91343d4f 100644
--- a/src/resources/beinginfo.h
+++ b/src/resources/beinginfo.h
@@ -42,10 +42,10 @@ struct Attack
enum class SoundEvent
{
- HIT,
- MISS,
- HURT,
- DIE
+ Hit,
+ Miss,
+ Hurt,
+ Die
};
/**
@@ -66,7 +66,7 @@ public:
std::string name;
SpriteDisplay display;
ActorSprite::TargetCursorSize targetCursorSize = ActorSprite::TC_MEDIUM;
- Cursor hoverCursor = Cursor::POINTER;
+ Cursor hoverCursor = Cursor::Pointer;
unsigned char walkMask = Map::BLOCKMASK_ALL;
Map::BlockType blockType = Map::BLOCKTYPE_CHARACTER;
bool targetSelection = true;
diff --git a/src/resources/itemdb.cpp b/src/resources/itemdb.cpp
index a6e65c71..05f6ad0b 100644
--- a/src/resources/itemdb.cpp
+++ b/src/resources/itemdb.cpp
@@ -123,9 +123,9 @@ void ItemDB::loadEmptyItemDefinition()
mUnknown->name = _("Unknown item");
mUnknown->display = SpriteDisplay();
std::string errFile = paths.getStringValue("spriteErrorFile");
- mUnknown->setSprite(errFile, Gender::MALE, 0);
- mUnknown->setSprite(errFile, Gender::FEMALE, 0);
- mUnknown->setSprite(errFile, Gender::HIDDEN, 0);
+ mUnknown->setSprite(errFile, Gender::Male, 0);
+ mUnknown->setSprite(errFile, Gender::Female, 0);
+ mUnknown->setSprite(errFile, Gender::Hidden, 0);
mUnknown->hitEffectId = paths.getIntValue("hitEffectId");
mUnknown->criticalHitEffectId = paths.getIntValue("criticalHitEffectId");
}
@@ -180,11 +180,11 @@ void ItemDB::loadSpriteRef(ItemInfo &itemInfo, XML::Node node)
const int race = node.getProperty("race", 0);
if (gender == "male" || gender == "unisex")
- itemInfo.setSprite(filename, Gender::MALE, race);
+ itemInfo.setSprite(filename, Gender::Male, race);
if (gender == "female" || gender == "unisex")
- itemInfo.setSprite(filename, Gender::FEMALE, race);
+ itemInfo.setSprite(filename, Gender::Female, race);
if (gender == "hidden" || gender == "other" || gender == "unisex")
- itemInfo.setSprite(filename, Gender::HIDDEN, race);
+ itemInfo.setSprite(filename, Gender::Hidden, race);
}
void ItemDB::loadSoundRef(ItemInfo &itemInfo, XML::Node node)
@@ -194,11 +194,11 @@ void ItemDB::loadSoundRef(ItemInfo &itemInfo, XML::Node node)
if (event == "hit")
{
- itemInfo.addSound(EquipmentSoundEvent::HIT, filename);
+ itemInfo.addSound(EquipmentSoundEvent::Hit, filename);
}
else if (event == "strike" || event == "miss")
{
- itemInfo.addSound(EquipmentSoundEvent::STRIKE, filename);
+ itemInfo.addSound(EquipmentSoundEvent::Strike, filename);
}
else
{
diff --git a/src/resources/iteminfo.h b/src/resources/iteminfo.h
index 4f9ab10a..62e4796d 100644
--- a/src/resources/iteminfo.h
+++ b/src/resources/iteminfo.h
@@ -31,8 +31,8 @@
enum class EquipmentSoundEvent
{
- STRIKE,
- HIT
+ Strike,
+ Hit
};
/**
diff --git a/src/resources/monsterdb.cpp b/src/resources/monsterdb.cpp
index 215ca2f8..4963f93f 100644
--- a/src/resources/monsterdb.cpp
+++ b/src/resources/monsterdb.cpp
@@ -54,7 +54,7 @@ void MonsterDB::init()
unload();
// This can be overridden by an 'offset' attribute on a 'monsters' root tag.
- mMonsterIdOffset = Net::getNetworkType() == ServerType::TMWATHENA ? OLD_TMWATHENA_OFFSET : 0;
+ mMonsterIdOffset = Net::getNetworkType() == ServerType::TmwAthena ? OLD_TMWATHENA_OFFSET : 0;
}
void MonsterDB::setMonsterIdOffset(int offset)
@@ -95,19 +95,19 @@ void MonsterDB::readMonsterNode(XML::Node node, const std::string &filename)
if (event == "hit")
{
- currentInfo->addSound(SoundEvent::HIT, soundFile);
+ currentInfo->addSound(SoundEvent::Hit, soundFile);
}
else if (event == "miss")
{
- currentInfo->addSound(SoundEvent::MISS, soundFile);
+ currentInfo->addSound(SoundEvent::Miss, soundFile);
}
else if (event == "hurt")
{
- currentInfo->addSound(SoundEvent::HURT, soundFile);
+ currentInfo->addSound(SoundEvent::Hurt, soundFile);
}
else if (event == "die")
{
- currentInfo->addSound(SoundEvent::DIE, soundFile);
+ currentInfo->addSound(SoundEvent::Die, soundFile);
}
else
{
diff --git a/src/resources/settingsmanager.cpp b/src/resources/settingsmanager.cpp
index 78bf617b..9323d4d1 100644
--- a/src/resources/settingsmanager.cpp
+++ b/src/resources/settingsmanager.cpp
@@ -83,7 +83,7 @@ namespace SettingsManager
StatusEffectDB::checkStatus();
Units::checkStatus();
- if (Net::getNetworkType() == ServerType::MANASERV)
+ if (Net::getNetworkType() == ServerType::ManaServ)
{
Attributes::informItemDB();
}