Skip to content

Commit

Permalink
FIX: keep current tile's climate on lower/raise if climate mode is hu…
Browse files Browse the repository at this point in the history
…midity based

git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11424 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
prissi committed Oct 26, 2024
1 parent 8be42e7 commit 5c9fc67
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions simutrans/history.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
ADD: pipette tool (started by ceeac, extended to copy and check for more objects)
FIX: convoi length bar not so long to need immediately a scrollbar
ADD: manually increase tool icon size in display settings window
FIX: keep current tile's climate on lower/raise if climate mode is humidity based


Release of 124.2.2 (r11400 on 2-Sep-2024):
Expand Down
19 changes: 14 additions & 5 deletions src/simutrans/world/terraformer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,8 @@ int terraformer_t::raise_to(const node_t &node)
assert(false);
}

bool recalc_climate = gr-> is_water() || welt->get_settings().get_climate_generator() == settings_t::HEIGHT_BASED;

// change height and slope, for water tiles only if they will become land
if( !gr->is_water() || (hmaxneu > water_hgt || (hneu == water_hgt && hmaxneu == water_hgt) ) ) {
gr->set_pos( koord3d( node.x, node.y, disp_hneu ) );
Expand All @@ -401,7 +403,9 @@ int terraformer_t::raise_to(const node_t &node)

// update north point in grid
welt->set_grid_hgt_nocheck(node.x, node.y, hn_nw);
welt->calc_climate(koord(node.x,node.y), true);
if (recalc_climate) {
welt->calc_climate(koord(node.x, node.y), true);
}

if ( node.x+1 == welt->get_size().x ) {
// update eastern grid coordinates too if we are in the edge.
Expand Down Expand Up @@ -535,6 +539,8 @@ int terraformer_t::lower_to(const node_t &node)
const sint8 disp_hn_nw = max( hn_nw, water_hgt );
const slope_t::type sneu = encode_corners(disp_hn_sw - disp_hneu, disp_hn_se - disp_hneu, disp_hn_ne - disp_hneu, disp_hn_nw - disp_hneu);

bool recalc_climate = welt->get_settings().get_climate_generator() == settings_t::HEIGHT_BASED;

// change height and slope for land tiles only
if( !gr->is_water() || (hmaxneu > water_hgt) ) {
gr->set_pos( koord3d( node.x, node.y, disp_hneu ) );
Expand Down Expand Up @@ -574,14 +580,17 @@ int terraformer_t::lower_to(const node_t &node)

welt->set_water_hgt_nocheck( neighbour, hneu );
welt->access_nocheck(neighbour)->correct_water();
recalc_climate = true;
}
}
}

welt->calc_climate( koord( node.x, node.y ), false );
for( sint16 i = 0; i < 8; i++ ) {
const koord neighbour = koord( node.x, node.y ) + koord::neighbours[i];
welt->calc_climate( neighbour, false );
if (recalc_climate) {
welt->calc_climate( koord( node.x, node.y ), false );
for( sint16 i = 0; i < 8; i++ ) {
const koord neighbour = koord( node.x, node.y ) + koord::neighbours[i];
welt->calc_climate( neighbour, false );
}
}

// recalc landscape images - need to extend 2 in each direction
Expand Down

0 comments on commit 5c9fc67

Please sign in to comment.