Skip to content

Rounding error in passenger calculations #768

Closed
@MizardX

Description

@MizardX

Describe the bug
When calculating how many passengers a house will produce (VoxelTycoon.Buildings.House.Update() method), the calculation is Mathf.CeilToInt((float) (this.Population / 2)). This results in rounding down (integer division) instead of the intended rounding up (assumed from the call to Mathf.CeilToInt).

To fix it, either divide by 2.0f or change the whole expression to (this.Population + 1) / 2

Build version
0.86.0.0 steam

Platform
Microsoft Windows 10 version 21H1 (OS Build 19043.985)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions