mirror of
https://github.com/mangosfour/server.git
synced 2025-12-14 07:37:01 +00:00
Merge branch 'master' into 303
Conflicts: src/game/Player.h
This commit is contained in:
commit
5d4d7292b9
47 changed files with 244 additions and 209 deletions
|
|
@ -360,7 +360,7 @@ void WorldSession::HandleArenaTeamPromoteToCaptainOpcode(WorldPacket & recv_data
|
||||||
at->BroadcastPacket(&data);
|
at->BroadcastPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendArenaTeamCommandResult(uint32 unk1, std::string str1, std::string str2, uint32 unk3)
|
void WorldSession::SendArenaTeamCommandResult(uint32 unk1, const std::string& str1, const std::string& str2, uint32 unk3)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_ARENA_TEAM_COMMAND_RESULT, 4+str1.length()+1+str2.length()+1+4);
|
WorldPacket data(SMSG_ARENA_TEAM_COMMAND_RESULT, 4+str1.length()+1+str2.length()+1+4);
|
||||||
data << unk1;
|
data << unk1;
|
||||||
|
|
@ -370,7 +370,7 @@ void WorldSession::SendArenaTeamCommandResult(uint32 unk1, std::string str1, std
|
||||||
SendPacket(&data);
|
SendPacket(&data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, std::string str1, std::string str2, std::string str3)
|
void WorldSession::BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, const std::string& str1, const std::string& str2, const std::string& str3)
|
||||||
{
|
{
|
||||||
data->Initialize(SMSG_ARENA_TEAM_EVENT, 1+1+1);
|
data->Initialize(SMSG_ARENA_TEAM_EVENT, 1+1+1);
|
||||||
*data << eventid;
|
*data << eventid;
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,7 @@
|
||||||
#include "World.h"
|
#include "World.h"
|
||||||
#include "SocialMgr.h"
|
#include "SocialMgr.h"
|
||||||
|
|
||||||
Channel::Channel(std::string name, uint32 channel_id)
|
Channel::Channel(const std::string& name, uint32 channel_id)
|
||||||
: m_name(name), m_announce(true), m_moderate(false), m_channelId(channel_id), m_ownerGUID(0), m_password(""), m_flags(0)
|
: m_name(name), m_announce(true), m_moderate(false), m_channelId(channel_id), m_ownerGUID(0), m_password(""), m_flags(0)
|
||||||
{
|
{
|
||||||
// set special flags if built-in channel
|
// set special flags if built-in channel
|
||||||
|
|
@ -773,7 +773,7 @@ void Channel::MakeOwnerChanged(WorldPacket *data, uint64 guid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// done 0x09
|
// done 0x09
|
||||||
void Channel::MakePlayerNotFound(WorldPacket *data, std::string name)
|
void Channel::MakePlayerNotFound(WorldPacket *data, const std::string& name)
|
||||||
{
|
{
|
||||||
MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE);
|
MakeNotifyPacket(data, CHAT_PLAYER_NOT_FOUND_NOTICE);
|
||||||
*data << name;
|
*data << name;
|
||||||
|
|
|
||||||
|
|
@ -170,7 +170,7 @@ class Channel
|
||||||
void MakeNotModerator(WorldPacket *data); //? 0x06
|
void MakeNotModerator(WorldPacket *data); //? 0x06
|
||||||
void MakePasswordChanged(WorldPacket *data, uint64 guid); //+ 0x07
|
void MakePasswordChanged(WorldPacket *data, uint64 guid); //+ 0x07
|
||||||
void MakeOwnerChanged(WorldPacket *data, uint64 guid); //? 0x08
|
void MakeOwnerChanged(WorldPacket *data, uint64 guid); //? 0x08
|
||||||
void MakePlayerNotFound(WorldPacket *data, std::string name); //+ 0x09
|
void MakePlayerNotFound(WorldPacket *data, const std::string& name); //+ 0x09
|
||||||
void MakeNotOwner(WorldPacket *data); //? 0x0A
|
void MakeNotOwner(WorldPacket *data); //? 0x0A
|
||||||
void MakeChannelOwner(WorldPacket *data); //? 0x0B
|
void MakeChannelOwner(WorldPacket *data); //? 0x0B
|
||||||
void MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags); //+ 0x0C
|
void MakeModeChange(WorldPacket *data, uint64 guid, uint8 oldflags); //+ 0x0C
|
||||||
|
|
@ -244,14 +244,14 @@ class Channel
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Channel(std::string name, uint32 channel_id);
|
Channel(const std::string& name, uint32 channel_id);
|
||||||
std::string GetName() const { return m_name; }
|
std::string GetName() const { return m_name; }
|
||||||
uint32 GetChannelId() const { return m_channelId; }
|
uint32 GetChannelId() const { return m_channelId; }
|
||||||
bool IsConstant() const { return m_channelId != 0; }
|
bool IsConstant() const { return m_channelId != 0; }
|
||||||
bool IsAnnounce() const { return m_announce; }
|
bool IsAnnounce() const { return m_announce; }
|
||||||
bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
|
bool IsLFG() const { return GetFlags() & CHANNEL_FLAG_LFG; }
|
||||||
std::string GetPassword() const { return m_password; }
|
std::string GetPassword() const { return m_password; }
|
||||||
void SetPassword(std::string npassword) { m_password = npassword; }
|
void SetPassword(const std::string& npassword) { m_password = npassword; }
|
||||||
void SetAnnounce(bool nannounce) { m_announce = nannounce; }
|
void SetAnnounce(bool nannounce) { m_announce = nannounce; }
|
||||||
uint32 GetNumPlayers() const { return players.size(); }
|
uint32 GetNumPlayers() const { return players.size(); }
|
||||||
uint8 GetFlags() const { return m_flags; }
|
uint8 GetFlags() const { return m_flags; }
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ class ChannelMgr
|
||||||
delete itr->second;
|
delete itr->second;
|
||||||
channels.clear();
|
channels.clear();
|
||||||
}
|
}
|
||||||
Channel *GetJoinChannel(std::string name, uint32 channel_id)
|
Channel *GetJoinChannel(const std::string& name, uint32 channel_id)
|
||||||
{
|
{
|
||||||
if(channels.count(name) == 0)
|
if(channels.count(name) == 0)
|
||||||
{
|
{
|
||||||
|
|
@ -45,7 +45,7 @@ class ChannelMgr
|
||||||
}
|
}
|
||||||
return channels[name];
|
return channels[name];
|
||||||
}
|
}
|
||||||
Channel *GetChannel(std::string name, Player *p)
|
Channel *GetChannel(const std::string& name, Player *p)
|
||||||
{
|
{
|
||||||
ChannelMap::const_iterator i = channels.find(name);
|
ChannelMap::const_iterator i = channels.find(name);
|
||||||
|
|
||||||
|
|
@ -59,7 +59,7 @@ class ChannelMgr
|
||||||
else
|
else
|
||||||
return i->second;
|
return i->second;
|
||||||
}
|
}
|
||||||
void LeftChannel(std::string name)
|
void LeftChannel(const std::string& name)
|
||||||
{
|
{
|
||||||
ChannelMap::const_iterator i = channels.find(name);
|
ChannelMap::const_iterator i = channels.find(name);
|
||||||
|
|
||||||
|
|
@ -76,7 +76,7 @@ class ChannelMgr
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
ChannelMap channels;
|
ChannelMap channels;
|
||||||
void MakeNotOnPacket(WorldPacket *data, std::string name)
|
void MakeNotOnPacket(WorldPacket *data, const std::string& name)
|
||||||
{
|
{
|
||||||
data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size
|
data->Initialize(SMSG_CHANNEL_NOTIFY, (1+10)); // we guess size
|
||||||
(*data) << (uint8)0x05 << name;
|
(*data) << (uint8)0x05 << name;
|
||||||
|
|
|
||||||
|
|
@ -709,7 +709,7 @@ void ChatHandler::PSendSysMessage(const char *format, ...)
|
||||||
SendSysMessage(str);
|
SendSysMessage(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, std::string fullcmd)
|
bool ChatHandler::ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcmd)
|
||||||
{
|
{
|
||||||
char const* oldtext = text;
|
char const* oldtext = text;
|
||||||
std::string cmd = "";
|
std::string cmd = "";
|
||||||
|
|
|
||||||
|
|
@ -80,7 +80,7 @@ class ChatHandler
|
||||||
|
|
||||||
void SendGlobalSysMessage(const char *str);
|
void SendGlobalSysMessage(const char *str);
|
||||||
|
|
||||||
bool ExecuteCommandInTable(ChatCommand *table, const char* text, std::string fullcommand);
|
bool ExecuteCommandInTable(ChatCommand *table, const char* text, const std::string& fullcommand);
|
||||||
bool ShowHelpForCommand(ChatCommand *table, const char* cmd);
|
bool ShowHelpForCommand(ChatCommand *table, const char* cmd);
|
||||||
bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd);
|
bool ShowHelpForSubCommands(ChatCommand *table, char const* cmd, char const* subcmd);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ class GMTicket
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
GMTicket(uint32 guid, std::string text, time_t update) : m_guid(guid), m_text(text), m_lastUpdate(update)
|
GMTicket(uint32 guid, const std::string& text, time_t update) : m_guid(guid), m_text(text), m_lastUpdate(update)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ GossipMenu::~GossipMenu()
|
||||||
ClearMenu();
|
ClearMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GossipMenu::AddMenuItem(uint8 Icon, std::string Message, uint32 dtSender, uint32 dtAction, std::string BoxMessage, uint32 BoxMoney, bool Coded)
|
void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSender, uint32 dtAction, const std::string& BoxMessage, uint32 BoxMoney, bool Coded)
|
||||||
{
|
{
|
||||||
ASSERT( m_gItems.size() <= GOSSIP_MAX_MENU_ITEMS );
|
ASSERT( m_gItems.size() <= GOSSIP_MAX_MENU_ITEMS );
|
||||||
|
|
||||||
|
|
@ -51,7 +51,7 @@ void GossipMenu::AddMenuItem(uint8 Icon, std::string Message, uint32 dtSender, u
|
||||||
m_gItems.push_back(gItem);
|
m_gItems.push_back(gItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GossipMenu::AddMenuItem(uint8 Icon, std::string Message, bool Coded)
|
void GossipMenu::AddMenuItem(uint8 Icon, const std::string& Message, bool Coded)
|
||||||
{
|
{
|
||||||
AddMenuItem( Icon, Message, 0, 0, "", 0, Coded);
|
AddMenuItem( Icon, Message, 0, 0, "", 0, Coded);
|
||||||
}
|
}
|
||||||
|
|
@ -341,7 +341,7 @@ void QuestMenu::ClearMenu()
|
||||||
m_qItems.clear();
|
m_qItems.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, std::string Title, uint64 npcGUID )
|
void PlayerMenu::SendQuestGiverQuestList( QEmote eEmote, const std::string& Title, uint64 npcGUID )
|
||||||
{
|
{
|
||||||
WorldPacket data( SMSG_QUESTGIVER_QUEST_LIST, 100 ); // guess size
|
WorldPacket data( SMSG_QUESTGIVER_QUEST_LIST, 100 ); // guess size
|
||||||
data << uint64(npcGUID);
|
data << uint64(npcGUID);
|
||||||
|
|
|
||||||
|
|
@ -101,8 +101,8 @@ class MANGOS_DLL_SPEC GossipMenu
|
||||||
GossipMenu();
|
GossipMenu();
|
||||||
~GossipMenu();
|
~GossipMenu();
|
||||||
|
|
||||||
void AddMenuItem(uint8 Icon, std::string Message, bool Coded = false);
|
void AddMenuItem(uint8 Icon, const std::string& Message, bool Coded = false);
|
||||||
void AddMenuItem(uint8 Icon, std::string Message, uint32 dtSender, uint32 dtAction, std::string BoxMessage, uint32 BoxMoney, bool Coded = false);
|
void AddMenuItem(uint8 Icon, const std::string& Message, uint32 dtSender, uint32 dtAction, const std::string& BoxMessage, uint32 BoxMoney, bool Coded = false);
|
||||||
|
|
||||||
// for using from scripts, don't must be inlined
|
// for using from scripts, don't must be inlined
|
||||||
void AddMenuItem(uint8 Icon, char const* Message, bool Coded = false);
|
void AddMenuItem(uint8 Icon, char const* Message, bool Coded = false);
|
||||||
|
|
@ -195,7 +195,7 @@ class MANGOS_DLL_SPEC PlayerMenu
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
void SendQuestGiverStatus( uint8 questStatus, uint64 npcGUID );
|
void SendQuestGiverStatus( uint8 questStatus, uint64 npcGUID );
|
||||||
|
|
||||||
void SendQuestGiverQuestList( QEmote eEmote, std::string Title, uint64 npcGUID );
|
void SendQuestGiverQuestList( QEmote eEmote, const std::string& Title, uint64 npcGUID );
|
||||||
|
|
||||||
void SendQuestQueryResponse ( Quest const *pQuest );
|
void SendQuestQueryResponse ( Quest const *pQuest );
|
||||||
void SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID, bool ActivateAccept);
|
void SendQuestGiverQuestDetails( Quest const *pQuest, uint64 npcGUID, bool ActivateAccept);
|
||||||
|
|
|
||||||
|
|
@ -212,7 +212,7 @@ bool Group::AddInvite(Player *player)
|
||||||
|
|
||||||
RemoveInvite(player);
|
RemoveInvite(player);
|
||||||
|
|
||||||
m_invitees.insert(player->GetGUID());
|
m_invitees.insert(player);
|
||||||
|
|
||||||
player->SetGroupInvite(this);
|
player->SetGroupInvite(this);
|
||||||
|
|
||||||
|
|
@ -231,14 +231,7 @@ bool Group::AddLeaderInvite(Player *player)
|
||||||
|
|
||||||
uint32 Group::RemoveInvite(Player *player)
|
uint32 Group::RemoveInvite(Player *player)
|
||||||
{
|
{
|
||||||
for(InvitesList::iterator itr=m_invitees.begin(); itr!=m_invitees.end(); ++itr)
|
m_invitees.erase(player);
|
||||||
{
|
|
||||||
if((*itr) == player->GetGUID())
|
|
||||||
{
|
|
||||||
m_invitees.erase(itr);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
player->SetGroupInvite(NULL);
|
player->SetGroupInvite(NULL);
|
||||||
return GetMembersCount();
|
return GetMembersCount();
|
||||||
|
|
@ -247,14 +240,31 @@ uint32 Group::RemoveInvite(Player *player)
|
||||||
void Group::RemoveAllInvites()
|
void Group::RemoveAllInvites()
|
||||||
{
|
{
|
||||||
for(InvitesList::iterator itr=m_invitees.begin(); itr!=m_invitees.end(); ++itr)
|
for(InvitesList::iterator itr=m_invitees.begin(); itr!=m_invitees.end(); ++itr)
|
||||||
{
|
(*itr)->SetGroupInvite(NULL);
|
||||||
Player *invitee = objmgr.GetPlayer(*itr);
|
|
||||||
if(invitee)
|
|
||||||
invitee->SetGroupInvite(NULL);
|
|
||||||
}
|
|
||||||
m_invitees.clear();
|
m_invitees.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Player* Group::GetInvited(const uint64& guid) const
|
||||||
|
{
|
||||||
|
for(InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
|
||||||
|
{
|
||||||
|
if((*itr)->GetGUID() == guid)
|
||||||
|
return (*itr);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
Player* Group::GetInvited(const std::string& name) const
|
||||||
|
{
|
||||||
|
for(InvitesList::const_iterator itr = m_invitees.begin(); itr != m_invitees.end(); ++itr)
|
||||||
|
{
|
||||||
|
if((*itr)->GetName() == name)
|
||||||
|
return (*itr);
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
bool Group::AddMember(const uint64 &guid, const char* name)
|
bool Group::AddMember(const uint64 &guid, const char* name)
|
||||||
{
|
{
|
||||||
if(!_addMember(guid, name))
|
if(!_addMember(guid, name))
|
||||||
|
|
|
||||||
|
|
@ -144,7 +144,7 @@ class MANGOS_DLL_SPEC Group
|
||||||
typedef UNORDERED_MAP< uint32 /*mapId*/, InstanceGroupBind> BoundInstancesMap;
|
typedef UNORDERED_MAP< uint32 /*mapId*/, InstanceGroupBind> BoundInstancesMap;
|
||||||
protected:
|
protected:
|
||||||
typedef MemberSlotList::iterator member_witerator;
|
typedef MemberSlotList::iterator member_witerator;
|
||||||
typedef std::set<uint64> InvitesList;
|
typedef std::set<Player*> InvitesList;
|
||||||
|
|
||||||
typedef std::vector<Roll*> Rolls;
|
typedef std::vector<Roll*> Rolls;
|
||||||
|
|
||||||
|
|
@ -184,6 +184,17 @@ class MANGOS_DLL_SPEC Group
|
||||||
// member manipulation methods
|
// member manipulation methods
|
||||||
bool IsMember(const uint64& guid) const { return _getMemberCSlot(guid) != m_memberSlots.end(); }
|
bool IsMember(const uint64& guid) const { return _getMemberCSlot(guid) != m_memberSlots.end(); }
|
||||||
bool IsLeader(const uint64& guid) const { return (GetLeaderGUID() == guid); }
|
bool IsLeader(const uint64& guid) const { return (GetLeaderGUID() == guid); }
|
||||||
|
uint64 GetMemberGUID(const std::string& name)
|
||||||
|
{
|
||||||
|
for(member_citerator itr = m_memberSlots.begin(); itr != m_memberSlots.end(); ++itr)
|
||||||
|
{
|
||||||
|
if(itr->name == name)
|
||||||
|
{
|
||||||
|
return itr->guid;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
bool IsAssistant(uint64 guid) const
|
bool IsAssistant(uint64 guid) const
|
||||||
{
|
{
|
||||||
member_citerator mslot = _getMemberCSlot(guid);
|
member_citerator mslot = _getMemberCSlot(guid);
|
||||||
|
|
@ -192,6 +203,8 @@ class MANGOS_DLL_SPEC Group
|
||||||
|
|
||||||
return mslot->assistant;
|
return mslot->assistant;
|
||||||
}
|
}
|
||||||
|
Player* GetInvited(const uint64& guid) const;
|
||||||
|
Player* GetInvited(const std::string& name) const;
|
||||||
|
|
||||||
bool SameSubGroup(uint64 guid1,const uint64& guid2) const
|
bool SameSubGroup(uint64 guid1,const uint64& guid2) const
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@
|
||||||
-FIX sending PartyMemberStats
|
-FIX sending PartyMemberStats
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void WorldSession::SendPartyResult(PartyOperation operation, std::string member, PartyResult res)
|
void WorldSession::SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_PARTY_COMMAND_RESULT, (8+member.size()+1));
|
WorldPacket data(SMSG_PARTY_COMMAND_RESULT, (8+member.size()+1));
|
||||||
data << (uint32)operation;
|
data << (uint32)operation;
|
||||||
|
|
@ -246,17 +246,37 @@ void WorldSession::HandleGroupUninviteGuidOpcode(WorldPacket & recv_data)
|
||||||
uint64 guid;
|
uint64 guid;
|
||||||
recv_data >> guid;
|
recv_data >> guid;
|
||||||
|
|
||||||
if(_player->InBattleGround())
|
//can't uninvite yourself
|
||||||
|
if(guid == GetPlayer()->GetGUID())
|
||||||
{
|
{
|
||||||
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_INVITE_RESTRICTED);
|
sLog.outError("WorldSession::HandleGroupUninviteGuidOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string membername;
|
PartyResult res = GetPlayer()->CanUninviteFromGroup();
|
||||||
if(!objmgr.GetPlayerNameByGUID(guid, membername))
|
if(res != PARTY_RESULT_OK)
|
||||||
return; // not found
|
{
|
||||||
|
SendPartyResult(PARTY_OP_LEAVE, "", res);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
HandleGroupUninvite(guid, membername);
|
Group* grp = GetPlayer()->GetGroup();
|
||||||
|
if(!grp)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(grp->IsMember(guid))
|
||||||
|
{
|
||||||
|
Player::RemoveFromGroup(grp,guid);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(Player* plr = grp->GetInvited(guid))
|
||||||
|
{
|
||||||
|
plr->UninviteFromGroup();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
SendPartyResult(PARTY_OP_LEAVE, "", PARTY_RESULT_NOT_IN_YOUR_PARTY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleGroupUninviteNameOpcode(WorldPacket & recv_data)
|
void WorldSession::HandleGroupUninviteNameOpcode(WorldPacket & recv_data)
|
||||||
|
|
@ -266,65 +286,41 @@ void WorldSession::HandleGroupUninviteNameOpcode(WorldPacket & recv_data)
|
||||||
std::string membername;
|
std::string membername;
|
||||||
recv_data >> membername;
|
recv_data >> membername;
|
||||||
|
|
||||||
if(_player->InBattleGround())
|
|
||||||
{
|
|
||||||
SendPartyResult(PARTY_OP_INVITE, membername, PARTY_RESULT_INVITE_RESTRICTED);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// player not found
|
// player not found
|
||||||
if(!normalizePlayerName(membername))
|
if(!normalizePlayerName(membername))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
uint64 guid = objmgr.GetPlayerGUIDByName(membername);
|
// can't uninvite yourself
|
||||||
|
if(GetPlayer()->GetName() == membername)
|
||||||
// player not found
|
|
||||||
if(!guid)
|
|
||||||
return;
|
|
||||||
|
|
||||||
HandleGroupUninvite(guid, membername);
|
|
||||||
}
|
|
||||||
|
|
||||||
void WorldSession::HandleGroupUninvite(uint64 guid, std::string name)
|
|
||||||
{
|
|
||||||
Group *group = GetPlayer()->GetGroup();
|
|
||||||
if(!group)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if(_player->InBattleGround())
|
|
||||||
{
|
{
|
||||||
SendPartyResult(PARTY_OP_INVITE, "", PARTY_RESULT_INVITE_RESTRICTED);
|
sLog.outError("WorldSession::HandleGroupUninviteNameOpcode: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Player *player = objmgr.GetPlayer(guid);
|
PartyResult res = GetPlayer()->CanUninviteFromGroup();
|
||||||
|
if(res != PARTY_RESULT_OK)
|
||||||
/** error handling **/
|
|
||||||
if(!group->IsLeader(GetPlayer()->GetGUID()) && !group->IsAssistant(GetPlayer()->GetGUID()))
|
|
||||||
{
|
{
|
||||||
SendPartyResult(PARTY_OP_LEAVE, "", PARTY_RESULT_YOU_NOT_LEADER);
|
SendPartyResult(PARTY_OP_LEAVE, "", res);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!group->IsMember(guid) && (player && player->GetGroupInvite() != group))
|
Group* grp = GetPlayer()->GetGroup();
|
||||||
|
if(!grp)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if(uint64 guid = grp->GetMemberGUID(membername))
|
||||||
{
|
{
|
||||||
SendPartyResult(PARTY_OP_LEAVE, name, PARTY_RESULT_NOT_IN_YOUR_PARTY);
|
Player::RemoveFromGroup(grp,guid);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(guid == GetPlayer()->GetGUID())
|
if(Player* plr = grp->GetInvited(membername))
|
||||||
{
|
{
|
||||||
sLog.outError("WorldSession::HandleGroupUninvite: leader %s(%d) tried to uninvite himself from the group.", GetPlayer()->GetName(), GetPlayer()->GetGUIDLow());
|
plr->UninviteFromGroup();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/********************/
|
|
||||||
|
|
||||||
// everything's fine, do it
|
SendPartyResult(PARTY_OP_LEAVE, membername, PARTY_RESULT_NOT_IN_YOUR_PARTY);
|
||||||
|
|
||||||
if(player && player->GetGroupInvite()) // uninvite invitee
|
|
||||||
player->UninviteFromGroup();
|
|
||||||
else // uninvite member
|
|
||||||
Player::RemoveFromGroup(group,guid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
|
void WorldSession::HandleGroupSetLeaderOpcode( WorldPacket & recv_data )
|
||||||
|
|
|
||||||
|
|
@ -517,7 +517,7 @@ void Guild::SetOFFNOTE(uint64 guid,std::string offnote)
|
||||||
CharacterDatabase.PExecute("UPDATE guild_member SET offnote = '%s' WHERE guid = '%u'", offnote.c_str(), itr->first);
|
CharacterDatabase.PExecute("UPDATE guild_member SET offnote = '%s' WHERE guid = '%u'", offnote.c_str(), itr->first);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::BroadcastToGuild(WorldSession *session, std::string msg, uint32 language)
|
void Guild::BroadcastToGuild(WorldSession *session, const std::string& msg, uint32 language)
|
||||||
{
|
{
|
||||||
if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(),GR_RIGHT_GCHATSPEAK))
|
if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(),GR_RIGHT_GCHATSPEAK))
|
||||||
{
|
{
|
||||||
|
|
@ -534,7 +534,7 @@ void Guild::BroadcastToGuild(WorldSession *session, std::string msg, uint32 lang
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::BroadcastToOfficers(WorldSession *session, std::string msg, uint32 language)
|
void Guild::BroadcastToOfficers(WorldSession *session, const std::string& msg, uint32 language)
|
||||||
{
|
{
|
||||||
if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(),GR_RIGHT_OFFCHATSPEAK))
|
if (session && session->GetPlayer() && HasRankRight(session->GetPlayer()->GetRank(),GR_RIGHT_OFFCHATSPEAK))
|
||||||
{
|
{
|
||||||
|
|
@ -593,7 +593,7 @@ void Guild::CreateRank(std::string name_,uint32 rights)
|
||||||
CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", Id, m_ranks.size(), name_.c_str(), rights );
|
CharacterDatabase.PExecute( "INSERT INTO guild_rank (guildid,rid,rname,rights) VALUES ('%u', '%u', '%s', '%u')", Id, m_ranks.size(), name_.c_str(), rights );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Guild::AddRank(std::string name_,uint32 rights, uint32 money)
|
void Guild::AddRank(const std::string& name_,uint32 rights, uint32 money)
|
||||||
{
|
{
|
||||||
m_ranks.push_back(RankInfo(name_,rights,money));
|
m_ranks.push_back(RankInfo(name_,rights,money));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,7 @@ struct MemberSlot
|
||||||
|
|
||||||
struct RankInfo
|
struct RankInfo
|
||||||
{
|
{
|
||||||
RankInfo(std::string _name, uint32 _rights, uint32 _money) : name(_name), rights(_rights), BankMoneyPerDay(_money)
|
RankInfo(const std::string& _name, uint32 _rights, uint32 _money) : name(_name), rights(_rights), BankMoneyPerDay(_money)
|
||||||
{
|
{
|
||||||
for(uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
|
for(uint8 i = 0; i < GUILD_BANK_MAX_TABS; ++i)
|
||||||
{
|
{
|
||||||
|
|
@ -310,8 +310,8 @@ class Guild
|
||||||
bool FillPlayerData(uint64 guid, MemberSlot* memslot);
|
bool FillPlayerData(uint64 guid, MemberSlot* memslot);
|
||||||
void LoadPlayerStatsByGuid(uint64 guid);
|
void LoadPlayerStatsByGuid(uint64 guid);
|
||||||
|
|
||||||
void BroadcastToGuild(WorldSession *session, std::string msg, uint32 language = LANG_UNIVERSAL);
|
void BroadcastToGuild(WorldSession *session, const std::string& msg, uint32 language = LANG_UNIVERSAL);
|
||||||
void BroadcastToOfficers(WorldSession *session, std::string msg, uint32 language = LANG_UNIVERSAL);
|
void BroadcastToOfficers(WorldSession *session, const std::string& msg, uint32 language = LANG_UNIVERSAL);
|
||||||
void BroadcastPacketToRank(WorldPacket *packet, uint32 rankId);
|
void BroadcastPacketToRank(WorldPacket *packet, uint32 rankId);
|
||||||
void BroadcastPacket(WorldPacket *packet);
|
void BroadcastPacket(WorldPacket *packet);
|
||||||
|
|
||||||
|
|
@ -332,7 +332,7 @@ class Guild
|
||||||
{
|
{
|
||||||
return (members.find(LowGuid) != members.end());
|
return (members.find(LowGuid) != members.end());
|
||||||
}
|
}
|
||||||
MemberSlot* GetMemberSlot(std::string const& name, uint64& guid)
|
MemberSlot* GetMemberSlot(const std::string& name, uint64& guid)
|
||||||
{
|
{
|
||||||
for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
for(MemberList::iterator itr = members.begin(); itr != members.end(); ++itr)
|
||||||
{
|
{
|
||||||
|
|
@ -408,7 +408,7 @@ class Guild
|
||||||
bool AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry );
|
bool AddGBankItemToDB(uint32 GuildId, uint32 BankTab , uint32 BankTabSlot , uint32 GUIDLow, uint32 Entry );
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void AddRank(std::string name,uint32 rights,uint32 money);
|
void AddRank(const std::string& name,uint32 rights,uint32 money);
|
||||||
|
|
||||||
uint32 Id;
|
uint32 Id;
|
||||||
std::string name;
|
std::string name;
|
||||||
|
|
|
||||||
|
|
@ -730,7 +730,7 @@ void WorldSession::HandleGuildDelRankOpcode(WorldPacket& /*recvPacket*/)
|
||||||
guild->Roster(this);
|
guild->Roster(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendGuildCommandResult(uint32 typecmd,std::string str,uint32 cmdresult)
|
void WorldSession::SendGuildCommandResult(uint32 typecmd, const std::string& str,uint32 cmdresult)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_GUILD_COMMAND_RESULT, (8+str.size()+1));
|
WorldPacket data(SMSG_GUILD_COMMAND_RESULT, (8+str.size()+1));
|
||||||
data << typecmd;
|
data << typecmd;
|
||||||
|
|
|
||||||
|
|
@ -352,7 +352,7 @@ void WorldSession::HandleReturnToSender(WorldPacket & recv_data )
|
||||||
pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, 0);
|
pl->SendMailResult(mailId, MAIL_RETURNED_TO_SENDER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId )
|
void WorldSession::SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, const std::string& subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId )
|
||||||
{
|
{
|
||||||
if(messageType != MAIL_NORMAL) // return only to players
|
if(messageType != MAIL_NORMAL) // return only to players
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -318,10 +318,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetPlayer()->m_lastFallTime >= movementInfo.fallTime || GetPlayer()->m_lastFallZ <=movementInfo.z)
|
if (GetPlayer()->m_lastFallTime >= movementInfo.fallTime || GetPlayer()->m_lastFallZ <=movementInfo.z)
|
||||||
{
|
GetPlayer()->SetFallInformation(movementInfo.fallTime, movementInfo.z);
|
||||||
GetPlayer()->m_lastFallTime = movementInfo.fallTime;
|
|
||||||
GetPlayer()->m_lastFallZ= movementInfo.z;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(GetPlayer()->isMovingOrTurning())
|
if(GetPlayer()->isMovingOrTurning())
|
||||||
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
GetPlayer()->RemoveSpellsCausingAura(SPELL_AURA_FEIGN_DEATH);
|
||||||
|
|
|
||||||
|
|
@ -114,7 +114,7 @@ void WorldSession::SendTrainerList( uint64 guid )
|
||||||
SendTrainerList( guid, str );
|
SendTrainerList( guid, str );
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendTrainerList( uint64 guid,std::string strTitle )
|
void WorldSession::SendTrainerList( uint64 guid, const std::string& strTitle )
|
||||||
{
|
{
|
||||||
sLog.outDebug( "WORLD: SendTrainerList" );
|
sLog.outDebug( "WORLD: SendTrainerList" );
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -407,7 +407,7 @@ class MANGOS_DLL_SPEC WorldObject : public Object
|
||||||
InstanceData* GetInstanceData();
|
InstanceData* GetInstanceData();
|
||||||
|
|
||||||
const char* GetName() const { return m_name.c_str(); }
|
const char* GetName() const { return m_name.c_str(); }
|
||||||
void SetName(std::string newname) { m_name=newname; }
|
void SetName(const std::string& newname) { m_name=newname; }
|
||||||
|
|
||||||
virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); }
|
virtual const char* GetNameForLocaleIdx(int32 /*locale_idx*/) const { return GetName(); }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ Guild * ObjectMgr::GetGuildById(const uint32 GuildId) const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Guild * ObjectMgr::GetGuildByName(std::string guildname) const
|
Guild * ObjectMgr::GetGuildByName(const std::string& guildname) const
|
||||||
{
|
{
|
||||||
for(GuildSet::const_iterator itr = mGuildSet.begin(); itr != mGuildSet.end(); ++itr)
|
for(GuildSet::const_iterator itr = mGuildSet.begin(); itr != mGuildSet.end(); ++itr)
|
||||||
if ((*itr)->GetName() == guildname)
|
if ((*itr)->GetName() == guildname)
|
||||||
|
|
@ -236,7 +236,7 @@ ArenaTeam* ObjectMgr::GetArenaTeamById(const uint32 ArenaTeamId) const
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArenaTeam* ObjectMgr::GetArenaTeamByName(std::string arenateamname) const
|
ArenaTeam* ObjectMgr::GetArenaTeamByName(const std::string& arenateamname) const
|
||||||
{
|
{
|
||||||
for(ArenaTeamSet::const_iterator itr = mArenaTeamSet.begin(); itr != mArenaTeamSet.end(); ++itr)
|
for(ArenaTeamSet::const_iterator itr = mArenaTeamSet.begin(); itr != mArenaTeamSet.end(); ++itr)
|
||||||
if ((*itr)->GetName() == arenateamname)
|
if ((*itr)->GetName() == arenateamname)
|
||||||
|
|
@ -1433,7 +1433,7 @@ uint32 ObjectMgr::GetPlayerAccountIdByGUID(const uint64 &guid) const
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 ObjectMgr::GetPlayerAccountIdByPlayerName(std::string name) const
|
uint32 ObjectMgr::GetPlayerAccountIdByPlayerName(const std::string& name) const
|
||||||
{
|
{
|
||||||
QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", name.c_str());
|
QueryResult *result = CharacterDatabase.PQuery("SELECT account FROM characters WHERE name = '%s'", name.c_str());
|
||||||
if(result)
|
if(result)
|
||||||
|
|
@ -6198,7 +6198,7 @@ bool isValidString(std::wstring wstr, uint32 strictMask, bool numericOrSpace, bo
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::IsValidName( std::string name, bool create )
|
bool ObjectMgr::IsValidName( const std::string& name, bool create )
|
||||||
{
|
{
|
||||||
std::wstring wname;
|
std::wstring wname;
|
||||||
if(!Utf8toWStr(name,wname))
|
if(!Utf8toWStr(name,wname))
|
||||||
|
|
@ -6212,7 +6212,7 @@ bool ObjectMgr::IsValidName( std::string name, bool create )
|
||||||
return isValidString(wname,strictMask,false,create);
|
return isValidString(wname,strictMask,false,create);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::IsValidCharterName( std::string name )
|
bool ObjectMgr::IsValidCharterName( const std::string& name )
|
||||||
{
|
{
|
||||||
std::wstring wname;
|
std::wstring wname;
|
||||||
if(!Utf8toWStr(name,wname))
|
if(!Utf8toWStr(name,wname))
|
||||||
|
|
@ -6226,7 +6226,7 @@ bool ObjectMgr::IsValidCharterName( std::string name )
|
||||||
return isValidString(wname,strictMask,true);
|
return isValidString(wname,strictMask,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::IsValidPetName( std::string name )
|
bool ObjectMgr::IsValidPetName( const std::string& name )
|
||||||
{
|
{
|
||||||
std::wstring wname;
|
std::wstring wname;
|
||||||
if(!Utf8toWStr(name,wname))
|
if(!Utf8toWStr(name,wname))
|
||||||
|
|
@ -6872,7 +6872,7 @@ void ObjectMgr::LoadGameTele()
|
||||||
sLog.outString( ">> Loaded %u game tele's", count );
|
sLog.outString( ">> Loaded %u game tele's", count );
|
||||||
}
|
}
|
||||||
|
|
||||||
GameTele const* ObjectMgr::GetGameTele(std::string name) const
|
GameTele const* ObjectMgr::GetGameTele(const std::string& name) const
|
||||||
{
|
{
|
||||||
// explicit name case
|
// explicit name case
|
||||||
std::wstring wname;
|
std::wstring wname;
|
||||||
|
|
@ -6915,7 +6915,7 @@ bool ObjectMgr::AddGameTele(GameTele& tele)
|
||||||
new_id,tele.position_x,tele.position_y,tele.position_z,tele.orientation,tele.mapId,tele.name.c_str());
|
new_id,tele.position_x,tele.position_y,tele.position_z,tele.orientation,tele.mapId,tele.name.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ObjectMgr::DeleteGameTele(std::string name)
|
bool ObjectMgr::DeleteGameTele(const std::string& name)
|
||||||
{
|
{
|
||||||
// explicit name case
|
// explicit name case
|
||||||
std::wstring wname;
|
std::wstring wname;
|
||||||
|
|
@ -7323,7 +7323,7 @@ uint32 ObjectMgr::GetScriptId(const char *name)
|
||||||
if(!name) return 0;
|
if(!name) return 0;
|
||||||
ScriptNameMap::const_iterator itr =
|
ScriptNameMap::const_iterator itr =
|
||||||
std::lower_bound(m_scriptNames.begin(), m_scriptNames.end(), name);
|
std::lower_bound(m_scriptNames.begin(), m_scriptNames.end(), name);
|
||||||
if(itr == m_scriptNames.end()) return 0;
|
if(itr == m_scriptNames.end() || *itr != name) return 0;
|
||||||
return itr - m_scriptNames.begin();
|
return itr - m_scriptNames.begin();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -315,13 +315,13 @@ class ObjectMgr
|
||||||
|
|
||||||
Guild* GetGuildByLeader(uint64 const&guid) const;
|
Guild* GetGuildByLeader(uint64 const&guid) const;
|
||||||
Guild* GetGuildById(const uint32 GuildId) const;
|
Guild* GetGuildById(const uint32 GuildId) const;
|
||||||
Guild* GetGuildByName(std::string guildname) const;
|
Guild* GetGuildByName(const std::string& guildname) const;
|
||||||
std::string GetGuildNameById(const uint32 GuildId) const;
|
std::string GetGuildNameById(const uint32 GuildId) const;
|
||||||
void AddGuild(Guild* guild) { mGuildSet.insert( guild ); }
|
void AddGuild(Guild* guild) { mGuildSet.insert( guild ); }
|
||||||
void RemoveGuild(Guild* guild) { mGuildSet.erase( guild ); }
|
void RemoveGuild(Guild* guild) { mGuildSet.erase( guild ); }
|
||||||
|
|
||||||
ArenaTeam* GetArenaTeamById(const uint32 ArenaTeamId) const;
|
ArenaTeam* GetArenaTeamById(const uint32 ArenaTeamId) const;
|
||||||
ArenaTeam* GetArenaTeamByName(std::string ArenaTeamName) const;
|
ArenaTeam* GetArenaTeamByName(const std::string& ArenaTeamName) const;
|
||||||
ArenaTeam* GetArenaTeamByCapitan(uint64 const& guid) const;
|
ArenaTeam* GetArenaTeamByCapitan(uint64 const& guid) const;
|
||||||
void AddArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.insert( arenateam ); }
|
void AddArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.insert( arenateam ); }
|
||||||
void RemoveArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.erase( arenateam ); }
|
void RemoveArenaTeam(ArenaTeam* arenateam) { mArenaTeamSet.erase( arenateam ); }
|
||||||
|
|
@ -407,7 +407,7 @@ class ObjectMgr
|
||||||
bool GetPlayerNameByGUID(const uint64 &guid, std::string &name) const;
|
bool GetPlayerNameByGUID(const uint64 &guid, std::string &name) const;
|
||||||
uint32 GetPlayerTeamByGUID(const uint64 &guid) const;
|
uint32 GetPlayerTeamByGUID(const uint64 &guid) const;
|
||||||
uint32 GetPlayerAccountIdByGUID(const uint64 &guid) const;
|
uint32 GetPlayerAccountIdByGUID(const uint64 &guid) const;
|
||||||
uint32 GetPlayerAccountIdByPlayerName(std::string name) const;
|
uint32 GetPlayerAccountIdByPlayerName(const std::string& name) const;
|
||||||
|
|
||||||
uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid );
|
uint32 GetNearestTaxiNode( float x, float y, float z, uint32 mapid );
|
||||||
void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost);
|
void GetTaxiPath( uint32 source, uint32 destination, uint32 &path, uint32 &cost);
|
||||||
|
|
@ -701,15 +701,15 @@ class ObjectMgr
|
||||||
|
|
||||||
// reserved names
|
// reserved names
|
||||||
void LoadReservedPlayersNames();
|
void LoadReservedPlayersNames();
|
||||||
bool IsReservedName(std::string name) const
|
bool IsReservedName(const std::string& name) const
|
||||||
{
|
{
|
||||||
return m_ReservedNames.find(name) != m_ReservedNames.end();
|
return m_ReservedNames.find(name) != m_ReservedNames.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
// name with valid structure and symbols
|
// name with valid structure and symbols
|
||||||
static bool IsValidName( std::string name, bool create = false );
|
static bool IsValidName( const std::string& name, bool create = false );
|
||||||
static bool IsValidCharterName( std::string name );
|
static bool IsValidCharterName( const std::string& name );
|
||||||
static bool IsValidPetName( std::string name );
|
static bool IsValidPetName( const std::string& name );
|
||||||
|
|
||||||
static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names);
|
static bool CheckDeclinedNames(std::wstring mainpart, DeclinedName const& names);
|
||||||
|
|
||||||
|
|
@ -733,10 +733,10 @@ class ObjectMgr
|
||||||
if(itr==m_GameTeleMap.end()) return NULL;
|
if(itr==m_GameTeleMap.end()) return NULL;
|
||||||
return &itr->second;
|
return &itr->second;
|
||||||
}
|
}
|
||||||
GameTele const* GetGameTele(std::string name) const;
|
GameTele const* GetGameTele(const std::string& name) const;
|
||||||
GameTeleMap const& GetGameTeleMap() const { return m_GameTeleMap; }
|
GameTeleMap const& GetGameTeleMap() const { return m_GameTeleMap; }
|
||||||
bool AddGameTele(GameTele& data);
|
bool AddGameTele(GameTele& data);
|
||||||
bool DeleteGameTele(std::string name);
|
bool DeleteGameTele(const std::string& name);
|
||||||
|
|
||||||
CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; }
|
CacheNpcOptionList const& GetNpcOptions() const { return m_mCacheNpcOptionList; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -672,7 +672,7 @@ void WorldSession::HandlePetCastSpellOpcode( WorldPacket& recvPacket )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::SendPetNameInvalid(uint32 error, std::string name, DeclinedName *declinedName)
|
void WorldSession::SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_PET_NAME_INVALID, 4 + name.size() + 1 + 1);
|
WorldPacket data(SMSG_PET_NAME_INVALID, 4 + name.size() + 1 + 1);
|
||||||
data << uint32(error);
|
data << uint32(error);
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,7 @@ void PlayerTaxi::AppendTaximaskTo( ByteBuffer& data, bool all )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool PlayerTaxi::LoadTaxiDestinationsFromString( std::string values )
|
bool PlayerTaxi::LoadTaxiDestinationsFromString( const std::string& values )
|
||||||
{
|
{
|
||||||
ClearTaxiDestinations();
|
ClearTaxiDestinations();
|
||||||
|
|
||||||
|
|
@ -488,7 +488,7 @@ void Player::CleanupsBeforeDelete()
|
||||||
Unit::CleanupsBeforeDelete();
|
Unit::CleanupsBeforeDelete();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::Create( uint32 guidlow, std::string name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId )
|
bool Player::Create( uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId )
|
||||||
{
|
{
|
||||||
//FIXME: outfitId not used in player creating
|
//FIXME: outfitId not used in player creating
|
||||||
|
|
||||||
|
|
@ -1549,6 +1549,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||||
else
|
else
|
||||||
// this will be used instead of the current location in SaveToDB
|
// this will be used instead of the current location in SaveToDB
|
||||||
m_teleport_dest = WorldLocation(mapid, x, y, z, orientation);
|
m_teleport_dest = WorldLocation(mapid, x, y, z, orientation);
|
||||||
|
SetFallInformation(0, z);
|
||||||
|
|
||||||
//BuildHeartBeatMsg(&data);
|
//BuildHeartBeatMsg(&data);
|
||||||
//SendMessageToSet(&data, true);
|
//SendMessageToSet(&data, true);
|
||||||
|
|
@ -1696,6 +1697,7 @@ bool Player::TeleportTo(uint32 mapid, float x, float y, float z, float orientati
|
||||||
}
|
}
|
||||||
|
|
||||||
m_teleport_dest = WorldLocation(mapid, final_x, final_y, final_z, final_o);
|
m_teleport_dest = WorldLocation(mapid, final_x, final_y, final_z, final_o);
|
||||||
|
SetFallInformation(0, final_z);
|
||||||
// if the player is saved before worldportack (at logout for example)
|
// if the player is saved before worldportack (at logout for example)
|
||||||
// this will be used instead of the current location in SaveToDB
|
// this will be used instead of the current location in SaveToDB
|
||||||
|
|
||||||
|
|
@ -2033,23 +2035,23 @@ bool Player::IsInSameGroupWith(Player const* p) const
|
||||||
/// \todo Shouldn't we also check if there is no other invitees before disbanding the group?
|
/// \todo Shouldn't we also check if there is no other invitees before disbanding the group?
|
||||||
void Player::UninviteFromGroup()
|
void Player::UninviteFromGroup()
|
||||||
{
|
{
|
||||||
if(GetGroupInvite()) // uninvited invitee
|
Group* group = GetGroupInvite();
|
||||||
|
if(!group)
|
||||||
|
return;
|
||||||
|
|
||||||
|
group->RemoveInvite(this);
|
||||||
|
|
||||||
|
if(group->GetMembersCount() <= 1) // group has just 1 member => disband
|
||||||
{
|
{
|
||||||
Group* group = GetGroupInvite();
|
if(group->IsCreated())
|
||||||
group->RemoveInvite(this);
|
|
||||||
|
|
||||||
if(group->GetMembersCount() <= 1) // group has just 1 member => disband
|
|
||||||
{
|
{
|
||||||
if(group->IsCreated())
|
group->Disband(true);
|
||||||
{
|
objmgr.RemoveGroup(group);
|
||||||
group->Disband(true);
|
|
||||||
objmgr.RemoveGroup(group);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
group->RemoveAllInvites();
|
|
||||||
|
|
||||||
delete group;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
group->RemoveAllInvites();
|
||||||
|
|
||||||
|
delete group;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -13811,6 +13813,7 @@ bool Player::LoadFromDB( uint32 guid, SqlQueryHolder *holder )
|
||||||
|
|
||||||
uint32 transGUID = fields[24].GetUInt32();
|
uint32 transGUID = fields[24].GetUInt32();
|
||||||
Relocate(fields[6].GetFloat(),fields[7].GetFloat(),fields[8].GetFloat(),fields[10].GetFloat());
|
Relocate(fields[6].GetFloat(),fields[7].GetFloat(),fields[8].GetFloat(),fields[10].GetFloat());
|
||||||
|
SetFallInformation(0, fields[8].GetFloat());
|
||||||
SetMapId(fields[9].GetUInt32());
|
SetMapId(fields[9].GetUInt32());
|
||||||
SetDifficulty(fields[32].GetUInt32()); // may be changed in _LoadGroup
|
SetDifficulty(fields[32].GetUInt32()); // may be changed in _LoadGroup
|
||||||
|
|
||||||
|
|
@ -16111,7 +16114,7 @@ void Player::Uncharm()
|
||||||
charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
|
charm->RemoveSpellsCausingAura(SPELL_AURA_MOD_POSSESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text, uint32 language) const
|
void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const
|
||||||
{
|
{
|
||||||
*data << (uint8)msgtype;
|
*data << (uint8)msgtype;
|
||||||
*data << (uint32)language;
|
*data << (uint32)language;
|
||||||
|
|
@ -16123,28 +16126,28 @@ void Player::BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text,
|
||||||
*data << (uint8)chatTag();
|
*data << (uint8)chatTag();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Say(const std::string text, const uint32 language)
|
void Player::Say(const std::string& text, const uint32 language)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||||
BuildPlayerChat(&data, CHAT_MSG_SAY, text, language);
|
BuildPlayerChat(&data, CHAT_MSG_SAY, text, language);
|
||||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true);
|
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_SAY),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Yell(const std::string text, const uint32 language)
|
void Player::Yell(const std::string& text, const uint32 language)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||||
BuildPlayerChat(&data, CHAT_MSG_YELL, text, language);
|
BuildPlayerChat(&data, CHAT_MSG_YELL, text, language);
|
||||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true);
|
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_YELL),true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::TextEmote(const std::string text)
|
void Player::TextEmote(const std::string& text)
|
||||||
{
|
{
|
||||||
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
WorldPacket data(SMSG_MESSAGECHAT, 200);
|
||||||
BuildPlayerChat(&data, CHAT_MSG_EMOTE, text, LANG_UNIVERSAL);
|
BuildPlayerChat(&data, CHAT_MSG_EMOTE, text, LANG_UNIVERSAL);
|
||||||
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) );
|
SendMessageToSetInRange(&data,sWorld.getConfig(CONFIG_LISTEN_RANGE_TEXTEMOTE),true, !sWorld.getConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_CHAT) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::Whisper(std::string text, uint32 language,uint64 receiver)
|
void Player::Whisper(const std::string& text, uint32 language,uint64 receiver)
|
||||||
{
|
{
|
||||||
if (language != LANG_ADDON) // if not addon data
|
if (language != LANG_ADDON) // if not addon data
|
||||||
language = LANG_UNIVERSAL; // whispers should always be readable
|
language = LANG_UNIVERSAL; // whispers should always be readable
|
||||||
|
|
@ -18630,6 +18633,21 @@ Player* Player::GetNextRandomRaidMember(float radius)
|
||||||
return nearMembers[randTarget];
|
return nearMembers[randTarget];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PartyResult Player::CanUninviteFromGroup() const
|
||||||
|
{
|
||||||
|
const Group* grp = GetGroup();
|
||||||
|
if(!grp)
|
||||||
|
return PARTY_RESULT_YOU_NOT_IN_GROUP;
|
||||||
|
|
||||||
|
if(!grp->IsLeader(GetGUID()) && !grp->IsAssistant(GetGUID()))
|
||||||
|
return PARTY_RESULT_YOU_NOT_LEADER;
|
||||||
|
|
||||||
|
if(InBattleGround())
|
||||||
|
return PARTY_RESULT_INVITE_RESTRICTED;
|
||||||
|
|
||||||
|
return PARTY_RESULT_OK;
|
||||||
|
}
|
||||||
|
|
||||||
void Player::UpdateUnderwaterState( Map* m, float x, float y, float z )
|
void Player::UpdateUnderwaterState( Map* m, float x, float y, float z )
|
||||||
{
|
{
|
||||||
float water_z = m->GetWaterLevel(x,y);
|
float water_z = m->GetWaterLevel(x,y);
|
||||||
|
|
|
||||||
|
|
@ -921,7 +921,7 @@ class MANGOS_DLL_SPEC PlayerTaxi
|
||||||
void AppendTaximaskTo(ByteBuffer& data,bool all);
|
void AppendTaximaskTo(ByteBuffer& data,bool all);
|
||||||
|
|
||||||
// Destinations
|
// Destinations
|
||||||
bool LoadTaxiDestinationsFromString(std::string values);
|
bool LoadTaxiDestinationsFromString(const std::string& values);
|
||||||
std::string SaveTaxiDestinationsToString();
|
std::string SaveTaxiDestinationsToString();
|
||||||
|
|
||||||
void ClearTaxiDestinations() { m_TaxiDestinations.clear(); }
|
void ClearTaxiDestinations() { m_TaxiDestinations.clear(); }
|
||||||
|
|
@ -974,7 +974,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
}
|
}
|
||||||
void SummonIfPossible(bool agree);
|
void SummonIfPossible(bool agree);
|
||||||
|
|
||||||
bool Create( uint32 guidlow, std::string name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId );
|
bool Create( uint32 guidlow, const std::string& name, uint8 race, uint8 class_, uint8 gender, uint8 skin, uint8 face, uint8 hairStyle, uint8 hairColor, uint8 facialHair, uint8 outfitId );
|
||||||
|
|
||||||
void Update( uint32 time );
|
void Update( uint32 time );
|
||||||
|
|
||||||
|
|
@ -1068,11 +1068,11 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
GuardianPetList const& GetGuardians() const { return m_guardianPets; }
|
GuardianPetList const& GetGuardians() const { return m_guardianPets; }
|
||||||
void Uncharm();
|
void Uncharm();
|
||||||
|
|
||||||
void Say(std::string text, const uint32 language);
|
void Say(const std::string& text, const uint32 language);
|
||||||
void Yell(std::string text, const uint32 language);
|
void Yell(const std::string& text, const uint32 language);
|
||||||
void TextEmote(std::string text);
|
void TextEmote(const std::string& text);
|
||||||
void Whisper(std::string text, const uint32 language,uint64 receiver);
|
void Whisper(const std::string& text, const uint32 language,uint64 receiver);
|
||||||
void BuildPlayerChat(WorldPacket *data, uint8 msgtype, std::string text, uint32 language) const;
|
void BuildPlayerChat(WorldPacket *data, uint8 msgtype, const std::string& text, uint32 language) const;
|
||||||
|
|
||||||
/*********************************************************/
|
/*********************************************************/
|
||||||
/*** STORAGE SYSTEM ***/
|
/*** STORAGE SYSTEM ***/
|
||||||
|
|
@ -1982,6 +1982,11 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
uint32 m_lastFallTime;
|
uint32 m_lastFallTime;
|
||||||
float m_lastFallZ;
|
float m_lastFallZ;
|
||||||
Unit *m_mover;
|
Unit *m_mover;
|
||||||
|
void SetFallInformation(uint32 time, float z)
|
||||||
|
{
|
||||||
|
m_lastFallTime = time;
|
||||||
|
m_lastFallZ = z;
|
||||||
|
}
|
||||||
bool isMoving() const { return HasUnitMovementFlag(movementFlagsMask); }
|
bool isMoving() const { return HasUnitMovementFlag(movementFlagsMask); }
|
||||||
bool isMovingOrTurning() const { return HasUnitMovementFlag(movementOrTurningFlagsMask); }
|
bool isMovingOrTurning() const { return HasUnitMovementFlag(movementOrTurningFlagsMask); }
|
||||||
|
|
||||||
|
|
@ -2095,6 +2100,7 @@ class MANGOS_DLL_SPEC Player : public Unit
|
||||||
uint64 GetAuraUpdateMask() { return m_auraUpdateMask; }
|
uint64 GetAuraUpdateMask() { return m_auraUpdateMask; }
|
||||||
void SetAuraUpdateMask(uint8 slot) { m_auraUpdateMask |= (uint64(1) << slot); }
|
void SetAuraUpdateMask(uint8 slot) { m_auraUpdateMask |= (uint64(1) << slot); }
|
||||||
Player* GetNextRandomRaidMember(float radius);
|
Player* GetNextRandomRaidMember(float radius);
|
||||||
|
PartyResult CanUninviteFromGroup() const;
|
||||||
|
|
||||||
GridReference<Player> &GetGridRef() { return m_gridRef; }
|
GridReference<Player> &GetGridRef() { return m_gridRef; }
|
||||||
MapReference &GetMapRef() { return m_mapRef; }
|
MapReference &GetMapRef() { return m_mapRef; }
|
||||||
|
|
|
||||||
|
|
@ -337,7 +337,7 @@ std::string PlayerDumpWriter::GetDump(uint32 guid)
|
||||||
return dump;
|
return dump;
|
||||||
}
|
}
|
||||||
|
|
||||||
DumpReturn PlayerDumpWriter::WriteDump(std::string file, uint32 guid)
|
DumpReturn PlayerDumpWriter::WriteDump(const std::string& file, uint32 guid)
|
||||||
{
|
{
|
||||||
FILE *fout = fopen(file.c_str(), "w");
|
FILE *fout = fopen(file.c_str(), "w");
|
||||||
if (!fout)
|
if (!fout)
|
||||||
|
|
@ -353,7 +353,7 @@ DumpReturn PlayerDumpWriter::WriteDump(std::string file, uint32 guid)
|
||||||
// Reading - High-level functions
|
// Reading - High-level functions
|
||||||
#define ROLLBACK(DR) {CharacterDatabase.RollbackTransaction(); fclose(fin); return (DR);}
|
#define ROLLBACK(DR) {CharacterDatabase.RollbackTransaction(); fclose(fin); return (DR);}
|
||||||
|
|
||||||
DumpReturn PlayerDumpReader::LoadDump(std::string file, uint32 account, std::string name, uint32 guid)
|
DumpReturn PlayerDumpReader::LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid)
|
||||||
{
|
{
|
||||||
// check character count
|
// check character count
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ class PlayerDumpWriter : public PlayerDump
|
||||||
PlayerDumpWriter() {}
|
PlayerDumpWriter() {}
|
||||||
|
|
||||||
std::string GetDump(uint32 guid);
|
std::string GetDump(uint32 guid);
|
||||||
DumpReturn WriteDump(std::string file, uint32 guid);
|
DumpReturn WriteDump(const std::string& file, uint32 guid);
|
||||||
private:
|
private:
|
||||||
typedef std::set<uint32> GUIDs;
|
typedef std::set<uint32> GUIDs;
|
||||||
|
|
||||||
|
|
@ -111,7 +111,7 @@ class PlayerDumpReader : public PlayerDump
|
||||||
public:
|
public:
|
||||||
PlayerDumpReader() {}
|
PlayerDumpReader() {}
|
||||||
|
|
||||||
DumpReturn LoadDump(std::string file, uint32 account, std::string name, uint32 guid);
|
DumpReturn LoadDump(const std::string& file, uint32 account, std::string name, uint32 guid);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -63,7 +63,7 @@ struct FriendInfo
|
||||||
Note = "";
|
Note = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
FriendInfo(uint32 flags, std::string note)
|
FriendInfo(uint32 flags, const std::string& note)
|
||||||
{
|
{
|
||||||
Status = FRIEND_STATUS_OFFLINE;
|
Status = FRIEND_STATUS_OFFLINE;
|
||||||
Flags = flags;
|
Flags = flags;
|
||||||
|
|
|
||||||
|
|
@ -2304,7 +2304,7 @@ void World::KickAllLess(AccountTypes sec)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Kick (and save) the designated player
|
/// Kick (and save) the designated player
|
||||||
bool World::KickPlayer(std::string playerName)
|
bool World::KickPlayer(const std::string& playerName)
|
||||||
{
|
{
|
||||||
SessionMap::iterator itr;
|
SessionMap::iterator itr;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -440,7 +440,7 @@ class World
|
||||||
bool IsPvPRealm() { return (getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP); }
|
bool IsPvPRealm() { return (getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_PVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_RPPVP || getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP); }
|
||||||
bool IsFFAPvPRealm() { return getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP; }
|
bool IsFFAPvPRealm() { return getConfig(CONFIG_GAME_TYPE) == REALM_TYPE_FFA_PVP; }
|
||||||
|
|
||||||
bool KickPlayer(std::string playerName);
|
bool KickPlayer(const std::string& playerName);
|
||||||
void KickAll();
|
void KickAll();
|
||||||
void KickAllLess(AccountTypes sec);
|
void KickAllLess(AccountTypes sec);
|
||||||
BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author);
|
BanReturn BanAccount(BanMode mode, std::string nameOrIP, std::string duration, std::string reason, std::string author);
|
||||||
|
|
|
||||||
|
|
@ -153,20 +153,11 @@ void WorldSession::logUnexpectedOpcode(WorldPacket* packet, const char *reason)
|
||||||
/// Update the WorldSession (triggered by World update)
|
/// Update the WorldSession (triggered by World update)
|
||||||
bool WorldSession::Update(uint32 /*diff*/)
|
bool WorldSession::Update(uint32 /*diff*/)
|
||||||
{
|
{
|
||||||
if (m_Socket && m_Socket->IsClosed ())
|
|
||||||
{
|
|
||||||
m_Socket->RemoveReference ();
|
|
||||||
m_Socket = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
WorldPacket *packet;
|
|
||||||
|
|
||||||
///- Retrieve packets from the receive queue and call the appropriate handlers
|
///- Retrieve packets from the receive queue and call the appropriate handlers
|
||||||
/// \todo Is there a way to consolidate the OpcondeHandlerTable and the g_worldOpcodeNames to only maintain 1 list?
|
/// not proccess packets if socket already closed
|
||||||
/// answer : there is a way, but this is better, because it would use redundant RAM
|
while (!_recvQueue.empty() && m_Socket && !m_Socket->IsClosed ())
|
||||||
while (!_recvQueue.empty())
|
|
||||||
{
|
{
|
||||||
packet = _recvQueue.next();
|
WorldPacket *packet = _recvQueue.next();
|
||||||
|
|
||||||
/*#if 1
|
/*#if 1
|
||||||
sLog.outError( "MOEP: %s (0x%.4X)",
|
sLog.outError( "MOEP: %s (0x%.4X)",
|
||||||
|
|
@ -226,6 +217,13 @@ bool WorldSession::Update(uint32 /*diff*/)
|
||||||
delete packet;
|
delete packet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///- Cleanup socket pointer if need
|
||||||
|
if (m_Socket && m_Socket->IsClosed ())
|
||||||
|
{
|
||||||
|
m_Socket->RemoveReference ();
|
||||||
|
m_Socket = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
///- If necessary, log the player out
|
///- If necessary, log the player out
|
||||||
time_t currTime = time(NULL);
|
time_t currTime = time(NULL);
|
||||||
if (!m_Socket || (ShouldLogOut(currTime) && !m_playerLoading))
|
if (!m_Socket || (ShouldLogOut(currTime) && !m_playerLoading))
|
||||||
|
|
|
||||||
|
|
@ -94,9 +94,9 @@ class MANGOS_DLL_SPEC WorldSession
|
||||||
void SendPacket(WorldPacket const* packet);
|
void SendPacket(WorldPacket const* packet);
|
||||||
void SendNotification(const char *format,...) ATTR_PRINTF(2,3);
|
void SendNotification(const char *format,...) ATTR_PRINTF(2,3);
|
||||||
void SendNotification(int32 string_id,...);
|
void SendNotification(int32 string_id,...);
|
||||||
void SendPetNameInvalid(uint32 error, std::string name, DeclinedName *declinedName);
|
void SendPetNameInvalid(uint32 error, const std::string& name, DeclinedName *declinedName);
|
||||||
void SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type);
|
void SendLfgResult(uint32 type, uint32 entry, uint8 lfg_type);
|
||||||
void SendPartyResult(PartyOperation operation, std::string member, PartyResult res);
|
void SendPartyResult(PartyOperation operation, const std::string& member, PartyResult res);
|
||||||
void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2,3);
|
void SendAreaTriggerMessage(const char* Text, ...) ATTR_PRINTF(2,3);
|
||||||
|
|
||||||
uint32 GetSecurity() const { return _security; }
|
uint32 GetSecurity() const { return _security; }
|
||||||
|
|
@ -141,7 +141,7 @@ class MANGOS_DLL_SPEC WorldSession
|
||||||
static void SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId);
|
static void SendNameQueryOpcodeFromDBCallBack(QueryResult *result, uint32 accountId);
|
||||||
|
|
||||||
void SendTrainerList( uint64 guid );
|
void SendTrainerList( uint64 guid );
|
||||||
void SendTrainerList( uint64 guid,std::string strTitle );
|
void SendTrainerList( uint64 guid, const std::string& strTitle );
|
||||||
void SendListInventory( uint64 guid );
|
void SendListInventory( uint64 guid );
|
||||||
void SendShowBank( uint64 guid );
|
void SendShowBank( uint64 guid );
|
||||||
void SendTabardVendorActivate( uint64 guid );
|
void SendTabardVendorActivate( uint64 guid );
|
||||||
|
|
@ -171,7 +171,7 @@ class MANGOS_DLL_SPEC WorldSession
|
||||||
//mail
|
//mail
|
||||||
//used with item_page table
|
//used with item_page table
|
||||||
bool SendItemInfo( uint32 itemid, WorldPacket data );
|
bool SendItemInfo( uint32 itemid, WorldPacket data );
|
||||||
static void SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, std::string subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId = 0);
|
static void SendReturnToSender(uint8 messageType, uint32 sender_acc, uint32 sender_guid, uint32 receiver_guid, const std::string& subject, uint32 itemTextId, MailItemsInfo *mi, uint32 money, uint16 mailTemplateId = 0);
|
||||||
static void SendMailTo(Player* receiver, uint8 messageType, uint8 stationery, uint32 sender_guidlow_or_entry, uint32 received_guidlow, std::string subject, uint32 itemTextId, MailItemsInfo* mi, uint32 money, uint32 COD, uint32 checked, uint32 deliver_delay = 0, uint16 mailTemplateId = 0);
|
static void SendMailTo(Player* receiver, uint8 messageType, uint8 stationery, uint32 sender_guidlow_or_entry, uint32 received_guidlow, std::string subject, uint32 itemTextId, MailItemsInfo* mi, uint32 money, uint32 COD, uint32 checked, uint32 deliver_delay = 0, uint16 mailTemplateId = 0);
|
||||||
|
|
||||||
//auction
|
//auction
|
||||||
|
|
@ -194,9 +194,9 @@ class MANGOS_DLL_SPEC WorldSession
|
||||||
bool SendLearnNewTaxiNode( Creature* unit );
|
bool SendLearnNewTaxiNode( Creature* unit );
|
||||||
|
|
||||||
// Guild/Arena Team
|
// Guild/Arena Team
|
||||||
void SendGuildCommandResult(uint32 typecmd,std::string str,uint32 cmdresult);
|
void SendGuildCommandResult(uint32 typecmd, const std::string& str, uint32 cmdresult);
|
||||||
void SendArenaTeamCommandResult(uint32 unk1, std::string str1, std::string str2, uint32 unk3);
|
void SendArenaTeamCommandResult(uint32 unk1, const std::string& str1, const std::string& str2, uint32 unk3);
|
||||||
void BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, std::string str1, std::string str2, std::string str3);
|
void BuildArenaTeamEventPacket(WorldPacket *data, uint8 eventid, uint8 str_count, const std::string& str1, const std::string& str2, const std::string& str3);
|
||||||
void SendNotInArenaTeamPacket(uint8 type);
|
void SendNotInArenaTeamPacket(uint8 type);
|
||||||
void SendPetitionShowList( uint64 guid );
|
void SendPetitionShowList( uint64 guid );
|
||||||
void SendSaveGuildEmblem( uint32 msg );
|
void SendSaveGuildEmblem( uint32 msg );
|
||||||
|
|
@ -352,7 +352,6 @@ class MANGOS_DLL_SPEC WorldSession
|
||||||
void HandleGroupDeclineOpcode(WorldPacket& recvPacket);
|
void HandleGroupDeclineOpcode(WorldPacket& recvPacket);
|
||||||
void HandleGroupUninviteNameOpcode(WorldPacket& recvPacket);
|
void HandleGroupUninviteNameOpcode(WorldPacket& recvPacket);
|
||||||
void HandleGroupUninviteGuidOpcode(WorldPacket& recvPacket);
|
void HandleGroupUninviteGuidOpcode(WorldPacket& recvPacket);
|
||||||
void HandleGroupUninvite(uint64 guid, std::string name);
|
|
||||||
void HandleGroupSetLeaderOpcode(WorldPacket& recvPacket);
|
void HandleGroupSetLeaderOpcode(WorldPacket& recvPacket);
|
||||||
void HandleGroupLeaveOpcode(WorldPacket& recvPacket);
|
void HandleGroupLeaveOpcode(WorldPacket& recvPacket);
|
||||||
void HandleGroupPassOnLootOpcode( WorldPacket &recv_data );
|
void HandleGroupPassOnLootOpcode( WorldPacket &recv_data );
|
||||||
|
|
|
||||||
|
|
@ -152,10 +152,9 @@ void WorldSocket::CloseSocket (void)
|
||||||
ACE_GUARD (LockType, Guard, m_OutBufferLock);
|
ACE_GUARD (LockType, Guard, m_OutBufferLock);
|
||||||
|
|
||||||
if (closing_)
|
if (closing_)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
closing_ = true;
|
closing_ = true;
|
||||||
|
|
||||||
peer ().close_writer ();
|
peer ().close_writer ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -301,7 +300,7 @@ int WorldSocket::handle_input (ACE_HANDLE)
|
||||||
if ((errno == EWOULDBLOCK) ||
|
if ((errno == EWOULDBLOCK) ||
|
||||||
(errno == EAGAIN))
|
(errno == EAGAIN))
|
||||||
{
|
{
|
||||||
return Update (); // interesting line ,isn't it ?
|
return Update (); // interesting line ,isn't it ?
|
||||||
}
|
}
|
||||||
|
|
||||||
DEBUG_LOG ("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
|
DEBUG_LOG ("WorldSocket::handle_input: Peer error closing connection errno = %s", ACE_OS::strerror (errno));
|
||||||
|
|
@ -319,7 +318,7 @@ int WorldSocket::handle_input (ACE_HANDLE)
|
||||||
case 1:
|
case 1:
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return Update (); // another interesting line ;)
|
return Update (); // another interesting line ;)
|
||||||
}
|
}
|
||||||
|
|
||||||
ACE_NOTREACHED(return -1);
|
ACE_NOTREACHED(return -1);
|
||||||
|
|
@ -513,7 +512,7 @@ int WorldSocket::handle_input_missing_data (void)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// We just received nice new header
|
// We just received nice new header
|
||||||
if (handle_input_header () == -1)
|
if (handle_input_header () == -1)
|
||||||
{
|
{
|
||||||
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
|
ACE_ASSERT ((errno != EWOULDBLOCK) && (errno != EAGAIN));
|
||||||
|
|
|
||||||
|
|
@ -298,7 +298,7 @@ void AuthSocket::OnRead()
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Make the SRP6 calculation from hash in dB
|
/// Make the SRP6 calculation from hash in dB
|
||||||
void AuthSocket::_SetVSFields(std::string rI)
|
void AuthSocket::_SetVSFields(const std::string& rI)
|
||||||
{
|
{
|
||||||
BigNumber I;
|
BigNumber I;
|
||||||
I.SetHexStr(rI.c_str());
|
I.SetHexStr(rI.c_str());
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class AuthSocket: public TcpSocket
|
||||||
bool _HandleXferCancel();
|
bool _HandleXferCancel();
|
||||||
bool _HandleXferAccept();
|
bool _HandleXferAccept();
|
||||||
|
|
||||||
void _SetVSFields(std::string rI);
|
void _SetVSFields(const std::string& rI);
|
||||||
|
|
||||||
FILE *pPatch;
|
FILE *pPatch;
|
||||||
ZThread::Mutex patcherLock;
|
ZThread::Mutex patcherLock;
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ void RealmList::Initialize(uint32 updateInterval)
|
||||||
UpdateRealms(true);
|
UpdateRealms(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RealmList::UpdateRealm( uint32 ID, std::string name, std::string address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu)
|
void RealmList::UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu)
|
||||||
{
|
{
|
||||||
///- Create new if not exist or update existed
|
///- Create new if not exist or update existed
|
||||||
Realm& realm = m_realms[name];
|
Realm& realm = m_realms[name];
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ class RealmList
|
||||||
uint32 size() const { return m_realms.size(); }
|
uint32 size() const { return m_realms.size(); }
|
||||||
private:
|
private:
|
||||||
void UpdateRealms(bool init);
|
void UpdateRealms(bool init);
|
||||||
void UpdateRealm( uint32 ID, std::string name, std::string address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu);
|
void UpdateRealm( uint32 ID, const std::string& name, const std::string& address, uint32 port, uint8 icon, uint8 color, uint8 timezone, AccountTypes allowedSecurityLevel, float popu);
|
||||||
private:
|
private:
|
||||||
RealmMap m_realms; ///< Internal map of realms
|
RealmMap m_realms; ///< Internal map of realms
|
||||||
uint32 m_UpdateInterval;
|
uint32 m_UpdateInterval;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ char const* localeNames[MAX_LOCALE] = {
|
||||||
"ruRU"
|
"ruRU"
|
||||||
};
|
};
|
||||||
|
|
||||||
LocaleConstant GetLocaleByName(std::string name)
|
LocaleConstant GetLocaleByName(const std::string& name)
|
||||||
{
|
{
|
||||||
for(uint32 i = 0; i < MAX_LOCALE; ++i)
|
for(uint32 i = 0; i < MAX_LOCALE; ++i)
|
||||||
if(name==localeNames[i])
|
if(name==localeNames[i])
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ enum LocaleConstant
|
||||||
|
|
||||||
extern char const* localeNames[MAX_LOCALE];
|
extern char const* localeNames[MAX_LOCALE];
|
||||||
|
|
||||||
LocaleConstant GetLocaleByName(std::string name);
|
LocaleConstant GetLocaleByName(const std::string& name);
|
||||||
|
|
||||||
// we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some pother platforms)
|
// we always use stdlibc++ std::max/std::min, undefine some not C++ standard defines (Win API and some pother platforms)
|
||||||
#ifdef max
|
#ifdef max
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,5 @@
|
||||||
#include "Common.h"
|
#include "Common.h"
|
||||||
#include "dotconfpp/dotconfpp.h"
|
#include "dotconfpp/dotconfpp.h"
|
||||||
#include "Config.h"
|
#include "Config.h"
|
||||||
#include "Log.h"
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,7 @@ DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore(WorldMapOverlayEntryfmt)
|
||||||
|
|
||||||
typedef std::list<std::string> StoreProblemList;
|
typedef std::list<std::string> StoreProblemList;
|
||||||
|
|
||||||
static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, std::string filename)
|
static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, const std::string& filename)
|
||||||
{
|
{
|
||||||
sLog.outError("ERROR: Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).",filename.c_str(),fsize,rsize);
|
sLog.outError("ERROR: Size of '%s' setted by format string (%u) not equal size of C++ structure (%u).",filename.c_str(),fsize,rsize);
|
||||||
|
|
||||||
|
|
@ -150,7 +150,7 @@ static bool LoadDBC_assert_print(uint32 fsize,uint32 rsize, std::string filename
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class T>
|
template<class T>
|
||||||
inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage<T>& storage, std::string dbc_path, std::string filename)
|
inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList& errlist, DBCStorage<T>& storage, const std::string& dbc_path, const std::string& filename)
|
||||||
{
|
{
|
||||||
// compatibility format and C++ structure sizes
|
// compatibility format and C++ structure sizes
|
||||||
assert(DBCFile::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFile::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename));
|
assert(DBCFile::GetFormatRecordSize(storage.GetFormat()) == sizeof(T) || LoadDBC_assert_print(DBCFile::GetFormatRecordSize(storage.GetFormat()),sizeof(T),filename));
|
||||||
|
|
@ -185,7 +185,7 @@ inline void LoadDBC(uint32& availableDbcLocales,barGoLink& bar, StoreProblemList
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadDBCStores(std::string dataPath)
|
void LoadDBCStores(const std::string& dataPath)
|
||||||
{
|
{
|
||||||
std::string dbcPath = dataPath+"dbc/";
|
std::string dbcPath = dataPath+"dbc/";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -208,7 +208,7 @@ extern DBCStorage <VehicleSeatEntry> sVehicleSeatStore;
|
||||||
extern DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore;
|
extern DBCStorage <WorldSafeLocsEntry> sWorldSafeLocsStore;
|
||||||
extern DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore;
|
extern DBCStorage <WorldMapOverlayEntry> sWorldMapOverlayStore;
|
||||||
|
|
||||||
void LoadDBCStores(std::string dataPath);
|
void LoadDBCStores(const std::string& dataPath);
|
||||||
|
|
||||||
// script support functions
|
// script support functions
|
||||||
MANGOS_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore();
|
MANGOS_DLL_SPEC DBCStorage <SoundEntriesEntry> const* GetSoundEntriesStore();
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ Log::Log() :
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Log::InitColors(std::string str)
|
void Log::InitColors(const std::string& str)
|
||||||
{
|
{
|
||||||
if(str.empty())
|
if(str.empty())
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -82,7 +82,7 @@ class Log : public MaNGOS::Singleton<Log, MaNGOS::ClassLevelLockable<Log, ZThrea
|
||||||
}
|
}
|
||||||
public:
|
public:
|
||||||
void Initialize();
|
void Initialize();
|
||||||
void InitColors(std::string init_str);
|
void InitColors(const std::string& init_str);
|
||||||
void outTitle( const char * str);
|
void outTitle( const char * str);
|
||||||
void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3,4);
|
void outCommand( uint32 account, const char * str, ...) ATTR_PRINTF(3,4);
|
||||||
void outString(); // any log level
|
void outString(); // any log level
|
||||||
|
|
|
||||||
|
|
@ -131,13 +131,13 @@ std::string secsToTimeString(uint32 timeInSecs, bool shortText, bool hoursOnly)
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 TimeStringToSecs(std::string timestring)
|
uint32 TimeStringToSecs(const std::string& timestring)
|
||||||
{
|
{
|
||||||
uint32 secs = 0;
|
uint32 secs = 0;
|
||||||
uint32 buffer = 0;
|
uint32 buffer = 0;
|
||||||
uint32 multiplier = 0;
|
uint32 multiplier = 0;
|
||||||
|
|
||||||
for(std::string::iterator itr = timestring.begin(); itr != timestring.end(); itr++ )
|
for(std::string::const_iterator itr = timestring.begin(); itr != timestring.end(); itr++ )
|
||||||
{
|
{
|
||||||
if(isdigit(*itr))
|
if(isdigit(*itr))
|
||||||
{
|
{
|
||||||
|
|
@ -193,7 +193,7 @@ bool IsIPAddress(char const* ipaddress)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// create PID file
|
/// create PID file
|
||||||
uint32 CreatePIDFile(std::string filename)
|
uint32 CreatePIDFile(const std::string& filename)
|
||||||
{
|
{
|
||||||
FILE * pid_file = fopen (filename.c_str(), "w" );
|
FILE * pid_file = fopen (filename.c_str(), "w" );
|
||||||
if (pid_file == NULL)
|
if (pid_file == NULL)
|
||||||
|
|
@ -271,7 +271,7 @@ bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utf8toWStr(std::string utf8str, std::wstring& wstr)
|
bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -376,7 +376,7 @@ std::wstring GetMainPartOfName(std::wstring wname, uint32 declension)
|
||||||
return wname;
|
return wname;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool utf8ToConsole(std::string utf8str, std::string& conStr)
|
bool utf8ToConsole(const std::string& utf8str, std::string& conStr)
|
||||||
{
|
{
|
||||||
#if PLATFORM == PLATFORM_WINDOWS
|
#if PLATFORM == PLATFORM_WINDOWS
|
||||||
std::wstring wstr;
|
std::wstring wstr;
|
||||||
|
|
@ -393,7 +393,7 @@ bool utf8ToConsole(std::string utf8str, std::string& conStr)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool consoleToUtf8(std::string conStr,std::string& utf8str)
|
bool consoleToUtf8(const std::string& conStr,std::string& utf8str)
|
||||||
{
|
{
|
||||||
#if PLATFORM == PLATFORM_WINDOWS
|
#if PLATFORM == PLATFORM_WINDOWS
|
||||||
std::wstring wstr;
|
std::wstring wstr;
|
||||||
|
|
@ -408,7 +408,7 @@ bool consoleToUtf8(std::string conStr,std::string& utf8str)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utf8FitTo(std::string str, std::wstring search)
|
bool Utf8FitTo(const std::string& str, std::wstring search)
|
||||||
{
|
{
|
||||||
std::wstring temp;
|
std::wstring temp;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ Tokens StrSplit(const std::string &src, const std::string &sep);
|
||||||
void stripLineInvisibleChars(std::string &src);
|
void stripLineInvisibleChars(std::string &src);
|
||||||
|
|
||||||
std::string secsToTimeString(uint32 timeInSecs, bool shortText = false, bool hoursOnly = false);
|
std::string secsToTimeString(uint32 timeInSecs, bool shortText = false, bool hoursOnly = false);
|
||||||
uint32 TimeStringToSecs(std::string timestring);
|
uint32 TimeStringToSecs(const std::string& timestring);
|
||||||
std::string TimeToTimestampStr(time_t t);
|
std::string TimeToTimestampStr(time_t t);
|
||||||
|
|
||||||
inline uint32 secsToTimeBitFields(time_t secs)
|
inline uint32 secsToTimeBitFields(time_t secs)
|
||||||
|
|
@ -95,10 +95,10 @@ inline void ApplyPercentModFloatVar(float& var, float val, bool apply)
|
||||||
var *= (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val));
|
var *= (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Utf8toWStr(std::string utf8str, std::wstring& wstr);
|
bool Utf8toWStr(const std::string& utf8str, std::wstring& wstr);
|
||||||
// in wsize==max size of buffer, out wsize==real string size
|
// in wsize==max size of buffer, out wsize==real string size
|
||||||
bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize);
|
bool Utf8toWStr(char const* utf8str, size_t csize, wchar_t* wstr, size_t& wsize);
|
||||||
inline bool Utf8toWStr(std::string utf8str, wchar_t* wstr, size_t& wsize)
|
inline bool Utf8toWStr(const std::string& utf8str, wchar_t* wstr, size_t& wsize)
|
||||||
{
|
{
|
||||||
return Utf8toWStr(utf8str.c_str(), utf8str.size(), wstr, wsize);
|
return Utf8toWStr(utf8str.c_str(), utf8str.size(), wstr, wsize);
|
||||||
}
|
}
|
||||||
|
|
@ -280,9 +280,9 @@ inline void wstrToLower(std::wstring& str)
|
||||||
|
|
||||||
std::wstring GetMainPartOfName(std::wstring wname, uint32 declension);
|
std::wstring GetMainPartOfName(std::wstring wname, uint32 declension);
|
||||||
|
|
||||||
bool utf8ToConsole(std::string utf8str, std::string& conStr);
|
bool utf8ToConsole(const std::string& utf8str, std::string& conStr);
|
||||||
bool consoleToUtf8(std::string conStr,std::string& utf8str);
|
bool consoleToUtf8(const std::string& conStr,std::string& utf8str);
|
||||||
bool Utf8FitTo(std::string str, std::wstring search);
|
bool Utf8FitTo(const std::string& str, std::wstring search);
|
||||||
|
|
||||||
#if PLATFORM == PLATFORM_WINDOWS
|
#if PLATFORM == PLATFORM_WINDOWS
|
||||||
#define UTF8PRINTF(OUT,FRM,RESERR) \
|
#define UTF8PRINTF(OUT,FRM,RESERR) \
|
||||||
|
|
@ -311,6 +311,6 @@ bool Utf8FitTo(std::string str, std::wstring search);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool IsIPAddress(char const* ipaddress);
|
bool IsIPAddress(char const* ipaddress);
|
||||||
uint32 CreatePIDFile(std::string filename);
|
uint32 CreatePIDFile(const std::string& filename);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "6895"
|
#define REVISION_NR "6902"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
|
|
@ -43,8 +43,8 @@ namespace VMAP
|
||||||
G3D::Array<std::string> iMainFiles;
|
G3D::Array<std::string> iMainFiles;
|
||||||
G3D::Array<std::string> iSingeFiles;
|
G3D::Array<std::string> iSingeFiles;
|
||||||
|
|
||||||
void appendToMain(std::string pStr) { iMainFiles.append(pStr); }
|
void appendToMain(const std::string& pStr) { iMainFiles.append(pStr); }
|
||||||
void appendToSingle(std::string pStr) { iSingeFiles.append(pStr); }
|
void appendToSingle(const std::string& pStr) { iSingeFiles.append(pStr); }
|
||||||
|
|
||||||
size_t size() { return (iMainFiles.size() + iSingeFiles.size()); }
|
size_t size() { return (iMainFiles.size() + iSingeFiles.size()); }
|
||||||
};
|
};
|
||||||
|
|
@ -113,7 +113,7 @@ namespace VMAP
|
||||||
|
|
||||||
const NameCollection getFilenamesForCoordinate(unsigned int pMapId, int xPos, int yPos);
|
const NameCollection getFilenamesForCoordinate(unsigned int pMapId, int xPos, int yPos);
|
||||||
|
|
||||||
static unsigned int getMapIdFromFilename(std::string pName)
|
static unsigned int getMapIdFromFilename(const std::string& pName)
|
||||||
{
|
{
|
||||||
size_t spos;
|
size_t spos;
|
||||||
|
|
||||||
|
|
@ -126,8 +126,8 @@ namespace VMAP
|
||||||
}
|
}
|
||||||
|
|
||||||
const G3D::Array<unsigned int>& getMaps() const { return iMapIds; }
|
const G3D::Array<unsigned int>& getMaps() const { return iMapIds; }
|
||||||
bool isAlreadyProcessedSingleFile(std::string pName) const { return iProcesseSingleFiles.containsKey(pName); }
|
bool isAlreadyProcessedSingleFile(const std::string& pName) const { return iProcesseSingleFiles.containsKey(pName); }
|
||||||
void addAlreadyProcessedSingleFile(std::string pName) { iProcesseSingleFiles.set(pName,pName); }
|
void addAlreadyProcessedSingleFile(const std::string& pName) { iProcesseSingleFiles.set(pName,pName); }
|
||||||
|
|
||||||
inline void addWorldAreaMap(unsigned int pMapId)
|
inline void addWorldAreaMap(unsigned int pMapId)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue