openra 1.0.1 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 53319a87b7e4de611a2dff2eb7ff000d31214070
4
- data.tar.gz: fdb078643277f89a02e6822dbefac5c37703af61
3
+ metadata.gz: ab7a16c3f01e989e67ae2aa310703ffff750855b
4
+ data.tar.gz: 1b0a85ea770c2d1a9f3e2914f900da66949eb50d
5
5
  SHA512:
6
- metadata.gz: d60e345f5f50e8f2fcba27042e85fc9e6eb56f3076216d42450b57f202c5d0245295bfb33101f36a17682b8b2b00aa4cc8fd1674a84e2f2ed89d8531b734c97d
7
- data.tar.gz: 67bef8e53bc78c6a6ee8c020fd87856177f1889e53cb825d6deec16806d7876585654d2e20110e8bdeb8a43add000f872fc686ce610df0ada0d72190278c14cd
6
+ metadata.gz: 4b5e36e2e31a514e081dc0f2d990f201d7db44de8d0c34eb6f47e13eff28d7a3753b0762580fe55d99483f1acd3904a4e5c68f84e7f939f07d91b56523530715
7
+ data.tar.gz: 9bab1534a3739e98b9b0182f98ca147890ef17646ba8b5523be0c9d219275f1d727a72ca461f1c43a4e09a52c9f45824824c8ac2c44c6c1a3938ecdc726345b6
@@ -2,10 +2,19 @@
2
2
 
3
3
  ## Fixed
4
4
 
5
+ * [replay-data] Make chat messages show name at time of message ([AMHOL](https://github.com/AMHOL))
6
+ * [replay-data] Only include clients present at game start ([AMHOL](https://github.com/AMHOL))
7
+
8
+ [Compare v1.0.1...HEAD](https://github.com/AMHOL/openra-ruby/compare/v1.0.1...HEAD)
9
+
10
+ ## v1.0.1
11
+
12
+ ## Fixed
13
+
5
14
  * [core] Add bundler as a runtime dependency (thanks to by dragunoff) ([AMHOL](https://github.com/AMHOL))
6
15
  * [replay-data] Fixed the game "type" field (by updating it to use players rather than clients array) ([AMHOL](https://github.com/AMHOL))
7
16
 
8
- [Compare v1.0.0...HEAD](https://github.com/AMHOL/openra-ruby/compare/v1.0.0...HEAD)
17
+ [Compare v1.0.0...v1.0.1](https://github.com/AMHOL/openra-ruby/compare/v1.0.0...v1.0.1)
9
18
 
10
19
  ## v1.0.0
11
20
 
@@ -1,4 +1,5 @@
1
1
  require 'securerandom'
2
+ require 'ostruct'
2
3
  require 'yaml'
3
4
  require 'json'
4
5
  require 'hanami/cli'
@@ -79,10 +79,20 @@ module Openra
79
79
  chat: []
80
80
  }
81
81
 
82
+ current_sync_info = OpenStruct.new(
83
+ clients: []
84
+ )
85
+
82
86
  replay.orders.each do |order|
83
- client = replay.client(order.client_index.to_s)
87
+ client = current_sync_info.clients.find do |candidate|
88
+ candidate.index == order.client_index.to_s
89
+ end
84
90
 
85
91
  case order.command
92
+ when 'SyncInfo'
93
+ current_sync_info = Openra::Struct::SyncInfo.new(
94
+ Openra::YAML.load(order.target)
95
+ )
86
96
  when 'PlaceBuilding'
87
97
  client_hash = replay_data[:clients].find do |candidate|
88
98
  candidate[:index] == order.client_index.to_s
@@ -54,22 +54,13 @@ module Openra
54
54
  def sync_info
55
55
  return @sync_info if @sync_info
56
56
 
57
- syncs = orders.reverse.each_with_object([]) do |order, arr|
58
- next unless order.command == 'SyncInfo'
57
+ start_game_order = orders.find { |order| order[:command] == 'StartGame' }
58
+ start_game_index = orders.index(start_game_order)
59
+ start_game_sync_order = orders[start_game_index.pred]
59
60
 
60
- arr << Openra::Struct::SyncInfo.new(
61
- Openra::YAML.load(order.target)
62
- )
63
- end
64
-
65
- @sync_info = syncs.inject(syncs.shift) do |next_sync, sync|
66
- next_sync.clients.each do |client|
67
- next if sync.clients.map(&:index).include?(client.index)
68
- sync.clients << client
69
- end
70
-
71
- sync
72
- end
61
+ @sync_info = Openra::Struct::SyncInfo.new(
62
+ Openra::YAML.load(start_game_sync_order.target)
63
+ )
73
64
  end
74
65
  end
75
66
  end
@@ -1,3 +1,3 @@
1
1
  module Openra
2
- VERSION = '1.0.1'.freeze
2
+ VERSION = '1.1.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: openra
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Holland
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-07-13 00:00:00.000000000 Z
11
+ date: 2018-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler