TrophyRace: fix nil error warning, caused by needlessly re-retrieving the name of the best hedgehog (which could be dead at that point)
--- a/share/hedgewars/Data/Maps/TrophyRace/map.lua Mon Oct 05 13:38:25 2015 +0200
+++ b/share/hedgewars/Data/Maps/TrophyRace/map.lua Wed Oct 07 23:20:31 2015 +0200
@@ -33,6 +33,7 @@
local worsthog = nil
local besthog = nil
+local besthogname = ''
-- best time
local besttime = maxtime + 1
@@ -142,6 +143,7 @@
if ttime < besttime then
besttime = ttime
besthog = CurrentHedgehog
+ besthogname = GetHogName(besthog)
hscore = hscore .. loc("NEW fastest lap: ")
else
hscore = hscore .. loc("Fastest lap: ")
@@ -150,7 +152,7 @@
worsttime = ttime
worsthog = CurrentHedgehog
end
- hscore = hscore .. GetHogName(besthog) .. " - " .. (besttime / 1000) .. " s | |" .. loc("Best laps per team: ")
+ hscore = hscore .. besthogname .. " - " .. (besttime / 1000) .. " s | |" .. loc("Best laps per team: ")
if clan == ClansCount -1 then
-- Time for elimination - worst hog is out and the worst hog vars are reset.