/** * @brief Finishes the mission. * * @luaparam properly If true and the mission is unique it marks the mission * as completed. If false it deletes the mission but * doesn't mark it as completed. If the parameter isn't * passed it just ends the mission (without removing it * from the player's list of active missions). * @luafunc finish( properly ) */ static int misn_finish( lua_State *L ) { int b; Mission *cur_mission; if (lua_isboolean(L,1)) b = lua_toboolean(L,1); else { lua_pushstring(L, NLUA_DONE); lua_error(L); /* THERE IS NO RETURN */ return 0; } lua_pushboolean( L, 1 ); lua_setglobal( L, "__misn_delete" ); cur_mission = misn_getFromLua(L); if (b && mis_isFlag(cur_mission->data,MISSION_UNIQUE)) player_missionFinished( mission_getID( cur_mission->data->name ) ); lua_pushstring(L, NLUA_DONE); lua_error(L); /* shouldn't return */ return 0; }
/** * @brief Finishes the mission. * * @luaparam properly If true and the mission is unique it marks the mission * as completed. If false it deletes the mission but * doesn't mark it as completed. If the parameter isn't * passed it just ends the mission. * @luafunc finish( properly ) */ static int misn_finish( lua_State *L ) { int b; if (lua_isboolean(L,1)) b = lua_toboolean(L,1); else { lua_pushstring(L, "Mission Done"); lua_error(L); /* THERE IS NO RETURN */ return 0; } misn_delete = 1; if (b && mis_isFlag(cur_mission->data,MISSION_UNIQUE)) player_missionFinished( mission_getID( cur_mission->data->name ) ); lua_pushstring(L, "Mission Done"); lua_error(L); /* shouldn't return */ return 0; }