diff --git a/examples/08_gui_snapshot.rb b/examples/08_gui_snapshot.rb index 29402d5..d582b0f 100755 --- a/examples/08_gui_snapshot.rb +++ b/examples/08_gui_snapshot.rb @@ -28,7 +28,7 @@ WINDOW_HEIGHT = 500 class Gui < Gosu::Window def initialize - super WINDOW_WIDTH, WINDOW_HEIGHT + super(WINDOW_WIDTH, WINDOW_HEIGHT) self.caption = 'ruby teeworlds client' @client = TeeworldsClient.new @client.connect('localhost', 8303, detach: true) diff --git a/lib/game_server.rb b/lib/game_server.rb index ab31bcd..7cb441f 100644 --- a/lib/game_server.rb +++ b/lib/game_server.rb @@ -149,7 +149,7 @@ class GameServer return if call_hook(:shutdown, Context.new(nil)).nil? puts '[gameserver] disconnecting all clients ...' - @server.clients.each do |id, client| + @server.clients.each do |_id, client| @server.send_ctrl_close(client, @server.shutdown_reason) end puts '[gameserver] shutting down ...' diff --git a/lib/net_base.rb b/lib/net_base.rb index a9d00e2..d7fc0ca 100644 --- a/lib/net_base.rb +++ b/lib/net_base.rb @@ -105,6 +105,6 @@ class NetBase end @s.send(data, 0, ip, port) - puts Packet.new(data, '>').to_s if @verbose || opts[:test] + puts Packet.new(data, '>') if @verbose || opts[:test] end end diff --git a/lib/packet.rb b/lib/packet.rb index 4f97b3e..b3e0931 100644 --- a/lib/packet.rb +++ b/lib/packet.rb @@ -27,7 +27,7 @@ class Packet flags_byte = @data[0].unpack('B*') @flags = PacketFlags.new(flags_byte.first[2..5]).hash @payload = @data[PACKET_HEADER_SIZE..] - return unless flags_compressed + return unless flags_compressed @payload = @huffman.decompress(@payload.unpack('C*')) @payload = @payload.pack('C*') diff --git a/lib/teeworlds_client.rb b/lib/teeworlds_client.rb index 5bf4b58..2791531 100644 --- a/lib/teeworlds_client.rb +++ b/lib/teeworlds_client.rb @@ -440,7 +440,7 @@ class TeeworldsClient data = packet.payload if data.size.zero? puts 'Error: packet payload is empty' - puts packet.to_s + puts packet return end chunks = BigChungusTheChunkGetter.get_chunks(data) @@ -480,7 +480,7 @@ class TeeworldsClient data = pck.first packet = Packet.new(data, '<') - puts packet.to_s if @verbose + puts packet if @verbose # process connless packets data if packet.flags_control diff --git a/lib/teeworlds_server.rb b/lib/teeworlds_server.rb index 1bed3ff..93e3df3 100644 --- a/lib/teeworlds_server.rb +++ b/lib/teeworlds_server.rb @@ -15,8 +15,7 @@ require_relative 'game_server' require_relative 'models/token' class Client - attr_accessor :id, :addr, :vital_sent, :last_recv_time, :token, :player, :in_game - attr_accessor :authed + attr_accessor :id, :addr, :vital_sent, :last_recv_time, :token, :player, :in_game, :authed attr_reader :ack def initialize(attr = {}) @@ -423,7 +422,7 @@ class TeeworldsServer packet.client = client end - puts packet.to_s if @verbose + puts packet if @verbose on_packet(packet) end end