#5602 closed defect (fixed)
ProductionQueue WARNING: Invalid command: can't train 0 units
Reported by: | elexis | Owned by: | elexis |
---|---|---|---|
Priority: | Nice to Have | Milestone: | Alpha 24 |
Component: | UI – In-game | Keywords: | |
Cc: | Patch: |
Description
In this match with r22951, nani somehow managed to send a command from the UI where 0 units were ordered to be trained at a kennel:
turn 6181 500 cmd 8 {"type":"returnresource","entities":[9978,9998,12158,12159,12160,12851,12887,12902,12903,13500,13501,13502,13503,13579,13609,13619],"target":10731,"queued":false} cmd 8 {"type":"gather","entities":[9978,9998,12158,12159,12160,12851,12887,12902,12903,13500,13501,13502,13503,13579,13609,13619],"target":5766,"queued":true} cmd 2 {"type":"train","entities":[10077,10092,10105],"template":"units/brit_war_dog_b","count":2} cmd 2 {"type":"train","entities":[10118],"template":"units/brit_war_dog_b","count":0} end
In the replay / for all players:
Turn 6181 (500)... WARNING: Invalid command: can't train 0 units
So there must be some kind of way to trigger this command from the UI, but that should not be possible to send it, i.e. should be fixed in the UI as well, not only simulation.
Attachments (1)
Change History (5)
by , 5 years ago
Attachment: | commands.zip added |
---|
comment:2 by , 4 years ago
Keywords: | simple removed |
---|---|
Milestone: | Backlog → Alpha 24 |
- Reproduced with n in {3, 4, 5} kennels, where
limit - (n-1)
dogs had been trained, batchSize = 1 and then flushing one batch
- Reproduced with batchsize=3 too:
WARNING: batchedSize 3 WARNING: appropriateBuildings.length 5 WARNING: g_BatchTrainingEntityAllowedCount 12 WARNING: buildingsCountToTrainFullBatch 4 WARNING: Invalid command: can't train 0 units
- It's the remainer part of
flushTrainingBatch
.
g_BatchTrainingEntityAllowedCount % batchedSize
is only negative ifg_BatchTrainingEntityAllowedCount
is negative, see specs
g_BatchTrainingEntityAllowedCount
is at least 0, see lineret.canBeAddedCount = Math.max(ret.entLimit - ret.entCount, 0);
- So capturing 0 is sufficient to cover all these reproduced cases.
batchedSize
is at least 1*
- So this non-0 check is sufficient for all "train" commands to capture all ways to trigger this error*
(* (unless there is a bug where g_NumberOfBatches could be 0 and this code called))
comment:4 by , 4 years ago
Summary: | ProudctionQueue WARNING: Invalid command: can't train 0 units → ProductionQueue WARNING: Invalid command: can't train 0 units |
---|
Note:
See TracTickets
for help on using tickets.
faction02 reported the way to reproduce the bug:
Then 2 dogs + 1 JS GUI warning is pushed.
The relevant code would be in addTrainingToQueue, flushTrainingBatch of input.js.