News:

Want to praise Simutrans?
Your feedback is important for us ;D.

[PATCH] Powerline Tunnels

Started by kierongreen, September 04, 2008, 01:56:40 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

isidoro

Nice work!

By the way, your idea about marking where the factories are underground would be marvelous if extended to the location of stations in sliced mode...


Dorren

Excellent work!  We have been needing this for quite some time.  Is there any chance this patch will find it's way into the Nightly?

Also, i do not have a problem with the build cost, but maybe the maintenance cost is a bit high?  Would something in the 1500-2800 range be more balanced?

kierongreen

Maintenance costs will be something that needs to be considered for each pakset. In pakBritain it looks like 5000 may be too much given this works out in my test game, even for one tile as approximately 10x the likely electricity income from a market.

Dorren

So the pak you posted is for the 128 set.  Did i overlook the 64 version?  Being new i don't trust myself with makeobj lol

Combuijs

Quote from: Dorren on February 28, 2012, 09:37:03 AM
So the pak you posted is for the 128 set.  Did i overlook the 64 version?  Being new i don't trust myself with makeobj lol

Quotesee top of thread for 64 sized image
Bob Marley: No woman, no cry

Programmer: No user, no bugs



Dorren

Quote from: Combuijs on February 28, 2012, 09:50:51 AMsee top of thread for 64 sized image


yes i saw that which is why i made the comment about makeobj.  it is just the images, as it says.  not the pak.

The Transporter

Is it possible to post a compiled version of simutrans, for testing?

kierongreen

My machine is linux so any compiled version would be linux only. Given that on linux many libraries can change I'm not sure how sensible it would be for me to release my own compiled testing version... Of course if anyone can build a testing release from nightly svn they would be more than welcome to do so and release it :)

I have attached a compiled (but not tested!) pak64 version of the powerline tunnels pak. Of course you will need a patched and compiled version of the simutrans executable to use this!

The Transporter

You have build a normal Powerline in the Underground at your Example from Post #66?
The Powerline-tunnel is only for connecting the Underground Line to the Overground Line?
Is a special Underground Powerline possible?

kierongreen

Underground powerlines use the same graphics as surface powerlines, currently at least. Using different graphics would require more code, as this is quite a large patch as it is I would rather it gets into the trunk first (if it ever does) before making it even larger.

To build underground powerlines you build a powerline tunnel on a slope in the same way you would a road or railway tunnel - holding down control will build just one tile rather than digging all the way through a hill. You can then edit the tunnel further by switching to underground mode and using the powertunnel tool, again, in the same way as you would edit a road or rail tunnel.

Dwachs

Quote from: kierongreen on February 29, 2012, 12:38:20 AM
Underground powerlines use the same graphics as surface powerlines, currently at least. Using different graphics would require more code, as this is quite a large patch as it is I would rather it gets into the trunk first (if it ever does) before making it even larger.
Can you elaborate? In the begin of tunnelbauer_t::baue_tunnel there is the code that loads the correct way object that is associated to the tunnel. Then one has to add some lt->set_besch(weg_besch) here and there. This should work ... Or are there more problems ?

Here is a bug report: Build powerline tunnel under factory then try to build transformer on top of powerline tunnel: The transformer is placed below the power line.
Parsley, sage, rosemary, and maggikraut.

kierongreen

QuoteCan you elaborate? In the begin of tunnelbauer_t::baue_tunnel there is the code that loads the correct way object that is associated to the tunnel. Then one has to add some lt->set_besch(weg_besch) here and there. This should work ... Or are there more problems ?
At present tunnels do not support images to be used underground. Therefore I would need to add an additional wegbauer_t::leitung_tunnel_besch to define these images and code to set this from a particular way name (e.g. Name=PowerTunnelInside) I think.

This can be done naturally, but I'm more concerned about getting core functionality working, smaller patches like this can be made after...

QuoteHere is a bug report: Build powerline tunnel under factory then try to build transformer on top of powerline tunnel: The transformer is placed below the power line.
Thank you, revised patch is attached, only change is in simwerkz.cc, wkz_transformer_t::work at line 1379:
-      if(!fab) {
+      if(!fab || gr->get_pos().z!=k.z ) {

Fabio

Kieron, lately tunnels support a way=xxx parameter, where xxx is a way of same type.
You could ensure that multiple ways of waytype=power are possible and this parameter is read for power tunnels to, then it would be all matter of pakset choices.

kierongreen

Ok, this has been one week now; are there are changes that are required before this can be included in trunk, or is this being denied (in which case topic should be moved to appropriate board!).

Dwachs

Here is an updated version. I did some cleanup: replace dynamic_casts by gr->find<leitung>, powerline tunnel uses way parameter to get way images (as Fabio said).

I have another question: why are there these mark-dirty loops, when transformer is build / removed?

This patch is ready for inclusion imho.

Parsley, sage, rosemary, and maggikraut.

kierongreen

Thank you. Dirty loops are because when the power state of a factory changes (either due to production changes or a transformer being built) the colour of the overlay tiles needs to change.

Dwachs

Patch updated: reworked the transformer tool to allow building transformers also in sliced underground view and to reduce code duplication. The overlay is now drawn always with dirty=true, no need to make these mark-dirty-loops.

There is one thing though: powerlines can connect through vertical walls to powerline tunnels. Intended? Imho this possibility should be removed.

Edit: Powerline tunnel take their images from the way pak indicated in the "way" parameter in the tunnel dat decription.

Parsley, sage, rosemary, and maggikraut.

kierongreen

Thanks :) Yes I'm aware of the vertical slope tunnel connection. My feeling was to leave it in as it does no harm...

prissi

Personally I would still like to have a parameter to forbid transformer underground for pak sets to disallow supply of oil rigs and fish swarms; but on newer version I can of course forbid those indsutries to increase with power also.

ANd the vertical connection through a wall is imho an error.

kierongreen

I suspect that unless they are in shallow water transformers will not connect to water industries...

kierongreen

#90
Revised patch for svn5547. Addresses concerns over transformers being built under water and power lines connecting through vertical slopes. Also fixes problem with existing simutrans code where power lines would similarly connect to power line bridges if at same height.

Changes:
dings/leitung2.cc:54
-            if(  lt  ) {
+            if(  lt  &&  (gr->ist_karten_boden()==gr_base->ist_karten_boden() || (gr->ist_tunnel()==gr_base->ist_tunnel() && gr->ist_bruecke()==gr_base->ist_bruecke()))  ) {

simwerkz.cc - in wkz_transformer_t::work
...
    // underground: first build tunnel tile    at coordinate k
    if(underground) {
+        if(gr->ist_wasser()) {
+             return "Transformer only next to factory!";
+        }
+
         if(welt->lookup(k)) {
             return "Tile not empty.";
          }
....

Edit: this is based on Dwachs 5528 patch

prissi

Ok, finally incorporated with an additional setting:
Using allow_undergroud_transformers=0 in simuconft.tab the usage of underground transformer can be disallowed (but default is allowing).

kierongreen


The Transporter

 :D :D Many,many Thanks to all!!!


Is it possible to create a own undergound Grafic for the Tunnel?
Currently it uses the normal Overground Grafic, and this looks not perfect in the Underground.

greenling

Does the power supply line tunnel possibly already function? :o
Opening hours 20:00 - 23:00
(In Night from friday on saturday and saturday on sunday it possibly that i be keep longer in Forum.)
I am The Assistant from Pakfilearcheologist!
Working on a big Problem!

kierongreen

It is supported in nightly builds yes. However it will now need to be added to paksets which involves adding an entry to menuconf.tab as well as adding a powerline tunnel pak.

greenling

kierongreen
i will be test so soon!
Opening hours 20:00 - 23:00
(In Night from friday on saturday and saturday on sunday it possibly that i be keep longer in Forum.)
I am The Assistant from Pakfilearcheologist!
Working on a big Problem!

Dwachs

Quote from: The Transporter on May 15, 2012, 03:50:07 PM
Is it possible to create a own undergound Grafic for the Tunnel?
yes, just like for all other types of tunnels.
Parsley, sage, rosemary, and maggikraut.

Dwachs

Quote from: kierongreen on March 11, 2012, 01:03:37 PM
... Also fixes problem with existing simutrans code where power lines would similarly connect to power line bridges if at same height.
This change broke powerline bridges to vertical slopes (ie bridges ending on vertical slope). Not sure how to fix this...
Parsley, sage, rosemary, and maggikraut.

kierongreen

Ouch hadn't considered that... Well a couple of options, 1) just revert this change, as I only changed it due to correcting problem with connections to tunnels, or 2) implement ribis for leitung, possibly making more mergers with the rest of the weg code in the proccess.

Dwachs

I tried to repair it in r5764.
Parsley, sage, rosemary, and maggikraut.

kierongreen