Changeset 28 for trunk/src/game/Chat.cpp
- Timestamp:
- 11/19/08 13:24:39 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Chat.cpp
r18 r28 354 354 static ChatCommand gmCommandTable[] = 355 355 { 356 { "chat", SEC_MODERATOR, &ChatHandler::HandleGMChatCommand, "", NULL }, 356 357 { "list", SEC_PLAYER, &ChatHandler::HandleGMListCommand, "", NULL }, 357 358 { "visible", SEC_MODERATOR, &ChatHandler::HandleVisibleCommand, "", NULL }, … … 508 509 } 509 510 510 bool ChatHandler::hasStringAbbr(const char* s1, const char* s2)511 { 512 for(;;)513 {514 if( !*s2 )515 return true;516 else if( !*s1)511 bool ChatHandler::hasStringAbbr(const char* name, const char* part) 512 { 513 // non "" command 514 if( *name ) 515 { 516 // "" part from non-"" command 517 if( !*part ) 517 518 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; 522 534 } 523 535 … … 595 607 while (*text == ' ') ++text; 596 608 597 if(!cmd.length())598 return false;599 600 609 for(uint32 i = 0; table[i].Name != NULL; i++) 601 610 { 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()) ) 604 612 continue; 605 613 … … 689 697 continue; 690 698 691 if(strlen(table[i].Name) && !hasStringAbbr(table[i].Name, subcmd)) 692 continue; 699 if( !hasStringAbbr(table[i].Name, subcmd) ) 693 700 694 701 (list += "\n ") += table[i].Name; … … 718 725 continue; 719 726 720 if( strlen(table[i].Name) && !hasStringAbbr(table[i].Name, cmd))727 if( !hasStringAbbr(table[i].Name, cmd) ) 721 728 continue; 722 729