1
0
Fork 0

(svn r7068) if () cascades -> switch ()

release/0.5
tron 2006-11-05 12:22:46 +00:00
parent f9fa8437eb
commit a763e7e52e
1 changed files with 141 additions and 124 deletions

View File

@ -768,19 +768,21 @@ static void ViewportAddTownNames(DrawPixelInfo *dpi)
right = left + dpi->width;
bottom = top + dpi->height;
if (dpi->zoom < 1) {
switch (dpi->zoom) {
case 0:
FOR_ALL_TOWNS(t) {
if (bottom > t->sign.top &&
top < t->sign.top + 12 &&
right > t->sign.left &&
left < t->sign.left + t->sign.width_1) {
AddStringToDraw(t->sign.left + 1, t->sign.top + 1,
_patches.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
t->index, t->population);
}
}
} else if (dpi->zoom == 1) {
break;
case 1:
right += 2;
bottom += 2;
@ -789,27 +791,28 @@ static void ViewportAddTownNames(DrawPixelInfo *dpi)
top < t->sign.top + 24 &&
right > t->sign.left &&
left < t->sign.left + t->sign.width_1*2) {
AddStringToDraw(t->sign.left + 1, t->sign.top + 1,
_patches.population_in_label ? STR_TOWN_LABEL_POP : STR_TOWN_LABEL,
t->index, t->population);
}
}
} else {
break;
default: NOT_REACHED();
case 2:
right += 4;
bottom += 5;
assert(dpi->zoom == 2);
FOR_ALL_TOWNS(t) {
if (bottom > t->sign.top &&
top < t->sign.top + 24 &&
right > t->sign.left &&
left < t->sign.left + t->sign.width_2*4) {
AddStringToDraw(t->sign.left + 5, t->sign.top + 1, STR_TOWN_LABEL_TINY_BLACK, t->index, 0);
AddStringToDraw(t->sign.left + 1, t->sign.top - 3, STR_TOWN_LABEL_TINY_WHITE, t->index, 0);
}
}
break;
}
}
@ -839,7 +842,8 @@ static void ViewportAddStationNames(DrawPixelInfo *dpi)
right = left + dpi->width;
bottom = top + dpi->height;
if (dpi->zoom < 1) {
switch (dpi->zoom) {
case 0:
FOR_ALL_STATIONS(st) {
if (bottom > st->sign.top &&
top < st->sign.top + 12 &&
@ -848,10 +852,11 @@ static void ViewportAddStationNames(DrawPixelInfo *dpi)
AddStation(st, STR_305C_0, st->sign.width_1);
}
}
} else if (dpi->zoom == 1) {
break;
case 1:
right += 2;
bottom += 2;
FOR_ALL_STATIONS(st) {
if (bottom > st->sign.top &&
top < st->sign.top + 24 &&
@ -860,13 +865,12 @@ static void ViewportAddStationNames(DrawPixelInfo *dpi)
AddStation(st, STR_305C_0, st->sign.width_1);
}
}
break;
} else {
assert(dpi->zoom == 2);
default: NOT_REACHED();
case 2:
right += 4;
bottom += 5;
FOR_ALL_STATIONS(st) {
if (bottom > st->sign.top &&
top < st->sign.top + 24 &&
@ -875,6 +879,7 @@ static void ViewportAddStationNames(DrawPixelInfo *dpi)
AddStation(st, STR_STATION_SIGN_TINY, st->sign.width_2 | 0x8000);
}
}
break;
}
}
@ -904,7 +909,8 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
right = left + dpi->width;
bottom = top + dpi->height;
if (dpi->zoom < 1) {
switch (dpi->zoom) {
case 0:
FOR_ALL_SIGNS(si) {
if (bottom > si->sign.top &&
top < si->sign.top + 12 &&
@ -913,7 +919,9 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
AddSign(si, STR_2806, si->sign.width_1);
}
}
} else if (dpi->zoom == 1) {
break;
case 1:
right += 2;
bottom += 2;
FOR_ALL_SIGNS(si) {
@ -924,10 +932,12 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
AddSign(si, STR_2806, si->sign.width_1);
}
}
} else {
break;
default: NOT_REACHED();
case 2:
right += 4;
bottom += 5;
FOR_ALL_SIGNS(si) {
if (bottom > si->sign.top &&
top < si->sign.top + 24 &&
@ -936,6 +946,7 @@ static void ViewportAddSigns(DrawPixelInfo *dpi)
AddSign(si, STR_2002, si->sign.width_2 | 0x8000);
}
}
break;
}
}
@ -965,7 +976,8 @@ static void ViewportAddWaypoints(DrawPixelInfo *dpi)
right = left + dpi->width;
bottom = top + dpi->height;
if (dpi->zoom < 1) {
switch (dpi->zoom) {
case 0:
FOR_ALL_WAYPOINTS(wp) {
if (bottom > wp->sign.top &&
top < wp->sign.top + 12 &&
@ -974,7 +986,9 @@ static void ViewportAddWaypoints(DrawPixelInfo *dpi)
AddWaypoint(wp, STR_WAYPOINT_VIEWPORT, wp->sign.width_1);
}
}
} else if (dpi->zoom == 1) {
break;
case 1:
right += 2;
bottom += 2;
FOR_ALL_WAYPOINTS(wp) {
@ -985,10 +999,12 @@ static void ViewportAddWaypoints(DrawPixelInfo *dpi)
AddWaypoint(wp, STR_WAYPOINT_VIEWPORT, wp->sign.width_1);
}
}
} else {
break;
default: NOT_REACHED();
case 2:
right += 4;
bottom += 5;
FOR_ALL_WAYPOINTS(wp) {
if (bottom > wp->sign.top &&
top < wp->sign.top + 24 &&
@ -997,6 +1013,7 @@ static void ViewportAddWaypoints(DrawPixelInfo *dpi)
AddWaypoint(wp, STR_WAYPOINT_VIEWPORT_TINY, wp->sign.width_2 | 0x8000);
}
}
break;
}
}