← Back to team overview

widelands-dev team mailing list archive

[Merge] lp:~widelands-dev/widelands/bug-1744583_fix_global_helptexts into lp:widelands

 

kaputtnik has proposed merging lp:~widelands-dev/widelands/bug-1744583_fix_global_helptexts into lp:widelands.

Commit message:
fix rt rendering of the building help

Requested reviews:
  Widelands Developers (widelands-dev)
Related bugs:
  Bug #1744583 in widelands: "Building help looks weird"
  https://bugs.launchpad.net/widelands/+bug/1744583

For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-1744583_fix_global_helptexts/+merge/337051

The problem is that data/tribes/scripting/help/building_help.lua is used in the tribal encyclopedia and for the building help. Adding 'rt' tags to the building_help.lua causes a crash when opening the tribal encyclopedia then. For the tribal encyclopedia the 'rt' tags get added when calling as_message().

https://bazaar.launchpad.net/~widelands-dev/widelands/trunk/view/head:/src/wui/encyclopedia_window.cc#L171

I guess the crash happens because we have double 'rt' tags then (one time in the building_help.lua and one time when calling as_message().

The solution is to add the 'rt' tags for the building_help when the building_help window get opened. I used the method text_layout:as_waresinfo() for this. IMHO this looks as expected.

Sorry for the bad named branch :-S
-- 
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-1744583_fix_global_helptexts into lp:widelands.
=== modified file 'src/wui/helpwindow.cc'
--- src/wui/helpwindow.cc	2017-02-26 12:16:09 +0000
+++ src/wui/helpwindow.cc	2018-02-02 11:36:20 +0000
@@ -55,7 +55,8 @@
 		cr->resume();
 		std::unique_ptr<LuaTable> return_table = cr->pop_table();
 		return_table->do_not_warn_about_unaccessed_keys();  // We won't display the title here
-		textarea_->set_text(return_table->get_string("text"));
+		textarea_->force_new_renderer();
+		textarea_->set_text(as_waresinfo(return_table->get_string("text")));
 	} catch (LuaError& err) {
 		textarea_->set_text(err.what());
 	}


Follow ups