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:
parent
835c0147fe
commit
8fbf201b8d
@ -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));
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user