Skip to content

Commit

Permalink
FIX do not replace wayobj with the same wayobj
Browse files Browse the repository at this point in the history
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@8212 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
Dwachs committed Apr 18, 2017
1 parent 9995253 commit e7db1a4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion obj/wayobj.cc
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ void wayobj_t::extend_wayobj(koord3d pos, player_t *owner, ribi_t::ribi dir, con
if(gr) {
wayobj_t *existing_wayobj = gr->get_wayobj( desc->get_wtyp() );
if( existing_wayobj ) {
if( ( existing_wayobj->get_desc()->get_topspeed() < desc->get_topspeed() || !keep_existing_faster_way) && player_t::check_owner(owner, existing_wayobj->get_owner()) ) {
if( ( existing_wayobj->get_desc()->get_topspeed() < desc->get_topspeed() || !keep_existing_faster_way) && player_t::check_owner(owner, existing_wayobj->get_owner())
&& existing_wayobj->get_desc() != desc )
{
// replace slower by faster if desired
dir = dir | existing_wayobj->get_dir();
gr->set_flag(grund_t::dirty);
Expand Down
2 changes: 1 addition & 1 deletion simtool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3387,7 +3387,7 @@ void tool_build_wayobj_t::mark_tiles( player_t* player, const koord3d &start, co
if( wayobj ) {
show = show | wayobj->get_dir();
// Already a catenary here -> costs only, if new catenary is faster
if( wayobj->get_desc()->get_topspeed() >= desc->get_topspeed() && keep_existing_faster_ways) {
if( (wayobj->get_desc()->get_topspeed() >= desc->get_topspeed() && keep_existing_faster_ways) || wayobj->get_desc() == desc ) {
cost_estimate -= desc->get_price();
}
}
Expand Down

0 comments on commit e7db1a4

Please sign in to comment.