widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #02268
[Merge] lp:~widelands-dev/widelands/bug-1330599 into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1330599 into lp:widelands.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1330599 in widelands: "Forbid SDL integer types in codecheck and remove its use"
https://bugs.launchpad.net/widelands/+bug/1330599
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1330599/+merge/226607
Removed SDL integer data types. Somebody please double-check the new codecheck rule; I have not been able to run the codecheck target at all.
--
https://code.launchpad.net/~widelands-dev/widelands/bug-1330599/+merge/226607
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1330599 into lp:widelands.
=== added file 'cmake/codecheck/rules/do_not_use_SDL_int'
--- cmake/codecheck/rules/do_not_use_SDL_int 1970-01-01 00:00:00 +0000
+++ cmake/codecheck/rules/do_not_use_SDL_int 2014-07-13 14:48:31 +0000
@@ -0,0 +1,19 @@
+#!/usr/bin/python
+
+"""
+Prefer DEBUG.
+"""
+
+error_msg="Do not use SDL integer data types (Uint8, Sint32 etc.). Instead use C++11 stdint.h types (uint8_t, int32_t etc.)."
+
+regexp=r"""(^Uint[0-9]|Sint[0-9])"""
+
+forbidden = [
+ "Uint8",
+ "Sint32"
+]
+
+allowed = [
+ "uint8_t",
+ "int32_t"
+]
=== modified file 'src/editor/editorinteractive.cc'
--- src/editor/editorinteractive.cc 2014-07-05 13:14:42 +0000
+++ src/editor/editorinteractive.cc 2014-07-13 14:48:31 +0000
@@ -280,14 +280,14 @@
set_need_save(true);
}
-bool Editor_Interactive::handle_mouserelease(Uint8 btn, int32_t x, int32_t y) {
+bool Editor_Interactive::handle_mouserelease(uint8_t btn, int32_t x, int32_t y) {
if (btn == SDL_BUTTON_LEFT) {
m_left_mouse_button_is_down = false;
}
return Interactive_Base::handle_mouserelease(btn, x, y);
}
-bool Editor_Interactive::handle_mousepress(Uint8 btn, int32_t x, int32_t y) {
+bool Editor_Interactive::handle_mousepress(uint8_t btn, int32_t x, int32_t y) {
if (btn == SDL_BUTTON_LEFT) {
m_left_mouse_button_is_down = true;
}
=== modified file 'src/editor/editorinteractive.h'
--- src/editor/editorinteractive.h 2014-07-05 16:41:51 +0000
+++ src/editor/editorinteractive.h 2014-07-13 14:48:31 +0000
@@ -67,8 +67,8 @@
// Handle UI elements.
bool handle_key(bool down, SDL_keysym) override;
- bool handle_mousepress(Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
struct Tools {
Tools()
=== modified file 'src/graphic/color.cc'
--- src/graphic/color.cc 2014-07-05 14:39:48 +0000
+++ src/graphic/color.cc 2014-07-13 14:48:31 +0000
@@ -25,11 +25,11 @@
RGBColor::RGBColor(uint8_t const R, uint8_t const G, uint8_t const B) :
r(R), g(G), b(B) {}
-Uint32 RGBColor::map(const SDL_PixelFormat& fmt) const {
+uint32_t RGBColor::map(const SDL_PixelFormat& fmt) const {
return SDL_MapRGB(&const_cast<SDL_PixelFormat&>(fmt), r, g, b);
}
-void RGBColor::set(SDL_PixelFormat* const fmt, Uint32 const clr) {
+void RGBColor::set(SDL_PixelFormat* const fmt, uint32_t const clr) {
SDL_GetRGB(clr, fmt, &r, &g, &b);
}
=== modified file 'src/graphic/colormap.cc'
--- src/graphic/colormap.cc 2013-09-23 20:30:35 +0000
+++ src/graphic/colormap.cc 2014-07-13 14:48:31 +0000
@@ -46,9 +46,9 @@
if (g > 255) g = 255;
if (b > 255) b = 255;
- const Uint32 value =
+ const uint32_t value =
SDL_MapRGB(&const_cast<SDL_PixelFormat &>(format), r, g, b);
- static_cast<Uint32 *>(colormap)[(j << 8) | i] = value;
+ static_cast<uint32_t *>(colormap)[(j << 8) | i] = value;
}
}
=== modified file 'src/graphic/image_transformations.cc'
--- src/graphic/image_transformations.cc 2014-07-03 19:26:30 +0000
+++ src/graphic/image_transformations.cc 2014-07-13 14:48:31 +0000
@@ -126,13 +126,13 @@
fmt.BitsPerPixel, fmt.Rmask, fmt.Gmask, fmt.Bmask, fmt.Amask);
SDL_Rect srcrc =
{0, 0,
- static_cast<Uint16>(zoomed->w), static_cast<Uint16>(zoomed->h)
+ static_cast<uint16_t>(zoomed->w), static_cast<uint16_t>(zoomed->h)
}; // For some reason SDL_Surface and SDL_Rect express w,h in different types
SDL_Rect dstrc = {0, 0, 0, 0};
SDL_SetAlpha(zoomed, 0, 0);
SDL_BlitSurface(zoomed, &srcrc, placed, &dstrc); // Updates dstrc
- Uint32 fillcolor = SDL_MapRGBA(zoomed->format, 0, 0, 0, 255);
+ uint32_t fillcolor = SDL_MapRGBA(zoomed->format, 0, 0, 0, 255);
if (zoomed->w < placed->w) {
dstrc.x = zoomed->w;
=== modified file 'src/graphic/render/gamerenderer_sdl.cc'
--- src/graphic/render/gamerenderer_sdl.cc 2014-03-23 18:26:08 +0000
+++ src/graphic/render/gamerenderer_sdl.cc 2014-07-13 14:48:31 +0000
@@ -32,7 +32,7 @@
using namespace Widelands;
///This is used by rendermap to calculate the brightness of the terrain.
-inline static Sint8 node_brightness
+inline static int8_t node_brightness
(Widelands::Time const gametime,
Widelands::Time const last_seen,
Widelands::Vision const vision,
@@ -44,8 +44,8 @@
assert(last_seen <= gametime);
Widelands::Duration const time_ago = gametime - last_seen;
result =
- static_cast<Sint16>
- (((static_cast<Sint16>(result) + 128) >> 1)
+ static_cast<int16_t>
+ (((static_cast<int16_t>(result) + 128) >> 1)
*
(1.0 + (time_ago < 45000 ? expf(-8.46126929e-5 * time_ago) : 0)))
-
@@ -134,10 +134,10 @@
const Texture * f_d_texture;
const Texture * tr_d_texture;
uint8_t roads;
- Sint8 f_brightness;
- Sint8 r_brightness;
- Sint8 bl_brightness;
- Sint8 br_brightness;
+ int8_t f_brightness;
+ int8_t r_brightness;
+ int8_t bl_brightness;
+ int8_t br_brightness;
if (m_player && !m_player->see_all()) {
const Player::Field & f_pf = m_player->fields()[f_index];
@@ -257,14 +257,14 @@
sdlsurf->set_subwin(dst.get_rect());
switch (sdlsurf->format().BytesPerPixel) {
case 2:
- draw_field_int<Uint16>
+ draw_field_int<uint16_t>
(*sdlsurf,
f_vert, r_vert, bl_vert, br_vert,
roads,
tr_d_texture, l_r_texture, f_d_texture, f_r_texture);
break;
case 4:
- draw_field_int<Uint32>
+ draw_field_int<uint32_t>
(*sdlsurf,
f_vert, r_vert, bl_vert, br_vert,
roads,
=== modified file 'src/graphic/render/minimaprenderer.cc'
--- src/graphic/render/minimaprenderer.cc 2014-07-03 19:26:30 +0000
+++ src/graphic/render/minimaprenderer.cc 2014-07-13 14:48:31 +0000
@@ -44,9 +44,9 @@
// Blend two colors.
inline uint32_t blend_color
- (const SDL_PixelFormat& format, uint32_t clr1, Uint8 r2, Uint8 g2, Uint8 b2)
+ (const SDL_PixelFormat& format, uint32_t clr1, uint8_t r2, uint8_t g2, uint8_t b2)
{
- Uint8 r1, g1, b1;
+ uint8_t r1, g1, b1;
SDL_GetRGB(clr1, &const_cast<SDL_PixelFormat &>(format), &r1, &g1, &b1);
return
SDL_MapRGB
@@ -164,7 +164,7 @@
{
const Widelands::Map & map = egbase.map();
- Uint8* const pixels = surface->get_pixels();
+ uint8_t* const pixels = surface->get_pixels();
const SDL_PixelFormat& format = surface->format();
const uint16_t pitch = surface->get_pitch();
const uint16_t surface_h = surface->height();
@@ -194,14 +194,14 @@
if (not player or player->see_all()) {
for (uint32_t y = 0; y < surface_h; ++y) {
- Uint8 * pix = pixels + y * pitch;
+ uint8_t * pix = pixels + y * pitch;
Widelands::FCoords f
(Widelands::Coords
(viewpoint.x, viewpoint.y + (flags & MiniMap::Zoom2 ? y / 2 : y)));
map.normalize_coords(f);
f.field = &map[f];
Widelands::Map_Index i = Widelands::Map::get_index(f, mapwidth);
- for (uint32_t x = 0; x < surface_w; ++x, pix += sizeof(Uint32)) {
+ for (uint32_t x = 0; x < surface_w; ++x, pix += sizeof(uint32_t)) {
if (x % 2 || !(flags & MiniMap::Zoom2))
move_r(mapwidth, f, i);
@@ -209,10 +209,10 @@
(is_minimap_frameborder
(f, ptopleft, pbottomright, mapwidth, mapheight, modx, mody))
{
- *reinterpret_cast<Uint32 *>(pix) = static_cast<Uint32>
+ *reinterpret_cast<uint32_t *>(pix) = static_cast<uint32_t>
(SDL_MapRGB(&const_cast<SDL_PixelFormat &>(format), 255, 0, 0));
} else {
- *reinterpret_cast<Uint32 *>(pix) = static_cast<Uint32>
+ *reinterpret_cast<uint32_t *>(pix) = static_cast<uint32_t>
(calc_minimap_color
(format, egbase, f, flags, f.field->get_owned_by(), true));
}
@@ -221,7 +221,7 @@
} else {
Widelands::Player::Field const * const player_fields = player->fields();
for (uint32_t y = 0; y < surface_h; ++y) {
- Uint8 * pix = pixels + y * pitch;
+ uint8_t * pix = pixels + y * pitch;
Widelands::FCoords f
(Widelands::Coords
(viewpoint.x, viewpoint.y +
@@ -229,7 +229,7 @@
map.normalize_coords(f);
f.field = &map[f];
Widelands::Map_Index i = Widelands::Map::get_index(f, mapwidth);
- for (uint32_t x = 0; x < surface_w; ++x, pix += sizeof(Uint32)) {
+ for (uint32_t x = 0; x < surface_w; ++x, pix += sizeof(uint32_t)) {
if (x % 2 || !(flags & MiniMap::Zoom2))
move_r(mapwidth, f, i);
@@ -237,15 +237,15 @@
(is_minimap_frameborder
(f, ptopleft, pbottomright, mapwidth, mapheight, modx, mody))
{
- *reinterpret_cast<Uint32 *>(pix) = static_cast<Uint32>
+ *reinterpret_cast<uint32_t *>(pix) = static_cast<uint32_t>
(SDL_MapRGB
(&const_cast<SDL_PixelFormat &>(format), 255, 0, 0));
} else {
const Widelands::Player::Field & player_field = player_fields[i];
Widelands::Vision const vision = player_field.vision;
- *reinterpret_cast<Uint32 *>(pix) =
- static_cast<Uint32>
+ *reinterpret_cast<uint32_t *>(pix) =
+ static_cast<uint32_t>
(vision ?
calc_minimap_color
(format,
@@ -277,7 +277,7 @@
const int16_t map_h = (flags & MiniMap::Zoom2) ? map.get_height() * 2 : map.get_height();
Surface* surface = Surface::create(map_w, map_h);
- assert(surface->format().BytesPerPixel == sizeof(Uint32));
+ assert(surface->format().BytesPerPixel == sizeof(uint32_t));
surface->fill_rect(Rect(0, 0, surface->width(), surface->height()), RGBAColor(0, 0, 0, 255));
surface->lock(Surface::Lock_Normal);
=== modified file 'src/graphic/render/sdl_helper.cc'
--- src/graphic/render/sdl_helper.cc 2014-07-08 05:10:11 +0000
+++ src/graphic/render/sdl_helper.cc 2014-07-13 14:48:31 +0000
@@ -25,7 +25,7 @@
SDL_Surface * empty_sdl_surface(int16_t w, int16_t h) {
SDL_Surface* surface;
- Uint32 rmask, gmask, bmask, amask;
+ uint32_t rmask, gmask, bmask, amask;
/* SDL interprets each pixel as a 32-bit number, so our masks must depend
on the endianness (byte order) of the machine */
#if SDL_BYTEORDER == SDL_BIG_ENDIAN
=== modified file 'src/graphic/render/sdl_surface.cc'
--- src/graphic/render/sdl_surface.cc 2014-06-25 20:03:51 +0000
+++ src/graphic/render/sdl_surface.cc 2014-07-13 14:48:31 +0000
@@ -72,16 +72,16 @@
assert(m_surface);
// Locking not needed: reading only
- const Uint8 bytes_per_pixel = m_surface->format->BytesPerPixel;
- Uint8 * const pix =
- static_cast<Uint8 *>(m_surface->pixels) +
+ const uint8_t bytes_per_pixel = m_surface->format->BytesPerPixel;
+ uint8_t * const pix =
+ static_cast<uint8_t *>(m_surface->pixels) +
y * m_surface->pitch + x * bytes_per_pixel;
switch (bytes_per_pixel) {
case 1:
return *pix; // Maybe needed for save_png.
case 2:
- return *reinterpret_cast<const Uint16 *>(pix);
+ return *reinterpret_cast<const uint16_t *>(pix);
case 3: //Needed for save_png.
// We can not dereference a pointer to a size 4 object in this case
// since that would casue a read beyond the end of the block pointed to
@@ -98,7 +98,7 @@
// shifting the values. It is alignment safe.
return pix[0] << 0x00 | pix[1] << 0x08 | pix[2] << 0x10;
case 4:
- return *reinterpret_cast<const Uint32 *>(pix);
+ return *reinterpret_cast<const uint32_t *>(pix);
default:
assert(false);
}
@@ -106,7 +106,7 @@
return 0; // Should never be here
}
-void SDLSurface::set_pixel(uint16_t x, uint16_t y, const Uint32 clr) {
+void SDLSurface::set_pixel(uint16_t x, uint16_t y, const uint32_t clr) {
x += m_offsx;
y += m_offsy;
@@ -117,13 +117,13 @@
if (SDL_MUSTLOCK(m_surface))
SDL_LockSurface(m_surface);
- const Uint8 bytes_per_pixel = m_surface->format->BytesPerPixel;
- Uint8 * const pix =
- static_cast<Uint8 *>(m_surface->pixels) +
+ const uint8_t bytes_per_pixel = m_surface->format->BytesPerPixel;
+ uint8_t * const pix =
+ static_cast<uint8_t *>(m_surface->pixels) +
y * m_surface->pitch + x * bytes_per_pixel;
switch (bytes_per_pixel) {
- case 2: *reinterpret_cast<Uint16 *>(pix) = static_cast<Uint16>(clr); break;
- case 4: *reinterpret_cast<Uint32 *>(pix) = clr; break;
+ case 2: *reinterpret_cast<uint16_t *>(pix) = static_cast<uint16_t>(clr); break;
+ case 4: *reinterpret_cast<uint32_t *>(pix) = clr; break;
default: break;
};
@@ -183,8 +183,8 @@
const uint32_t color = clr.map(format());
SDL_Rect r = {
- static_cast<Sint16>(rc.x), static_cast<Sint16>(rc.y),
- static_cast<Uint16>(rc.w), static_cast<Uint16>(rc.h)
+ static_cast<int16_t>(rc.x), static_cast<int16_t>(rc.y),
+ static_cast<uint16_t>(rc.w), static_cast<uint16_t>(rc.h)
};
SDL_FillRect(m_surface, &r, color);
}
@@ -219,11 +219,11 @@
for (int32_t x = rc.x; x < bl.x; ++x)
{
- Uint8 * const pix =
- static_cast<Uint8 *>(m_surface->pixels) +
+ uint8_t * const pix =
+ static_cast<uint8_t *>(m_surface->pixels) +
(y + m_offsy) * m_surface->pitch + (x + m_offsx) * 4;
- uint32_t const clr = *reinterpret_cast<const Uint32 *>(pix);
+ uint32_t const clr = *reinterpret_cast<const uint32_t *>(pix);
uint8_t gr, gg, gb;
SDL_GetRGB(clr, m_surface->format, &gr, &gg, &gb);
int16_t r = gr + factor;
@@ -237,18 +237,18 @@
if (r & 0xFF00)
r = ~r >> 24;
- *reinterpret_cast<Uint32 *>(pix) =
+ *reinterpret_cast<uint32_t *>(pix) =
SDL_MapRGB(m_surface->format, r, g, b);
}
} else if (m_surface->format->BytesPerPixel == 2) {
for (int32_t y = rc.y; y < bl.y; ++y)
for (int32_t x = rc.x; x < bl.x; ++x)
{
- Uint8 * const pix =
- static_cast<Uint8 *>(m_surface->pixels) +
+ uint8_t * const pix =
+ static_cast<uint8_t *>(m_surface->pixels) +
(y + m_offsy) * m_surface->pitch + (x + m_offsx) * 2;
- uint32_t const clr = *reinterpret_cast<const Uint16 *>(pix);
+ uint32_t const clr = *reinterpret_cast<const uint16_t *>(pix);
uint8_t gr, gg, gb;
SDL_GetRGB(clr, m_surface->format, &gr, &gg, &gb);
int16_t r = gr + factor;
@@ -262,7 +262,7 @@
if (r & 0xFF00)
r = ~r >> 24;
- *reinterpret_cast<Uint16 *>(pix) =
+ *reinterpret_cast<uint16_t *>(pix) =
SDL_MapRGB(m_surface->format, r, g, b);
}
}
@@ -327,11 +327,11 @@
{
SDL_Surface* sdlsurf = static_cast<const SDLSurface*>(src)->get_sdl_surface();
SDL_Rect srcrect = {
- static_cast<Sint16>(srcrc.x), static_cast<Sint16>(srcrc.y),
- static_cast<Uint16>(srcrc.w), static_cast<Uint16>(srcrc.h)
+ static_cast<int16_t>(srcrc.x), static_cast<int16_t>(srcrc.y),
+ static_cast<uint16_t>(srcrc.w), static_cast<uint16_t>(srcrc.h)
};
SDL_Rect dstrect = {
- static_cast<Sint16>(dst.x), static_cast<Sint16>(dst.y),
+ static_cast<int16_t>(dst.x), static_cast<int16_t>(dst.y),
0, 0
};
=== modified file 'src/graphic/render/sdl_surface.h'
--- src/graphic/render/sdl_surface.h 2014-07-05 19:33:23 +0000
+++ src/graphic/render/sdl_surface.h 2014-07-13 14:48:31 +0000
@@ -55,7 +55,7 @@
virtual void lock(LockMode) override;
virtual void unlock(UnlockMode) override;
virtual uint32_t get_pixel(uint16_t x, uint16_t y) override;
- virtual void set_pixel(uint16_t x, uint16_t y, Uint32 clr) override;
+ virtual void set_pixel(uint16_t x, uint16_t y, uint32_t clr) override;
virtual uint16_t get_pitch() const override {return m_surface->pitch;}
virtual uint8_t * get_pixels() const override;
=== modified file 'src/graphic/render/terrain_sdl.h'
--- src/graphic/render/terrain_sdl.h 2014-07-05 16:41:51 +0000
+++ src/graphic/render/terrain_sdl.h 2014-07-13 14:48:31 +0000
@@ -160,7 +160,7 @@
T * scanline =
reinterpret_cast<T *>
- (static_cast<Uint8 *>(dst.get_pixels()) + y * dst.get_pitch())
+ (static_cast<uint8_t *>(dst.get_pixels()) + y * dst.get_pitch())
+
leftx;
@@ -487,7 +487,7 @@
++i, ++x, tx0 += dty, ty0 -= dtx, rnd0 >>= DITHER_RAND_SHIFT)
if ((rnd0 & DITHER_RAND_MASK) <= i && x >= 0 && x < dstw)
reinterpret_cast<T *>
- (static_cast<Uint8 *>(dst.get_pixels())
+ (static_cast<uint8_t *>(dst.get_pixels())
+
y * dst.get_pitch())
[x]
@@ -509,7 +509,7 @@
&&
x >= 0 && x < dstw)
reinterpret_cast<T *>
- (static_cast<Uint8 *>(dst.get_pixels())
+ (static_cast<uint8_t *>(dst.get_pixels())
+
y * dst.get_pitch())
[x]
=== modified file 'src/graphic/text/sdl_ttf_font.cc'
--- src/graphic/text/sdl_ttf_font.cc 2014-07-06 19:16:20 +0000
+++ src/graphic/text/sdl_ttf_font.cc 2014-07-13 14:48:31 +0000
@@ -86,13 +86,13 @@
SDL_SetAlpha(shadow, 0, SDL_ALPHA_OPAQUE);
SDL_BlitSurface(shadow, nullptr, text_surface, &dstrct1);
- Uint32* spix = static_cast<Uint32*>(tsurf->pixels);
- Uint32* dpix = static_cast<Uint32*>(text_surface->pixels);
+ uint32_t* spix = static_cast<uint32_t*>(tsurf->pixels);
+ uint32_t* dpix = static_cast<uint32_t*>(text_surface->pixels);
// Alpha Blend the Text onto the Shadow. This is really slow, but it is
// the only compatible way to do it using SDL 1.2. SDL 2.0 offers more
// functionality but is not yet released.
- Uint8 sr, sg, sb, sa, dr, dg, db, da, outa, outr = 0, outg = 0, outb = 0;
+ uint8_t sr, sg, sb, sa, dr, dg, db, da, outa, outr = 0, outg = 0, outb = 0;
for (int y = 0; y < tsurf->h; ++y) {
for (int x = 0; x < tsurf->w; ++x) {
size_t sidx = (y * tsurf->pitch + 4 * x) / 4;
=== modified file 'src/graphic/texture.cc'
--- src/graphic/texture.cc 2014-07-05 14:22:44 +0000
+++ src/graphic/texture.cc 2014-07-13 14:48:31 +0000
@@ -180,14 +180,14 @@
/**
* Return the basic terrain colour to be used in the minimap.
*/
-Uint32 Texture::get_minimap_color(char shade) {
+uint32_t Texture::get_minimap_color(char shade) {
if (not m_pixels)
return m_mmap_color[128 + shade];
uint8_t clr = m_pixels[0]; // just use the top-left pixel
uint32_t table = static_cast<uint8_t>(shade);
- return static_cast<const Uint32*>(m_colormap->get_colormap())[clr | (table << 8)];
+ return static_cast<const uint32_t*>(m_colormap->get_colormap())[clr | (table << 8)];
}
/**
=== modified file 'src/sound/fxset.h'
--- src/sound/fxset.h 2014-07-05 16:41:51 +0000
+++ src/sound/fxset.h 2014-07-13 14:48:31 +0000
@@ -47,7 +47,7 @@
FXset(uint8_t priority = PRIO_MEDIUM);
~FXset();
- void add_fx(Mix_Chunk * fx, Uint8 prio = PRIO_MEDIUM);
+ void add_fx(Mix_Chunk * fx, uint8_t prio = PRIO_MEDIUM);
Mix_Chunk * get_fx();
bool empty() {return fxs_.empty();}
@@ -58,7 +58,7 @@
/** When the effect was played the last time (milliseconds since SDL
* initialization). Set via SDL_GetTicks()
*/
- Uint32 last_used_;
+ uint32_t last_used_;
/** How important is it to play the effect even when others are running
* already?
=== modified file 'src/sound/sound_handler.cc'
--- src/sound/sound_handler.cc 2014-07-05 12:17:03 +0000
+++ src/sound/sound_handler.cc 2014-07-13 14:48:31 +0000
@@ -145,7 +145,7 @@
Mix_HookMusicFinished(nullptr);
int numtimesopened, frequency, channels;
- Uint16 format;
+ uint16_t format;
numtimesopened = Mix_QuerySpec(&frequency, &format, &channels);
log
("Sound_Handler closing times %i, freq %i, format %i, chan %i\n",
=== modified file 'src/ui_basic/button.cc'
--- src/ui_basic/button.cc 2014-07-05 14:22:44 +0000
+++ src/ui_basic/button.cc 2014-07-13 14:48:31 +0000
@@ -304,7 +304,7 @@
/**
* Update the pressed status of the button
*/
-bool Button::handle_mousepress(Uint8 const btn, int32_t, int32_t) {
+bool Button::handle_mousepress(uint8_t const btn, int32_t, int32_t) {
if (btn != SDL_BUTTON_LEFT)
return false;
@@ -321,7 +321,7 @@
return true;
}
-bool Button::handle_mouserelease(Uint8 const btn, int32_t, int32_t) {
+bool Button::handle_mouserelease(uint8_t const btn, int32_t, int32_t) {
if (btn != SDL_BUTTON_LEFT)
return false;
@@ -341,7 +341,7 @@
}
return true;
}
-bool Button::handle_mousemove(const Uint8, int32_t, int32_t, int32_t, int32_t) {
+bool Button::handle_mousemove(const uint8_t, int32_t, int32_t, int32_t, int32_t) {
return true; // We handle this always by lighting up
}
=== modified file 'src/ui_basic/button.h'
--- src/ui_basic/button.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/button.h 2014-07-13 14:48:31 +0000
@@ -71,9 +71,9 @@
void think() override;
void handle_mousein(bool inside) override;
- bool handle_mousepress (Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mousemove(Uint8, int32_t, int32_t, int32_t, int32_t) override;
+ bool handle_mousepress (uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mousemove(uint8_t, int32_t, int32_t, int32_t, int32_t) override;
// Set the permanently pressed state of the button
void set_perm_pressed(bool state);
=== modified file 'src/ui_basic/checkbox.cc'
--- src/ui_basic/checkbox.cc 2013-07-26 20:19:36 +0000
+++ src/ui_basic/checkbox.cc 2014-07-13 14:48:31 +0000
@@ -146,19 +146,19 @@
/**
* Left-click: Toggle checkbox state
*/
-bool Statebox::handle_mousepress(const Uint8 btn, int32_t, int32_t) {
+bool Statebox::handle_mousepress(const uint8_t btn, int32_t, int32_t) {
if (btn == SDL_BUTTON_LEFT and (m_flags & Is_Enabled)) {
clicked();
return true;
} else
return false;
}
-bool Statebox::handle_mouserelease(const Uint8 btn, int32_t, int32_t)
+bool Statebox::handle_mouserelease(const uint8_t btn, int32_t, int32_t)
{
return btn == SDL_BUTTON_LEFT;
}
-bool Statebox::handle_mousemove(const Uint8, int32_t, int32_t, int32_t, int32_t) {
+bool Statebox::handle_mousemove(const uint8_t, int32_t, int32_t, int32_t, int32_t) {
return true; // We handle this always by lighting up
}
=== modified file 'src/ui_basic/checkbox.h'
--- src/ui_basic/checkbox.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/checkbox.h 2014-07-13 14:48:31 +0000
@@ -60,9 +60,9 @@
void draw(RenderTarget &) override;
void handle_mousein(bool inside) override;
- bool handle_mousepress (Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mousemove(Uint8, int32_t, int32_t, int32_t, int32_t) override;
+ bool handle_mousepress (uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mousemove(uint8_t, int32_t, int32_t, int32_t, int32_t) override;
private:
virtual void clicked() = 0;
=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc 2014-07-08 18:54:44 +0000
+++ src/ui_basic/editbox.cc 2014-07-13 14:48:31 +0000
@@ -199,7 +199,7 @@
/**
* The mouse was clicked on this editbox
*/
-bool EditBox::handle_mousepress(const Uint8 btn, int32_t, int32_t)
+bool EditBox::handle_mousepress(const uint8_t btn, int32_t, int32_t)
{
if (btn == SDL_BUTTON_LEFT && get_can_focus()) {
focus();
@@ -209,7 +209,7 @@
return false;
}
-bool EditBox::handle_mouserelease(const Uint8 btn, int32_t, int32_t)
+bool EditBox::handle_mouserelease(const uint8_t btn, int32_t, int32_t)
{
return btn == SDL_BUTTON_LEFT && get_can_focus();
}
=== modified file 'src/ui_basic/editbox.h'
--- src/ui_basic/editbox.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/editbox.h 2014-07-13 14:48:31 +0000
@@ -59,8 +59,8 @@
void activate_history(bool activate) {m_history_active = activate;}
- bool handle_mousepress(Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
bool handle_key(bool down, SDL_keysym) override;
void draw(RenderTarget &) override;
=== modified file 'src/ui_basic/listselect.cc'
--- src/ui_basic/listselect.cc 2014-07-05 14:22:44 +0000
+++ src/ui_basic/listselect.cc 2014-07-13 14:48:31 +0000
@@ -416,7 +416,7 @@
/**
* Handle mouse presses: select the appropriate entry
*/
-bool BaseListselect::handle_mousepress(const Uint8 btn, int32_t, int32_t y)
+bool BaseListselect::handle_mousepress(const uint8_t btn, int32_t, int32_t y)
{
switch (btn) {
case SDL_BUTTON_WHEELDOWN:
@@ -454,12 +454,12 @@
}
}
-bool BaseListselect::handle_mouserelease(const Uint8 btn, int32_t, int32_t)
+bool BaseListselect::handle_mouserelease(const uint8_t btn, int32_t, int32_t)
{
return btn == SDL_BUTTON_LEFT;
}
-bool BaseListselect::handle_mousemove(Uint8, int32_t, int32_t y, int32_t, int32_t) {
+bool BaseListselect::handle_mousemove(uint8_t, int32_t, int32_t y, int32_t, int32_t) {
y = (y + m_scrollpos) / get_lineheight();
if (y < 0 or static_cast<int32_t>(m_entry_records.size()) <= y) {
set_tooltip("");
=== modified file 'src/ui_basic/listselect.h'
--- src/ui_basic/listselect.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/listselect.h 2014-07-13 14:48:31 +0000
@@ -114,9 +114,9 @@
// Drawing and event handling
void draw(RenderTarget &) override;
- bool handle_mousepress (Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mousemove (Uint8 state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
+ bool handle_mousepress (uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mousemove (uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
bool handle_key(bool down, SDL_keysym) override;
private:
=== modified file 'src/ui_basic/messagebox.cc'
--- src/ui_basic/messagebox.cc 2014-07-05 14:22:44 +0000
+++ src/ui_basic/messagebox.cc 2014-07-13 14:48:31 +0000
@@ -116,7 +116,7 @@
* Clicking the right mouse button inside the window acts like pressing
* Ok or No, depending on the message box type.
*/
-bool WLMessageBox::handle_mousepress(const Uint8 btn, int32_t, int32_t)
+bool WLMessageBox::handle_mousepress(const uint8_t btn, int32_t, int32_t)
{
if (btn == SDL_BUTTON_RIGHT) {
play_click();
@@ -128,7 +128,7 @@
return true;
}
-bool WLMessageBox::handle_mouserelease(const Uint8, int32_t, int32_t)
+bool WLMessageBox::handle_mouserelease(const uint8_t, int32_t, int32_t)
{
return true;
}
=== modified file 'src/ui_basic/messagebox.h'
--- src/ui_basic/messagebox.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/messagebox.h 2014-07-13 14:48:31 +0000
@@ -67,8 +67,8 @@
boost::signals2::signal<void ()> yes;
boost::signals2::signal<void ()> no;
- bool handle_mousepress (Uint8 btn, int32_t mx, int32_t my) override;
- bool handle_mouserelease(Uint8 btn, int32_t mx, int32_t my) override;
+ bool handle_mousepress (uint8_t btn, int32_t mx, int32_t my) override;
+ bool handle_mouserelease(uint8_t btn, int32_t mx, int32_t my) override;
bool handle_key(bool down, SDL_keysym code) override;
protected:
=== modified file 'src/ui_basic/multilinetextarea.cc'
--- src/ui_basic/multilinetextarea.cc 2014-07-05 14:22:44 +0000
+++ src/ui_basic/multilinetextarea.cc 2014-07-13 14:48:31 +0000
@@ -191,7 +191,7 @@
}
bool Multiline_Textarea::handle_mousepress
- (Uint8 const btn, int32_t const x, int32_t const y)
+ (uint8_t const btn, int32_t const x, int32_t const y)
{
return
btn == SDL_BUTTON_WHEELUP or btn == SDL_BUTTON_WHEELDOWN ?
=== modified file 'src/ui_basic/multilinetextarea.h'
--- src/ui_basic/multilinetextarea.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/multilinetextarea.h 2014-07-13 14:48:31 +0000
@@ -64,7 +64,7 @@
// Drawing and event handlers
void draw(RenderTarget &) override;
- bool handle_mousepress (Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mousepress (uint8_t btn, int32_t x, int32_t y) override;
const char * get_font_name() {return m_fontname.c_str();}
int32_t get_font_size() {return m_fontsize;}
=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc 2014-07-05 14:22:44 +0000
+++ src/ui_basic/panel.cc 2014-07-13 14:48:31 +0000
@@ -643,7 +643,7 @@
*
* \return true if the mouseclick was processed, flase otherwise
*/
-bool Panel::handle_mousepress (const Uint8, int32_t, int32_t)
+bool Panel::handle_mousepress (const uint8_t, int32_t, int32_t)
{
return false;
}
@@ -655,7 +655,7 @@
*
* \return true if the mouseclick was processed, false otherwise
*/
-bool Panel::handle_mouserelease(const Uint8, int32_t, int32_t)
+bool Panel::handle_mouserelease(const uint8_t, int32_t, int32_t)
{
return false;
}
@@ -663,7 +663,7 @@
/**
* Called when the mouse is moved while inside the panel
*/
-bool Panel::handle_mousemove(const Uint8, int32_t, int32_t, int32_t, int32_t)
+bool Panel::handle_mousemove(const uint8_t, int32_t, int32_t, int32_t, int32_t)
{
return !_tooltip.empty();
}
@@ -986,7 +986,7 @@
*
* Returns whether the event was processed.
*/
-bool Panel::do_mousepress(const Uint8 btn, int32_t x, int32_t y) {
+bool Panel::do_mousepress(const uint8_t btn, int32_t x, int32_t y) {
if (not _g_allow_user_input) {
return true;
}
@@ -1020,7 +1020,7 @@
}
return handle_mousepress(btn, x, y);
}
-bool Panel::do_mouserelease(const Uint8 btn, int32_t x, int32_t y) {
+bool Panel::do_mouserelease(const uint8_t btn, int32_t x, int32_t y) {
if (not _g_allow_user_input)
return true;
@@ -1037,7 +1037,7 @@
}
bool Panel::do_mousemove
- (Uint8 const state,
+ (uint8_t const state,
int32_t x, int32_t y, int32_t const xdiff, int32_t const ydiff)
{
if (not _g_allow_user_input)
@@ -1141,14 +1141,14 @@
* Input callback function. Pass the mouseclick event to the currently modal
* panel.
*/
-void Panel::ui_mousepress(const Uint8 button, int32_t x, int32_t y) {
+void Panel::ui_mousepress(const uint8_t button, int32_t x, int32_t y) {
if (not _g_allow_user_input)
return;
if (Panel * const p = ui_trackmouse(x, y))
p->do_mousepress(button, x, y);
}
-void Panel::ui_mouserelease(const Uint8 button, int32_t x, int32_t y) {
+void Panel::ui_mouserelease(const uint8_t button, int32_t x, int32_t y) {
if (not _g_allow_user_input)
return;
@@ -1161,7 +1161,7 @@
* panel.
*/
void Panel::ui_mousemove
- (Uint8 const state,
+ (uint8_t const state,
int32_t x, int32_t y, int32_t const xdiff, int32_t const ydiff)
{
if (not _g_allow_user_input)
=== modified file 'src/ui_basic/panel.h'
--- src/ui_basic/panel.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/panel.h 2014-07-13 14:48:31 +0000
@@ -182,10 +182,10 @@
void center_mouse();
virtual void handle_mousein(bool inside);
- virtual bool handle_mousepress (Uint8 btn, int32_t x, int32_t y);
- virtual bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y);
+ virtual bool handle_mousepress (uint8_t btn, int32_t x, int32_t y);
+ virtual bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y);
virtual bool handle_mousemove
- (Uint8 state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff);
+ (uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff);
virtual bool handle_key(bool down, SDL_keysym code);
virtual bool handle_alt_drag(int32_t x, int32_t y);
virtual bool handle_tooltip();
@@ -259,18 +259,18 @@
Panel * child_at_mouse_cursor
(int32_t mouse_x, int32_t mouse_y, Panel * child);
void do_mousein(bool inside);
- bool do_mousepress (const Uint8 btn, int32_t x, int32_t y);
- bool do_mouserelease(const Uint8 btn, int32_t x, int32_t y);
+ bool do_mousepress (const uint8_t btn, int32_t x, int32_t y);
+ bool do_mouserelease(const uint8_t btn, int32_t x, int32_t y);
bool do_mousemove
- (const Uint8 state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff);
+ (const uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff);
bool do_key(bool down, SDL_keysym code);
bool do_tooltip();
static Panel * ui_trackmouse(int32_t & x, int32_t & y);
- static void ui_mousepress (const Uint8 button, int32_t x, int32_t y);
- static void ui_mouserelease(const Uint8 button, int32_t x, int32_t y);
+ static void ui_mousepress (const uint8_t button, int32_t x, int32_t y);
+ static void ui_mouserelease(const uint8_t button, int32_t x, int32_t y);
static void ui_mousemove
- (const Uint8 state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff);
+ (const uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff);
static void ui_key(bool down, SDL_keysym code);
=== modified file 'src/ui_basic/scrollbar.cc'
--- src/ui_basic/scrollbar.cc 2014-06-25 05:42:44 +0000
+++ src/ui_basic/scrollbar.cc 2014-07-13 14:48:31 +0000
@@ -391,7 +391,7 @@
}
-bool Scrollbar::handle_mousepress(const Uint8 btn, int32_t x, int32_t y) {
+bool Scrollbar::handle_mousepress(const uint8_t btn, int32_t x, int32_t y) {
bool result = false;
switch (btn) {
@@ -425,7 +425,7 @@
update();
return result;
}
-bool Scrollbar::handle_mouserelease(const Uint8 btn, int32_t, int32_t) {
+bool Scrollbar::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
bool result = false;
switch (btn) {
@@ -456,7 +456,7 @@
* Move the knob while pressed.
*/
bool Scrollbar::handle_mousemove
- (Uint8, int32_t const mx, int32_t const my, int32_t, int32_t)
+ (uint8_t, int32_t const mx, int32_t const my, int32_t, int32_t)
{
if (m_pressed == Knob)
set_knob_pos((m_horizontal ? mx : my) - m_knob_grabdelta);
=== modified file 'src/ui_basic/scrollbar.h'
--- src/ui_basic/scrollbar.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/scrollbar.h 2014-07-13 14:48:31 +0000
@@ -62,7 +62,7 @@
uint32_t get_pagesize() const {return m_pagesize;}
uint32_t get_scrollpos() const {return m_pos;}
- bool handle_mousepress (Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mousepress (uint8_t btn, int32_t x, int32_t y) override;
void set_force_draw(bool const t) {m_force_draw = t;}
@@ -79,9 +79,9 @@
void draw(RenderTarget &) override;
void think() override;
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
bool handle_mousemove
- (Uint8 state, int32_t mx, int32_t my, int32_t xdiff, int32_t ydiff) override;
+ (uint8_t state, int32_t mx, int32_t my, int32_t xdiff, int32_t ydiff) override;
private:
bool m_horizontal;
=== modified file 'src/ui_basic/slider.cc'
--- src/ui_basic/slider.cc 2013-07-26 20:19:36 +0000
+++ src/ui_basic/slider.cc 2014-07-13 14:48:31 +0000
@@ -247,7 +247,7 @@
*
* Update pressed status.
*/
-bool Slider::handle_mouserelease(const Uint8 btn, int32_t, int32_t) {
+bool Slider::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
if (btn != SDL_BUTTON_LEFT)
return false;
if (m_pressed) {
@@ -426,7 +426,7 @@
* \param y The new Y position of mouse pointer.
*/
bool HorizontalSlider::handle_mousemove
- (Uint8, int32_t const x, int32_t const y, int32_t, int32_t)
+ (uint8_t, int32_t const x, int32_t const y, int32_t, int32_t)
{
cursor_moved(x, x, y);
return true;
@@ -441,7 +441,7 @@
* \param y The Y position of mouse pointer.
*/
bool HorizontalSlider::handle_mousepress
- (const Uint8 btn, int32_t x, int32_t y)
+ (const uint8_t btn, int32_t x, int32_t y)
{
if (btn != SDL_BUTTON_LEFT)
return false;
@@ -510,7 +510,7 @@
* \param y The new Y position of mouse pointer.
*/
bool VerticalSlider::handle_mousemove
- (Uint8, int32_t const x, int32_t const y, int32_t, int32_t)
+ (uint8_t, int32_t const x, int32_t const y, int32_t, int32_t)
{
cursor_moved(y, x, y);
return true;
@@ -524,7 +524,7 @@
* \param x The X position of mouse pointer.
* \param y The Y position of mouse pointer.
*/
-bool VerticalSlider::handle_mousepress(const Uint8 btn, int32_t x, int32_t y) {
+bool VerticalSlider::handle_mousepress(const uint8_t btn, int32_t x, int32_t y) {
if (btn != SDL_BUTTON_LEFT)
return false;
=== modified file 'src/ui_basic/slider.h'
--- src/ui_basic/slider.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/slider.h 2014-07-13 14:48:31 +0000
@@ -74,7 +74,7 @@
(RenderTarget &, int32_t x, int32_t y, int32_t w, int32_t h);
// mouse events
- bool handle_mouserelease(Uint8 btn, int32_t, int32_t) override;
+ bool handle_mouserelease(uint8_t btn, int32_t, int32_t) override;
void handle_mousein(bool inside) override;
void cursor_moved(int32_t pointer, int32_t x, int32_t y);
void cursor_pressed(int32_t pointer);
@@ -138,8 +138,8 @@
protected:
void draw(RenderTarget & dst) override;
- bool handle_mousemove (Uint8 btn, int32_t x, int32_t y, int32_t, int32_t) override;
- bool handle_mousepress(Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mousemove (uint8_t btn, int32_t x, int32_t y, int32_t, int32_t) override;
+ bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
void layout() override;
};
@@ -173,8 +173,8 @@
protected:
void draw(RenderTarget & dst) override;
- bool handle_mousemove (Uint8 btn, int32_t x, int32_t y, int32_t, int32_t) override;
- bool handle_mousepress(Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mousemove (uint8_t btn, int32_t x, int32_t y, int32_t, int32_t) override;
+ bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
void layout() override;
};
=== modified file 'src/ui_basic/table.cc'
--- src/ui_basic/table.cc 2014-07-05 14:22:44 +0000
+++ src/ui_basic/table.cc 2014-07-13 14:48:31 +0000
@@ -346,7 +346,7 @@
* Handle mouse presses: select the appropriate entry
*/
bool Table<void *>::handle_mousepress
- (Uint8 const btn, int32_t x, int32_t const y)
+ (uint8_t const btn, int32_t x, int32_t const y)
{
if (get_can_focus())
focus();
@@ -397,7 +397,7 @@
return false;
}
}
-bool Table<void *>::handle_mouserelease(const Uint8 btn, int32_t, int32_t)
+bool Table<void *>::handle_mouserelease(const uint8_t btn, int32_t, int32_t)
{
return btn == SDL_BUTTON_LEFT;
}
=== modified file 'src/ui_basic/table.h'
--- src/ui_basic/table.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/table.h 2014-07-13 14:48:31 +0000
@@ -105,8 +105,8 @@
// Drawing and event handling
void draw(RenderTarget &);
- bool handle_mousepress (Uint8 btn, int32_t x, int32_t y);
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y);
+ bool handle_mousepress (uint8_t btn, int32_t x, int32_t y);
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y);
virtual bool handle_key(bool down, SDL_keysym code);
};
@@ -241,8 +241,8 @@
// Drawing and event handling
void draw(RenderTarget &) override;
- bool handle_mousepress (Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mousepress (uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
virtual bool handle_key(bool down, SDL_keysym code) override;
private:
=== modified file 'src/ui_basic/tabpanel.cc'
--- src/ui_basic/tabpanel.cc 2013-07-26 20:19:36 +0000
+++ src/ui_basic/tabpanel.cc 2014-07-13 14:48:31 +0000
@@ -296,7 +296,7 @@
* Update highlighting
*/
bool Tab_Panel::handle_mousemove
- (Uint8, int32_t const x, int32_t const y, int32_t, int32_t)
+ (uint8_t, int32_t const x, int32_t const y, int32_t, int32_t)
{
int32_t hl;
@@ -331,7 +331,7 @@
/**
* Change the active tab if a tab button has been clicked
*/
-bool Tab_Panel::handle_mousepress(const Uint8 btn, int32_t x, int32_t y) {
+bool Tab_Panel::handle_mousepress(const uint8_t btn, int32_t x, int32_t y) {
if (btn == SDL_BUTTON_LEFT) {
int32_t id;
@@ -349,7 +349,7 @@
return false;
}
-bool Tab_Panel::handle_mouserelease(Uint8, int32_t, int32_t)
+bool Tab_Panel::handle_mouserelease(uint8_t, int32_t, int32_t)
{
return false;
}
=== modified file 'src/ui_basic/tabpanel.h'
--- src/ui_basic/tabpanel.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/tabpanel.h 2014-07-13 14:48:31 +0000
@@ -96,10 +96,10 @@
// Drawing and event handlers
void draw(RenderTarget &) override;
- bool handle_mousepress (Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mousepress (uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
bool handle_mousemove
- (Uint8 state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
+ (uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
void handle_mousein(bool inside) override;
=== modified file 'src/ui_basic/window.cc'
--- src/ui_basic/window.cc 2014-07-05 14:22:44 +0000
+++ src/ui_basic/window.cc 2014-07-13 14:48:31 +0000
@@ -430,7 +430,7 @@
* Left-click: drag the window
* Right-click: close the window
*/
-bool Window::handle_mousepress(const Uint8 btn, int32_t mx, int32_t my)
+bool Window::handle_mousepress(const uint8_t btn, int32_t mx, int32_t my)
{
// FIXME This code is erroneous. It checks the current key state. What it
// FIXME needs is the key state at the time the mouse was clicked. See the
@@ -456,7 +456,7 @@
return true;
}
-bool Window::handle_mouserelease(const Uint8 btn, int32_t, int32_t) {
+bool Window::handle_mouserelease(const uint8_t btn, int32_t, int32_t) {
if (btn == SDL_BUTTON_LEFT) {
grab_mouse(false);
_dragging = false;
@@ -527,7 +527,7 @@
* Ensure that the window isn't fully dragged out of the screen.
*/
bool Window::handle_mousemove
- (const Uint8, int32_t mx, int32_t my, int32_t, int32_t)
+ (const uint8_t, int32_t mx, int32_t my, int32_t, int32_t)
{
if (_dragging) {
const int32_t mouse_x = get_x() + get_lborder() + mx;
=== modified file 'src/ui_basic/window.h'
--- src/ui_basic/window.h 2014-07-05 16:41:51 +0000
+++ src/ui_basic/window.h 2014-07-13 14:48:31 +0000
@@ -82,10 +82,10 @@
void think() override;
- bool handle_mousepress (Uint8 btn, int32_t mx, int32_t my) override;
- bool handle_mouserelease(Uint8 btn, int32_t mx, int32_t my) override;
+ bool handle_mousepress (uint8_t btn, int32_t mx, int32_t my) override;
+ bool handle_mouserelease(uint8_t btn, int32_t mx, int32_t my) override;
bool handle_mousemove
- (Uint8 state, int32_t mx, int32_t my, int32_t xdiff, int32_t ydiff) override;
+ (uint8_t state, int32_t mx, int32_t my, int32_t xdiff, int32_t ydiff) override;
bool handle_alt_drag (int32_t mx, int32_t my) override;
bool handle_tooltip() override;
=== modified file 'src/ui_fsmenu/intro.cc'
--- src/ui_fsmenu/intro.cc 2014-06-08 21:47:45 +0000
+++ src/ui_fsmenu/intro.cc 2014-07-13 14:48:31 +0000
@@ -34,13 +34,13 @@
m_message.set_font(ui_fn(), fs_small() * 6 / 5, RGBColor(192, 192, 128));
}
-bool Fullscreen_Menu_Intro::handle_mousepress (Uint8, int32_t, int32_t)
+bool Fullscreen_Menu_Intro::handle_mousepress (uint8_t, int32_t, int32_t)
{
end_modal(0);
return true;
}
-bool Fullscreen_Menu_Intro::handle_mouserelease(Uint8, int32_t, int32_t)
+bool Fullscreen_Menu_Intro::handle_mouserelease(uint8_t, int32_t, int32_t)
{
return true;
}
=== modified file 'src/ui_fsmenu/intro.h'
--- src/ui_fsmenu/intro.h 2014-07-05 16:41:51 +0000
+++ src/ui_fsmenu/intro.h 2014-07-13 14:48:31 +0000
@@ -32,8 +32,8 @@
Fullscreen_Menu_Intro();
protected:
- virtual bool handle_mousepress (Uint8 btn, int32_t x, int32_t y) override;
- virtual bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
+ virtual bool handle_mousepress (uint8_t btn, int32_t x, int32_t y) override;
+ virtual bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
bool handle_key(bool down, SDL_keysym) override;
private:
UI::Textarea m_message;
=== modified file 'src/wlapplication.cc'
--- src/wlapplication.cc 2014-07-08 19:15:19 +0000
+++ src/wlapplication.cc 2014-07-13 14:48:31 +0000
@@ -887,7 +887,7 @@
* \return true if there were no fatal errors that prevent the game from running
*/
bool WLApplication::init_hardware() {
- Uint32 sdl_flags = 0;
+ uint8_t sdl_flags = 0;
Section & s = g_options.pull_section("global");
//Start the SDL core
=== modified file 'src/wlapplication.h'
--- src/wlapplication.h 2014-07-05 16:41:51 +0000
+++ src/wlapplication.h 2014-07-13 14:48:31 +0000
@@ -50,13 +50,13 @@
// input
struct InputCallback {
void (*mouse_press)
- (const Uint8 button, // Button number as #defined in SDL_mouse.h.
+ (const uint8_t button, // Button number as #defined in SDL_mouse.h.
int32_t x, int32_t y); // The coordinates of the mouse at press time.
void (*mouse_release)
- (const Uint8 button, // Button number as #defined in SDL_mouse.h.
+ (const uint8_t button, // Button number as #defined in SDL_mouse.h.
int32_t x, int32_t y); // The coordinates of the mouse at release time.
void (*mouse_move)
- (const Uint8 state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff);
+ (const uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff);
void (*key) (bool down, SDL_keysym code);
};
=== modified file 'src/wui/game_summary.cc'
--- src/wui/game_summary.cc 2014-07-08 18:35:29 +0000
+++ src/wui/game_summary.cc 2014-07-13 14:48:31 +0000
@@ -109,7 +109,7 @@
fill_data();
}
-bool GameSummaryScreen::handle_mousepress(Uint8 btn, int32_t mx, int32_t my)
+bool GameSummaryScreen::handle_mousepress(uint8_t btn, int32_t mx, int32_t my)
{
// Prevent closing with right click
if (btn == SDL_BUTTON_RIGHT)
=== modified file 'src/wui/game_summary.h'
--- src/wui/game_summary.h 2014-07-05 16:41:51 +0000
+++ src/wui/game_summary.h 2014-07-13 14:48:31 +0000
@@ -39,7 +39,7 @@
GameSummaryScreen
(Interactive_GameBase * parent, UI::UniqueWindow::Registry * r);
- bool handle_mousepress(Uint8 btn, int32_t mx, int32_t my) override;
+ bool handle_mousepress(uint8_t btn, int32_t mx, int32_t my) override;
private:
void fill_data();
void stop_clicked();
=== modified file 'src/wui/game_tips.cc'
--- src/wui/game_tips.cc 2014-07-05 14:22:44 +0000
+++ src/wui/game_tips.cc 2014-07-13 14:48:31 +0000
@@ -81,7 +81,7 @@
}
void GameTips::update(bool repaint) {
- Uint32 ticks = SDL_GetTicks();
+ uint8_t ticks = SDL_GetTicks();
if (ticks >= (m_lastUpdated + m_updateAfter)) {
const uint32_t next = rand() % m_tips.size();
if (next == m_lastTip)
=== modified file 'src/wui/mapview.cc'
--- src/wui/mapview.cc 2014-07-03 19:26:30 +0000
+++ src/wui/mapview.cc 2014-07-13 14:48:31 +0000
@@ -152,7 +152,7 @@
* Left-press: field action window
*/
bool Map_View::handle_mousepress
- (Uint8 const btn, int32_t const x, int32_t const y)
+ (uint8_t const btn, int32_t const x, int32_t const y)
{
if (btn == SDL_BUTTON_LEFT)
{
@@ -167,7 +167,7 @@
}
return true;
}
-bool Map_View::handle_mouserelease(const Uint8 btn, int32_t, int32_t)
+bool Map_View::handle_mouserelease(const uint8_t btn, int32_t, int32_t)
{
if (btn == SDL_BUTTON_RIGHT and m_dragging)
stop_dragging();
@@ -181,7 +181,7 @@
===============
*/
bool Map_View::handle_mousemove
- (Uint8 const state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff)
+ (uint8_t const state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff)
{
if (m_dragging) {
if (state & SDL_BUTTON(SDL_BUTTON_RIGHT))
=== modified file 'src/wui/mapview.h'
--- src/wui/mapview.h 2014-07-05 16:41:51 +0000
+++ src/wui/mapview.h 2014-07-13 14:48:31 +0000
@@ -72,10 +72,10 @@
void draw(RenderTarget &) override;
// Event handling
- bool handle_mousepress (Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mousepress (uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
bool handle_mousemove
- (Uint8 state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
+ (uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
void track_sel(Point m);
void need_complete_redraw() {m_complete_redraw_needed = true;}
=== modified file 'src/wui/minimap.cc'
--- src/wui/minimap.cc 2014-06-08 21:47:45 +0000
+++ src/wui/minimap.cc 2014-07-13 14:48:31 +0000
@@ -85,7 +85,7 @@
Left-press: warp the view point to the new position
===============
*/
-bool MiniMap::View::handle_mousepress(const Uint8 btn, int32_t x, int32_t y) {
+bool MiniMap::View::handle_mousepress(const uint8_t btn, int32_t x, int32_t y) {
if (btn != SDL_BUTTON_LEFT)
return false;
@@ -105,7 +105,7 @@
return true;
}
-bool MiniMap::View::handle_mouserelease(Uint8 const btn, int32_t, int32_t) {
+bool MiniMap::View::handle_mouserelease(uint8_t const btn, int32_t, int32_t) {
return btn == SDL_BUTTON_LEFT;
}
=== modified file 'src/wui/minimap.h'
--- src/wui/minimap.h 2014-07-05 16:41:51 +0000
+++ src/wui/minimap.h 2014-07-13 14:48:31 +0000
@@ -68,8 +68,8 @@
void draw(RenderTarget &) override;
- bool handle_mousepress (Uint8 btn, int32_t x, int32_t y) override;
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mousepress (uint8_t btn, int32_t x, int32_t y) override;
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
void set_zoom(int32_t z);
=== modified file 'src/wui/soldierlist.cc'
--- src/wui/soldierlist.cc 2014-07-05 12:17:03 +0000
+++ src/wui/soldierlist.cc 2014-07-13 14:48:31 +0000
@@ -60,8 +60,8 @@
protected:
virtual void handle_mousein(bool inside) override;
- virtual bool handle_mousemove(Uint8 state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
- virtual bool handle_mousepress(Uint8 btn, int32_t x, int32_t y) override;
+ virtual bool handle_mousemove(uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
+ virtual bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
private:
Point calc_pos(uint32_t row, uint32_t col) const;
@@ -330,7 +330,7 @@
}
bool SoldierPanel::handle_mousemove
- (Uint8 /* state */,
+ (uint8_t /* state */,
int32_t x,
int32_t y,
int32_t /* xdiff */,
@@ -341,7 +341,7 @@
return true;
}
-bool SoldierPanel::handle_mousepress(Uint8 btn, int32_t x, int32_t y)
+bool SoldierPanel::handle_mousepress(uint8_t btn, int32_t x, int32_t y)
{
if (btn == SDL_BUTTON_LEFT) {
if (m_click_fn) {
=== modified file 'src/wui/story_message_box.cc'
--- src/wui/story_message_box.cc 2014-07-05 14:22:44 +0000
+++ src/wui/story_message_box.cc 2014-07-13 14:48:31 +0000
@@ -90,7 +90,7 @@
* Avoid being closed by right click
*/
bool Story_Message_Box::handle_mousepress
- (const Uint8 btn, int32_t mx, int32_t my)
+ (const uint8_t btn, int32_t mx, int32_t my)
{
if (btn == SDL_BUTTON_RIGHT)
return true;
=== modified file 'src/wui/story_message_box.h'
--- src/wui/story_message_box.h 2014-07-05 16:41:51 +0000
+++ src/wui/story_message_box.h 2014-07-13 14:48:31 +0000
@@ -30,7 +30,7 @@
const std::string &, const std::string &, const std::string &,
int32_t gposx, int32_t gposy, uint32_t w, uint32_t h);
- bool handle_mousepress(Uint8 btn, int32_t mx, int32_t my) override;
+ bool handle_mousepress(uint8_t btn, int32_t mx, int32_t my) override;
private:
void clicked_ok();
=== modified file 'src/wui/waresdisplay.cc'
--- src/wui/waresdisplay.cc 2014-07-05 13:28:20 +0000
+++ src/wui/waresdisplay.cc 2014-07-13 14:48:31 +0000
@@ -139,7 +139,7 @@
return UI::Panel::handle_mousepress(btn, x, y);
}
-bool AbstractWaresDisplay::handle_mouserelease(Uint8 btn, int32_t x, int32_t y)
+bool AbstractWaresDisplay::handle_mouserelease(uint8_t btn, int32_t x, int32_t y)
{
if (btn != SDL_BUTTON_LEFT || m_selection_anchor == Widelands::INVALID_INDEX) {
return UI::Panel::handle_mouserelease(btn, x, y);
=== modified file 'src/wui/waresdisplay.h'
--- src/wui/waresdisplay.h 2014-07-05 16:41:51 +0000
+++ src/wui/waresdisplay.h 2014-07-13 14:48:31 +0000
@@ -56,7 +56,7 @@
bool handle_mousemove
(uint8_t state, int32_t x, int32_t y, int32_t xdiff, int32_t ydiff) override;
bool handle_mousepress(uint8_t btn, int32_t x, int32_t y) override;
- bool handle_mouserelease(Uint8 btn, int32_t x, int32_t y) override;
+ bool handle_mouserelease(uint8_t btn, int32_t x, int32_t y) override;
// Wares may be selected (highlighted)
void select_ware(Widelands::Ware_Index);
Follow ups