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 tile parameter for GSCompany.ChangeBankBalance to show text effect if needed #8573

Merged
merged 1 commit into from Jan 22, 2021

Conversation

@ldpl
Copy link
Contributor

@ldpl ldpl commented Jan 14, 2021

Add an extra tile parameter to GSCompany.ChangeBankBalance that if set to a valid tile triggers an income/cost text effect. Can be used to better communicate balance changes to a player when they can be related to a certain location. E.g. fees for using road of other company or passing a toll booth.
Screenshot from 2021-01-14 22-39-54

GS for testing: money-spring.zip

Checklist for review

  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, gs_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
@ldpl ldpl force-pushed the ldpl:gs-money-tile branch from c79b917 to bfae882 Jan 14, 2021

company = ResolveCompanyID(company);
EnforcePrecondition(false, company != COMPANY_INVALID);

return ScriptObject::DoCommand(0, (uint32)(delta), company | expenses_type << 8 , CMD_CHANGE_BANK_BALANCE);
return ScriptObject::DoCommand(tile == INVALID_TILE ? 0 : tile , (uint32)(delta), company | expenses_type << 8 , CMD_CHANGE_BANK_BALANCE);

This comment has been minimized.

@LordAro

LordAro Jan 16, 2021
Member

Why use 0 instead of INVALID_TILE ?

This comment has been minimized.

@ldpl

ldpl Jan 16, 2021
Author Contributor

In network commands 0 stands for invalid tile. If you pass INVALID_TILE there it will just ignore the command.

This comment has been minimized.

@LordAro

LordAro Jan 18, 2021
Member

Can we have a comment stating as such? It's not clear :)

…ext effect if needed
@ldpl ldpl force-pushed the ldpl:gs-money-tile branch from bfae882 to 80afef2 Jan 18, 2021
Copy link
Member

@LordAro LordAro left a comment

LGTM

@TrueBrain TrueBrain merged commit 4b42ecb into OpenTTD:master Jan 22, 2021
8 checks passed
8 checks passed
Emscripten
Details
Commit checker
Details
Check preview needs update Check preview needs update
Details
Linux (clang, clang++)
Details
Linux (gcc, g++)
Details
Mac OS (x64, x86_64)
Details
Windows (x86)
Details
Windows (x64)
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants