Skip to content

Commit 240dc98

Browse files
committed
BUGFIX:
- Mission replacements of the last mission in the list did set the listStartIndex wrong.
1 parent d3cccda commit 240dc98

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

plugins/mission/lua/commands.lua

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ function dcsbot.startMission(json)
226226
json.result = net.missionlist_run(json.id)
227227
if json.result == true then
228228
utils.saveSettings({
229-
listStartIndex=json.id
229+
listStartIndex = json.id,
230+
current = json.id
230231
})
231232
end
232233
else
@@ -269,7 +270,8 @@ end
269270
function dcsbot.setStartIndex(json)
270271
log.write('DCSServerBot', log.DEBUG, 'Mission: setStartIndex()')
271272
utils.saveSettings({
272-
listStartIndex = json.id
273+
listStartIndex = json.id,
274+
current = json.id
273275
})
274276
end
275277

@@ -319,15 +321,11 @@ end
319321
function dcsbot.replaceMission(json)
320322
log.write('DCSServerBot', log.DEBUG, 'Mission: replaceMission()')
321323
local current_missions = net.missionlist_get()
324+
local listStartIndex = current_missions["listStartIndex"]
322325
net.missionlist_delete(tonumber(json.index))
323326
net.missionlist_append(json.path)
324327
net.missionlist_move(#current_missions["missionList"], tonumber(json.index))
325328
current_missions = net.missionlist_get()
326-
-- workaround DCS bug
327-
local listStartIndex = current_missions["listStartIndex"]
328-
if #current_missions['missionList'] < listStartIndex then
329-
listStartIndex = 1
330-
end
331329
utils.saveSettings({
332330
missionList = current_missions["missionList"],
333331
listStartIndex = listStartIndex

0 commit comments

Comments
 (0)