Skip to content

[BUG] Shipyards never stop working  #239

@Scott-TT

Description

@Scott-TT

Version: latest/master

Hello, real bug this time as far as I can tell :)

Apologies for very poor PHP skills. Learning on the fly.

In short the shipyards never ever stop working, even when their queue is actually empty, "accumulating" production time while inactive, and then being able to instantly pop out massive amounts of ships. Debug/investigation isn't fun, due to time-sensitive reproduction, but issue can be quickly observed with some manual debugging.

This check is the root cause of the issue, and fails to properly detect that a queue is indeed empty.
Adding a basic debug log error_log("Queue is non-0: adding production time = $ProductionTime") ; right inside the body and refreshing the shipyard page of any inactive planet show that each refresh adds production time.
Requesting ship construction while this buffer is high enough leads to instant build queues (up until the buffer is fully consumed), which is particularly noticeable with a higher game speed multiplier : hours worth of production are typically instantaneous.

Proposed fix : replace with if (!empty($ThePlanet['shipyardQueue'])) . Confirmed to work for shipyards, but NOT retroactive : the buffer will still need to be consumed.

Side note:

While the core issue is that this time leads to (I believe) improper build time mechanics, a fun side-effect is that with enough accumulated time (not much), accessing the overview Page throws this highly funky stack in the logs (but appears just fine to the user)

[11-Jul-2022 23:47:50 UTC] PHP Fatal error:  Uncaught Error: Class "UniEngine\Engine\Common\Exceptions\UniEngineException" not found in C:\Apache24\htdocs\UniEngine\includes\helpers\world\elements.cost.functions.php:13
Stack trace:
#0 C:\Apache24\htdocs\UniEngine\includes\helpers\_includes.php(14): include()
#1 C:\Apache24\htdocs\UniEngine\generate_sig.php(29): include('C:\\Apache24\\htd...')
#2 {main}
  thrown in C:\Apache24\htdocs\UniEngine\includes\helpers\world\elements.cost.functions.php on line 13
[11-Jul-2022 23:47:50 UTC] PHP Fatal error:  Uncaught Error: Class "UniEngine\Engine\Common\Exceptions\UniEngineException" not found in C:\Apache24\htdocs\UniEngine\includes\helpers\world\elements.cost.functions.php:13
Stack trace:
#0 C:\Apache24\htdocs\UniEngine\includes\helpers\_includes.php(14): include()
#1 C:\Apache24\htdocs\UniEngine\generate_sig.php(29): include('C:\\Apache24\\htd...')
#2 {main}
  thrown in C:\Apache24\htdocs\UniEngine\includes\helpers\world\elements.cost.functions.php on line 13

I have no idea why, nor do I believe it worth investigating further at this point.

Regards,
Scott

Metadata

Metadata

Assignees

Labels

bugAll bug reportsbug:unconfirmedAll new bug reports that are yet to be confirmed (eg. by providing more details)

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions