--- a/QTfrontend/ui/page/pagevideos.cpp Wed Jun 05 13:01:25 2013 -0400
+++ b/QTfrontend/ui/page/pagevideos.cpp Fri Jun 07 12:51:09 2013 +0400
@@ -508,8 +508,8 @@
else
{
QString path = item->path();
- desc += tr("Date: %1\n").arg(QFileInfo(path).created().toString(Qt::DefaultLocaleLongDate));
- desc += tr("Size: %1\n").arg(FileSizeStr(path));
+ desc += tr("Date: %1").arg(QFileInfo(path).created().toString(Qt::DefaultLocaleLongDate)) + "\n";
+ desc += tr("Size: %1").arg(FileSizeStr(path)) + "\n";
if (item->desc.isEmpty())
{
// Extract description from file;
--- a/QTfrontend/util/LibavInteraction.cpp Wed Jun 05 13:01:25 2013 -0400
+++ b/QTfrontend/util/LibavInteraction.cpp Fri Jun 07 12:51:09 2013 +0400
@@ -278,7 +278,7 @@
return "";
int s = float(pContext->duration)/AV_TIME_BASE;
- QString desc = QString(tr("Duration: %1m %2s\n")).arg(s/60).arg(s%60);
+ QString desc = tr("Duration: %1m %2s").arg(s/60).arg(s%60) + "\n";
for (int i = 0; i < (int)pContext->nb_streams; i++)
{
AVStream* pStream = pContext->streams[i];
@@ -290,11 +290,11 @@
if (pCodec->codec_type == AVMEDIA_TYPE_VIDEO)
{
- desc += QString(tr("Video: %1x%2, ")).arg(pCodec->width).arg(pCodec->height);
+ desc += QString(tr("Video: %1x%2")).arg(pCodec->width).arg(pCodec->height) + ", ";
if (pStream->avg_frame_rate.den)
{
float fps = float(pStream->avg_frame_rate.num)/pStream->avg_frame_rate.den;
- desc += QString(tr("%1 fps, ")).arg(fps, 0, 'f', 2);
+ desc += QString(tr("%1 fps")).arg(fps, 0, 'f', 2) + ", ";
}
}
else if (pCodec->codec_type == AVMEDIA_TYPE_AUDIO)
--- a/gameServer/Actions.hs Wed Jun 05 13:01:25 2013 -0400
+++ b/gameServer/Actions.hs Fri Jun 07 12:51:09 2013 +0400
@@ -162,7 +162,13 @@
rnc <- gets roomsClients
io $ do
- modifyClient rnc (\cl -> cl{teamsInGame = 0, isReady = False, isMaster = False, isInGame = False, clientClan = Nothing}) ci
+ modifyClient rnc (
+ \cl -> cl{teamsInGame = 0
+ , isReady = False
+ , isMaster = False
+ , isInGame = False
+ , isJoinedMidGame = False
+ , clientClan = Nothing}) ci
modifyRoom rnc (\r -> r{playersIn = playersIn r + 1}) ri
moveClientToRoom rnc ri ci
@@ -290,7 +296,7 @@
pr <- client's clientProto
mapM_ processAction [
AnswerClients (map sendChan roomPlayers) $ notReadyMessage pr . map nick . filter (not . isMaster) $ roomPlayers
- , ModifyRoomClients (\cl -> cl{isReady = isMaster cl})
+ , ModifyRoomClients (\cl -> cl{isReady = isMaster cl, isJoinedMidGame = False})
, ModifyRoom (\r -> r{readyPlayers = 1})
]
where
@@ -301,10 +307,17 @@
rnc <- gets roomsClients
ri <- clientRoomA
thisRoomChans <- liftM (map sendChan) $ roomClientsS ri
+ joinedMidGame <- liftM (filter isJoinedMidGame) $ roomClientsS ri
answerRemovedTeams <- io $
- room'sM rnc (map (\t -> AnswerClients thisRoomChans ["REMOVE_TEAM", t]) . leftTeams . fromJust . gameInfo) ri
+ room'sM rnc (\r -> let gi = fromJust $ gameInfo r in
+ concatMap (\c ->
+ (answerFullConfigParams c (mapParams r) (params r))
+ ++
+ (map (\t -> AnswerClients [sendChan c] ["REMOVE_TEAM", t]) $ leftTeams gi)
+ ) joinedMidGame
+ ) ri
- mapM_ processAction $
+ mapM_ processAction $ (
SaveReplay
: ModifyRoom
(\r -> r{
@@ -312,10 +325,11 @@
readyPlayers = 0
}
)
- : UnreadyRoomClients
: SendUpdateOnThisRoom
: AnswerClients thisRoomChans ["ROUND_FINISHED"]
: answerRemovedTeams
+ )
+ ++ [UnreadyRoomClients]
processAction (SendTeamRemovalMessage teamName) = do
--- a/gameServer/CoreTypes.hs Wed Jun 05 13:01:25 2013 -0400
+++ b/gameServer/CoreTypes.hs Fri Jun 07 12:51:09 2013 +0400
@@ -107,6 +107,7 @@
isAdministrator :: Bool,
isChecker :: Bool,
isKickedFromServer :: Bool,
+ isJoinedMidGame :: Bool,
clientClan :: !(Maybe B.ByteString),
checkInfo :: Maybe CheckInfo,
teamsInGame :: Word
--- a/gameServer/HWProtoChecker.hs Wed Jun 05 13:01:25 2013 -0400
+++ b/gameServer/HWProtoChecker.hs Fri Jun 07 12:51:09 2013 +0400
@@ -1,17 +1,12 @@
{-# LANGUAGE OverloadedStrings #-}
module HWProtoChecker where
-import qualified Data.Map as Map
import Data.Maybe
-import Data.List
import Control.Monad.Reader
--------------------------------------
import CoreTypes
import Actions
-import Utils
import HandlerUtils
-import RoomsAndClients
-import EngineInteraction
handleCmd_checker :: CmdHandler
--- a/gameServer/HWProtoLobbyState.hs Wed Jun 05 13:01:25 2013 -0400
+++ b/gameServer/HWProtoLobbyState.hs Fri Jun 07 12:51:09 2013 +0400
@@ -1,7 +1,6 @@
{-# LANGUAGE OverloadedStrings #-}
module HWProtoLobbyState where
-import qualified Data.Map as Map
import Data.Maybe
import Data.List
import Control.Monad.Reader
@@ -51,7 +50,7 @@
[
AddRoom rName roomPassword
, AnswerClients [sendChan cl] ["CLIENT_FLAGS", "+hr", nick cl]
- , ModifyClient (\c -> c{isMaster = True, isReady = True})
+ , ModifyClient (\c -> c{isMaster = True, isReady = True, isJoinedMidGame = False})
, ModifyRoom (\r -> r{readyPlayers = 1})
]
@@ -87,12 +86,13 @@
else
[
MoveToRoom jRI
+ , ModifyClient (\c -> c{isJoinedMidGame = isJust $ gameInfo jRoom})
, AnswerClients [sendChan cl] $ "JOINED" : nicks
, AnswerClients chans ["CLIENT_FLAGS", "-r", nick cl]
, AnswerClients [sendChan cl] $ ["CLIENT_FLAGS", "+h", ownerNick]
]
++ (if clientProto cl < 38 then map (readynessMessage cl) jRoomClients else [sendStateFlags cl jRoomClients])
- ++ answerFullConfig cl (mapParams jRoom) (params jRoom)
+ ++ answerFullConfig cl jRoom
++ answerTeams cl jRoom
++ watchRound cl jRoom chans
@@ -105,18 +105,9 @@
(ingame, inroomlobby) = partition isInGame clients
f fl lst = ["CLIENT_FLAGS" : fl : map nick lst | not $ null lst]
- toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs
-
- answerFullConfig cl mpr pr
- | clientProto cl < 38 = map (toAnswer cl) $
- (reverse . map (\(a, b) -> (a, [b])) $ Map.toList mpr)
- ++ (("SCHEME", pr Map.! "SCHEME")
- : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr))
-
- | otherwise = map (toAnswer cl) $
- ("FULLMAPCONFIG", Map.elems mpr)
- : ("SCHEME", pr Map.! "SCHEME")
- : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr)
+ -- get config from gameInfo if possible, otherwise from room
+ answerFullConfig cl jRoom = let f r g = (if isJust $ gameInfo jRoom then g . fromJust . gameInfo else r) jRoom
+ in answerFullConfigParams cl (f mapParams giMapParams) (f params giParams)
answerTeams cl jRoom = let f = if isJust $ gameInfo jRoom then teamsAtStart . fromJust . gameInfo else teams in answerAllTeams cl $ f jRoom
--- a/gameServer/HandlerUtils.hs Wed Jun 05 13:01:25 2013 -0400
+++ b/gameServer/HandlerUtils.hs Fri Jun 07 12:51:09 2013 +0400
@@ -6,7 +6,7 @@
import RoomsAndClients
import CoreTypes
-import Actions
+
thisClient :: Reader (ClientIndex, IRnC) ClientInfo
thisClient = do
--- a/gameServer/NetRoutines.hs Wed Jun 05 13:01:25 2013 -0400
+++ b/gameServer/NetRoutines.hs Fri Jun 07 12:51:09 2013 +0400
@@ -44,6 +44,7 @@
False
False
False
+ False
Nothing
Nothing
0
--- a/gameServer/Utils.hs Wed Jun 05 13:01:25 2013 -0400
+++ b/gameServer/Utils.hs Fri Jun 07 12:51:09 2013 +0400
@@ -137,5 +137,25 @@
head (Map.findWithDefault ["Default"] "AMMO" (params r))
]
+
+answerFullConfigParams ::
+ ClientInfo
+ -> Map.Map B.ByteString B.ByteString
+ -> Map.Map B.ByteString [B.ByteString]
+ -> [Action]
+answerFullConfigParams cl mpr pr
+ | clientProto cl < 38 = map (toAnswer cl) $
+ (reverse . map (\(a, b) -> (a, [b])) $ Map.toList mpr)
+ ++ (("SCHEME", pr Map.! "SCHEME")
+ : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr))
+
+ | otherwise = map (toAnswer cl) $
+ ("FULLMAPCONFIG", Map.elems mpr)
+ : ("SCHEME", pr Map.! "SCHEME")
+ : (filter (\(p, _) -> p /= "SCHEME") $ Map.toList pr)
+ where
+ toAnswer cl (paramName, paramStrs) = AnswerClients [sendChan cl] $ "CFG" : paramName : paramStrs
+
+
loc :: B.ByteString -> B.ByteString
loc = id