From 6068085de46856aed12f172197892bdc99df89af Mon Sep 17 00:00:00 2001 From: hg <4683435+hgtw@users.noreply.github.com> Date: Sun, 31 Jul 2022 18:52:18 -0400 Subject: [PATCH] [Quest API] Fix lua task selector count when over max (#2353) This was leaving the task count at 0 if called with more than the max number of tasks (40) --- zone/lua_general.cpp | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/zone/lua_general.cpp b/zone/lua_general.cpp index 506430ad4..2707ea669 100644 --- a/zone/lua_general.cpp +++ b/zone/lua_general.cpp @@ -605,21 +605,15 @@ void lua_task_selector(luabind::adl::object table) { int tasks[MAXCHOOSERENTRIES] = { 0 }; int count = 0; - for(int i = 1; i <= MAXCHOOSERENTRIES; ++i) { - auto cur = table[i]; - int cur_value = 0; - if(luabind::type(cur) != LUA_TNIL) { - try { - cur_value = luabind::object_cast(cur); - } catch(luabind::cast_failed &) { - } - } else { - count = i - 1; - break; + for (int i = 1; i <= MAXCHOOSERENTRIES; ++i) + { + if (luabind::type(table[i]) == LUA_TNUMBER) + { + tasks[i - 1] = luabind::object_cast(table[i]); + ++count; } - - tasks[i - 1] = cur_value; } + quest_manager.taskselector(count, tasks); }