Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Team 2 alasdair branch #117

Merged
merged 4 commits into from
Sep 8, 2023
Merged

Conversation

AlasdairS4698737
Copy link
Contributor

Averts divide by zero edge case if a tower's fire rate is reduced to 0 shots per second. If TowerCombatTask attempts to set it's fireRateInterval to 1/0, it will instead be set to 0.
TowerUpgraderComponent is now part of all towers made, not just weapon towers.

AlasdairS4698737 and others added 3 commits September 8, 2023 13:21
updated to return without editing firerate if division by zero is attempted.
@@ -203,7 +203,11 @@ private boolean isTargetVisible() {
private void changeFireRateInterval(int perMinute) {
float oldFireSpeed = 1/fireRateInterval;
float newFireSpeed = oldFireSpeed + perMinute/60f;
fireRateInterval = 1/newFireSpeed;
if (newFireSpeed == 0) {
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

updated this to return without doing anything rather than changing the firerate

Fixed failing test after previous edit
@The-AhmadAA The-AhmadAA merged commit bfc1018 into Team-2--Towers Sep 8, 2023
@The-AhmadAA
Copy link
Contributor

Looks good, nice pick up of the edge case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants