diff --git a/include/pp.hrl b/include/pp.hrl index 8e1fc8f..0c3261d 100644 --- a/include/pp.hrl +++ b/include/pp.hrl @@ -473,3 +473,9 @@ -record(notify_unwatch, { game }). + +-define(NOTIFY_ACTOR, 58). +-record(notify_actor, { + gid, + seat +}). diff --git a/src/exch.erl b/src/exch.erl index 4f171f0..e846110 100644 --- a/src/exch.erl +++ b/src/exch.erl @@ -136,27 +136,11 @@ process_cast(Event, Exch) -> Data = Exch#exch.data, Ctx = Exch#exch.ctx, - if - is_record(Event, watch) -> - io:format("EVENT: ~p~n", [Event]); - true -> - ok - end, -% Result = Mod:State(Data, Ctx, Event), -% advance(Exch, Event, Result). - %io:format("STATE: ~p~nMOD: ~p~nEVENT: ~p~n", [State, Mod, Event]), case Cbk:cast(Event, Ctx, Data) of skip -> Result = Mod:State(Data, Ctx, Event), - case Result of - {stop, _, _} -> - io:format("STATE: ~p~nMOD: ~p~nEVENT: ~p~n", [State, Mod, Event]); - _ -> ok - end, - %io:format("RESULT: ~p~n", [Result]), advance(Exch, Event, Result); {NewGame, NewCtx} -> - %io:format("NEWGAME: ~p~nNEWCTX: ~p~n", [NewGame, NewCtx]), {noreply, Exch#exch{data = NewGame, ctx = NewCtx}} end. diff --git a/src/pp.erl b/src/pp.erl index 6e81d31..d1005a0 100644 --- a/src/pp.erl +++ b/src/pp.erl @@ -667,6 +667,11 @@ notify_unwatch() -> record(notify_unwatch, { game() }). +notify_actor() -> + record(notify_actor, { + game(), + seat() + }). %%% Pickle write(R) when is_record(R, bad) -> @@ -839,7 +844,9 @@ write(R) when is_record(R, notify_seat_detail) -> write(R) when is_record(R, notify_game_detail) -> [?NOTIFY_GAME_DETAIL | pickle(notify_game_detail(), R)]; write(R) when is_record(R, notify_unwatch) -> - [?NOTIFY_UNWATCH | pickle(notify_unwatch(), R)]. + [?NOTIFY_UNWATCH | pickle(notify_unwatch(), R)]; +write(R) when is_record(R, notify_actor) -> + [?NOTIFY_ACTOR | pickle(notify_actor(), R)]. %%% Unpickle @@ -1013,7 +1020,9 @@ read(<>) -> read(<>) -> unpickle(notify_game_detail(), Bin); read(<>) -> - unpickle(notify_seat_detail(), Bin). + unpickle(notify_seat_detail(), Bin); +read(<>) -> + unpickle(notify_actor(), Bin). send(Socket, Data, Ping) -> Bin = list_to_binary(write(Data)), diff --git a/src/test/dmb.erl b/src/test/dmb.erl index 7e443e4..4842ac4 100644 --- a/src/test/dmb.erl +++ b/src/test/dmb.erl @@ -253,7 +253,7 @@ start_game_slaves(N) -> %%% Enable kernel poll and disable SMP. The latter is not obligatory. common_args() -> - "+K true -smp disable". + "+K true -smp disable -pa ebin deps/*/ebin". start_slave_node(Name, Args) -> case slave:start_link(net_adm:localhost(), Name, Args) of diff --git a/src/texas/g.erl b/src/texas/g.erl index 8e9ef34..a00a2ca 100644 --- a/src/texas/g.erl +++ b/src/texas/g.erl @@ -533,25 +533,27 @@ get_seat(Game, Player) request_bet(Game, SeatNum, Call, Min, Max) -> Seat = element(SeatNum, Game#game.seats), + Game1 = broadcast(Game, #notify_actor{ gid = Game#game.gid, seat = SeatNum}), + if %% auto-play enabled Seat#seat.cmd_que /= [] -> - Seat1 = process_autoplay(Game, Seat), - Game#game { + Seat1 = process_autoplay(Game1, Seat), + Game1#game { seats = setelement(SeatNum, - Game#game.seats, + Game1#game.seats, Seat1) }; %% regular bet request true -> BetReq = #bet_req{ - game = Game#game.gid, + game = Game1#game.gid, call = Call, min = Min, max = Max }, gen_server:cast(Seat#seat.player, BetReq), - Game + Game1 end. %%% Use stored commands instead of asking player