Objects: Fixed a possible runtime error in the Parkour goal

stable-5.1
Maikel de Vries 2011-01-14 22:32:50 +01:00
parent 503172bf99
commit 9b26363e52
1 changed files with 4 additions and 1 deletions

View File

@ -206,12 +206,15 @@ public func Activate(int plr)
public func GetShortDescription(int plr)
{
var team = GetPlayerTeam(plr);
var parkour_length = GetParkourLength();
if (parkour_length == 0)
return "";
var length;
if (team)
length = GetTeamPosition(team);
else
length = GetPlayerPosition(plr);
var percentage = 100 * length / GetParkourLength();
var percentage = 100 * length / parkour_length;
var red = BoundBy(255 - percentage * 255 / 100, 0, 255);
var green = BoundBy(percentage * 255 / 100, 0, 255);
var color = RGB(red, green, 0);