--- a/QTfrontend/weapons.h Fri Dec 13 13:50:14 2013 +0200
+++ b/QTfrontend/weapons.h Fri Dec 13 21:55:19 2013 +0400
@@ -21,40 +21,41 @@
//skip---------------------------------|
//structure------------------------------------------------------------------|
-#define AMMOLINE_DEFAULT_QT "93919294221991210322351110012010000002111101010111111211"
-#define AMMOLINE_DEFAULT_PROB "04050405416006555465544647765766666661555101011154111211"
+
+#define AMMOLINE_DEFAULT_QT "93919294221991210322351110012000000002111001010111110001"
+#define AMMOLINE_DEFAULT_PROB "04050405416006555465544647765766666661555101011154111111"
#define AMMOLINE_DEFAULT_DELAY "00000000000002055000000400070040000000002200000006000200"
-#define AMMOLINE_DEFAULT_CRATE "13111103121111111231141111111111111112111111011111111211"
+#define AMMOLINE_DEFAULT_CRATE "13111103121111111231141111111111111112111111011111111111"
#define AMMOLINE_CRAZY_QT "99999999999999999929999999999999992999999999099999929991"
#define AMMOLINE_CRAZY_PROB "11111101111111111111111111111111111111111111011111111111"
#define AMMOLINE_CRAZY_DELAY "00000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_CRAZY_CRATE "13111103121111111231141111111111111112111101011111111211"
+#define AMMOLINE_CRAZY_CRATE "13111103121111111231141111111111111112111101011111111111"
#define AMMOLINE_PROMODE_QT "90900090000000000000090000000000000000000000000000000000"
#define AMMOLINE_PROMODE_PROB "00000000000000000000000000000000000000000000000000000000"
#define AMMOLINE_PROMODE_DELAY "00000000000002055000000400070040000000002000000000000200"
-#define AMMOLINE_PROMODE_CRATE "11111101111111111111111111111111111111111001011111111211"
+#define AMMOLINE_PROMODE_CRATE "11111101111111111111111111111111111111111001011111111111"
#define AMMOLINE_SHOPPA_QT "00000099000000000000000000000000000000000000000000000000"
#define AMMOLINE_SHOPPA_PROB "44444100442444022101121212224220000000020004000100110010"
#define AMMOLINE_SHOPPA_DELAY "00000000000000000000000000000000000000000000000000000000"
-#define AMMOLINE_SHOPPA_CRATE "11111101111111111111111111111111111111111011011111111210"
+#define AMMOLINE_SHOPPA_CRATE "11111101111111111111111111111111111111111011011111111110"
#define AMMOLINE_CLEAN_QT "10100090000100000110000000000000000000000000000010000000"
#define AMMOLINE_CLEAN_PROB "04050405416006555465544647765766666661555101011154111211"
#define AMMOLINE_CLEAN_DELAY "00000000000000000000000000000000000000000000000000000200"
-#define AMMOLINE_CLEAN_CRATE "13111103121111111231141111111111111112111111011111111211"
+#define AMMOLINE_CLEAN_CRATE "13111103121111111231141111111111111112111111011111111111"
#define AMMOLINE_MINES_QT "00000099000900000003000000000000000000000000000000000000"
#define AMMOLINE_MINES_PROB "00000000000000000000000000000000000000000000000000000000"
#define AMMOLINE_MINES_DELAY "00000000000002055000000400070040000000002000000006000200"
-#define AMMOLINE_MINES_CRATE "11111101111111111111111111111111111111111111011111111211"
+#define AMMOLINE_MINES_CRATE "11111101111111111111111111111111111111111111011111111111"
#define AMMOLINE_PORTALS_QT "90000090020000000021000000000000001100000900000000000000"
#define AMMOLINE_PORTALS_PROB "04050405416006555465544647765766666661555101011154111211"
#define AMMOLINE_PORTALS_DELAY "00000000000002055000000400070040000000002000000006000200"
-#define AMMOLINE_PORTALS_CRATE "13111103121111111231141111111111111112111111011111111211"
+#define AMMOLINE_PORTALS_CRATE "13111103121111111231141111111111111112111111011111111111"
#define AMMOLINE_ONEEVERY_QT "11111191111111111111111111111111111111111111111111111111"
#define AMMOLINE_ONEEVERY_PROB "11111101111111111111111111111111111111111111111111111111"
--- a/gameServer/Actions.hs Fri Dec 13 13:50:14 2013 +0200
+++ b/gameServer/Actions.hs Fri Dec 13 21:55:19 2013 +0400
@@ -444,10 +444,8 @@
checkerLogin "" False False
else
processAction JoinLobby
- Admin -> do
+ Admin ->
mapM_ processAction [ModifyClient (\cl -> cl{isAdministrator = True}), JoinLobby]
- chan <- client's sendChan
- processAction $ AnswerClients [chan] ["ADMIN_ACCESS"]
ReplayName fn -> processAction $ ShowReplay fn
where
isBanned = do
@@ -725,11 +723,11 @@
where
toPair t = (teamname t, teamowner t)
-processAction (QueryReplay name) = do
+processAction (QueryReplay rname) = do
(Just ci) <- gets clientIndex
si <- gets serverInfo
uid <- client's clUID
- io $ writeChan (dbQueries si) $ GetReplayName ci (hashUnique uid) name
+ io $ writeChan (dbQueries si) $ GetReplayName ci (hashUnique uid) rname
#else
processAction SaveReplay = return ()
@@ -739,25 +737,25 @@
processAction (QueryReplay _) = return ()
#endif
-processAction (ShowReplay name) = do
+processAction (ShowReplay rname) = do
c <- client's sendChan
cl <- client's id
- let fileName = B.concat ["checked/", if B.isPrefixOf "replays/" name then B.drop 8 name else name]
+ let fileName = B.concat ["checked/", if B.isPrefixOf "replays/" rname then B.drop 8 rname else rname]
- checkInfo <- liftIO $ E.handle (\(e :: SomeException) ->
+ cInfo <- liftIO $ E.handle (\(e :: SomeException) ->
warningM "REPLAYS" (B.unpack $ B.concat ["Problems reading ", fileName, ": ", B.pack $ show e]) >> return Nothing) $ do
(t, p1, p2, msgs) <- liftM read $ readFile (B.unpack fileName)
return $ Just (t, Map.fromList p1, Map.fromList p2, reverse msgs)
- let (teams, params1, params2, roundMsgs) = fromJust checkInfo
+ let (teams', params1, params2, roundMsgs') = fromJust cInfo
- when (isJust checkInfo) $ do
+ when (isJust cInfo) $ do
mapM_ processAction $ concat [
[AnswerClients [c] ["JOINED", nick cl]]
, answerFullConfigParams cl params1 params2
- , answerAllTeams cl teams
+ , answerAllTeams cl teams'
, [AnswerClients [c] ["RUN_GAME"]]
- , [AnswerClients [c] $ "EM" : roundMsgs]
+ , [AnswerClients [c] $ "EM" : roundMsgs']
, [AnswerClients [c] ["KICKED"]]
]
--- a/gameServer/CoreTypes.hs Fri Dec 13 13:50:14 2013 +0200
+++ b/gameServer/CoreTypes.hs Fri Dec 13 21:55:19 2013 +0400
@@ -182,6 +182,7 @@
isRestrictedTeams :: Bool,
isRegisteredOnly :: Bool,
isSpecial :: Bool,
+ greeting :: B.ByteString,
roomBansList :: ![B.ByteString],
mapParams :: Map.Map B.ByteString B.ByteString,
params :: Map.Map B.ByteString [B.ByteString]
@@ -202,6 +203,7 @@
False
False
False
+ ""
[]
(
Map.fromList $ Prelude.zip
--- a/gameServer/HWProtoCore.hs Fri Dec 13 13:50:14 2013 +0200
+++ b/gameServer/HWProtoCore.hs Fri Dec 13 21:55:19 2013 +0400
@@ -53,6 +53,7 @@
h "WATCH" f = return [QueryReplay f]
h "FIX" _ = handleCmd ["FIX"]
h "UNFIX" _ = handleCmd ["UNFIX"]
+ h "GREETING" msg = handleCmd ["GREETING", msg]
h c p = return [Warning $ B.concat ["Unknown cmd: /", c, p]]
handleCmd cmd = do
--- a/gameServer/HWProtoInRoomState.hs Fri Dec 13 13:50:14 2013 +0200
+++ b/gameServer/HWProtoInRoomState.hs Fri Dec 13 21:55:19 2013 +0400
@@ -378,6 +378,10 @@
cl <- thisClient
return [ModifyRoom (\r -> r{isSpecial = False}) | isAdministrator cl]
+handleCmd_inRoom ["GREETING", msg] = do
+ cl <- thisClient
+ rm <- thisRoom
+ return [ModifyRoom (\r -> r{greeting = msg}) | isAdministrator cl || (isMaster cl && (not $ isSpecial rm))]
handleCmd_inRoom ["LIST"] = return [] -- for old clients (<= 0.9.17)
--- a/gameServer/HWProtoLobbyState.hs Fri Dec 13 13:50:14 2013 +0200
+++ b/gameServer/HWProtoLobbyState.hs Fri Dec 13 21:55:19 2013 +0400
@@ -79,18 +79,17 @@
(
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", nick $ fromJust owner] | isJust owner]
+ : [(AnswerClients [sendChan cl] $ "JOINED" : nicks) | not $ null nicks]
)
- ++ (if clientProto cl < 38 then map (readynessMessage cl) jRoomClients else [sendStateFlags cl jRoomClients])
+ ++ [AnswerClients [sendChan cl] ["CLIENT_FLAGS", "+h", nick $ fromJust owner] | isJust owner]
+ ++ [sendStateFlags cl jRoomClients | not $ null jRoomClients]
++ answerFullConfig cl jRoom
++ answerTeams cl jRoom
++ watchRound cl jRoom chans
- ++ []
+ ++ [AnswerClients [sendChan cl] ["CHAT", "[greeting]", greeting jRoom] | greeting jRoom /= ""]
where
- readynessMessage cl c = AnswerClients [sendChan cl] [if isReady c then "READY" else "NOT_READY", nick c]
sendStateFlags cl clients = AnswerClients [sendChan cl] . concat . intersperse [""] . filter (not . null) . concat $
[f "+r" ready, f "-r" unready, f "+g" ingame, f "-g" inroomlobby]
where
--- a/hedgewars/uScript.pas Fri Dec 13 13:50:14 2013 +0200
+++ b/hedgewars/uScript.pas Fri Dec 13 21:55:19 2013 +0400
@@ -839,6 +839,30 @@
lc_gethogteamname:= 1
end;
+function lc_sethogteamname(L : Plua_State) : LongInt; Cdecl;
+var gear : PGear;
+begin
+ if lua_gettop(L) <> 2 then
+ begin
+ LuaParameterCountError('SetHogTeamName', 'gearUid, name', lua_gettop(L));
+ lua_pushnil(L); // return value on stack (nil)
+ end
+ else
+ begin
+ gear := GearByUID(lua_tointeger(L, 1));
+ if (gear <> nil) and ((gear^.Kind = gtHedgehog) or (gear^.Kind = gtGrave)) and (gear^.Hedgehog <> nil) then
+ begin
+ gear^.Hedgehog^.Team^.TeamName := lua_tostring(L, 2);
+
+ FreeTexture(gear^.Hedgehog^.Team^.NameTagTex);
+ gear^.Hedgehog^.Team^.NameTagTex:= RenderStringTex(gear^.Hedgehog^.Team^.TeamName, gear^.Hedgehog^.Team^.Clan^.Color, fnt16);
+ end
+ else
+ lua_pushnil(L);
+ end;
+ lc_sethogteamname:= 1
+end;
+
function lc_gethogname(L : Plua_State) : LongInt; Cdecl;
var gear : PGear;
begin
@@ -2509,6 +2533,7 @@
lua_register(luaState, _P'GetClanColor', @lc_getclancolor);
lua_register(luaState, _P'SetClanColor', @lc_setclancolor);
lua_register(luaState, _P'GetHogTeamName', @lc_gethogteamname);
+lua_register(luaState, _P'SetHogTeamName', @lc_sethogteamname);
lua_register(luaState, _P'GetHogName', @lc_gethogname);
lua_register(luaState, _P'SetHogName', @lc_sethogname);
lua_register(luaState, _P'GetHogLevel', @lc_gethoglevel);
--- a/project_files/hedgewars.pro Fri Dec 13 13:50:14 2013 +0200
+++ b/project_files/hedgewars.pro Fri Dec 13 21:55:19 2013 +0400
@@ -114,7 +114,8 @@
../QTfrontend/ui/widget/feedbackdialog.h \
../QTfrontend/ui/widget/lineeditcursor.h \
../QTfrontend/servermessages.h \
- ../QTfrontend/ui/widget/roomnameprompt.h
+ ../QTfrontend/ui/widget/roomnameprompt.h \
+ ../QTfrontend/weapons.h
SOURCES += ../QTfrontend/model/ammoSchemeModel.cpp \