Author Topic: In what method is road replacing written?  (Read 744 times)

0 Members and 1 Guest are viewing this topic.

Online THLeaderH

In what method is road replacing written?
« on: July 16, 2017, 03:57:55 PM »
Roads in a city district are automatically replaced by cityroads under certain conditions. In what method is this replacement process written?

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2591
  • Total likes: 288
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: In what method is road replacing written?
« Reply #1 on: July 16, 2017, 04:53:04 PM »
If I'm not mistaken it's either in wegbauer or simcity. Perhaps in weg

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4632
  • Total likes: 168
  • Helpful: 107
  • Languages: EN, NO
Re: In what method is road replacing written?
« Reply #2 on: July 16, 2017, 05:07:10 PM »
As far as I can tell, city road construction takes place when buildings are built. Several classes are likely involved.

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4201
  • Total likes: 157
  • Helpful: 148
  • Languages: EN, DE, AT
Re: In what method is road replacing written?
« Reply #3 on: July 16, 2017, 05:54:08 PM »
simcity.cc, stadt_t::build_road
Parsley, sage, rosemary, and maggikraut.

Offline DrSuperGood

Re: In what method is road replacing written?
« Reply #4 on: July 16, 2017, 07:22:07 PM »
Quote
Roads in a city district are automatically replaced by cityroads under certain conditions. In what method is this replacement process written?
They are not automatically replaced. What happens is that every time a city building is built or upgraded it replaces the surrounding road ways, that are not under a depot, with null owned (not public owned, null as in no player) roads of the current (the new) city road type. This upgrades existing city roads, as well as converts private roads to city roads.

It is very well possible that some roads may never upgrade because a city cannot ever build or upgrade anything around them.

Online THLeaderH

Re: In what method is road replacing written?
« Reply #5 on: July 17, 2017, 02:46:02 AM »
Thank you for your advices, everyone 8)
I found this part of code in stadt_t::build_road(). It's simcity.cc::L3318~L3325
Code: [Select]
if (!bd->weg_erweitern(road_wt, connection_roads)) {
strasse_t* weg = new strasse_t();
// Hajo: city roads should not belong to any player => so we can ignore any construction costs ...
weg->set_desc(welt->get_city_road());
weg->set_gehweg(true);
bd->neuen_weg_bauen(weg, connection_roads, player_);
bd->calc_image(); // otherwise the
}
It seems that this part of code only builds new way. Where is replacement taken? Or does this code also do replacement?

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4201
  • Total likes: 157
  • Helpful: 148
  • Languages: EN, DE, AT
Re: In what method is road replacing written?
« Reply #6 on: July 17, 2017, 05:58:19 AM »
replacement is done here: bool process_city_street(grund_t& gr, const way_desc_t* cr)
Parsley, sage, rosemary, and maggikraut.

Online THLeaderH

Re: In what method is road replacing written?
« Reply #7 on: July 17, 2017, 06:01:37 AM »
I got it. Thank you.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8725
  • Total likes: 303
  • Helpful: 228
  • Languages: De,EN,JP
Re: In what method is road replacing written?
« Reply #8 on: July 18, 2017, 05:18:59 AM »
But with a wayobj making overtaking roads, you do not have to worry, as it will not be touched.

EDIT: I think a road with a wayobj should not be touched at all, and should have no automatic connection either. That would allow to put guardrails/noise fences etc. next to a road and have an inner city highway - a long requested feature.
« Last Edit: July 19, 2017, 12:44:21 PM by prissi »

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2591
  • Total likes: 288
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: In what method is road replacing written?
« Reply #9 on: July 19, 2017, 03:29:50 PM »
I believe THLeaderH will start using my patch that affects the roads itself rather than use wayobjs. I already posted my GitHub link so it can be integrated to the overtaking patch.

Online THLeaderH

Re: In what method is road replacing written?
« Reply #10 on: July 20, 2017, 01:58:08 AM »
Quote
I believe THLeaderH will start using my patch that affects the roads itself rather than use wayobjs. I already posted my GitHub link so it can be integrated to the overtaking patch.
I decided to use a window like this rather than use a tool bar. I already finished implementation and it will be released with the next version, v11.

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2591
  • Total likes: 288
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: In what method is road replacing written?
« Reply #11 on: July 20, 2017, 02:29:39 AM »
Ok, I'll focus on the graphics, I still need to create the global object.

Online THLeaderH

Re: In what method is road replacing written?
« Reply #12 on: July 20, 2017, 06:47:56 AM »
Quote
EDIT: I think a road with a wayobj should not be touched at all, and should have no automatic connection either. That would allow to put guardrails/noise fences etc. next to a road and have an inner city highway - a long requested feature.
I think this should be implemented immediately.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4632
  • Total likes: 168
  • Helpful: 107
  • Languages: EN, NO
Re: In what method is road replacing written?
« Reply #13 on: July 20, 2017, 02:15:00 PM »
EDIT: I think a road with a wayobj should not be touched at all, and should have no automatic connection either. That would allow to put guardrails/noise fences etc. next to a road and have an inner city highway - a long requested feature.

I find that a bit too strict. Streets with electrification should be upgraded, and maybe even be allowed to grow new junctions, especially since regular players don't have the tools to upgrade city roads. They can upgrade, but then the sidewalk (and speed restriction) disappears. Maybe have some flags for this, like autoconnect in the other recent wayobj discussion?