summaryrefslogtreecommitdiff
path: root/src/viewport.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-03-15 00:32:18 +0000
committerrubidium <rubidium@openttd.org>2009-03-15 00:32:18 +0000
commitc3e87f345ddd60082d6470f6401a1659094a3011 (patch)
tree776122508c686680b9c97f37ba3cb92ef905d67f /src/viewport.cpp
parent332846e9e28924314443850b4ca646261882cca0 (diff)
downloadopenttd-c3e87f345ddd60082d6470f6401a1659094a3011.tar.xz
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
Diffstat (limited to 'src/viewport.cpp')
-rw-r--r--src/viewport.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/viewport.cpp b/src/viewport.cpp
index 6f37e35be..01dbe2f6b 100644
--- a/src/viewport.cpp
+++ b/src/viewport.cpp
@@ -817,7 +817,7 @@ static bool IsPartOfAutoLine(int px, int py)
}
}
-// [direction][side]
+/* [direction][side] */
static const HighLightStyle _autorail_type[6][2] = {
{ HT_DIR_X, HT_DIR_X },
{ HT_DIR_Y, HT_DIR_Y },
@@ -900,7 +900,7 @@ static void DrawTileSelection(const TileInfo *ti)
}
}
DrawSelectionSprite(_cur_dpi->zoom <= ZOOM_LVL_DETAIL ? SPR_DOT : SPR_DOT_SMALL, PAL_NONE, ti, z, foundation_part);
- } else if (_thd.drawstyle & HT_RAIL /*&& _thd.place_mode == VHM_RAIL*/) {
+ } else if (_thd.drawstyle & HT_RAIL /* && _thd.place_mode == VHM_RAIL*/) {
/* autorail highlight piece under cursor */
uint type = _thd.drawstyle & 0xF;
assert(type <= 5);
@@ -2363,8 +2363,8 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t
switch (style & HT_DRAG_MASK) {
case HT_RECT: {
static const TileIndexDiffC heightdiff_area_by_dir[] = {
- /* Start */ {1, 0}, /* Dragging east */ {0, 0}, /* Dragging south */
- /* End */ {0, 1}, /* Dragging east */ {1, 1} /* Dragging south */
+ /* Start */ {1, 0}, /* Dragging east */ {0, 0}, // Dragging south
+ /* End */ {0, 1}, /* Dragging east */ {1, 1} // Dragging south
};
/* In the case of an area we can determine whether we were dragging south or
@@ -2378,18 +2378,18 @@ static int CalcHeightdiff(HighLightStyle style, uint distance, TileIndex start_t
h0 = TileHeight(start_tile);
h1 = TileHeight(end_tile);
break;
- default: { /* All other types, this is mostly only line/autorail */
+ default: { // All other types, this is mostly only line/autorail
static const HighLightStyle flip_style_direction[] = {
HT_DIR_X, HT_DIR_Y, HT_DIR_HL, HT_DIR_HU, HT_DIR_VR, HT_DIR_VL
};
static const TileIndexDiffC heightdiff_line_by_dir[] = {
- /* Start */ {1, 0}, {1, 1}, /* HT_DIR_X */ {0, 1}, {1, 1}, /* HT_DIR_Y */
- /* Start */ {1, 0}, {0, 0}, /* HT_DIR_HU */ {1, 0}, {1, 1}, /* HT_DIR_HL */
- /* Start */ {1, 0}, {1, 1}, /* HT_DIR_VL */ {0, 1}, {1, 1}, /* HT_DIR_VR */
+ /* Start */ {1, 0}, {1, 1}, /* HT_DIR_X */ {0, 1}, {1, 1}, // HT_DIR_Y
+ /* Start */ {1, 0}, {0, 0}, /* HT_DIR_HU */ {1, 0}, {1, 1}, // HT_DIR_HL
+ /* Start */ {1, 0}, {1, 1}, /* HT_DIR_VL */ {0, 1}, {1, 1}, // HT_DIR_VR
- /* Start */ {0, 1}, {0, 0}, /* HT_DIR_X */ {1, 0}, {0, 0}, /* HT_DIR_Y */
- /* End */ {0, 1}, {0, 0}, /* HT_DIR_HU */ {1, 1}, {0, 1}, /* HT_DIR_HL */
- /* End */ {1, 0}, {0, 0}, /* HT_DIR_VL */ {0, 0}, {0, 1}, /* HT_DIR_VR */
+ /* Start */ {0, 1}, {0, 0}, /* HT_DIR_X */ {1, 0}, {0, 0}, // HT_DIR_Y
+ /* End */ {0, 1}, {0, 0}, /* HT_DIR_HU */ {1, 1}, {0, 1}, // HT_DIR_HL
+ /* End */ {1, 0}, {0, 0}, /* HT_DIR_VL */ {0, 0}, {0, 1}, // HT_DIR_VR
};
distance %= 2; // we're only interested if the distance is even or uneven
@@ -2471,10 +2471,10 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth
thd->selend.x = thd->selend.x & ~0xF;
thd->selend.y = thd->selend.y & ~0xF;
- // four cases.
+ /* four cases. */
if (x > thd->selstart.x) {
if (y > thd->selstart.y) {
- // south
+ /* south */
if (d == 0) {
b = (x & 0xF) > (y & 0xF) ? HT_LINE | HT_DIR_VL : HT_LINE | HT_DIR_VR;
} else if (d >= 0) {
@@ -2486,7 +2486,7 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth
b = HT_LINE | HT_DIR_VR;
} // return px == py || px == py - 16;
} else {
- // west
+ /* west */
if (d == 0) {
b = (x & 0xF) + (y & 0xF) >= 0x10 ? HT_LINE | HT_DIR_HL : HT_LINE | HT_DIR_HU;
} else if (d >= 0) {
@@ -2499,7 +2499,7 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth
}
} else {
if (y > thd->selstart.y) {
- // east
+ /* east */
if (d == 0) {
b = (x & 0xF) + (y & 0xF) >= 0x10 ? HT_LINE | HT_DIR_HL : HT_LINE | HT_DIR_HU;
} else if (d >= 0) {
@@ -2511,7 +2511,7 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth
b = HT_LINE | HT_DIR_HL;
} // return px == -py || px == -py + 16;
} else {
- // north
+ /* north */
if (d == 0) {
b = (x & 0xF) > (y & 0xF) ? HT_LINE | HT_DIR_VL : HT_LINE | HT_DIR_VR;
} else if (d >= 0) {
@@ -2521,7 +2521,7 @@ static void CalcRaildirsDrawstyle(TileHighlightData *thd, int x, int y, int meth
} else {
y = thd->selstart.y - w;
b = HT_LINE | HT_DIR_VL;
- } //return px == py || px == py + 16;
+ } // return px == py || px == py + 16;
}
}
}
@@ -2588,7 +2588,7 @@ void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
sy = _thd.selstart.y;
switch (method) {
- case VPM_X_OR_Y: /* drag in X or Y direction */
+ case VPM_X_OR_Y: // drag in X or Y direction
if (abs(sy - y) < abs(sx - x)) {
y = sy;
style = HT_DIR_X;
@@ -2597,11 +2597,11 @@ void VpSelectTilesWithMethod(int x, int y, ViewportPlaceMethod method)
style = HT_DIR_Y;
}
goto calc_heightdiff_single_direction;
- case VPM_FIX_X: /* drag in Y direction */
+ case VPM_FIX_X: // drag in Y direction
x = sx;
style = HT_DIR_Y;
goto calc_heightdiff_single_direction;
- case VPM_FIX_Y: /* drag in X direction */
+ case VPM_FIX_Y: // drag in X direction
y = sy;
style = HT_DIR_X;
@@ -2628,12 +2628,12 @@ calc_heightdiff_single_direction:;
ShowMeasurementTooltips(measure_strings_length[index], index, params);
} break;
- case VPM_X_AND_Y_LIMITED: { /* drag an X by Y constrained rect area */
+ case VPM_X_AND_Y_LIMITED: { // drag an X by Y constrained rect area
int limit = (_thd.sizelimit - 1) * TILE_SIZE;
x = sx + Clamp(x - sx, -limit, limit);
y = sy + Clamp(y - sy, -limit, limit);
- } /* Fallthrough */
- case VPM_X_AND_Y: { /* drag an X by Y area */
+ } // Fallthrough
+ case VPM_X_AND_Y: { // drag an X by Y area
if (_settings_client.gui.measure_tooltip) {
static const StringID measure_strings_area[] = {
STR_NULL, STR_NULL, STR_MEASURE_AREA, STR_MEASURE_AREA_HEIGHTDIFF