mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-12 09:31:30 +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 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<int>(cur);
|
||||
} catch(luabind::cast_failed &) {
|
||||
for (int i = 1; i <= MAXCHOOSERENTRIES; ++i)
|
||||
{
|
||||
if (luabind::type(table[i]) == LUA_TNUMBER)
|
||||
{
|
||||
tasks[i - 1] = luabind::object_cast<int>(table[i]);
|
||||
++count;
|
||||
}
|
||||
} else {
|
||||
count = i - 1;
|
||||
break;
|
||||
}
|
||||
|
||||
tasks[i - 1] = cur_value;
|
||||
}
|
||||
quest_manager.taskselector(count, tasks);
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user