投稿者 トピック: 高架建設時1つ下のレベルの駅、車庫をチェックしている  (参照数 4010 回)

z9999+

  • 管理人
  • 急行
  • *
  • 投稿: 381
問題点
-駅の上に駅と直角に交差する高架が引けない
-高架上の駅、車庫に不自然に接続できる

修正案

コード: [選択]
Index: bauer/wegbauer.cc
===================================================================
--- bauer/wegbauer.cc (リビジョン 3302)
+++ bauer/wegbauer.cc (作業コピー)
@@ -558,6 +558,8 @@
  bool fundament = to->get_typ()==grund_t::fundament;
  const gebaeude_t* gb = to->find<gebaeude_t>();
 
+// Is this really needed ? Isn't this a duplication of check_building() ?
+#if 1
  // no crossings to halt
  if(to!=from  &&  bautyp!=leitung  &&  (bautyp&elevated_flag)==0) {
  static koord gb_to_zv[4] = { koord::sued, koord::ost, koord::nord, koord::west };
@@ -596,6 +598,7 @@
  }
  }
  }
+#endif
 
  // universal check for elevated things ...
  if(bautyp&elevated_flag) {
@@ -622,6 +625,25 @@
  return false;
  }
  }
+ height = from->get_hoehe()+Z_TILE_STEP;
+ grund_t *from2 = welt->lookup(koord3d(from->get_pos().get_2d(),height));
+ if(from2) {
+ if(from2->get_weg_nr(0)) {
+ // already an elevated ground here => it will has always a way object, that indicates ownership
+ ok = from2->get_typ()==grund_t::monorailboden  &&  check_owner(from2->obj_bei(0)->get_besitzer(),sp);
+ ok &= from2->get_weg_nr(0)->get_besch()->get_wtyp()==besch->get_wtyp();
+ }
+ else {
+ ok = from2->find<leitung_t>()==NULL;
+ }
+ if(!ok) {
+DBG_MESSAGE("wegbauer_t::is_allowed_step()","wrong ground already there!");
+ return false;
+ }
+ if(  !check_building( from2, zv )  ) {
+ return false;
+ }
+ }
  if(gb) {
  // no halt => citybuilding => do not touch
  if(!check_owner(gb->get_besitzer(),sp)  ||  gb->get_tile()->get_hintergrund(0,1,0)!=IMG_LEER) {  // also check for too high buildings ...
@@ -677,7 +699,7 @@
  return false;
  }
  // check for depots/stops/...
- if(  !check_building( from, zv )  ||  !check_building( to, -zv )  ) {
+ if((bautyp&elevated_flag)==0  &&  (!check_building( from, zv )  ||  !check_building( to, -zv ))) {
  return false;
  }
  // calculate costs
@@ -711,7 +733,7 @@
  return false;
  }
  // check for depots/stops/...
- if(  !check_building( from, zv )  ||  !check_building( to, -zv )  ) {
+ if((bautyp&elevated_flag)==0  &&  (!check_building( from, zv )  ||  !check_building( to, -zv ))) {
  return false;
  }
  // calculate costs
@@ -837,7 +859,7 @@
  // calculate costs
  if(ok) {
  // check for depots/stops/...
- if(  !check_building( from, zv )  ||  !check_building( to, -zv )  ) {
+ if((bautyp&elevated_flag)==0  &&  (!check_building( from, zv )  ||  !check_building( to, -zv ))) {
  return false;
  }
  *costs = to->ist_wasser()  ||  to->hat_weg(water_wt) ? welt->get_einstellungen()->way_count_straight : welt->get_einstellungen()->way_count_leaving_road; // prefer water very much ...


#if 1 ~ #endif で囲った部分はcheck_building()と重複しているから不要な気がするんですが、あまり自信なし。無理に消す必要もないですし残してあります。

z9999+

  • 管理人
  • 急行
  • *
  • 投稿: 381
上記の問題は最新のナイトリーで修正されましたが、
r3608以降、高架運河が建設できないという別の問題が生じているようです。