forked from mirror/openmw-tes3mp
Merge pull request #188 from OpenMW/master
Add OpenMW commits up to 24 Mar 2017
This commit is contained in:
commit
c10dd1b002
13 changed files with 191 additions and 29 deletions
|
@ -1,29 +1,113 @@
|
|||
#include "pathgridcreator.hpp"
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
#include "../../model/doc/document.hpp"
|
||||
|
||||
#include "../../model/world/columns.hpp"
|
||||
#include "../../model/world/data.hpp"
|
||||
#include "../../model/world/idcompletionmanager.hpp"
|
||||
#include "../../model/world/idtable.hpp"
|
||||
|
||||
#include "../widget/droplineedit.hpp"
|
||||
#include "idvalidator.hpp"
|
||||
|
||||
std::string CSVWorld::PathgridCreator::getId() const
|
||||
{
|
||||
return mCell->text().toUtf8().constData();
|
||||
}
|
||||
|
||||
CSMWorld::IdTable& CSVWorld::PathgridCreator::getPathgridsTable() const
|
||||
{
|
||||
return dynamic_cast<CSMWorld::IdTable&> (
|
||||
*getData().getTableModel(getCollectionId())
|
||||
);
|
||||
}
|
||||
|
||||
CSVWorld::PathgridCreator::PathgridCreator(
|
||||
CSMWorld::Data& data,
|
||||
QUndoStack& undoStack,
|
||||
const CSMWorld::UniversalId& id,
|
||||
CSMWorld::IdCompletionManager& completionManager,
|
||||
bool relaxedIdRules
|
||||
) : GenericCreator(data, undoStack, id, relaxedIdRules)
|
||||
{}
|
||||
{
|
||||
setManualEditing(false);
|
||||
|
||||
QLabel *label = new QLabel("Cell ID", this);
|
||||
insertBeforeButtons(label, false);
|
||||
|
||||
// Add cell ID input with auto-completion.
|
||||
CSMWorld::ColumnBase::Display displayType = CSMWorld::ColumnBase::Display_Cell;
|
||||
mCell = new CSVWidget::DropLineEdit(displayType, this);
|
||||
mCell->setCompleter(completionManager.getCompleter(displayType).get());
|
||||
mCell->setValidator(new IdValidator(relaxedIdRules, this));
|
||||
insertBeforeButtons(mCell, true);
|
||||
|
||||
connect(mCell, SIGNAL (textChanged(const QString&)), this, SLOT (cellChanged()));
|
||||
connect(mCell, SIGNAL (returnPressed()), this, SLOT (inputReturnPressed()));
|
||||
}
|
||||
|
||||
void CSVWorld::PathgridCreator::cloneMode(
|
||||
const std::string& originId,
|
||||
const CSMWorld::UniversalId::Type type)
|
||||
{
|
||||
CSVWorld::GenericCreator::cloneMode(originId, type);
|
||||
|
||||
// Look up cloned record in pathgrids table and set cell ID text.
|
||||
CSMWorld::IdTable& table = getPathgridsTable();
|
||||
int column = table.findColumnIndex(CSMWorld::Columns::ColumnId_Id);
|
||||
mCell->setText(table.data(table.getModelIndex(originId, column)).toString());
|
||||
}
|
||||
|
||||
std::string CSVWorld::PathgridCreator::getErrors() const
|
||||
{
|
||||
std::string pathgridId = getId();
|
||||
std::string cellId = getId();
|
||||
|
||||
// Check user input for any errors.
|
||||
// The last two checks, cell with existing pathgrid and non-existent cell,
|
||||
// shouldn't be needed but we absolutely want to make sure they never happen.
|
||||
std::string errors;
|
||||
if (pathgridId.empty())
|
||||
if (cellId.empty())
|
||||
{
|
||||
errors = "No Pathgrid ID entered";
|
||||
errors = "No cell ID selected";
|
||||
}
|
||||
else if (getData().getPathgrids().searchId(pathgridId) > -1)
|
||||
else if (getData().getPathgrids().searchId(cellId) > -1)
|
||||
{
|
||||
errors = "Pathgrid with this ID already exists";
|
||||
errors = "Pathgrid for selected cell ID already exists";
|
||||
}
|
||||
else if (getData().getCells().searchId(cellId) == -1)
|
||||
{
|
||||
errors = "Cell with selected cell ID does not exist";
|
||||
}
|
||||
|
||||
return errors;
|
||||
}
|
||||
|
||||
void CSVWorld::PathgridCreator::focus()
|
||||
{
|
||||
mCell->setFocus();
|
||||
}
|
||||
|
||||
void CSVWorld::PathgridCreator::reset()
|
||||
{
|
||||
CSVWorld::GenericCreator::reset();
|
||||
mCell->setText("");
|
||||
}
|
||||
|
||||
void CSVWorld::PathgridCreator::cellChanged()
|
||||
{
|
||||
update();
|
||||
}
|
||||
|
||||
CSVWorld::Creator *CSVWorld::PathgridCreatorFactory::makeCreator(
|
||||
CSMDoc::Document& document,
|
||||
const CSMWorld::UniversalId& id) const
|
||||
{
|
||||
return new PathgridCreator(
|
||||
document.getData(),
|
||||
document.getUndoStack(),
|
||||
id,
|
||||
document.getIdCompletionManager()
|
||||
);
|
||||
}
|
||||
|
|
|
@ -3,6 +3,24 @@
|
|||
|
||||
#include "genericcreator.hpp"
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
class Document;
|
||||
}
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class Data;
|
||||
class IdCompletionManager;
|
||||
class IdTable;
|
||||
class UniversalId;
|
||||
}
|
||||
|
||||
namespace CSVWidget
|
||||
{
|
||||
class DropLineEdit;
|
||||
}
|
||||
|
||||
namespace CSVWorld
|
||||
{
|
||||
/// \brief Record creator for pathgrids.
|
||||
|
@ -10,16 +28,55 @@ namespace CSVWorld
|
|||
{
|
||||
Q_OBJECT
|
||||
|
||||
CSVWidget::DropLineEdit *mCell;
|
||||
|
||||
private:
|
||||
|
||||
/// \return Cell ID entered by user.
|
||||
virtual std::string getId() const;
|
||||
|
||||
/// \return reference to table containing pathgrids.
|
||||
CSMWorld::IdTable& getPathgridsTable() const;
|
||||
|
||||
public:
|
||||
|
||||
PathgridCreator(
|
||||
CSMWorld::Data& data,
|
||||
QUndoStack& undoStack,
|
||||
const CSMWorld::UniversalId& id,
|
||||
CSMWorld::IdCompletionManager& completionManager,
|
||||
bool relaxedIdRules = false);
|
||||
|
||||
/// \brief Set cell ID input widget to ID of record to be cloned.
|
||||
/// \param originId Cell ID to be cloned.
|
||||
/// \param type Type of record to be cloned.
|
||||
virtual void cloneMode(
|
||||
const std::string& originId,
|
||||
const CSMWorld::UniversalId::Type type);
|
||||
|
||||
/// \return Error description for current user input.
|
||||
virtual std::string getErrors() const;
|
||||
|
||||
/// \brief Set focus to cell ID input widget.
|
||||
virtual void focus();
|
||||
|
||||
/// \brief Clear cell ID input widget.
|
||||
virtual void reset();
|
||||
|
||||
private slots:
|
||||
|
||||
/// \brief Check user input for errors.
|
||||
void cellChanged();
|
||||
};
|
||||
|
||||
/// \brief Creator factory for pathgrid record creator.
|
||||
class PathgridCreatorFactory : public CreatorFactoryBase
|
||||
{
|
||||
public:
|
||||
|
||||
virtual Creator *makeCreator(
|
||||
CSMDoc::Document& document,
|
||||
const CSMWorld::UniversalId& id) const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
|||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, InfoCreatorFactory>);
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_Pathgrids,
|
||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<PathgridCreator> >);
|
||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, PathgridCreatorFactory>);
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_Globals,
|
||||
new CSVDoc::SubViewFactoryWithCreator<TableSubView, CreatorFactory<GlobalCreator> >);
|
||||
|
@ -174,7 +174,7 @@ void CSVWorld::addSubViewFactories (CSVDoc::SubViewFactoryManager& manager)
|
|||
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, JournalCreatorFactory> (false));
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_Pathgrid,
|
||||
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, CreatorFactory<PathgridCreator> > (false));
|
||||
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, PathgridCreatorFactory> (false));
|
||||
|
||||
manager.add (CSMWorld::UniversalId::Type_DebugProfile,
|
||||
new CSVDoc::SubViewFactoryWithCreator<DialogueSubView, CreatorFactory<GenericCreator, CSMWorld::Scope_Project | CSMWorld::Scope_Session> > (false));
|
||||
|
|
|
@ -546,7 +546,7 @@ namespace MWClass
|
|||
|
||||
bool Creature::hasToolTip(const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
if (!ptr.getRefData().getCustomData())
|
||||
if (!ptr.getRefData().getCustomData() || MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||
return true;
|
||||
|
||||
const CreatureCustomData& customData = ptr.getRefData().getCustomData()->asCreatureCustomData();
|
||||
|
|
|
@ -1055,7 +1055,7 @@ namespace MWClass
|
|||
|
||||
bool Npc::hasToolTip(const MWWorld::ConstPtr& ptr) const
|
||||
{
|
||||
if (!ptr.getRefData().getCustomData())
|
||||
if (!ptr.getRefData().getCustomData() || MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||
return true;
|
||||
|
||||
const NpcCustomData& customData = ptr.getRefData().getCustomData()->asNpcCustomData();
|
||||
|
|
|
@ -414,11 +414,11 @@ namespace MWGui
|
|||
|
||||
const MyGUI::IntPoint padding(8, 8);
|
||||
|
||||
const int maximumWidth = 500;
|
||||
|
||||
const int imageCaptionHPadding = (caption != "" ? 8 : 0);
|
||||
const int imageCaptionVPadding = (caption != "" ? 4 : 0);
|
||||
|
||||
const int maximumWidth = MyGUI::RenderManager::getInstance().getViewSize().width - imageCaptionHPadding * 2;
|
||||
|
||||
std::string realImage = MWBase::Environment::get().getWindowManager()->correctIconPath(image);
|
||||
|
||||
MyGUI::EditBox* captionWidget = mDynamicToolTipBox->createWidget<MyGUI::EditBox>("NormalText", MyGUI::IntCoord(0, 0, 300, 300), MyGUI::Align::Left | MyGUI::Align::Top, "ToolTipCaption");
|
||||
|
|
|
@ -367,9 +367,11 @@ void CharacterController::refreshMovementAnims(const WeaponInfo* weap, Character
|
|||
{
|
||||
if(force || movement != mMovementState)
|
||||
{
|
||||
mIdleState = CharState_None;
|
||||
mMovementState = movement;
|
||||
|
||||
if (movement != CharState_None)
|
||||
mIdleState = CharState_None;
|
||||
|
||||
std::string movementAnimName;
|
||||
MWRender::Animation::BlendMask movemask = MWRender::Animation::BlendMask_All;
|
||||
const StateInfo *movestate = std::find_if(sMovementList, sMovementListEnd, FindCharState(mMovementState));
|
||||
|
@ -1842,7 +1844,7 @@ void CharacterController::update(float duration)
|
|||
if (onground)
|
||||
cls.getCreatureStats(mPtr).land();
|
||||
|
||||
if(movestate != CharState_None)
|
||||
if(movestate != CharState_None && movestate != CharState_TurnLeft && movestate != CharState_TurnRight)
|
||||
clearAnimQueue();
|
||||
|
||||
if(mAnimQueue.empty() || inwater || sneak)
|
||||
|
|
|
@ -189,7 +189,7 @@ namespace MWMechanics
|
|||
|
||||
void AttributeValue::setBase(int base)
|
||||
{
|
||||
mBase = std::max(0, base);
|
||||
mBase = base;
|
||||
}
|
||||
|
||||
void AttributeValue::setModifier(int mod)
|
||||
|
|
|
@ -52,7 +52,7 @@ namespace MWMechanics
|
|||
float f1 = 0.2f * merchantStats.getAttribute(ESM::Attribute::Personality).getModified();
|
||||
|
||||
float dispositionTerm = gmst.find("fDispositionMod")->getFloat() * (clampedDisposition - 50);
|
||||
float pcTerm = (dispositionTerm - 50 + a1 + b1 + c1) * playerStats.getFatigueTerm();
|
||||
float pcTerm = (dispositionTerm + a1 + b1 + c1) * playerStats.getFatigueTerm();
|
||||
float npcTerm = (d1 + e1 + f1) * merchantStats.getFatigueTerm();
|
||||
float x = gmst.find("fBargainOfferMulti")->getFloat() * d
|
||||
+ gmst.find("fBargainOfferBase")->getFloat()
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace MWScript
|
|||
runtime.pop();
|
||||
|
||||
MWMechanics::AttributeValue attribute = ptr.getClass().getCreatureStats(ptr).getAttribute(mIndex);
|
||||
attribute.setBase (value - (attribute.getModified() - attribute.getBase()));
|
||||
attribute.setBase (value);
|
||||
ptr.getClass().getCreatureStats(ptr).setAttribute(mIndex, attribute);
|
||||
}
|
||||
};
|
||||
|
@ -151,7 +151,18 @@ namespace MWScript
|
|||
.getCreatureStats(ptr)
|
||||
.getAttribute(mIndex);
|
||||
|
||||
attribute.setBase (std::min(100, attribute.getBase() + value));
|
||||
if (value == 0)
|
||||
return;
|
||||
|
||||
if (((attribute.getBase() <= 0) && (value < 0))
|
||||
|| ((attribute.getBase() >= 100) && (value > 0)))
|
||||
return;
|
||||
|
||||
if (value < 0)
|
||||
attribute.setBase(std::max(0, attribute.getBase() + value));
|
||||
else
|
||||
attribute.setBase(std::min(100, attribute.getBase() + value));
|
||||
|
||||
ptr.getClass().getCreatureStats(ptr).setAttribute(mIndex, attribute);
|
||||
}
|
||||
};
|
||||
|
@ -353,12 +364,7 @@ namespace MWScript
|
|||
|
||||
MWMechanics::NpcStats& stats = ptr.getClass().getNpcStats (ptr);
|
||||
|
||||
int newLevel = value - (stats.getSkill(mIndex).getModified() - stats.getSkill(mIndex).getBase());
|
||||
|
||||
if (newLevel<0)
|
||||
newLevel = 0;
|
||||
|
||||
stats.getSkill (mIndex).setBase (newLevel);
|
||||
stats.getSkill (mIndex).setBase (value);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -378,10 +384,21 @@ namespace MWScript
|
|||
Interpreter::Type_Integer value = runtime[0].mInteger;
|
||||
runtime.pop();
|
||||
|
||||
MWMechanics::NpcStats& stats = ptr.getClass().getNpcStats(ptr);
|
||||
MWMechanics::SkillValue &skill = ptr.getClass()
|
||||
.getNpcStats(ptr)
|
||||
.getSkill(mIndex);
|
||||
|
||||
stats.getSkill(mIndex).
|
||||
setBase (std::min(100, stats.getSkill(mIndex).getBase() + value));
|
||||
if (value == 0)
|
||||
return;
|
||||
|
||||
if (((skill.getBase() <= 0) && (value < 0))
|
||||
|| ((skill.getBase() >= 100) && (value > 0)))
|
||||
return;
|
||||
|
||||
if (value < 0)
|
||||
skill.setBase(std::max(0, skill.getBase() + value));
|
||||
else
|
||||
skill.setBase(std::min(100, skill.getBase() + value));
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -1059,7 +1059,7 @@ namespace MWWorld
|
|||
facedObject = getFacedObject(activationDistance, true);
|
||||
|
||||
if (!facedObject.isEmpty() && !facedObject.getClass().allowTelekinesis(facedObject)
|
||||
&& mDistanceToFacedObject > getMaxActivationDistance())
|
||||
&& mDistanceToFacedObject > getMaxActivationDistance() && !MWBase::Environment::get().getWindowManager()->isGuiMode())
|
||||
return 0;
|
||||
}
|
||||
return facedObject;
|
||||
|
|
|
@ -48,6 +48,9 @@ cache:
|
|||
|
||||
clone_folder: C:\projects\openmw
|
||||
|
||||
install:
|
||||
- set PATH=C:\Program Files\Git\mingw64\bin;%PATH%
|
||||
|
||||
before_build:
|
||||
- cmd: sh %APPVEYOR_BUILD_FOLDER%\CI\before_script.msvc.sh -u -p %PLATFORM% -v %msvc%
|
||||
|
||||
|
|
|
@ -47,7 +47,6 @@ namespace Resource
|
|||
float _statsHeight;
|
||||
|
||||
std::string _font;
|
||||
float _leftPos;
|
||||
float _characterSize;
|
||||
|
||||
int _resourceStatsChildNum;
|
||||
|
|
Loading…
Reference in a new issue