Jump to content

mcben

Members
  • Posts

    8
  • Joined

  • Last visited

    Never
  • Donations

    0.00 GBP 

Posts posted by mcben

  1. Can you give me an example of what SD2 can do on its own, or what other project can use SD2?

    That's almost like saying, PEAR is not part of PHP, or Rails has nothing to do with Ruby.

    When you write a program (PEAR, RAILS, SD2, Plugin) based on a language/lib (PHP, Ruby, Mangos, Browser)

    then you are responsible to keep it uptodate not the language developers.

    That's why people write: "requires...; compatible with ..."

    It's like blaiming the ruby-devs for releasing version 2.0 (example) because your old Rails 2.3 won't work with it.

  2. As i read isspace can be propertly used only for isascii(ch)==true cases
    That's not correct. It can also check if an extend (8-bit) char is a 'space' based on the locale settings. ...(something I just learned too :) )

    a comment for 'ctype' function from: http://en.wikipedia.org/wiki/Ctype.h

    In all cases the argument is an int, the value of which shall be representable as an unsigned char or shall equal the value of the macro EOF. If the argument has any other value, the behavior is undefined.

    ...

    The correct way to use char arguments is to first cast them to unsigned char.

    An 'isascii' check is a possible alternative (doesn't assert on <0) since locales aren't setup anyway.

    So something like the following could be a option

    -        if(isspace(*line) && !quoted){
    +        if(isascii(*line) && isspace(*line) && !quoted){
    ...
    -            while(isspace(*++line)) {}
    +            ++line; 
    +            while(isascii(*line) && isspace(*line)) {++line;}
    

  3. nothing really bad but in MS-Studio-debug builds you may run in an assert if you use special chars in mangos.conf (for example 'äá' as db-password)

    fix:

    commit 1418d8d6e6be9d409e58fd6ec7dcb7419b1b7ccb
    Author: McBen <[email protected]>
    Date:   Tue Nov 25 13:16:19 2008 +0100
    
       fixed config file parsing
    
    diff --git a/src/shared/Config/dotconfpp/dotconfpp.cpp b/src/shared/Config/dotconfpp/dotconfpp.cpp
    index 6000874..e5c6e87 100644
    --- a/src/shared/Config/dotconfpp/dotconfpp.cpp
    +++ b/src/shared/Config/dotconfpp/dotconfpp.cpp
    @@ -138,7 +138,7 @@ int DOTCONFDocument::cleanupLine(char * line)
                quoted = !quoted;
                ++line; continue;
            }
    -        if(isspace(*line) && !quoted){
    +        if(isspace((unsigned char)*line) && !quoted){
                *bg++ = 0;
                if(strlen(start)){
    
    @@ -154,7 +154,7 @@ int DOTCONFDocument::cleanupLine(char * line)
                    words.push_back(word);
                }
                start = bg;
    -            while(isspace(*++line)) {}
    +            while(isspace((unsigned char)(*++line))) {}
    
                continue;
            } 

  4. 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;
        }
    

×
×
  • 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