From a870dc618f9440a3efb658607292d504e7ba1210 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sat, 15 May 2010 19:53:04 +0200 Subject: [PATCH] Fix lobby actions, now broadcasted to other players. --- conf/motd.txt | Bin 620 -> 566 bytes src/egs_game.erl | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/conf/motd.txt b/conf/motd.txt index 84d9a4a7a4cf98734025b69912296131eccd5862..746fde032dc8d7b835e07579c3623d1e79fb831d 100644 GIT binary patch delta 44 wcmaFEvW;cJ99AEOM26yt3x&mf81fmCfUuH50VtHrP{NQ26v^An$e7It02tB>4*&oF delta 97 zcmdnS@`h!?99BPuRECO)3x$217>XG384?*%7?OcxF+&N10z(c^Bnb#Bf$T(}cnL!$ jP$Um1s{mx@1Ic_KodGnW2*@q~s!s%}1@bnY&SnGvc90fN diff --git a/src/egs_game.erl b/src/egs_game.erl index 8eb47cf..c8a0b0a 100644 --- a/src/egs_game.erl +++ b/src/egs_game.erl @@ -235,6 +235,20 @@ loop(CSocket, GID, Version) -> egs_proto:packet_send(CSocket, Send) end, ?MODULE:loop(CSocket, GID, Version); + {psu_broadcast_010f, Data} -> + << _:96, SrcGID:32/little-unsigned-integer, _:256, After/bits >> = Data, + % TODO: assign the LID correctly when sending the character info for the player's character, not when broadcasting + case egs_db:users_select(SrcGID) of + error -> + ignore; + User -> + LID = User#users.lid, + Send = << 16#010f0100:32, 0:32, 16#00011300:32, SrcGID:32/little-unsigned-integer, 0:64, + 16#00011300:32, GID:32/little-unsigned-integer, 0:64, SrcGID:32/little-unsigned-integer, + LID:32/little-unsigned-integer, After/binary >>, + egs_proto:packet_send(CSocket, Send) + end, + ?MODULE:loop(CSocket, GID, Version); {psu_broadcast_0503, Data} -> << _:96, SrcGID:32/little-unsigned-integer, _:256, After/bits >> = Data, % TODO: assign the LID correctly when sending the character info for the player's character, not when broadcasting @@ -344,6 +358,12 @@ handle(16#0102, _, GID, _, Packet) -> << _:32, Data/bits >> = Packet, lists:foreach(fun(User) -> User#users.pid ! {psu_broadcast_0102, Data} end, egs_db:users_select_others(GID)); +%% @doc Lobby actions handler. Broadcast to all other players. + +handle(16#010f, _, GID, _, Packet) -> + << _:32, Data/bits >> = Packet, + lists:foreach(fun(User) -> User#users.pid ! {psu_broadcast_010f, Data} end, egs_db:users_select_others(GID)); + %% @doc Position change handler. Broadcast to all other players. handle(16#0503, _, GID, _, Packet) ->