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

add callback to g_BPInitialBudget and g_BPBudgetPerMiner #1125

Merged
merged 1 commit into from Nov 11, 2019

Conversation

@Gireen
Copy link
Member

Gireen commented Nov 4, 2019

Fix #1124

@slipher

This comment has been minimized.

Copy link
Contributor

slipher commented Nov 5, 2019

Oh, if it's the case that the calculation works fine but just needs to be updated, you could use a cvar callback. You can make a function get called when the value changes. E.g.

Cvar::Callback<Cvar::Cvar<int>> g_lol("g_lol", "description", 0, 50, [](int lol) { Log::Notice("lol = %d", lol); });

Looks like there are 3 obscure features that depend on cvars being in gameCvarTable, but none of them are used by the two BP cvars so it's fine to convert them to new-style (C++ API) cvars.

@Gireen

This comment has been minimized.

Copy link
Member Author

Gireen commented Nov 5, 2019

the callback required more changes but that works really better.

"Initial Budget",
Cvar::SERVERINFO,
DEFAULT_BP_INITIAL_BUDGET,
[](int budget) {

This comment has been minimized.

Copy link
@slipher

slipher Nov 6, 2019

Contributor

Remove the name of the unused variable (so like [](int) {... )

@slipher

This comment has been minimized.

Copy link
Contributor

slipher commented Nov 6, 2019

Please squash the commits into one, remove the unused variable names and LGTM otherwise.

@Gireen Gireen force-pushed the Gireen:updateBPBudgets branch from 3987c7f to be77be2 Nov 6, 2019
@Gireen Gireen force-pushed the Gireen:updateBPBudgets branch from be77be2 to 636a689 Nov 6, 2019
@Gireen Gireen changed the title add updateBPBudgets command for console add callback to g_BPInitialBudget and g_BPBudgetPerMiner Nov 6, 2019
@slipher

This comment has been minimized.

Copy link
Contributor

slipher commented Nov 11, 2019

You can merge it, right?

@Gireen Gireen merged commit 894e95e into Unvanquished:master Nov 11, 2019
1 of 2 checks passed
1 of 2 checks passed
continuous-integration/travis-ci/pr The Travis CI build could not complete due to an error
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
@Gireen Gireen deleted the Gireen:updateBPBudgets branch Nov 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.