diff --git a/docs/landscape_grid.html b/docs/landscape_grid.html index 553a62b5af..f4b99e6139 100644 --- a/docs/landscape_grid.html +++ b/docs/landscape_grid.html @@ -178,7 +178,7 @@ the array so you can quickly see what is used and what is not. 4 trees OXX1 OOOO - OOOO OOOXXX XX XXXX + OOOO OOOXXX XX OOOO XXXX XXXX OOOO OOOO XXOO OXXX diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index 82fb015457..ad0cccb5c0 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -4098,6 +4098,14 @@ bool AfterLoadGame() } } + if (SlXvIsFeatureMissing(XSLFI_NO_TREE_COUNTER)) { + for (TileIndex t = 0; t < map_size; t++) { + if (IsTileType(t, MP_TREES)) { + ClearOldTreeCounter(t); + } + } + } + InitializeRoadGUI(); /* This needs to be done after conversion. */ diff --git a/src/saveload/extended_ver_sl.cpp b/src/saveload/extended_ver_sl.cpp index d6308a40f6..3b2c0ad12d 100644 --- a/src/saveload/extended_ver_sl.cpp +++ b/src/saveload/extended_ver_sl.cpp @@ -175,6 +175,7 @@ const SlxiSubChunkInfo _sl_xv_sub_chunk_infos[] = { { XSLFI_INDUSTRY_ANIM_MASK, XSCF_IGNORABLE_ALL, 1, 1, "industry_anim_mask", nullptr, nullptr, nullptr }, { XSLFI_NEW_SIGNAL_STYLES, XSCF_NULL, 2, 2, "new_signal_styles", nullptr, nullptr, "XBST,NSID" }, { XSLFI_SCRIPT_INT64, XSCF_NULL, 1, 1, "script_int64", nullptr, nullptr, nullptr }, + { XSLFI_NO_TREE_COUNTER, XSCF_IGNORABLE_ALL, 1, 1, "no_tree_counter", nullptr, nullptr, nullptr }, { XSLFI_NULL, XSCF_NULL, 0, 0, nullptr, nullptr, nullptr, nullptr },// This is the end marker }; diff --git a/src/saveload/extended_ver_sl.h b/src/saveload/extended_ver_sl.h index 9a7fa05deb..ed9fd2f979 100644 --- a/src/saveload/extended_ver_sl.h +++ b/src/saveload/extended_ver_sl.h @@ -127,6 +127,7 @@ enum SlXvFeatureIndex { XSLFI_GRF_ROADSTOPS, ///< NewGRF road stops XSLFI_INDUSTRY_ANIM_MASK, ///< Industry tile animation masking XSLFI_NEW_SIGNAL_STYLES, ///< New signal styles + XSLFI_NO_TREE_COUNTER, ///< No tree counter XSLFI_SCRIPT_INT64, ///< See: SLV_SCRIPT_INT64 diff --git a/src/tree_map.h b/src/tree_map.h index 5d2c34f44e..ca39de8b23 100644 --- a/src/tree_map.h +++ b/src/tree_map.h @@ -215,6 +215,18 @@ static inline void SetTreeGrowth(TileIndex t, uint g) SB(_m[t].m5, 0, 3, g); } +/** + * Clear the old tick counter for a tree-tile + * + * @param t The tile to clear the old tick counter + * @pre Tile must be of type MP_TREES + */ +static inline void ClearOldTreeCounter(TileIndex t) +{ + assert_tile(IsTileType(t, MP_TREES), t); + SB(_m[t].m2, 0, 4, 0); +} + /** * Make a tree-tile. *