From 8923978c700302a2f19f106a43905b8e061495c1 Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Wed, 19 Apr 2017 04:08:10 -0400 Subject: [PATCH] Squash some MSVC warnings --- src/ai/formula/callable_objects.cpp | 7 ++----- src/gui/dialogs/editor/custom_tod.cpp | 2 +- src/scripting/game_lua_kernel.cpp | 1 + src/scripting/lua_gui2.cpp | 4 ++-- src/units/unit.hpp | 4 ++-- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/src/ai/formula/callable_objects.cpp b/src/ai/formula/callable_objects.cpp index 2f394c40703c..33fc7a269900 100644 --- a/src/ai/formula/callable_objects.cpp +++ b/src/ai/formula/callable_objects.cpp @@ -394,11 +394,8 @@ variant set_unit_var_callable::execute_self(variant ctxt) { } variant fallback_callable::execute_self(variant) { -// if(get_recursion_count() < recursion_counter::MAX_COUNTER_VALUE) { - //we want give control of the side to human for the rest of this turn - throw fallback_ai_to_human_exception(); -// } - return variant(false); + // We want give control of the side to human for the rest of this turn + throw fallback_ai_to_human_exception(); } } diff --git a/src/gui/dialogs/editor/custom_tod.cpp b/src/gui/dialogs/editor/custom_tod.cpp index a7253e24d5b1..3d53427b921b 100644 --- a/src/gui/dialogs/editor/custom_tod.cpp +++ b/src/gui/dialogs/editor/custom_tod.cpp @@ -257,7 +257,7 @@ const time_of_day& custom_tod::get_selected_tod() const try { return times_.at(current_tod_); } catch(std::out_of_range&) { - assert(false && "Attempted to fetch a non-existant ToD!"); + throw std::string("Attempted to fetch a non-existant ToD!"); } } diff --git a/src/scripting/game_lua_kernel.cpp b/src/scripting/game_lua_kernel.cpp index 47f36c788a52..7fd1656cd7ed 100644 --- a/src/scripting/game_lua_kernel.cpp +++ b/src/scripting/game_lua_kernel.cpp @@ -1461,6 +1461,7 @@ int game_lua_kernel::impl_end_level_data_set(lua_State* L) static int impl_end_level_data_collect(lua_State* L) { end_level_data* data = static_cast(lua_touserdata(L, 1)); + data; // Suppress an erroneous MSVC warning (a destructor call doesn't count as a reference) data->~end_level_data(); return 0; } diff --git a/src/scripting/lua_gui2.cpp b/src/scripting/lua_gui2.cpp index f19814fa51ea..1e3d039c8671 100644 --- a/src/scripting/lua_gui2.cpp +++ b/src/scripting/lua_gui2.cpp @@ -435,10 +435,10 @@ int intf_set_dialog_value(lua_State* L) std::vector selected_vec = lua_check>(L, 1); std::set selected(selected_vec.begin(), selected_vec.end()); for(unsigned i = 0; i < list->get_item_count(); i++) { - list->select_row(i, selected.count(i + 1)); + list->select_row(i, selected.count(i + 1) > 0); } for(unsigned i = 0; i < list->get_item_count(); i++) { - list->select_row(i, selected.count(i + 1)); + list->select_row(i, selected.count(i + 1) > 0); } } else { int v = luaL_checkinteger(L, 1); diff --git a/src/units/unit.hpp b/src/units/unit.hpp index 5dc9143fd804..2821b23b0339 100644 --- a/src/units/unit.hpp +++ b/src/units/unit.hpp @@ -846,10 +846,10 @@ class unit { template typename std::enable_if::value, std::string>::type - operator()(T& v) const + operator()(T&) const { // Any special upkeep type should have an associated @ref type getter in its helper struct. - return v.type(); + return T::type(); } std::string operator()(int v) const