bool QueueEventProcessing(Funds & funds, u8 mul) { const s8 index = GetIndexClick(); if(index >= 0) { u8 rs = Resource::FromIndexSprite2(index); u8 step = rs == Resource::GOLD ? 100 : 1; u32 cur = resource.Get(rs); u32 sel = cur; u32 max = mul > 1 ? (funds.Get(rs) + resource.Get(rs)) / mul : funds.Get(rs) + resource.Get(rs); if(0 == mul) { Dialog::Message("", "First select recipients!", Font::BIG, Dialog::OK); } else if(0 == max) { std::string msg = _("You cannot select %{resource}!"); String::Replace(msg, "%{resource}", Resource::String(rs)); Dialog::Message("", msg, Font::BIG, Dialog::OK); } else { std::string msg = _("Select count %{resource}:"); String::Replace(msg, "%{resource}", Resource::String(rs)); if(Dialog::SelectCount(msg, 0, max, sel, step) && cur != sel) { s32* from = funds.GetPtr(rs); s32* to = resource.GetPtr(rs); if(from && to) { s32 count = sel - cur; *from -= mul > 1 ? count * mul : count; *to += count; return true; } } } } return false; }
std::string CapturedExtInfoString(int res, int color, const Funds & funds) { std::ostringstream os; os << world.CountCapturedMines(res, color); const s32 vals = funds.Get(res); if(vals) { os << " " << "("; if(vals > 0) os << "+"; os << vals << ")"; } return os.str(); }