Add last location memoization in Lua context
This commit is contained in:
@@ -36,7 +36,9 @@ struct LocationDependentData
|
||||
|
||||
bool empty() const { return rtree.empty(); }
|
||||
|
||||
property_t operator()(const point_t &point, const char *key) const;
|
||||
std::vector<std::size_t> GetPropertyIndexes(const point_t &point) const;
|
||||
|
||||
property_t FindByKey(const std::vector<std::size_t> &property_indexes, const char *key) const;
|
||||
|
||||
private:
|
||||
void loadLocationDependentData(const boost::filesystem::path &file_path,
|
||||
|
||||
@@ -22,7 +22,8 @@ namespace extractor
|
||||
struct LuaScriptingContext final
|
||||
{
|
||||
LuaScriptingContext(const LocationDependentData &location_dependent_data)
|
||||
: location_dependent_data(location_dependent_data)
|
||||
: location_dependent_data(location_dependent_data),
|
||||
last_location_point(0., 180.) // assume (0,180) is invalid coordinate
|
||||
{
|
||||
}
|
||||
|
||||
@@ -52,7 +53,11 @@ struct LuaScriptingContext final
|
||||
|
||||
int api_version;
|
||||
sol::table profile_table;
|
||||
|
||||
// Reference to immutable location dependent data and locations memo
|
||||
const LocationDependentData &location_dependent_data;
|
||||
LocationDependentData::point_t last_location_point;
|
||||
std::vector<std::size_t> last_location_indexes;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user