|
|
@@ -400,14 +400,25 @@ CSplitWindow::CSplitWindow(const CCreature * creature, std::function<void(int, i
|
|
|
|
|
|
void CSplitWindow::setAmountText(std::string text, bool left)
|
|
|
{
|
|
|
- try
|
|
|
- {
|
|
|
- setAmount(boost::lexical_cast<int>(text), left);
|
|
|
- slider->moveTo(rightAmount - rightMin);
|
|
|
- }
|
|
|
- catch(boost::bad_lexical_cast &)
|
|
|
+ int amount = 0;
|
|
|
+ if (text.length())
|
|
|
{
|
|
|
+ try
|
|
|
+ {
|
|
|
+ amount = boost::lexical_cast<int>(text);
|
|
|
+ }
|
|
|
+ catch(boost::bad_lexical_cast &)
|
|
|
+ {
|
|
|
+ amount = left ? leftAmount : rightAmount;
|
|
|
+ }
|
|
|
+
|
|
|
+ int total = leftAmount + rightAmount;
|
|
|
+ if (amount > total)
|
|
|
+ amount = total;
|
|
|
}
|
|
|
+
|
|
|
+ setAmount(amount, left);
|
|
|
+ slider->moveTo(rightAmount - rightMin);
|
|
|
}
|
|
|
|
|
|
void CSplitWindow::setAmount(int value, bool left)
|