mirror of
https://github.com/mangosfour/server.git
synced 2025-12-13 22:37:03 +00:00
[10322] In chat command handlers use char* arg instead "const char*"
We in any case modify args string content at parsing in commands, so cast it to char* early. This let avoid lot later casts. Some other code style exist in related code.
This commit is contained in:
parent
17ecab0030
commit
0cc1fbe697
9 changed files with 1200 additions and 1264 deletions
|
|
@ -33,12 +33,12 @@
|
|||
#include "ObjectGuid.h"
|
||||
#include "SpellMgr.h"
|
||||
|
||||
bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSendSpellFailCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
char* px = strtok(args, " ");
|
||||
if (!px)
|
||||
return false;
|
||||
|
||||
|
|
@ -66,7 +66,7 @@ bool ChatHandler::HandleDebugSendSpellFailCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSendPoiCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSendPoiCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
|
@ -79,7 +79,7 @@ bool ChatHandler::HandleDebugSendPoiCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
char* icon_text = strtok((char*)args, " ");
|
||||
char* icon_text = strtok(args, " ");
|
||||
char* flags_text = strtok(NULL, " ");
|
||||
if (!icon_text || !flags_text)
|
||||
return false;
|
||||
|
|
@ -92,7 +92,7 @@ bool ChatHandler::HandleDebugSendPoiCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSendEquipErrorCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSendEquipErrorCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
|
@ -102,7 +102,7 @@ bool ChatHandler::HandleDebugSendEquipErrorCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSendSellErrorCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSendSellErrorCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
|
@ -112,7 +112,7 @@ bool ChatHandler::HandleDebugSendSellErrorCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSendBuyErrorCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSendBuyErrorCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
|
@ -122,7 +122,7 @@ bool ChatHandler::HandleDebugSendBuyErrorCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
|
||||
bool ChatHandler::HandleDebugSendOpcodeCommand(char* /*args*/)
|
||||
{
|
||||
Unit *unit = getSelectedUnit();
|
||||
if (!unit || (unit->GetTypeId() != TYPEID_PLAYER))
|
||||
|
|
@ -199,9 +199,9 @@ bool ChatHandler::HandleDebugSendOpcodeCommand(const char* /*args*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugUpdateWorldStateCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugUpdateWorldStateCommand(char* args)
|
||||
{
|
||||
char* w = strtok((char*)args, " ");
|
||||
char* w = strtok(args, " ");
|
||||
char* s = strtok(NULL, " ");
|
||||
|
||||
if (!w || !s)
|
||||
|
|
@ -213,7 +213,7 @@ bool ChatHandler::HandleDebugUpdateWorldStateCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugPlayCinematicCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugPlayCinematicCommand(char* args)
|
||||
{
|
||||
// USAGE: .debug play cinematic #cinematicid
|
||||
// #cinematicid - ID decimal number from CinemaicSequences.dbc (1st column)
|
||||
|
|
@ -224,7 +224,7 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32 dwId = atoi((char*)args);
|
||||
uint32 dwId = atoi(args);
|
||||
|
||||
if (!sCinematicSequencesStore.LookupEntry(dwId))
|
||||
{
|
||||
|
|
@ -237,7 +237,7 @@ bool ChatHandler::HandleDebugPlayCinematicCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugPlayMovieCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugPlayMovieCommand(char* args)
|
||||
{
|
||||
// USAGE: .debug play movie #movieid
|
||||
// #movieid - ID decimal number from Movie.dbc (1st column)
|
||||
|
|
@ -248,7 +248,7 @@ bool ChatHandler::HandleDebugPlayMovieCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32 dwId = atoi((char*)args);
|
||||
uint32 dwId = atoi(args);
|
||||
|
||||
if (!sMovieStore.LookupEntry(dwId))
|
||||
{
|
||||
|
|
@ -262,7 +262,7 @@ bool ChatHandler::HandleDebugPlayMovieCommand(const char* args)
|
|||
}
|
||||
|
||||
//Play sound
|
||||
bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugPlaySoundCommand(char* args)
|
||||
{
|
||||
// USAGE: .debug playsound #soundid
|
||||
// #soundid - ID decimal number from SoundEntries.dbc (1st column)
|
||||
|
|
@ -273,7 +273,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32 dwSoundId = atoi((char*)args);
|
||||
uint32 dwSoundId = atoi(args);
|
||||
|
||||
if (!sSoundEntriesStore.LookupEntry(dwSoundId))
|
||||
{
|
||||
|
|
@ -300,7 +300,7 @@ bool ChatHandler::HandleDebugPlaySoundCommand(const char* args)
|
|||
}
|
||||
|
||||
//Send notification in channel
|
||||
bool ChatHandler::HandleDebugSendChannelNotifyCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSendChannelNotifyCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
|
@ -318,7 +318,7 @@ bool ChatHandler::HandleDebugSendChannelNotifyCommand(const char* args)
|
|||
}
|
||||
|
||||
//Send notification in chat
|
||||
bool ChatHandler::HandleDebugSendChatMsgCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSendChatMsgCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
|
@ -331,14 +331,14 @@ bool ChatHandler::HandleDebugSendChatMsgCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSendQuestPartyMsgCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSendQuestPartyMsgCommand(char* args)
|
||||
{
|
||||
uint32 msg = atol((char*)args);
|
||||
uint32 msg = atol(args);
|
||||
m_session->GetPlayer()->SendPushToPartyResponse(m_session->GetPlayer(), msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugGetLootRecipientCommand(const char* /*args*/)
|
||||
bool ChatHandler::HandleDebugGetLootRecipientCommand(char* /*args*/)
|
||||
{
|
||||
Creature* target = getSelectedCreature();
|
||||
if (!target)
|
||||
|
|
@ -357,14 +357,14 @@ bool ChatHandler::HandleDebugGetLootRecipientCommand(const char* /*args*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSendQuestInvalidMsgCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSendQuestInvalidMsgCommand(char* args)
|
||||
{
|
||||
uint32 msg = atol((char*)args);
|
||||
uint32 msg = atol(args);
|
||||
m_session->GetPlayer()->SendCanTakeQuestResponse(msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugGetItemStateCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
|
@ -598,24 +598,24 @@ bool ChatHandler::HandleDebugGetItemStateCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugBattlegroundCommand(const char * /*args*/)
|
||||
bool ChatHandler::HandleDebugBattlegroundCommand(char* /*args*/)
|
||||
{
|
||||
sBattleGroundMgr.ToggleTesting();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugArenaCommand(const char * /*args*/)
|
||||
bool ChatHandler::HandleDebugArenaCommand(char* /*args*/)
|
||||
{
|
||||
sBattleGroundMgr.ToggleArenaTesting();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
|
||||
bool ChatHandler::HandleDebugSpawnVehicleCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* e = strtok((char*)args, " ");
|
||||
char* e = strtok(args, " ");
|
||||
char* i = strtok(NULL, " ");
|
||||
|
||||
if (!e || !i)
|
||||
|
|
@ -660,14 +660,14 @@ bool ChatHandler::HandleDebugSpawnVehicle(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSpellCheckCommand(const char* /*args*/)
|
||||
bool ChatHandler::HandleDebugSpellCheckCommand(char* /*args*/)
|
||||
{
|
||||
sLog.outString( "Check expected in code spell properties base at table 'spell_check' content...");
|
||||
sSpellMgr.CheckUsedSpells("spell_check");
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSendLargePacketCommand(const char* /*args*/)
|
||||
bool ChatHandler::HandleDebugSendLargePacketCommand(char* /*args*/)
|
||||
{
|
||||
const char* stuffingString = "This is a dummy string to push the packet's size beyond 128000 bytes. ";
|
||||
std::ostringstream ss;
|
||||
|
|
@ -677,7 +677,7 @@ bool ChatHandler::HandleDebugSendLargePacketCommand(const char* /*args*/)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
|
@ -687,12 +687,12 @@ bool ChatHandler::HandleDebugSendSetPhaseShiftCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugGetItemValueCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugGetItemValueCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* e = strtok((char*)args, " ");
|
||||
char* e = strtok(args, " ");
|
||||
char* f = strtok(NULL, " ");
|
||||
|
||||
if (!e || !f)
|
||||
|
|
@ -716,12 +716,12 @@ bool ChatHandler::HandleDebugGetItemValueCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSetItemValueCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSetItemValueCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
char* e = strtok((char*)args, " ");
|
||||
char* e = strtok(args, " ");
|
||||
char* f = strtok(NULL, " ");
|
||||
char* g = strtok(NULL, " ");
|
||||
|
||||
|
|
@ -746,17 +746,17 @@ bool ChatHandler::HandleDebugSetItemValueCommand(const char* args)
|
|||
}
|
||||
|
||||
//show animation
|
||||
bool ChatHandler::HandleDebugAnimCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugAnimCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
return false;
|
||||
|
||||
uint32 emote_id = atoi((char*)args);
|
||||
uint32 emote_id = atoi(args);
|
||||
m_session->GetPlayer()->HandleEmoteCommand(emote_id);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSetAuraStateCommand(char* args)
|
||||
{
|
||||
if (!*args)
|
||||
{
|
||||
|
|
@ -773,7 +773,7 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args)
|
|||
return false;
|
||||
}
|
||||
|
||||
int32 state = atoi((char*)args);
|
||||
int32 state = atoi(args);
|
||||
if (!state)
|
||||
{
|
||||
// reset all states
|
||||
|
|
@ -786,12 +786,12 @@ bool ChatHandler::HandleDebugSetAuraStateCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugSetValueCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugSetValueCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
char* px = strtok(args, " ");
|
||||
char* py = strtok(NULL, " ");
|
||||
char* pz = strtok(NULL, " ");
|
||||
|
||||
|
|
@ -837,12 +837,12 @@ bool ChatHandler::HandleDebugSetValueCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugGetValueCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugGetValueCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
char* px = strtok(args, " ");
|
||||
char* pz = strtok(NULL, " ");
|
||||
|
||||
if (!px)
|
||||
|
|
@ -886,12 +886,12 @@ bool ChatHandler::HandleDebugGetValueCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugMod32ValueCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugMod32ValueCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
||||
char* px = strtok((char*)args, " ");
|
||||
char* px = strtok(args, " ");
|
||||
char* py = strtok(NULL, " ");
|
||||
|
||||
if (!px || !py)
|
||||
|
|
@ -918,7 +918,7 @@ bool ChatHandler::HandleDebugMod32ValueCommand(const char* args)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool ChatHandler::HandleDebugUpdateCommand(const char* args)
|
||||
bool ChatHandler::HandleDebugUpdateCommand(char* args)
|
||||
{
|
||||
if(!*args)
|
||||
return false;
|
||||
|
|
@ -926,7 +926,7 @@ bool ChatHandler::HandleDebugUpdateCommand(const char* args)
|
|||
uint32 updateIndex;
|
||||
uint32 value;
|
||||
|
||||
char* pUpdateIndex = strtok((char*)args, " ");
|
||||
char* pUpdateIndex = strtok(args, " ");
|
||||
|
||||
Unit* chr = getSelectedUnit();
|
||||
if (chr == NULL)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue