reinforce 0.3.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c2c8e1823c1494cc0539eb64c7584b13373db6b93997098fc21c9b62486128c2
4
- data.tar.gz: dd6cb4d68bc5161612b5445115478a1933d88673addc2016c54eb11ee1ad3651
3
+ metadata.gz: 0dbb936bd23637321c7c067014202777a82fd047abdb1f64614ac4d640691345
4
+ data.tar.gz: 883ca0c1b22859a9f247a5d5469f21bf1e41730116c7857fe7fdc157c33c7834
5
5
  SHA512:
6
- metadata.gz: 5b23e3dc607237646695799064d8cdb740e2715b2ca718b342d734a5a39391025a70fc24ad14fef723bbbc34a97615688fb5d070846b859adf1ae7014b3725e1
7
- data.tar.gz: 7c660a7ed763f7732b8ae8bf9e16c7ab1bc897890960f2928b131ee20e77ce572aceebab53b31167d176290207e0d4797c550d1e5a30d1ba9b363d112253eba7
6
+ metadata.gz: 2c5ab91f9de91f1870fab2ec6b4e18b8332611d7acd4a6530d453e135f73e80558589eb5c234fae9b99d644258b85fa71d49a9d677091058810191b78ea9a25a
7
+ data.tar.gz: e4a8535ee8d6f83a4761acb5137dd1267c676f7c3ebc9d60eb50c606213b94df746f354e01a31b3335eda1c36a560996799c7755990958354f6fec325981b336
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Reinforce
4
4
  class Command
5
- attr_reader :action_type, :tick, :source, :index, :details
5
+ attr_reader :action_type, :tick, :source, :queue_index, :index, :details
6
6
 
7
7
  PBGID_MAX = 2_147_483_648
8
8
 
@@ -12,7 +12,8 @@ module Reinforce
12
12
  @tick = command_hash.values.first[:tick]
13
13
  @pbgid = command_hash.values.first[:pbgid]
14
14
  @source = command_hash.values.first[:source_identifier]
15
- @index = command_hash.values.first[:queue_index]
15
+ @queue_index = command_hash.values.first[:queue_index]
16
+ @index = command_hash.values.first[:index]
16
17
  @details = Reinforce.dictionary.get_by_pbgid(@pbgid, build: build_number)
17
18
  @cancelled = false
18
19
  @suspect_from_tick = nil
@@ -74,7 +74,7 @@ module Reinforce
74
74
  if command.action_type == 'CancelConstruction'
75
75
  @buildings.reject(&:suspect?).each { |building| building.mark_suspect(command.tick) }
76
76
  else
77
- @productions[command.source][command.index - 1].cancel
77
+ @productions[command.source][command.queue_index - 1].cancel
78
78
  end
79
79
 
80
80
  true
@@ -90,7 +90,11 @@ module Reinforce
90
90
 
91
91
  def consolidate
92
92
  build = @buildings + @battlegroup + @takeover + @productions.values.flatten
93
- build.sort_by(&:tick)
93
+ build.sort do |a, b|
94
+ order = a.tick <=> b.tick
95
+ order = a.index <=> b.index if order.zero?
96
+ order
97
+ end
94
98
  end
95
99
 
96
100
  # rubocop:disable Metrics/AbcSize
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Reinforce
4
- VERSION = '0.3.2'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: reinforce
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ryantaylor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-09-15 00:00:00.000000000 Z
11
+ date: 2024-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vault_coh