Refactor code to make it easier to do 'nopredict' inside of any function without having a dependency on world model.

This commit is contained in:
2023-03-01 16:07:13 -05:00
parent aa77480fb5
commit 9ce34d950b
15 changed files with 86 additions and 49 deletions

View File

@@ -104,7 +104,7 @@ public:
// The constructor also calls 'lua_open' to create a new
// lua interpreter for this world model.
//
World(util::WorldType wt);
World(WorldType wt);
// Destructor.
//
@@ -236,8 +236,8 @@ public:
// Check if the world is authoritative.
//
bool is_authoritative() const { return (world_type_ == util::WORLD_TYPE_MASTER) || (world_type_ == util::WORLD_TYPE_STANDALONE); }
bool is_authoritative() const { return LuaStack::is_authoritative(world_type_); }
// Get a table showing all outstanding HTTP requests.
//
const HttpClientRequestMap &http_requests() const { return http_requests_; }
@@ -249,6 +249,9 @@ public:
// Snapshot and rollback.
//
// These are used by the client to convert the synchronous model
// to an asynchronous model and back.
//
void snapshot();
void rollback();
bool snapshot_empty() { return snapshot_.empty(); }
@@ -494,7 +497,7 @@ public:
private:
// Type of model
util::WorldType world_type_;
WorldType world_type_;
// A lua intepreter with snapshot function.
//