From 1e8e8f5fd2730e94ab08df0fbdcd9a289c0d98a9 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Wed, 13 Jan 2010 02:09:26 +0300 Subject: [PATCH] [9164] Use enum for CONFIG_SKIP_CINEMATICS values. Just small code cleanup ;) --- src/game/CharacterHandler.cpp | 18 +++++++++++++----- src/shared/revision_nr.h | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/src/game/CharacterHandler.cpp b/src/game/CharacterHandler.cpp index 634652dd3..f0fecc130 100644 --- a/src/game/CharacterHandler.cpp +++ b/src/game/CharacterHandler.cpp @@ -39,6 +39,14 @@ #include "ArenaTeam.h" #include "Language.h" +// config option SkipCinematics supported values +enum CinematicsSkipMode +{ + CINEMATICS_SKIP_NONE = 0, + CINEMATICS_SKIP_SAME_RACE = 1, + CINEMATICS_SKIP_ALL = 2, +}; + class LoginQueryHolder : public SqlQueryHolder { private: @@ -321,17 +329,17 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) } bool AllowTwoSideAccounts = sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_ACCOUNTS) || GetSecurity() > SEC_PLAYER; - uint32 skipCinematics = sWorld.getConfig(CONFIG_SKIP_CINEMATICS); + CinematicsSkipMode skipCinematics = CinematicsSkipMode(sWorld.getConfig(CONFIG_SKIP_CINEMATICS)); bool have_same_race = false; // if 0 then allowed creating without any characters bool have_req_level_for_heroic = (req_level_for_heroic==0); - if(!AllowTwoSideAccounts || skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT) + if(!AllowTwoSideAccounts || skipCinematics == CINEMATICS_SKIP_SAME_RACE || class_ == CLASS_DEATH_KNIGHT) { QueryResult *result2 = CharacterDatabase.PQuery("SELECT level,race,class FROM characters WHERE account = '%u' %s", - GetAccountId(), (skipCinematics == 1 || class_ == CLASS_DEATH_KNIGHT) ? "" : "LIMIT 1"); + GetAccountId(), (skipCinematics == CINEMATICS_SKIP_SAME_RACE || class_ == CLASS_DEATH_KNIGHT) ? "" : "LIMIT 1"); if(result2) { uint32 team_= Player::TeamForRace(race_); @@ -382,7 +390,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) // search same race for cinematic or same class if need // TODO: check if cinematic already shown? (already logged in?; cinematic field) - while ((skipCinematics == 1 && !have_same_race) || class_ == CLASS_DEATH_KNIGHT) + while ((skipCinematics == CINEMATICS_SKIP_SAME_RACE && !have_same_race) || class_ == CLASS_DEATH_KNIGHT) { if(!result2->NextRow()) break; @@ -445,7 +453,7 @@ void WorldSession::HandleCharCreateOpcode( WorldPacket & recv_data ) return; } - if ((have_same_race && skipCinematics == 1) || skipCinematics == 2) + if ((have_same_race && skipCinematics == CINEMATICS_SKIP_SAME_RACE) || skipCinematics == CINEMATICS_SKIP_ALL) pNewChar->setCinematic(1); // not show intro // Player created, save it now diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 083ad86d5..0c5b7ec8d 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "9163" + #define REVISION_NR "9164" #endif // __REVISION_NR_H__