Skip to content

National stockpile: place orders on market #444

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

Open
wvpm opened this issue Jun 5, 2025 · 0 comments
Open

National stockpile: place orders on market #444

wvpm opened this issue Jun 5, 2025 · 0 comments
Labels
enhancement New feature or request good first issue Good for newcomers topic:economy
Milestone

Comments

@wvpm
Copy link
Contributor

wvpm commented Jun 5, 2025

In the national stockpile a player can manually set a desired maximum (if buying) or minimum (if selling) quantity.
This can be set in the trade screen (picture below).
Image

When selling, every tick the country should sell any amount that exceeds the minimum amount.
This is done by placing a MarketSellOrder with quantity set to current stockpiled quantity minus minimum quantity.
The revenue from the sale must go into the cash_stockpile and must be stored in a new fixed_point_t PROPERTY (named something like national_stockpile_balance). Any unsold amount must be returned to the stockpile.

When buying, every tick the country should project the expenses. The projected expenses may be cut if there isn't enough budget.
Currently it's not clear whether national stockpile is cut first or only after other expenses are cut, see also https://discord.com/channels/1063392556160909312/1105422859641290803/1358814641790255134 .

After the possible budget cuts are taken into account, a BuyUpToOrder must be placed with max_quantity being the desired maximum quantity minus the current stockpiled quantity and the money_to_spend being the max_quantity * max_next_price (unless restricted by budget cuts).

Note automated goods are outside the scope of this task.

@wvpm wvpm added enhancement New feature or request good first issue Good for newcomers topic:economy labels Jun 5, 2025
@wvpm wvpm added this to the 0.9.0 milestone Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers topic:economy
Projects
None yet
Development

No branches or pull requests

1 participant