本文整理汇总了C++中IRollbackManager::getNodeActors方法的典型用法代码示例。如果您正苦于以下问题:C++ IRollbackManager::getNodeActors方法的具体用法?C++ IRollbackManager::getNodeActors怎么用?C++ IRollbackManager::getNodeActors使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IRollbackManager
的用法示例。
在下文中一共展示了IRollbackManager::getNodeActors方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: l_rollback_get_node_actions
// rollback_get_node_actions(pos, range, seconds, limit) -> {{actor, pos, time, oldnode, newnode}, ...}
int ModApiRollback::l_rollback_get_node_actions(lua_State *L)
{
NO_MAP_LOCK_REQUIRED;
v3s16 pos = read_v3s16(L, 1);
int range = luaL_checknumber(L, 2);
time_t seconds = (time_t) luaL_checknumber(L, 3);
int limit = luaL_checknumber(L, 4);
Server *server = getServer(L);
IRollbackManager *rollback = server->getRollbackManager();
if (rollback == NULL) {
return 0;
}
std::list<RollbackAction> actions = rollback->getNodeActors(pos, range, seconds, limit);
std::list<RollbackAction>::iterator iter = actions.begin();
lua_createtable(L, actions.size(), 0);
for (unsigned int i = 1; iter != actions.end(); ++iter, ++i) {
lua_createtable(L, 0, 5); // Make a table with enough space pre-allocated
lua_pushstring(L, iter->actor.c_str());
lua_setfield(L, -2, "actor");
push_v3s16(L, iter->p);
lua_setfield(L, -2, "pos");
lua_pushnumber(L, iter->unix_time);
lua_setfield(L, -2, "time");
push_RollbackNode(L, iter->n_old);
lua_setfield(L, -2, "oldnode");
push_RollbackNode(L, iter->n_new);
lua_setfield(L, -2, "newnode");
lua_rawseti(L, -2, i); // Add action table to main table
}
return 1;
}