Jump to content

[patch][7102] .showarea


Guest mcben

Recommended Posts

showarea/hidearea commands uses areaID instead of areaFlag -> so command will fail or reveals wrong area

fix:

commit a90fee198e61ff8dc96be312ebcc242252794bce
Author: McBen <[email protected]>
Date:   Mon Jan 5 13:28:08 2009 +0100

   fixed .showarea command

diff --git a/src/game/Level3.cpp b/src/game/Level3.cpp
index e26f260..66640eb 100644
--- a/src/game/Level3.cpp
+++ b/src/game/Level3.cpp
@@ -4219,8 +4219,6 @@ bool ChatHandler::HandleShowAreaCommand(const char* args)
    if (!*args)
        return false;

-    int area = atoi((char*)args);
-
    Player *chr = getSelectedPlayer();
    if (chr == NULL)
    {
@@ -4229,10 +4227,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);
@@ -4251,8 +4250,6 @@ bool ChatHandler::HandleHideAreaCommand(const char* args)
    if (!*args)
        return false;

-    int area = atoi((char*)args);
-
    Player *chr = getSelectedPlayer();
    if (chr == NULL)
    {
@@ -4261,10 +4258,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);
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index adc55bb..9d6b944 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -5337,7 +5337,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;
    }

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. Privacy Policy Terms of Use