Fix Utils.FormatTime not working properly on different game speeds

This commit is contained in:
abcdefg30
2015-10-24 23:42:32 +02:00
parent e0177d7798
commit e65465c539

View File

@@ -19,12 +19,8 @@ namespace OpenRA.Mods.Common.Scripting
[ScriptGlobal("Utils")] [ScriptGlobal("Utils")]
public class UtilsGlobal : ScriptGlobal public class UtilsGlobal : ScriptGlobal
{ {
readonly World world;
public UtilsGlobal(ScriptContext context) public UtilsGlobal(ScriptContext context)
: base(context) : base(context) { }
{
world = context.World;
}
[Desc("Calls a function on every element in a collection.")] [Desc("Calls a function on every element in a collection.")]
public void Do(LuaValue[] collection, LuaFunction func) public void Do(LuaValue[] collection, LuaFunction func)
@@ -106,7 +102,7 @@ namespace OpenRA.Mods.Common.Scripting
[Desc("Returns the ticks formatted to HH:MM:SS.")] [Desc("Returns the ticks formatted to HH:MM:SS.")]
public string FormatTime(int ticks, bool leadingMinuteZero = true) public string FormatTime(int ticks, bool leadingMinuteZero = true)
{ {
return WidgetUtils.FormatTime(ticks, leadingMinuteZero, world.Timestep); return WidgetUtils.FormatTime(ticks, leadingMinuteZero, 40);
} }
} }
} }