diff transmission code tested!!!

This commit is contained in:
2021-09-10 17:06:07 -04:00
parent aedd8ca43a
commit 6fbe700107
10 changed files with 1354 additions and 1131 deletions

View File

@@ -117,7 +117,7 @@ public:
// pushdb is true, pushes the tangible's database onto the lua stack.
// Otherwise, leaves the lua stack untouched.
//
Tangible *tangible_make(lua_State *L, int64_t id, bool pushdb);
Tangible *tangible_make(lua_State *L, int64_t id, const std::string &plane, bool pushdb);
// Get the tangible ID of the specified LUA tangible database.
//
@@ -197,7 +197,22 @@ public:
void snapshot();
void rollback();
util::IdVector get_visible_union(int64_t actor_id, World *master);
private:
// Run any threads which according to the scheduler queue are ready.
//
void run_scheduled_threads(int64_t clk);
// Store a pointer to a world model into a lua registry.
//
static void store_global_pointer(lua_State *L, World *w);
// Check that the main thread has nothing on the stack
//
bool stack_is_clear() const { return lua_gettop(state()) == 0; }
// Invoke a plan.
//
void invoke_plan(int64_t actor_id, int64_t place_id, const std::string &action, const InvocationData &idata);
public:
////////////////////////////////////////////////////////////////////////////
@@ -242,23 +257,35 @@ public:
// Pretty-print the entire tangible database and return it as a string.
//
std::string tangible_pprint(int64_t id) const;
// Set the tangible's lua class.
//
void tangible_set_class(int64_t id, const std::string &c) const;
// Get the tangible's lua class (returns empty string if none).
//
std::string tangible_get_class(int64_t id) const;
private:
// Run any threads which according to the scheduler queue are ready.
//
void run_scheduled_threads(int64_t clk);
// Store a pointer to a world model into a lua registry.
public:
///////////////////////////////////////////////////////////
//
static void store_global_pointer(lua_State *L, World *w);
// world-difftab: Nonrecursive table comparison
//
// These routines compare tables in the master lua to the corresponding
// tables in the synchronous lua. This is a nonrecursive process, because
// the recursion has already been done during the table enumeration process.
//
///////////////////////////////////////////////////////////
// Check that the main thread has nothing on the stack
//
bool stack_is_clear() const { return lua_gettop(state()) == 0; }
void patch_numbered_tables(StreamBuffer *sb);
void diff_numbered_tables(lua_State *master, StreamBuffer *sb);
// Invoke a plan.
//
void invoke_plan(int64_t actor_id, int64_t place_id, const std::string &action, const InvocationData &idata);
void patch_tangible_databases(StreamBuffer *sb);
void diff_tangible_databases(const IdVector &basis, lua_State *master, StreamBuffer *sb);
void patch_tangible_classes(StreamBuffer *sb);
void diff_tangible_classes(const IdVector &basis, lua_State *master, StreamBuffer *sb);
public:
///////////////////////////////////////////////////////////
@@ -267,6 +294,8 @@ public:
//
///////////////////////////////////////////////////////////
util::IdVector get_visible_union(int64_t actor_id, World *master);
int64_t patch_actor(StreamBuffer *sb);
void diff_actor(int64_t actor_id, World *master, StreamBuffer *sb);
@@ -276,6 +305,9 @@ public:
void patch_luatabs(StreamBuffer *sb);
void diff_luatabs(int64_t actor_id, World *master, StreamBuffer *sb);
void patch_tanclass(StreamBuffer *sb);
void diff_tanclass(int64_t actor_id, World *master, StreamBuffer *sb);
// This is the main entry point for difference transmission.
//
void patch_everything(StreamBuffer *sb);
@@ -335,23 +367,6 @@ public:
//
void unnumber_lua_tables();
public:
///////////////////////////////////////////////////////////
//
// world-difftab: Nonrecursive table comparison
//
// These routines compare tables in the master lua to the corresponding
// tables in the synchronous lua. This is a nonrecursive process, because
// the recursion has already been done during the table enumeration process.
//
///////////////////////////////////////////////////////////
void patch_numbered_tables(StreamBuffer *sb);
void diff_numbered_tables(lua_State *master, StreamBuffer *sb);
void patch_tangible_databases(StreamBuffer *sb);
void diff_tangible_databases(const IdVector &basis, lua_State *master, StreamBuffer *sb);
private:
// Type of model
util::WorldType world_type_;