widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #10437
[Merge] lp:~widelands-dev/widelands/b19_gcc7 into lp:widelands/build19
GunChleoc has proposed merging lp:~widelands-dev/widelands/b19_gcc7 into lp:widelands/build19.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/b19_gcc7/+merge/325798
Ported support for gcc7 from trunk.
This can go in as soon as Travis is clean.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/b19_gcc7 into lp:widelands/build19.
=== modified file '.travis.yml'
--- .travis.yml 2016-10-09 09:36:13 +0000
+++ .travis.yml 2017-06-16 08:32:34 +0000
@@ -20,25 +20,17 @@
- compiler: clang
env: CLANG_VERSION="3.5" BUILD_TYPE="Debug"
- compiler: clang
- env: CLANG_VERSION="3.6" BUILD_TYPE="Debug"
- - compiler: clang
- env: CLANG_VERSION="3.7" BUILD_TYPE="Debug"
- - compiler: clang
- env: CLANG_VERSION="3.8" BUILD_TYPE="Debug"
- - compiler: clang
env: CLANG_VERSION="3.9" BUILD_TYPE="Debug"
- compiler: clang
+ env: CLANG_VERSION="4.0" BUILD_TYPE="Debug"
+ - compiler: clang
env: CLANG_VERSION="3.4" BUILD_TYPE="Release"
- compiler: clang
env: CLANG_VERSION="3.5" BUILD_TYPE="Release"
- compiler: clang
- env: CLANG_VERSION="3.6" BUILD_TYPE="Release"
- - compiler: clang
- env: CLANG_VERSION="3.7" BUILD_TYPE="Release"
- - compiler: clang
- env: CLANG_VERSION="3.8" BUILD_TYPE="Release"
- - compiler: clang
env: CLANG_VERSION="3.9" BUILD_TYPE="Release"
+ - compiler: clang
+ env: CLANG_VERSION="4.0" BUILD_TYPE="Release"
- compiler: gcc
env: GCC_VERSION="4.7" BUILD_TYPE="Debug"
- compiler: gcc
@@ -46,16 +38,16 @@
- compiler: gcc
env: GCC_VERSION="4.9" BUILD_TYPE="Debug"
- compiler: gcc
- env: GCC_VERSION="5" BUILD_TYPE="Debug"
- - compiler: gcc
env: GCC_VERSION="6" BUILD_TYPE="Debug"
- compiler: gcc
+ env: GCC_VERSION="7" BUILD_TYPE="Debug"
+ - compiler: gcc
env: GCC_VERSION="4.7" BUILD_TYPE="Release"
- compiler: gcc
env: GCC_VERSION="4.8" BUILD_TYPE="Release"
- compiler: gcc
env: GCC_VERSION="4.9" BUILD_TYPE="Release"
- compiler: gcc
- env: GCC_VERSION="5" BUILD_TYPE="Release"
- - compiler: gcc
env: GCC_VERSION="6" BUILD_TYPE="Release"
+ - compiler: gcc
+ env: GCC_VERSION="7" BUILD_TYPE="Release"
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-09-04 07:54:45 +0000
+++ CMakeLists.txt 2017-06-16 08:32:34 +0000
@@ -116,7 +116,6 @@
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-padded")
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-sign-conversion")
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-missing-noreturn")
- wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-implicit-fallthrough")
# TODO(sirver): weak-vtables should be enabled, but leads to lot of errors right now.
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-weak-vtables")
@@ -132,6 +131,9 @@
if(WIN32)
# This is needed for getenv().
wl_add_flag(WL_GENERIC_CXX_FLAGS "-std=gnu++11")
+ else()
+ # SDL and MinGW both declare 'unsigned int __builtin_ia32_crc32qi(unsigned int, unsigned char)', resulting in lots of warnings. So, we can't have this flag in Windows.
+ wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wredundant-decls")
endif()
if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8))
@@ -167,7 +169,6 @@
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Woverlength-strings")
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wpacked")
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wpointer-arith")
- wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wredundant-decls")
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wsign-promo")
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wsync-nand")
wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wtrampolines")
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2016-05-17 15:57:06 +0000
+++ src/CMakeLists.txt 2017-06-16 08:32:34 +0000
@@ -113,6 +113,7 @@
logic
logic_game_controller
logic_game_settings
+ logic_single_player_game_settings
map_io_map_loader
network
profile
=== modified file 'src/base/macros.h'
--- src/base/macros.h 2016-08-04 15:49:05 +0000
+++ src/base/macros.h 2017-06-16 08:32:34 +0000
@@ -67,6 +67,16 @@
#define DIAG_OFF(x) GCC_DIAG_OFF(x) CLANG_DIAG_OFF(x)
#define DIAG_ON(x) GCC_DIAG_ON(x) CLANG_DIAG_ON(x)
+// For switch statements: Tell gcc7 and clang that a fallthrough is intended
+// https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
+#ifdef __clang__
+#define FALLS_THROUGH /* Falls through */ [[clang::fallthrough]]
+#elif __GNUC__ >= 7
+#define FALLS_THROUGH /* Falls through */ [[gnu::fallthrough]]
+#else
+#define FALLS_THROUGH /* Falls through */
+#endif
+
// disallow copying or assigning a class
#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
TypeName(const TypeName&) = delete; \
=== modified file 'src/graphic/gl/fill_rect_program.cc'
--- src/graphic/gl/fill_rect_program.cc 2016-08-04 15:49:05 +0000
+++ src/graphic/gl/fill_rect_program.cc 2017-06-16 08:32:34 +0000
@@ -21,7 +21,7 @@
#include <vector>
-#include "base/log.h"
+#include "base/macros.h"
#include "base/wexception.h"
// static
@@ -66,7 +66,7 @@
switch (template_args.blend_mode) {
case BlendMode::Subtract:
glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
- /* fallthrough intended */
+ FALLS_THROUGH;
case BlendMode::UseAlpha:
glBlendFunc(GL_ONE, GL_ONE);
break;
@@ -132,7 +132,7 @@
switch (template_args.blend_mode) {
case BlendMode::Subtract:
glBlendEquation(GL_FUNC_ADD);
- /* fallthrough intended */
+ FALLS_THROUGH;
case BlendMode::UseAlpha:
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
break;
=== modified file 'src/logic/CMakeLists.txt'
--- src/logic/CMakeLists.txt 2016-05-14 07:35:39 +0000
+++ src/logic/CMakeLists.txt 2017-06-16 08:32:34 +0000
@@ -4,19 +4,28 @@
widelands_geometry.h
)
-wl_library(logic_game_settings
+ wl_library(logic_game_settings
SRCS
+ game_settings.cc
game_settings.h
+ player_end_result.h
+ DEPENDS
+ io_filesystem
+ logic
+ scripting_lua_interface
+ scripting_lua_table
+)
+
+wl_library(logic_single_player_game_settings
+ SRCS
single_player_game_settings_provider.cc
single_player_game_settings_provider.h
DEPENDS
ai
base_exceptions
- io_filesystem
logic
- scripting_lua_interface
- scripting_lua_table
-)
+ logic_game_settings
+ )
wl_library(logic_game_controller
SRCS
@@ -28,6 +37,7 @@
DEPENDS
ai
logic
+ logic_game_settings
profile
ui_basic
widelands_ball_of_mud
=== modified file 'src/logic/game_controller.h'
--- src/logic/game_controller.h 2016-08-04 15:49:05 +0000
+++ src/logic/game_controller.h 2017-06-16 08:32:34 +0000
@@ -22,12 +22,12 @@
#include <string>
+#include "logic/player_end_result.h"
#include "logic/widelands.h"
namespace Widelands {
class Game;
class PlayerCommand;
-enum class PlayerEndResult : uint8_t;
}
/**
=== added file 'src/logic/game_settings.cc'
--- src/logic/game_settings.cc 1970-01-01 00:00:00 +0000
+++ src/logic/game_settings.cc 2017-06-16 08:32:34 +0000
@@ -0,0 +1,1 @@
+// Dummy to make CMake happy
=== modified file 'src/logic/game_settings.h'
--- src/logic/game_settings.h 2016-08-04 15:49:05 +0000
+++ src/logic/game_settings.h 2017-06-16 08:32:34 +0000
@@ -26,14 +26,11 @@
#include "io/filesystem/layered_filesystem.h"
#include "logic/map_objects/tribes/tribe_basic_info.h"
+#include "logic/player_end_result.h"
#include "logic/widelands.h"
#include "scripting/lua_interface.h"
#include "scripting/lua_table.h"
-namespace Widelands {
-enum class PlayerEndResult : uint8_t;
-}
-
struct PlayerSettings {
enum State { stateOpen, stateHuman, stateComputer, stateClosed, stateShared };
@@ -60,6 +57,12 @@
return not_connected() - 1;
}
+ UserSettings(Widelands::PlayerEndResult init_result, bool init_ready)
+ : position(0), name(""), result(init_result), win_condition_string(""), ready(init_ready) {
+ }
+ UserSettings() : UserSettings(Widelands::PlayerEndResult::kUndefined, false) {
+ }
+
uint8_t position;
std::string name;
Widelands::PlayerEndResult result;
=== modified file 'src/logic/map_objects/immovable.cc'
--- src/logic/map_objects/immovable.cc 2016-08-04 15:49:05 +0000
+++ src/logic/map_objects/immovable.cc 2017-06-16 08:32:34 +0000
@@ -947,7 +947,7 @@
probability = value;
// fallthrough
}
- /* no break */
+ FALLS_THROUGH;
case '\0':
goto end;
default:
=== modified file 'src/logic/map_objects/tribes/production_program.cc'
--- src/logic/map_objects/tribes/production_program.cc 2016-09-10 16:50:51 +0000
+++ src/logic/map_objects/tribes/production_program.cc 2017-06-16 08:32:34 +0000
@@ -245,9 +245,8 @@
"the specified ware type(s) is only %u, so the group can "
"never be fulfilled by the site",
count, count_max);
- // fallthrough
}
- /* no break */
+ FALLS_THROUGH;
case '\0':
case ' ':
group.second = count;
=== modified file 'src/logic/map_objects/tribes/ship.cc'
--- src/logic/map_objects/tribes/ship.cc 2016-09-07 09:30:49 +0000
+++ src/logic/map_objects/tribes/ship.cc 2017-06-16 08:32:34 +0000
@@ -274,14 +274,13 @@
return;
}
log("Oh no... this ship has no sinking animation :(!\n");
- // fall trough
+ FALLS_THROUGH;
case ShipStates::kSinkAnimation:
// The sink animation has been played, so finally remove the ship from the map
pop_task(game);
remove(game);
return;
}
-
// if the real update function failed (e.g. nothing to transport), the ship goes idle
ship_update_idle(game, state);
}
@@ -685,7 +684,7 @@
return start_task_idle(game, descr().main_animation(), 1500);
}
}
-
+ FALLS_THROUGH;
case ShipStates::kExpeditionWaiting:
case ShipStates::kExpeditionPortspaceFound:
case ShipStates::kSinkRequest:
=== modified file 'src/logic/mapfringeregion.cc'
--- src/logic/mapfringeregion.cc 2016-08-04 15:49:05 +0000
+++ src/logic/mapfringeregion.cc 2017-06-16 08:32:34 +0000
@@ -29,9 +29,11 @@
if (area_.radius) {
remaining_in_phase_ = area_.radius;
phase_ = 6;
- } else
+ // Fallthrough
+ } else {
return false;
- /* no break */
+ }
+ FALLS_THROUGH;
case 1:
map.get_trn(area_, &area_);
break;
@@ -53,6 +55,7 @@
default:
NEVER_HERE();
}
+
if (--remaining_in_phase_ == 0) {
remaining_in_phase_ = area_.radius;
--phase_;
@@ -66,9 +69,11 @@
if (area_.radius) {
remaining_in_phase_ = area_.radius;
phase_ = 6;
- } else
+ // Fallthrough
+ } else {
return false;
- /* no break */
+ }
+ FALLS_THROUGH;
case 1:
map.get_trn(area_, &area_);
break;
@@ -90,6 +95,7 @@
default:
NEVER_HERE();
}
+
if (--remaining_in_phase_ == 0) {
remaining_in_phase_ = area_.radius;
--phase_;
=== added file 'src/logic/player_end_result.h'
--- src/logic/player_end_result.h 1970-01-01 00:00:00 +0000
+++ src/logic/player_end_result.h 2017-06-16 08:32:34 +0000
@@ -0,0 +1,27 @@
+/*
+ * Copyright (C) 2008-2017 by the Widelands Development Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WL_LOGIC_PLAYER_END_RESULT_H
+#define WL_LOGIC_PLAYER_END_RESULT_H
+
+namespace Widelands {
+enum class PlayerEndResult : uint8_t { kLost = 0, kWon = 1, kResigned = 2, kUndefined = 255 };
+}
+
+#endif // end of include guard: WL_LOGIC_PLAYER_END_RESULT_H
=== modified file 'src/logic/playersmanager.h'
--- src/logic/playersmanager.h 2016-08-04 15:49:05 +0000
+++ src/logic/playersmanager.h 2017-06-16 08:32:34 +0000
@@ -24,6 +24,7 @@
#include <vector>
#include "logic/constants.h"
+#include "logic/player_end_result.h"
#include "logic/widelands.h"
namespace Widelands {
@@ -32,13 +33,6 @@
class Player;
class Player;
-enum class PlayerEndResult : uint8_t {
- PLAYER_LOST = 0,
- PLAYER_WON = 1,
- PLAYER_RESIGNED = 2,
- UNDEFINED = 255
-};
-
/**
* Hold data once a player left the game, or on game ends.
* Allowed values for the info string, as key=value pairs separated
=== modified file 'src/logic/single_player_game_controller.h'
--- src/logic/single_player_game_controller.h 2016-08-04 15:49:05 +0000
+++ src/logic/single_player_game_controller.h 2017-06-16 08:32:34 +0000
@@ -22,6 +22,7 @@
#include "ai/computer_player.h"
#include "logic/game_controller.h"
+#include "logic/player_end_result.h"
class SinglePlayerGameController : public GameController {
public:
=== modified file 'src/network/netclient.cc'
--- src/network/netclient.cc 2016-08-04 15:49:05 +0000
+++ src/network/netclient.cc 2017-06-16 08:32:34 +0000
@@ -476,8 +476,7 @@
// This might happen, if a users connects after the game starts.
if (number == d->settings.users.size()) {
- UserSettings newuser;
- d->settings.users.push_back(newuser);
+ d->settings.users.push_back(*new UserSettings());
}
d->settings.users.at(number).name = packet.string();
=== modified file 'src/network/netclient.h'
--- src/network/netclient.h 2016-08-04 15:49:05 +0000
+++ src/network/netclient.h 2017-06-16 08:32:34 +0000
@@ -23,6 +23,7 @@
#include "chat/chat.h"
#include "logic/game_controller.h"
#include "logic/game_settings.h"
+#include "logic/player_end_result.h"
#include "network/network.h"
struct NetClientImpl;
=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc 2016-09-22 17:40:14 +0000
+++ src/network/nethost.cc 2017-06-16 08:32:34 +0000
@@ -143,7 +143,7 @@
newstate = PlayerSettings::stateClosed;
break;
} // else fall through
- /* no break */
+ FALLS_THROUGH;
case PlayerSettings::stateComputer: {
const ComputerPlayer::ImplementationVector& impls = ComputerPlayer::get_implementations();
ComputerPlayer::ImplementationVector::const_iterator it = impls.begin();
@@ -1605,14 +1605,14 @@
for (uint32_t i = 0; i < d->settings.users.size(); ++i)
if (d->settings.users[i].position == UserSettings::not_connected()) {
client.usernum = i;
- d->settings.users[i].result = Widelands::PlayerEndResult::UNDEFINED;
+ d->settings.users[i].result = Widelands::PlayerEndResult::kUndefined;
d->settings.users[i].ready = true;
break;
}
if (client.usernum == -1) {
client.usernum = d->settings.users.size();
UserSettings newuser;
- newuser.result = Widelands::PlayerEndResult::UNDEFINED;
+ newuser.result = Widelands::PlayerEndResult::kUndefined;
newuser.ready = true;
d->settings.users.push_back(newuser);
}
@@ -2404,7 +2404,7 @@
if (user.position == p_nr - 1) {
user.result = result;
user.win_condition_string = info;
- if (result == Widelands::PlayerEndResult::PLAYER_LOST) {
+ if (result == Widelands::PlayerEndResult::kLost) {
send_system_message_code("PLAYER_DEFEATED", user.name);
}
}
=== modified file 'src/network/nethost.h'
--- src/network/nethost.h 2016-08-04 15:49:05 +0000
+++ src/network/nethost.h 2017-06-16 08:32:34 +0000
@@ -22,6 +22,7 @@
#include "logic/game_controller.h"
#include "logic/game_settings.h"
+#include "logic/player_end_result.h"
#include "logic/widelands.h"
#include "network/network.h"
=== modified file 'src/scripting/CMakeLists.txt'
--- src/scripting/CMakeLists.txt 2016-01-18 19:35:25 +0000
+++ src/scripting/CMakeLists.txt 2017-06-16 08:32:34 +0000
@@ -110,6 +110,7 @@
logic
logic_campaign_visibility
logic_game_controller
+ logic_game_settings
logic_widelands_geometry
map_io
scripting_base
=== modified file 'src/scripting/lua_game.cc'
--- src/scripting/lua_game.cc 2016-08-07 20:39:44 +0000
+++ src/scripting/lua_game.cc 2017-06-16 08:32:34 +0000
@@ -33,6 +33,7 @@
#include "logic/objective.h"
#include "logic/path.h"
#include "logic/player.h"
+#include "logic/player_end_result.h"
#include "logic/playersmanager.h"
#include "scripting/globals.h"
#include "scripting/lua_interface.h"
=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc 2016-08-07 08:18:51 +0000
+++ src/ui_basic/editbox.cc 2017-06-16 08:32:34 +0000
@@ -219,15 +219,16 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_DELETE:
if (m_->caret < m_->text.size()) {
while ((m_->text[++m_->caret] & 0xc0) == 0x80) {
};
- // now handle it like Backspace
- } else
+ // Now fallthrough to handle it like Backspace
+ } else {
return true;
- /* no break */
+ }
+ FALLS_THROUGH;
case SDLK_BACKSPACE:
if (m_->caret > 0) {
while ((m_->text[--m_->caret] & 0xc0) == 0x80)
@@ -242,7 +243,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_LEFT:
if (m_->caret > 0) {
while ((m_->text[--m_->caret] & 0xc0) == 0x80) {
@@ -260,7 +261,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_RIGHT:
if (m_->caret < m_->text.size()) {
while ((m_->text[++m_->caret] & 0xc0) == 0x80) {
@@ -280,7 +281,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_HOME:
if (m_->caret != 0) {
m_->caret = 0;
@@ -293,7 +294,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_END:
if (m_->caret != m_->text.size()) {
m_->caret = m_->text.size();
@@ -305,7 +306,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_UP:
// Load entry from history if active and text is not empty
if (history_active_) {
@@ -323,7 +324,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_DOWN:
// Load entry from history if active and text is not equivalent to the current one
if (history_active_) {
=== modified file 'src/ui_basic/listselect.cc'
--- src/ui_basic/listselect.cc 2016-08-04 15:49:05 +0000
+++ src/ui_basic/listselect.cc 2017-06-16 08:32:34 +0000
@@ -454,9 +454,10 @@
uint32_t selected_idx;
switch (code.sym) {
case SDLK_KP_2:
- if (code.mod & KMOD_NUM)
+ if (code.mod & KMOD_NUM) {
break;
- /* no break */
+ }
+ FALLS_THROUGH;
case SDLK_DOWN:
selected_idx = selection_index() + 1;
if (selected_idx < size())
@@ -468,9 +469,10 @@
}
return true;
case SDLK_KP_8:
- if (code.mod & KMOD_NUM)
+ if (code.mod & KMOD_NUM) {
break;
- /* no break */
+ }
+ FALLS_THROUGH;
case SDLK_UP:
selected_idx = selection_index();
if (selected_idx > 0)
=== modified file 'src/ui_basic/multilineeditbox.cc'
--- src/ui_basic/multilineeditbox.cc 2016-08-07 10:10:18 +0000
+++ src/ui_basic/multilineeditbox.cc 2017-06-16 08:32:34 +0000
@@ -235,9 +235,10 @@
// Let the panel handle the tab key
return get_parent()->handle_key(true, code);
case SDLK_KP_PERIOD:
- if (code.mod & KMOD_NUM)
+ if (code.mod & KMOD_NUM) {
break;
- /* no break */
+ }
+ FALLS_THROUGH;
case SDLK_DELETE:
if (d_->cursor_pos < d_->text.size()) {
d_->erase_bytes(d_->cursor_pos, d_->next_char(d_->cursor_pos));
@@ -256,7 +257,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_LEFT: {
if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
uint32_t newpos = d_->prev_char(d_->cursor_pos);
@@ -279,7 +280,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_RIGHT:
if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
uint32_t newpos = d_->next_char(d_->cursor_pos);
@@ -297,7 +298,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_DOWN:
if (d_->cursor_pos < d_->text.size()) {
d_->refresh_ww();
@@ -326,7 +327,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_UP:
if (d_->cursor_pos > 0) {
d_->refresh_ww();
@@ -353,7 +354,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_HOME:
if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
d_->set_cursor_pos(0);
@@ -371,7 +372,7 @@
if (code.mod & KMOD_NUM) {
break;
}
- /* no break */
+ FALLS_THROUGH;
case SDLK_END:
if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
d_->set_cursor_pos(d_->text.size());
=== modified file 'src/ui_fsmenu/loadgame.cc'
--- src/ui_fsmenu/loadgame.cc 2016-09-25 12:27:22 +0000
+++ src/ui_fsmenu/loadgame.cc 2017-06-16 08:32:34 +0000
@@ -631,9 +631,10 @@
switch (code.sym) {
case SDLK_KP_PERIOD:
- if (code.mod & KMOD_NUM)
+ if (code.mod & KMOD_NUM) {
break;
- /* no break */
+ }
+ FALLS_THROUGH;
case SDLK_DELETE:
clicked_delete();
return true;
=== modified file 'src/wui/game_summary.cc'
--- src/wui/game_summary.cc 2016-08-04 15:49:05 +0000
+++ src/wui/game_summary.cc 2017-06-16 08:32:34 +0000
@@ -26,6 +26,7 @@
#include "graphic/graphic.h"
#include "logic/game.h"
#include "logic/player.h"
+#include "logic/player_end_result.h"
#include "logic/playersmanager.h"
#include "ui_basic/box.h"
#include "ui_basic/button.h"
@@ -147,7 +148,7 @@
Widelands::PlayerEndStatus pes = players_status.at(i);
if (ipl && pes.player == ipl->player_number()) {
local_in_game = true;
- local_won = pes.result == Widelands::PlayerEndResult::PLAYER_WON;
+ local_won = pes.result == Widelands::PlayerEndResult::kWon;
current_player_position = i;
}
Widelands::Player* p = game_.get_player(pes.player);
@@ -163,11 +164,11 @@
// Status
std::string stat_str;
switch (pes.result) {
- case Widelands::PlayerEndResult::PLAYER_LOST:
+ case Widelands::PlayerEndResult::kLost:
/** TRANSLATORS: This is shown in the game summary for the players who have lost. */
stat_str = _("Lost");
break;
- case Widelands::PlayerEndResult::PLAYER_WON:
+ case Widelands::PlayerEndResult::kWon:
/** TRANSLATORS: This is shown in the game summary for the players who have won. */
stat_str = _("Won");
if (!single_won) {
@@ -176,11 +177,11 @@
teawon_ = p->team_number();
}
break;
- case Widelands::PlayerEndResult::PLAYER_RESIGNED:
+ case Widelands::PlayerEndResult::kResigned:
/** TRANSLATORS: This is shown in the game summary for the players who have resigned. */
stat_str = _("Resigned");
break;
- case Widelands::PlayerEndResult::UNDEFINED:
+ case Widelands::PlayerEndResult::kUndefined:
/** TRANSLATORS: This is shown in the game summary when we don't know */
/** TRANSLATORS: if the player has lost or won. */
stat_str = pgettext("player_won", "Unknown");
=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc 2016-09-25 16:45:37 +0000
+++ src/wui/interactive_base.cc 2017-06-16 08:32:34 +0000
@@ -774,9 +774,10 @@
if (down) {
switch (code.sym) {
case SDLK_KP_9:
- if (code.mod & KMOD_NUM)
+ if (code.mod & KMOD_NUM) {
break;
- /* no break */
+ }
+ FALLS_THROUGH;
case SDLK_PAGEUP:
if (upcast(Game, game, &egbase_)) {
if (GameController* const ctrl = game->game_controller()) {
@@ -794,9 +795,10 @@
return true;
case SDLK_KP_3:
- if (code.mod & KMOD_NUM)
+ if (code.mod & KMOD_NUM) {
break;
- /* no break */
+ }
+ FALLS_THROUGH;
case SDLK_PAGEDOWN:
if (upcast(Widelands::Game, game, &egbase_)) {
if (GameController* const ctrl = game->game_controller()) {
=== modified file 'src/wui/interactive_player.cc'
--- src/wui/interactive_player.cc 2016-08-04 15:49:05 +0000
+++ src/wui/interactive_player.cc 2017-06-16 08:32:34 +0000
@@ -320,7 +320,7 @@
case SDLK_KP_7:
if (code.mod & KMOD_NUM)
break;
- /* no break */
+ FALLS_THROUGH;
case SDLK_HOME:
move_view_to(game().map().get_starting_pos(player_number_));
return true;
References