summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharles Pigott <charlespigott@googlemail.com>2020-01-05 23:05:28 +0000
committerCharles Pigott <charlespigott@googlemail.com>2020-01-05 23:31:20 +0000
commit5b52f25902dad09e2f237ce798e9873a4ac42f4f (patch)
tree5aa04865f2cf195e0a9f95f9f3b791dc295c7c38 /src
parent39e6247bec6b958b11c6ab58430a4197eb1deb6a (diff)
downloadopenttd-5b52f25902dad09e2f237ce798e9873a4ac42f4f.tar.xz
Fix e558aa8: Compiler warning about unused value (and move some variable declarations to where they're used)
Diffstat (limited to 'src')
-rw-r--r--src/screenshot.cpp18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/screenshot.cpp b/src/screenshot.cpp
index 4a80a0cbf..17efa9130 100644
--- a/src/screenshot.cpp
+++ b/src/screenshot.cpp
@@ -893,12 +893,8 @@ static Owner GetMinimapOwner(TileIndex tile)
static void MinimapScreenCallback(void *userdata, void *buf, uint y, uint pitch, uint n)
{
- uint32 *ubuf;
- uint num, row, col;
- byte val;
- byte owner_colours[OWNER_END + 1];
-
/* Fill with the company colours */
+ byte owner_colours[OWNER_END + 1];
for (const Company *c : Company::Iterate()) {
owner_colours[c->index] = MKCOLOUR(_colour_gradient[c->colour][5]);
}
@@ -910,15 +906,15 @@ static void MinimapScreenCallback(void *userdata, void *buf, uint y, uint pitch,
owner_colours[OWNER_DEITY] = PC_DARK_GREY; // industry
owner_colours[OWNER_END] = PC_BLACK;
- ubuf = (uint32 *)buf;
- num = (pitch * n);
+ uint32 *ubuf = (uint32 *)buf;
+ uint num = (pitch * n);
for (uint i = 0; i < num; i++) {
- row = y + (int)(i / pitch);
- col = (MapSizeX() - 1) - (i % pitch);
+ uint row = y + (int)(i / pitch);
+ uint col = (MapSizeX() - 1) - (i % pitch);
TileIndex tile = TileXY(col, row);
Owner o = GetMinimapOwner(tile);
- val = owner_colours[o];
+ byte val = owner_colours[o];
uint32 colour_buf = 0;
colour_buf = (_cur_palette.palette[val].b << 0);
@@ -926,7 +922,7 @@ static void MinimapScreenCallback(void *userdata, void *buf, uint y, uint pitch,
colour_buf |= (_cur_palette.palette[val].r << 16);
*ubuf = colour_buf;
- *ubuf++; // Skip alpha
+ ubuf++; // Skip alpha
}
}