pull 0.9.25 changes into default
authornemo
Fri, 07 Dec 2018 14:35:08 -0500
changeset 14397 c3ae3cac8fba
parent 14396 cc99f7c673c7 (current diff)
parent 14390 7f0166b01dc9 (diff)
child 14398 b251aa50c0d3
pull 0.9.25 changes into default
tests/lua/staticmines.lua
--- a/hedgewars/hwengine.pas	Fri Dec 07 18:32:36 2018 +0300
+++ b/hedgewars/hwengine.pas	Fri Dec 07 14:35:08 2018 -0500
@@ -358,6 +358,9 @@
 var s: shortstring;
     i: LongInt;
 begin
+{$IFDEF PAS2C}
+    AddFileLog('Generated using pas2c');
+{$ENDIF}
     WriteLnToConsole('Hedgewars engine ' + cVersionString + '-r' + cRevisionString +
                      ' (' + cHashString + ') with protocol #' + inttostr(cNetProtoVersion));
     AddFileLog('Prefix: "' + shortstring(PathPrefix) +'"');
--- a/hedgewars/uChat.pas	Fri Dec 07 18:32:36 2018 +0300
+++ b/hedgewars/uChat.pas	Fri Dec 07 14:35:08 2018 -0500
@@ -515,7 +515,7 @@
         exit
         end;
 
-    // “/clan” or “/team” (“/team” is an alias for “/clan”)
+    // "/clan" or "/team" ("/team" is an alias for "/clan")
     if ((copy(s, 2, 5) = 'clan ') or (copy(s, 2, 5) = 'team ')) then
         begin
         if (Length(s) > 6) then
--- a/hedgewars/uGearsHedgehog.pas	Fri Dec 07 18:32:36 2018 +0300
+++ b/hedgewars/uGearsHedgehog.pas	Fri Dec 07 14:35:08 2018 -0500
@@ -775,7 +775,8 @@
         if (ammo = amNothing) or (cnt = 0) then
             s:= trmsg[sidEmptyCrate]
         else if cnt >= AMMO_INFINITE then
-            s:= name + ansistring(' (+∞)')
+            // infinity symbol
+            s:= name + ansistring(' (+' + char($E2) + char($88) + char($9E) +')')
         else
             s:= name + ansistring(' (+' + IntToStr(cnt) + ')');
 
--- a/hedgewars/uInputHandler.pas	Fri Dec 07 18:32:36 2018 +0300
+++ b/hedgewars/uInputHandler.pas	Fri Dec 07 14:35:08 2018 -0500
@@ -130,7 +130,7 @@
         begin
         name:= SDL_GetKeyName(SDL_GetKeyFromScancode(code));
         if (name = 'Escape') then
-            // Let's shorten the name “Escape” for the quit menu
+            // Let's shorten the name "Escape" for the quit menu
             KeyBindToName:= 'Esc'
         else if (length(name) <> 0) then
             KeyBindToName:= name
--- a/hedgewars/uScript.pas	Fri Dec 07 18:32:36 2018 +0300
+++ b/hedgewars/uScript.pas	Fri Dec 07 14:35:08 2018 -0500
@@ -3593,7 +3593,6 @@
 var braceCount: LongWord;
 var wordCount: LongWord;
 var lastChar: char;
-// ⭒⭐⭒✨⭐⭒✨⭐☆✨⭐✨✧✨☆✨✧✨☆⭒✨☆⭐⭒☆✧✨⭒✨⭐✧⭒☆⭒✧☆✨✧⭐☆✨☆✧⭒✨✧⭒☆⭐☆✧
 function  ScriptReader(L: Plua_State; f: PFSFile; sz: Psize_t) : PChar; Cdecl;
 var mybuf: PChar;
     i: LongInt;
@@ -3658,7 +3657,6 @@
         end;
     ScriptLocaleReader:= mybuf
 end;
-// ⭒⭐⭒✨⭐⭒✨⭐☆✨⭐✨✧✨☆✨✧✨☆⭒✨☆⭐⭒☆✧✨⭒✨⭐✧⭒☆⭒✧☆✨✧⭐☆✨☆✧⭒✨✧⭒☆⭐☆✧
 
 function ScriptLoad(name : shortstring; mustExist : boolean): boolean;
 var ret : LongInt;
--- a/hedgewars/uSound.pas	Fri Dec 07 18:32:36 2018 +0300
+++ b/hedgewars/uSound.pas	Fri Dec 07 14:35:08 2018 -0500
@@ -475,7 +475,7 @@
 // Get a fallback voice, assuming that snd is not available. Returns sndNone if none is found.
 function GetFallbackV(snd: TSound): TSound;
 begin
-    // Fallback to sndFirePunch1 / sndOw1 / sndOoff1 if a “higher-numbered” sound is missing
+    // Fallback to sndFirePunch1 / sndOw1 / sndOoff1 if a "higher-numbered" sound is missing
     if (snd in [sndFirePunch2, sndFirePunch3, sndFirePunch4, sndFirePunch5, sndFirePunch6]) then
         GetFallbackV := sndFirePunch1
     else if (snd in [sndOw2, sndOw3, sndOw4, sndOuch]) then
--- a/hedgewars/uStats.pas	Fri Dec 07 18:32:36 2018 +0300
+++ b/hedgewars/uStats.pas	Fri Dec 07 14:35:08 2018 -0500
@@ -527,7 +527,7 @@
             deathEntry:= deathEntry^.NextEntry;
             end;
 
-    // “Achievements” / Details part of stats screen
+    // "Achievements" / Details part of stats screen
     if SendAchievementsStatsOn then
         begin
         if msdhh <> nil then
--- a/hedgewars/uTeams.pas	Fri Dec 07 18:32:36 2018 +0300
+++ b/hedgewars/uTeams.pas	Fri Dec 07 14:35:08 2018 -0500
@@ -123,7 +123,7 @@
                 // Write victory message for caption and stats page
                 if (TeamsNumber = cMaxTeams) or (TeamsCount = TeamsNumber) then
                     begin
-                    // No enemies for some reason … Everyone wins!!1!
+                    // No enemies for some reason ... Everyone wins!!1!
                     s:= trmsg[sidWinnerAll];
                     allWin:= true;
                     end
--- a/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/first_blood.lua	Fri Dec 07 18:32:36 2018 +0300
+++ b/share/hedgewars/Data/Missions/Campaign/A_Classic_Fairytale/first_blood.lua	Fri Dec 07 14:35:08 2018 -0500
@@ -588,7 +588,7 @@
   SetGearMessage(CurrentHedgehog, 0)
   AddAnim(challengeFailedAnim)
   chalTries = chalTries + 1
-  difficulty = 0
+  difficulty = 1
   AddFunction({func = SetChoice, args = {}})
 end
 
--- a/share/hedgewars/Data/Scripts/TargetPractice.lua	Fri Dec 07 18:32:36 2018 +0300
+++ b/share/hedgewars/Data/Scripts/TargetPractice.lua	Fri Dec 07 14:35:08 2018 -0500
@@ -226,8 +226,10 @@
 	end
 
 	_G.onGearAdd = function(gear)
+		if GetGearType(gear) == params.gearType then
+			shots = shots + 1
+		end
 		if GetGearType(gear) == params.gearType or (params.secGearType and GetGearType(gear) == params.secGearType) then
-			shots = shots + 1
 			gearsInGameCount = gearsInGameCount + 1
 			gearsInGame[gear] = true
 		end
--- a/tests/lua/staticmines.lua	Fri Dec 07 18:32:36 2018 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,137 +0,0 @@
---[[ Static Mines Test
-
-This test tests if mines are able to stand still on the ground for a very long time. 8 mines are spawned on a few girders.
-
-The test passes if the mines don't move for a very long time.
-The test failes if any mine moves even the tiniest bit or is destroyed.
-
-This test case has been created as response to bug 96.
-]]
-
--- Max. time to test
-local TEST_TIME_LIMIT = 3600000 * 5 -- 5 hours
-
-local hhs = {}
-
-function onGameInit()
-
-	ClearGameFlags()
-	EnableGameFlags(gfDisableWind, gfOneClanMode)
-	Map = ""
-	Seed = 12
-	Theme = "Desert"
-	MapGen = mgDrawn
-	TurnTime = -1
-	Explosives = 0
-	MinesNum = 0
-	CaseFreq = 0
-	Delay = 100
-	WaterRise = 0
-	HealthDecrease = 0
-	AirMinesNum = 0
-
-
-	AddTeam("Test Team", 0xFFFF00, "Statue", "Tank", "Default", "cm_test")
-	hhs[1] = AddHog("Test Hog", 0, 100, "cm_test")
-	SetGearPosition(hhs[1], 300, 1450)
-end
-
-local mines = {
-	{ x = 231, y = 1708},
-	{ x = 290, y = 1708},
-	{ x = 342, y = 1708},
-	{ x = 261, y = 1708},
-	{ x = 319, y = 1708},
-	{ x = 403, y = 1706},
-	{ x = 428, y = 1706},
-	{ x = 461, y = 1706},
-	{ x = 498, y = 1706},
-	{ x = 518, y = 1706},
-}
-
-function LoadGearData()
-	------ GIRDER LIST ------
-	PlaceGirder(290, 1718, 4)
-	PlaceGirder(290, 1790, 4)
-	PlaceGirder(452, 1716, 4)
-	PlaceGirder(452, 1790, 4)
-	
-	PlaceGirder(300, 1500, 4)
-
-	------ MINE LIST ------
-	for m=1, #mines do
-		mines[m].gear = AddGear(mines[m].x, mines[m].y, gtMine, 0, 0, 0, 0)
-	end
-
-end
-
-function onGameStart()
-	LoadGearData()
-end
-
-function onGearDelete(gear)
-	for m=#mines, 1, -1 do
-		if gear == mines[m] then
-			WriteLnToConsole(string.format("Mine %d died!", m))
-			table.remove(mines, m)
-		end
-	end
-end
-
--- Give a short time for the mines to settle first.
-local checkTimer = -5000
-local initPosCheck = false
--- Count the total times the mines managed to stand still
-local totalTime = 0
-local fin = false
-function onGameTick20()
-	if fin then
-		return
-	end
-	-- Infinite turn time
-	if TurnTimeLeft < 6000 then
-		TurnTimeLeft = -1
-	end
-	checkTimer = checkTimer + 20
-	if initPosCheck then
-		totalTime = totalTime + 20
-	end
-	if checkTimer >= 1000 then
-		local failed = false
-		for m=1, #mines do
-			if not initPosCheck then
-				-- Position initialization
-				-- Save “real” x and y values after the mines have settled
-				local x, y = GetGearPosition(mines[m].gear)
-				mines[m].rx = x
-				mines[m].ry = y
-			else
-				-- Position check
-				local x, y = GetGearPosition(mines[m].gear)
-				local rx, ry = mines[m].rx, mines[m].ry
-				if not x or not y then
-					WriteLnToConsole(string.format("Mine %d has died!", m))
-					failed = true
-				elseif x ~= rx or y ~= ry then
-					WriteLnToConsole(string.format("Mine %d has moved! Expected: (%d, %d). Actual: (%d, %d)", m, rx, ry, x, y))
-					failed = true
-				end
-			end
-		end
-		if not initPosCheck then
-			initPosCheck = true
-		end
-		if failed then
-			WriteLnToConsole(string.format("Test failed. The mines managed to stand still for %d ticks.", totalTime))
-			EndLuaTest(TEST_FAILED)
-			fin = true
-			return
-		end
-	end
-	if totalTime >= TEST_TIME_LIMIT then
-		WriteLnToConsole(string.format("All mines have been static for over %d ticks! Success!", TEST_TIME_LIMIT))
-		EndLuaTest(TEST_SUCCESSFUL)
-		fin = true
-		return
-	end
-end
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/lua_noncritical/staticmines.lua	Fri Dec 07 14:35:08 2018 -0500
@@ -0,0 +1,137 @@
+--[[ Static Mines Test
+
+This test tests if mines are able to stand still on the ground for a very long time. 8 mines are spawned on a few girders.
+
+The test passes if the mines don't move for a very long time.
+The test failes if any mine moves even the tiniest bit or is destroyed.
+
+This test case has been created as response to bug 96.
+]]
+
+-- Max. time to test
+local TEST_TIME_LIMIT = 3600000 * 5 -- 5 hours
+
+local hhs = {}
+
+function onGameInit()
+
+	ClearGameFlags()
+	EnableGameFlags(gfDisableWind, gfOneClanMode)
+	Map = ""
+	Seed = 12
+	Theme = "Desert"
+	MapGen = mgDrawn
+	TurnTime = -1
+	Explosives = 0
+	MinesNum = 0
+	CaseFreq = 0
+	Delay = 100
+	WaterRise = 0
+	HealthDecrease = 0
+	AirMinesNum = 0
+
+
+	AddTeam("Test Team", 0xFFFF00, "Statue", "Tank", "Default", "cm_test")
+	hhs[1] = AddHog("Test Hog", 0, 100, "cm_test")
+	SetGearPosition(hhs[1], 300, 1450)
+end
+
+local mines = {
+	{ x = 231, y = 1708},
+	{ x = 290, y = 1708},
+	{ x = 342, y = 1708},
+	{ x = 261, y = 1708},
+	{ x = 319, y = 1708},
+	{ x = 403, y = 1706},
+	{ x = 428, y = 1706},
+	{ x = 461, y = 1706},
+	{ x = 498, y = 1706},
+	{ x = 518, y = 1706},
+}
+
+function LoadGearData()
+	------ GIRDER LIST ------
+	PlaceGirder(290, 1718, 4)
+	PlaceGirder(290, 1790, 4)
+	PlaceGirder(452, 1716, 4)
+	PlaceGirder(452, 1790, 4)
+	
+	PlaceGirder(300, 1500, 4)
+
+	------ MINE LIST ------
+	for m=1, #mines do
+		mines[m].gear = AddGear(mines[m].x, mines[m].y, gtMine, 0, 0, 0, 0)
+	end
+
+end
+
+function onGameStart()
+	LoadGearData()
+end
+
+function onGearDelete(gear)
+	for m=#mines, 1, -1 do
+		if gear == mines[m] then
+			WriteLnToConsole(string.format("Mine %d died!", m))
+			table.remove(mines, m)
+		end
+	end
+end
+
+-- Give a short time for the mines to settle first.
+local checkTimer = -5000
+local initPosCheck = false
+-- Count the total times the mines managed to stand still
+local totalTime = 0
+local fin = false
+function onGameTick20()
+	if fin then
+		return
+	end
+	-- Infinite turn time
+	if TurnTimeLeft < 6000 then
+		TurnTimeLeft = -1
+	end
+	checkTimer = checkTimer + 20
+	if initPosCheck then
+		totalTime = totalTime + 20
+	end
+	if checkTimer >= 1000 then
+		local failed = false
+		for m=1, #mines do
+			if not initPosCheck then
+				-- Position initialization
+				-- Save “real” x and y values after the mines have settled
+				local x, y = GetGearPosition(mines[m].gear)
+				mines[m].rx = x
+				mines[m].ry = y
+			else
+				-- Position check
+				local x, y = GetGearPosition(mines[m].gear)
+				local rx, ry = mines[m].rx, mines[m].ry
+				if not x or not y then
+					WriteLnToConsole(string.format("Mine %d has died!", m))
+					failed = true
+				elseif x ~= rx or y ~= ry then
+					WriteLnToConsole(string.format("Mine %d has moved! Expected: (%d, %d). Actual: (%d, %d)", m, rx, ry, x, y))
+					failed = true
+				end
+			end
+		end
+		if not initPosCheck then
+			initPosCheck = true
+		end
+		if failed then
+			WriteLnToConsole(string.format("Test failed. The mines managed to stand still for %d ticks.", totalTime))
+			EndLuaTest(TEST_FAILED)
+			fin = true
+			return
+		end
+	end
+	if totalTime >= TEST_TIME_LIMIT then
+		WriteLnToConsole(string.format("All mines have been static for over %d ticks! Success!", TEST_TIME_LIMIT))
+		EndLuaTest(TEST_SUCCESSFUL)
+		fin = true
+		return
+	end
+end
\ No newline at end of file