Skip to content

Change: rearrange definitions of tree info to remove hardcoded values - #14

Open
PeterN wants to merge 257 commits into
masterfrom
working-tree
Open

Change: rearrange definitions of tree info to remove hardcoded values#14
PeterN wants to merge 257 commits into
masterfrom
working-tree

Conversation

@PeterN

@PeterN PeterN commented Apr 8, 2026

Copy link
Copy Markdown
Owner

Motivation / Problem

Trees are full of magic. Magic sprite numbers, magic climate-based value and magic tropic-zone values.

De-magic them.

Description

Rearrange definitions of tree info to remove hardcoded values
Tree availability is now defined with climates and tropical zone.

Limitations

Checklist for review

Some things are not automated, and forgotten often. This list is a reminder for the reviewers.

  • The bug fix is important enough to be backported? (label: 'backport requested')
  • This PR touches english.txt or translations? Check the guidelines
  • This PR affects the GS/AI API? (label 'needs review: Script API')
    • ai_changelog.hpp, game_changelog.hpp need updating.
    • The compatibility wrappers (compat_*.nut) need updating.
  • This PR affects the NewGRF API? (label 'needs review: NewGRF')

PeterN and others added 29 commits June 14, 2026 15:24
indonesian: 121 changes by q1t0
swedish: 6 changes by joeax910
maori (new zealand): 7 changes by Kyle-McDangersword
Bumps the actions group with 4 updates in the / directory: [actions/upload-artifact](https://github.com/actions/upload-artifact), [actions/download-artifact](https://github.com/actions/download-artifact), [Apple-Actions/import-codesign-certs](https://github.com/apple-actions/import-codesign-certs) and [microsoft/microsoft-store-apppublisher](https://github.com/microsoft/microsoft-store-apppublisher).


Updates `actions/upload-artifact` from 6 to 7
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v6...v7)

Updates `actions/download-artifact` from 6 to 8
- [Release notes](https://github.com/actions/download-artifact/releases)
- [Commits](actions/download-artifact@v6...v8)

Updates `Apple-Actions/import-codesign-certs` from 6 to 7
- [Release notes](https://github.com/apple-actions/import-codesign-certs/releases)
- [Commits](Apple-Actions/import-codesign-certs@v6...v7)

Updates `microsoft/microsoft-store-apppublisher` from 1.1 to 1.3
- [Release notes](https://github.com/microsoft/microsoft-store-apppublisher/releases)
- [Commits](microsoft/microsoft-store-apppublisher@v1.1...v1.3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: actions/download-artifact
  dependency-version: '8'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: Apple-Actions/import-codesign-certs
  dependency-version: '7'
  dependency-type: direct:production
  update-type: version-update:semver-major
  dependency-group: actions
- dependency-name: microsoft/microsoft-store-apppublisher
  dependency-version: '1.3'
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: actions
...

Signed-off-by: dependabot[bot] <support@github.com>
chinese (simplified): 1 change by wensimehrp
korean: 1 change by telk5093
indonesian: 180 changes by q1t0
finnish: 1 change by hpiirai
maori (new zealand): 18 changes by Kyle-McDangersword
indonesian: 17 changes by q1t0
latvian: 7 changes by lexuslatvia
maori (new zealand): 26 changes by Kyle-McDangersword
chinese (traditional): 6 changes by KogentaSan
maori (new zealand): 1 change by Kyle-McDangersword
PeterN and others added 15 commits July 26, 2026 10:16
…er (OpenTTD#15494)

The condition is now "driving backwards at reduced speed".

If a train is able to run at full speed when driving backwards then there is no need to perform manoeuvres to turn around
This allows widgets to return a different size depending on the size that would be used, allowing for more dynamic sizing.
Uses a dynamic widget to switch the buttons between 1 and 2 column layout depending on height, and improves use of space.
)

The most common usage for this function is to convert a DWord from NewGRF into a label.

Now the rare cases, sending over the network and script interaction, requires a std::byteswap.

This reverts commit 9140a7a
…nTTD#15921)

Achieves what f9e6b8b aimed to do, as a read error will replace the current set id, but as it is only replaced at the end, chaining to the same set id works correctly.

Also reduces cognitive complexity.
english (au): 1 change by krysclarke
english (us): 1 change by 2TallTyler
greek: 1 change by gh658804
hungarian: 7 changes by vargaviktor
russian: 1 change by Ln-Wolf
finnish: 1 change by hpiirai
portuguese: 1 change by jcteotonio
portuguese (brazilian): 1 change by pasantoro
polish: 1 change by pAter-exe
Comment thread src/widget.cpp
@@ -1674,6 +1678,12 @@
child_wid->current_y = ComputeMaxSize(child_wid->smallest_y, given_height - child_wid->padding.Vertical(), vert_step);
}

for (const auto &child_wid : this->children) {
auto [pref_x, _] = child_wid->GetPreferredSizeForSize(child_wid->current_x, child_wid->current_y);
Comment thread src/widget.cpp
@@ -1848,6 +1858,12 @@
child_wid->current_x = ComputeMaxSize(child_wid->smallest_x, given_width - child_wid->padding.Horizontal(), hor_step);
}

for (const auto &child_wid : this->children) {
auto [_, pref_y] = child_wid->GetPreferredSizeForSize(child_wid->current_x, child_wid->current_y);
Comment thread src/newgrf/newgrf_act0_trees.cpp Fixed
Comment thread src/newgrf/newgrf_act0_trees.cpp Fixed
Comment thread src/newgrf_trees.cpp
Comment on lines +110 to +111
// assert(industry != nullptr && IsValidTile(tile));
// assert(industry->index == IndustryID::Invalid() || IsTileType(tile, TileType::Industry));
Comment thread src/newgrf_trees.h
uint16_t GetTreeTileCallback(CallbackID callback, uint32_t param1, uint32_t param2, TreeType treetype, TileIndex tile, std::span<int32_t> regs100 = {});
PalSpriteID GetCustomTreeSprite(TileIndex tile, TreeType treetype);
bool GetNewTreeList(const TileInfo *ti, TreeType treetype, uint trees, std::array<TreeListEnt, 4> &te);
// bool DrawNewTrees(const TileInfo *ti, TreeType treetype);
@@ -104,7 +104,7 @@
if (!ScriptEngine::IsBuildable(engine_id)) return -1;
if (!ScriptCargo::IsValidCargo(cargo)) return -1;

auto [res, veh_id, refit_capacity, refit_mail, cargo_capacities] = ::Command<Commands::BuildVehicle>::Do(DoCommandFlag::QueryCost, depot, engine_id, true, cargo, INVALID_CLIENT_ID);
auto [res, veh_id, refit_capacity, refit_mail, cargo_capacities] = ::Command<Commands::BuildVehicle>::Do(DoCommandFlag::QueryCost, depot, engine_id, true, cargo, ClientID::Invalid);
@@ -104,7 +104,7 @@
if (!ScriptEngine::IsBuildable(engine_id)) return -1;
if (!ScriptCargo::IsValidCargo(cargo)) return -1;

auto [res, veh_id, refit_capacity, refit_mail, cargo_capacities] = ::Command<Commands::BuildVehicle>::Do(DoCommandFlag::QueryCost, depot, engine_id, true, cargo, INVALID_CLIENT_ID);
auto [res, veh_id, refit_capacity, refit_mail, cargo_capacities] = ::Command<Commands::BuildVehicle>::Do(DoCommandFlag::QueryCost, depot, engine_id, true, cargo, ClientID::Invalid);
@@ -104,7 +104,7 @@
if (!ScriptEngine::IsBuildable(engine_id)) return -1;
if (!ScriptCargo::IsValidCargo(cargo)) return -1;

auto [res, veh_id, refit_capacity, refit_mail, cargo_capacities] = ::Command<Commands::BuildVehicle>::Do(DoCommandFlag::QueryCost, depot, engine_id, true, cargo, INVALID_CLIENT_ID);
auto [res, veh_id, refit_capacity, refit_mail, cargo_capacities] = ::Command<Commands::BuildVehicle>::Do(DoCommandFlag::QueryCost, depot, engine_id, true, cargo, ClientID::Invalid);
Comment thread src/newgrf/newgrf_act0_trees.cpp Outdated
if (treespec == nullptr) {
treespec = std::make_unique<TreeTileInfo>(GetOriginalTreeTileInfo()[subs_id]);

// treespec->enabled = true;
Comment thread src/newgrf/newgrf_act0_trees.cpp Outdated
Comment on lines +60 to +61
// treespec->anim_production = INDUSTRYTILE_NOANIM;
// treespec->anim_next = INDUSTRYTILE_NOANIM;
@PeterN
PeterN force-pushed the working-tree branch 2 times, most recently from 05a7b23 to 3fd1f5b Compare July 28, 2026 19:43
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.