[9164] Use enum for CONFIG_SKIP_CINEMATICS values.

Just small code cleanup ;)
This commit is contained in:
VladimirMangos 2010-01-13 02:09:26 +03:00
parent 6c7e0fccd2
commit 1e8e8f5fd2
2 changed files with 14 additions and 6 deletions

View file

@ -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

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "9163"
#define REVISION_NR "9164"
#endif // __REVISION_NR_H__