Fix an issue with translatable strings that included a possible plural

This commit is contained in:
Celtic Minstrel 2016-08-31 21:01:17 -04:00
parent 43bad8cc13
commit 742b4b0be3
2 changed files with 5 additions and 2 deletions

View file

@ -69,7 +69,8 @@ local function generate_objectives(cfg)
if turn_limit >= current_turn then
local turn_count = turn_limit - current_turn + 1
turn_counter = _("(this turn left)", "(%d turns left)", turn_count)
turn_counter = tostring("<span foreground='white'><small> " .. turn_counter .. "</small></span>"):format(turn_count)
turn_counter = tostring(turn_counter):format(turn_count)
turn_counter = "<span foreground='white'><small> " .. turn_counter .. "</small></span>"
end
end

View file

@ -144,7 +144,9 @@ void t_string_base::walker::update()
case PLURAL_PART:
begin_ = string_.find_first_of(mark, end_ + 5);
if(begin_ == PLURAL_PART) {
if(begin_ == std::string::npos)
begin_ = string_.size();
if(string_[begin_] == PLURAL_PART) {
ERR_CF << "Error: invalid string: " << string_ << std::endl;
begin_ = string_.size();
return;