Changeset 28 for trunk/src/game/Chat.cpp

Show
Ignore:
Timestamp:
11/19/08 13:24:39 (17 years ago)
Author:
yumileroy
Message:

[svn] * Updated to 6743 and 685

Moved language id used by Arena to a higher place to solve conflicts
Added the empty script folders

Original author: Neo2003
Date: 2008-10-09 08:42:22-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Chat.cpp

    r18 r28  
    354354    static ChatCommand gmCommandTable[] = 
    355355    { 
     356        { "chat",           SEC_MODERATOR,      &ChatHandler::HandleGMChatCommand,              "", NULL }, 
    356357        { "list",           SEC_PLAYER,         &ChatHandler::HandleGMListCommand,              "", NULL }, 
    357358        { "visible",        SEC_MODERATOR,      &ChatHandler::HandleVisibleCommand,             "", NULL }, 
     
    508509} 
    509510 
    510 bool ChatHandler::hasStringAbbr(const char* s1, const char* s2) 
    511 { 
    512     for(;;) 
    513     { 
    514         if( !*s2 ) 
    515             return true; 
    516         else if( !*s1 ) 
     511bool ChatHandler::hasStringAbbr(const char* name, const char* part) 
     512{ 
     513    // non "" command 
     514    if( *name ) 
     515    { 
     516        // "" part from non-"" command 
     517        if( !*part ) 
    517518            return false; 
    518         else if( tolower( *s1 ) != tolower( *s2 ) ) 
    519             return false; 
    520         ++s1; ++s2; 
    521     } 
     519 
     520        for(;;) 
     521        { 
     522            if( !*part ) 
     523                return true; 
     524            else if( !*name ) 
     525                return false; 
     526            else if( tolower( *name ) != tolower( *part ) ) 
     527                return false; 
     528            ++name; ++part; 
     529        } 
     530    } 
     531    // allow with any for "" 
     532 
     533    return true; 
    522534} 
    523535 
     
    595607    while (*text == ' ') ++text; 
    596608 
    597     if(!cmd.length()) 
    598         return false; 
    599  
    600609    for(uint32 i = 0; table[i].Name != NULL; i++) 
    601610    { 
    602         // allow pass "" command name in table 
    603         if(strlen(table[i].Name) && !hasStringAbbr(table[i].Name, cmd.c_str())) 
     611        if( !hasStringAbbr(table[i].Name, cmd.c_str()) ) 
    604612            continue; 
    605613 
     
    689697            continue; 
    690698 
    691         if(strlen(table[i].Name) && !hasStringAbbr(table[i].Name, subcmd)) 
    692             continue; 
     699        if( !hasStringAbbr(table[i].Name, subcmd) ) 
    693700 
    694701        (list += "\n    ") += table[i].Name; 
     
    718725                continue; 
    719726 
    720             if(strlen(table[i].Name) && !hasStringAbbr(table[i].Name, cmd)) 
     727            if( !hasStringAbbr(table[i].Name, cmd) ) 
    721728                continue; 
    722729