equal
deleted
inserted
replaced
131 -- racer vars |
131 -- racer vars |
132 -------- |
132 -------- |
133 |
133 |
134 local cGear = nil |
134 local cGear = nil |
135 |
135 |
136 local bestClan = nil |
136 local bestClan = 10 |
137 local bestTime = nil |
137 local bestTime = 1000000 |
138 |
138 |
139 local gameBegun = false |
139 local gameBegun = false |
140 local gameOver = false |
140 local gameOver = false |
141 local racerActive = false |
141 local racerActive = false |
142 local trackTime = 0 |
142 local trackTime = 0 |
203 -- make a list of individual team names |
203 -- make a list of individual team names |
204 for i = 0, (TeamsCount-1) do |
204 for i = 0, (TeamsCount-1) do |
205 teamNameArr[i] = " " |
205 teamNameArr[i] = " " |
206 teamSize[i] = 0 |
206 teamSize[i] = 0 |
207 teamIndex[i] = 0 |
207 teamIndex[i] = 0 |
208 teamScore[i] = 100000 |
208 teamScore[i] = 1000000 |
209 end |
209 end |
210 numTeams = 0 |
210 numTeams = 0 |
211 |
211 |
212 for i = 0, (numhhs-1) do |
212 for i = 0, (numhhs-1) do |
213 |
213 |
332 return(trackFinished) |
332 return(trackFinished) |
333 |
333 |
334 end |
334 end |
335 |
335 |
336 function AdjustScores() |
336 function AdjustScores() |
337 |
337 bestTimeComment = loc("Did not finish") |
338 if bestTime == nil then |
|
339 bestTime = 100000 |
|
340 bestClan = 10 |
|
341 bestTimeComment = "N/A" |
|
342 end |
|
343 |
338 |
344 newScore = false |
339 newScore = false |
345 |
340 |
346 -- update this clan's time if the new track is better |
341 -- update this clan's time if the new track is better |
347 for i = 0, (numTeams-1) do |
342 for i = 0, (numTeams-1) do |
361 bestTime = teamScore[i] |
356 bestTime = teamScore[i] |
362 bestClan = teamClan[i] |
357 bestClan = teamClan[i] |
363 end |
358 end |
364 end |
359 end |
365 |
360 |
366 if bestTime ~= 100000 then |
361 if bestTime ~= 1000000 then |
367 bestTimeComment = string.format(loc("%.1fs"), (bestTime/1000)) |
362 bestTimeComment = string.format(loc("%.1fs"), (bestTime/1000)) |
368 end |
363 end |
369 |
364 |
370 if newScore == true then |
365 if newScore == true then |
371 if trackTime == bestTime then -- best time of the race |
366 if trackTime == bestTime then -- best time of the race |
413 |
408 |
414 roundNumber = roundNumber + 1 |
409 roundNumber = roundNumber + 1 |
415 |
410 |
416 totalComment = "" |
411 totalComment = "" |
417 for i = 0, (TeamsCount-1) do |
412 for i = 0, (TeamsCount-1) do |
418 if teamNameArr[i] ~= " " and teamScore[i] ~= -1 then |
413 if teamNameArr[i] ~= " " and teamScore[i] ~= 1000000 then |
419 teamComment[i] = string.format(loc("%s: %.1fs"), teamNameArr[i], (teamScore[i]/1000)) .. "|" |
414 teamComment[i] = string.format(loc("%s: %.1fs"), teamNameArr[i], (teamScore[i]/1000)) .. "|" |
420 else |
415 else |
421 teamComment[i] = string.format(loc("%s: N/A"), teamNameArr[i]) .. "|" |
416 teamComment[i] = string.format(loc("%s: Did not finish"), teamNameArr[i]) .. "|" |
422 end |
417 end |
423 totalComment = totalComment .. teamComment[i] |
418 totalComment = totalComment .. teamComment[i] |
424 end |
419 end |
425 |
420 |
426 ShowMission( loc("Racer"), |
421 ShowMission( loc("Racer"), |
436 -- Sort the scores for the ranking list |
431 -- Sort the scores for the ranking list |
437 local unfinishedArray = {} |
432 local unfinishedArray = {} |
438 local sortedTeams = {} |
433 local sortedTeams = {} |
439 local k = 1 |
434 local k = 1 |
440 for i = 0, TeamsCount-1 do |
435 for i = 0, TeamsCount-1 do |
441 if teamScore[i] ~= 100000 and teamNameArr[i] ~= " " then |
436 if teamScore[i] ~= 1000000 and teamNameArr[i] ~= " " then |
442 sortedTeams[k] = {} |
437 sortedTeams[k] = {} |
443 sortedTeams[k].name = teamNameArr[i] |
438 sortedTeams[k].name = teamNameArr[i] |
444 sortedTeams[k].score = teamScore[i] |
439 sortedTeams[k].score = teamScore[i] |
445 k = k + 1 |
440 k = k + 1 |
446 else |
441 else |
813 end |
808 end |
814 |
809 |
815 map = detectMapWithDigest() |
810 map = detectMapWithDigest() |
816 |
811 |
817 for i = 0, (numTeams-1) do |
812 for i = 0, (numTeams-1) do |
818 if teamScore[i] < 100000 then |
813 if teamScore[i] < 1000000 then |
819 DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i]) |
814 DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i]) |
820 end |
815 end |
821 end |
816 end |
822 |
817 |
823 if map ~= nil and fastCount > 0 then |
818 if map ~= nil and fastCount > 0 then |