mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 17:51:28 +00:00
[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)
This commit is contained in:
parent
e1f515ba4b
commit
6068085de4
@ -605,21 +605,15 @@ void lua_task_selector(luabind::adl::object table) {
|
|||||||
int tasks[MAXCHOOSERENTRIES] = { 0 };
|
int tasks[MAXCHOOSERENTRIES] = { 0 };
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
for(int i = 1; i <= MAXCHOOSERENTRIES; ++i) {
|
for (int i = 1; i <= MAXCHOOSERENTRIES; ++i)
|
||||||
auto cur = table[i];
|
{
|
||||||
int cur_value = 0;
|
if (luabind::type(table[i]) == LUA_TNUMBER)
|
||||||
if(luabind::type(cur) != LUA_TNIL) {
|
{
|
||||||
try {
|
tasks[i - 1] = luabind::object_cast<int>(table[i]);
|
||||||
cur_value = luabind::object_cast<int>(cur);
|
++count;
|
||||||
} catch(luabind::cast_failed &) {
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
count = i - 1;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks[i - 1] = cur_value;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
quest_manager.taskselector(count, tasks);
|
quest_manager.taskselector(count, tasks);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user