added makefile, fixed problems with tests

This commit is contained in:
Jeena Paradies 2011-02-22 03:11:35 +01:00
parent e4753b2c07
commit 6ee945379f
8 changed files with 58 additions and 36 deletions

View file

@ -65,7 +65,7 @@ handle_call({join_table, Table}, From, State) ->
{FromPlayer, _Ref} = From,
Tables = State#co_state.tables,
case lists:keyfind(Table, 1, Tables) of
{TableID, TablePID} ->
{_TableID, TablePID} ->
ggs_table:add_player(TablePID, FromPlayer),
{reply, {ok, TablePID}, State};
false ->
@ -84,7 +84,7 @@ handle_call({create_table, {force, TableID}}, From, State) ->
handle_call(_Message, _From, State) ->
{noreply, State}.
handle_cast({stop, Reason}, State) ->
handle_cast({stop, _Reason}, _State) ->
{stop, normal, state};
handle_cast(_Message, State) ->

View file

@ -45,7 +45,7 @@ handle_call(_Message, _From, State) ->
handle_cast(_Message, State) ->
{noreply, State}.
handle_info({tcp, _Socket, RawData}, State) ->
handle_info({tcp, _Socket, _RawData}, State) ->
io:format("Got connect request!~n"),
{noreply, State};

View file

@ -32,7 +32,7 @@ user_command(GameVM, Player, Command, Args) ->
loop(Table) ->
receive
{define, SourceCode} ->
{define, _SourceCode} ->
loop(Table);
{user_command, _User, Command, _Args, _From, _Ref} ->
io:format("GameVM received a message~n"),

View file

@ -60,7 +60,7 @@ loop(#pl_state{token = Token, socket = Socket, table = Table} = State) ->
io:format("Notifying table..~n"),
ggs_table:notify_game(Table, Token, Data),
loop(State);
{notify, From, Message} ->
{notify, _From, Message} ->
gen_tcp:send(Socket, Message),
loop(State)
end.

View file

@ -5,17 +5,18 @@
%% gen_server callbacks
-export([init/1, handle_call/3, handle_cast/2, handle_info/2,
terminate/2, code_change/3, notify_all_players/2, notify_game/3,
add_player/2]).
terminate/2, code_change/3]).
-record(state, { players, game_vm } ).
%% API
-export([start_link/0,
add_player/2,
remove_player/2,
stop/1,
notify/3]).
add_player/2,
remove_player/2,
stop/1,
notify/3,
notify_all_players/2,
notify_game/3]).
%% ----------------------------------------------------------------------
@ -24,6 +25,7 @@
% @doc returns a new table
start_link() ->
{ok, Pid} = gen_server:start_link(?MODULE, [], []),
Pid.
%% @private
call(Pid, Msg) ->