The International Simutrans Forum

Development => Patches & Projects => Incorporated Patches and Solved Bug Reports => Topic started by: HDomos on June 18, 2013, 01:33:05 PM

Title: Bi-level factories and attractions
Post by: HDomos on June 18, 2013, 01:33:05 PM
(https://lh5.googleusercontent.com/-8wHE2oKRsNw/UcBgoLD4JEI/AAAAAAAAL8o/zyl-DkSjuv4/s800/simscr12.jpg)
In the latest nightly, the factories and attractions that are bigger then 1x1 tile are often split to several heigths, see the french park and the garbage dump in picture. In my game these are quite frequent...
Title: Re: Bi-level factories and attractions
Post by: kierongreen on June 18, 2013, 02:48:04 PM
Confirmed: single and double height paks buildings next to water don't have foundations restored correctly after loading under some circumstances. Will investigate more later.
Title: Re: Bi-level factories and attractions
Post by: Ters on June 18, 2013, 04:22:53 PM
Not again. My current map is still bearing the scars from the last time something like this happened (it wasn't restricted to water that time).
Title: Re: Bi-level factories and attractions
Post by: kierongreen on June 18, 2013, 05:09:16 PM
Looks like a similar issue to elevated ways disappearing over water. This seems to fix it for me:

Index: boden/grund.cc
===================================================================
--- boden/grund.cc    (revision 6554)
+++ boden/grund.cc    (working copy)
@@ -185,7 +185,7 @@
     // water saves its correct height => no need to save grid heights anymore
     sint8 z = welt->lookup_hgt( pos.get_2d() ); // save grid height for water tiles - including partial water tiles
     sint8 z_w = welt->get_water_hgt( pos.get_2d() );
-    if(  (!ist_wasser()  &&  z > z_w)  ||  ist_bruecke()  ||  ist_tunnel()  ||  get_typ() == grund_t::monorailboden  ) {
+    if(  (!ist_wasser()  &&  z > z_w)  ||  ist_bruecke()  ||  ist_tunnel() || get_typ() == grund_t::fundament ||  get_typ() == grund_t::monorailboden  ) {
         z = pos.z; // all other tiles save ground height
     }
Title: Re: Bi-level factories and attractions
Post by: Ters on June 18, 2013, 05:31:35 PM
The expression in this if is now so long that I start to wonder which cases are left when it is supposed to be false.
Title: Re: Bi-level factories and attractions
Post by: kierongreen on June 18, 2013, 05:42:17 PM
I had the same thought I have to say....

The reason behind all this is to ensure the height grid is saved correctly. Before I added this you got strange effects around lakes when you raised and lowered water. Something which *should* have the same effect would be:

if(  !(get_typ() == grund_t::boden || get_typ() == grund_t::wasser) ||  z > z_w  )


Edit:
Testing this quickly seems to work and it is much shorter, hopefully it doesn't cause problems elsewhere :)
Title: Re: Bi-level factories and attractions
Post by: greenling on June 18, 2013, 05:50:02 PM
Hello
i think that on those problem, a too old pakset can have a part.
Title: Re: Bi-level factories and attractions
Post by: Ters on June 18, 2013, 06:45:49 PM
Quote from: greenling on June 18, 2013, 05:50:02 PM
Hello
i think that on those problem, a too old pakset can have a part.


I seriously doubt it. There might be a different bug somewhere that looks the same, but not all that has wings are birds.
Title: Re: Bi-level factories and attractions
Post by: HDomos on June 18, 2013, 07:17:32 PM
My too old pakset is one day old :D compiled from the latest trunk
Title: Re: Bi-level factories and attractions
Post by: greenling on June 18, 2013, 08:01:47 PM
hello HDomos
Have you use the data from http://simutrans.svn.sourceforge.net/, http://sourceforge.net/p/simutrans/code/1217/
or https://github.com/simutrans/pak128 to make your paksetwith makeobj 55-2?
Title: Re: Bi-level factories and attractions
Post by: kierongreen on June 27, 2013, 06:54:36 AM
Incorporated into trunk as of r6560 (thanks turfit :) )