changeset 35:8e1241156034

Misc: various style update
author David Demelier <markand@malikania.fr>
date Fri, 01 Jul 2016 13:32:08 +0200
parents 3a6769c1d1e7
children 9af360f34c7d
files libclient/malikania/animator.cpp libclient/malikania/backend/sdl/font-backend.cpp libclient/malikania/backend/sdl/image-backend.cpp libclient/malikania/backend/sdl/window-backend.cpp libclient/malikania/client-resources-loader.cpp libclient/malikania/color.cpp libclient/malikania/js-animation.cpp libclient/malikania/js-animator.cpp libclient/malikania/js-color.cpp libclient/malikania/js-font.cpp libclient/malikania/js-image.cpp libclient/malikania/js-line.cpp libclient/malikania/js-point.cpp libclient/malikania/js-rectangle.cpp libclient/malikania/js-size.cpp libclient/malikania/js-sprite.cpp libclient/malikania/js-window.cpp libclient/malikania/sprite.cpp libclient/malikania/window.hpp libcommon/malikania/backend/sdl/common-sdl.cpp libcommon/malikania/backend/sdl/common-sdl.hpp libcommon/malikania/id.hpp libcommon/malikania/js-elapsed-timer.cpp libcommon/malikania/resources-locator.cpp
diffstat 24 files changed, 273 insertions(+), 345 deletions(-) [+]
line wrap: on
line diff
--- a/libclient/malikania/animator.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/animator.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -30,9 +30,8 @@
 {
     unsigned total = m_animation.sprite().rows() * m_animation.sprite().columns();
 
-    if (m_current >= total) {
+    if (m_current >= total)
         return;
-    }
 
     if (m_timer.elapsed() >= m_animation[m_current].delay()) {
         m_current ++;
@@ -43,9 +42,8 @@
 void Animator::draw(Window &window, const Point &point)
 {
     // TODO: assert ?
-    if (m_current >= m_animation.sprite().rows() * m_animation.sprite().columns()) {
+    if (m_current >= m_animation.sprite().rows() * m_animation.sprite().columns())
         return;
-    }
 
     m_animation.sprite().draw(window, m_current, point);
 }
--- a/libclient/malikania/backend/sdl/font-backend.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/backend/sdl/font-backend.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -30,28 +30,25 @@
 Font::Backend::Backend(std::string data, unsigned size)
     : m_font(nullptr, nullptr)
 {
-    auto rw = sdl::RWFromBinary(std::move(data));
+    auto rw = SDLx_RWFromBinary(std::move(data));
 
-    if (rw == nullptr) {
+    if (rw == nullptr)
         throw std::runtime_error(SDL_GetError());
-    }
 
     m_font = Handle(TTF_OpenFontRW(rw, true, size), TTF_CloseFont);
 
-    if (m_font == NULL) {
+    if (m_font == NULL)
         throw std::runtime_error(TTF_GetError());
-    }
 }
 
 Size Font::Backend::clip(const Font &, const std::string &text) const
 {
     int width, height;
 
-    if (TTF_SizeUTF8(m_font.get(), text.c_str(), &width, &height) != 0) {
+    if (TTF_SizeUTF8(m_font.get(), text.c_str(), &width, &height) != 0)
         throw std::runtime_error(SDL_GetError());
-    }
 
-    return Size((unsigned)width, (unsigned)height);
+    return Size(static_cast<unsigned>(width), static_cast<unsigned>(height));
 }
 
 } // !malikania
--- a/libclient/malikania/backend/sdl/image-backend.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/backend/sdl/image-backend.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -31,80 +31,73 @@
 {
     m_texture = Texture(SDL_CreateTextureFromSurface(window.backend().renderer(), m_surface.get()), SDL_DestroyTexture);
 
-    if (m_texture == nullptr) {
+    if (m_texture == nullptr)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 Image::Backend::Backend(Image &, std::string data)
     : m_surface(nullptr, nullptr)
     , m_texture(nullptr, nullptr)
 {
-    /* Initialize the texture */
-    auto rw = sdl::RWFromBinary(std::move(data));
+    // Initialize the texture.
+    auto rw = SDLx_RWFromBinary(std::move(data));
 
-    if (rw == nullptr) {
+    if (rw == nullptr)
         throw std::runtime_error(SDL_GetError());
-    }
 
     m_surface = Surface(IMG_Load_RW(rw, true), SDL_FreeSurface);
 
-    if (!m_surface) {
+    if (!m_surface)
         throw std::runtime_error(SDL_GetError());
-    }
 
-    m_size = Size((unsigned)m_surface->w, (unsigned)m_surface->h);
+    m_size = Size(static_cast<unsigned>(m_surface->w), static_cast<unsigned>(m_surface->h));
 }
 
 void Image::Backend::draw(Window &window, const Point &point)
 {
-    if (!m_texture) {
+    if (!m_texture)
         createTexture(window);
-    }
 
     SDL_Rect target;
 
-    target.x = (int)point.x();
-    target.y = (int)point.y();
-    target.w = (int)m_size.width();
-    target.h = (int)m_size.height();
+    target.x = static_cast<int>(point.x());
+    target.y = static_cast<int>(point.y());
+    target.w = static_cast<int>(m_size.width());
+    target.h = static_cast<int>(m_size.height());
 
-    if (SDL_RenderCopy(window.backend().renderer(), m_texture.get(), nullptr, &target) < 0) {
+    if (SDL_RenderCopy(window.backend().renderer(), m_texture.get(), nullptr, &target) < 0)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 void Image::Backend::draw(Window &window, const Rectangle &source, const Rectangle &target)
 {
-    if (!m_texture) {
+    if (!m_texture)
         createTexture(window);
-    }
 
     SDL_Rect sr, st;
 
     sr.x = source.x();
     sr.y = source.y();
-    sr.w = (int)source.width();
-    sr.h = (int)source.height();
+    sr.w = static_cast<int>(source.width());
+    sr.h = static_cast<int>(source.height());
 
     st.x = target.x();
     st.y = target.y();
-    st.w = (int)target.width();
-    st.h = (int)target.height();
+    st.w = static_cast<int>(target.width());
+    st.h = static_cast<int>(target.height());
 
     /* Readjust .w, .h if null */
     if (source.isNull()) {
-        sr.w = (int)m_size.width();
-        sr.h = (int)m_size.height();
+        sr.w = static_cast<int>(m_size.width());
+        sr.h = static_cast<int>(m_size.height());
     }
     if (target.isNull()) {
-        st.w = (int)m_size.width();
-        st.h = (int)m_size.height();
+        st.w = static_cast<int>(m_size.width());
+        st.h = static_cast<int>(m_size.height());
     }
 
-    if (SDL_RenderCopy(window.backend().renderer(), m_texture.get(), &sr, &st) < 0) {
+    if (SDL_RenderCopy(window.backend().renderer(), m_texture.get(), &sr, &st) < 0)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 } // !malikania
--- a/libclient/malikania/backend/sdl/window-backend.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/backend/sdl/window-backend.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -43,23 +43,20 @@
         SDL_DestroyWindow
     );
 
-    if (m_window == nullptr) {
+    if (m_window == nullptr)
         throw std::runtime_error(SDL_GetError());
-    }
 
-    // Create renderer
+    // Create renderer.
     m_renderer = RendererHandle(
         SDL_CreateRenderer(m_window.get(), -1, SDL_RENDERER_ACCELERATED | SDL_RENDERER_PRESENTVSYNC),
         SDL_DestroyRenderer
     );
 
-    if (m_renderer == nullptr) {
+    if (m_renderer == nullptr)
         throw std::runtime_error(SDL_GetError());
-    }
 
-    if (TTF_Init() == -1) {
+    if (TTF_Init() == -1)
         throw std::runtime_error(TTF_GetError());
-    }
 }
 
 void Window::Backend::poll(Window &self)
@@ -123,102 +120,90 @@
 {
     SDL_Color color;
 
-    if (SDL_GetRenderDrawColor(m_renderer.get(), &color.r, &color.g, &color.b, &color.a) < 0) {
+    if (SDL_GetRenderDrawColor(m_renderer.get(), &color.r, &color.g, &color.b, &color.a) < 0)
         throw std::runtime_error(SDL_GetError());
-    }
 
     return Color(color.r, color.g, color.b, color.a);
 }
 
 void Window::Backend::setDrawingColor(const Color &color)
 {
-    if (SDL_SetRenderDrawColor(m_renderer.get(), color.red(), color.green(), color.blue(), color.alpha()) < 0) {
+    if (SDL_SetRenderDrawColor(m_renderer.get(), color.red(), color.green(), color.blue(), color.alpha()) < 0)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 void Window::Backend::drawLine(const Line &line)
 {
-    if (SDL_RenderDrawLine(m_renderer.get(), line.x1(), line.y1(), line.x2(), line.y2()) != 0) {
+    if (SDL_RenderDrawLine(m_renderer.get(), line.x1(), line.y1(), line.x2(), line.y2()) != 0)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 void Window::Backend::drawLines(const std::vector<Point> &points)
 {
     std::vector<SDL_Point> sdlPoints(points.size());
 
-    for (unsigned i = 0; i < points.size(); ++i) {
+    for (unsigned i = 0; i < points.size(); ++i)
         sdlPoints[i] = SDL_Point{points[i].x(), points[i].y()};
-    }
 
-    if (SDL_RenderDrawLines(m_renderer.get(), sdlPoints.data(), sdlPoints.size()) < 0) {
+    if (SDL_RenderDrawLines(m_renderer.get(), sdlPoints.data(), sdlPoints.size()) < 0)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 void Window::Backend::drawPoint(const Point &point)
 {
-    if (SDL_RenderDrawPoint(m_renderer.get(), point.x(), point.y()) != 0) {
+    if (SDL_RenderDrawPoint(m_renderer.get(), point.x(), point.y()) != 0)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 void Window::Backend::drawPoints(const std::vector<Point> &points)
 {
     std::vector<SDL_Point> sdlPoints(points.size());
 
-    for (unsigned i = 0; i < points.size(); ++i) {
+    for (unsigned i = 0; i < points.size(); ++i)
         sdlPoints[i] = SDL_Point{points[i].x(), points[i].y()};
-    }
 
-    if (SDL_RenderDrawPoints(m_renderer.get(), sdlPoints.data(), sdlPoints.size()) != 0) {
+    if (SDL_RenderDrawPoints(m_renderer.get(), sdlPoints.data(), sdlPoints.size()) != 0)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 void Window::Backend::drawRectangle(const Rectangle &rectangle)
 {
-    SDL_Rect rect{rectangle.x(), rectangle.y(), (int)rectangle.width(), (int)rectangle.height()};
+    SDL_Rect rect{rectangle.x(), rectangle.y(), static_cast<int>(rectangle.width()), static_cast<int>(rectangle.height())};
 
-    if (SDL_RenderDrawRect(m_renderer.get(), &rect) < 0) {
+    if (SDL_RenderDrawRect(m_renderer.get(), &rect) < 0)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 void Window::Backend::drawRectangles(const std::vector<Rectangle> &rectangles)
 {
     std::vector<SDL_Rect> sdlRects(rectangles.size());
 
-    for (unsigned i = 0; i < rectangles.size(); ++i) {
-        sdlRects[i] = SDL_Rect{rectangles[i].x(), rectangles[i].y(), (int)rectangles[i].width(), (int)rectangles[i].height()};
-    }
+    for (unsigned i = 0; i < rectangles.size(); ++i)
+        sdlRects[i] = SDL_Rect{rectangles[i].x(), rectangles[i].y(),
+                               static_cast<int>(rectangles[i].width()), static_cast<int>(rectangles[i].height())};
 
-    if (SDL_RenderDrawRects(m_renderer.get(), sdlRects.data(), sdlRects.size()) != 0) {
+    if (SDL_RenderDrawRects(m_renderer.get(), sdlRects.data(), sdlRects.size()) != 0)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 void Window::Backend::fillRectangle(const Rectangle &rectangle)
 {
-    SDL_Rect rect{rectangle.x(), rectangle.y(), (int)rectangle.width(), (int)rectangle.height()};
+    SDL_Rect rect{rectangle.x(), rectangle.y(), static_cast<int>(rectangle.width()), static_cast<int>(rectangle.height())};
 
-    if (SDL_RenderFillRect(m_renderer.get(), &rect) < 0) {
+    if (SDL_RenderFillRect(m_renderer.get(), &rect) < 0)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 void Window::Backend::fillRectangles(const std::vector<Rectangle> &rectangles)
 {
     std::vector<SDL_Rect> sdlRects(rectangles.size());
 
-    for (unsigned i = 0; i < rectangles.size(); ++i) {
-        sdlRects[i] = SDL_Rect{rectangles[i].x(), rectangles[i].y(), (int)rectangles[i].width(), (int)rectangles[i].height()};
-    }
+    for (unsigned i = 0; i < rectangles.size(); ++i)
+        sdlRects[i] = SDL_Rect{rectangles[i].x(), rectangles[i].y(),
+                               static_cast<int>(rectangles[i].width()), static_cast<int>(rectangles[i].height())};
 
-    if (SDL_RenderFillRects(m_renderer.get(), sdlRects.data(), sdlRects.size()) != 0) {
+    if (SDL_RenderFillRects(m_renderer.get(), sdlRects.data(), sdlRects.size()) != 0)
         throw std::runtime_error(SDL_GetError());
-    }
 }
 
 void Window::Backend::drawText(const std::string &text, Font &font, const Rectangle &rectangle)
--- a/libclient/malikania/client-resources-loader.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/client-resources-loader.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -90,7 +90,7 @@
 
     Sprite sprite = loadSprite(requireString(id, value, "sprite"));
 
-    /* Load all frames */
+    // Load all frames.
     json property = value["frames"];
 
     if (!property.is_array())
--- a/libclient/malikania/color.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/color.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -35,12 +35,10 @@
  */
 std::uint8_t value(char digit)
 {
-    if (std::isdigit(digit)) {
+    if (std::isdigit(digit))
         return digit - '0';
-    }
-    if ((digit = std::toupper(digit)) < 'A' || digit > 'F') {
+    if ((digit = std::toupper(digit)) < 'A' || digit > 'F')
         throw std::invalid_argument("invalid hexadecimal value: " + std::to_string(digit));
-    }
 
     return digit - 55;
 }
@@ -51,154 +49,154 @@
 }
 
 const std::unordered_map<std::string, std::uint32_t> colors{
-    { "aliceblue",        rgb(240, 248, 255)    },
-    { "antiquewhite",    rgb(250, 235, 215)    },
-    { "aqua",        rgb( 0, 255, 255)    },
-    { "aquamarine",        rgb(127, 255, 212)    },
-    { "azure",        rgb(240, 255, 255)    },
-    { "beige",        rgb(245, 245, 220)    },
-    { "bisque",        rgb(255, 228, 196)    },
-    { "black",        rgb( 0, 0, 0)        },
-    { "blanchedalmond",    rgb(255, 235, 205)    },
-    { "blue",        rgb( 0, 0, 255)        },
-    { "blueviolet",        rgb(138, 43, 226)    },
-    { "brown",        rgb(165, 42, 42)    },
-    { "burlywood",        rgb(222, 184, 135)    },
-    { "cadetblue",        rgb( 95, 158, 160)    },
-    { "chartreuse",        rgb(127, 255, 0)    },
-    { "chocolate",        rgb(210, 105, 30)    },
-    { "coral",        rgb(255, 127, 80)    },
-    { "cornflowerblue",    rgb(100, 149, 237)    },
-    { "cornsilk",        rgb(255, 248, 220)    },
-    { "crimson",        rgb(220, 20, 60)    },
-    { "cyan",        rgb( 0, 255, 255)    },
-    { "darkblue",        rgb( 0, 0, 139)        },
-    { "darkcyan",        rgb( 0, 139, 139)    },
-    { "darkgoldenrod",    rgb(184, 134, 11)    },
-    { "darkgray",        rgb(169, 169, 169)    },
-    { "darkgreen",        rgb( 0, 100, 0)        },
-    { "darkgrey",        rgb(169, 169, 169)    },
-    { "darkkhaki",        rgb(189, 183, 107)    },
-    { "darkmagenta",    rgb(139, 0, 139)    },
-    { "darkolivegreen",    rgb( 85, 107, 47)    },
-    { "darkorange",        rgb(255, 140, 0)    },
-    { "darkorchid",        rgb(153, 50, 204)    },
-    { "darkred",        rgb(139, 0, 0)        },
-    { "darksalmon",        rgb(233, 150, 122)    },
-    { "darkseagreen",    rgb(143, 188, 143)    },
-    { "darkslateblue",    rgb( 72, 61, 139)    },
-    { "darkslategray",    rgb( 47, 79, 79)    },
-    { "darkslategrey",    rgb( 47, 79, 79)    },
-    { "darkturquoise",    rgb( 0, 206, 209)    },
-    { "darkviolet",        rgb(148, 0, 211)    },
-    { "deeppink",        rgb(255, 20, 147)    },
-    { "deepskyblue",    rgb( 0, 191, 255)    },
-    { "dimgray",        rgb(105, 105, 105)    },
-    { "dimgrey",        rgb(105, 105, 105)    },
-    { "dodgerblue",        rgb( 30, 144, 255)    },
-    { "firebrick",        rgb(178, 34, 34)    },
-    { "floralwhite",    rgb(255, 250, 240)    },
-    { "forestgreen",    rgb( 34, 139, 34)    },
-    { "fuchsia",        rgb(255, 0, 255)    },
-    { "gainsboro",        rgb(220, 220, 220)    },
-    { "ghostwhite",        rgb(248, 248, 255)    },
-    { "gold",        rgb(255, 215, 0)    },
-    { "goldenrod",        rgb(218, 165, 32)    },
-    { "gray",        rgb(128, 128, 128)    },
-    { "green",        rgb( 0, 128, 0)        },
-    { "greenyellow",    rgb(173, 255, 47)    },
-    { "grey",        rgb(128, 128, 128)    },
-    { "honeydew",        rgb(240, 255, 240)    },
-    { "hotpink",        rgb(255, 105, 180)    },
-    { "indianred",        rgb(205, 92, 92)    },
-    { "indigo",        rgb( 75, 0, 130)    },
-    { "ivory",        rgb(255, 255, 240)    },
-    { "khaki",        rgb(240, 230, 140)    },
-    { "lavender",        rgb(230, 230, 250)    },
-    { "lavenderblush",    rgb(255, 240, 245)    },
-    { "lawngreen",        rgb(124, 252, 0)    },
-    { "lemonchiffon",    rgb(255, 250, 205)    },
-    { "lightblue",        rgb(173, 216, 230)    },
-    { "lightcoral",        rgb(240, 128, 128)    },
-    { "lightcyan",        rgb(224, 255, 255)    },
-    { "lightgoldenrodyellow", rgb(250, 250, 210)    },
-    { "lightgray",        rgb(211, 211, 211)    },
-    { "lightgreen",        rgb(144, 238, 144)    },
-    { "lightgrey",        rgb(211, 211, 211)    },
-    { "lightpink",        rgb(255, 182, 193)    },
-    { "lightsalmon",    rgb(255, 160, 122)    },
-    { "lightseagreen",    rgb( 32, 178, 170)    },
-    { "lightskyblue",    rgb(135, 206, 250)    },
-    { "lightslategray",    rgb(119, 136, 153)    },
-    { "lightslategrey",    rgb(119, 136, 153)    },
-    { "lightsteelblue",    rgb(176, 196, 222)    },
-    { "lightyellow",    rgb(255, 255, 224)    },
-    { "lime",        rgb( 0, 255, 0)        },
-    { "limegreen",        rgb( 50, 205, 50)    },
-    { "linen",        rgb(250, 240, 230)    },
-    { "magenta",        rgb(255, 0, 255)    },
-    { "maroon",        rgb(128, 0, 0)        },
-    { "mediumaquamarine",    rgb(102, 205, 170)    },
-    { "mediumblue",        rgb( 0, 0, 205)        },
-    { "mediumorchid",    rgb(186, 85, 211)    },
-    { "mediumpurple",    rgb(147, 112, 219)    },
-    { "mediumseagreen",    rgb( 60, 179, 113)    },
-    { "mediumslateblue",    rgb(123, 104, 238)    },
-    { "mediumspringgreen",    rgb( 0, 250, 154)    },
-    { "mediumturquoise",    rgb( 72, 209, 204)    },
-    { "mediumvioletred",    rgb(199, 21, 133)    },
-    { "midnightblue",    rgb( 25, 25, 112)    },
-    { "mintcream",        rgb(245, 255, 250)    },
-    { "mistyrose",        rgb(255, 228, 225)    },
-    { "moccasin",        rgb(255, 228, 181)    },
-    { "navajowhite",    rgb(255, 222, 173)    },
-    { "navy",        rgb( 0, 0, 128)        },
-    { "oldlace",        rgb(253, 245, 230)    },
-    { "olive",        rgb(128, 128, 0)    },
-    { "olivedrab",        rgb(107, 142, 35)    },
-    { "orange",        rgb(255, 165, 0)    },
-    { "orangered",        rgb(255, 69, 0)        },
-    { "orchid",        rgb(218, 112, 214)    },
-    { "palegoldenrod",    rgb(238, 232, 170)    },
-    { "palegreen",        rgb(152, 251, 152)    },
-    { "paleturquoise",    rgb(175, 238, 238)    },
-    { "palevioletred",    rgb(219, 112, 147)    },
-    { "papayawhip",        rgb(255, 239, 213)    },
-    { "peachpuff",        rgb(255, 218, 185)    },
-    { "peru",        rgb(205, 133, 63)    },
-    { "pink",        rgb(255, 192, 203)    },
-    { "plum",        rgb(221, 160, 221)    },
-    { "powderblue",        rgb(176, 224, 230)    },
-    { "purple",        rgb(128, 0, 128)    },
-    { "red",        rgb(255, 0, 0)        },
-    { "rosybrown",        rgb(188, 143, 143)    },
-    { "royalblue",        rgb( 65, 105, 225)    },
-    { "saddlebrown",    rgb(139, 69, 19)    },
-    { "salmon",        rgb(250, 128, 114)    },
-    { "sandybrown",        rgb(244, 164, 96)    },
-    { "seagreen",        rgb( 46, 139, 87)    },
-    { "seashell",        rgb(255, 245, 238)    },
-    { "sienna",        rgb(160, 82, 45)    },
-    { "silver",        rgb(192, 192, 192)    },
-    { "skyblue",        rgb(135, 206, 235)    },
-    { "slateblue",        rgb(106, 90, 205)    },
-    { "slategray",        rgb(112, 128, 144)    },
-    { "slategrey",        rgb(112, 128, 144)    },
-    { "snow",        rgb(255, 250, 250)    },
-    { "springgreen",    rgb( 0, 255, 127)    },
-    { "steelblue",        rgb( 70, 130, 180)    },
-    { "tan",        rgb(210, 180, 140)    },
-    { "teal",        rgb( 0, 128, 128)    },
-    { "thistle",        rgb(216, 191, 216)    },
-    { "tomato",        rgb(255, 99, 71)    },
-    { "transparent",    0            },
-    { "turquoise",        rgb( 64, 224, 208)    },
-    { "violet",        rgb(238, 130, 238)    },
-    { "wheat",        rgb(245, 222, 179)    },
-    { "white",        rgb(255, 255, 255)    },
-    { "whitesmoke",        rgb(245, 245, 245)    },
-    { "yellow",        rgb(255, 255, 0)    },
-    { "yellowgreen",    rgb(154, 205, 50)    }
+    { "aliceblue",              rgb(240, 248, 255)  },
+    { "antiquewhite",           rgb(250, 235, 215)  },
+    { "aqua",                   rgb( 0, 255, 255)   },
+    { "aquamarine",             rgb(127, 255, 212)  },
+    { "azure",                  rgb(240, 255, 255)  },
+    { "beige",                  rgb(245, 245, 220)  },
+    { "bisque",                 rgb(255, 228, 196)  },
+    { "black",                  rgb( 0, 0, 0)       },
+    { "blanchedalmond",         rgb(255, 235, 205)  },
+    { "blue",                   rgb( 0, 0, 255)     },
+    { "blueviolet",             rgb(138, 43, 226)   },
+    { "brown",                  rgb(165, 42, 42)    },
+    { "burlywood",              rgb(222, 184, 135)  },
+    { "cadetblue",              rgb( 95, 158, 160)  },
+    { "chartreuse",             rgb(127, 255, 0)    },
+    { "chocolate",              rgb(210, 105, 30)   },
+    { "coral",                  rgb(255, 127, 80)   },
+    { "cornflowerblue",         rgb(100, 149, 237)  },
+    { "cornsilk",               rgb(255, 248, 220)  },
+    { "crimson",                rgb(220, 20, 60)    },
+    { "cyan",                   rgb( 0, 255, 255)   },
+    { "darkblue",               rgb( 0, 0, 139)     },
+    { "darkcyan",               rgb( 0, 139, 139)   },
+    { "darkgoldenrod",          rgb(184, 134, 11)   },
+    { "darkgray",               rgb(169, 169, 169)  },
+    { "darkgreen",              rgb( 0, 100, 0)     },
+    { "darkgrey",               rgb(169, 169, 169)  },
+    { "darkkhaki",              rgb(189, 183, 107)  },
+    { "darkmagenta",            rgb(139, 0, 139)    },
+    { "darkolivegreen",         rgb( 85, 107, 47)   },
+    { "darkorange",             rgb(255, 140, 0)    },
+    { "darkorchid",             rgb(153, 50, 204)   },
+    { "darkred",                rgb(139, 0, 0)      },
+    { "darksalmon",             rgb(233, 150, 122)  },
+    { "darkseagreen",           rgb(143, 188, 143)  },
+    { "darkslateblue",          rgb( 72, 61, 139)   },
+    { "darkslategray",          rgb( 47, 79, 79)    },
+    { "darkslategrey",          rgb( 47, 79, 79)    },
+    { "darkturquoise",          rgb( 0, 206, 209)   },
+    { "darkviolet",             rgb(148, 0, 211)    },
+    { "deeppink",               rgb(255, 20, 147)   },
+    { "deepskyblue",            rgb( 0, 191, 255)   },
+    { "dimgray",                rgb(105, 105, 105)  },
+    { "dimgrey",                rgb(105, 105, 105)  },
+    { "dodgerblue",             rgb( 30, 144, 255)  },
+    { "firebrick",              rgb(178, 34, 34)    },
+    { "floralwhite",            rgb(255, 250, 240)  },
+    { "forestgreen",            rgb( 34, 139, 34)   },
+    { "fuchsia",                rgb(255, 0, 255)    },
+    { "gainsboro",              rgb(220, 220, 220)  },
+    { "ghostwhite",             rgb(248, 248, 255)  },
+    { "gold",                   rgb(255, 215, 0)    },
+    { "goldenrod",              rgb(218, 165, 32)   },
+    { "gray",                   rgb(128, 128, 128)  },
+    { "green",                  rgb( 0, 128, 0)     },
+    { "greenyellow",            rgb(173, 255, 47)   },
+    { "grey",                   rgb(128, 128, 128)  },
+    { "honeydew",               rgb(240, 255, 240)  },
+    { "hotpink",                rgb(255, 105, 180)  },
+    { "indianred",              rgb(205, 92, 92)    },
+    { "indigo",                 rgb( 75, 0, 130)    },
+    { "ivory",                  rgb(255, 255, 240)  },
+    { "khaki",                  rgb(240, 230, 140)  },
+    { "lavender",               rgb(230, 230, 250)  },
+    { "lavenderblush",          rgb(255, 240, 245)  },
+    { "lawngreen",              rgb(124, 252, 0)    },
+    { "lemonchiffon",           rgb(255, 250, 205)  },
+    { "lightblue",              rgb(173, 216, 230)  },
+    { "lightcoral",             rgb(240, 128, 128)  },
+    { "lightcyan",              rgb(224, 255, 255)  },
+    { "lightgoldenrodyellow",   rgb(250, 250, 210)  },
+    { "lightgray",              rgb(211, 211, 211)  },
+    { "lightgreen",             rgb(144, 238, 144)  },
+    { "lightgrey",              rgb(211, 211, 211)  },
+    { "lightpink",              rgb(255, 182, 193)  },
+    { "lightsalmon",            rgb(255, 160, 122)  },
+    { "lightseagreen",          rgb( 32, 178, 170)  },
+    { "lightskyblue",           rgb(135, 206, 250)  },
+    { "lightslategray",         rgb(119, 136, 153)  },
+    { "lightslategrey",         rgb(119, 136, 153)  },
+    { "lightsteelblue",         rgb(176, 196, 222)  },
+    { "lightyellow",            rgb(255, 255, 224)  },
+    { "lime",                   rgb( 0, 255, 0)     },
+    { "limegreen",              rgb( 50, 205, 50)   },
+    { "linen",                  rgb(250, 240, 230)  },
+    { "magenta",                rgb(255, 0, 255)    },
+    { "maroon",                 rgb(128, 0, 0)      },
+    { "mediumaquamarine",       rgb(102, 205, 170)  },
+    { "mediumblue",             rgb( 0, 0, 205)     },
+    { "mediumorchid",           rgb(186, 85, 211)   },
+    { "mediumpurple",           rgb(147, 112, 219)  },
+    { "mediumseagreen",         rgb( 60, 179, 113)  },
+    { "mediumslateblue",        rgb(123, 104, 238)  },
+    { "mediumspringgreen",      rgb( 0, 250, 154)   },
+    { "mediumturquoise",        rgb( 72, 209, 204)  },
+    { "mediumvioletred",        rgb(199, 21, 133)   },
+    { "midnightblue",           rgb( 25, 25, 112)   },
+    { "mintcream",              rgb(245, 255, 250)  },
+    { "mistyrose",              rgb(255, 228, 225)  },
+    { "moccasin",               rgb(255, 228, 181)  },
+    { "navajowhite",            rgb(255, 222, 173)  },
+    { "navy",                   rgb( 0, 0, 128)     },
+    { "oldlace",                rgb(253, 245, 230)  },
+    { "olive",                  rgb(128, 128, 0)    },
+    { "olivedrab",              rgb(107, 142, 35)   },
+    { "orange",                 rgb(255, 165, 0)    },
+    { "orangered",              rgb(255, 69, 0)     },
+    { "orchid",                 rgb(218, 112, 214)  },
+    { "palegoldenrod",          rgb(238, 232, 170)  },
+    { "palegreen",              rgb(152, 251, 152)  },
+    { "paleturquoise",          rgb(175, 238, 238)  },
+    { "palevioletred",          rgb(219, 112, 147)  },
+    { "papayawhip",             rgb(255, 239, 213)  },
+    { "peachpuff",              rgb(255, 218, 185)  },
+    { "peru",                   rgb(205, 133, 63)   },
+    { "pink",                   rgb(255, 192, 203)  },
+    { "plum",                   rgb(221, 160, 221)  },
+    { "powderblue",             rgb(176, 224, 230)  },
+    { "purple",                 rgb(128, 0, 128)    },
+    { "red",                    rgb(255, 0, 0)      },
+    { "rosybrown",              rgb(188, 143, 143)  },
+    { "royalblue",              rgb( 65, 105, 225)  },
+    { "saddlebrown",            rgb(139, 69, 19)    },
+    { "salmon",                 rgb(250, 128, 114)  },
+    { "sandybrown",             rgb(244, 164, 96)   },
+    { "seagreen",               rgb( 46, 139, 87)   },
+    { "seashell",               rgb(255, 245, 238)  },
+    { "sienna",                 rgb(160, 82, 45)    },
+    { "silver",                 rgb(192, 192, 192)  },
+    { "skyblue",                rgb(135, 206, 235)  },
+    { "slateblue",              rgb(106, 90, 205)   },
+    { "slategray",              rgb(112, 128, 144)  },
+    { "slategrey",              rgb(112, 128, 144)  },
+    { "snow",                   rgb(255, 250, 250)  },
+    { "springgreen",            rgb( 0, 255, 127)   },
+    { "steelblue",              rgb( 70, 130, 180)  },
+    { "tan",                    rgb(210, 180, 140)  },
+    { "teal",                   rgb( 0, 128, 128)   },
+    { "thistle",                rgb(216, 191, 216)  },
+    { "tomato",                 rgb(255, 99, 71)    },
+    { "transparent",            0                   },
+    { "turquoise",              rgb( 64, 224, 208)  },
+    { "violet",                 rgb(238, 130, 238)  },
+    { "wheat",                  rgb(245, 222, 179)  },
+    { "white",                  rgb(255, 255, 255)  },
+    { "whitesmoke",             rgb(245, 245, 245)  },
+    { "yellow",                 rgb(255, 255, 0)    },
+    { "yellowgreen",            rgb(154, 205, 50)   }
 };
 
 } // !namespace
@@ -206,7 +204,7 @@
 Color::Color(const std::string &name)
 {
     if (!name.empty()) {
-        /* Parse #rrggbb or #rgb */
+        // Parse #rrggbb or #rgb.
         if (name[0] == '#') {
             if (name.length() == 7) {
                 m_red   = value(name[1], name[2]);
@@ -216,18 +214,16 @@
                 m_red   = value(name[1], name[1]);
                 m_green = value(name[2], name[2]);
                 m_blue  = value(name[3], name[3]);
-            } else {
-                throw std::invalid_argument{"invalid format"};
-            }
+            } else
+                throw std::invalid_argument("invalid format");
         } else {
-            /* Name lookup */
+            // Name lookup.
             auto it = colors.find(name);
 
-            if (it == colors.end()) {
-                throw std::invalid_argument{name + " is not a valid color"};
-            }
+            if (it == colors.end())
+                throw std::invalid_argument(name + " is not a valid color");
 
-            /* Assign the color to *this */
+            // Assign the color to *this.
             *this = it->second;
         }
     }
--- a/libclient/malikania/js-animation.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/js-animation.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -27,9 +27,8 @@
 {
     duk::StackAssert sa(ctx);
 
-    if (!duk_is_constructor_call(ctx)) {
+    if (!duk_is_constructor_call(ctx))
         duk::raise(ctx, DUK_ERR_ERROR, "animation must be new-constructed");
-    }
 
     try {
         auto loader = duk::getGlobal<ClientResourcesLoader *>(ctx, "\xff""\xff""loader");
--- a/libclient/malikania/js-animator.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/js-animator.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -27,13 +27,12 @@
 
 duk::Ret constructor(duk::ContextPtr ctx)
 {
-    if (!duk_is_constructor_call(ctx)) {
+    if (!duk_is_constructor_call(ctx))
         duk::raise(ctx, DUK_ERR_ERROR, "animator must be new-constructed");
-    }
 
     duk::construct(ctx, std::make_shared<Animator>(*duk::require<std::shared_ptr<Animation>>(ctx, 0)));
 
-    /* Be sure animation get not collected before */
+    // Be sure animation get not collected before.
     duk::push(ctx, duk::This());
     duk::dup(ctx, 0);
     duk::putProperty(ctx, -2, "\xff""\xff""animation-ref");
--- a/libclient/malikania/js-color.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/js-color.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -28,11 +28,10 @@
 std::uint8_t clampComponent(duk::ContextPtr ctx, int value, bool required)
 {
     if (value < 0 || value > 255) {
-        if (required) {
+        if (required)
             duk::raise(ctx, DUK_ERR_RANGE_ERROR, "%d is out of range (0, 255)", value);
-        } else {
+        else
             value = util::clamp(value, 0, 255);
-        }
     }
 
     return static_cast<std::uint8_t>(value);
@@ -85,9 +84,8 @@
         color = parseObject(ctx, index, required);
         break;
     default:
-        if (required) {
+        if (required)
             duk::raise(ctx, DUK_ERR_TYPE_ERROR, "color (string, object) expected");
-        }
 
         break;
     }
@@ -110,13 +108,12 @@
             clampComponent(ctx, duk::require<int>(ctx, 2), true),
             clampComponent(ctx, duk::optional<int>(ctx, 3, 255), true)
         );
-    } else if (duk::top(ctx) == 1) {
+    } else if (duk::top(ctx) == 1)
         color = parse(ctx, 0, true);
-    }
 
     duk::Ret ret;
 
-    /* Allow both constructor and non constructor calls */
+    // Allow both constructor and non constructor calls.
     if (duk_is_constructor_call(ctx)) {
         duk::push(ctx, duk::This());
         /* TODO: use duk::put when available */
@@ -157,7 +154,6 @@
     duk::push(ctx, Object());
     /* TODO: use duk::put when available */
     duk::TypeTraits<Color>::put(ctx, color);
-
 }
 
 void TypeTraits<Color>::put(ContextPtr ctx, const Color &color)
--- a/libclient/malikania/js-font.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/js-font.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -28,18 +28,16 @@
 {
     duk::StackAssert sa(ctx);
 
-    if (!duk_is_constructor_call(ctx)) {
+    if (!duk_is_constructor_call(ctx))
         duk::raise(ctx, DUK_ERR_ERROR, "font must be new-constructed");
-    }
 
     try {
         auto loader = duk::getGlobal<ClientResourcesLoader *>(ctx, "\xff""\xff""loader");
         auto id = duk::require<std::string>(ctx, 0);
         auto size = duk::require<int>(ctx, 1);
 
-        if (size < 0) {
+        if (size < 0)
             duk::raise(ctx, DUK_ERR_RANGE_ERROR, "%d must not be negative", size);
-        }
 
         duk::construct(ctx, std::make_shared<Font>(loader->loadFont(id, static_cast<unsigned>(size))));
     } catch (const std::exception &ex) {
--- a/libclient/malikania/js-image.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/js-image.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -44,13 +44,12 @@
         auto self = duk::self<std::shared_ptr<Image>>(ctx);
         auto window = duk::get<std::shared_ptr<Window>>(ctx, 0);
 
-        if (duk::top(ctx) == 2) {
+        if (duk::top(ctx) == 2)
             self->draw(*window, duk::get<Point>(ctx, 1));
-        } else if (duk::top(ctx) == 3) {
+        else if (duk::top(ctx) == 3)
             self->draw(*window, duk::get<Rectangle>(ctx, 1), duk::get<Rectangle>(ctx, 2));
-        } else {
+        else
             duk::raise(ctx, DUK_ERR_TYPE_ERROR, "invalid number of arguments: #%d", duk::top(ctx));
-        }
     } catch (const std::exception &ex) {
         duk::raise(ctx, DUK_ERR_ERROR, "%s", ex.what());
     }
--- a/libclient/malikania/js-line.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/js-line.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -33,9 +33,8 @@
             duk::get<int>(ctx, 2),
             duk::get<int>(ctx, 3)
         );
-    } else if (duk::top(ctx) == 1) {
+    } else if (duk::top(ctx) == 1)
         line = duk::require<Line>(ctx, 0);
-    }
 
     duk::Ret ret;
 
@@ -75,9 +74,8 @@
     duk::StackAssert sa(ctx);
 
     auto get = [&] (const std::string &property) -> int {
-        if (!duk::hasProperty(ctx, index, property)) {
+        if (!duk::hasProperty(ctx, index, property))
             duk::raise(ctx, DUK_ERR_ERROR, "missing %s property in line description", property.c_str());
-        }
 
         duk::getProperty<void>(ctx, index, property);
 
--- a/libclient/malikania/js-point.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/js-point.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -27,16 +27,14 @@
     duk::StackAssert sa(ctx);
 
     if (duk::type(ctx, index) == DUK_TYPE_OBJECT){
-        if (required && !duk::hasProperty(ctx, index, "x")) {
+        if (required && !duk::hasProperty(ctx, index, "x"))
             duk::raise(ctx, DUK_ERR_ERROR, "missing x property in point description");
-        } else if (required && !duk::hasProperty(ctx, index, "y")) {
+        else if (required && !duk::hasProperty(ctx, index, "y"))
             duk::raise(ctx, DUK_ERR_ERROR, "missing y property in point description");
-        }
 
         point = Point(duk::getProperty<int>(ctx, index, "x"), duk::getProperty<int>(ctx, index, "y"));
-    } else if (required) {
+    } else if (required)
         duk::raise(ctx, DUK_ERR_TYPE_ERROR, "point object expected");
-    }
 
     return point;
 }
@@ -45,15 +43,14 @@
 {
     Point point;
 
-    if (duk::top(ctx) == 2) {
+    if (duk::top(ctx) == 2)
         point = Point(duk::require<int>(ctx, 0), duk::require<int>(ctx, 1));
-    } else if (duk::top(ctx) == 1) {
+    else if (duk::top(ctx) == 1)
         point = parse(ctx, 0, true);
-    }
 
     duk::Ret ret;
 
-    /* Allow both constructor and non constructor calls */
+    // Allow both constructor and non constructor calls.
     if (duk_is_constructor_call(ctx)) {
         duk::push(ctx, duk::This());
         /* TODO: use duk::put when available */
--- a/libclient/malikania/js-rectangle.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/js-rectangle.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -134,7 +134,7 @@
     duk::putProperty(ctx, -1, "height", static_cast<int>(rect.height()));
 }
 
-} // !duk
+} // !dukl
 
 void loadMalikaniaRectangle(duk::ContextPtr ctx)
 {
--- a/libclient/malikania/js-size.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/js-size.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -25,11 +25,10 @@
 unsigned clamp(duk::ContextPtr ctx, int value, bool required)
 {
     if (value < 0) {
-        if (required) {
+        if (required)
             duk::raise(ctx, DUK_ERR_RANGE_ERROR, "%d can not be negative", value);
-        } else {
+        else
             value = 0;
-        }
     }
 
     return static_cast<unsigned>(value);
@@ -40,19 +39,17 @@
     duk::StackAssert sa(ctx);
 
     if (duk::type(ctx, index) == DUK_TYPE_OBJECT) {
-        if (required && !duk::hasProperty(ctx, index, "width")) {
+        if (required && !duk::hasProperty(ctx, index, "width"))
             duk::raise(ctx, DUK_ERR_ERROR, "missing width property in size description");
-        } else if (required && !duk::hasProperty(ctx, index, "height")) {
+        else if (required && !duk::hasProperty(ctx, index, "height"))
             duk::raise(ctx, DUK_ERR_ERROR, "missing height property in size description");
-        }
 
         size = Size(
             clamp(ctx, duk::getProperty<int>(ctx, index, "width"), required),
             clamp(ctx, duk::getProperty<int>(ctx, index, "height"), required)
         );
-    } else if (required) {
+    } else if (required)
         duk::raise(ctx, DUK_ERR_TYPE_ERROR, "size object expected");
-    }
 
     return size;
 }
@@ -66,13 +63,12 @@
             clamp(ctx, duk::require<int>(ctx, 0), true),
             clamp(ctx, duk::require<int>(ctx, 1), true)
         );
-    } else if (duk::top(ctx) == 1) {
+    } else if (duk::top(ctx) == 1)
         size = parse(ctx, 0, true);
-    }
 
     duk::Ret ret;
 
-    /* Allow both constructor and non constructor calls */
+    // Allow both constructor and non constructor calls.
     if (duk_is_constructor_call(ctx)) {
         duk::push(ctx, duk::This());
         /* TODO: use duk::put when available */
--- a/libclient/malikania/js-sprite.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/js-sprite.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -63,9 +63,8 @@
 
 duk::Ret constructor(duk::ContextPtr ctx)
 {
-    if (!duk_is_constructor_call(ctx)) {
+    if (!duk_is_constructor_call(ctx))
         duk::raise(ctx, DUK_ERR_ERROR, "sprite must be new-constructed");
-    }
 
     try {
         auto loader = duk::getGlobal<ClientResourcesLoader *>(ctx, "\xff""\xff""loader");
@@ -74,27 +73,27 @@
         duk::construct(ctx, std::make_shared<Sprite>(std::move(sprite)));
         duk::push(ctx, duk::This());
 
-        /* Cell */
+        // Cell.
         duk::push(ctx, "cell");
         duk::push(ctx, duk::Function{cell});
         duk::defineProperty(ctx, -3, DUK_DEFPROP_HAVE_GETTER);
 
-        /* Columns */
+        // Columns.
         duk::push(ctx, "columns");
         duk::push(ctx, duk::Function{columns});
         duk::defineProperty(ctx, -3, DUK_DEFPROP_HAVE_GETTER);
 
-        /* Margins */
+        // Margins.
         duk::push(ctx, "margins");
         duk::push(ctx, duk::Function{margins});
         duk::defineProperty(ctx, -3, DUK_DEFPROP_HAVE_GETTER);
 
-        /* Rows */
+        // Rows.
         duk::push(ctx, "rows");
         duk::push(ctx, duk::Function{rows});
         duk::defineProperty(ctx, -3, DUK_DEFPROP_HAVE_GETTER);
 
-        /* Space */
+        // Space.
         duk::push(ctx, "space");
         duk::push(ctx, duk::Function{space});
         duk::defineProperty(ctx, -3, DUK_DEFPROP_HAVE_GETTER);
@@ -115,9 +114,8 @@
         auto cell = duk::require<int>(ctx, 1);
         auto point = duk::get<Point>(ctx, 2);
 
-        if (cell < 0 || cell >= static_cast<int>(self->rows() * self->columns())) {
+        if (cell < 0 || cell >= static_cast<int>(self->rows() * self->columns()))
             duk::raise(ctx, DUK_ERR_RANGE_ERROR, "%d is out of range", cell);
-        }
 
         self->draw(*window, static_cast<unsigned>(cell), point);
     } catch (const std::exception &ex) {
--- a/libclient/malikania/js-window.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/js-window.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -31,9 +31,8 @@
 {
     duk::StackAssert sa(ctx);
 
-    if (!duk_is_constructor_call(ctx)) {
+    if (!duk_is_constructor_call(ctx))
         duk::raise(ctx, DUK_ERR_ERROR, "window must be new-constructed");
-    }
 
     /* TODO: add parameters */
     try {
@@ -152,11 +151,10 @@
         auto font = duk::get<std::shared_ptr<Font>>(ctx, 1);
         auto rect = duk::get<Rectangle>(ctx, 2);
 
-        if (!rect.isNull()) {
+        if (!rect.isNull())
             self->drawText(text, *font, rect);
-        } else {
+        else
             self->drawText(text, *font, Point(rect.x(), rect.y()));
-        }
     } catch (const std::exception &ex) {
         duk::raise(ctx, DUK_ERR_ERROR, "%s", ex.what());
     }
--- a/libclient/malikania/sprite.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/sprite.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -30,12 +30,11 @@
     assert(m_cell.width() > 0);
     assert(m_cell.height() > 0);
 
-    /* If size is not specified, take from image */
-    if (m_size.isNull()) {
+    // If size is not specified, take from image.
+    if (m_size.isNull())
         m_size = m_image.size();
-    }
 
-    /* Compute number of cells */
+    // Compute number of cells.
     m_rows = (m_size.height() - (margin.height() * 2) + m_space.height()) / (m_cell.height() + m_space.height());
     m_columns = (m_size.width() - (m_margin.width() * 2) + m_space.width()) / (m_cell.width() + m_space.width());
 }
@@ -44,11 +43,11 @@
 {
     assert(cell < m_rows * m_columns);
 
-    /* Compute index in the grid */
+    // Compute index in the grid.
     unsigned hindex = (cell % m_columns);
     unsigned vindex = (cell / m_columns);
 
-    /* Compute the pixel boundaries */
+    // Compute the pixel boundaries.
     int x = m_margin.width() + (hindex * m_space.width()) + (hindex * m_cell.width());
     int y = m_margin.height() + (vindex * m_space.height()) + (vindex * m_cell.height());
 
--- a/libclient/malikania/window.hpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libclient/malikania/window.hpp	Fri Jul 01 13:32:08 2016 +0200
@@ -57,23 +57,20 @@
 public:
     inline void onQuit()
     {
-        if (m_onQuit) {
+        if (m_onQuit)
             m_onQuit();
-        }
     }
 
     inline void onKeyDown(unsigned key)
     {
-        if (m_onKeyDown) {
+        if (m_onKeyDown)
             m_onKeyDown(key);
-        }
     }
 
     inline void onKeyUp(unsigned key)
     {
-        if (m_onKeyUp) {
+        if (m_onKeyUp)
             m_onKeyUp(key);
-        }
     }
 
     inline void setOnQuit(std::function<void ()> fn) noexcept
--- a/libcommon/malikania/backend/sdl/common-sdl.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libcommon/malikania/backend/sdl/common-sdl.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -25,8 +25,6 @@
 
 namespace malikania {
 
-namespace sdl {
-
 namespace {
 
 /*
@@ -51,12 +49,12 @@
     }
 };
 
-Sint64 size(SDL_RWops *ops)
+Sint64 size(SDL_RWops *ops) noexcept
 {
     return reinterpret_cast<Buffer *>(ops->hidden.unknown.data1)->m_length;
 }
 
-Sint64 seek(SDL_RWops *ops, Sint64 offset, int whence)
+Sint64 seek(SDL_RWops *ops, Sint64 offset, int whence) noexcept
 {
     Buffer *data = reinterpret_cast<Buffer *>(ops->hidden.unknown.data1);
     Sint64 position = data->m_position;
@@ -83,18 +81,16 @@
     return (data->m_position = position);
 }
 
-size_t read(SDL_RWops *ops, void *dst, size_t size, size_t number)
+size_t read(SDL_RWops *ops, void *dst, std::size_t size, std::size_t number) noexcept
 {
     Buffer *data = reinterpret_cast<Buffer *>(ops->hidden.unknown.data1);
     size_t total = number * size;
     size_t avail = data->m_length - data->m_position;
 
-    if (number <= 0 || size <= 0 || ((total / number) != (size_t)size)) {
+    if (number <= 0 || size <= 0 || ((total / number) != static_cast<std::size_t>(size)))
         return 0;
-    }
-    if (total > avail) {
+    if (total > avail)
         total = avail;
-    }
 
     SDL_memcpy(dst, &data->m_data[data->m_position], total);
 
@@ -103,14 +99,14 @@
     return (total / size);
 }
 
-size_t write(SDL_RWops *, const void *, size_t, size_t)
+size_t write(SDL_RWops *, const void *, size_t, size_t) noexcept
 {
     SDL_SetError("write not supported");
 
     return -1;
 }
 
-int close(SDL_RWops *ops)
+int close(SDL_RWops *ops) noexcept
 {
     if (ops != nullptr) {
         delete reinterpret_cast<Buffer *>(ops->hidden.unknown.data1);
@@ -122,13 +118,12 @@
 
 } // !namespace
 
-SDL_RWops *RWFromBinary(std::string data) noexcept
+SDL_RWops *SDLx_RWFromBinary(std::string data) noexcept
 {
     SDL_RWops *ops = SDL_AllocRW();
 
-    if (ops == nullptr) {
+    if (ops == nullptr)
         return nullptr;
-    }
 
     ops->hidden.unknown.data1 = new (std::nothrow) Buffer(std::move(data));
 
@@ -148,6 +143,4 @@
     return ops;
 }
 
-} // !sdl
-
 } // !malikania
--- a/libcommon/malikania/backend/sdl/common-sdl.hpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libcommon/malikania/backend/sdl/common-sdl.hpp	Fri Jul 01 13:32:08 2016 +0200
@@ -25,8 +25,6 @@
 
 namespace malikania {
 
-namespace sdl {
-
 /**
  * Create a SDL_RWops that owns the binary data.
  *
@@ -40,9 +38,7 @@
  * \param data the data
  * \return the object or nullptr on errors
  */
-SDL_RWops *RWFromBinary(std::string data) noexcept;
-
-} // !sdl
+SDL_RWops *SDLx_RWFromBinary(std::string data) noexcept;
 
 } // !malikania
 
--- a/libcommon/malikania/id.hpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libcommon/malikania/id.hpp	Fri Jul 01 13:32:08 2016 +0200
@@ -83,9 +83,8 @@
         id = m_reusable.top();
         m_reusable.pop();
     } else {
-        if (m_current == std::numeric_limits<T>::max()) {
+        if (m_current == std::numeric_limits<T>::max())
             throw std::out_of_range("no id available");
-        }
 
         id = m_current++;
     }
@@ -98,9 +97,8 @@
 {
     m_current = 0;
 
-    while (!m_reusable.empty()) {
+    while (!m_reusable.empty())
         m_reusable.pop();
-    }
 }
 
 /**
--- a/libcommon/malikania/js-elapsed-timer.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libcommon/malikania/js-elapsed-timer.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -73,7 +73,7 @@
  */
 duk::Ret elapsed(duk::ContextPtr ctx)
 {
-    duk::push(ctx, (int)duk::self<std::shared_ptr<ElapsedTimer>>(ctx)->elapsed());
+    duk::push(ctx, static_cast<int>(duk::self<std::shared_ptr<ElapsedTimer>>(ctx)->elapsed()));
 
     return 1;
 }
--- a/libcommon/malikania/resources-locator.cpp	Wed Jun 29 19:44:19 2016 +0200
+++ b/libcommon/malikania/resources-locator.cpp	Fri Jul 01 13:32:08 2016 +0200
@@ -35,9 +35,8 @@
 {
     std::ifstream in(m_path + "/" + id, std::ifstream::in | std::ifstream::binary);
 
-    if (!in) {
+    if (!in)
         throw std::runtime_error(std::strerror(errno));
-    }
 
     return std::string(std::istreambuf_iterator<char>(in.rdbuf()), std::istreambuf_iterator<char>());
 }
@@ -46,9 +45,8 @@
 {
     std::unique_ptr<std::istream> ptr = std::make_unique<std::ifstream>(m_path + "/" + id);
 
-    if (!(*ptr)) {
+    if (!(*ptr))
         throw std::runtime_error(std::strerror(errno));
-    }
 
     return ptr;
 }