diff_tables and patch_table are working and tested

This commit is contained in:
2021-08-31 20:03:33 -04:00
parent 82f1f69c25
commit 013992400e
10 changed files with 261 additions and 87 deletions

View File

@@ -57,6 +57,9 @@ World::World(util::WorldType wt) {
// Create the tangibles table in the registry.
LS.rawset(LuaRegistry, "tangibles", LuaNewTable);
// Create the globaldb in the registry.
LS.rawset(LuaRegistry, "globaldb", LuaNewTable);
// Initialize the SourceDB. At this stage, the sourcedb is
// empty, so it's just populating the lua builtins.
source_db_.init(state());
@@ -755,7 +758,7 @@ void World::difference_transmit(int64_t actor_id, World *master, StreamBuffer *s
// Pair tables from the synchronous and master models.
pair_lua_tables(closetans, master->state());
int ncreate = pair_new_tables(closetans, master->state());
int ncreate = number_remaining_tables(closetans, master->state());
sb->write_int32(ncreate);
create_new_tables(ncreate);
@@ -1113,7 +1116,7 @@ LuaDefine(unittests_world, "c") {
// The master world model above has two tables that couldn't be paired
// to the client: inventory.cplx, and transactions. These two tables
// should be paired to new, created tables.
ncreate = m->pair_new_tables(util::id_vector_create(123), m->state());
ncreate = m->number_remaining_tables(util::id_vector_create(123), m->state());
LuaAssert(L, ncreate == 2);
ss->create_new_tables(ncreate);
LuaAssertStrEq(L, ss->paired_tables_debug_string(m->state()),