diff --git a/games/GGSChat/chat.py b/games/GGSChat/chat.py index 9c94728..17c30ea 100644 --- a/games/GGSChat/chat.py +++ b/games/GGSChat/chat.py @@ -42,11 +42,15 @@ class GGSChat: exp = self.wTree.get_widget("entry").get_text() nick = self.wTree.get_widget("nickBox").get_text() if exp[0] == "/": + cmdStr = exp[1:].split(" ") + cmd = cmdStr[0] + params = ' '.join(cmdStr[1:]) self.s.send("Game-Command: %s\n" % exp[1:] + "Token: %s\n" % self.token + "Content-Type: text\n" + - "Content-Length: 0\n"+ - "\n") + "Content-Length: %s\n" % len(params)+ + "\n"+ + params) else: exp = "<%s> %s" % (nick, exp) self.s.send("Game-Command: chat\n"+ diff --git a/src/ggs_coordinator.erl b/src/ggs_coordinator.erl index a7f0ab8..f1e7caa 100644 --- a/src/ggs_coordinator.erl +++ b/src/ggs_coordinator.erl @@ -49,7 +49,7 @@ respawn_table(_Token) -> ggs_logger:not_implemented(). %% @doc Removes a player from coordinator. -remove_player(_From, Player) -> +remove_player(_From, _Player) -> %gen_server:cast(ggs_coordinator, {remove_player, Player}). ggs_logger:not_implemented(). @@ -66,7 +66,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 -> @@ -85,8 +85,8 @@ handle_call({create_table, {force, TableID}}, From, State) -> handle_call(_Message, _From, State) -> {noreply, State}. -handle_cast({stop, Reason}, State) -> - {stop, normal, state}; +handle_cast({stop, _Reason}, State) -> + {stop, normal, State}; %% @TODO: Implement me %handle_cast({remove_player, Player}) -> diff --git a/src/ggs_dispatcher.erl b/src/ggs_dispatcher.erl index 49dcf4b..11dd729 100644 --- a/src/ggs_dispatcher.erl +++ b/src/ggs_dispatcher.erl @@ -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}; diff --git a/src/ggs_gamevm.erl b/src/ggs_gamevm.erl index 1a8f547..a16e6a6 100644 --- a/src/ggs_gamevm.erl +++ b/src/ggs_gamevm.erl @@ -6,7 +6,6 @@ %% @doc Create a new VM process. The process ID is returned and can be used %% with for example the define method of this module. start_link() -> - erlang_js:start(), %% @TODO: should only be done once PortPid = spawn_link( fun() -> process_flag(trap_exit, true), {ok, Port} = js_driver:new(), @@ -46,5 +45,7 @@ loop(Port) -> list_to_binary(Args) ]), From ! {Ref, Ret}, - loop(Port) + loop(Port); + {eval, JS} -> + end. diff --git a/src/ggs_gamevm_e.erl b/src/ggs_gamevm_e.erl index ad2527b..3cc6b17 100644 --- a/src/ggs_gamevm_e.erl +++ b/src/ggs_gamevm_e.erl @@ -32,11 +32,11 @@ user_command(GameVM, Player, Command, Args) -> loop(Table) -> receive - {define, SourceCode} -> + {define, _SourceCode} -> io:format("GameVM_e can't define functions, sorry!~n"), loop(Table); - {user_command, Player, Command, Args, From, _Ref} -> - erlang:display(Player), + {user_command, Player, Command, Args, _From, _Ref} -> + erlang:display(Command), do_stuff(Command, Args, Player, Table), loop(Table) end. @@ -53,6 +53,8 @@ do_stuff(Command, Args, Player, Table) -> "lusers" -> {ok, Players} = ggs_table:get_player_list(Table), ggs_player:notify(Player, server,io_lib:format("~p\n",[Players])); - Other -> + "nick" -> + io:format("Changing nickname of ~p to ~p.", [Player, Args]); + _Other -> ggs_player:notify(Player, server, "I don't know that command..\n") end. diff --git a/src/ggs_player.erl b/src/ggs_player.erl index bd3b198..0211f3f 100644 --- a/src/ggs_player.erl +++ b/src/ggs_player.erl @@ -56,21 +56,21 @@ stop(_Player,_Table) -> %% Internals -loop(#pl_state{token = Token, socket = Socket, table = Table} = State) -> +loop(#pl_state{token = _Token, socket = Socket, table = Table} = State) -> receive {tcp, Socket, Data} -> % Just echo for now.. io:format("Parsing via protocol module..~n"), Parsed = ggs_protocol:parse(Data), self() ! Parsed, loop(State); - {notify, From, Message} -> + {notify, _From, Message} -> gen_tcp:send(Socket, Message), loop(State); % Below are messages generated by the parser - {game_cmd,Cmd, Headers, Data} -> + {game_cmd,Cmd, _Headers, Data} -> ggs_table:notify(Table, self(), {game, Cmd, Data}), loop(State); - {srv_cmd,"define", Headers, Data} -> + {srv_cmd,"define", _Headers, Data} -> ggs_table:notify(Table, self(), {server, define, Data}), loop(State); {tcp_closed, _Socket} -> diff --git a/src/ggs_table.erl b/src/ggs_table.erl index 93b79fd..cf77f30 100644 --- a/src/ggs_table.erl +++ b/src/ggs_table.erl @@ -6,7 +6,7 @@ %% 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, get_player_list/1]). + get_player_list/1]). -record(state, { token, players, socket, game_vm } ).