merge changelog changes of 0.9.22 into default
authorsheepluva
Tue, 03 Nov 2015 23:33:32 +0100
changeset 11283 a3f3fc9af429
parent 11278 f35b207087a6 (diff)
parent 11282 48a3145cd118 (current diff)
child 11285 f8529d679a0d
merge changelog changes of 0.9.22 into default
ChangeLog.txt
--- a/CMakeLists.txt	Tue Nov 03 23:32:14 2015 +0100
+++ b/CMakeLists.txt	Tue Nov 03 23:33:32 2015 +0100
@@ -53,7 +53,7 @@
 set(CPACK_PACKAGE_VERSION_MAJOR 0)
 set(CPACK_PACKAGE_VERSION_MINOR 9)
 set(CPACK_PACKAGE_VERSION_PATCH 22)
-set(HEDGEWARS_PROTO_VER 51)
+set(HEDGEWARS_PROTO_VER 52)
 set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
 include(${CMAKE_MODULE_PATH}/revinfo.cmake)
 
--- a/ChangeLog.txt	Tue Nov 03 23:32:14 2015 +0100
+++ b/ChangeLog.txt	Tue Nov 03 23:33:32 2015 +0100
@@ -1,6 +1,9 @@
 + features
 * bugfixes
 
+0.9.22 -> 0.9.23
+ * Hammer damage is now rounded down. This means it will cause NO DAMAGE to a hedgehog with less than 3 hp.
+
 0.9.21 -> 0.9.22
  + New Weapon / Map object: AirMine (floating mine that will follow nearby hedgehogs)
  + Extensive changes to TechRacer: Variable terrain types, enhanced parameters, hwmap interpreter, fuel limiter, etc. 
--- a/gameServer/OfficialServer/extdbinterface.hs	Tue Nov 03 23:32:14 2015 +0100
+++ b/gameServer/OfficialServer/extdbinterface.hs	Tue Nov 03 23:33:32 2015 +0100
@@ -55,8 +55,10 @@
     "INSERT INTO rating_games (script, protocol, filename, time) \
     \ VALUES (?, ?, ?, ?)"
 
+dbQueryGameId = "SELECT LAST_INSERT_ID()"
+
 dbQueryGamesHistoryPlaces = "INSERT INTO rating_players (userid, gameid, place) \
-    \ VALUES ((SELECT uid FROM users WHERE name = ?), LAST_INSERT_ID(), ?)"
+    \ VALUES ((SELECT uid FROM users WHERE name = ?), ?, ?)"
 
 dbQueryReplayFilename = "SELECT filename FROM achievements WHERE id = ?"
 
@@ -112,10 +114,10 @@
     ps :: [B.ByteString] -> [IO Int64]
     ps [] = []
     ps ("DRAW" : bs) = execute dbConn dbQueryGamesHistory (script, (fromIntegral p) :: Int, fileName, time)
-        : executeMany dbConn dbQueryGamesHistoryPlaces (map drawParams teams)
+        : places (map drawParams teams)
         : ps bs
     ps ("WINNERS" : n : bs) = let winNum = readInt_ n in execute dbConn dbQueryGamesHistory (script, (fromIntegral p) :: Int, fileName, time)
-        : executeMany dbConn dbQueryGamesHistoryPlaces (map (placeParams (take winNum bs)) teams)
+        : places (map (placeParams (take winNum bs)) teams)
         : ps (drop winNum bs)
     ps ("ACHIEVEMENT" : typ : teamname : location : value : bs) = execute dbConn dbQueryAchievement
         ( time
@@ -129,6 +131,16 @@
     ps (b:bs) = ps bs
     drawParams t = (snd t, 0 :: Int)
     placeParams winners t = (snd t, if (fst t) `elem` winners then 1 else 2 :: Int)
+    places :: [(B.ByteString, Int)] -> IO Int64
+    places params = do
+        res <- query_ dbConn dbQueryGameId
+        let gameId = case res of
+                [Only a] -> a
+                _ -> 0
+        mapM_ (execute dbConn dbQueryGamesHistoryPlaces . midInsert gameId) params
+        return 0
+    midInsert :: Int -> (a, b) -> (a, Int, b)
+    midInsert g (a, b) = (a, g, b)
 
 dbConnectionLoop mySQLConnectionInfo =
     Control.Exception.handle (\(e :: SomeException) -> hPutStrLn stderr $ show e) $
--- a/hedgewars/uGearsHandlersMess.pas	Tue Nov 03 23:32:14 2015 +0100
+++ b/hedgewars/uGearsHandlersMess.pas	Tue Nov 03 23:33:32 2015 +0100
@@ -5255,13 +5255,12 @@
                         d:= 2
                     else
                         d:= 3;
-                    // always round up
-                    if dmg mod d > 0 then
-                        dmg:= dmg div d + 1
-                    else
-                        dmg:= dmg div d;
-
-                    ApplyDamage(tmp, CurrentHedgehog, dmg, dsUnknown);
+
+                    // always rounding down
+                    dmg:= dmg div d;
+
+                    if dmg > 0 then
+                        ApplyDamage(tmp, CurrentHedgehog, dmg, dsUnknown);
                     end;
                 end;