Skip to content

Conversation

@rnyoakum
Copy link
Contributor

@rnyoakum rnyoakum commented Jun 9, 2023

Fixes the clocks displayed in Mission Control during launches.

Fixes the clocks displayed in Mission Control during launches.
@rnyoakum rnyoakum merged commit d01aac9 into raceintospace:master Jun 9, 2023
@rnyoakum rnyoakum deleted the fix-clocks branch June 9, 2023 22:12
@peyre
Copy link
Member

peyre commented Jun 10, 2023

What was wrong with the clocks?

@rnyoakum
Copy link
Contributor Author

For instance, when the two middle clocks were at about the 10:30 position, they would immediately skip forwards to the 12:00 position. They would behave erratically, and sometimes rapidly advance through several positions. They reminded me of Mr. Burns in The Simpsons, having so many ailments they canceled each other out to a semblance of normality.

Seconds, minutes, hours, and days are divided into eight parts (0-7 for each value). The code for determining to advance a clock used

        if (g == 3 && Hour == 7) {
            change = 1;
        } else if (g == 2 && Min == 7) {
            change = 1;
        } else if (g == 1 && Sec == 7) {
            change = 1;
        } else if (g == 0) {
            change = 1;
        }

So the Day advances when the hour is 7. Not when it's 7 hours, 7 minutes, and 7 seconds; it advances at 7 hours and 1 second. Likewise for the hour. But there's more: the switch statement for advancing the time starts with days and proceeds through seconds. However, the case statements have no call to break; so whenever the day advanced, it would also advance the hour, minute, and second hands, etc. Therein lies the danger of switch statements.

@sflynn850 sflynn850 added the Bug An issue that causes a crash or an invalid or undesirable game state. label Jun 12, 2024
@sflynn850 sflynn850 added this to the Release 2.0 milestone Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug An issue that causes a crash or an invalid or undesirable game state.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants