Skip to content

Rounding error in passenger calculations #768

Closed

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)

Activity

  1. andrewpey commented on Mar 5, 2022

    @andrewpey
    Collaborator

    Thanks! Fix is live on the beta branch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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