Skip to content

Commit 690e13d

Browse files
committed
some safeguards
1 parent 4e8756c commit 690e13d

1 file changed

Lines changed: 14 additions & 7 deletions

File tree

Assets/Lua/Doom/doom.misc.lua

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1177,15 +1177,15 @@ local function settings_read()
11771177

11781178
-- TRACKED ENTITIES
11791179
if not Config.tracked then return end
1180-
for _,type in pairs(TrackedType) do
1181-
local entity = Tracked[type]
1180+
for _,ttype in pairs(TrackedType) do
1181+
local entity = Tracked[ttype]
11821182
local source = Config.tracked[entity.Name]
11831183
entity.Current = source.Current
11841184
entity.Min = math.maxinteger
11851185
entity.Max = math.mininteger
11861186

11871187
if entity.Current then
1188-
if type == TrackedType.LINE then
1188+
if ttype == TrackedType.LINE then
11891189
for _,v in pairs(source.TrackedList) do
11901190
for _, line in pairs(Globals.lines) do
11911191
if v == line.iLineID then
@@ -1196,7 +1196,7 @@ local function settings_read()
11961196
end
11971197
end
11981198
end
1199-
elseif type == TrackedType.SECTOR then
1199+
elseif ttype == TrackedType.SECTOR then
12001200
for _,v in pairs(source.TrackedList) do
12011201
for _, sector in pairs(Globals.sectors) do
12021202
if v == sector.iSectorID then
@@ -1207,7 +1207,7 @@ local function settings_read()
12071207
end
12081208
end
12091209
end
1210-
elseif type == TrackedType.THING then
1210+
elseif ttype == TrackedType.THING then
12111211
for _,v in pairs(source.TrackedList) do
12121212
for _, mobj in pairs(Globals.mobjs:readbulk()) do
12131213
if v == mobj.index then
@@ -1220,9 +1220,15 @@ local function settings_read()
12201220
end
12211221
end
12221222

1223-
if not entity.TrackedList[entity.Current] then
1223+
if not entity.TrackedList[entity.Current]
1224+
and entity.Min ~= math.maxinteger
1225+
then
12241226
entity.Current = entity.Min
12251227
end
1228+
1229+
if entity.Min == math.maxinteger then
1230+
entity.Current = nil
1231+
end
12261232
end
12271233
end
12281234
end
@@ -1256,6 +1262,7 @@ function settings_write()
12561262
file:write("\n")
12571263

12581264
-- TRACKED ENTITIES
1265+
file:write("-- keys in TrackedList are internal and meaningless, values hold actual IDs of tracked entities\n")
12591266
local tracked = {}
12601267

12611268
for _,t in pairs(TrackedType) do
@@ -1430,7 +1437,7 @@ function make_button(x, y, name, func)
14301437

14311438
-- delete button
14321439
if name == " X " then
1433-
colors = { 0x66ff6666, 0xaaff0000, 0xffff0000 }
1440+
colors = { 0x88ff8888, 0xffff0000, 0xffff0000 }
14341441
end
14351442

14361443
if x < 0 then x = ScreenWidth + x end

0 commit comments

Comments
 (0)