diff --git a/lib/game_client.rb b/lib/game_client.rb index 7eff892..2ad63e6 100644 --- a/lib/game_client.rb +++ b/lib/game_client.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -require_relative 'player' +require_relative 'models/player' +require_relative 'models/chat_message' require_relative 'packer' -require_relative 'chat_message' class Context attr_reader :old_data, :client diff --git a/lib/game_server.rb b/lib/game_server.rb index 0772ba3..b9b09ca 100644 --- a/lib/game_server.rb +++ b/lib/game_server.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -require_relative 'map' -require_relative 'server_info' -require_relative 'game_info' +require_relative 'models/map' +require_relative 'models/server_info' +require_relative 'models/game_info' class GameServer attr_accessor :pred_game_tick, :ack_game_tick, :map diff --git a/lib/chat_message.rb b/lib/models/chat_message.rb similarity index 100% rename from lib/chat_message.rb rename to lib/models/chat_message.rb diff --git a/lib/game_info.rb b/lib/models/game_info.rb similarity index 95% rename from lib/game_info.rb rename to lib/models/game_info.rb index 2bbd929..83dd025 100644 --- a/lib/game_info.rb +++ b/lib/models/game_info.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative 'packer' +require_relative '../packer' class GameInfo attr_accessor :game_flags, :score_limit, :time_limit, :match_num, :match_current diff --git a/lib/map.rb b/lib/models/map.rb similarity index 98% rename from lib/map.rb rename to lib/models/map.rb index 7284447..c47ccc4 100644 --- a/lib/map.rb +++ b/lib/models/map.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative 'bytes' +require_relative '../bytes' class Map attr_reader :name, :crc, :crc_str, :crc_arr, :size, :sha256, :sha256_str, :sha256_arr diff --git a/lib/net_addr.rb b/lib/models/net_addr.rb similarity index 100% rename from lib/net_addr.rb rename to lib/models/net_addr.rb diff --git a/lib/packet_flags.rb b/lib/models/packet_flags.rb similarity index 100% rename from lib/packet_flags.rb rename to lib/models/packet_flags.rb diff --git a/lib/player.rb b/lib/models/player.rb similarity index 100% rename from lib/player.rb rename to lib/models/player.rb diff --git a/lib/server_info.rb b/lib/models/server_info.rb similarity index 96% rename from lib/server_info.rb rename to lib/models/server_info.rb index 3a045e5..1fcece5 100644 --- a/lib/server_info.rb +++ b/lib/models/server_info.rb @@ -1,8 +1,8 @@ # frozen_string_literal: true -require_relative 'network' +require_relative '../network' require_relative 'player' -require_relative 'packer' +require_relative '../packer' class ServerInfo attr_accessor :version, :name, :hostname, :map, :gametype, :flags, :num_players, :max_players, :num_clients, diff --git a/lib/token.rb b/lib/models/token.rb similarity index 95% rename from lib/token.rb rename to lib/models/token.rb index 91f8f17..31ac8e8 100644 --- a/lib/token.rb +++ b/lib/models/token.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative 'bytes' +require_relative '../bytes' class SecurityToken def self.err_msg(msg, token) diff --git a/lib/net_base.rb b/lib/net_base.rb index 9240f35..4a8747a 100644 --- a/lib/net_base.rb +++ b/lib/net_base.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative 'token' +require_relative 'models/token' ## # NetBase diff --git a/lib/packet.rb b/lib/packet.rb index 227fd72..4f97b3e 100644 --- a/lib/packet.rb +++ b/lib/packet.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true -require_relative 'net_addr' -require_relative 'packet_flags' +require_relative 'models/net_addr' +require_relative 'models/packet_flags' require 'huffman_tw' diff --git a/lib/teeworlds_client.rb b/lib/teeworlds_client.rb index 75396c6..9854916 100644 --- a/lib/teeworlds_client.rb +++ b/lib/teeworlds_client.rb @@ -8,10 +8,10 @@ require_relative 'bytes' require_relative 'network' require_relative 'packet' require_relative 'chunk' -require_relative 'server_info' +require_relative 'models/server_info' require_relative 'net_base' require_relative 'packer' -require_relative 'player' +require_relative 'models/player' require_relative 'game_client' require_relative 'message' diff --git a/lib/teeworlds_server.rb b/lib/teeworlds_server.rb index 69d2fcd..971ac92 100644 --- a/lib/teeworlds_server.rb +++ b/lib/teeworlds_server.rb @@ -9,11 +9,11 @@ require_relative 'network' require_relative 'packet' require_relative 'chunk' require_relative 'net_base' -require_relative 'net_addr' +require_relative 'models/net_addr' require_relative 'packer' require_relative 'game_server' require_relative 'message' -require_relative 'token' +require_relative 'models/token' class Client attr_accessor :id, :addr, :vital_sent, :last_recv_time, :token, :player, :in_game diff --git a/spec/06_server_info_spec.rb b/spec/06_server_info_spec.rb index 21cc06d..e728123 100644 --- a/spec/06_server_info_spec.rb +++ b/spec/06_server_info_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative '../lib/server_info' +require_relative '../lib/models/server_info' describe 'ServerInfo', :server_info do context 'Pack to network' do diff --git a/spec/07_game_info_spec.rb b/spec/07_game_info_spec.rb index f9fc6cb..3f9928a 100644 --- a/spec/07_game_info_spec.rb +++ b/spec/07_game_info_spec.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -require_relative '../lib/game_info' +require_relative '../lib/models/game_info' describe 'GameInfo', :game_info do context 'Pack to network' do