[Widelands-dev] [Merge] lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands
The proposal to merge lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands has been updated. Status: Needs review => Merged For more details, see: https://code.launchpad.net/~widelands-dev/widelands/fh1-winconditions/+merge/323987 -- Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/fh1-winconditions. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands
Thanks for the review :) @bunnybot merge -- https://code.launchpad.net/~widelands-dev/widelands/fh1-winconditions/+merge/323987 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/fh1-winconditions. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands
Review: Approve code review Code Revire is ok for me. In case of an error some layout may be broken, well. We will find that. -- https://code.launchpad.net/~widelands-dev/widelands/fh1-winconditions/+merge/323987 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/fh1-winconditions. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands
Sorry, wrong branch :-S -- https://code.launchpad.net/~widelands-dev/widelands/fh1-winconditions/+merge/323987 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/fh1-winconditions. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands
Review: Approve testing This looks really good now :-) Played an hour or so but no crash anymore. The output of 'new size' is a bit annoying, i guess it switches between Kilobytes and Bytes (?): TransientCache: Dropping 11 bytes, new size 4082. [...] TransientCache: Dropping 4032 bytes, new size 31452972. [...] [...] TransientCache: Dropping 4 bytes, new size 4092. But it never exceeds the size of 4093 (as far as i can see). There are a lot of such outputs if you just move the mouse around, also moving the mouse on black areas. Don't know if this much processor time consuming. Maybe here is a chance of optimization? -- https://code.launchpad.net/~widelands-dev/widelands/fh1-winconditions/+merge/323987 Your team Widelands Developers is subscribed to branch lp:~widelands-dev/widelands/fh1-winconditions. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands
The crash is this bug: https://bugs.launchpad.net/widelands/+bug/1648785 -- https://code.launchpad.net/~widelands-dev/widelands/fh1-winconditions/+merge/323987 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands
Yes, it must be a problem that we have in trunk already - the worst thing that should happen here is reverting to the old font renderer if the text can't be parsed and the ending up with empty text or lots of visible tags. -- https://code.launchpad.net/~widelands-dev/widelands/fh1-winconditions/+merge/323987 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands
I played this some time now and got an ugly crash, here: Cmd_EnemyFlagAction::execute player(3): flag->owner(4) number=4 Assertion failed: (it != entries_.end()), function drop, file /Users/klaus/develop/widelands-repo/fh1-winconditions/src/graphic/texture_cache.cc, line 79. 3 libsystem_c.dylib 0x7fffb52b3893 __assert_rtn + 320 4 widelands 0x00010f9d6bad TextureCache::drop() + 845 (texture_cache.cc:79) 5 widelands 0x00010f9d6121 TextureCache::insert(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, std::__1::unique_ptr<Texture, std::__1::default_delete >) + 801 (texture_cache.cc:63) 6 widelands 0x00010f3b6aac RT::SdlTtfFont::render(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, RGBColor const&, int, TextureCache*) + 3932 (sdl_ttf_font.cc:131) 7 widelands 0x00010f393ac5 RT::TextNode::render(TextureCache*) + 85 (rt_render.cc:521) 8 widelands 0x00010f3a2764 RT::DivTagRenderNode::render(TextureCache*) + 3012 (rt_render.cc:746) 9 widelands 0x00010f39bfeb RT::Renderer::render(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, unsigned short, std::__1::set<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, std::__1::less<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > > > const&) + 315 (rt_render.cc:1487) 10 widelands 0x00010f2b6876 (anonymous namespace)::RTImage::texture() const + 262 (font_handler1.cc:92) 11 widelands 0x00010f2b6685 (anonymous namespace)::RTImage::width() const + 21 (font_handler1.cc:75) 12 widelands 0x00010f2b3612 UI::FontHandler1::render(std::__1::basic_string<char, std::__1::char_traits, Maybe this is again the memory problem we face on trunk, no idea, mmh -- https://code.launchpad.net/~widelands-dev/widelands/fh1-winconditions/+merge/323987 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands
Continuous integration builds have changed state: Travis build 2179. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/231575243. Appveyor build 2014. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_fh1_winconditions-2014. -- https://code.launchpad.net/~widelands-dev/widelands/fh1-winconditions/+merge/323987 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
Re: [Widelands-dev] [Merge] lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands
Uhm, this is all lua, what would be the way to test this? I cannot judge much about that code. I will however compile the code and play around with some winconditions -- https://code.launchpad.net/~widelands-dev/widelands/fh1-winconditions/+merge/323987 Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands. ___ Mailing list: https://launchpad.net/~widelands-dev Post to : widelands-dev@lists.launchpad.net Unsubscribe : https://launchpad.net/~widelands-dev More help : https://help.launchpad.net/ListHelp
[Widelands-dev] [Merge] lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands. Commit message: Converted win condition scripts to new font renderer. Formatting functions for the new renderer live in data/scripting/richtext.lua Requested reviews: Widelands Developers (widelands-dev) For more details, see: https://code.launchpad.net/~widelands-dev/widelands/fh1-winconditions/+merge/323987 I decided to add a separate script for the formatting stuff. This way, we can keep the old renderer around until after the release so that savegames won't crash. I will replace the online documentation for Richtext once we have support for campaign scenarios - I haven't touched the message boxes and objectives yet. -- Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/fh1-winconditions into lp:widelands. === modified file 'data/scripting/formatting.lua' --- data/scripting/formatting.lua 2016-10-19 09:00:29 + +++ data/scripting/formatting.lua 2017-05-12 14:03:15 + @@ -1,3 +1,6 @@ +-- TODO(GunChleoc): This is for the legacy font renderer. Remove when we remove the old renderer. + + -- RST -- formatting.lua -- -- === added file 'data/scripting/richtext.lua' --- data/scripting/richtext.lua 1970-01-01 00:00:00 + +++ data/scripting/richtext.lua 2017-05-12 14:03:15 + @@ -0,0 +1,412 @@ +-- NOCOM(GunChleoc): Wrap all tags and document allowed attributes when we're done +-- RST +-- formatting.lua +-- -- +-- +-- Functions to simplify and unique text formatting in scenarios and help files. +-- Most of these functions are simple wrapper functions that make working with +-- widelands rich text formatting system more bearable. +-- Function names generally follow HTML names. + + +-- RST +-- .. function:: localize_list(items, listtype, former_textdomain) +-- +--Turns an array of string items into a localized string list with +--appropriate concatenation. +-- +--e.g. localize_list({"foo", "bar", baz"}, "or", "widelands") will return +--_"foo, bar or baz" +-- +--:arg items: An array of strings +--:arg listtype: The type of concatenation to use. +-- Legal values are "&", "and", "or", and ";" +--:arg former_textdomain: The textdomain to restore after running this function. +--:returns: The concatenated list string, using localized concatenation operators. +-- +-- Same algorithm as in src/base/i18n +function localize_list(items, listtype, former_textdomain) + set_textdomain("widelands") + local result = "" + for i, item in pairs(items) do + if (i == 1) then + result = item + elseif (i == #items) then + if (listtype == "&") then +result = _"%1$s & %2$s":bformat(result, item) + elseif (listtype == "or") then +result = _"%1$s or %2$s":bformat(result, item) + elseif (listtype == ",") then +result = _"%1$s, %2$s":bformat(result, item) + else +result = _"%1$s and %2$s":bformat(result, item) + end + else + result = _"%1$s, %2$s":bformat(result, item) + end + end + set_textdomain(former_textdomain) + return result +end + + +-- RST +-- .. function:: rt(text_or_attributes[, text = nil]) +-- +--Wraps a block of text into Lua rich text. +--Only call this once for the whole text that gets sent to the backend. +--There is no general need to wrap an rt tag around your text, +--because the backend will take care of it. +--So, only use this function if you wish to add some attributes to the tag. +-- +--Allowed attributes are: +-- padding, padding_r, padding_l, padding_b, padding_t: NOCOM(GunChleoc): Document +-- background: a background color or image +-- debug: add visual debug information and debug log +-- editor_mode: allow multiple blank spaces for editing +-- +--:arg attributes: the attributes for the rt tag. +--:type attributes: :class:`string` +--:arg text: the text to be enclosed in rich text tags. +--:type text: :class:`string` +--:returns: the wrapped rich text. +-- +function rt(text_or_attributes, text) + if text then + return "" .. text .. "" + else + return "" .. text_or_attributes .. "" + end +end + + +-- RST +-- .. function:: img(src[, attributes = nil]) +-- +--Turns an image src path into an image tag for richtext. +-- +--:arg src: the file path to the image. +--:type src: :class:`string` +--:arg attributes: the attributes for the div tag. +--:type attributes: :class:`string` +-- +--Allowed attributes are: +-- color: a hex color