Пример #1
0
bool travel_by_air_branch_0_expand(Method_Instance* method, Planner_State& pstate, void* world)
{
	p3_state* precondition = plnnr::precondition<p3_state>(method);
	travel_by_air_args* method_args = plnnr::arguments<travel_by_air_args>(method);
	Worldstate* wstate = static_cast<Worldstate*>(world);

	PLNNR_COROUTINE_BEGIN(*method);

	precondition = push_precondition<p3_state>(pstate, method);
	precondition->_0 = method_args->_0;
	precondition->_2 = method_args->_1;

	while (next(*precondition, *wstate))
	{
		{
			Method_Instance* t = push_method(pstate, task_travel, travel_branch_0_expand);
			travel_args* a = push_arguments<travel_args>(pstate, t);
			a->_0 = method_args->_0;
			a->_1 = precondition->_1;
		}

		PLNNR_COROUTINE_YIELD(*method, 1);

		if (method->flags & method_flags_failed)
		{
			continue;
		}

		{
			Task_Instance* t = push_task(pstate, task_fly, 0);
			fly_args* a = push_arguments<fly_args>(pstate, t);
			a->_0 = precondition->_1;
			a->_1 = precondition->_3;
		}

		PLNNR_COROUTINE_YIELD(*method, 2);

		{
			Method_Instance* t = push_method(pstate, task_travel, travel_branch_0_expand);
			travel_args* a = push_arguments<travel_args>(pstate, t);
			a->_0 = precondition->_3;
			a->_1 = method_args->_1;
		}

		method->flags |= method_flags_expanded;
		PLNNR_COROUTINE_YIELD(*method, 3);
	}

	PLNNR_COROUTINE_END();
}
Пример #2
0
bool travel_branch_1_expand(Method_Instance* method, Planner_State& pstate, void* world)
{
	p2_state* precondition = plnnr::precondition<p2_state>(method);
	travel_args* method_args = plnnr::arguments<travel_args>(method);
	Worldstate* wstate = static_cast<Worldstate*>(world);

	PLNNR_COROUTINE_BEGIN(*method);

	precondition = push_precondition<p2_state>(pstate, method);
	precondition->_0 = method_args->_0;
	precondition->_1 = method_args->_1;

	while (next(*precondition, *wstate))
	{
		{
			Method_Instance* t = push_method(pstate, task_travel_by_air, travel_by_air_branch_0_expand);
			travel_by_air_args* a = push_arguments<travel_by_air_args>(pstate, t);
			a->_0 = method_args->_0;
			a->_1 = method_args->_1;
		}

		method->flags |= method_flags_expanded;
		PLNNR_COROUTINE_YIELD(*method, 1);
	}

	PLNNR_COROUTINE_END();
}
Пример #3
0
	void class_start(lua_State * L, const char * clsName, const char * superName, int classID, SCRIPT_CALLBACK ctor)
	{
		clsTop = lua_gettop(L);
		clsMap [ classID ] = clsName;

		push_method( L, clsName, ctor, 1 );

		_newmetatable( L, clsName );
	
		if ( superName ) // copy all inherited members to 'this' metatable
		{
			int c = lua_gettop(L);
			lua_pushstring( L, superName );
			lua_gettable( L, LUA_REGISTRYINDEX );

		    lua_pushnil(L);  // first key 
			while (lua_next(L, -2) != 0) 
			{
				// don't copy __index & __gc, etc:
				if ( strstr( lua_tostring(L,-2), "__" ) )
				{
			        lua_pop(L, 1);  // removes `value'; keeps `key' for next iteration 
					continue;
				}
				lua_pushvalue( L,  c ); // the table
				lua_pushvalue( L, -3 ); // the key
				lua_pushvalue( L, -3 ); // the value
				lua_settable( L, -3 );  // set table
		        lua_pop(L, 1);  // removes table
		        lua_pop(L, 1);  // removes `value'; keeps `key' for next iteration 
		    }
			lua_settop(L,c);
		}
	}
Пример #4
0
bool root_branch_0_expand(Method_Instance* method, Planner_State& pstate, void* world)
{
    p0_state* precondition = plnnr::precondition<p0_state>(method);
    Worldstate* wstate = static_cast<Worldstate*>(world);

    PLNNR_COROUTINE_BEGIN(*method);

    precondition = push_precondition<p0_state>(pstate, method);

    while (next(*precondition, *wstate))
    {
        {
            Method_Instance* t = push_method(pstate, task_Move_Stack, Move_Stack_branch_0_expand);
            Move_Stack_args* a = push_arguments<Move_Stack_args>(pstate, t);
            a->_0 = precondition->_3;
            a->_1 = precondition->_0;
            a->_2 = precondition->_1;
            a->_3 = precondition->_2;
        }

        method->flags |= method_flags_expanded;
        PLNNR_COROUTINE_YIELD(*method, 1);
    }

    PLNNR_COROUTINE_END();
}
Пример #5
0
bool Move_Stack_branch_0_expand(Method_Instance* method, Planner_State& pstate, void* world)
{
    p1_state* precondition = plnnr::precondition<p1_state>(method);
    Move_Stack_args* method_args = plnnr::arguments<Move_Stack_args>(method);
    Worldstate* wstate = static_cast<Worldstate*>(world);

    PLNNR_COROUTINE_BEGIN(*method);

    precondition = push_precondition<p1_state>(pstate, method);
    precondition->_0 = method_args->_0;
    precondition->_2 = method_args->_1;
    precondition->_3 = method_args->_2;
    precondition->_4 = method_args->_3;

    while (next(*precondition, *wstate))
    {
        {
            Method_Instance* t = push_method(pstate, task_Move_Stack, Move_Stack_branch_0_expand);
            Move_Stack_args* a = push_arguments<Move_Stack_args>(pstate, t);
            a->_0 = precondition->_1;
            a->_1 = method_args->_1;
            a->_2 = method_args->_3;
            a->_3 = method_args->_2;
        }

        PLNNR_COROUTINE_YIELD(*method, 1);

        if (method->flags & method_flags_failed)
        {
            continue;
        }

        {
            Method_Instance* t = push_method(pstate, task_Move_Stack, Move_Stack_branch_0_expand);
            Move_Stack_args* a = push_arguments<Move_Stack_args>(pstate, t);
            a->_0 = method_args->_0;
            a->_1 = method_args->_1;
            a->_2 = method_args->_2;
            a->_3 = method_args->_3;
        }

        PLNNR_COROUTINE_YIELD(*method, 2);

        if (method->flags & method_flags_failed)
        {
            continue;
        }

        {
            Method_Instance* t = push_method(pstate, task_Move_Stack, Move_Stack_branch_0_expand);
            Move_Stack_args* a = push_arguments<Move_Stack_args>(pstate, t);
            a->_0 = precondition->_1;
            a->_1 = method_args->_3;
            a->_2 = method_args->_2;
            a->_3 = method_args->_1;
        }

        method->flags |= method_flags_expanded;
        PLNNR_COROUTINE_YIELD(*method, 3);
    }

    return expand_next_branch(pstate, Move_Stack_branch_1_expand, world);
    PLNNR_COROUTINE_END();
}