Skip to content

Commit

Permalink
[11513] Not pass command list as format %s value.
Browse files Browse the repository at this point in the history
This let avoid not nice command list text length limitation.

Signed-off-by: VladimirMangos <vladimir@getmangos.com>
  • Loading branch information
Vinolentus authored and VladimirMangos committed May 20, 2011
1 parent 16b634c commit 1b70cf6
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 11 deletions.
4 changes: 2 additions & 2 deletions sql/mangos.sql
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CREATE TABLE `db_version` (
`version` varchar(120) default NULL,
`creature_ai_version` varchar(120) default NULL,
`cache_id` int(10) default '0',
`required_11503_01_mangos_spell_proc_event` bit(1) default NULL
`required_11513_09_mangos_mangos_string` bit(1) default NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=FIXED COMMENT='Used DB version notes';

--
Expand Down Expand Up @@ -3083,7 +3083,7 @@ INSERT INTO `mangos_string` VALUES
(5,'There is no help for that command',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(6,'There is no such command',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(7,'There is no such subcommand',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(8,'Command %s have subcommands:%s',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(8,'Command %s have subcommands:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(9,'Commands available to you:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(10,'Incorrect syntax.',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
(11,'Your account level is: %i',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL),
Expand Down
5 changes: 5 additions & 0 deletions sql/updates/11513_09_mangos_mangos_string.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ALTER TABLE db_version CHANGE COLUMN required_11503_01_mangos_spell_proc_event required_11513_09_mangos_mangos_string bit;

DELETE FROM mangos_string WHERE entry IN (8);
INSERT INTO mangos_string VALUES
(8,'Command %s have subcommands:',NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL);
16 changes: 9 additions & 7 deletions src/game/Chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ void ChatHandler::PSendSysMessage(int32 entry, ...)
va_list ap;
char str [2048];
va_start(ap, entry);
vsnprintf(str,2048,format, ap );
vsnprintf(str, 2048, format, ap);
va_end(ap);
SendSysMessage(str);
}
Expand All @@ -956,7 +956,7 @@ void ChatHandler::PSendSysMessage(const char *format, ...)
va_list ap;
char str [2048];
va_start(ap, format);
vsnprintf(str,2048,format, ap );
vsnprintf(str, 2048, format, ap);
va_end(ap);
SendSysMessage(str);
}
Expand Down Expand Up @@ -1311,7 +1311,7 @@ bool ChatHandler::ParseCommands(const char* text)
bool ChatHandler::ShowHelpForSubCommands(ChatCommand *table, char const* cmd)
{
std::string list;
for(uint32 i = 0; table[i].Name != NULL; ++i)
for (uint32 i = 0; table[i].Name != NULL; ++i)
{
// must be available (ignore handler existence for show command with possible available subcommands
if (!isAvailable(table[i]))
Expand All @@ -1331,14 +1331,16 @@ bool ChatHandler::ShowHelpForSubCommands(ChatCommand *table, char const* cmd)
if (list.empty())
return false;

if (table==getCommandTable())
if (table == getCommandTable())
{
SendSysMessage(LANG_AVIABLE_CMD);
PSendSysMessage("%s",list.c_str());
SendSysMessage(list.c_str());
}
else
PSendSysMessage(LANG_SUBCMDS_LIST,cmd,list.c_str());

{
PSendSysMessage(LANG_SUBCMDS_LIST, cmd);
SendSysMessage(list.c_str());
}
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/shared/revision_nr.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "11512"
#define REVISION_NR "11513"
#endif // __REVISION_NR_H__
2 changes: 1 addition & 1 deletion src/shared/revision_sql.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#ifndef __REVISION_SQL_H__
#define __REVISION_SQL_H__
#define REVISION_DB_CHARACTERS "required_11436_01_characters_character_queststatus"
#define REVISION_DB_MANGOS "required_11503_01_mangos_spell_proc_event"
#define REVISION_DB_MANGOS "required_11513_09_mangos_mangos_string"
#define REVISION_DB_REALMD "required_10008_01_realmd_realmd_db_version"
#endif // __REVISION_SQL_H__

3 comments on commit 1b70cf6

@DoesntMatter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

since this commit, server crashes in Chat.cpp:
http://pastebin.com/raw.php?i=fbLMEuad

@VladimirMangos
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mangos string sql updates by reason drop localization string versions at main string content update.

You re-add wrong "Befehl %s hat Unterbefehle:%s" and why you wonder that crash ;)
User/localization DB error.

@DoesntMatter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah thanks :) I should have had a closer look at gmdb here, sorry :(

Please sign in to comment.