From 934e592bdb8467b42daccb75bc3abb8acc4b3b47 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Thu, 5 Jul 2018 20:27:42 +0300 Subject: [PATCH] [Server] Make spacing in CharClass consistent with other categories --- apps/openmw-mp/Script/Functions/CharClass.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/apps/openmw-mp/Script/Functions/CharClass.cpp b/apps/openmw-mp/Script/Functions/CharClass.cpp index 19e87a58b..e361c2d92 100644 --- a/apps/openmw-mp/Script/Functions/CharClass.cpp +++ b/apps/openmw-mp/Script/Functions/CharClass.cpp @@ -16,6 +16,7 @@ const char *CharClassFunctions::GetDefaultClass(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ""); + return player->charClass.mId.c_str(); } @@ -23,6 +24,7 @@ const char *CharClassFunctions::GetClassName(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ""); + return player->charClass.mName.c_str(); } @@ -30,6 +32,7 @@ const char *CharClassFunctions::GetClassDesc(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, ""); + return player->charClass.mDescription.c_str(); } @@ -37,8 +40,10 @@ int CharClassFunctions::GetClassMajorAttribute(unsigned short pid, unsigned char { Player *player; GET_PLAYER(pid, player, 0); + if (slot > 1) throw invalid_argument("Incorrect attribute slot id"); + return player->charClass.mData.mAttribute[slot]; } @@ -46,6 +51,7 @@ int CharClassFunctions::GetClassSpecialization(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, 0); + return player->charClass.mData.mSpecialization; } @@ -53,8 +59,10 @@ int CharClassFunctions::GetClassMajorSkill(unsigned short pid, unsigned char slo { Player *player; GET_PLAYER(pid, player, 0); + if (slot > 4) throw invalid_argument("Incorrect skill slot id"); + return player->charClass.mData.mSkills[slot][1]; } @@ -62,8 +70,10 @@ int CharClassFunctions::GetClassMinorSkill(unsigned short pid, unsigned char slo { Player *player; GET_PLAYER(pid, player, 0); + if (slot > 4) throw invalid_argument("Incorrect skill slot id"); + return player->charClass.mData.mSkills[slot][0]; } @@ -71,6 +81,7 @@ int CharClassFunctions::IsClassDefault(unsigned short pid) noexcept { Player *player; GET_PLAYER(pid, player, 0); + return !player->charClass.mId.empty(); // true if default } @@ -78,12 +89,14 @@ void CharClassFunctions::SetDefaultClass(unsigned short pid, const char *id) noe { Player *player; GET_PLAYER(pid, player,); + player->charClass.mId = id; } void CharClassFunctions::SetClassName(unsigned short pid, const char *name) noexcept { Player *player; GET_PLAYER(pid, player,); + player->charClass.mName = name; player->charClass.mId = ""; } @@ -91,6 +104,7 @@ void CharClassFunctions::SetClassDesc(unsigned short pid, const char *desc) noex { Player *player; GET_PLAYER(pid, player,); + player->charClass.mDescription = desc; } void CharClassFunctions::SetClassMajorAttribute(unsigned short pid, unsigned char slot, int attrId) noexcept @@ -108,22 +122,27 @@ void CharClassFunctions::SetClassSpecialization(unsigned short pid, int spec) no { Player *player; GET_PLAYER(pid, player,); + player->charClass.mData.mSpecialization = spec; } void CharClassFunctions::SetClassMajorSkill(unsigned short pid, unsigned char slot, int skillId) noexcept { Player *player; GET_PLAYER(pid, player,); + if (slot > 4) throw invalid_argument("Incorrect skill slot id"); + player->charClass.mData.mSkills[slot][1] = skillId; } void CharClassFunctions::SetClassMinorSkill(unsigned short pid, unsigned char slot, int skillId) noexcept { Player *player; GET_PLAYER(pid, player,); + if (slot > 4) throw invalid_argument("Incorrect skill slot id"); + player->charClass.mData.mSkills[slot][0] = skillId; }