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.


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);
Copy link
Member

Choose a reason for hiding this comment

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

Why use 0 instead of INVALID_TILE ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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

Copy link
Member

Choose a reason for hiding this comment

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

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

Copy link
Member

@LordAro LordAro left a comment

Choose a reason for hiding this comment

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

LGTM

@TrueBrain TrueBrain merged commit 4b42ecb into OpenTTD:master Jan 22, 2021
@ldpl ldpl deleted the gs-money-tile branch September 19, 2021 20:01
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.

None yet

3 participants