Warzone2100 / warzone2100

Command the forces of The Project in a battle to rebuild the world after mankind has been nearly destroyed by nuclear missiles. A 100% free and open source real-time strategy game for Windows, macOS, Linux, BSD+
https://wz2100.net
GNU General Public License v2.0
3.11k stars 517 forks source link

countDroid in JS API does not count VTOL #2530

Open maxsupermanhd opened 2 years ago

maxsupermanhd commented 2 years ago

Describe the bug countDroid does not count VTOL

To Reproduce

  1. Achieve state with one player having only 1 VTOL left (load a replay).
  2. Try to count droids

Expected behavior VTOL count included in droid count

KJeff01 commented 2 years ago

Is this only in a replay? This doesn't happen at all in my skirmish and campaign tests.

countDroid(DROID_ANY, player_idx)

maxsupermanhd commented 2 years ago

It is not consistent as Vaut says, sometimes it counts sometimes it does not. It is confirmed by early win/lose assigning in Autohoster when VTOL is still alive and hiding, instead of a message spam it is insta loose

gantsevdenis commented 2 years ago

I just checked wzapi, and countDroid returns a memorized number, instead of iterating over droids and counting them... Soo, let me guess, this number is not consistently updated across by adjustDroidCount..

maxsupermanhd commented 2 years ago

Here is impacted game, on the bottom of the map at around 34th minute there is charged vtol that does not count: https://wz2100-autohost.net/games/9065