widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #08024
[Merge] lp:~widelands-dev/widelands/bug-1610162-territorial-lord into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/bug-1610162-territorial-lord into lp:widelands.
Commit message:
- Fixed message formatting in Territorial Lord win condition.
- Made some variables const in LuaPlayer::send_message.
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1610162 in widelands: "Richtext bug in Territorial Lord status messages"
https://bugs.launchpad.net/widelands/+bug/1610162
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1610162-territorial-lord/+merge/302219
This fixes the content of the status messages in Territorial Lord.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1610162-territorial-lord into lp:widelands.
=== modified file 'data/scripting/win_conditions/territorial_lord.lua'
--- data/scripting/win_conditions/territorial_lord.lua 2016-03-15 08:42:41 +0000
+++ data/scripting/win_conditions/territorial_lord.lua 2016-08-07 08:17:29 +0000
@@ -3,6 +3,7 @@
-- =======================================================================
include "scripting/coroutine.lua" -- for sleep
+include "scripting/formatting.lua"
include "scripting/messages.lua"
include "scripting/table.lua"
include "scripting/win_conditions/win_condition_functions.lua"
@@ -168,12 +169,12 @@
remaining_time / 60))
:format(remaining_time / 60)
- for idx, p in ipairs(plrs) do
- if candidateisteam and currentcandidate == p.team
- or not candidateisteam and currentcandidate == p.name then
- send_message(p, game_status.title, msg2, {popup = true})
+ for idx, player in ipairs(plrs) do
+ if candidateisteam and currentcandidate == player.team
+ or not candidateisteam and currentcandidate == player.name then
+ send_message(player, game_status.title, rt(p(msg2)), {popup = true})
else
- send_message(p, game_status.title, msg1, {popup = true})
+ send_message(player, game_status.title, rt(p(msg1)), {popup = true})
end
end
end
=== modified file 'src/scripting/lua_game.cc'
--- src/scripting/lua_game.cc 2016-08-04 15:49:05 +0000
+++ src/scripting/lua_game.cc 2016-08-07 08:17:29 +0000
@@ -321,9 +321,9 @@
*/
int LuaPlayer::send_message(lua_State* L) {
uint32_t n = lua_gettop(L);
- std::string title = luaL_checkstring(L, 2);
+ const std::string title = luaL_checkstring(L, 2);
std::string heading = title;
- std::string body = luaL_checkstring(L, 3);
+ const std::string body = luaL_checkstring(L, 3);
std::string icon = "images/wui/messages/menu_toggle_objectives_menu.png";
Coords c = Coords::null();
Message::Status st = Message::Status::kNew;
@@ -341,7 +341,7 @@
lua_getfield(L, 4, "status");
if (!lua_isnil(L, -1)) {
- std::string s = luaL_checkstring(L, -1);
+ const std::string s = luaL_checkstring(L, -1);
if (s == "new")
st = Message::Status::kNew;
else if (s == "read")
@@ -360,14 +360,14 @@
lua_getfield(L, 4, "icon");
if (!lua_isnil(L, -1)) {
- std::string s = luaL_checkstring(L, -1);
+ const std::string s = luaL_checkstring(L, -1);
if (!s.empty()) {
icon = s;
}
}
lua_getfield(L, 4, "heading");
if (!lua_isnil(L, -1)) {
- std::string s = luaL_checkstring(L, -1);
+ const std::string s = luaL_checkstring(L, -1);
if (!s.empty()) {
heading = s;
}
Follow ups