mirror of
https://github.com/OpenMW/openmw.git
synced 2025-12-01 19:04:32 +00:00
Address more conversion warnings in the engine
This commit is contained in:
parent
fc700c61fd
commit
bcad4a7fd5
25 changed files with 176 additions and 176 deletions
|
|
@ -441,8 +441,9 @@ namespace MWDialogue
|
||||||
|
|
||||||
// Get the sum of disposition effects minus charm (shouldn't be made permanent)
|
// Get the sum of disposition effects minus charm (shouldn't be made permanent)
|
||||||
npcStats.setBaseDisposition(0);
|
npcStats.setBaseDisposition(0);
|
||||||
int zero = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor, false)
|
int zero = static_cast<int>(
|
||||||
- npcStats.getMagicEffects().getOrDefault(ESM::MagicEffect::Charm).getMagnitude();
|
MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor, false)
|
||||||
|
- npcStats.getMagicEffects().getOrDefault(ESM::MagicEffect::Charm).getMagnitude());
|
||||||
|
|
||||||
// Clamp new permanent disposition to avoid negative derived disposition (can be caused by intimidate)
|
// Clamp new permanent disposition to avoid negative derived disposition (can be caused by intimidate)
|
||||||
int disposition = std::clamp(mOriginalDisposition + mPermanentDispositionChange, -zero, 100 - zero);
|
int disposition = std::clamp(mOriginalDisposition + mPermanentDispositionChange, -zero, 100 - zero);
|
||||||
|
|
|
||||||
|
|
@ -400,7 +400,7 @@ int MWDialogue::Filter::getSelectStructInteger(const SelectWrapper& select) cons
|
||||||
case ESM::DialogueCondition::Function_PcLuck:
|
case ESM::DialogueCondition::Function_PcLuck:
|
||||||
{
|
{
|
||||||
ESM::RefId attribute = ESM::Attribute::indexToRefId(select.getArgument());
|
ESM::RefId attribute = ESM::Attribute::indexToRefId(select.getArgument());
|
||||||
return player.getClass().getCreatureStats(player).getAttribute(attribute).getModified();
|
return static_cast<int>(player.getClass().getCreatureStats(player).getAttribute(attribute).getModified());
|
||||||
}
|
}
|
||||||
case ESM::DialogueCondition::Function_PcBlock:
|
case ESM::DialogueCondition::Function_PcBlock:
|
||||||
case ESM::DialogueCondition::Function_PcArmorer:
|
case ESM::DialogueCondition::Function_PcArmorer:
|
||||||
|
|
|
||||||
|
|
@ -216,7 +216,7 @@ namespace MWGui
|
||||||
std::set<std::string> itemNames, itemEffects;
|
std::set<std::string> itemNames, itemEffects;
|
||||||
for (size_t i = 0; i < mModel->getItemCount(); ++i)
|
for (size_t i = 0; i < mModel->getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
MWWorld::Ptr item = mModel->getItem(i).mBase;
|
MWWorld::Ptr item = mModel->getItem(static_cast<ItemModel::ModelIndex>(i)).mBase;
|
||||||
if (item.getType() != ESM::Ingredient::sRecordId)
|
if (item.getType() != ESM::Ingredient::sRecordId)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
@ -376,7 +376,7 @@ namespace MWGui
|
||||||
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &AlchemyWindow::onItemCancel);
|
mItemSelectionDialog->eventDialogCanceled += MyGUI::newDelegate(this, &AlchemyWindow::onItemCancel);
|
||||||
mItemSelectionDialog->setVisible(true);
|
mItemSelectionDialog->setVisible(true);
|
||||||
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
|
mItemSelectionDialog->openContainer(MWMechanics::getPlayer());
|
||||||
mItemSelectionDialog->getSortModel()->setApparatusTypeFilter(i);
|
mItemSelectionDialog->getSortModel()->setApparatusTypeFilter(static_cast<int32_t>(i));
|
||||||
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyAlchemyTools);
|
mItemSelectionDialog->setFilter(SortFilterItemModel::Filter_OnlyAlchemyTools);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -459,7 +459,7 @@ namespace MWGui
|
||||||
for (const MWMechanics::EffectKey& effectKey : effectIds)
|
for (const MWMechanics::EffectKey& effectKey : effectIds)
|
||||||
{
|
{
|
||||||
Widgets::SpellEffectParams params;
|
Widgets::SpellEffectParams params;
|
||||||
params.mEffectID = effectKey.mId;
|
params.mEffectID = static_cast<short>(effectKey.mId);
|
||||||
const ESM::MagicEffect* magicEffect
|
const ESM::MagicEffect* magicEffect
|
||||||
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effectKey.mId);
|
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effectKey.mId);
|
||||||
if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetSkill)
|
if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetSkill)
|
||||||
|
|
@ -589,11 +589,11 @@ namespace MWGui
|
||||||
if (arg.button == SDL_CONTROLLER_BUTTON_B)
|
if (arg.button == SDL_CONTROLLER_BUTTON_B)
|
||||||
{
|
{
|
||||||
// Remove active ingredients or close the window, starting with right-most slot.
|
// Remove active ingredients or close the window, starting with right-most slot.
|
||||||
for (int i = mIngredients.size() - 1; i >= 0; --i)
|
for (size_t i = mIngredients.size(); i > 0; --i)
|
||||||
{
|
{
|
||||||
if (mIngredients[i]->isUserString("ToolTipType"))
|
if (mIngredients[i - 1]->isUserString("ToolTipType"))
|
||||||
{
|
{
|
||||||
onIngredientSelected(mIngredients[i]);
|
onIngredientSelected(mIngredients[i - 1]);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,76 @@ namespace
|
||||||
info.advance /= scale;
|
info.advance /= scale;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ucsLineBreak(Utf8Stream::UnicodeChar codePoint)
|
||||||
|
{
|
||||||
|
return codePoint == '\n';
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ucsCarriageReturn(Utf8Stream::UnicodeChar codePoint)
|
||||||
|
{
|
||||||
|
return codePoint == '\r';
|
||||||
|
}
|
||||||
|
|
||||||
|
// Normal no-break space (0x00A0) is ignored here
|
||||||
|
// because Morrowind compatibility requires us to render its glyph
|
||||||
|
bool ucsSpace(Utf8Stream::UnicodeChar codePoint)
|
||||||
|
{
|
||||||
|
switch (codePoint)
|
||||||
|
{
|
||||||
|
case 0x0020: // SPACE
|
||||||
|
case 0x1680: // OGHAM SPACE MARK
|
||||||
|
case 0x180E: // MONGOLIAN VOWEL SEPARATOR
|
||||||
|
case 0x2000: // EN QUAD
|
||||||
|
case 0x2001: // EM QUAD
|
||||||
|
case 0x2002: // EN SPACE
|
||||||
|
case 0x2003: // EM SPACE
|
||||||
|
case 0x2004: // THREE-PER-EM SPACE
|
||||||
|
case 0x2005: // FOUR-PER-EM SPACE
|
||||||
|
case 0x2006: // SIX-PER-EM SPACE
|
||||||
|
case 0x2007: // FIGURE SPACE
|
||||||
|
case 0x2008: // PUNCTUATION SPACE
|
||||||
|
case 0x2009: // THIN SPACE
|
||||||
|
case 0x200A: // HAIR SPACE
|
||||||
|
case 0x200B: // ZERO WIDTH SPACE
|
||||||
|
case 0x202F: // NARROW NO-BREAK SPACE
|
||||||
|
case 0x205F: // MEDIUM MATHEMATICAL SPACE
|
||||||
|
case 0x3000: // IDEOGRAPHIC SPACE
|
||||||
|
case 0xFEFF: // ZERO WIDTH NO-BREAK SPACE
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No-break spaces (0x00A0, 0x202F, 0xFEFF - normal, narrow, zero width)
|
||||||
|
// are ignored here for obvious reasons
|
||||||
|
// Figure space (0x2007) is not a breaking space either
|
||||||
|
bool ucsBreakingSpace(int codePoint)
|
||||||
|
{
|
||||||
|
switch (codePoint)
|
||||||
|
{
|
||||||
|
case 0x0020: // SPACE
|
||||||
|
case 0x1680: // OGHAM SPACE MARK
|
||||||
|
case 0x180E: // MONGOLIAN VOWEL SEPARATOR
|
||||||
|
case 0x2000: // EN QUAD
|
||||||
|
case 0x2001: // EM QUAD
|
||||||
|
case 0x2002: // EN SPACE
|
||||||
|
case 0x2003: // EM SPACE
|
||||||
|
case 0x2004: // THREE-PER-EM SPACE
|
||||||
|
case 0x2005: // FOUR-PER-EM SPACE
|
||||||
|
case 0x2006: // SIX-PER-EM SPACE
|
||||||
|
case 0x2008: // PUNCTUATION SPACE
|
||||||
|
case 0x2009: // THIN SPACE
|
||||||
|
case 0x200A: // HAIR SPACE
|
||||||
|
case 0x200B: // ZERO WIDTH SPACE
|
||||||
|
case 0x205F: // MEDIUM MATHEMATICAL SPACE
|
||||||
|
case 0x3000: // IDEOGRAPHIC SPACE
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
|
|
@ -36,11 +106,6 @@ namespace MWGui
|
||||||
class PageDisplay;
|
class PageDisplay;
|
||||||
class BookPageImpl;
|
class BookPageImpl;
|
||||||
|
|
||||||
static bool ucsSpace(int codePoint);
|
|
||||||
static bool ucsLineBreak(int codePoint);
|
|
||||||
static bool ucsCarriageReturn(int codePoint);
|
|
||||||
static bool ucsBreakingSpace(int codePoint);
|
|
||||||
|
|
||||||
struct BookTypesetter::Style
|
struct BookTypesetter::Style
|
||||||
{
|
{
|
||||||
virtual ~Style() = default;
|
virtual ~Style() = default;
|
||||||
|
|
@ -806,7 +871,7 @@ namespace MWGui
|
||||||
mCursor.top = mOrigin.top + top;
|
mCursor.top = mOrigin.top + top;
|
||||||
}
|
}
|
||||||
|
|
||||||
void emitGlyph(wchar_t ch)
|
void emitGlyph(MyGUI::Char ch)
|
||||||
{
|
{
|
||||||
std::optional<MyGUI::GlyphInfo> info = getGlyphInfo(mFont, ch);
|
std::optional<MyGUI::GlyphInfo> info = getGlyphInfo(mFont, ch);
|
||||||
|
|
||||||
|
|
@ -828,7 +893,7 @@ namespace MWGui
|
||||||
mCursor.left += static_cast<int>(info->bearingX + info->advance);
|
mCursor.left += static_cast<int>(info->bearingX + info->advance);
|
||||||
}
|
}
|
||||||
|
|
||||||
void emitSpace(wchar_t ch)
|
void emitSpace(MyGUI::Char ch)
|
||||||
{
|
{
|
||||||
std::optional<MyGUI::GlyphInfo> info = getGlyphInfo(mFont, ch);
|
std::optional<MyGUI::GlyphInfo> info = getGlyphInfo(mFont, ch);
|
||||||
|
|
||||||
|
|
@ -1368,75 +1433,4 @@ namespace MWGui
|
||||||
factory.registerFactory<BookPageImpl>("Widget");
|
factory.registerFactory<BookPageImpl>("Widget");
|
||||||
factory.registerFactory<PageDisplay>("BasisSkin");
|
factory.registerFactory<PageDisplay>("BasisSkin");
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ucsLineBreak(int codePoint)
|
|
||||||
{
|
|
||||||
return codePoint == '\n';
|
|
||||||
}
|
|
||||||
|
|
||||||
static bool ucsCarriageReturn(int codePoint)
|
|
||||||
{
|
|
||||||
return codePoint == '\r';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normal no-break space (0x00A0) is ignored here
|
|
||||||
// because Morrowind compatibility requires us to render its glyph
|
|
||||||
static bool ucsSpace(int codePoint)
|
|
||||||
{
|
|
||||||
switch (codePoint)
|
|
||||||
{
|
|
||||||
case 0x0020: // SPACE
|
|
||||||
case 0x1680: // OGHAM SPACE MARK
|
|
||||||
case 0x180E: // MONGOLIAN VOWEL SEPARATOR
|
|
||||||
case 0x2000: // EN QUAD
|
|
||||||
case 0x2001: // EM QUAD
|
|
||||||
case 0x2002: // EN SPACE
|
|
||||||
case 0x2003: // EM SPACE
|
|
||||||
case 0x2004: // THREE-PER-EM SPACE
|
|
||||||
case 0x2005: // FOUR-PER-EM SPACE
|
|
||||||
case 0x2006: // SIX-PER-EM SPACE
|
|
||||||
case 0x2007: // FIGURE SPACE
|
|
||||||
case 0x2008: // PUNCTUATION SPACE
|
|
||||||
case 0x2009: // THIN SPACE
|
|
||||||
case 0x200A: // HAIR SPACE
|
|
||||||
case 0x200B: // ZERO WIDTH SPACE
|
|
||||||
case 0x202F: // NARROW NO-BREAK SPACE
|
|
||||||
case 0x205F: // MEDIUM MATHEMATICAL SPACE
|
|
||||||
case 0x3000: // IDEOGRAPHIC SPACE
|
|
||||||
case 0xFEFF: // ZERO WIDTH NO-BREAK SPACE
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// No-break spaces (0x00A0, 0x202F, 0xFEFF - normal, narrow, zero width)
|
|
||||||
// are ignored here for obvious reasons
|
|
||||||
// Figure space (0x2007) is not a breaking space either
|
|
||||||
static bool ucsBreakingSpace(int codePoint)
|
|
||||||
{
|
|
||||||
switch (codePoint)
|
|
||||||
{
|
|
||||||
case 0x0020: // SPACE
|
|
||||||
case 0x1680: // OGHAM SPACE MARK
|
|
||||||
case 0x180E: // MONGOLIAN VOWEL SEPARATOR
|
|
||||||
case 0x2000: // EN QUAD
|
|
||||||
case 0x2001: // EM QUAD
|
|
||||||
case 0x2002: // EN SPACE
|
|
||||||
case 0x2003: // EM SPACE
|
|
||||||
case 0x2004: // THREE-PER-EM SPACE
|
|
||||||
case 0x2005: // FOUR-PER-EM SPACE
|
|
||||||
case 0x2006: // SIX-PER-EM SPACE
|
|
||||||
case 0x2008: // PUNCTUATION SPACE
|
|
||||||
case 0x2009: // THIN SPACE
|
|
||||||
case 0x200A: // HAIR SPACE
|
|
||||||
case 0x200B: // ZERO WIDTH SPACE
|
|
||||||
case 0x205F: // MEDIUM MATHEMATICAL SPACE
|
|
||||||
case 0x3000: // IDEOGRAPHIC SPACE
|
|
||||||
return true;
|
|
||||||
default:
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::Ptr object = item.mBase;
|
MWWorld::Ptr object = item.mBase;
|
||||||
int count = item.mCount;
|
size_t count = item.mCount;
|
||||||
bool shift = MyGUI::InputManager::getInstance().isShiftPressed();
|
bool shift = MyGUI::InputManager::getInstance().isShiftPressed();
|
||||||
if (MyGUI::InputManager::getInstance().isControlPressed())
|
if (MyGUI::InputManager::getInstance().isControlPressed())
|
||||||
count = 1;
|
count = 1;
|
||||||
|
|
@ -101,7 +101,7 @@ namespace MWGui
|
||||||
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
|
CountDialog* dialog = MWBase::Environment::get().getWindowManager()->getCountDialog();
|
||||||
std::string name{ object.getClass().getName(object) };
|
std::string name{ object.getClass().getName(object) };
|
||||||
name += MWGui::ToolTips::getSoulString(object.getCellRef());
|
name += MWGui::ToolTips::getSoulString(object.getCellRef());
|
||||||
dialog->openCountDialog(name, "#{sTake}", count);
|
dialog->openCountDialog(name, "#{sTake}", static_cast<int>(count));
|
||||||
dialog->eventOkClicked.clear();
|
dialog->eventOkClicked.clear();
|
||||||
if (Settings::gui().mControllerMenus || MyGUI::InputManager::getInstance().isAltPressed())
|
if (Settings::gui().mControllerMenus || MyGUI::InputManager::getInstance().isAltPressed())
|
||||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &CompanionWindow::transferItem);
|
dialog->eventOkClicked += MyGUI::newDelegate(this, &CompanionWindow::transferItem);
|
||||||
|
|
@ -174,9 +174,9 @@ namespace MWGui
|
||||||
{
|
{
|
||||||
if (mPtr.isEmpty())
|
if (mPtr.isEmpty())
|
||||||
return;
|
return;
|
||||||
float capacity = mPtr.getClass().getCapacity(mPtr);
|
int capacity = static_cast<int>(mPtr.getClass().getCapacity(mPtr));
|
||||||
float encumbrance = mPtr.getClass().getEncumbrance(mPtr);
|
float encumbrance = std::ceil(mPtr.getClass().getEncumbrance(mPtr));
|
||||||
mEncumbranceBar->setValue(std::ceil(encumbrance), static_cast<int>(capacity));
|
mEncumbranceBar->setValue(static_cast<int>(encumbrance), capacity);
|
||||||
|
|
||||||
if (mModel && mModel->hasProfit(mPtr))
|
if (mModel && mModel->hasProfit(mPtr))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,14 @@
|
||||||
#include "../mwworld/class.hpp"
|
#include "../mwworld/class.hpp"
|
||||||
#include "../mwworld/esmstore.hpp"
|
#include "../mwworld/esmstore.hpp"
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
bool isWhitespace(MyGUI::UString::code_point c)
|
||||||
|
{
|
||||||
|
return c == ' ' || c == '\t';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
namespace MWGui
|
namespace MWGui
|
||||||
{
|
{
|
||||||
class ConsoleInterpreterContext : public MWScript::InterpreterContext
|
class ConsoleInterpreterContext : public MWScript::InterpreterContext
|
||||||
|
|
@ -275,11 +283,6 @@ namespace MWGui
|
||||||
resetReference();
|
resetReference();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isWhitespace(char c)
|
|
||||||
{
|
|
||||||
return c == ' ' || c == '\t';
|
|
||||||
}
|
|
||||||
|
|
||||||
void Console::commandBoxKeyPress(MyGUI::Widget* /*sender*/, MyGUI::KeyCode key, MyGUI::Char /*value*/)
|
void Console::commandBoxKeyPress(MyGUI::Widget* /*sender*/, MyGUI::KeyCode key, MyGUI::Char /*value*/)
|
||||||
{
|
{
|
||||||
if (MyGUI::InputManager::getInstance().isControlPressed())
|
if (MyGUI::InputManager::getInstance().isControlPressed())
|
||||||
|
|
@ -697,7 +700,7 @@ namespace MWGui
|
||||||
|
|
||||||
/* Is there still something in the input string? If not just display all commands and return the unchanged
|
/* Is there still something in the input string? If not just display all commands and return the unchanged
|
||||||
* input. */
|
* input. */
|
||||||
if (tmp.length() == 0)
|
if (tmp.empty())
|
||||||
{
|
{
|
||||||
matches = mNames;
|
matches = mNames;
|
||||||
return input;
|
return input;
|
||||||
|
|
@ -756,10 +759,9 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if all matching strings match further than input. If yes complete to this match. */
|
/* Check if all matching strings match further than input. If yes complete to this match. */
|
||||||
int i = tmp.length();
|
size_t i = tmp.length();
|
||||||
|
|
||||||
for (std::string::iterator iter = matches.front().begin() + tmp.length(); iter < matches.front().end();
|
for (auto iter = matches.front().begin() + tmp.length(); iter < matches.front().end(); ++iter, ++i)
|
||||||
++iter, ++i)
|
|
||||||
{
|
{
|
||||||
for (std::string& match : matches)
|
for (std::string& match : matches)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -121,7 +121,7 @@ namespace MWGui
|
||||||
|
|
||||||
void ContainerItemModel::removeItem(const ItemStack& item, size_t count)
|
void ContainerItemModel::removeItem(const ItemStack& item, size_t count)
|
||||||
{
|
{
|
||||||
int toRemove = count;
|
int toRemove = static_cast<int>(count);
|
||||||
|
|
||||||
for (auto& source : mItemSources)
|
for (auto& source : mItemSources)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -48,9 +48,9 @@ namespace MWGui
|
||||||
ItemModel::ModelIndex newIndex = -1;
|
ItemModel::ModelIndex newIndex = -1;
|
||||||
for (size_t i = 0; i < playerModel->getItemCount(); ++i)
|
for (size_t i = 0; i < playerModel->getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
if (playerModel->getItem(i).mBase == item)
|
if (playerModel->getItem(static_cast<ItemModel::ModelIndex>(i)).mBase == item)
|
||||||
{
|
{
|
||||||
newIndex = i;
|
newIndex = static_cast<ItemModel::ModelIndex>(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -82,7 +82,7 @@ namespace MWGui
|
||||||
|
|
||||||
mDraggedWidget->setItem(mItem.mBase);
|
mDraggedWidget->setItem(mItem.mBase);
|
||||||
mDraggedWidget->setNeedMouseFocus(false);
|
mDraggedWidget->setNeedMouseFocus(false);
|
||||||
mDraggedWidget->setCount(count);
|
mDraggedWidget->setCount(static_cast<int>(count));
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->setDragDrop(true);
|
MWBase::Environment::get().getWindowManager()->setDragDrop(true);
|
||||||
|
|
||||||
|
|
@ -134,7 +134,7 @@ namespace MWGui
|
||||||
|
|
||||||
mItem.mCount = count;
|
mItem.mCount = count;
|
||||||
mDraggedCount = count;
|
mDraggedCount = count;
|
||||||
mDraggedWidget->setCount(mDraggedCount);
|
mDraggedWidget->setCount(static_cast<int>(mDraggedCount));
|
||||||
mSourceSortModel->clearDragItems();
|
mSourceSortModel->clearDragItems();
|
||||||
mSourceSortModel->addDragItem(mItem.mBase, mDraggedCount);
|
mSourceSortModel->addDragItem(mItem.mBase, mDraggedCount);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -218,10 +218,10 @@ namespace MWGui
|
||||||
const WindowRectSettingValues& rect = settings.mIsMaximized ? settings.mRegular : settings.mMaximized;
|
const WindowRectSettingValues& rect = settings.mIsMaximized ? settings.mRegular : settings.mMaximized;
|
||||||
|
|
||||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||||
const float x = rect.mX * viewSize.width;
|
const int x = static_cast<int>(rect.mX * viewSize.width);
|
||||||
const float y = rect.mY * viewSize.height;
|
const int y = static_cast<int>(rect.mY * viewSize.height);
|
||||||
const float w = rect.mW * viewSize.width;
|
const int w = static_cast<int>(rect.mW * viewSize.width);
|
||||||
const float h = rect.mH * viewSize.height;
|
const int h = static_cast<int>(rect.mH * viewSize.height);
|
||||||
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
|
MyGUI::Window* window = mMainWidget->castType<MyGUI::Window>();
|
||||||
window->setCoord(x, y, w, h);
|
window->setCoord(x, y, w, h);
|
||||||
|
|
||||||
|
|
@ -296,7 +296,7 @@ namespace MWGui
|
||||||
const ESM::RefId& sound = item.mBase.getClass().getDownSoundId(item.mBase);
|
const ESM::RefId& sound = item.mBase.getClass().getDownSoundId(item.mBase);
|
||||||
|
|
||||||
MWWorld::Ptr object = item.mBase;
|
MWWorld::Ptr object = item.mBase;
|
||||||
int count = item.mCount;
|
size_t count = item.mCount;
|
||||||
bool shift = MyGUI::InputManager::getInstance().isShiftPressed();
|
bool shift = MyGUI::InputManager::getInstance().isShiftPressed();
|
||||||
|
|
||||||
if (MyGUI::InputManager::getInstance().isControlPressed())
|
if (MyGUI::InputManager::getInstance().isControlPressed())
|
||||||
|
|
@ -347,7 +347,7 @@ namespace MWGui
|
||||||
message = "#{sDrop}";
|
message = "#{sDrop}";
|
||||||
std::string name{ object.getClass().getName(object) };
|
std::string name{ object.getClass().getName(object) };
|
||||||
name += MWGui::ToolTips::getSoulString(object.getCellRef());
|
name += MWGui::ToolTips::getSoulString(object.getCellRef());
|
||||||
dialog->openCountDialog(name, message, count);
|
dialog->openCountDialog(name, message, static_cast<int>(count));
|
||||||
dialog->eventOkClicked.clear();
|
dialog->eventOkClicked.clear();
|
||||||
if (mTrading || mPendingControllerAction == ControllerAction::Sell)
|
if (mTrading || mPendingControllerAction == ControllerAction::Sell)
|
||||||
dialog->eventOkClicked += MyGUI::newDelegate(this, &InventoryWindow::sellItem);
|
dialog->eventOkClicked += MyGUI::newDelegate(this, &InventoryWindow::sellItem);
|
||||||
|
|
@ -414,9 +414,9 @@ namespace MWGui
|
||||||
int newIndex = -1;
|
int newIndex = -1;
|
||||||
for (size_t i = 0; i < mTradeModel->getItemCount(); ++i)
|
for (size_t i = 0; i < mTradeModel->getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
if (mTradeModel->getItem(i).mBase == newStack)
|
if (mTradeModel->getItem(static_cast<ItemModel::ModelIndex>(i)).mBase == newStack)
|
||||||
{
|
{
|
||||||
newIndex = i;
|
newIndex = static_cast<int>(i);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -431,21 +431,21 @@ namespace MWGui
|
||||||
|
|
||||||
void InventoryWindow::dragItem(MyGUI::Widget* /*sender*/, std::size_t count)
|
void InventoryWindow::dragItem(MyGUI::Widget* /*sender*/, std::size_t count)
|
||||||
{
|
{
|
||||||
ensureSelectedItemUnequipped(count);
|
ensureSelectedItemUnequipped(static_cast<int>(count));
|
||||||
mDragAndDrop->startDrag(mSelectedItem, mSortModel, mTradeModel, mItemView, count);
|
mDragAndDrop->startDrag(mSelectedItem, mSortModel, mTradeModel, mItemView, count);
|
||||||
notifyContentChanged();
|
notifyContentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InventoryWindow::transferItem(MyGUI::Widget* /*sender*/, std::size_t count)
|
void InventoryWindow::transferItem(MyGUI::Widget* /*sender*/, std::size_t count)
|
||||||
{
|
{
|
||||||
ensureSelectedItemUnequipped(count);
|
ensureSelectedItemUnequipped(static_cast<int>(count));
|
||||||
mItemTransfer->apply(mTradeModel->getItem(mSelectedItem), count, *mItemView);
|
mItemTransfer->apply(mTradeModel->getItem(mSelectedItem), count, *mItemView);
|
||||||
notifyContentChanged();
|
notifyContentChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
void InventoryWindow::sellItem(MyGUI::Widget* /*sender*/, std::size_t count)
|
void InventoryWindow::sellItem(MyGUI::Widget* /*sender*/, std::size_t count)
|
||||||
{
|
{
|
||||||
ensureSelectedItemUnequipped(count);
|
ensureSelectedItemUnequipped(static_cast<int>(count));
|
||||||
const ItemStack& item = mTradeModel->getItem(mSelectedItem);
|
const ItemStack& item = mTradeModel->getItem(mSelectedItem);
|
||||||
const ESM::RefId& sound = item.mBase.getClass().getUpSoundId(item.mBase);
|
const ESM::RefId& sound = item.mBase.getClass().getUpSoundId(item.mBase);
|
||||||
MWBase::Environment::get().getWindowManager()->playSound(sound);
|
MWBase::Environment::get().getWindowManager()->playSound(sound);
|
||||||
|
|
@ -652,7 +652,7 @@ namespace MWGui
|
||||||
|
|
||||||
MWWorld::InventoryStore& invStore = mPtr.getClass().getInventoryStore(mPtr);
|
MWWorld::InventoryStore& invStore = mPtr.getClass().getInventoryStore(mPtr);
|
||||||
auto [eqSlots, canStack] = ptr.getClass().getEquipmentSlots(ptr);
|
auto [eqSlots, canStack] = ptr.getClass().getEquipmentSlots(ptr);
|
||||||
int useCount = isFromDragAndDrop ? mDragAndDrop->mDraggedCount : ptr.getCellRef().getCount();
|
int useCount = isFromDragAndDrop ? static_cast<int>(mDragAndDrop->mDraggedCount) : ptr.getCellRef().getCount();
|
||||||
|
|
||||||
if (!eqSlots.empty())
|
if (!eqSlots.empty())
|
||||||
{
|
{
|
||||||
|
|
@ -714,9 +714,9 @@ namespace MWGui
|
||||||
|
|
||||||
for (size_t i = 0; i < mTradeModel->getItemCount(); ++i)
|
for (size_t i = 0; i < mTradeModel->getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
if (mTradeModel->getItem(i).mBase == itemSelected)
|
if (mTradeModel->getItem(static_cast<ItemModel::ModelIndex>(i)).mBase == itemSelected)
|
||||||
{
|
{
|
||||||
onItemSelectedFromSourceModel(i);
|
onItemSelectedFromSourceModel(static_cast<int>(i));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -726,7 +726,7 @@ namespace MWGui
|
||||||
|
|
||||||
MWWorld::Ptr InventoryWindow::getAvatarSelectedItem(int x, int y)
|
MWWorld::Ptr InventoryWindow::getAvatarSelectedItem(int x, int y)
|
||||||
{
|
{
|
||||||
const osg::Vec2f viewportCoords = mapPreviewWindowToViewport(x, y);
|
const osg::Vec2i viewportCoords = mapPreviewWindowToViewport(x, y);
|
||||||
int slot = mPreview->getSlotSelected(viewportCoords.x(), viewportCoords.y());
|
int slot = mPreview->getSlotSelected(viewportCoords.x(), viewportCoords.y());
|
||||||
|
|
||||||
if (slot == -1)
|
if (slot == -1)
|
||||||
|
|
@ -843,7 +843,7 @@ namespace MWGui
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (; i < mTradeModel->getItemCount(); ++i)
|
for (; i < mTradeModel->getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
if (mTradeModel->getItem(i).mBase == newObject)
|
if (mTradeModel->getItem(static_cast<ItemModel::ModelIndex>(i)).mBase == newObject)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == mTradeModel->getItemCount())
|
if (i == mTradeModel->getItemCount())
|
||||||
|
|
@ -854,13 +854,13 @@ namespace MWGui
|
||||||
|
|
||||||
if (MyGUI::InputManager::getInstance().isAltPressed())
|
if (MyGUI::InputManager::getInstance().isAltPressed())
|
||||||
{
|
{
|
||||||
const MWWorld::Ptr item = mTradeModel->getItem(i).mBase;
|
const MWWorld::Ptr item = mTradeModel->getItem(static_cast<ItemModel::ModelIndex>(i)).mBase;
|
||||||
MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item));
|
MWBase::Environment::get().getWindowManager()->playSound(item.getClass().getDownSoundId(item));
|
||||||
mItemView->update();
|
mItemView->update();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mDragAndDrop->startDrag(i, mSortModel, mTradeModel, mItemView, count);
|
mDragAndDrop->startDrag(static_cast<int>(i), mSortModel, mTradeModel, mItemView, count);
|
||||||
}
|
}
|
||||||
|
|
||||||
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
|
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
|
||||||
|
|
@ -901,7 +901,7 @@ namespace MWGui
|
||||||
for (size_t i = 0; i < model.getItemCount(); ++i)
|
for (size_t i = 0; i < model.getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
cycled += incr;
|
cycled += incr;
|
||||||
cycled = (cycled + model.getItemCount()) % model.getItemCount();
|
cycled = static_cast<ItemModel::ModelIndex>((cycled + model.getItemCount()) % model.getItemCount());
|
||||||
|
|
||||||
MWWorld::Ptr item = model.getItem(cycled).mBase;
|
MWWorld::Ptr item = model.getItem(cycled).mBase;
|
||||||
|
|
||||||
|
|
@ -946,18 +946,19 @@ namespace MWGui
|
||||||
const MyGUI::IntSize previewWindowSize = mAvatarImage->getSize();
|
const MyGUI::IntSize previewWindowSize = mAvatarImage->getSize();
|
||||||
const float scale = MWBase::Environment::get().getWindowManager()->getScalingFactor();
|
const float scale = MWBase::Environment::get().getWindowManager()->getScalingFactor();
|
||||||
|
|
||||||
return MyGUI::IntSize(std::min<int>(mPreview->getTextureWidth(), previewWindowSize.width * scale),
|
return MyGUI::IntSize(std::min(mPreview->getTextureWidth(), static_cast<int>(previewWindowSize.width * scale)),
|
||||||
std::min<int>(mPreview->getTextureHeight(), previewWindowSize.height * scale));
|
std::min(mPreview->getTextureHeight(), static_cast<int>(previewWindowSize.height * scale)));
|
||||||
}
|
}
|
||||||
|
|
||||||
osg::Vec2f InventoryWindow::mapPreviewWindowToViewport(int x, int y) const
|
osg::Vec2i InventoryWindow::mapPreviewWindowToViewport(int x, int y) const
|
||||||
{
|
{
|
||||||
const MyGUI::IntSize previewWindowSize = mAvatarImage->getSize();
|
const MyGUI::IntSize previewWindowSize = mAvatarImage->getSize();
|
||||||
const float normalisedX = x / std::max<float>(1.0f, previewWindowSize.width);
|
const float normalisedX = x / float(std::max(1, previewWindowSize.width));
|
||||||
const float normalisedY = y / std::max<float>(1.0f, previewWindowSize.height);
|
const float normalisedY = y / float(std::max(1, previewWindowSize.height));
|
||||||
|
|
||||||
const MyGUI::IntSize viewport = getPreviewViewportSize();
|
const MyGUI::IntSize viewport = getPreviewViewportSize();
|
||||||
return osg::Vec2f(normalisedX * float(viewport.width - 1), (1.0 - normalisedY) * float(viewport.height - 1));
|
return osg::Vec2i(static_cast<int>(normalisedX * (viewport.width - 1)),
|
||||||
|
static_cast<int>((1 - normalisedY) * (viewport.height - 1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
ControllerButtons* InventoryWindow::getControllerButtons()
|
ControllerButtons* InventoryWindow::getControllerButtons()
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ namespace MWGui
|
||||||
void updateArmorRating();
|
void updateArmorRating();
|
||||||
|
|
||||||
MyGUI::IntSize getPreviewViewportSize() const;
|
MyGUI::IntSize getPreviewViewportSize() const;
|
||||||
osg::Vec2f mapPreviewWindowToViewport(int x, int y) const;
|
osg::Vec2i mapPreviewWindowToViewport(int x, int y) const;
|
||||||
|
|
||||||
void adjustPanes();
|
void adjustPanes();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ namespace MWGui
|
||||||
int maxHeight = mScrollView->getHeight();
|
int maxHeight = mScrollView->getHeight();
|
||||||
|
|
||||||
mRows = std::max(maxHeight / 42, 1);
|
mRows = std::max(maxHeight / 42, 1);
|
||||||
mItemCount = dragArea->getChildCount();
|
mItemCount = static_cast<int>(dragArea->getChildCount());
|
||||||
bool showScrollbar = static_cast<int>(std::ceil(mItemCount / float(mRows))) > mScrollView->getWidth() / 42;
|
bool showScrollbar = static_cast<int>(std::ceil(mItemCount / float(mRows))) > mScrollView->getWidth() / 42;
|
||||||
if (showScrollbar)
|
if (showScrollbar)
|
||||||
{
|
{
|
||||||
|
|
@ -126,7 +126,7 @@ namespace MWGui
|
||||||
if (item.mType == ItemStack::Type_Equipped)
|
if (item.mType == ItemStack::Type_Equipped)
|
||||||
state = ItemWidget::Equip;
|
state = ItemWidget::Equip;
|
||||||
itemWidget->setItem(item.mBase, state);
|
itemWidget->setItem(item.mBase, state);
|
||||||
itemWidget->setCount(item.mCount);
|
itemWidget->setCount(static_cast<int>(item.mCount));
|
||||||
|
|
||||||
itemWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemView::onSelectedItem);
|
itemWidget->eventMouseButtonClick += MyGUI::newDelegate(this, &ItemView::onSelectedItem);
|
||||||
itemWidget->eventMouseWheel += MyGUI::newDelegate(this, &ItemView::onMouseWheelMoved);
|
itemWidget->eventMouseWheel += MyGUI::newDelegate(this, &ItemView::onMouseWheelMoved);
|
||||||
|
|
|
||||||
|
|
@ -207,10 +207,12 @@ namespace MWGui
|
||||||
scale = found->second;
|
scale = found->second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const int diameter = static_cast<int>(44 * scale);
|
||||||
if (state == Barter && !isMagic)
|
if (state == Barter && !isMagic)
|
||||||
setFrame(backgroundTex, MyGUI::IntCoord(2 * scale, 2 * scale, 44 * scale, 44 * scale));
|
setFrame(backgroundTex,
|
||||||
|
MyGUI::IntCoord(static_cast<int>(2 * scale), static_cast<int>(2 * scale), diameter, diameter));
|
||||||
else
|
else
|
||||||
setFrame(backgroundTex, MyGUI::IntCoord(0, 0, 44 * scale, 44 * scale));
|
setFrame(backgroundTex, MyGUI::IntCoord(0, 0, diameter, diameter));
|
||||||
|
|
||||||
setIcon(ptr);
|
setIcon(ptr);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -917,7 +917,7 @@ namespace MWGui
|
||||||
const int localWidgetSize = Settings::map().mLocalMapWidgetSize;
|
const int localWidgetSize = Settings::map().mLocalMapWidgetSize;
|
||||||
const bool zoomOut = rel < 0;
|
const bool zoomOut = rel < 0;
|
||||||
const bool zoomIn = !zoomOut;
|
const bool zoomIn = !zoomOut;
|
||||||
const double speedDiff = zoomOut ? 1.0 / speed : speed;
|
const float speedDiff = zoomOut ? 1.f / speed : speed;
|
||||||
|
|
||||||
const float currentMinLocalMapZoom
|
const float currentMinLocalMapZoom
|
||||||
= std::max({ (float(Settings::map().mGlobalMapCellSize) * 4.f) / float(localWidgetSize),
|
= std::max({ (float(Settings::map().mGlobalMapCellSize) * 4.f) / float(localWidgetSize),
|
||||||
|
|
@ -985,8 +985,8 @@ namespace MWGui
|
||||||
|
|
||||||
Settings::map().mGlobal ? updateGlobalMap() : updateLocalMap();
|
Settings::map().mGlobal ? updateGlobalMap() : updateLocalMap();
|
||||||
|
|
||||||
map->setViewOffset(MyGUI::IntPoint(std::round(centerView.left * speedDiff) + cursor.left,
|
map->setViewOffset(MyGUI::IntPoint(static_cast<int>(std::round(centerView.left * speedDiff) + cursor.left),
|
||||||
std::round(centerView.top * speedDiff) + cursor.top));
|
static_cast<int>(std::round(centerView.top * speedDiff) + cursor.top)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void MapWindow::updateGlobalMap()
|
void MapWindow::updateGlobalMap()
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ namespace MWGui
|
||||||
for (size_t i = 0; i < mSourceModel->getItemCount(); ++i)
|
for (size_t i = 0; i < mSourceModel->getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
if (Misc::Rng::roll0to99(prng) > chance)
|
if (Misc::Rng::roll0to99(prng) > chance)
|
||||||
mHiddenItems.push_back(mSourceModel->getItem(i));
|
mHiddenItems.push_back(mSourceModel->getItem(static_cast<ModelIndex>(i)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -64,7 +64,7 @@ namespace MWGui
|
||||||
mItems.clear();
|
mItems.clear();
|
||||||
for (size_t i = 0; i < mSourceModel->getItemCount(); ++i)
|
for (size_t i = 0; i < mSourceModel->getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
const ItemStack& item = mSourceModel->getItem(i);
|
const ItemStack& item = mSourceModel->getItem(static_cast<ModelIndex>(i));
|
||||||
|
|
||||||
// Bound items may not be stolen
|
// Bound items may not be stolen
|
||||||
if (item.mFlags & ItemStack::Flag_Bound)
|
if (item.mFlags & ItemStack::Flag_Bound)
|
||||||
|
|
|
||||||
|
|
@ -172,16 +172,16 @@ namespace MWGui
|
||||||
if (selected == MyGUI::ITEM_NONE)
|
if (selected == MyGUI::ITEM_NONE)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
int index = direction == Direction::Up ? static_cast<int>(selected) - 1 : selected + 1;
|
size_t index = direction == Direction::Up ? selected - 1 : selected + 1;
|
||||||
index = std::clamp<int>(index, 0, mActiveList->getItemCount() - 1);
|
index = std::clamp<size_t>(index, 0, mActiveList->getItemCount() - 1);
|
||||||
|
|
||||||
if (static_cast<size_t>(index) != selected)
|
if (index != selected)
|
||||||
{
|
{
|
||||||
auto technique = getTechnique(*mActiveList, selected);
|
auto technique = getTechnique(*mActiveList, selected);
|
||||||
if (technique->getDynamic() || technique->getInternal())
|
if (technique->getDynamic() || technique->getInternal())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (processor->enableTechnique(std::move(technique), index - mOffset)
|
if (processor->enableTechnique(std::move(technique), static_cast<int>(index) - mOffset)
|
||||||
!= MWRender::PostProcessor::Status_Error)
|
!= MWRender::PostProcessor::Status_Error)
|
||||||
processor->saveChain();
|
processor->saveChain();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -324,8 +324,7 @@ namespace MWGui
|
||||||
|
|
||||||
std::string path = effect->mIcon;
|
std::string path = effect->mIcon;
|
||||||
std::replace(path.begin(), path.end(), '/', '\\');
|
std::replace(path.begin(), path.end(), '/', '\\');
|
||||||
int slashPos = path.rfind('\\');
|
path.insert(path.rfind('\\') + 1, "b_");
|
||||||
path.insert(slashPos + 1, "b_");
|
|
||||||
path = Misc::ResourceHelpers::correctIconPath(path, MWBase::Environment::get().getResourceSystem()->getVFS());
|
path = Misc::ResourceHelpers::correctIconPath(path, MWBase::Environment::get().getResourceSystem()->getVFS());
|
||||||
|
|
||||||
float scale = 1.f;
|
float scale = 1.f;
|
||||||
|
|
|
||||||
|
|
@ -346,7 +346,7 @@ namespace MWGui
|
||||||
void EditEffectDialog::onMagnitudeMinChanged(MyGUI::ScrollBar* sender, size_t pos)
|
void EditEffectDialog::onMagnitudeMinChanged(MyGUI::ScrollBar* sender, size_t pos)
|
||||||
{
|
{
|
||||||
mMagnitudeMinValue->setCaption(MyGUI::utility::toString(pos + 1));
|
mMagnitudeMinValue->setCaption(MyGUI::utility::toString(pos + 1));
|
||||||
mEffect.mMagnMin = pos + 1;
|
mEffect.mMagnMin = static_cast<int32_t>(pos + 1);
|
||||||
|
|
||||||
// trigger the check again (see below)
|
// trigger the check again (see below)
|
||||||
onMagnitudeMaxChanged(mMagnitudeMaxSlider, mMagnitudeMaxSlider->getScrollPosition());
|
onMagnitudeMaxChanged(mMagnitudeMaxSlider, mMagnitudeMaxSlider->getScrollPosition());
|
||||||
|
|
@ -364,7 +364,7 @@ namespace MWGui
|
||||||
sender->setScrollPosition(pos);
|
sender->setScrollPosition(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
mEffect.mMagnMax = pos + 1;
|
mEffect.mMagnMax = static_cast<int32_t>(pos + 1);
|
||||||
const std::string to{ MWBase::Environment::get().getWindowManager()->getGameSettingString("sTo", "-") };
|
const std::string to{ MWBase::Environment::get().getWindowManager()->getGameSettingString("sTo", "-") };
|
||||||
|
|
||||||
mMagnitudeMaxValue->setCaption(to + " " + MyGUI::utility::toString(pos + 1));
|
mMagnitudeMaxValue->setCaption(to + " " + MyGUI::utility::toString(pos + 1));
|
||||||
|
|
@ -375,7 +375,7 @@ namespace MWGui
|
||||||
void EditEffectDialog::onDurationChanged(MyGUI::ScrollBar* sender, size_t pos)
|
void EditEffectDialog::onDurationChanged(MyGUI::ScrollBar* sender, size_t pos)
|
||||||
{
|
{
|
||||||
mDurationValue->setCaption(MyGUI::utility::toString(pos + 1));
|
mDurationValue->setCaption(MyGUI::utility::toString(pos + 1));
|
||||||
mEffect.mDuration = pos + 1;
|
mEffect.mDuration = static_cast<int32_t>(pos + 1);
|
||||||
eventEffectModified(mEffect);
|
eventEffectModified(mEffect);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -188,7 +188,7 @@ namespace MWGui
|
||||||
}
|
}
|
||||||
|
|
||||||
// special case, look for spells added to model that are beyond last updatable item
|
// special case, look for spells added to model that are beyond last updatable item
|
||||||
SpellModel::ModelIndex topSpellIndex = mModel->getItemCount() - 1;
|
auto topSpellIndex = static_cast<SpellModel::ModelIndex>(mModel->getItemCount() - 1);
|
||||||
if (fullUpdateRequired || ((0 <= topSpellIndex) && (maxSpellIndexFound < topSpellIndex)))
|
if (fullUpdateRequired || ((0 <= topSpellIndex) && (maxSpellIndexFound < topSpellIndex)))
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,8 @@ namespace MWGui
|
||||||
= *focus->getUserData<std::pair<ItemModel::ModelIndex, ItemModel*>>();
|
= *focus->getUserData<std::pair<ItemModel::ModelIndex, ItemModel*>>();
|
||||||
mFocusObject = pair.second->getItem(pair.first).mBase;
|
mFocusObject = pair.second->getItem(pair.first).mBase;
|
||||||
bool isAllowedToUse = pair.second->allowedToUseItems();
|
bool isAllowedToUse = pair.second->allowedToUseItems();
|
||||||
tooltipSize = getToolTipViaPtr(pair.second->getItem(pair.first).mCount, false, !isAllowedToUse);
|
tooltipSize = getToolTipViaPtr(
|
||||||
|
static_cast<int>(pair.second->getItem(pair.first).mCount), false, !isAllowedToUse);
|
||||||
}
|
}
|
||||||
else if (type == "ToolTipInfo")
|
else if (type == "ToolTipInfo")
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -152,14 +152,14 @@ namespace MWGui
|
||||||
size_t i = 0;
|
size_t i = 0;
|
||||||
for (; i < sourceModel->getItemCount(); ++i)
|
for (; i < sourceModel->getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
if (itemStack.mBase == sourceModel->getItem(i).mBase)
|
if (itemStack.mBase == sourceModel->getItem(static_cast<ModelIndex>(i)).mBase)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (i == sourceModel->getItemCount())
|
if (i == sourceModel->getItemCount())
|
||||||
throw std::runtime_error("The borrowed item disappeared");
|
throw std::runtime_error("The borrowed item disappeared");
|
||||||
|
|
||||||
sourceModel->moveItem(
|
sourceModel->moveItem(sourceModel->getItem(static_cast<ModelIndex>(i)), itemStack.mCount, this,
|
||||||
sourceModel->getItem(i), itemStack.mCount, this, !Settings::game().mPreventMerchantEquipping);
|
!Settings::game().mPreventMerchantEquipping);
|
||||||
}
|
}
|
||||||
mBorrowedToUs.clear();
|
mBorrowedToUs.clear();
|
||||||
mBorrowedFromUs.clear();
|
mBorrowedFromUs.clear();
|
||||||
|
|
@ -177,7 +177,7 @@ namespace MWGui
|
||||||
// add regular items
|
// add regular items
|
||||||
for (size_t i = 0; i < mSourceModel->getItemCount(); ++i)
|
for (size_t i = 0; i < mSourceModel->getItemCount(); ++i)
|
||||||
{
|
{
|
||||||
ItemStack item = mSourceModel->getItem(i);
|
ItemStack item = mSourceModel->getItem(static_cast<ModelIndex>(i));
|
||||||
if (!mMerchant.isEmpty())
|
if (!mMerchant.isEmpty())
|
||||||
{
|
{
|
||||||
MWWorld::Ptr base = item.mBase;
|
MWWorld::Ptr base = item.mBase;
|
||||||
|
|
|
||||||
|
|
@ -383,7 +383,7 @@ namespace MWGui
|
||||||
|
|
||||||
void TradeWindow::onOfferSubmitted(MyGUI::Widget* /*sender*/, size_t offerAmount)
|
void TradeWindow::onOfferSubmitted(MyGUI::Widget* /*sender*/, size_t offerAmount)
|
||||||
{
|
{
|
||||||
mCurrentBalance = offerAmount * (mCurrentBalance < 0 ? -1 : 1);
|
mCurrentBalance = static_cast<int>(offerAmount) * (mCurrentBalance < 0 ? -1 : 1);
|
||||||
updateLabels();
|
updateLabels();
|
||||||
onOfferButtonClicked(mOfferButton);
|
onOfferButtonClicked(mOfferButton);
|
||||||
}
|
}
|
||||||
|
|
@ -622,7 +622,7 @@ namespace MWGui
|
||||||
const std::vector<ItemStack>& playerBorrowed = playerTradeModel->getItemsBorrowedToUs();
|
const std::vector<ItemStack>& playerBorrowed = playerTradeModel->getItemsBorrowedToUs();
|
||||||
for (const ItemStack& itemStack : playerBorrowed)
|
for (const ItemStack& itemStack : playerBorrowed)
|
||||||
{
|
{
|
||||||
const int basePrice = getEffectiveValue(itemStack.mBase, itemStack.mCount);
|
const int basePrice = getEffectiveValue(itemStack.mBase, static_cast<int>(itemStack.mCount));
|
||||||
const int cap
|
const int cap
|
||||||
= static_cast<int>(std::max(1.f, 0.75f * basePrice)); // Minimum buying price -- 75% of the base
|
= static_cast<int>(std::max(1.f, 0.75f * basePrice)); // Minimum buying price -- 75% of the base
|
||||||
const int buyingPrice
|
const int buyingPrice
|
||||||
|
|
@ -633,7 +633,7 @@ namespace MWGui
|
||||||
const std::vector<ItemStack>& merchantBorrowed = mTradeModel->getItemsBorrowedToUs();
|
const std::vector<ItemStack>& merchantBorrowed = mTradeModel->getItemsBorrowedToUs();
|
||||||
for (const ItemStack& itemStack : merchantBorrowed)
|
for (const ItemStack& itemStack : merchantBorrowed)
|
||||||
{
|
{
|
||||||
const int basePrice = getEffectiveValue(itemStack.mBase, itemStack.mCount);
|
const int basePrice = getEffectiveValue(itemStack.mBase, static_cast<int>(itemStack.mCount));
|
||||||
const int cap
|
const int cap
|
||||||
= static_cast<int>(std::max(1.f, 0.75f * basePrice)); // Maximum selling price -- 75% of the base
|
= static_cast<int>(std::max(1.f, 0.75f * basePrice)); // Maximum selling price -- 75% of the base
|
||||||
const int sellingPrice
|
const int sellingPrice
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,8 @@ namespace MWRender
|
||||||
const float fov = Settings::camera().mFieldOfView;
|
const float fov = Settings::camera().mFieldOfView;
|
||||||
constexpr double clipFudgeMin = 2.5; // minimum offset of clip plane
|
constexpr double clipFudgeMin = 2.5; // minimum offset of clip plane
|
||||||
constexpr double clipFudgeScale = -15000.0;
|
constexpr double clipFudgeScale = -15000.0;
|
||||||
double clipFudge = std::abs(std::abs((*mCullPlane)[3]) - eyePoint.z()) * fov / clipFudgeScale - clipFudgeMin;
|
double clipFudge
|
||||||
|
= std::abs(std::abs((*mCullPlane)[3]) - eyePoint.z()) * fov / clipFudgeScale - clipFudgeMin;
|
||||||
modelViewMatrix->preMultTranslate(mCullPlane->getNormal() * clipFudge);
|
modelViewMatrix->preMultTranslate(mCullPlane->getNormal() * clipFudge);
|
||||||
|
|
||||||
cv->pushModelViewMatrix(modelViewMatrix, osg::Transform::RELATIVE_RF);
|
cv->pushModelViewMatrix(modelViewMatrix, osg::Transform::RELATIVE_RF);
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ namespace MWScript
|
||||||
if (!mLocals)
|
if (!mLocals)
|
||||||
throw std::runtime_error("local variables not available in this context");
|
throw std::runtime_error("local variables not available in this context");
|
||||||
|
|
||||||
mLocals->mShorts.at(index) = value;
|
mLocals->mShorts.at(index) = static_cast<Interpreter::Type_Short>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterContext::setLocalLong(int index, int value)
|
void InterpreterContext::setLocalLong(int index, int value)
|
||||||
|
|
@ -483,7 +483,7 @@ namespace MWScript
|
||||||
{
|
{
|
||||||
Locals& locals = getMemberLocals(global, id);
|
Locals& locals = getMemberLocals(global, id);
|
||||||
|
|
||||||
locals.mShorts[findLocalVariableIndex(id, name, 's')] = value;
|
locals.mShorts[findLocalVariableIndex(id, name, 's')] = static_cast<Interpreter::Type_Short>(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterContext::setMemberLong(ESM::RefId id, std::string_view name, int value, bool global)
|
void InterpreterContext::setMemberLong(ESM::RefId id, std::string_view name, int value, bool global)
|
||||||
|
|
|
||||||
|
|
@ -187,29 +187,28 @@ namespace MWScript
|
||||||
const Compiler::Locals& declarations = MWBase::Environment::get().getScriptManager()->getLocals(script);
|
const Compiler::Locals& declarations = MWBase::Environment::get().getScriptManager()->getLocals(script);
|
||||||
|
|
||||||
int index = 0, numshorts = 0, numlongs = 0;
|
int index = 0, numshorts = 0, numlongs = 0;
|
||||||
for (unsigned int v = 0; v < locals.mVariables.size(); ++v)
|
for (const auto& [_, value] : locals.mVariables)
|
||||||
{
|
{
|
||||||
ESM::VarType type = locals.mVariables[v].second.getType();
|
ESM::VarType type = value.getType();
|
||||||
if (type == ESM::VT_Short)
|
if (type == ESM::VT_Short)
|
||||||
++numshorts;
|
++numshorts;
|
||||||
else if (type == ESM::VT_Int)
|
else if (type == ESM::VT_Int)
|
||||||
++numlongs;
|
++numlongs;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (std::vector<std::pair<std::string, ESM::Variant>>::const_iterator iter = locals.mVariables.begin();
|
for (const auto& [name, value] : locals.mVariables)
|
||||||
iter != locals.mVariables.end(); ++iter, ++index)
|
|
||||||
{
|
{
|
||||||
if (iter->first.empty())
|
if (name.empty())
|
||||||
{
|
{
|
||||||
// no variable names available (this will happen for legacy, i.e. ESS-imported savegames only)
|
// no variable names available (this will happen for legacy, i.e. ESS-imported savegames only)
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (index >= numshorts + numlongs)
|
if (index >= numshorts + numlongs)
|
||||||
mFloats.at(index - (numshorts + numlongs)) = iter->second.getFloat();
|
mFloats.at(index - (numshorts + numlongs)) = value.getFloat();
|
||||||
else if (index >= numshorts)
|
else if (index >= numshorts)
|
||||||
mLongs.at(index - numshorts) = iter->second.getInteger();
|
mLongs.at(index - numshorts) = value.getInteger();
|
||||||
else
|
else
|
||||||
mShorts.at(index) = iter->second.getInteger();
|
mShorts.at(index) = static_cast<Interpreter::Type_Short>(value.getInteger());
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
|
@ -220,8 +219,8 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
char type = declarations.getType(iter->first);
|
char type = declarations.getType(name);
|
||||||
int index2 = declarations.getIndex(iter->first);
|
int index2 = declarations.getIndex(name);
|
||||||
|
|
||||||
// silently ignore locals that don't exist anymore
|
// silently ignore locals that don't exist anymore
|
||||||
if (type == ' ' || index2 == -1)
|
if (type == ' ' || index2 == -1)
|
||||||
|
|
@ -232,13 +231,13 @@ namespace MWScript
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
case 's':
|
case 's':
|
||||||
mShorts.at(index2) = iter->second.getInteger();
|
mShorts.at(index2) = static_cast<Interpreter::Type_Short>(value.getInteger());
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
mLongs.at(index2) = iter->second.getInteger();
|
mLongs.at(index2) = value.getInteger();
|
||||||
break;
|
break;
|
||||||
case 'f':
|
case 'f':
|
||||||
mFloats.at(index2) = iter->second.getFloat();
|
mFloats.at(index2) = value.getFloat();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ namespace MWScript
|
||||||
chances.reserve(10);
|
chances.reserve(10);
|
||||||
while (arg0 > 0)
|
while (arg0 > 0)
|
||||||
{
|
{
|
||||||
chances.push_back(std::clamp(runtime[0].mInteger, 0, 100));
|
chances.push_back(static_cast<uint8_t>(std::clamp(runtime[0].mInteger, 0, 100)));
|
||||||
runtime.pop();
|
runtime.pop();
|
||||||
arg0--;
|
arg0--;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue