forked from teamnwah/openmw-tes3coop
[General] Make coding style consistent
This commit is contained in:
parent
afcf5a7fc8
commit
c3c04bbfc3
19 changed files with 52 additions and 52 deletions
|
@ -188,7 +188,7 @@ void MasterClient::Thread()
|
|||
SetPlayers((int) players->size());
|
||||
|
||||
auto pIt = players->begin();
|
||||
if(queryData.players.size() != players->size())
|
||||
if (queryData.players.size() != players->size())
|
||||
{
|
||||
queryData.players.clear();
|
||||
updated = true;
|
||||
|
@ -211,9 +211,9 @@ void MasterClient::Thread()
|
|||
updated = false;
|
||||
if (pIt != players->end())
|
||||
{
|
||||
for(auto player : *players)
|
||||
for (auto player : *players)
|
||||
{
|
||||
if(!player.second->npc.mName.empty())
|
||||
if (!player.second->npc.mName.empty())
|
||||
queryData.players.push_back(player.second->npc.mName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -216,7 +216,7 @@ void Networking::update(RakNet::Packet *packet)
|
|||
if (hashList.empty()) // and server do not allow to have custom hash for plugin
|
||||
continue;
|
||||
auto it = find(hashList.begin(), hashList.end(), plugin->second[0]);
|
||||
if(it == hashList.end()) // hash not found in sample
|
||||
if (it == hashList.end()) // hash not found in sample
|
||||
break;
|
||||
|
||||
}
|
||||
|
@ -226,7 +226,7 @@ void Networking::update(RakNet::Packet *packet)
|
|||
}
|
||||
RakNet::BitStream bs;
|
||||
packetPreInit.SetSendStream(&bs);
|
||||
if(plugin != plugins.end()) // if condition is true, then client have wrong plugin list
|
||||
if (plugin != plugins.end()) // if condition is true, then client have wrong plugin list
|
||||
{
|
||||
packetPreInit.setChecksums(&samples);
|
||||
packetPreInit.Send(packet->systemAddress);
|
||||
|
@ -390,14 +390,14 @@ PacketPreInit::PluginContainer Networking::getPluginListSample()
|
|||
unsigned field = 0;
|
||||
auto name = "";
|
||||
Script::Call<Script::CallbackIdentity("OnRequestPluginList")>(name, id, field++);
|
||||
if(strlen(name) == 0)
|
||||
if (strlen(name) == 0)
|
||||
break;
|
||||
PacketPreInit::HashList hashList;
|
||||
while(true)
|
||||
{
|
||||
auto hash = "";
|
||||
Script::Call<Script::CallbackIdentity("OnRequestPluginList")>(hash, id, field++);
|
||||
if(strlen(hash) == 0)
|
||||
if (strlen(hash) == 0)
|
||||
break;
|
||||
hashList.push_back((unsigned)stoul(hash));
|
||||
}
|
||||
|
|
|
@ -23,12 +23,12 @@ bool ActorProcessor::Process(RakNet::Packet &packet, ActorList &actorList)
|
|||
|
||||
BOOST_FOREACH(processors_t::value_type &processor, processors)
|
||||
{
|
||||
if(processor.first == packet.data[0])
|
||||
if (processor.first == packet.data[0])
|
||||
{
|
||||
myGuid = Main::get().getLocalPlayer()->guid;
|
||||
request = packet.length == myPacket->headerSize();
|
||||
|
||||
if(!request && !processor.second->avoidReading)
|
||||
if (!request && !processor.second->avoidReading)
|
||||
{
|
||||
myPacket->Read();
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ void ActorProcessor::AddProcessor(mwmp::ActorProcessor *processor)
|
|||
{
|
||||
BOOST_FOREACH(processors_t::value_type &p, processors)
|
||||
{
|
||||
if(processor->packetID == p.first)
|
||||
if (processor->packetID == p.first)
|
||||
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
|
||||
processor->className + " and " + p.second->className);
|
||||
}
|
||||
|
|
|
@ -349,7 +349,7 @@ void CellController::openContainer(const MWWorld::Ptr &container, bool loot)
|
|||
|
||||
LOG_APPEND(Log::LOG_VERBOSE, " - Item. Refid: \"%s\" Count: %d", name.c_str(), count);
|
||||
|
||||
/*if(::Misc::StringUtils::ciEqual(name, "gold_001"))
|
||||
/*if (::Misc::StringUtils::ciEqual(name, "gold_001"))
|
||||
cont.remove("gold_001", count, container);*/
|
||||
}
|
||||
|
||||
|
|
|
@ -98,9 +98,9 @@ void mwmp::GUIController::showDialogList(const mwmp::BasePlayer::GUIMessageBox &
|
|||
|
||||
std::string buf;
|
||||
|
||||
for(size_t i = 0; i < guiMessageBox.data.size(); i++)
|
||||
for (size_t i = 0; i < guiMessageBox.data.size(); i++)
|
||||
{
|
||||
if(guiMessageBox.data[i] == '\n')
|
||||
if (guiMessageBox.data[i] == '\n')
|
||||
{
|
||||
list.push_back(buf);
|
||||
buf.erase();
|
||||
|
@ -224,7 +224,7 @@ void mwmp::GUIController::WM_UpdateVisible(MWGui::GuiMode mode)
|
|||
}
|
||||
case GM_TES3MP_ListBox:
|
||||
{
|
||||
if(mListBox != 0)
|
||||
if (mListBox != 0)
|
||||
mListBox->setVisible(true);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -29,7 +29,7 @@ GUIDialogList::GUIDialogList(const std::string &message, const std::vector<std::
|
|||
mButton->eventMouseButtonClick += MyGUI::newDelegate(this, &GUIDialogList::mousePressed);
|
||||
|
||||
mMessage->setCaptionWithReplacing(message);
|
||||
for(size_t i = 0; i < list.size(); i++)
|
||||
for (size_t i = 0; i < list.size(); i++)
|
||||
mListBox->addItem(list[i]);
|
||||
|
||||
}
|
||||
|
@ -46,7 +46,7 @@ void GUIDialogList::mousePressed(MyGUI::Widget * /*widget*/)
|
|||
Main::get().getNetworking()->getPlayerPacket(ID_GUI_MESSAGEBOX)->Send();
|
||||
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Selected id: %d", id);
|
||||
if(id == MyGUI::ITEM_NONE)
|
||||
if (id == MyGUI::ITEM_NONE)
|
||||
return;
|
||||
|
||||
std::string itemName = mListBox->getItemNameAt(mListBox->getIndexSelected()).asUTF8();
|
||||
|
|
|
@ -63,12 +63,12 @@ string comparePlugins(PacketPreInit::PluginContainer checksums, PacketPreInit::P
|
|||
sstr << "Note: Use the same load order as the server.\n";
|
||||
size_t pluginNameLen1 = 0;
|
||||
size_t pluginNameLen2 = 0;
|
||||
for(size_t i = 0; i < checksums.size(); i++)
|
||||
if(pluginNameLen1 < checksums[i].first.size())
|
||||
for (size_t i = 0; i < checksums.size(); i++)
|
||||
if (pluginNameLen1 < checksums[i].first.size())
|
||||
pluginNameLen1 = checksums[i].first.size();
|
||||
|
||||
for(size_t i = 0; i < checksumsResponse.size(); i++)
|
||||
if(pluginNameLen2 < checksumsResponse[i].first.size())
|
||||
for (size_t i = 0; i < checksumsResponse.size(); i++)
|
||||
if (pluginNameLen2 < checksumsResponse[i].first.size())
|
||||
pluginNameLen2 = checksumsResponse[i].first.size();
|
||||
|
||||
printWithWidth(sstr, "Your current plugins are:", pluginNameLen1 + 16);
|
||||
|
@ -78,7 +78,7 @@ string comparePlugins(PacketPreInit::PluginContainer checksums, PacketPreInit::P
|
|||
printWithWidth(sstr, "hash", 14);
|
||||
printWithWidth(sstr, "name", pluginNameLen2 + 2);
|
||||
sstr << "hash\n";
|
||||
for(size_t i = 0; i < checksumsResponse.size(); i++)
|
||||
for (size_t i = 0; i < checksumsResponse.size(); i++)
|
||||
{
|
||||
string plugin;
|
||||
unsigned val;
|
||||
|
@ -95,10 +95,10 @@ string comparePlugins(PacketPreInit::PluginContainer checksums, PacketPreInit::P
|
|||
printWithWidth(sstr, plugin, pluginNameLen1 + 2);
|
||||
printWithWidth(sstr, intToHexStr(val), 14);
|
||||
printWithWidth(sstr, checksumsResponse[i].first, pluginNameLen2 + 2);
|
||||
if(checksumsResponse[i].second.size() > 0)
|
||||
if (checksumsResponse[i].second.size() > 0)
|
||||
{
|
||||
if(full)
|
||||
for(size_t j = 0; j < checksumsResponse[i].second.size(); j++)
|
||||
if (full)
|
||||
for (size_t j = 0; j < checksumsResponse[i].second.size(); j++)
|
||||
printWithWidth(sstr, intToHexStr(checksumsResponse[i].second[j]), 14);
|
||||
else
|
||||
sstr << intToHexStr(checksumsResponse[i].second[0]);
|
||||
|
@ -289,7 +289,7 @@ void Networking::preInit(std::vector<std::string> &content, Files::Collections &
|
|||
while (!done)
|
||||
{
|
||||
RakNet::Packet *packet = peer->Receive();
|
||||
if(!packet)
|
||||
if (!packet)
|
||||
{
|
||||
RakSleep(500);
|
||||
continue;
|
||||
|
@ -315,7 +315,7 @@ void Networking::preInit(std::vector<std::string> &content, Files::Collections &
|
|||
peer->DeallocatePacket(packet);
|
||||
}
|
||||
|
||||
if(!checksumsResponse.empty()) // something wrong
|
||||
if (!checksumsResponse.empty()) // something wrong
|
||||
errmsg = comparePlugins(checksums, checksumsResponse);
|
||||
|
||||
|
||||
|
@ -334,7 +334,7 @@ void Networking::receiveMessage(RakNet::Packet *packet)
|
|||
|
||||
if (playerPacketController.ContainsPacket(packet->data[0]))
|
||||
{
|
||||
if(!PlayerProcessor::Process(*packet))
|
||||
if (!PlayerProcessor::Process(*packet))
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_WARN, "Unhandled PlayerPacket with identifier %i has arrived", packet->data[0]);
|
||||
}
|
||||
else if (actorPacketController.ContainsPacket(packet->data[0]))
|
||||
|
|
|
@ -15,7 +15,7 @@ void PlayerProcessor::AddProcessor(PlayerProcessor *processor)
|
|||
{
|
||||
BOOST_FOREACH(processors_t::value_type &p, processors)
|
||||
{
|
||||
if(processor->packetID == p.first)
|
||||
if (processor->packetID == p.first)
|
||||
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
|
||||
processor->className + " and " + p.second->className);
|
||||
}
|
||||
|
@ -30,14 +30,14 @@ bool PlayerProcessor::Process(RakNet::Packet &packet)
|
|||
PlayerPacket *myPacket = Main::get().getNetworking()->getPlayerPacket(packet.data[0]);
|
||||
myPacket->SetReadStream(&bsIn);
|
||||
|
||||
/*if(myPacket == 0)
|
||||
/*if (myPacket == 0)
|
||||
{
|
||||
// error: packet not found
|
||||
}*/
|
||||
|
||||
BOOST_FOREACH(processors_t::value_type &processor, processors)
|
||||
{
|
||||
if(processor.first == packet.data[0])
|
||||
if (processor.first == packet.data[0])
|
||||
{
|
||||
myGuid = Main::get().getLocalPlayer()->guid;
|
||||
request = packet.length == myPacket->headerSize();
|
||||
|
@ -48,7 +48,7 @@ bool PlayerProcessor::Process(RakNet::Packet &packet)
|
|||
else
|
||||
player = Main::get().getLocalPlayer();
|
||||
|
||||
if(!request && !processor.second->avoidReading && player != 0)
|
||||
if (!request && !processor.second->avoidReading && player != 0)
|
||||
{
|
||||
myPacket->setPlayer(player);
|
||||
myPacket->Read();
|
||||
|
|
|
@ -23,12 +23,12 @@ bool WorldProcessor::Process(RakNet::Packet &packet, WorldEvent &event)
|
|||
|
||||
BOOST_FOREACH(processors_t::value_type &processor, processors)
|
||||
{
|
||||
if(processor.first == packet.data[0])
|
||||
if (processor.first == packet.data[0])
|
||||
{
|
||||
myGuid = Main::get().getLocalPlayer()->guid;
|
||||
request = packet.length == myPacket->headerSize();
|
||||
|
||||
if(!request && !processor.second->avoidReading)
|
||||
if (!request && !processor.second->avoidReading)
|
||||
{
|
||||
myPacket->Read();
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ void WorldProcessor::AddProcessor(mwmp::WorldProcessor *processor)
|
|||
{
|
||||
BOOST_FOREACH(processors_t::value_type &p, processors)
|
||||
{
|
||||
if(processor->packetID == p.first)
|
||||
if (processor->packetID == p.first)
|
||||
throw std::logic_error("processor " + p.second->strPacketID + " already registered. Check " +
|
||||
processor->className + " and " + p.second->className);
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace mwmp
|
|||
{
|
||||
if (isLocal())
|
||||
{
|
||||
if(isRequest())
|
||||
if (isRequest())
|
||||
static_cast<LocalPlayer *>(player)->updateAnimFlags(true);
|
||||
}
|
||||
else if (player != 0)
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace mwmp
|
|||
{
|
||||
if (isLocal())
|
||||
{
|
||||
if(isRequest())
|
||||
if (isRequest())
|
||||
static_cast<LocalPlayer *>(player)->updateAttributes(true);
|
||||
else
|
||||
static_cast<LocalPlayer *>(player)->setAttributes();
|
||||
|
|
|
@ -21,11 +21,11 @@ namespace mwmp
|
|||
{
|
||||
LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received ID_PLAYER_BASEINFO from server");
|
||||
|
||||
if(isLocal())
|
||||
if (isLocal())
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "- Packet was about my id");
|
||||
|
||||
if(isRequest())
|
||||
if (isRequest())
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "- Requesting info");
|
||||
packet.Send(serverAddr);
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace mwmp
|
|||
{
|
||||
if (isLocal())
|
||||
{
|
||||
if(isRequest())
|
||||
if (isRequest())
|
||||
static_cast<LocalPlayer *>(player)->updateBounty(true);
|
||||
else
|
||||
static_cast<LocalPlayer *>(player)->setBounty();
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace mwmp
|
|||
{
|
||||
if (isLocal())
|
||||
{
|
||||
if(isRequest())
|
||||
if (isRequest())
|
||||
static_cast<LocalPlayer *>(player)->sendClass();
|
||||
else
|
||||
static_cast<LocalPlayer *>(player)->setClass();
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace mwmp
|
|||
{
|
||||
if (isLocal())
|
||||
{
|
||||
if(isRequest())
|
||||
if (isRequest())
|
||||
static_cast<LocalPlayer *>(player)->updateLevel(true);
|
||||
else
|
||||
static_cast<LocalPlayer *>(player)->setLevel();
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace mwmp
|
|||
{
|
||||
if (isLocal())
|
||||
{
|
||||
if(isRequest())
|
||||
if (isRequest())
|
||||
static_cast<LocalPlayer *>(player)->updateSkills(true);
|
||||
else
|
||||
static_cast<LocalPlayer *>(player)->setSkills();
|
||||
|
|
|
@ -25,7 +25,7 @@ void PacketMasterAnnounce::Packet(BitStream *bs, bool send)
|
|||
|
||||
RW(func, send);
|
||||
|
||||
if(func == FUNCTION_ANNOUNCE)
|
||||
if (func == FUNCTION_ANNOUNCE)
|
||||
ProxyMasterPacket::addServer(this, *server, send);
|
||||
}
|
||||
|
||||
|
|
|
@ -30,14 +30,14 @@ void PacketMasterQuery::Packet(RakNet::BitStream *bs, bool send)
|
|||
RW(serversCount, send);
|
||||
|
||||
map<SystemAddress, QueryData>::iterator serverIt;
|
||||
if(send)
|
||||
if (send)
|
||||
serverIt = servers->begin();
|
||||
|
||||
QueryData server;
|
||||
SystemAddress sa;
|
||||
while(serversCount--)
|
||||
{
|
||||
if(send)
|
||||
if (send)
|
||||
{
|
||||
sa = serverIt->first;
|
||||
server = serverIt->second;
|
||||
|
@ -46,7 +46,7 @@ void PacketMasterQuery::Packet(RakNet::BitStream *bs, bool send)
|
|||
RW(sa, send);
|
||||
ProxyMasterPacket::addServer(this, server, send);
|
||||
|
||||
if(send)
|
||||
if (send)
|
||||
serverIt++;
|
||||
else
|
||||
servers->insert(pair<SystemAddress, QueryData>(sa, server));
|
||||
|
|
|
@ -18,26 +18,26 @@ void mwmp::PacketPreInit::Packet(RakNet::BitStream *bs, bool send)
|
|||
size_t size = checksums->size();
|
||||
RW(size, send);
|
||||
|
||||
for(size_t i = 0; i < size; i++)
|
||||
for (size_t i = 0; i < size; i++)
|
||||
{
|
||||
PluginPair ppair;
|
||||
if(send)
|
||||
if (send)
|
||||
ppair = (*checksums)[i];
|
||||
|
||||
RW(ppair.first, send);
|
||||
|
||||
size_t hashSize = ppair.second.size();
|
||||
RW(hashSize, send);
|
||||
for(size_t j = 0; j < hashSize; j++)
|
||||
for (size_t j = 0; j < hashSize; j++)
|
||||
{
|
||||
unsigned hash;
|
||||
if(send)
|
||||
if (send)
|
||||
hash = ppair.second[j];
|
||||
RW(hash, send);
|
||||
if(!send)
|
||||
if (!send)
|
||||
ppair.second.push_back(hash);
|
||||
}
|
||||
if(!send)
|
||||
if (!send)
|
||||
checksums->push_back(ppair);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue