Skip to content

Commit

Permalink
[7102] Fixed .showarea/,hodearea commands.
Browse files Browse the repository at this point in the history
Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
McBen authored and VladimirMangos committed Jan 18, 2009
1 parent 76a78f6 commit cc2f83d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
10 changes: 4 additions & 6 deletions src/game/Level3.cpp
Expand Up @@ -3836,8 +3836,6 @@ bool ChatHandler::HandleShowAreaCommand(const char* args)
if (!*args)
return false;

int area = atoi((char*)args);

Player *chr = getSelectedPlayer();
if (chr == NULL)
{
Expand All @@ -3846,10 +3844,11 @@ bool ChatHandler::HandleShowAreaCommand(const char* args)
return false;
}

int area = GetAreaFlagByAreaID(atoi((char*)args));
int offset = area / 32;
uint32 val = (uint32)(1 << (area % 32));

if(offset >= 128)
if(area<0 || offset >= 128)
{
SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true);
Expand All @@ -3868,8 +3867,6 @@ bool ChatHandler::HandleHideAreaCommand(const char* args)
if (!*args)
return false;

int area = atoi((char*)args);

Player *chr = getSelectedPlayer();
if (chr == NULL)
{
Expand All @@ -3878,10 +3875,11 @@ bool ChatHandler::HandleHideAreaCommand(const char* args)
return false;
}

int area = GetAreaFlagByAreaID(atoi((char*)args));
int offset = area / 32;
uint32 val = (uint32)(1 << (area % 32));

if(offset >= 128)
if(area<0 || offset >= 128)
{
SendSysMessage(LANG_BAD_VALUE);
SetSentErrorMessage(true);
Expand Down
2 changes: 1 addition & 1 deletion src/game/Player.cpp
Expand Up @@ -5322,7 +5322,7 @@ void Player::CheckExploreSystem()

if(offset >= 128)
{
sLog.outError("ERROR: Wrong area flag %u in map data for (X: %f Y: %f) point to field PLAYER_EXPLORED_ZONES_1 + %u ( %u must be < 64 ).",areaFlag,GetPositionX(),GetPositionY(),offset,offset);
sLog.outError("ERROR: 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);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "7101"
#define REVISION_NR "7102"
#endif // __REVISION_NR_H__

0 comments on commit cc2f83d

Please sign in to comment.