Skip to content

Commit e026a3b

Browse files
author
hpyhacking
committed
fixed #1
1 parent ecf229d commit e026a3b

6 files changed

+23
-25
lines changed

src/handler/genesis_game_handler.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ handle_protocol(R, LoopData) ->
105105
send(R) -> send(self(), R).
106106

107107
send(PID, R) ->
108-
io:format("~n===============================~n~p~n", [R]),
108+
%io:format("~n===============================~n~p~n", [R]),
109109
case catch protocol:write(R) of
110110
{'EXIT', Raise} ->
111111
error_logger:error_report({protocol, write, R, Raise});

src/mods/op_mod_betting.erl

-2
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,10 @@ ask([H|_], Ctx = #texas{}) ->
9696
% small blind fix big blind
9797
ask_for_bet(H = #seat{inplay = Inplay, sn = SN, bet = B}, Ctx = #texas{sb = SB, stage = S})
9898
when S =:= ?GS_PREFLOP, SN =:= SB#seat.sn, B =:= Ctx#texas.sb_amt ->
99-
io:format("===ASK=== PREFLOP SB~n"),
10099
ask_for_bet(H, Ctx, {Ctx#texas.max_betting, Inplay});
101100

102101
ask_for_bet(H = #seat{inplay = Inplay, sn = SN, bet = B}, Ctx = #texas{bb = BB, limit = Limit, stage = S})
103102
when S =:= ?GS_PREFLOP, SN =:= BB#seat.sn, B =:= Ctx#texas.bb_amt ->
104-
io:format("===ASK=== PREFLOP BB~n"),
105103
ask_for_bet(H, Ctx, {Limit#limit.big, Inplay});
106104

107105
ask_for_bet(H = #seat{inplay = Inplay}, Ctx = #texas{}) ->

src/mods/restart.erl

+18-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,25 @@
22
-behaviour(op_exch_mod).
33
-export([start/2, dispatch/2]).
44

5+
-include("genesis.hrl").
6+
57
start([], Ctx) ->
6-
{goto, top, Ctx}.
8+
ResetCtx= Ctx#texas{
9+
exp_seat = ?UNDEF,
10+
exp_call = 0,
11+
exp_min = 0,
12+
exp_max = 0,
13+
board = [],
14+
pot = pot:new(),
15+
deck = deck:new(),
16+
seats = reset_seat(seat:get(Ctx#texas.seats), Ctx#texas.seats)
17+
},
18+
19+
{goto, top, ResetCtx}.
720

821
dispatch(_R, _Ctx) ->
922
ok.
23+
24+
reset_seat([], Seats) -> Seats;
25+
reset_seat([H|T], Seats) ->
26+
reset_seat(T, seat:set(H#seat{hand = hand:new(), bet = 0}, Seats)).

src/mods/showdown.erl

+2-14
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,9 @@ start([], Ctx = #texas{gid = Id, seats = S, pot = P}) ->
1919
RewardedSeats = RewardedCtx#texas.seats,
2020
KickedCtx = kick_poor_players(seat:lookup(?PS_READY, RewardedSeats), RewardedCtx),
2121

22-
ResetCtx= KickedCtx#texas{
23-
board = [],
24-
pot = pot:new(),
25-
deck = deck:new(),
26-
seats = reset_seat(seat:get(KickedCtx#texas.seats), KickedCtx#texas.seats)
27-
},
22+
game:broadcast(#notify_game_end{ game = Id }, KickedCtx),
2823

29-
game:broadcast(#notify_game_end{ game = Id }, ResetCtx),
30-
31-
{stop, ResetCtx}.
24+
{stop, KickedCtx}.
3225

3326
dispatch(_R, _Ctx) ->
3427
ok.
@@ -37,11 +30,6 @@ dispatch(_R, _Ctx) ->
3730
%%% private
3831
%%%
3932

40-
reset_seat([], Seats) -> Seats;
41-
reset_seat([H|T], Seats) ->
42-
reset_seat(T, seat:set(H#seat{hand = hand:new()}, Seats)).
43-
44-
4533
show_cards([], _Ctx) -> ok;
4634
show_cards([#seat{pid = PId, identity = Identity, hand = Hand, sn = SN}|T], Ctx = #texas{gid = Id}) ->
4735
game:broadcast(#notify_cards{ game = Id, player = PId, sn = SN, cards = Hand#hand.cards}, Ctx, [Identity]),

src/mods/wait_players.erl

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,7 @@ start(_Params, Ctx = #texas{start_delay = 0}) ->
88
wait_for_players({timeout, ?UNDEF, ?MODULE}, Ctx);
99
start(_Params, Ctx = #texas{start_delay = StartDelay}) ->
1010
Timer = erlang:start_timer(StartDelay, self(), ?MODULE),
11-
NewCtx = Ctx#texas{
12-
timer = Timer,
13-
exp_seat = ?UNDEF,
14-
exp_call = 0,
15-
exp_min = 0,
16-
exp_max = 0 },
11+
NewCtx = Ctx#texas{timer = Timer},
1712
{next, wait_for_players, NewCtx }.
1813

1914
dispatch(#cmd_raise{}, _Ctx) ->

src/op_exch_event.erl

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ init(Mod, Msg) when is_atom(Mod) ->
2727
notify([{event, init}, {Mod, Msg}]).
2828

2929
notify(Msg) ->
30-
io:format('~n~n================================~n~p~n', [Msg]),
30+
%io:format('~n~n================================~n~p~n', [Msg]),
3131
gen_event:notify(?MODULE, {self(), Msg}).

0 commit comments

Comments
 (0)