diff --git a/src/egs_game_server.erl b/src/egs_game_server.erl index 15692e2..fd5da6c 100644 --- a/src/egs_game_server.erl +++ b/src/egs_game_server.erl @@ -59,5 +59,6 @@ init(Socket) -> egs_game_server_exit_mon ! {link, self()}, timer:send_interval(5000, {egs, keepalive}), TmpGID = 16#ff000000 + mnesia:dirty_update_counter(counters, tmpgid, 1), - psu_proto:send_0202(Socket, TmpGID), - egs_network:recv(<< >>, egs_login, #state{socket=Socket, gid=TmpGID}). + State = #state{socket=Socket, gid=TmpGID}, + psu_proto:send_0202(State), + egs_network:recv(<< >>, egs_login, State). diff --git a/src/egs_login_server.erl b/src/egs_login_server.erl index 5945739..62d75d4 100644 --- a/src/egs_login_server.erl +++ b/src/egs_login_server.erl @@ -36,5 +36,6 @@ on_exit(_Pid) -> %% @doc Initialize the game state and start receiving messages. init(Socket) -> TmpGID = 16#ff000000 + mnesia:dirty_update_counter(counters, tmpgid, 1), - psu_proto:send_0202(Socket, TmpGID), - egs_network:recv(<< >>, egs_login, #state{socket=Socket, gid=TmpGID}). + State = #state{socket=Socket, gid=TmpGID}, + psu_proto:send_0202(State), + egs_network:recv(<< >>, egs_login, State). diff --git a/src/psu/psu_proto.erl b/src/psu/psu_proto.erl index e33eac0..82526e5 100644 --- a/src/psu/psu_proto.erl +++ b/src/psu/psu_proto.erl @@ -1194,7 +1194,7 @@ send_0201(CharUser, State) -> %% @doc Hello command. Sent when a client connects to the game or login server. %% @todo Can contain an error message if 0:1024 is setup similar to this: 0:32, 3:32/little, 0:48, Len:16/little, Error/binary, 0:Padding. -send_0202(DestSocket, SessionID) -> +send_0202(#state{socket=DestSocket, gid=SessionID}) -> packet_send(DestSocket, << 16#020203bf:32, 16#ffff:16, 0:272, SessionID:32/little, 0:1024 >>). %% @doc Make the client load a new map.