Dump best time ghost on console 0.9.22
authorunc0rr
Tue, 23 Feb 2016 13:45:49 +0300
branch0.9.22
changeset 12371 744e51920a04
parent 11635 11f6a4c316a1
child 12372 3e4044f959a9
Dump best time ghost on console
hedgewars/uScript.pas
hedgewars/uStats.pas
share/hedgewars/Data/Scripts/Multiplayer/Racer.lua
share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua
--- a/hedgewars/uScript.pas	Tue Mar 29 16:54:41 2016 +0200
+++ b/hedgewars/uScript.pas	Tue Feb 23 13:45:49 2016 +0300
@@ -2528,6 +2528,20 @@
     lc_declareachievement:= 0
 end;
 
+function lc_startghostpoints(L : Plua_State) : LongInt; Cdecl;
+begin
+    if CheckLuaParamCount(L, 1, 'StartGhostPoints', 'count') then
+        startGhostPoints(lua_tointeger(L, 1));
+    lc_startghostpoints:= 0
+end;
+
+function lc_dumppoint(L : Plua_State) : LongInt; Cdecl;
+begin
+    if CheckLuaParamCount(L, 2, 'DumpPoint', 'x, y') then
+        dumpPoint(lua_tointeger(L, 1), lua_tointeger(L, 2));
+    lc_dumppoint:= 0
+end;
+
 
 procedure ScriptFlushPoints();
 begin
@@ -3345,6 +3359,8 @@
 lua_register(luaState, _P'SetGearAIHints', @lc_setgearaihints);
 lua_register(luaState, _P'HedgewarsScriptLoad', @lc_hedgewarsscriptload);
 lua_register(luaState, _P'DeclareAchievement', @lc_declareachievement);
+lua_register(luaState, _P'StartGhostPoints', @lc_startghostpoints);
+lua_register(luaState, _P'DumpPoint', @lc_dumppoint);
 
 ScriptSetInteger('TEST_SUCCESSFUL'   , HaltTestSuccess);
 ScriptSetInteger('TEST_FAILED'       , HaltTestFailed);
--- a/hedgewars/uStats.pas	Tue Mar 29 16:54:41 2016 +0200
+++ b/hedgewars/uStats.pas	Tue Feb 23 13:45:49 2016 +0300
@@ -36,6 +36,8 @@
 procedure SendStats;
 procedure hedgehogFlight(Gear: PGear; time: Longword);
 procedure declareAchievement(id, teamname, location: shortstring; value: LongInt);
+procedure startGhostPoints(n: LongInt);
+procedure dumpPoint(x, y: LongInt);
 
 implementation
 uses uSound, uLocale, uVariables, uUtils, uIO, uCaptions, uDebug, uMisc, uConsole, uScript;
@@ -323,8 +325,32 @@
     WriteLnToConsole(inttostr(value));
 end;
 
+procedure startGhostPoints(n: LongInt);
+begin
+    WriteLnToConsole('GHOST_POINTS');
+    WriteLnToConsole(inttostr(n));
+end;
+
+procedure dumpPoint(x, y: LongInt);
+begin
+    WriteLnToConsole(inttostr(x));
+    WriteLnToConsole(inttostr(y));
+end;
+
 procedure initModule;
 begin
+    DamageClan  := 0;
+    DamageTotal := 0;
+    DamageTurn  := 0;
+    KillsClan   := 0;
+    Kills       := 0;
+    KillsTotal  := 0;
+    AmmoUsedCount := 0;
+    AmmoDamagingUsed := false;
+    SkippedTurns:= 0;
+    isTurnSkipped:= false;
+    vpHurtSameClan:= nil;
+    vpHurtEnemy:= nil;
     TotalRounds:= -1;
     FinishedTurnsTotal:= -1;
 end;
--- a/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Tue Mar 29 16:54:41 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/Racer.lua	Tue Feb 23 13:45:49 2016 +0300
@@ -782,4 +782,12 @@
             DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i])
         end
     end
+
+    if fastCount > 0 then
+        StartGhostPoints(fastCount)
+
+        for i = 0, (fastCount - 1) do
+            DumpPoint(fastX[i], fastY[i])
+        end
+    end
 end
--- a/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua	Tue Mar 29 16:54:41 2016 +0200
+++ b/share/hedgewars/Data/Scripts/Multiplayer/TechRacer.lua	Tue Feb 23 13:45:49 2016 +0300
@@ -1277,6 +1277,15 @@
             DeclareAchievement(raceType, teamNameArr[i], map, teamScore[i])
         end
     end
+
+    if fastCount > 0 then
+        StartGhostPoints(fastCount)
+
+        for i = 0, (fastCount - 1) do
+            DumpPoint(fastX[i], fastY[i])
+        end
+    end
+
 end
 
 function onAmmoStoreInit()