Skip to content

Commit 5e7983d

Browse files
committed
Again stronger clustering even on the same level
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@11711 8aca7d54-2c30-db11-9de9-000461428c89
1 parent 9a52fe8 commit 5e7983d

File tree

3 files changed

+38
-12
lines changed

3 files changed

+38
-12
lines changed

Simutrans.sln

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ Global
2121
EndGlobalSection
2222
GlobalSection(ProjectConfigurationPlatforms) = postSolution
2323
{0621B295-BEB7-4767-82F1-F27995610323}.Debug|x64.ActiveCfg = Debug|x64
24+
{0621B295-BEB7-4767-82F1-F27995610323}.Debug|x64.Build.0 = Debug|x64
2425
{0621B295-BEB7-4767-82F1-F27995610323}.Debug|x86.ActiveCfg = Debug|Win32
2526
{0621B295-BEB7-4767-82F1-F27995610323}.Debug|x86.Build.0 = Debug|Win32
2627
{0621B295-BEB7-4767-82F1-F27995610323}.Release|x64.ActiveCfg = Release|x64
@@ -31,7 +32,6 @@ Global
3132
{0621B295-BEB7-4767-82F1-F27995610323}.Stable|x86.ActiveCfg = Stable|Win32
3233
{0621B295-BEB7-4767-82F1-F27995610323}.Stable|x86.Build.0 = Stable|Win32
3334
{E74757E8-C2FD-44AD-87BD-3D55F4709484}.Debug|x64.ActiveCfg = Debug|x64
34-
{E74757E8-C2FD-44AD-87BD-3D55F4709484}.Debug|x64.Build.0 = Debug|x64
3535
{E74757E8-C2FD-44AD-87BD-3D55F4709484}.Debug|x86.ActiveCfg = Debug|Win32
3636
{E74757E8-C2FD-44AD-87BD-3D55F4709484}.Release|x64.ActiveCfg = Release|x64
3737
{E74757E8-C2FD-44AD-87BD-3D55F4709484}.Release|x64.Build.0 = Release|x64

src/simutrans/builder/hausbauer.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,9 @@ bool hausbauer_t::successfully_loaded()
147147
if (desc->get_size().x > 3 || desc->get_size().y > 3) {
148148
dbg->fatal("hausbauer_t::successfully_loaded()", "maximum city building size (3x3) but %s is (%ix%i)", desc->get_name(), desc->get_x(), desc->get_y());
149149
}
150-
if (largest_city_building_area < desc->is_city_building()) {
150+
if (largest_city_building_area < desc->get_area()) {
151151
dbg->message("hausbauer_t::successfully_loaded()", "so far largest city building %s is (%ix%i)", desc->get_name(), desc->get_x(), desc->get_y());
152-
largest_city_building_area = desc->is_city_building();
152+
largest_city_building_area = desc->get_area();
153153
}
154154
}
155155

src/simutrans/world/simcity.cc

Lines changed: 35 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)