mirror of
https://github.com/rwengine/openrw.git
synced 2024-11-22 02:12:45 +01:00
Convert functions to unordered_map and use reserve
This commit is contained in:
parent
4063fabe52
commit
84c09d93ce
@ -1,8 +1,8 @@
|
||||
#ifndef _LIBRW_RW_FORWARD_HPP_
|
||||
#define _LIBRW_RW_FORWARD_HPP_
|
||||
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
// Forward Declarations
|
||||
|
@ -2,13 +2,12 @@
|
||||
#define _RWENGINE_SCRIPTMODULE_HPP_
|
||||
|
||||
#include <cstddef>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <script/ScriptTypes.hpp>
|
||||
#include "ScriptMachine.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace script_bind {
|
||||
template <class T>
|
||||
struct arg_traits {
|
||||
@ -172,9 +171,13 @@ public:
|
||||
|
||||
bool findOpcode(ScriptFunctionID id, ScriptFunctionMeta** out);
|
||||
|
||||
void reserveFunctions(size_t nr) {
|
||||
functions.reserve(nr);
|
||||
}
|
||||
|
||||
private:
|
||||
const std::string name;
|
||||
std::map<ScriptFunctionID, ScriptFunctionMeta> functions;
|
||||
std::unordered_map<ScriptFunctionID, ScriptFunctionMeta> functions;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -14,6 +14,8 @@
|
||||
#include "GTA3ModuleImpl.inl"
|
||||
|
||||
GTA3Module::GTA3Module() : ScriptModule("GTA3") {
|
||||
reserveFunctions(903);
|
||||
|
||||
bind(0x0000, 0, opcode_0000);
|
||||
bind(0x0001, 1, opcode_0001);
|
||||
bind(0x0002, 1, opcode_0002);
|
||||
|
Loading…
Reference in New Issue
Block a user