NestorTejero / ES2016A

VideoJoc Curs Enginyeria Software 2016 - grup A de pràctiques (dijous)
https://nestortejero.github.io/ES2016A/
GNU General Public License v3.0
2 stars 0 forks source link

Fix bug with tower interface #282

Closed sdiaz7 closed 7 years ago

sdiaz7 commented 7 years ago

Clicking the interface buttons when they are over a tower opens the interface of that tower, rather than performing the requested action.

Definition of Done:

Time estimated: 1 hour

Branch: dev_Issue282

Pull request: #283

NestorTejero commented 7 years ago

Prova:

sdiaz7 commented 7 years ago

Bug was caused by the way the if-else conditions where sorted.

Old pseudocode:

if upgrade button clicked and tower selected:
    upgrade selected tower

else if tower clicked:
    set clicked tower as tower selected

else if sell button clicked and tower selected:
    sell selected tower

else
    close interface

Making the tower selection checkout before the buying tower causes that when the associated button is clicked over a tower the code takes the tower and does not perform the sale. Fixed pseudocode:

if upgrade button clicked and tower selected:
    upgrade selected tower

else if sell button clicked and tower selected:
    sell selected tower

else if tower clicked:
    set clicked tower as tower selected

else
    close interface

Now the "sell button clicked" condition has priority over the "tower clicked one". With this little modification the code works as was expected. I proceed to open the pull request

agonzatr17 commented 7 years ago

Issue done perfectly, see Pull Request #283 for more info.