Skip to content
This repository has been archived by the owner on Apr 2, 2023. It is now read-only.

Commit

Permalink
Optimizations with GCC 4.8 lib
Browse files Browse the repository at this point in the history
  • Loading branch information
foxtacles committed Dec 4, 2013
1 parent 3f51ffc commit 2d96626
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 17 deletions.
10 changes: 4 additions & 6 deletions source/Actor.cpp
Expand Up @@ -107,9 +107,8 @@ void Actor::initialize()
{
for (const auto& value : API::values)
{
// emplace
actor_Values.insert(make_pair(value.second, Value<float>()));
actor_BaseValues.insert(make_pair(value.second, Value<float>()));
actor_Values.emplace(value.second, Value<float>());
actor_BaseValues.emplace(value.second, Value<float>());
}

#ifdef VAULTMP_DEBUG
Expand Down Expand Up @@ -341,9 +340,8 @@ pPacket Actor::toPacket() const

for (const auto& value : actor_Values)
{
// emplace
values.insert(make_pair(value.first, this->GetActorValue(value.first)));
baseValues.insert(make_pair(value.first, this->GetActorBaseValue(value.first)));
values.emplace(value.first, this->GetActorValue(value.first));
baseValues.emplace(value.first, this->GetActorBaseValue(value.first));
}

pPacket pContainerNew = Container::toPacket();
Expand Down
6 changes: 2 additions & 4 deletions source/GameFactory.hpp
Expand Up @@ -316,8 +316,7 @@ struct GameFactory::Get_<T, RakNet::NetworkID> {
if (it == instances.end())
result[i] = VaultException("Unknown object with NetworkID %llu", id);
else
// emplace
sort.insert(make_pair(*it, i));
sort.emplace(*it, i);

++i;
}
Expand Down Expand Up @@ -412,8 +411,7 @@ RakNet::NetworkID GameFactory::Create(Args&&... args)

cs.Operate([id, type, &base]() {
++typecount[type];
// emplace
index[id] = instances.insert(make_pair(std::move(base), type)).first;
index[id] = instances.emplace(std::move(base), type).first;
});

return id;
Expand Down
3 changes: 1 addition & 2 deletions source/Player.cpp
Expand Up @@ -66,9 +66,8 @@ Player::~Player() noexcept

void Player::initialize()
{
// emplace
for (auto control : API::controls)
player_Controls.insert(make_pair(control, make_pair(Value<unsigned char>(), Value<bool>(true))));
player_Controls.emplace(control, make_pair(Value<unsigned char>(), Value<bool>(true)));

#ifdef VAULTSERVER
baseIDs.Operate([this](BaseIDTracker& baseIDs) {
Expand Down
3 changes: 1 addition & 2 deletions source/ServerEntry.cpp
Expand Up @@ -15,8 +15,7 @@ void ServerEntry::SetServerMap(const string& map)
void ServerEntry::SetServerRule(const string& rule, const string& value)
{
this->rules.erase(rule);
// emplace
this->rules.insert(make_pair(rule, value));
this->rules.emplace(rule, value);
}

void ServerEntry::SetServerPlayers(const pair<unsigned int, unsigned int>& players)
Expand Down
2 changes: 1 addition & 1 deletion source/packet
Submodule packet updated 1 files
+1 −2 PacketFactory.hpp
3 changes: 1 addition & 2 deletions source/vaultserver/Client.cpp
Expand Up @@ -12,9 +12,8 @@ stack<unsigned int> Client::clientID;
Client::Client(RakNetGUID guid, NetworkID player) : guid(guid), player(player)
{
cs.Operate([guid, this]() {
// emplace
ID = clientID.top();
clients.insert(make_pair(guid, this));
clients.emplace(guid, this);
clientID.pop();
});
}
Expand Down

0 comments on commit 2d96626

Please sign in to comment.