1
0
mirror of https://github.com/rwengine/openrw.git synced 2024-10-06 09:07:19 +02:00

Use unordered_map and reserve for bones

This commit is contained in:
Filip Gawin 2018-11-23 21:45:35 +01:00
parent 835c0147fe
commit 8fbf201b8d
2 changed files with 5 additions and 3 deletions

View File

@ -76,6 +76,8 @@ bool LoaderIFP::loadFromMemory(char* data) {
DGAN* animroot = read<DGAN>(data, dataI);
std::string infoname = readString(data, dataI);
animation->bones.reserve(static_cast<unsigned>(animroot->info.entries));
for (int c = 0; c < animroot->info.entries; ++c) {
size_t start = data_offs;
CPAN* cpan = read<CPAN>(data, dataI);
@ -83,7 +85,7 @@ bool LoaderIFP::loadFromMemory(char* data) {
AnimationBone boneData{};
boneData.name = frames->name;
boneData.frames.reserve(frames->frames);
boneData.frames.reserve(static_cast<unsigned>(frames->frames));
data_offs += ((8 + frames->base.size) - sizeof(ANIM));

View File

@ -3,8 +3,8 @@
#include <cstddef>
#include <cstdint>
#include <map>
#include <string>
#include <unordered_map>
#include <vector>
#include <glm/glm.hpp>
@ -67,7 +67,7 @@ struct AnimationBone {
*/
struct Animation {
std::string name;
std::map<std::string, AnimationBone> bones;
std::unordered_map<std::string, AnimationBone> bones;
~Animation() = default;