本文整理汇总了C++中Quest::isCompleted方法的典型用法代码示例。如果您正苦于以下问题:C++ Quest::isCompleted方法的具体用法?C++ Quest::isCompleted怎么用?C++ Quest::isCompleted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Quest
的用法示例。
在下文中一共展示了Quest::isCompleted方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Quest_complete
/**
* Silently sets the quest completed/finished flag, this does not fire any events.
*
* @param boolean completed Sets if the quest has been completed/finished.
* @returns am.quest This
*/
int Quest_complete(lua_State *lua)
{
Quest *quest = castUData<Quest>(lua, 1);
if (quest)
{
if (lua_gettop(lua) == 1)
{
lua_pushboolean(lua, quest->isCompleted());
return 1;
}
else if (lua_isbool(lua, 2))
{
quest->setCompleted(lua_tobool(lua, 2));
lua_first(lua);
}
return LuaState::expectedArgs(lua, "complete", "boolean complete");
}
return LuaState::expectedContext(lua, "complete", "am.quest");
}
示例2: QuestL_IsComplete
static int QuestL_IsComplete(lua_State* luaVM)
{
bool complete = false;
int nargs = lua_gettop(luaVM);
switch(nargs)
{
case 1:
{
Quest* quest = luaW_check<Quest>(luaVM, 1);
if(quest != NULL)
{
complete = quest->isCompleted();
}
break;
}
}
lua_pushboolean(luaVM, complete);
return 1;
}
示例3: testSimple
bool TestLuaQuest::testSimple() {
LuaState lua;
Engine *prevEng = Engine::getEngine();
Engine *eng = new Engine();
Engine::setEngine(eng);
Handle<Game> game(new Game(eng));
eng->setCurrentGame(game);
Handle<Character> main(new Character());
main->setGameId("testMainChar");
game->setMainCharacter(main);
int loadResult = lua.loadString("Quest, Character, Engine, Game, CoinPurse = import("
"\"Quest\", \"Character\", \"Engine\", \"Game\", \"CoinPurse\")\n"
"local quest = Quest.new(\"testQuest\")\n"
"Quest.add_quest(quest)\n"
"local game = Engine.game()\n"
"local main = game:main()\n"
"local questStarted = false\n"
"function startQuest(event)\n"
" main:on(\"talk\", finishQuest)\n"
" main:off(\"talk\", startQuest)\n"
"end\n"
"function finishQuest(event)\n"
" main:off(\"talk\", finishQuest)\n"
" main:add_experience(1000)\n"
" main:coin_purse():add_coin(50)\n"
" quest:set_complete(true)\n"
"end\n"
"main:on(\"talk\", startQuest)\n"
);
if (!loadResult)
{
lua.logStack("LOAD ERR");
}
assert(loadResult);
lua_Debug ar;
lua_getstack(lua, 1, &ar);
Quest *quest = Engine::getGame()->getQuest("testQuest");
assert(!quest->isCompleted());
am_equals(0, main->getExperience());
am_equals(0, main->getLevel());
am_equals(0u, main->getCoinPurse()->getCoin());
Handle<Event> startEvent(new Event("talk"));
main->fireEvent<Event>(startEvent);
main->fireEvent<Event>(startEvent);
am_equals(1000, main->getExperience());
am_equals(1, main->getLevel());
am_equals(50u, main->getCoinPurse()->getCoin());
Engine::setEngine(prevEng);
delete eng;
return true;
}