forked from mirror/openmw-tes3mp
[General] Fix typos and use consistent style for recent additions
This commit is contained in:
parent
051f65a4d5
commit
ad61d88cb1
10 changed files with 58 additions and 58 deletions
|
@ -123,7 +123,7 @@ void Networking::processPlayerPacket(RakNet::Packet *packet)
|
||||||
if (packet->data[0] == ID_LOADED)
|
if (packet->data[0] == ID_LOADED)
|
||||||
{
|
{
|
||||||
player->setLoadState(Player::LOADED);
|
player->setLoadState(Player::LOADED);
|
||||||
player->joinToChannel(0, "Default");
|
player->joinChannel(0, "Default");
|
||||||
|
|
||||||
bool result = luaState.getEventCtrl().Call<CoreEvent::ON_PLAYER_CONNECT, bool>(player);
|
bool result = luaState.getEventCtrl().Call<CoreEvent::ON_PLAYER_CONNECT, bool>(player);
|
||||||
|
|
||||||
|
|
|
@ -41,13 +41,13 @@ void Player::Init(LuaState &lua)
|
||||||
"getAvgPing", &Player::getAvgPing,
|
"getAvgPing", &Player::getAvgPing,
|
||||||
|
|
||||||
"message", &Player::message,
|
"message", &Player::message,
|
||||||
"joinToChannel", &Player::joinToChannel,
|
"joinChannel", &Player::joinChannel,
|
||||||
"cleanChannel", &Player::cleanChannel,
|
"cleanChannel", &Player::cleanChannel,
|
||||||
"renameChannel", &Player::renameChannel,
|
"renameChannel", &Player::renameChannel,
|
||||||
"closeChannel", &Player::closeChannel,
|
"closeChannel", &Player::closeChannel,
|
||||||
"leaveChannel", &Player::leaveChannel,
|
"leaveChannel", &Player::leaveChannel,
|
||||||
"setChannel", &Player::setChannel,
|
"setChannel", &Player::setChannel,
|
||||||
"isChannelOpened", &Player::isChannelOpened,
|
"isChannelOpen", &Player::isChannelOpen,
|
||||||
|
|
||||||
"pid", sol::readonly_property(&Player::id),
|
"pid", sol::readonly_property(&Player::id),
|
||||||
"guid", sol::readonly_property(&Player::getGUID),
|
"guid", sol::readonly_property(&Player::getGUID),
|
||||||
|
@ -99,7 +99,7 @@ void Player::Init(LuaState &lua)
|
||||||
"createChannel", 0,
|
"createChannel", 0,
|
||||||
"joinChannel", 1,
|
"joinChannel", 1,
|
||||||
"closeChannel", 2,
|
"closeChannel", 2,
|
||||||
"leftChannel", 3);
|
"leaveChannel", 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
Player::Player(RakNet::RakNetGUID guid) : BasePlayer(guid), NetActor(), changedMap(false), cClass(this),
|
Player::Player(RakNet::RakNetGUID guid) : BasePlayer(guid), NetActor(), changedMap(false), cClass(this),
|
||||||
|
@ -372,7 +372,7 @@ void Player::setCharGenStages(int currentStage, int endStage)
|
||||||
|
|
||||||
void Player::message(unsigned channelId, const std::string &message, bool toAll)
|
void Player::message(unsigned channelId, const std::string &message, bool toAll)
|
||||||
{
|
{
|
||||||
if (isChannelOpened(channelId))
|
if (isChannelOpen(channelId))
|
||||||
{
|
{
|
||||||
mwmp::Chat tmp;
|
mwmp::Chat tmp;
|
||||||
tmp.action = mwmp::Chat::Action::print;
|
tmp.action = mwmp::Chat::Action::print;
|
||||||
|
@ -407,7 +407,7 @@ void Player::message(unsigned channelId, const std::string &message, bool toAll)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::joinToChannel(unsigned channelId, const std::string &name)
|
bool Player::joinChannel(unsigned channelId, const std::string &name)
|
||||||
{
|
{
|
||||||
auto channel = mwmp::Networking::get().getChannel(channelId);
|
auto channel = mwmp::Networking::get().getChannel(channelId);
|
||||||
|
|
||||||
|
@ -419,7 +419,7 @@ bool Player::joinToChannel(unsigned channelId, const std::string &name)
|
||||||
if (auto member = weakMember.lock())
|
if (auto member = weakMember.lock())
|
||||||
{
|
{
|
||||||
if (member->guid == guid)
|
if (member->guid == guid)
|
||||||
return false; // player already member of the channel
|
return false; // the player is already a member of the channel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto thisPl = Players::getPlayerByGUID(guid);
|
auto thisPl = Players::getPlayerByGUID(guid);
|
||||||
|
@ -438,7 +438,7 @@ bool Player::joinToChannel(unsigned channelId, const std::string &name)
|
||||||
|
|
||||||
void Player::renameChannel(unsigned channelId, const std::string &name)
|
void Player::renameChannel(unsigned channelId, const std::string &name)
|
||||||
{
|
{
|
||||||
if (isChannelOpened(channelId))
|
if (isChannelOpen(channelId))
|
||||||
{
|
{
|
||||||
chat.action = mwmp::Chat::Action::renamechannel;
|
chat.action = mwmp::Chat::Action::renamechannel;
|
||||||
chat.channel = channelId;
|
chat.channel = channelId;
|
||||||
|
@ -462,14 +462,14 @@ void Player::leaveChannel(unsigned channelId)
|
||||||
|
|
||||||
packet->Send(false);
|
packet->Send(false);
|
||||||
|
|
||||||
mwmp::Networking::get().getState().getEventCtrl().Call<CoreEvent::ON_CHANNEL_ACTION>(this, channelId, 2); // leaved channel
|
mwmp::Networking::get().getState().getEventCtrl().Call<CoreEvent::ON_CHANNEL_ACTION>(this, channelId, 2); // left the channel
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::closeChannel(unsigned channelId)
|
void Player::closeChannel(unsigned channelId)
|
||||||
{
|
{
|
||||||
auto channel = mwmp::Networking::get().getChannel(channelId);
|
auto channel = mwmp::Networking::get().getChannel(channelId);
|
||||||
|
|
||||||
for(auto &weakMember : channel->members) // kick members from channel before deleting channel
|
for (auto &weakMember : channel->members) // kick the channel's members before deleting it
|
||||||
{
|
{
|
||||||
if (auto member = weakMember.lock())
|
if (auto member = weakMember.lock())
|
||||||
member->leaveChannel(channelId);
|
member->leaveChannel(channelId);
|
||||||
|
@ -483,7 +483,7 @@ void Player::closeChannel(unsigned channelId)
|
||||||
|
|
||||||
void Player::setChannel(unsigned channelId)
|
void Player::setChannel(unsigned channelId)
|
||||||
{
|
{
|
||||||
if (isChannelOpened(channelId))
|
if (isChannelOpen(channelId))
|
||||||
{
|
{
|
||||||
chat.action = mwmp::Chat::Action::setchannel;
|
chat.action = mwmp::Chat::Action::setchannel;
|
||||||
chat.channel = channelId;
|
chat.channel = channelId;
|
||||||
|
@ -496,7 +496,7 @@ void Player::setChannel(unsigned channelId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::isChannelOpened(unsigned channelId)
|
bool Player::isChannelOpen(unsigned channelId)
|
||||||
{
|
{
|
||||||
auto channel = mwmp::Networking::get().getChannel(channelId);
|
auto channel = mwmp::Networking::get().getChannel(channelId);
|
||||||
|
|
||||||
|
|
|
@ -78,12 +78,12 @@ public:
|
||||||
|
|
||||||
void cleanChannel(unsigned channelId);
|
void cleanChannel(unsigned channelId);
|
||||||
void message(unsigned channelId, const std::string &message, bool toAll = false);
|
void message(unsigned channelId, const std::string &message, bool toAll = false);
|
||||||
bool joinToChannel(unsigned channelId, const std::string &name);
|
bool joinChannel(unsigned channelId, const std::string &name);
|
||||||
void renameChannel(unsigned channelId, const std::string &name);
|
void renameChannel(unsigned channelId, const std::string &name);
|
||||||
void closeChannel(unsigned channelId);
|
void closeChannel(unsigned channelId);
|
||||||
void leaveChannel(unsigned channelId);
|
void leaveChannel(unsigned channelId);
|
||||||
void setChannel(unsigned channelId);
|
void setChannel(unsigned channelId);
|
||||||
bool isChannelOpened(unsigned channelId);
|
bool isChannelOpen(unsigned channelId);
|
||||||
|
|
||||||
int getAvgPing();
|
int getAvgPing();
|
||||||
|
|
||||||
|
|
|
@ -35,9 +35,9 @@ namespace mwmp
|
||||||
getWidget(mCommandLine, "edit_Command");
|
getWidget(mCommandLine, "edit_Command");
|
||||||
getWidget(mHistory, "list_History");
|
getWidget(mHistory, "list_History");
|
||||||
getWidget(mChannelPrevBtn, "btn_prev_ch");
|
getWidget(mChannelPrevBtn, "btn_prev_ch");
|
||||||
mChannelPrevBtn->eventMouseButtonClick += MyGUI::newDelegate(this, &GUIChat::prevChannels);
|
mChannelPrevBtn->eventMouseButtonClick += MyGUI::newDelegate(this, &GUIChat::prevChannel);
|
||||||
getWidget(mChannelNextBtn, "btn_next_ch");
|
getWidget(mChannelNextBtn, "btn_next_ch");
|
||||||
mChannelNextBtn->eventMouseButtonClick += MyGUI::newDelegate(this, &GUIChat::nextChannels);
|
mChannelNextBtn->eventMouseButtonClick += MyGUI::newDelegate(this, &GUIChat::nextChannel);
|
||||||
getWidget(mBoxChannels, "box_channels");
|
getWidget(mBoxChannels, "box_channels");
|
||||||
|
|
||||||
for (int i = 0; i < 3; ++i)
|
for (int i = 0; i < 3; ++i)
|
||||||
|
@ -67,7 +67,7 @@ namespace mwmp
|
||||||
currentChannel = 0;
|
currentChannel = 0;
|
||||||
addChannel(0, "Default");
|
addChannel(0, "Default");
|
||||||
setChannel(0);
|
setChannel(0);
|
||||||
redrawChnnels();
|
redrawChannels();
|
||||||
defaultColor = mChannelPrevBtn->getTextColour();
|
defaultColor = mChannelPrevBtn->getTextColour();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,7 +369,7 @@ namespace mwmp
|
||||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Adding channel id: %d %s", ch, name);
|
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Adding channel id: %d %s", ch, name);
|
||||||
channels.push_back(ChannelData{ch, name.substr(0, 9), "", false});
|
channels.push_back(ChannelData{ch, name.substr(0, 9), "", false});
|
||||||
}
|
}
|
||||||
redrawChnnels();
|
redrawChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::renameChannel(unsigned ch, const std::string &newName)
|
void GUIChat::renameChannel(unsigned ch, const std::string &newName)
|
||||||
|
@ -378,7 +378,7 @@ namespace mwmp
|
||||||
if (it != channels.end())
|
if (it != channels.end())
|
||||||
{
|
{
|
||||||
it->channelName = newName.substr(0, 9);
|
it->channelName = newName.substr(0, 9);
|
||||||
redrawChnnels();
|
redrawChannels();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ namespace mwmp
|
||||||
mHistory->setCaption(it->channelText);
|
mHistory->setCaption(it->channelText);
|
||||||
currentChannel = it->channel;
|
currentChannel = it->channel;
|
||||||
|
|
||||||
redrawChnnels();
|
redrawChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::closeChannel(unsigned ch)
|
void GUIChat::closeChannel(unsigned ch)
|
||||||
|
@ -424,10 +424,10 @@ namespace mwmp
|
||||||
setChannel(0, false); // reset to default channel
|
setChannel(0, false); // reset to default channel
|
||||||
channels.erase(it);
|
channels.erase(it);
|
||||||
}
|
}
|
||||||
redrawChnnels();
|
redrawChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::redrawChnnels()
|
void GUIChat::redrawChannels()
|
||||||
{
|
{
|
||||||
mChannelPrevBtn->setVisible(page != 0);
|
mChannelPrevBtn->setVisible(page != 0);
|
||||||
mChannelNextBtn->setVisible(channels.size() > 3 && page != lastPage());
|
mChannelNextBtn->setVisible(channels.size() > 3 && page != lastPage());
|
||||||
|
@ -466,19 +466,19 @@ namespace mwmp
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::nextChannels(MyGUI::Widget* _sender)
|
void GUIChat::nextChannel(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
page++;
|
page++;
|
||||||
if (page > lastPage())
|
if (page > lastPage())
|
||||||
page = lastPage();
|
page = lastPage();
|
||||||
redrawChnnels();
|
redrawChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::prevChannels(MyGUI::Widget* _sender)
|
void GUIChat::prevChannel(MyGUI::Widget* _sender)
|
||||||
{
|
{
|
||||||
if (page > 0)
|
if (page > 0)
|
||||||
page--;
|
page--;
|
||||||
redrawChnnels();
|
redrawChannels();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUIChat::onClickChannel(MyGUI::Widget *_sender)
|
void GUIChat::onClickChannel(MyGUI::Widget *_sender)
|
||||||
|
|
|
@ -77,10 +77,10 @@ namespace mwmp
|
||||||
void renameChannel(unsigned ch, const std::string &channel);
|
void renameChannel(unsigned ch, const std::string &channel);
|
||||||
void setChannel(unsigned ch, bool saveHistory = true);
|
void setChannel(unsigned ch, bool saveHistory = true);
|
||||||
void closeChannel(unsigned ch);
|
void closeChannel(unsigned ch);
|
||||||
void redrawChnnels();
|
void redrawChannels();
|
||||||
unsigned lastPage();
|
unsigned lastPage();
|
||||||
void nextChannels(MyGUI::Widget* _sender);
|
void nextChannel(MyGUI::Widget* _sender);
|
||||||
void prevChannels(MyGUI::Widget* _sender);
|
void prevChannel(MyGUI::Widget* _sender);
|
||||||
void onClickChannel(MyGUI::Widget* _sender);
|
void onClickChannel(MyGUI::Widget* _sender);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in a new issue