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

Fix UI papercuts #1248

Conversation

necessarily-equal
Copy link
Contributor

@necessarily-equal necessarily-equal commented Dec 29, 2020

Always allow buying upgrade when funds would be sufficient

Sometimes you have enough money to buy something but first need to sell
what conflicting gear you already have. For example when you want to
replace your heavy armor to put on on a light armor and have 100 credits
in your pocket. The game didn't allow you to buy it and required you to
sell it explicitely first. This commit fixes the annoyance.

Example test process:

  • /devmap usstremor
  • /give momentum 300
  • /give funds 400
  • buy power armor
  • try to buy anything else without selling your power armor
    note that if you give yourself 1000 credits on the 0.51, you can buy
    every update, even conflicting, but you can't do that if you have 400
    credits.

Fix rounding annoyance in displayed morph points

as said on IRC:
afontain:
do you have some other ui papercuts in mind?
peertubed:
wrong rounding for evos
like if you have 5.99 and you need 6 to evolve
then it displays 6.0, but you can't [buy a dragoon]
should round down

With this commit, it now rounds down as it should.

Example test process:

  • /devmap antares
  • join aliens
  • /give funds 1.99
  • look at what's displayed on bottom-right

@illwieckz
Copy link
Member

Oh! Thank-you for fixing something I even haven't reported yet (was like… low on my priority list)! 👍
I confirm the issue, such fix is welcome!

@necessarily-equal
Copy link
Contributor Author

Oh, right, I remember that I wasn't sure about the proper prefix name to give to the new function. Is CG_Rocket_DFCMCanAffordUpgrade appropriate? or is the prefix reserved for functions that will be used directly by librocket?

@illwieckz
Copy link
Member

I don't know! 😅

src/cgame/cg_rocket_dataformatter.cpp Outdated Show resolved Hide resolved
src/cgame/cg_rocket_dataformatter.cpp Outdated Show resolved Hide resolved
@slipher
Copy link
Contributor

slipher commented Dec 29, 2020

Looks good generally.

DF apparently means dataformatter. Not sure about CM, maybe context menu.

@necessarily-equal necessarily-equal force-pushed the take-into-account-sold-items-when-displaying-if-funds-are-sufficient branch from e654787 to cf7f84e Compare December 29, 2020 14:33
@necessarily-equal necessarily-equal changed the base branch from master to 0.52.0/sync December 29, 2020 14:40
@necessarily-equal necessarily-equal force-pushed the take-into-account-sold-items-when-displaying-if-funds-are-sufficient branch from cf7f84e to fe7d0c5 Compare December 29, 2020 14:43
@necessarily-equal
Copy link
Contributor Author

I've simplified it a bit and rebased on 0.52.0/sync. Should be good

Sometimes you have enough money to buy something but first need to sell
what conflicting gear you already have. For example when you want to
replace your heavy armor to put on on a light armor and have 100 credits
in your pocket. The game didn't allow you to buy it and required you to
sell it explicitely first. This commit fixes the annoyance.

Example test process:

* /devmap usstremor
* /give momentum 300
* /give funds 400
* *buy power armor*
* *try to buy anything else without selling your power armor*
note that if you give yourself 1000 credits on the 0.51, you can buy
every update, even conflicting, but you can't do that if you have 400
credits.
@necessarily-equal necessarily-equal force-pushed the take-into-account-sold-items-when-displaying-if-funds-are-sufficient branch from fe7d0c5 to 3b98797 Compare December 29, 2020 15:38
as said on IRC:
afontain:
	do you have some other ui papercuts in mind?
peertubed:
        wrong rounding for evos
        like if you have 5.99 and you need 6 to evolve
        then it displays 6.0, but you can't [buy a dragoon]
        should round down

With this commit, it now rounds down as it should.

Example test process:
 * `/devmap antares`
 * join aliens
 * `/give funds 1.99`
 * look at what's displayed on bottom-right
@necessarily-equal necessarily-equal changed the title Always allow buying upgrade when funds would be sufficient Fix UI papercuts Dec 29, 2020
@necessarily-equal
Copy link
Contributor Author

I've added another commit and updated the description accordingly

@slipher slipher merged commit 6a2a70b into Unvanquished:0.52.0/sync Dec 29, 2020
@necessarily-equal necessarily-equal deleted the take-into-account-sold-items-when-displaying-if-funds-are-sufficient branch January 26, 2021 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants