
Steemnova - error in deut consumption calculation
Project Information
Expected behavior
When I want to send ships around, it is expected that I can do this as long as the deut consumption does not exceed the deut in the storage or in the cargo capacity.
Actual behavior
If the deut consumption for a fleet mission is zero, the cargo capacity gets shown as zero as well, even though it should be much higher. Also, if one presses continue, steemnova throws the following error:
WARNING
--
Message: Division by zero
File: /includes/classes/class.FleetFunctions.php
Line: 187
URL: https://steemnova.intinte.org/game.php?page=fleetStep2
PHP-Version: 7.0.30-2
PHP-API: fpm-fcgi
2Moons Version: 1.8.git
Debug Backtrace:
#0 /includes/classes/class.FleetFunctions.php(187): errorHandler(2, 'Division by zer...', 'FILEPATH ...', 187, Array)
#1 /includes/pages/game/ShowFleetStep2Page.class.php(88): FleetFunctions::GetFleetConsumption(Array, 5, 5, Array, 2)
#2 /game.php(58): ShowFleetStep2Page->show()
#3 {main}
As the error message states, this is caused by a division by zero. I think this is caused by the very high speed of spy drones, causing the duration of the of the flight to be rounded down to zero in the round expression in that line. Maybe this bug could be fixed by adding a max() statement in there. (so changing round($MissionDuration, 0) to max(round($MissionDuration, 0), 1))
How to reproduce
(These steps assume you know how to play the game and how it works a bit.) If these need to be more detailed for you, hit me up in the comments or in discord and I'll edit them
- Get a running steemnova environment to test on. (Here's a tutorial for setting up a local steemnova instance)
- Get a moon besides one of your planets. (This can be done with the admin tools if you have admin permissions or by having some luck while playing the game)
- Build some Spy Probes.
- Try to send them to your moon.
- Browser/App version: Vivaldi | 1.15.1147.55 (Stable channel) (64-Bit)
- Operating system: Windows 10
Communication with Project Owner
When I first encountered this bug and verified it was replicable I hit up @mys on discord and asked him if that was already known. After he said no I opened a GitHub issue. Mys answered in that issue, and already fixed that bug in this pull request
GitHub Account
Leave Steemnova - error in deut consumption calculation to:
Read more #utopian-io posts
Best Posts From Flugschwein
We have not curated any of flugschwein's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.
More Posts From Flugschwein
- Numbers for the upcoming Hardfork
- My chipadvisor results
- Mein Steem Geburtstag - My Steem Birthday
- Beem 0.20.10 - Fixing lots of documentation syntax errors and typos
- Your Vote Value got a lot higher after HF20? Here's why!
- Which witnesses could be interesting for me?
- Beem 0.19.55 - 3 new functions for SBD to rshares/vote_pct calculations
- Beem 0.19.54 - Optimizing vote value calculations
- UserAuthority (UA), @steem-ua und UA-API – Deutsche Übersetzung
- Beem 0.19.52 - calculation error in vests_to_rshares