Merge lp:~widelands-dev/widelands/b19_gcc7 into lp:widelands/build19

Proposed by GunChleoc
Status: Merged
Merged at revision: 8149
Proposed branch: lp:~widelands-dev/widelands/b19_gcc7
Merge into: lp:widelands/build19
Diff against target: 816 lines (+143/-88)
29 files modified
.travis.yml (+8/-16)
CMakeLists.txt (+3/-2)
src/CMakeLists.txt (+1/-0)
src/base/macros.h (+10/-0)
src/graphic/gl/fill_rect_program.cc (+3/-3)
src/logic/CMakeLists.txt (+15/-5)
src/logic/game_controller.h (+1/-1)
src/logic/game_settings.cc (+1/-0)
src/logic/game_settings.h (+7/-4)
src/logic/map_objects/immovable.cc (+1/-1)
src/logic/map_objects/tribes/production_program.cc (+1/-2)
src/logic/map_objects/tribes/ship.cc (+2/-3)
src/logic/mapfringeregion.cc (+10/-4)
src/logic/player_end_result.h (+27/-0)
src/logic/playersmanager.h (+1/-7)
src/logic/single_player_game_controller.h (+1/-0)
src/network/netclient.cc (+1/-2)
src/network/netclient.h (+1/-0)
src/network/nethost.cc (+4/-4)
src/network/nethost.h (+1/-0)
src/scripting/CMakeLists.txt (+1/-0)
src/scripting/lua_game.cc (+1/-0)
src/ui_basic/editbox.cc (+11/-10)
src/ui_basic/listselect.cc (+6/-4)
src/ui_basic/multilineeditbox.cc (+9/-8)
src/ui_fsmenu/loadgame.cc (+3/-2)
src/wui/game_summary.cc (+6/-5)
src/wui/interactive_base.cc (+6/-4)
src/wui/interactive_player.cc (+1/-1)
To merge this branch: bzr merge lp:~widelands-dev/widelands/b19_gcc7
Reviewer Review Type Date Requested Status
Widelands Developers Pending
Review via email: mp+325798@code.launchpad.net

Description of the change

Ported support for gcc7 from trunk.

This can go in as soon as Travis is clean.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.travis.yml'
--- .travis.yml 2016-10-09 09:36:13 +0000
+++ .travis.yml 2017-06-17 14:22:37 +0000
@@ -20,25 +20,17 @@
20 - compiler: clang20 - compiler: clang
21 env: CLANG_VERSION="3.5" BUILD_TYPE="Debug"21 env: CLANG_VERSION="3.5" BUILD_TYPE="Debug"
22 - compiler: clang22 - compiler: clang
23 env: CLANG_VERSION="3.6" BUILD_TYPE="Debug"
24 - compiler: clang
25 env: CLANG_VERSION="3.7" BUILD_TYPE="Debug"
26 - compiler: clang
27 env: CLANG_VERSION="3.8" BUILD_TYPE="Debug"
28 - compiler: clang
29 env: CLANG_VERSION="3.9" BUILD_TYPE="Debug"23 env: CLANG_VERSION="3.9" BUILD_TYPE="Debug"
30 - compiler: clang24 - compiler: clang
25 env: CLANG_VERSION="4.0" BUILD_TYPE="Debug"
26 - compiler: clang
31 env: CLANG_VERSION="3.4" BUILD_TYPE="Release"27 env: CLANG_VERSION="3.4" BUILD_TYPE="Release"
32 - compiler: clang28 - compiler: clang
33 env: CLANG_VERSION="3.5" BUILD_TYPE="Release"29 env: CLANG_VERSION="3.5" BUILD_TYPE="Release"
34 - compiler: clang30 - compiler: clang
35 env: CLANG_VERSION="3.6" BUILD_TYPE="Release"
36 - compiler: clang
37 env: CLANG_VERSION="3.7" BUILD_TYPE="Release"
38 - compiler: clang
39 env: CLANG_VERSION="3.8" BUILD_TYPE="Release"
40 - compiler: clang
41 env: CLANG_VERSION="3.9" BUILD_TYPE="Release"31 env: CLANG_VERSION="3.9" BUILD_TYPE="Release"
32 - compiler: clang
33 env: CLANG_VERSION="4.0" BUILD_TYPE="Release"
42 - compiler: gcc34 - compiler: gcc
43 env: GCC_VERSION="4.7" BUILD_TYPE="Debug"35 env: GCC_VERSION="4.7" BUILD_TYPE="Debug"
44 - compiler: gcc36 - compiler: gcc
@@ -46,16 +38,16 @@
46 - compiler: gcc38 - compiler: gcc
47 env: GCC_VERSION="4.9" BUILD_TYPE="Debug"39 env: GCC_VERSION="4.9" BUILD_TYPE="Debug"
48 - compiler: gcc40 - compiler: gcc
49 env: GCC_VERSION="5" BUILD_TYPE="Debug"
50 - compiler: gcc
51 env: GCC_VERSION="6" BUILD_TYPE="Debug"41 env: GCC_VERSION="6" BUILD_TYPE="Debug"
52 - compiler: gcc42 - compiler: gcc
43 env: GCC_VERSION="7" BUILD_TYPE="Debug"
44 - compiler: gcc
53 env: GCC_VERSION="4.7" BUILD_TYPE="Release"45 env: GCC_VERSION="4.7" BUILD_TYPE="Release"
54 - compiler: gcc46 - compiler: gcc
55 env: GCC_VERSION="4.8" BUILD_TYPE="Release"47 env: GCC_VERSION="4.8" BUILD_TYPE="Release"
56 - compiler: gcc48 - compiler: gcc
57 env: GCC_VERSION="4.9" BUILD_TYPE="Release"49 env: GCC_VERSION="4.9" BUILD_TYPE="Release"
58 - compiler: gcc50 - compiler: gcc
59 env: GCC_VERSION="5" BUILD_TYPE="Release"
60 - compiler: gcc
61 env: GCC_VERSION="6" BUILD_TYPE="Release"51 env: GCC_VERSION="6" BUILD_TYPE="Release"
52 - compiler: gcc
53 env: GCC_VERSION="7" BUILD_TYPE="Release"
6254
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2016-09-04 07:54:45 +0000
+++ CMakeLists.txt 2017-06-17 14:22:37 +0000
@@ -116,7 +116,6 @@
116 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-padded")116 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-padded")
117 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-sign-conversion")117 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-sign-conversion")
118 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-missing-noreturn")118 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-missing-noreturn")
119 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-implicit-fallthrough")
120119
121 # TODO(sirver): weak-vtables should be enabled, but leads to lot of errors right now.120 # TODO(sirver): weak-vtables should be enabled, but leads to lot of errors right now.
122 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-weak-vtables")121 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wno-weak-vtables")
@@ -132,6 +131,9 @@
132 if(WIN32)131 if(WIN32)
133 # This is needed for getenv().132 # This is needed for getenv().
134 wl_add_flag(WL_GENERIC_CXX_FLAGS "-std=gnu++11")133 wl_add_flag(WL_GENERIC_CXX_FLAGS "-std=gnu++11")
134 else()
135 # 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.
136 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wredundant-decls")
135 endif()137 endif()
136138
137 if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8))139 if (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8))
@@ -167,7 +169,6 @@
167 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Woverlength-strings")169 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Woverlength-strings")
168 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wpacked")170 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wpacked")
169 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wpointer-arith")171 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wpointer-arith")
170 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wredundant-decls")
171 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wsign-promo")172 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wsign-promo")
172 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wsync-nand")173 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wsync-nand")
173 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wtrampolines")174 wl_add_flag(WL_COMPILE_DIAGNOSTICS "-Wtrampolines")
174175
=== modified file 'src/CMakeLists.txt'
--- src/CMakeLists.txt 2016-05-17 15:57:06 +0000
+++ src/CMakeLists.txt 2017-06-17 14:22:37 +0000
@@ -113,6 +113,7 @@
113 logic113 logic
114 logic_game_controller114 logic_game_controller
115 logic_game_settings115 logic_game_settings
116 logic_single_player_game_settings
116 map_io_map_loader117 map_io_map_loader
117 network118 network
118 profile119 profile
119120
=== modified file 'src/base/macros.h'
--- src/base/macros.h 2016-08-04 15:49:05 +0000
+++ src/base/macros.h 2017-06-17 14:22:37 +0000
@@ -67,6 +67,16 @@
67#define DIAG_OFF(x) GCC_DIAG_OFF(x) CLANG_DIAG_OFF(x)67#define DIAG_OFF(x) GCC_DIAG_OFF(x) CLANG_DIAG_OFF(x)
68#define DIAG_ON(x) GCC_DIAG_ON(x) CLANG_DIAG_ON(x)68#define DIAG_ON(x) GCC_DIAG_ON(x) CLANG_DIAG_ON(x)
6969
70// For switch statements: Tell gcc7 and clang that a fallthrough is intended
71// https://developers.redhat.com/blog/2017/03/10/wimplicit-fallthrough-in-gcc-7/
72#ifdef __clang__
73#define FALLS_THROUGH /* Falls through */ [[clang::fallthrough]]
74#elif __GNUC__ >= 7
75#define FALLS_THROUGH /* Falls through */ [[gnu::fallthrough]]
76#else
77#define FALLS_THROUGH /* Falls through */
78#endif
79
70// disallow copying or assigning a class80// disallow copying or assigning a class
71#define DISALLOW_COPY_AND_ASSIGN(TypeName) \81#define DISALLOW_COPY_AND_ASSIGN(TypeName) \
72 TypeName(const TypeName&) = delete; \82 TypeName(const TypeName&) = delete; \
7383
=== 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-17 14:22:37 +0000
@@ -21,7 +21,7 @@
2121
22#include <vector>22#include <vector>
2323
24#include "base/log.h"24#include "base/macros.h"
25#include "base/wexception.h"25#include "base/wexception.h"
2626
27// static27// static
@@ -66,7 +66,7 @@
66 switch (template_args.blend_mode) {66 switch (template_args.blend_mode) {
67 case BlendMode::Subtract:67 case BlendMode::Subtract:
68 glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);68 glBlendEquation(GL_FUNC_REVERSE_SUBTRACT);
69 /* fallthrough intended */69 FALLS_THROUGH;
70 case BlendMode::UseAlpha:70 case BlendMode::UseAlpha:
71 glBlendFunc(GL_ONE, GL_ONE);71 glBlendFunc(GL_ONE, GL_ONE);
72 break;72 break;
@@ -132,7 +132,7 @@
132 switch (template_args.blend_mode) {132 switch (template_args.blend_mode) {
133 case BlendMode::Subtract:133 case BlendMode::Subtract:
134 glBlendEquation(GL_FUNC_ADD);134 glBlendEquation(GL_FUNC_ADD);
135 /* fallthrough intended */135 FALLS_THROUGH;
136 case BlendMode::UseAlpha:136 case BlendMode::UseAlpha:
137 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);137 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
138 break;138 break;
139139
=== modified file 'src/logic/CMakeLists.txt'
--- src/logic/CMakeLists.txt 2016-05-14 07:35:39 +0000
+++ src/logic/CMakeLists.txt 2017-06-17 14:22:37 +0000
@@ -4,19 +4,28 @@
4 widelands_geometry.h4 widelands_geometry.h
5)5)
66
7wl_library(logic_game_settings7 wl_library(logic_game_settings
8 SRCS8 SRCS
9 game_settings.cc
9 game_settings.h10 game_settings.h
11 player_end_result.h
12 DEPENDS
13 io_filesystem
14 logic
15 scripting_lua_interface
16 scripting_lua_table
17)
18
19wl_library(logic_single_player_game_settings
20 SRCS
10 single_player_game_settings_provider.cc21 single_player_game_settings_provider.cc
11 single_player_game_settings_provider.h22 single_player_game_settings_provider.h
12 DEPENDS23 DEPENDS
13 ai24 ai
14 base_exceptions25 base_exceptions
15 io_filesystem
16 logic26 logic
17 scripting_lua_interface27 logic_game_settings
18 scripting_lua_table28 )
19)
2029
21wl_library(logic_game_controller30wl_library(logic_game_controller
22 SRCS31 SRCS
@@ -28,6 +37,7 @@
28 DEPENDS37 DEPENDS
29 ai38 ai
30 logic39 logic
40 logic_game_settings
31 profile41 profile
32 ui_basic42 ui_basic
33 widelands_ball_of_mud43 widelands_ball_of_mud
3444
=== 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-17 14:22:37 +0000
@@ -22,12 +22,12 @@
2222
23#include <string>23#include <string>
2424
25#include "logic/player_end_result.h"
25#include "logic/widelands.h"26#include "logic/widelands.h"
2627
27namespace Widelands {28namespace Widelands {
28class Game;29class Game;
29class PlayerCommand;30class PlayerCommand;
30enum class PlayerEndResult : uint8_t;
31}31}
3232
33/**33/**
3434
=== 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-17 14:22:37 +0000
@@ -0,0 +1,1 @@
1// Dummy to make CMake happy
02
=== 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-17 14:22:37 +0000
@@ -26,14 +26,11 @@
2626
27#include "io/filesystem/layered_filesystem.h"27#include "io/filesystem/layered_filesystem.h"
28#include "logic/map_objects/tribes/tribe_basic_info.h"28#include "logic/map_objects/tribes/tribe_basic_info.h"
29#include "logic/player_end_result.h"
29#include "logic/widelands.h"30#include "logic/widelands.h"
30#include "scripting/lua_interface.h"31#include "scripting/lua_interface.h"
31#include "scripting/lua_table.h"32#include "scripting/lua_table.h"
3233
33namespace Widelands {
34enum class PlayerEndResult : uint8_t;
35}
36
37struct PlayerSettings {34struct PlayerSettings {
38 enum State { stateOpen, stateHuman, stateComputer, stateClosed, stateShared };35 enum State { stateOpen, stateHuman, stateComputer, stateClosed, stateShared };
3936
@@ -60,6 +57,12 @@
60 return not_connected() - 1;57 return not_connected() - 1;
61 }58 }
6259
60 UserSettings(Widelands::PlayerEndResult init_result, bool init_ready)
61 : position(0), name(""), result(init_result), win_condition_string(""), ready(init_ready) {
62 }
63 UserSettings() : UserSettings(Widelands::PlayerEndResult::kUndefined, false) {
64 }
65
63 uint8_t position;66 uint8_t position;
64 std::string name;67 std::string name;
65 Widelands::PlayerEndResult result;68 Widelands::PlayerEndResult result;
6669
=== 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-17 14:22:37 +0000
@@ -947,7 +947,7 @@
947 probability = value;947 probability = value;
948 // fallthrough948 // fallthrough
949 }949 }
950 /* no break */950 FALLS_THROUGH;
951 case '\0':951 case '\0':
952 goto end;952 goto end;
953 default:953 default:
954954
=== 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-17 14:22:37 +0000
@@ -245,9 +245,8 @@
245 "the specified ware type(s) is only %u, so the group can "245 "the specified ware type(s) is only %u, so the group can "
246 "never be fulfilled by the site",246 "never be fulfilled by the site",
247 count, count_max);247 count, count_max);
248 // fallthrough
249 }248 }
250 /* no break */249 FALLS_THROUGH;
251 case '\0':250 case '\0':
252 case ' ':251 case ' ':
253 group.second = count;252 group.second = count;
254253
=== 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-17 14:22:37 +0000
@@ -274,14 +274,13 @@
274 return;274 return;
275 }275 }
276 log("Oh no... this ship has no sinking animation :(!\n");276 log("Oh no... this ship has no sinking animation :(!\n");
277 // fall trough277 FALLS_THROUGH;
278 case ShipStates::kSinkAnimation:278 case ShipStates::kSinkAnimation:
279 // The sink animation has been played, so finally remove the ship from the map279 // The sink animation has been played, so finally remove the ship from the map
280 pop_task(game);280 pop_task(game);
281 remove(game);281 remove(game);
282 return;282 return;
283 }283 }
284
285 // if the real update function failed (e.g. nothing to transport), the ship goes idle284 // if the real update function failed (e.g. nothing to transport), the ship goes idle
286 ship_update_idle(game, state);285 ship_update_idle(game, state);
287}286}
@@ -685,7 +684,7 @@
685 return start_task_idle(game, descr().main_animation(), 1500);684 return start_task_idle(game, descr().main_animation(), 1500);
686 }685 }
687 }686 }
688687 FALLS_THROUGH;
689 case ShipStates::kExpeditionWaiting:688 case ShipStates::kExpeditionWaiting:
690 case ShipStates::kExpeditionPortspaceFound:689 case ShipStates::kExpeditionPortspaceFound:
691 case ShipStates::kSinkRequest:690 case ShipStates::kSinkRequest:
692691
=== modified file 'src/logic/mapfringeregion.cc'
--- src/logic/mapfringeregion.cc 2016-08-04 15:49:05 +0000
+++ src/logic/mapfringeregion.cc 2017-06-17 14:22:37 +0000
@@ -29,9 +29,11 @@
29 if (area_.radius) {29 if (area_.radius) {
30 remaining_in_phase_ = area_.radius;30 remaining_in_phase_ = area_.radius;
31 phase_ = 6;31 phase_ = 6;
32 } else32 // Fallthrough
33 } else {
33 return false;34 return false;
34 /* no break */35 }
36 FALLS_THROUGH;
35 case 1:37 case 1:
36 map.get_trn(area_, &area_);38 map.get_trn(area_, &area_);
37 break;39 break;
@@ -53,6 +55,7 @@
53 default:55 default:
54 NEVER_HERE();56 NEVER_HERE();
55 }57 }
58
56 if (--remaining_in_phase_ == 0) {59 if (--remaining_in_phase_ == 0) {
57 remaining_in_phase_ = area_.radius;60 remaining_in_phase_ = area_.radius;
58 --phase_;61 --phase_;
@@ -66,9 +69,11 @@
66 if (area_.radius) {69 if (area_.radius) {
67 remaining_in_phase_ = area_.radius;70 remaining_in_phase_ = area_.radius;
68 phase_ = 6;71 phase_ = 6;
69 } else72 // Fallthrough
73 } else {
70 return false;74 return false;
71 /* no break */75 }
76 FALLS_THROUGH;
72 case 1:77 case 1:
73 map.get_trn(area_, &area_);78 map.get_trn(area_, &area_);
74 break;79 break;
@@ -90,6 +95,7 @@
90 default:95 default:
91 NEVER_HERE();96 NEVER_HERE();
92 }97 }
98
93 if (--remaining_in_phase_ == 0) {99 if (--remaining_in_phase_ == 0) {
94 remaining_in_phase_ = area_.radius;100 remaining_in_phase_ = area_.radius;
95 --phase_;101 --phase_;
96102
=== 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-17 14:22:37 +0000
@@ -0,0 +1,27 @@
1/*
2 * Copyright (C) 2008-2017 by the Widelands Development Team
3 *
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; either version 2
7 * of the License, or (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 *
18 */
19
20#ifndef WL_LOGIC_PLAYER_END_RESULT_H
21#define WL_LOGIC_PLAYER_END_RESULT_H
22
23namespace Widelands {
24enum class PlayerEndResult : uint8_t { kLost = 0, kWon = 1, kResigned = 2, kUndefined = 255 };
25}
26
27#endif // end of include guard: WL_LOGIC_PLAYER_END_RESULT_H
028
=== modified file 'src/logic/playersmanager.h'
--- src/logic/playersmanager.h 2016-08-04 15:49:05 +0000
+++ src/logic/playersmanager.h 2017-06-17 14:22:37 +0000
@@ -24,6 +24,7 @@
24#include <vector>24#include <vector>
2525
26#include "logic/constants.h"26#include "logic/constants.h"
27#include "logic/player_end_result.h"
27#include "logic/widelands.h"28#include "logic/widelands.h"
2829
29namespace Widelands {30namespace Widelands {
@@ -32,13 +33,6 @@
32class Player;33class Player;
33class Player;34class Player;
3435
35enum class PlayerEndResult : uint8_t {
36 PLAYER_LOST = 0,
37 PLAYER_WON = 1,
38 PLAYER_RESIGNED = 2,
39 UNDEFINED = 255
40};
41
42/**36/**
43 * Hold data once a player left the game, or on game ends.37 * Hold data once a player left the game, or on game ends.
44 * Allowed values for the info string, as key=value pairs separated38 * Allowed values for the info string, as key=value pairs separated
4539
=== 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-17 14:22:37 +0000
@@ -22,6 +22,7 @@
2222
23#include "ai/computer_player.h"23#include "ai/computer_player.h"
24#include "logic/game_controller.h"24#include "logic/game_controller.h"
25#include "logic/player_end_result.h"
2526
26class SinglePlayerGameController : public GameController {27class SinglePlayerGameController : public GameController {
27public:28public:
2829
=== modified file 'src/network/netclient.cc'
--- src/network/netclient.cc 2016-08-04 15:49:05 +0000
+++ src/network/netclient.cc 2017-06-17 14:22:37 +0000
@@ -476,8 +476,7 @@
476476
477 // This might happen, if a users connects after the game starts.477 // This might happen, if a users connects after the game starts.
478 if (number == d->settings.users.size()) {478 if (number == d->settings.users.size()) {
479 UserSettings newuser;479 d->settings.users.push_back(*new UserSettings());
480 d->settings.users.push_back(newuser);
481 }480 }
482481
483 d->settings.users.at(number).name = packet.string();482 d->settings.users.at(number).name = packet.string();
484483
=== modified file 'src/network/netclient.h'
--- src/network/netclient.h 2016-08-04 15:49:05 +0000
+++ src/network/netclient.h 2017-06-17 14:22:37 +0000
@@ -23,6 +23,7 @@
23#include "chat/chat.h"23#include "chat/chat.h"
24#include "logic/game_controller.h"24#include "logic/game_controller.h"
25#include "logic/game_settings.h"25#include "logic/game_settings.h"
26#include "logic/player_end_result.h"
26#include "network/network.h"27#include "network/network.h"
2728
28struct NetClientImpl;29struct NetClientImpl;
2930
=== modified file 'src/network/nethost.cc'
--- src/network/nethost.cc 2016-09-22 17:40:14 +0000
+++ src/network/nethost.cc 2017-06-17 14:22:37 +0000
@@ -143,7 +143,7 @@
143 newstate = PlayerSettings::stateClosed;143 newstate = PlayerSettings::stateClosed;
144 break;144 break;
145 } // else fall through145 } // else fall through
146 /* no break */146 FALLS_THROUGH;
147 case PlayerSettings::stateComputer: {147 case PlayerSettings::stateComputer: {
148 const ComputerPlayer::ImplementationVector& impls = ComputerPlayer::get_implementations();148 const ComputerPlayer::ImplementationVector& impls = ComputerPlayer::get_implementations();
149 ComputerPlayer::ImplementationVector::const_iterator it = impls.begin();149 ComputerPlayer::ImplementationVector::const_iterator it = impls.begin();
@@ -1605,14 +1605,14 @@
1605 for (uint32_t i = 0; i < d->settings.users.size(); ++i)1605 for (uint32_t i = 0; i < d->settings.users.size(); ++i)
1606 if (d->settings.users[i].position == UserSettings::not_connected()) {1606 if (d->settings.users[i].position == UserSettings::not_connected()) {
1607 client.usernum = i;1607 client.usernum = i;
1608 d->settings.users[i].result = Widelands::PlayerEndResult::UNDEFINED;1608 d->settings.users[i].result = Widelands::PlayerEndResult::kUndefined;
1609 d->settings.users[i].ready = true;1609 d->settings.users[i].ready = true;
1610 break;1610 break;
1611 }1611 }
1612 if (client.usernum == -1) {1612 if (client.usernum == -1) {
1613 client.usernum = d->settings.users.size();1613 client.usernum = d->settings.users.size();
1614 UserSettings newuser;1614 UserSettings newuser;
1615 newuser.result = Widelands::PlayerEndResult::UNDEFINED;1615 newuser.result = Widelands::PlayerEndResult::kUndefined;
1616 newuser.ready = true;1616 newuser.ready = true;
1617 d->settings.users.push_back(newuser);1617 d->settings.users.push_back(newuser);
1618 }1618 }
@@ -2404,7 +2404,7 @@
2404 if (user.position == p_nr - 1) {2404 if (user.position == p_nr - 1) {
2405 user.result = result;2405 user.result = result;
2406 user.win_condition_string = info;2406 user.win_condition_string = info;
2407 if (result == Widelands::PlayerEndResult::PLAYER_LOST) {2407 if (result == Widelands::PlayerEndResult::kLost) {
2408 send_system_message_code("PLAYER_DEFEATED", user.name);2408 send_system_message_code("PLAYER_DEFEATED", user.name);
2409 }2409 }
2410 }2410 }
24112411
=== modified file 'src/network/nethost.h'
--- src/network/nethost.h 2016-08-04 15:49:05 +0000
+++ src/network/nethost.h 2017-06-17 14:22:37 +0000
@@ -22,6 +22,7 @@
2222
23#include "logic/game_controller.h"23#include "logic/game_controller.h"
24#include "logic/game_settings.h"24#include "logic/game_settings.h"
25#include "logic/player_end_result.h"
25#include "logic/widelands.h"26#include "logic/widelands.h"
26#include "network/network.h"27#include "network/network.h"
2728
2829
=== modified file 'src/scripting/CMakeLists.txt'
--- src/scripting/CMakeLists.txt 2016-01-18 19:35:25 +0000
+++ src/scripting/CMakeLists.txt 2017-06-17 14:22:37 +0000
@@ -110,6 +110,7 @@
110 logic110 logic
111 logic_campaign_visibility111 logic_campaign_visibility
112 logic_game_controller112 logic_game_controller
113 logic_game_settings
113 logic_widelands_geometry114 logic_widelands_geometry
114 map_io115 map_io
115 scripting_base116 scripting_base
116117
=== 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-17 14:22:37 +0000
@@ -33,6 +33,7 @@
33#include "logic/objective.h"33#include "logic/objective.h"
34#include "logic/path.h"34#include "logic/path.h"
35#include "logic/player.h"35#include "logic/player.h"
36#include "logic/player_end_result.h"
36#include "logic/playersmanager.h"37#include "logic/playersmanager.h"
37#include "scripting/globals.h"38#include "scripting/globals.h"
38#include "scripting/lua_interface.h"39#include "scripting/lua_interface.h"
3940
=== 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-17 14:22:37 +0000
@@ -219,15 +219,16 @@
219 if (code.mod & KMOD_NUM) {219 if (code.mod & KMOD_NUM) {
220 break;220 break;
221 }221 }
222 /* no break */222 FALLS_THROUGH;
223 case SDLK_DELETE:223 case SDLK_DELETE:
224 if (m_->caret < m_->text.size()) {224 if (m_->caret < m_->text.size()) {
225 while ((m_->text[++m_->caret] & 0xc0) == 0x80) {225 while ((m_->text[++m_->caret] & 0xc0) == 0x80) {
226 };226 };
227 // now handle it like Backspace227 // Now fallthrough to handle it like Backspace
228 } else228 } else {
229 return true;229 return true;
230 /* no break */230 }
231 FALLS_THROUGH;
231 case SDLK_BACKSPACE:232 case SDLK_BACKSPACE:
232 if (m_->caret > 0) {233 if (m_->caret > 0) {
233 while ((m_->text[--m_->caret] & 0xc0) == 0x80)234 while ((m_->text[--m_->caret] & 0xc0) == 0x80)
@@ -242,7 +243,7 @@
242 if (code.mod & KMOD_NUM) {243 if (code.mod & KMOD_NUM) {
243 break;244 break;
244 }245 }
245 /* no break */246 FALLS_THROUGH;
246 case SDLK_LEFT:247 case SDLK_LEFT:
247 if (m_->caret > 0) {248 if (m_->caret > 0) {
248 while ((m_->text[--m_->caret] & 0xc0) == 0x80) {249 while ((m_->text[--m_->caret] & 0xc0) == 0x80) {
@@ -260,7 +261,7 @@
260 if (code.mod & KMOD_NUM) {261 if (code.mod & KMOD_NUM) {
261 break;262 break;
262 }263 }
263 /* no break */264 FALLS_THROUGH;
264 case SDLK_RIGHT:265 case SDLK_RIGHT:
265 if (m_->caret < m_->text.size()) {266 if (m_->caret < m_->text.size()) {
266 while ((m_->text[++m_->caret] & 0xc0) == 0x80) {267 while ((m_->text[++m_->caret] & 0xc0) == 0x80) {
@@ -280,7 +281,7 @@
280 if (code.mod & KMOD_NUM) {281 if (code.mod & KMOD_NUM) {
281 break;282 break;
282 }283 }
283 /* no break */284 FALLS_THROUGH;
284 case SDLK_HOME:285 case SDLK_HOME:
285 if (m_->caret != 0) {286 if (m_->caret != 0) {
286 m_->caret = 0;287 m_->caret = 0;
@@ -293,7 +294,7 @@
293 if (code.mod & KMOD_NUM) {294 if (code.mod & KMOD_NUM) {
294 break;295 break;
295 }296 }
296 /* no break */297 FALLS_THROUGH;
297 case SDLK_END:298 case SDLK_END:
298 if (m_->caret != m_->text.size()) {299 if (m_->caret != m_->text.size()) {
299 m_->caret = m_->text.size();300 m_->caret = m_->text.size();
@@ -305,7 +306,7 @@
305 if (code.mod & KMOD_NUM) {306 if (code.mod & KMOD_NUM) {
306 break;307 break;
307 }308 }
308 /* no break */309 FALLS_THROUGH;
309 case SDLK_UP:310 case SDLK_UP:
310 // Load entry from history if active and text is not empty311 // Load entry from history if active and text is not empty
311 if (history_active_) {312 if (history_active_) {
@@ -323,7 +324,7 @@
323 if (code.mod & KMOD_NUM) {324 if (code.mod & KMOD_NUM) {
324 break;325 break;
325 }326 }
326 /* no break */327 FALLS_THROUGH;
327 case SDLK_DOWN:328 case SDLK_DOWN:
328 // Load entry from history if active and text is not equivalent to the current one329 // Load entry from history if active and text is not equivalent to the current one
329 if (history_active_) {330 if (history_active_) {
330331
=== 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-17 14:22:37 +0000
@@ -454,9 +454,10 @@
454 uint32_t selected_idx;454 uint32_t selected_idx;
455 switch (code.sym) {455 switch (code.sym) {
456 case SDLK_KP_2:456 case SDLK_KP_2:
457 if (code.mod & KMOD_NUM)457 if (code.mod & KMOD_NUM) {
458 break;458 break;
459 /* no break */459 }
460 FALLS_THROUGH;
460 case SDLK_DOWN:461 case SDLK_DOWN:
461 selected_idx = selection_index() + 1;462 selected_idx = selection_index() + 1;
462 if (selected_idx < size())463 if (selected_idx < size())
@@ -468,9 +469,10 @@
468 }469 }
469 return true;470 return true;
470 case SDLK_KP_8:471 case SDLK_KP_8:
471 if (code.mod & KMOD_NUM)472 if (code.mod & KMOD_NUM) {
472 break;473 break;
473 /* no break */474 }
475 FALLS_THROUGH;
474 case SDLK_UP:476 case SDLK_UP:
475 selected_idx = selection_index();477 selected_idx = selection_index();
476 if (selected_idx > 0)478 if (selected_idx > 0)
477479
=== 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-17 14:22:37 +0000
@@ -235,9 +235,10 @@
235 // Let the panel handle the tab key235 // Let the panel handle the tab key
236 return get_parent()->handle_key(true, code);236 return get_parent()->handle_key(true, code);
237 case SDLK_KP_PERIOD:237 case SDLK_KP_PERIOD:
238 if (code.mod & KMOD_NUM)238 if (code.mod & KMOD_NUM) {
239 break;239 break;
240 /* no break */240 }
241 FALLS_THROUGH;
241 case SDLK_DELETE:242 case SDLK_DELETE:
242 if (d_->cursor_pos < d_->text.size()) {243 if (d_->cursor_pos < d_->text.size()) {
243 d_->erase_bytes(d_->cursor_pos, d_->next_char(d_->cursor_pos));244 d_->erase_bytes(d_->cursor_pos, d_->next_char(d_->cursor_pos));
@@ -256,7 +257,7 @@
256 if (code.mod & KMOD_NUM) {257 if (code.mod & KMOD_NUM) {
257 break;258 break;
258 }259 }
259 /* no break */260 FALLS_THROUGH;
260 case SDLK_LEFT: {261 case SDLK_LEFT: {
261 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {262 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
262 uint32_t newpos = d_->prev_char(d_->cursor_pos);263 uint32_t newpos = d_->prev_char(d_->cursor_pos);
@@ -279,7 +280,7 @@
279 if (code.mod & KMOD_NUM) {280 if (code.mod & KMOD_NUM) {
280 break;281 break;
281 }282 }
282 /* no break */283 FALLS_THROUGH;
283 case SDLK_RIGHT:284 case SDLK_RIGHT:
284 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {285 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
285 uint32_t newpos = d_->next_char(d_->cursor_pos);286 uint32_t newpos = d_->next_char(d_->cursor_pos);
@@ -297,7 +298,7 @@
297 if (code.mod & KMOD_NUM) {298 if (code.mod & KMOD_NUM) {
298 break;299 break;
299 }300 }
300 /* no break */301 FALLS_THROUGH;
301 case SDLK_DOWN:302 case SDLK_DOWN:
302 if (d_->cursor_pos < d_->text.size()) {303 if (d_->cursor_pos < d_->text.size()) {
303 d_->refresh_ww();304 d_->refresh_ww();
@@ -326,7 +327,7 @@
326 if (code.mod & KMOD_NUM) {327 if (code.mod & KMOD_NUM) {
327 break;328 break;
328 }329 }
329 /* no break */330 FALLS_THROUGH;
330 case SDLK_UP:331 case SDLK_UP:
331 if (d_->cursor_pos > 0) {332 if (d_->cursor_pos > 0) {
332 d_->refresh_ww();333 d_->refresh_ww();
@@ -353,7 +354,7 @@
353 if (code.mod & KMOD_NUM) {354 if (code.mod & KMOD_NUM) {
354 break;355 break;
355 }356 }
356 /* no break */357 FALLS_THROUGH;
357 case SDLK_HOME:358 case SDLK_HOME:
358 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {359 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
359 d_->set_cursor_pos(0);360 d_->set_cursor_pos(0);
@@ -371,7 +372,7 @@
371 if (code.mod & KMOD_NUM) {372 if (code.mod & KMOD_NUM) {
372 break;373 break;
373 }374 }
374 /* no break */375 FALLS_THROUGH;
375 case SDLK_END:376 case SDLK_END:
376 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {377 if (code.mod & (KMOD_LCTRL | KMOD_RCTRL)) {
377 d_->set_cursor_pos(d_->text.size());378 d_->set_cursor_pos(d_->text.size());
378379
=== 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-17 14:22:37 +0000
@@ -631,9 +631,10 @@
631631
632 switch (code.sym) {632 switch (code.sym) {
633 case SDLK_KP_PERIOD:633 case SDLK_KP_PERIOD:
634 if (code.mod & KMOD_NUM)634 if (code.mod & KMOD_NUM) {
635 break;635 break;
636 /* no break */636 }
637 FALLS_THROUGH;
637 case SDLK_DELETE:638 case SDLK_DELETE:
638 clicked_delete();639 clicked_delete();
639 return true;640 return true;
640641
=== 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-17 14:22:37 +0000
@@ -26,6 +26,7 @@
26#include "graphic/graphic.h"26#include "graphic/graphic.h"
27#include "logic/game.h"27#include "logic/game.h"
28#include "logic/player.h"28#include "logic/player.h"
29#include "logic/player_end_result.h"
29#include "logic/playersmanager.h"30#include "logic/playersmanager.h"
30#include "ui_basic/box.h"31#include "ui_basic/box.h"
31#include "ui_basic/button.h"32#include "ui_basic/button.h"
@@ -147,7 +148,7 @@
147 Widelands::PlayerEndStatus pes = players_status.at(i);148 Widelands::PlayerEndStatus pes = players_status.at(i);
148 if (ipl && pes.player == ipl->player_number()) {149 if (ipl && pes.player == ipl->player_number()) {
149 local_in_game = true;150 local_in_game = true;
150 local_won = pes.result == Widelands::PlayerEndResult::PLAYER_WON;151 local_won = pes.result == Widelands::PlayerEndResult::kWon;
151 current_player_position = i;152 current_player_position = i;
152 }153 }
153 Widelands::Player* p = game_.get_player(pes.player);154 Widelands::Player* p = game_.get_player(pes.player);
@@ -163,11 +164,11 @@
163 // Status164 // Status
164 std::string stat_str;165 std::string stat_str;
165 switch (pes.result) {166 switch (pes.result) {
166 case Widelands::PlayerEndResult::PLAYER_LOST:167 case Widelands::PlayerEndResult::kLost:
167 /** TRANSLATORS: This is shown in the game summary for the players who have lost. */168 /** TRANSLATORS: This is shown in the game summary for the players who have lost. */
168 stat_str = _("Lost");169 stat_str = _("Lost");
169 break;170 break;
170 case Widelands::PlayerEndResult::PLAYER_WON:171 case Widelands::PlayerEndResult::kWon:
171 /** TRANSLATORS: This is shown in the game summary for the players who have won. */172 /** TRANSLATORS: This is shown in the game summary for the players who have won. */
172 stat_str = _("Won");173 stat_str = _("Won");
173 if (!single_won) {174 if (!single_won) {
@@ -176,11 +177,11 @@
176 teawon_ = p->team_number();177 teawon_ = p->team_number();
177 }178 }
178 break;179 break;
179 case Widelands::PlayerEndResult::PLAYER_RESIGNED:180 case Widelands::PlayerEndResult::kResigned:
180 /** TRANSLATORS: This is shown in the game summary for the players who have resigned. */181 /** TRANSLATORS: This is shown in the game summary for the players who have resigned. */
181 stat_str = _("Resigned");182 stat_str = _("Resigned");
182 break;183 break;
183 case Widelands::PlayerEndResult::UNDEFINED:184 case Widelands::PlayerEndResult::kUndefined:
184 /** TRANSLATORS: This is shown in the game summary when we don't know */185 /** TRANSLATORS: This is shown in the game summary when we don't know */
185 /** TRANSLATORS: if the player has lost or won. */186 /** TRANSLATORS: if the player has lost or won. */
186 stat_str = pgettext("player_won", "Unknown");187 stat_str = pgettext("player_won", "Unknown");
187188
=== 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-17 14:22:37 +0000
@@ -774,9 +774,10 @@
774 if (down) {774 if (down) {
775 switch (code.sym) {775 switch (code.sym) {
776 case SDLK_KP_9:776 case SDLK_KP_9:
777 if (code.mod & KMOD_NUM)777 if (code.mod & KMOD_NUM) {
778 break;778 break;
779 /* no break */779 }
780 FALLS_THROUGH;
780 case SDLK_PAGEUP:781 case SDLK_PAGEUP:
781 if (upcast(Game, game, &egbase_)) {782 if (upcast(Game, game, &egbase_)) {
782 if (GameController* const ctrl = game->game_controller()) {783 if (GameController* const ctrl = game->game_controller()) {
@@ -794,9 +795,10 @@
794 return true;795 return true;
795796
796 case SDLK_KP_3:797 case SDLK_KP_3:
797 if (code.mod & KMOD_NUM)798 if (code.mod & KMOD_NUM) {
798 break;799 break;
799 /* no break */800 }
801 FALLS_THROUGH;
800 case SDLK_PAGEDOWN:802 case SDLK_PAGEDOWN:
801 if (upcast(Widelands::Game, game, &egbase_)) {803 if (upcast(Widelands::Game, game, &egbase_)) {
802 if (GameController* const ctrl = game->game_controller()) {804 if (GameController* const ctrl = game->game_controller()) {
803805
=== 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-17 14:22:37 +0000
@@ -320,7 +320,7 @@
320 case SDLK_KP_7:320 case SDLK_KP_7:
321 if (code.mod & KMOD_NUM)321 if (code.mod & KMOD_NUM)
322 break;322 break;
323 /* no break */323 FALLS_THROUGH;
324 case SDLK_HOME:324 case SDLK_HOME:
325 move_view_to(game().map().get_starting_pos(player_number_));325 move_view_to(game().map().get_starting_pos(player_number_));
326 return true;326 return true;

Subscribers

People subscribed via source and target branches

to all changes: