@@ -3087,12 +3087,12 @@ int stadt_t::orient_city_building(const koord k, const building_desc_t *h, koord
30873087 }
30883088
30893089 sint16 street_counter_ew = 0 ;
3090+ sint16 street_counter_ew_ns = 0 ;
30903091 sint16 roads_ew = 0 ;
30913092 if (fit0) {
3092- // 1 or 3 => east or west => counting along y
30933093 roads_ew++;
3094- sint16 extra_offset = h->get_x (0 );
3095- for (int offset = -1 ; offset <= h->get_y (0 ); offset++) {
3094+ sint16 extra_offset = h->get_x (1 );
3095+ for (int offset = -1 ; offset <= h->get_y (1 ); offset++) {
30963096 gr = welt->lookup_kartenboden (k + koord (extra_offset, offset));
30973097 if (gr && gr->hat_weg (road_wt)) {
30983098 street_counter_ew++; // east
@@ -3105,15 +3105,28 @@ int stadt_t::orient_city_building(const koord k, const building_desc_t *h, koord
31053105 roads_ew++;
31063106 }
31073107 }
3108+ extra_offset = h->get_y (1 );
3109+ for (int offset = 0 ; offset < h->get_x (1 ); offset++) {
3110+ gr = welt->lookup_kartenboden (k + koord (offset, extra_offset));
3111+ if (gr && gr->hat_weg (road_wt)) {
3112+ street_counter_ew_ns++; // south
3113+ roads_ew++;
3114+ }
3115+ gr = welt->lookup_kartenboden (k + koord (offset,-1 ));
3116+ if (gr && gr->hat_weg (road_wt)) {
3117+ street_counter_ew_ns--; // south
3118+ roads_ew++;
3119+ }
3120+ }
31083121 }
31093122
31103123 sint16 street_counter_ns = 0 ;
3124+ sint16 street_counter_ns_ew = 0 ;
31113125 sint16 roads_ns = 0 ;
31123126 if (fit1) {
3113- // 0 or 2 => south or north
31143127 roads_ns++;
3115- sint16 extra_offset = h->get_y (1 );
3116- for (int offset = -1 ; offset <= h->get_x (1 ); offset++) {
3128+ sint16 extra_offset = h->get_y (0 );
3129+ for (int offset = -1 ; offset <= h->get_x (0 ); offset++) {
31173130 gr = welt->lookup_kartenboden (k + koord (offset, extra_offset));
31183131 if (gr && gr->hat_weg (road_wt)) {
31193132 street_counter_ns++; // south
@@ -3125,6 +3138,19 @@ int stadt_t::orient_city_building(const koord k, const building_desc_t *h, koord
31253138 roads_ns++;
31263139 }
31273140 }
3141+ extra_offset = h->get_x (0 );
3142+ for (int offset = 0 ; offset < h->get_y (0 ); offset++) {
3143+ gr = welt->lookup_kartenboden (k + koord (extra_offset, offset));
3144+ if (gr && gr->hat_weg (road_wt)) {
3145+ street_counter_ns_ew++; // south
3146+ roads_ns++;
3147+ }
3148+ gr = welt->lookup_kartenboden (k + koord (-1 ,offset));
3149+ if (gr && gr->hat_weg (road_wt)) {
3150+ street_counter_ns_ew--; // south
3151+ roads_ns++;
3152+ }
3153+ }
31283154 }
31293155
31303156 if (roads_ns > roads_ew) {
@@ -3138,7 +3164,7 @@ int stadt_t::orient_city_building(const koord k, const building_desc_t *h, koord
31383164 else if (roads_ns < roads_ew) {
31393165 // more EW roads
31403166 if (street_counter_ew) {
3141- return RC ((street_counter_ew > 0 ? 1 : 3 ) & max_layout);
3167+ return RC ((street_counter_ew > 0 ? 3 : 1 ) & max_layout);
31423168 }
31433169 return RC ((simrand (2 ) * 2 + 1 ) & max_layout);
31443170 }
@@ -3485,13 +3511,13 @@ void stadt_t::renovate_city_building(gebaeude_t *gb)
34853511 }
34863512 }
34873513
3488- if (h == NULL || exclude_desc. is_contained (h) ) {
3514+ if (h == NULL ) {
34893515 // no matching building found ...
34903516 return ;
34913517 }
34923518
34933519 // only renovate, if there is a change in level
3494- if (h->get_level () <= gb_desc->get_level () && h->get_type () == gb_desc->get_type ()) {
3520+ if (h->get_level () < gb_desc->get_level () && h->get_type () == gb_desc->get_type ()) {
34953521 // same level, no reason to replace
34963522 return ;
34973523 }
0 commit comments