Merge from default ios-revival
authorantonc27 <antonc27@mail.ru>
Mon, 09 Nov 2015 04:25:29 +0100
branchios-revival
changeset 11326 62af5c67662d
parent 11325 d98070707214 (current diff)
parent 11322 c32b5d5181dd (diff)
child 11327 a0163b8302c5
Merge from default
README
--- a/ChangeLog.txt	Mon Nov 09 04:24:08 2015 +0100
+++ b/ChangeLog.txt	Mon Nov 09 04:25:29 2015 +0100
@@ -3,6 +3,8 @@
 
 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.
+ * Fixed bee not being affected by wrap world edge while still being thrown
+ * Fixed turn not ending when sticky mine was trapped on rubberband
 
 0.9.21 -> 0.9.22
  + New Weapon / Map object: AirMine (floating mine that will follow nearby hedgehogs)
--- a/README	Mon Nov 09 04:24:08 2015 +0100
+++ b/README	Mon Nov 09 04:25:29 2015 +0100
@@ -1,46 +1,1 @@
-Hedgewars - a turn based strategy game.
-=======================================
-
-Copyright 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> and others.
-See QTfrontend/res/html/about.html and CREDITS for a complete list of authors.
-
-Licence:
---------
-Source code is distributed under the terms of the GNU General Public Licence
-version 2; images and sounds are distributed under the terms of the GNU Free
-Documentation Licence version 1.2. See the COPYING file for the full text of
-the licenses.
-
-Instructions:
--------------
-See our wiki at: https://code.google.com/p/hedgewars/wiki/BuildingHedgewars
-
-You can find an outline of the necessary dependencies in the INSTALL file.
-
-Source code:
-------------
-Our main repository is located at http://hedgewars.googlecode.com using
-Mercurial as DVCS. A Git repository is also available (mirrored daily)
-at https://github.com/hedgewars/hw
-
-Contribute:
------------
-If you see a bug or have any suggestion please use the official bug tracker at
-http://code.google.com/p/hedgewars/issues/list or the integrated feedback
-button.
-
-If you want to help or get to know the sources better you can do that with some
-easy tasks from http://code.google.com/p/hedgewars/wiki/TODO. We also have an
-extended API in LUA to customize your adventures in our wiki at
-http://code.google.com/p/hedgewars/wiki/LuaAPI.
-
-If you know your way through the code feel free to send a patch or open a pull
-request. The best LUA scripts get released in the official DLC page and later
-integrated in the next version.
-
-Contact:
---------
-* IRC channel     - irc://irc.freenode.net/hedgewars
-* community forum - http://www.hedgewars.org/forum
-* mailing list    - https://mail.gna.org/listinfo/hedgewars-dev
-
+README.md
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/README.md	Mon Nov 09 04:25:29 2015 +0100
@@ -0,0 +1,46 @@
+Hedgewars - a turn based strategy game.
+=======================================
+
+Copyright 2004-2015 Andrey Korotaev <unC0Rr@gmail.com> and others.
+See QTfrontend/res/html/about.html and CREDITS for a complete list of authors.
+
+Licence:
+--------
+Source code is distributed under the terms of the GNU General Public Licence
+version 2; images and sounds are distributed under the terms of the GNU Free
+Documentation Licence version 1.2. See the COPYING file for the full text of
+the licenses.
+
+Instructions:
+-------------
+See our wiki at: http://hedgewars.org/kb/BuildingHedgewars
+
+You can find an outline of the necessary dependencies in the INSTALL file.
+
+Source code:
+------------
+Our main repository is located at http://hg.hedgewars.org/hedgewars/ using
+Mercurial as DVCS. A Git repository is also available (mirrored daily)
+at https://github.com/hedgewars/hw
+
+Contribute:
+-----------
+If you see a bug or have any suggestion please use the official bug tracker at
+http://code.google.com/p/hedgewars/issues/list or the integrated feedback
+button.
+
+If you want to help or get to know the sources better you can do that with some
+easy tasks from http://hedgewars.org/kb/TODO. We also have an
+extended API in LUA to customize your adventures in our wiki at
+http://hedgewars.org/kb/LuaAPI.
+
+If you know your way through the code feel free to send a patch or open a pull
+request. The best LUA scripts get released in the official DLC page and later
+integrated in the next version.
+
+Contact:
+--------
+* IRC channel     - irc://irc.freenode.net/hedgewars
+* community forum - http://www.hedgewars.org/forum
+* mailing list    - https://mail.gna.org/listinfo/hedgewars-dev
+
--- a/gameServer/Actions.hs	Mon Nov 09 04:24:08 2015 +0100
+++ b/gameServer/Actions.hs	Mon Nov 09 04:25:29 2015 +0100
@@ -762,10 +762,11 @@
 
 
 processAction (CheckSuccess info) = do
-    Just (CheckInfo fileName teams script) <- client's checkInfo
+    Just (CheckInfo fileName teams gameDetails) <- client's checkInfo
     p <- client's clientProto
     si <- gets serverInfo
-    io $ writeChan (dbQueries si) $ StoreAchievements p (B.pack fileName) (map toPair teams) script info
+    when (isJust gameDetails)
+        $ io $ writeChan (dbQueries si) $ StoreAchievements p (B.pack fileName) (map toPair teams) (fromJust gameDetails) info
     io $ moveCheckedRecord fileName
     where
         toPair t = (teamname t, teamowner t)
--- a/gameServer/CoreTypes.hs	Mon Nov 09 04:24:08 2015 +0100
+++ b/gameServer/CoreTypes.hs	Mon Nov 09 04:25:29 2015 +0100
@@ -16,7 +16,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  \-}
 
-{-# LANGUAGE CPP, OverloadedStrings, DeriveDataTypeable #-}
+{-# LANGUAGE CPP, OverloadedStrings, DeriveDataTypeable, GeneralizedNewtypeDeriving #-}
 module CoreTypes where
 
 import Control.Concurrent
@@ -120,7 +120,7 @@
     {
         recordFileName :: String,
         recordTeams :: [TeamInfo],
-        recordScript :: B.ByteString
+        details :: Maybe GameDetails
     }
 
 data ClientInfo =
@@ -346,10 +346,21 @@
     CheckAccount ClientIndex Int B.ByteString B.ByteString
     | ClearCache
     | SendStats Int Int
-    | StoreAchievements Word16 B.ByteString [(B.ByteString, B.ByteString)] B.ByteString [B.ByteString]
+    | StoreAchievements Word16 B.ByteString [(B.ByteString, B.ByteString)] GameDetails [B.ByteString]
     | GetReplayName ClientIndex Int B.ByteString
     deriving (Show, Read)
 
+data GameDetails =
+    GameDetails {
+        gameScript :: B.ByteString
+        , infRope
+        , isVamp
+        , infAttacks :: Bool
+    } deriving (Show, Read)
+
+instance NFData GameDetails where
+    rnf (GameDetails a b c d) = a `deepseq` b `deepseq` c `deepseq` d `deepseq` ()
+
 data CoreMessage =
     Accept ClientInfo
     | ClientMessage (ClientIndex, [B.ByteString])
--- a/gameServer/EngineInteraction.hs	Mon Nov 09 04:24:08 2015 +0100
+++ b/gameServer/EngineInteraction.hs	Mon Nov 09 04:25:29 2015 +0100
@@ -100,8 +100,8 @@
         -> Map.Map B.ByteString B.ByteString
         -> Map.Map B.ByteString [B.ByteString]
         -> [B.ByteString]
-        -> ([B.ByteString], [B.ByteString])
-replayToDemo ti mParams prms msgs = if not sane then ([], []) else ([scriptName], concat [
+        -> (Maybe GameDetails, [B.ByteString])
+replayToDemo ti mParams prms msgs = if not sane then (Nothing, []) else (Just $ GameDetails scriptName infRopes vamp infattacks, concat [
         [em "TD"]
         , maybeScript
         , maybeMap
@@ -126,6 +126,7 @@
             && Set.null (keys2 Set.\\ Map.keysSet prms)
             && (not . null . drop 41 $ scheme)
             && (not . null . tail $ prms Map.! "AMMO")
+            && ((B.length . head $ prms Map.! "AMMO") > 200)
         mapGenTypes = ["+rnd+", "+maze+", "+drawn+", "+perlin+"]
         scriptName = head . fromMaybe ["Normal"] $ Map.lookup "SCRIPT" prms
         maybeScript = let s = scriptName in if s == "Normal" then [] else [eml ["escript Scripts/Multiplayer/", s, ".lua"]]
@@ -162,6 +163,9 @@
                             ])
                         $ hedgehogs t
                         )
+        infRopes = ammoStr `B.index` 7  == '9'
+        vamp = gameFlags .&. 0x00000200 /= 0
+        infattacks = gameFlags .&. 0x00100000 /= 0
 
 drawnMapData :: B.ByteString -> [B.ByteString]
 drawnMapData =
--- a/gameServer/OfficialServer/GameReplayStore.hs	Mon Nov 09 04:24:08 2015 +0100
+++ b/gameServer/OfficialServer/GameReplayStore.hs	Mon Nov 09 04:25:29 2015 +0100
@@ -70,11 +70,11 @@
     where
         loadFile :: String -> IO (Maybe CheckInfo, [B.ByteString])
         loadFile fileName = E.handle (\(e :: SomeException) ->
-                    warningM "REPLAYS" ("Problems reading " ++ fileName ++ ": " ++ show e) >> return (Just $ CheckInfo fileName [] "", [])) $ do
+                    warningM "REPLAYS" ("Problems reading " ++ fileName ++ ": " ++ show e) >> return (Just $ CheckInfo fileName [] Nothing, [])) $ do
             (teams, params1, params2, roundMsgs) <- liftM read $ readFile fileName
             let d = replayToDemo teams (Map.fromList params1) (Map.fromList params2) (reverse roundMsgs)
             d `deepseq` return $ (
-                Just (CheckInfo fileName teams (head $ fst d))
+                Just (CheckInfo fileName teams (fst d))
                 , snd d
                 )
 
--- a/gameServer/OfficialServer/extdbinterface.hs	Mon Nov 09 04:24:08 2015 +0100
+++ b/gameServer/OfficialServer/extdbinterface.hs	Mon Nov 09 04:25:29 2015 +0100
@@ -52,8 +52,8 @@
     \ ?, ?, ?, ?)"
 
 dbQueryGamesHistory =
-    "INSERT INTO rating_games (script, protocol, filename, time) \
-    \ VALUES (?, ?, ?, ?)"
+    "INSERT INTO rating_games (script, protocol, filename, time, vamp, ropes, infattacks) \
+    \ VALUES (?, ?, ?, ?, ?, ?, ?)"
 
 dbQueryGameId = "SELECT LAST_INSERT_ID()"
 
@@ -93,8 +93,8 @@
 
         SendStats clients rooms ->
                 void $ execute dbConn dbQueryStats (clients, rooms)
-        StoreAchievements p fileName teams script info ->
-            sequence_ $ parseStats dbConn p fileName teams script info
+        StoreAchievements p fileName teams g info ->
+            sequence_ $ parseStats dbConn p fileName teams g info
 
 
 --readTime = read . B.unpack . B.take 19 . B.drop 8
@@ -105,18 +105,18 @@
     -> Word16 
     -> B.ByteString 
     -> [(B.ByteString, B.ByteString)] 
-    -> B.ByteString
+    -> GameDetails
     -> [B.ByteString]
     -> [IO Int64]
-parseStats dbConn p fileName teams script = ps
+parseStats dbConn p fileName teams (GameDetails script infRopes vamp infAttacks) = ps
     where
     time = readTime fileName
     ps :: [B.ByteString] -> [IO Int64]
     ps [] = []
-    ps ("DRAW" : bs) = execute dbConn dbQueryGamesHistory (script, (fromIntegral p) :: Int, fileName, time)
+    ps ("DRAW" : bs) = execute dbConn dbQueryGamesHistory (script, (fromIntegral p) :: Int, fileName, time, vamp, infRopes, infAttacks)
         : places (map drawParams teams)
         : ps bs
-    ps ("WINNERS" : n : bs) = let winNum = readInt_ n in execute dbConn dbQueryGamesHistory (script, (fromIntegral p) :: Int, fileName, time)
+    ps ("WINNERS" : n : bs) = let winNum = readInt_ n in execute dbConn dbQueryGamesHistory (script, (fromIntegral p) :: Int, fileName, time, vamp, infRopes, infAttacks)
         : places (map (placeParams (take winNum bs)) teams)
         : ps (drop winNum bs)
     ps ("ACHIEVEMENT" : typ : teamname : location : value : bs) = execute dbConn dbQueryAchievement
--- a/hedgewars/avwrapper/avwrapper.c	Mon Nov 09 04:24:08 2015 +0100
+++ b/hedgewars/avwrapper/avwrapper.c	Mon Nov 09 04:25:29 2015 +0100
@@ -302,13 +302,7 @@
 #endif
 
     // open the codec
-#if LIBAVCODEC_VERSION_MAJOR >= 53
-    AVDictionary* pDict = NULL;
-    if (strcmp(g_pVCodec->name, "libx264") == 0)
-        av_dict_set(&pDict, "preset", "medium", 0);
-#endif
-
-    if (avcodec_open2(g_pVideo, g_pVCodec, &pDict) < 0)
+    if (avcodec_open2(g_pVideo, g_pVCodec, NULL) < 0)
         return FatalError("Could not open video codec %s", g_pVCodec->long_name);
 
     g_pVFrame = av_frame_alloc();