mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 04:37:00 +00:00
[9633] Some code clean up.
Signed-off-by: hunuza <hunuza@gmail.com>
This commit is contained in:
parent
1d0218bf7b
commit
6c553bf226
4 changed files with 25 additions and 41 deletions
|
|
@ -3961,7 +3961,7 @@ bool ChatHandler::HandleExploreCheatCommand(const char* args)
|
|||
ChatHandler(chr).PSendSysMessage(LANG_YOURS_EXPLORE_SET_NOTHING,GetNameLink().c_str());
|
||||
}
|
||||
|
||||
for (uint8 i=0; i<128; ++i)
|
||||
for (uint8 i=0; i<PLAYER_EXPLORED_ZONES_SIZE; ++i)
|
||||
{
|
||||
if (flag != 0)
|
||||
{
|
||||
|
|
@ -4118,7 +4118,7 @@ bool ChatHandler::HandleShowAreaCommand(const char* args)
|
|||
int offset = area / 32;
|
||||
uint32 val = (uint32)(1 << (area % 32));
|
||||
|
||||
if(area<0 || offset >= 128)
|
||||
if(area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
@ -4149,7 +4149,7 @@ bool ChatHandler::HandleHideAreaCommand(const char* args)
|
|||
int offset = area / 32;
|
||||
uint32 val = (uint32)(1 << (area % 32));
|
||||
|
||||
if(area<0 || offset >= 128)
|
||||
if(area<0 || offset >= PLAYER_EXPLORED_ZONES_SIZE)
|
||||
{
|
||||
SendSysMessage(LANG_BAD_VALUE);
|
||||
SetSentErrorMessage(true);
|
||||
|
|
|
|||
|
|
@ -608,10 +608,10 @@ bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8
|
|||
SetUInt32Value( PLAYER_GUILDRANK, 0 );
|
||||
SetUInt32Value( PLAYER_GUILD_TIMESTAMP, 0 );
|
||||
|
||||
SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES, 0 ); // 0=disabled
|
||||
SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES1, 0 ); // 0=disabled
|
||||
SetUInt64Value( PLAYER__FIELD_KNOWN_TITLES2, 0 ); // 0=disabled
|
||||
for(int i = 0; i < KNOWN_TITLES_SIZE; ++i)
|
||||
SetUInt64Value(PLAYER__FIELD_KNOWN_TITLES + i, 0); // 0=disabled
|
||||
SetUInt32Value( PLAYER_CHOSEN_TITLE, 0 );
|
||||
|
||||
SetUInt32Value( PLAYER_FIELD_KILLS, 0 );
|
||||
SetUInt32Value( PLAYER_FIELD_LIFETIME_HONORBALE_KILLS, 0 );
|
||||
SetUInt32Value( PLAYER_FIELD_TODAY_CONTRIBUTION, 0 );
|
||||
|
|
@ -5889,9 +5889,9 @@ void Player::CheckExploreSystem()
|
|||
return;
|
||||
int offset = areaFlag / 32;
|
||||
|
||||
if(offset >= 128)
|
||||
if(offset >= PLAYER_EXPLORED_ZONES_SIZE)
|
||||
{
|
||||
sLog.outError("Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < 128 ).",areaFlag,GetPositionX(),GetPositionY(),offset,offset);
|
||||
sLog.outError("Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < %u ).",areaFlag,GetPositionX(),GetPositionY(),offset,offset, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -14651,39 +14651,21 @@ float Player::GetFloatValueFromArray(Tokens const& data, uint16 index)
|
|||
return result;
|
||||
}
|
||||
|
||||
void Player::_LoadExploredZones(const char* data)
|
||||
void Player::_LoadIntoDataField(const char* data, uint32 startOffset, uint32 count)
|
||||
{
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
Tokens tokens = StrSplit(data, " ");
|
||||
|
||||
if(tokens.size() != 128)
|
||||
if(tokens.size() != count)
|
||||
return;
|
||||
|
||||
Tokens::iterator iter;
|
||||
int index;
|
||||
for (iter = tokens.begin(), index = 0; index < 128; ++iter, ++index)
|
||||
uint32 index;
|
||||
for (iter = tokens.begin(), index = 0; index < count; ++iter, ++index)
|
||||
{
|
||||
m_uint32Values[PLAYER_EXPLORED_ZONES_1 + index] = atol((*iter).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void Player::_LoadKnownTitles(const char* data)
|
||||
{
|
||||
if(!data)
|
||||
return;
|
||||
|
||||
Tokens tokens = StrSplit(data, " ");
|
||||
|
||||
if(tokens.size() != 6)
|
||||
return;
|
||||
|
||||
Tokens::iterator iter;
|
||||
int index;
|
||||
for (iter = tokens.begin(), index = 0; index < 6; ++iter, ++index)
|
||||
{
|
||||
m_uint32Values[PLAYER__FIELD_KNOWN_TITLES + index] = atol((*iter).c_str());
|
||||
m_uint32Values[startOffset + index] = atol((*iter).c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -14746,8 +14728,9 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
|||
SetUInt32Value(UNIT_FIELD_LEVEL, fields[6].GetUInt8());
|
||||
SetUInt32Value(PLAYER_XP, fields[7].GetUInt32());
|
||||
|
||||
_LoadExploredZones(fields[60].GetString());
|
||||
_LoadKnownTitles(fields[63].GetString());
|
||||
_LoadIntoDataField(fields[60].GetString(), PLAYER_EXPLORED_ZONES_1, PLAYER_EXPLORED_ZONES_SIZE);
|
||||
_LoadIntoDataField(fields[63].GetString(), PLAYER__FIELD_KNOWN_TITLES, KNOWN_TITLES_SIZE*2);
|
||||
|
||||
SetFloatValue(UNIT_FIELD_BOUNDINGRADIUS, DEFAULT_WORLD_OBJECT_SIZE);
|
||||
SetFloatValue(UNIT_FIELD_COMBATREACH, 1.5f);
|
||||
SetFloatValue(UNIT_FIELD_HOVERHEIGHT, 1.0f);
|
||||
|
|
@ -16368,7 +16351,7 @@ void Player::SaveToDB()
|
|||
ss << ", ";
|
||||
ss << uint32(m_specsCount) << ", ";
|
||||
ss << uint32(m_activeSpec) << ", '";
|
||||
for(uint32 i = 0; i < 128; ++i )
|
||||
for(uint32 i = 0; i < PLAYER_EXPLORED_ZONES_SIZE; ++i )
|
||||
{
|
||||
ss << GetUInt32Value(PLAYER_EXPLORED_ZONES_1 + i) << " ";
|
||||
}
|
||||
|
|
@ -16381,7 +16364,7 @@ void Player::SaveToDB()
|
|||
|
||||
ss << "',";
|
||||
ss << GetUInt32Value(PLAYER_AMMO_ID) << ", '";
|
||||
for(uint32 i = 0; i < 6; ++i )
|
||||
for(uint32 i = 0; i < KNOWN_TITLES_SIZE*2; ++i )
|
||||
{
|
||||
ss << GetUInt32Value(PLAYER__FIELD_KNOWN_TITLES + i) << " ";
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,8 +57,9 @@ class Item;
|
|||
|
||||
typedef std::deque<Mail*> PlayerMails;
|
||||
|
||||
#define PLAYER_MAX_SKILLS 127
|
||||
#define PLAYER_MAX_DAILY_QUESTS 25
|
||||
#define PLAYER_MAX_SKILLS 127
|
||||
#define PLAYER_MAX_DAILY_QUESTS 25
|
||||
#define PLAYER_EXPLORED_ZONES_SIZE 128
|
||||
|
||||
// Note: SPELLMOD_* values is aura types in fact
|
||||
enum SpellModType
|
||||
|
|
@ -548,7 +549,8 @@ enum PlayerFlags
|
|||
#define PLAYER_TITLE_HAND_OF_ADAL UI64LIT(0x0000008000000000) // 39
|
||||
#define PLAYER_TITLE_VENGEFUL_GLADIATOR UI64LIT(0x0000010000000000) // 40
|
||||
|
||||
#define MAX_TITLE_INDEX (3*64) // 3 uint64 fields
|
||||
#define KNOWN_TITLES_SIZE 3
|
||||
#define MAX_TITLE_INDEX (KNOWN_TITLES_SIZE*64) // 3 uint64 fields
|
||||
|
||||
// used in PLAYER_FIELD_BYTES values
|
||||
enum PlayerFieldByteFlags
|
||||
|
|
@ -2320,8 +2322,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
|||
void _LoadEquipmentSets(QueryResult *result);
|
||||
void _LoadBGData(QueryResult* result);
|
||||
void _LoadGlyphs(QueryResult *result);
|
||||
void _LoadExploredZones(const char* data);
|
||||
void _LoadKnownTitles(const char* data);
|
||||
void _LoadIntoDataField(const char* data, uint32 startOffset, uint32 count);
|
||||
|
||||
/*********************************************************/
|
||||
/*** SAVE SYSTEM ***/
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "9632"
|
||||
#define REVISION_NR "9633"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue