Merge remote-tracking branch 'upstream/master'

Conflicts:
	apps/openmw/mwmechanics/actors.cpp
This commit is contained in:
Thomas 2014-04-28 12:27:57 -04:00
commit 885228ec02
80 changed files with 375 additions and 241 deletions

View file

@ -333,7 +333,7 @@ int load(Arguments& info)
// Is the user interested in this record type? // Is the user interested in this record type?
bool interested = true; bool interested = true;
if (info.types.size() > 0) if (!info.types.empty())
{ {
std::vector<std::string>::iterator match; std::vector<std::string>::iterator match;
match = std::find(info.types.begin(), info.types.end(), match = std::find(info.types.begin(), info.types.end(),

View file

@ -124,7 +124,7 @@ void printEffectList(ESM::EffectList effects)
{ {
int i = 0; int i = 0;
std::vector<ESM::ENAMstruct>::iterator eit; std::vector<ESM::ENAMstruct>::iterator eit;
for (eit = effects.mList.begin(); eit != effects.mList.end(); eit++) for (eit = effects.mList.begin(); eit != effects.mList.end(); ++eit)
{ {
std::cout << " Effect[" << i << "]: " << magicEffectLabel(eit->mEffectID) std::cout << " Effect[" << i << "]: " << magicEffectLabel(eit->mEffectID)
<< " (" << eit->mEffectID << ")" << std::endl; << " (" << eit->mEffectID << ")" << std::endl;

View file

@ -214,13 +214,13 @@ QStringList Launcher::GraphicsPage::getAvailableOptions(const QString &key, Ogre
uint row = 0; uint row = 0;
Ogre::ConfigOptionMap options = renderer->getConfigOptions(); Ogre::ConfigOptionMap options = renderer->getConfigOptions();
for (Ogre::ConfigOptionMap::iterator i = options.begin (); i != options.end (); i++, row++) for (Ogre::ConfigOptionMap::iterator i = options.begin (); i != options.end (); ++i, ++row)
{ {
Ogre::StringVector::iterator opt_it; Ogre::StringVector::iterator opt_it;
uint idx = 0; uint idx = 0;
for (opt_it = i->second.possibleValues.begin(); for (opt_it = i->second.possibleValues.begin();
opt_it != i->second.possibleValues.end(); opt_it++, idx++) opt_it != i->second.possibleValues.end(); ++opt_it, ++idx)
{ {
if (strcmp (key.toStdString().c_str(), i->first.c_str()) == 0) { if (strcmp (key.toStdString().c_str(), i->first.c_str()) == 0) {
result << ((key == "FSAA") ? QString("MSAA ") : QString("")) + QString::fromStdString((*opt_it).c_str()).simplified(); result << ((key == "FSAA") ? QString("MSAA ") : QString("")) + QString::fromStdString((*opt_it).c_str()).simplified();

4
apps/opencs/view/world/datadisplaydelegate.cpp Executable file → Normal file
View file

@ -25,7 +25,7 @@ CSVWorld::DataDisplayDelegate::DataDisplayDelegate(const ValueList &values,
void CSVWorld::DataDisplayDelegate::buildPixmaps () void CSVWorld::DataDisplayDelegate::buildPixmaps ()
{ {
if (mPixmaps.size() > 0) if (!mPixmaps.empty())
mPixmaps.clear(); mPixmaps.clear();
IconList::iterator it = mIcons.begin(); IconList::iterator it = mIcons.begin();
@ -33,7 +33,7 @@ void CSVWorld::DataDisplayDelegate::buildPixmaps ()
while (it != mIcons.end()) while (it != mIcons.end())
{ {
mPixmaps.push_back (std::make_pair (it->first, it->second.pixmap (mIconSize) ) ); mPixmaps.push_back (std::make_pair (it->first, it->second.pixmap (mIconSize) ) );
it++; ++it;
} }
} }

View file

@ -298,7 +298,7 @@ void CSVWorld::Table::revertRecord()
{ {
std::vector<std::string> revertableIds = listRevertableSelectedIds(); std::vector<std::string> revertableIds = listRevertableSelectedIds();
if (revertableIds.size()>0) if (!revertableIds.empty())
{ {
if (revertableIds.size()>1) if (revertableIds.size()>1)
mDocument.getUndoStack().beginMacro (tr ("Revert multiple records")); mDocument.getUndoStack().beginMacro (tr ("Revert multiple records"));
@ -318,7 +318,7 @@ void CSVWorld::Table::deleteRecord()
{ {
std::vector<std::string> deletableIds = listDeletableSelectedIds(); std::vector<std::string> deletableIds = listDeletableSelectedIds();
if (deletableIds.size()>0) if (!deletableIds.empty())
{ {
if (deletableIds.size()>1) if (deletableIds.size()>1)
mDocument.getUndoStack().beginMacro (tr ("Delete multiple records")); mDocument.getUndoStack().beginMacro (tr ("Delete multiple records"));

View file

@ -5,6 +5,11 @@
#include <stdint.h> #include <stdint.h>
namespace Loading
{
class Listener;
}
namespace ESM namespace ESM
{ {
class ESMReader; class ESMReader;
@ -60,7 +65,7 @@ namespace MWBase
virtual int countSavedGameRecords() const = 0; virtual int countSavedGameRecords() const = 0;
virtual void write (ESM::ESMWriter& writer) const = 0; virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const = 0;
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0; virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
}; };

View file

@ -11,6 +11,11 @@
#include "../mwdialogue/topic.hpp" #include "../mwdialogue/topic.hpp"
#include "../mwdialogue/quest.hpp" #include "../mwdialogue/quest.hpp"
namespace Loading
{
class Listener;
}
namespace ESM namespace ESM
{ {
class ESMReader; class ESMReader;
@ -80,7 +85,7 @@ namespace MWBase
virtual int countSavedGameRecords() const = 0; virtual int countSavedGameRecords() const = 0;
virtual void write (ESM::ESMWriter& writer) const = 0; virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const = 0;
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0; virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
}; };

View file

@ -156,8 +156,9 @@ namespace MWBase
virtual void setValue (const std::string& id, int value) = 0; virtual void setValue (const std::string& id, int value) = 0;
/// Set time left for the player to start drowning (update the drowning bar) /// Set time left for the player to start drowning (update the drowning bar)
/// @param time value from [0,20] /// @param time time left to start drowning
virtual void setDrowningTimeLeft (float time) =0; /// @param maxTime how long we can be underwater (in total) until drowning starts
virtual void setDrowningTimeLeft (float time, float maxTime) = 0;
virtual void setPlayerClass (const ESM::Class &class_) = 0; virtual void setPlayerClass (const ESM::Class &class_) = 0;
///< set current class of player ///< set current class of player
@ -302,7 +303,7 @@ namespace MWBase
/// Clear all savegame-specific data /// Clear all savegame-specific data
virtual void clear() = 0; virtual void clear() = 0;
virtual void write (ESM::ESMWriter& writer) = 0; virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) = 0;
virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0; virtual void readRecord (ESM::ESMReader& reader, int32_t type) = 0;
}; };
} }

View file

@ -108,7 +108,7 @@ namespace MWBase
virtual int countSavedGameRecords() const = 0; virtual int countSavedGameRecords() const = 0;
virtual void write (ESM::ESMWriter& writer) const = 0; virtual void write (ESM::ESMWriter& writer, Loading::Listener& listener) const = 0;
virtual void readRecord (ESM::ESMReader& reader, int32_t type, virtual void readRecord (ESM::ESMReader& reader, int32_t type,
const std::map<int, int>& contentFileMap) = 0; const std::map<int, int>& contentFileMap) = 0;

View file

@ -609,7 +609,7 @@ namespace MWDialogue
return 1; // known topics return 1; // known topics
} }
void DialogueManager::write (ESM::ESMWriter& writer) const void DialogueManager::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
{ {
ESM::DialogueState state; ESM::DialogueState state;
@ -621,6 +621,7 @@ namespace MWDialogue
writer.startRecord (ESM::REC_DIAS); writer.startRecord (ESM::REC_DIAS);
state.save (writer); state.save (writer);
writer.endRecord (ESM::REC_DIAS); writer.endRecord (ESM::REC_DIAS);
progress.increaseProgress();
} }
void DialogueManager::readRecord (ESM::ESMReader& reader, int32_t type) void DialogueManager::readRecord (ESM::ESMReader& reader, int32_t type)

View file

@ -83,7 +83,7 @@ namespace MWDialogue
virtual int countSavedGameRecords() const; virtual int countSavedGameRecords() const;
virtual void write (ESM::ESMWriter& writer) const; virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
virtual void readRecord (ESM::ESMReader& reader, int32_t type); virtual void readRecord (ESM::ESMReader& reader, int32_t type);
}; };

View file

@ -167,7 +167,7 @@ namespace MWDialogue
return count; return count;
} }
void Journal::write (ESM::ESMWriter& writer) const void Journal::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
{ {
for (TQuestIter iter (mQuests.begin()); iter!=mQuests.end(); ++iter) for (TQuestIter iter (mQuests.begin()); iter!=mQuests.end(); ++iter)
{ {
@ -178,6 +178,7 @@ namespace MWDialogue
writer.startRecord (ESM::REC_QUES); writer.startRecord (ESM::REC_QUES);
state.save (writer); state.save (writer);
writer.endRecord (ESM::REC_QUES); writer.endRecord (ESM::REC_QUES);
progress.increaseProgress();
for (Topic::TEntryIter iter (quest.begin()); iter!=quest.end(); ++iter) for (Topic::TEntryIter iter (quest.begin()); iter!=quest.end(); ++iter)
{ {
@ -188,6 +189,7 @@ namespace MWDialogue
writer.startRecord (ESM::REC_JOUR); writer.startRecord (ESM::REC_JOUR);
entry.save (writer); entry.save (writer);
writer.endRecord (ESM::REC_JOUR); writer.endRecord (ESM::REC_JOUR);
progress.increaseProgress();
} }
} }
@ -199,6 +201,7 @@ namespace MWDialogue
writer.startRecord (ESM::REC_JOUR); writer.startRecord (ESM::REC_JOUR);
entry.save (writer); entry.save (writer);
writer.endRecord (ESM::REC_JOUR); writer.endRecord (ESM::REC_JOUR);
progress.increaseProgress();
} }
for (TTopicIter iter (mTopics.begin()); iter!=mTopics.end(); ++iter) for (TTopicIter iter (mTopics.begin()); iter!=mTopics.end(); ++iter)
@ -214,6 +217,7 @@ namespace MWDialogue
writer.startRecord (ESM::REC_JOUR); writer.startRecord (ESM::REC_JOUR);
entry.save (writer); entry.save (writer);
writer.endRecord (ESM::REC_JOUR); writer.endRecord (ESM::REC_JOUR);
progress.increaseProgress();
} }
} }
} }

View file

@ -64,7 +64,7 @@ namespace MWDialogue
virtual int countSavedGameRecords() const; virtual int countSavedGameRecords() const;
virtual void write (ESM::ESMWriter& writer) const; virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
virtual void readRecord (ESM::ESMReader& reader, int32_t type); virtual void readRecord (ESM::ESMReader& reader, int32_t type);
}; };

View file

@ -188,12 +188,13 @@ namespace MWGui
break; break;
case GM_ClassCreate: case GM_ClassCreate:
MWBase::Environment::get().getWindowManager()->removeDialog(mCreateClassDialog); if (!mCreateClassDialog)
mCreateClassDialog = 0; {
mCreateClassDialog = new CreateClassDialog(); mCreateClassDialog = new CreateClassDialog();
mCreateClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
mCreateClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogDone); mCreateClassDialog->eventDone += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogDone);
mCreateClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogBack); mCreateClassDialog->eventBack += MyGUI::newDelegate(this, &CharacterCreation::onCreateClassDialogBack);
}
mCreateClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen);
mCreateClassDialog->setVisible(true); mCreateClassDialog->setVisible(true);
if (mCreationStage < CSE_RaceChosen) if (mCreationStage < CSE_RaceChosen)
mCreationStage = CSE_RaceChosen; mCreationStage = CSE_RaceChosen;
@ -531,8 +532,8 @@ namespace MWGui
mPlayerClass = klass; mPlayerClass = klass;
MWBase::Environment::get().getWindowManager()->setPlayerClass(klass); MWBase::Environment::get().getWindowManager()->setPlayerClass(klass);
MWBase::Environment::get().getWindowManager()->removeDialog(mCreateClassDialog); // Do not delete dialog, so that choices are rembered in case we want to go back and adjust them later
mCreateClassDialog = 0; mCreateClassDialog->setVisible(false);
} }
updatePlayerHealth(); updatePlayerHealth();
@ -554,8 +555,8 @@ namespace MWGui
void CharacterCreation::onCreateClassDialogBack() void CharacterCreation::onCreateClassDialogBack()
{ {
MWBase::Environment::get().getWindowManager()->removeDialog(mCreateClassDialog); // Do not delete dialog, so that choices are rembered in case we want to go back and adjust them later
mCreateClassDialog = 0; mCreateClassDialog->setVisible(false);
MWBase::Environment::get().getWindowManager()->popGuiMode(); MWBase::Environment::get().getWindowManager()->popGuiMode();
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class); MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);

View file

@ -10,7 +10,7 @@ namespace MWGui
{ {
} }
void CompanionItemModel::copyItem (const ItemStack& item, size_t count) void CompanionItemModel::copyItem (const ItemStack& item, size_t count, bool setNewOwner=false)
{ {
if (mActor.getClass().isNpc()) if (mActor.getClass().isNpc())
{ {
@ -18,7 +18,7 @@ namespace MWGui
stats.modifyProfit(MWWorld::Class::get(item.mBase).getValue(item.mBase) * count); stats.modifyProfit(MWWorld::Class::get(item.mBase).getValue(item.mBase) * count);
} }
InventoryItemModel::copyItem(item, count); InventoryItemModel::copyItem(item, count, setNewOwner);
} }
void CompanionItemModel::removeItem (const ItemStack& item, size_t count) void CompanionItemModel::removeItem (const ItemStack& item, size_t count)

View file

@ -13,7 +13,7 @@ namespace MWGui
public: public:
CompanionItemModel (const MWWorld::Ptr& actor); CompanionItemModel (const MWWorld::Ptr& actor);
virtual void copyItem (const ItemStack& item, size_t count); virtual void copyItem (const ItemStack& item, size_t count, bool setNewOwner);
virtual void removeItem (const ItemStack& item, size_t count); virtual void removeItem (const ItemStack& item, size_t count);
}; };

View file

@ -13,6 +13,7 @@
#include "../mwworld/containerstore.hpp" #include "../mwworld/containerstore.hpp"
#include "../mwmechanics/pickpocket.hpp" #include "../mwmechanics/pickpocket.hpp"
#include "../mwmechanics/creaturestats.hpp"
#include "countdialog.hpp" #include "countdialog.hpp"
#include "tradewindow.hpp" #include "tradewindow.hpp"
@ -84,8 +85,7 @@ namespace MWGui
// otherwise, do the transfer // otherwise, do the transfer
if (targetModel != mSourceModel) if (targetModel != mSourceModel)
{ {
targetModel->copyItem(mItem, mDraggedCount); mSourceModel->moveItem(mItem, mDraggedCount, targetModel);
mSourceModel->removeItem(mItem, mDraggedCount);
} }
mSourceModel->update(); mSourceModel->update();
@ -292,8 +292,7 @@ namespace MWGui
if (!onTakeItem(item, item.mCount)) if (!onTakeItem(item, item.mCount))
break; break;
playerModel->copyItem(item, item.mCount); mModel->moveItem(item, item.mCount, playerModel);
mModel->removeItem(item, item.mCount);
} }
MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container); MWBase::Environment::get().getWindowManager()->removeGuiMode(GM_Container);
@ -341,6 +340,10 @@ namespace MWGui
} }
else else
{ {
// Looting a dead corpse is considered OK
if (mPtr.getClass().isActor() && mPtr.getClass().getCreatureStats(mPtr).isDead())
return true;
else
MWBase::Environment::get().getMechanicsManager()->itemTaken(player, item.mBase, count); MWBase::Environment::get().getMechanicsManager()->itemTaken(player, item.mBase, count);
} }
return true; return true;

View file

@ -71,7 +71,7 @@ ItemModel::ModelIndex ContainerItemModel::getIndex (ItemStack item)
return -1; return -1;
} }
void ContainerItemModel::copyItem (const ItemStack& item, size_t count) void ContainerItemModel::copyItem (const ItemStack& item, size_t count, bool setNewOwner)
{ {
const MWWorld::Ptr& source = mItemSources[mItemSources.size()-1]; const MWWorld::Ptr& source = mItemSources[mItemSources.size()-1];
if (item.mBase.getContainerStore() == &source.getClass().getContainerStore(source)) if (item.mBase.getContainerStore() == &source.getClass().getContainerStore(source))

View file

@ -21,7 +21,7 @@ namespace MWGui
virtual ModelIndex getIndex (ItemStack item); virtual ModelIndex getIndex (ItemStack item);
virtual size_t getItemCount(); virtual size_t getItemCount();
virtual void copyItem (const ItemStack& item, size_t count); virtual void copyItem (const ItemStack& item, size_t count, bool setNewOwner=false);
virtual void removeItem (const ItemStack& item, size_t count); virtual void removeItem (const ItemStack& item, size_t count);
virtual void update(); virtual void update();

View file

@ -203,9 +203,9 @@ namespace MWGui
} }
} }
void HUD::setDrowningTimeLeft(float time) void HUD::setDrowningTimeLeft(float time, float maxTime)
{ {
size_t progress = time/20.0*200.0; size_t progress = time/maxTime*200.0;
mDrowning->setProgressPosition(progress); mDrowning->setProgressPosition(progress);
bool isDrowning = (progress == 0); bool isDrowning = (progress == 0);
@ -625,7 +625,7 @@ namespace MWGui
if (mIsDrowning) if (mIsDrowning)
{ {
float intensity = (cos(mDrowningFlashTheta) + 1.0f) / 2.0f; float intensity = (cos(mDrowningFlashTheta) + 1.0f) / 2.0f;
mDrowningFlash->setColour(MyGUI::Colour(intensity, intensity, intensity)); mDrowningFlash->setColour(MyGUI::Colour(intensity, 0, 0));
} }
} }

View file

@ -22,8 +22,9 @@ namespace MWGui
void setBatchCount(unsigned int count); void setBatchCount(unsigned int count);
/// Set time left for the player to start drowning /// Set time left for the player to start drowning
/// @param time value from [0,20] /// @param time time left to start drowning
void setDrowningTimeLeft(float time); /// @param maxTime how long we can be underwater (in total) until drowning starts
void setDrowningTimeLeft(float time, float maxTime);
void setDrowningBarVisible(bool visible); void setDrowningBarVisible(bool visible);
void setHmsVisible(bool visible); void setHmsVisible(bool visible);

View file

@ -4,6 +4,8 @@
#include "../mwworld/class.hpp" #include "../mwworld/class.hpp"
#include "../mwworld/inventorystore.hpp" #include "../mwworld/inventorystore.hpp"
#include "../mwmechanics/creaturestats.hpp"
namespace MWGui namespace MWGui
{ {
@ -38,11 +40,11 @@ ItemModel::ModelIndex InventoryItemModel::getIndex (ItemStack item)
return -1; return -1;
} }
void InventoryItemModel::copyItem (const ItemStack& item, size_t count) void InventoryItemModel::copyItem (const ItemStack& item, size_t count, bool setNewOwner)
{ {
if (item.mBase.getContainerStore() == &mActor.getClass().getContainerStore(mActor)) if (item.mBase.getContainerStore() == &mActor.getClass().getContainerStore(mActor))
throw std::runtime_error("Item to copy needs to be from a different container!"); throw std::runtime_error("Item to copy needs to be from a different container!");
mActor.getClass().getContainerStore(mActor).add(item.mBase, count, mActor); mActor.getClass().getContainerStore(mActor).add(item.mBase, count, mActor, setNewOwner);
} }
@ -57,6 +59,18 @@ void InventoryItemModel::removeItem (const ItemStack& item, size_t count)
throw std::runtime_error("Not enough items in the stack to remove"); throw std::runtime_error("Not enough items in the stack to remove");
} }
void InventoryItemModel::moveItem(const ItemStack &item, size_t count, ItemModel *otherModel)
{
bool setNewOwner = false;
// Are you dead? Then you wont need that anymore
if (mActor.getClass().isActor() && mActor.getClass().getCreatureStats(mActor).isDead())
setNewOwner = true;
otherModel->copyItem(item, count, setNewOwner);
removeItem(item, count);
}
void InventoryItemModel::update() void InventoryItemModel::update()
{ {
MWWorld::ContainerStore& store = MWWorld::Class::get(mActor).getContainerStore(mActor); MWWorld::ContainerStore& store = MWWorld::Class::get(mActor).getContainerStore(mActor);

View file

@ -15,9 +15,12 @@ namespace MWGui
virtual ModelIndex getIndex (ItemStack item); virtual ModelIndex getIndex (ItemStack item);
virtual size_t getItemCount(); virtual size_t getItemCount();
virtual void copyItem (const ItemStack& item, size_t count); virtual void copyItem (const ItemStack& item, size_t count, bool setNewOwner=false);
virtual void removeItem (const ItemStack& item, size_t count); virtual void removeItem (const ItemStack& item, size_t count);
/// Move items from this model to \a otherModel.
virtual void moveItem (const ItemStack& item, size_t count, ItemModel* otherModel);
virtual void update(); virtual void update();
protected: protected:

View file

@ -71,16 +71,22 @@ namespace MWGui
{ {
} }
void ItemModel::moveItem(const ItemStack &item, size_t count, ItemModel *otherModel)
{
otherModel->copyItem(item, count);
removeItem(item, count);
}
ProxyItemModel::~ProxyItemModel() ProxyItemModel::~ProxyItemModel()
{ {
delete mSourceModel; delete mSourceModel;
} }
void ProxyItemModel::copyItem (const ItemStack& item, size_t count) void ProxyItemModel::copyItem (const ItemStack& item, size_t count, bool setNewOwner)
{ {
// no need to use mapToSource since itemIndex refers to an index in the sourceModel // no need to use mapToSource since itemIndex refers to an index in the sourceModel
mSourceModel->copyItem (item, count); mSourceModel->copyItem (item, count, setNewOwner);
} }
void ProxyItemModel::removeItem (const ItemStack& item, size_t count) void ProxyItemModel::removeItem (const ItemStack& item, size_t count)

View file

@ -55,7 +55,11 @@ namespace MWGui
virtual void update() = 0; virtual void update() = 0;
virtual void copyItem (const ItemStack& item, size_t count) = 0; /// Move items from this model to \a otherModel.
virtual void moveItem (const ItemStack& item, size_t count, ItemModel* otherModel);
/// @param setNewOwner Set the copied item's owner to the actor we are copying to, or keep the original owner?
virtual void copyItem (const ItemStack& item, size_t count, bool setNewOwner=false) = 0;
virtual void removeItem (const ItemStack& item, size_t count) = 0; virtual void removeItem (const ItemStack& item, size_t count) = 0;
private: private:
@ -69,7 +73,7 @@ namespace MWGui
{ {
public: public:
virtual ~ProxyItemModel(); virtual ~ProxyItemModel();
virtual void copyItem (const ItemStack& item, size_t count); virtual void copyItem (const ItemStack& item, size_t count, bool setNewOwner=false);
virtual void removeItem (const ItemStack& item, size_t count); virtual void removeItem (const ItemStack& item, size_t count);
virtual ModelIndex getIndex (ItemStack item); virtual ModelIndex getIndex (ItemStack item);

View file

@ -160,7 +160,6 @@ namespace MWGui
void LoadingScreen::setProgress (size_t value) void LoadingScreen::setProgress (size_t value)
{ {
assert(value < mProgressBar->getScrollRange());
if (value - mProgress < mProgressBar->getScrollRange()/100.f) if (value - mProgress < mProgressBar->getScrollRange()/100.f)
return; return;
mProgress = value; mProgress = value;
@ -174,7 +173,6 @@ namespace MWGui
mProgressBar->setScrollPosition(0); mProgressBar->setScrollPosition(0);
size_t value = mProgress + increase; size_t value = mProgress + increase;
mProgress = value; mProgress = value;
assert(mProgress < mProgressBar->getScrollRange());
mProgressBar->setTrackSize(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize()); mProgressBar->setTrackSize(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize());
draw(); draw();
} }

View file

@ -25,7 +25,7 @@ namespace MWGui
virtual void setProgressRange (size_t range); virtual void setProgressRange (size_t range);
virtual void setProgress (size_t value); virtual void setProgress (size_t value);
virtual void increaseProgress (size_t increase); virtual void increaseProgress (size_t increase=1);
virtual void setVisible(bool visible); virtual void setVisible(bool visible);

View file

@ -595,7 +595,7 @@ namespace MWGui
MyGUI::Gui::getInstance().destroyWidget(mGlobalMapOverlay->getChildAt(0)); MyGUI::Gui::getInstance().destroyWidget(mGlobalMapOverlay->getChildAt(0));
} }
void MapWindow::write(ESM::ESMWriter &writer) void MapWindow::write(ESM::ESMWriter &writer, Loading::Listener& progress)
{ {
ESM::GlobalMap map; ESM::GlobalMap map;
mGlobalMapRender->write(map); mGlobalMapRender->write(map);
@ -605,6 +605,7 @@ namespace MWGui
writer.startRecord(ESM::REC_GMAP); writer.startRecord(ESM::REC_GMAP);
map.save(writer); map.save(writer);
writer.endRecord(ESM::REC_GMAP); writer.endRecord(ESM::REC_GMAP);
progress.increaseProgress();
} }
void MapWindow::readRecord(ESM::ESMReader &reader, int32_t type) void MapWindow::readRecord(ESM::ESMReader &reader, int32_t type)

View file

@ -108,7 +108,7 @@ namespace MWGui
/// Clear all savegame-specific data /// Clear all savegame-specific data
void clear(); void clear();
void write (ESM::ESMWriter& writer); void write (ESM::ESMWriter& writer, Loading::Listener& progress);
void readRecord (ESM::ESMReader& reader, int32_t type); void readRecord (ESM::ESMReader& reader, int32_t type);
private: private:

View file

@ -120,14 +120,11 @@ namespace MWGui
if (i == sourceModel->getItemCount()) if (i == sourceModel->getItemCount())
throw std::runtime_error("The borrowed item disappeared"); throw std::runtime_error("The borrowed item disappeared");
// reset owner before copying // reset owner while copying, but only for items bought by the player
bool setNewOwner = (mMerchant.isEmpty());
const ItemStack& item = sourceModel->getItem(i); const ItemStack& item = sourceModel->getItem(i);
std::string owner = item.mBase.getCellRef().mOwner;
if (mMerchant.isEmpty()) // only for items bought by player
item.mBase.getCellRef().mOwner = "";
// copy the borrowed items to our model // copy the borrowed items to our model
copyItem(item, it->mCount); copyItem(item, it->mCount, setNewOwner);
item.mBase.getCellRef().mOwner = owner;
// then remove them from the source model // then remove them from the source model
sourceModel->removeItem(item, it->mCount); sourceModel->removeItem(item, it->mCount);
} }

View file

@ -245,7 +245,7 @@ namespace MWGui
// were there any items traded at all? // were there any items traded at all?
std::vector<ItemStack> playerBought = playerItemModel->getItemsBorrowedToUs(); std::vector<ItemStack> playerBought = playerItemModel->getItemsBorrowedToUs();
std::vector<ItemStack> merchantBought = mTradeModel->getItemsBorrowedToUs(); std::vector<ItemStack> merchantBought = mTradeModel->getItemsBorrowedToUs();
if (!playerBought.size() && !merchantBought.size()) if (playerBought.empty() && merchantBought.empty())
{ {
// user notification // user notification
MWBase::Environment::get().getWindowManager()-> MWBase::Environment::get().getWindowManager()->

View file

@ -625,9 +625,9 @@ namespace MWGui
mStatsWindow->setValue (id, value); mStatsWindow->setValue (id, value);
} }
void WindowManager::setDrowningTimeLeft (float time) void WindowManager::setDrowningTimeLeft (float time, float maxTime)
{ {
mHud->setDrowningTimeLeft(time); mHud->setDrowningTimeLeft(time, maxTime);
} }
void WindowManager::setPlayerClass (const ESM::Class &class_) void WindowManager::setPlayerClass (const ESM::Class &class_)
@ -1407,9 +1407,9 @@ namespace MWGui
mMap->clear(); mMap->clear();
} }
void WindowManager::write(ESM::ESMWriter &writer) void WindowManager::write(ESM::ESMWriter &writer, Loading::Listener& progress)
{ {
mMap->write(writer); mMap->write(writer, progress);
} }
void WindowManager::readRecord(ESM::ESMReader &reader, int32_t type) void WindowManager::readRecord(ESM::ESMReader &reader, int32_t type)

View file

@ -166,8 +166,9 @@ namespace MWGui
virtual void setValue (const std::string& id, int value); virtual void setValue (const std::string& id, int value);
/// Set time left for the player to start drowning (update the drowning bar) /// Set time left for the player to start drowning (update the drowning bar)
/// @param time value from [0,20] /// @param time time left to start drowning
virtual void setDrowningTimeLeft (float time); /// @param maxTime how long we can be underwater (in total) until drowning starts
virtual void setDrowningTimeLeft (float time, float maxTime);
virtual void setPlayerClass (const ESM::Class &class_); ///< set current class of player virtual void setPlayerClass (const ESM::Class &class_); ///< set current class of player
virtual void configureSkills (const SkillList& major, const SkillList& minor); ///< configure skill groups, each set contains the skill ID for that group. virtual void configureSkills (const SkillList& major, const SkillList& minor); ///< configure skill groups, each set contains the skill ID for that group.
@ -290,7 +291,7 @@ namespace MWGui
/// Clear all savegame-specific data /// Clear all savegame-specific data
virtual void clear(); virtual void clear();
virtual void write (ESM::ESMWriter& writer); virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress);
virtual void readRecord (ESM::ESMReader& reader, int32_t type); virtual void readRecord (ESM::ESMReader& reader, int32_t type);
private: private:

View file

@ -206,7 +206,7 @@ namespace MWMechanics
if (effectIt->mKey.mId == effectId) if (effectIt->mKey.mId == effectId)
effectIt = it->second.mEffects.erase(effectIt); effectIt = it->second.mEffects.erase(effectIt);
else else
effectIt++; ++effectIt;
} }
} }
mSpellsChanged = true; mSpellsChanged = true;
@ -224,7 +224,7 @@ namespace MWMechanics
&& it->second.mCasterHandle == actorHandle) && it->second.mCasterHandle == actorHandle)
effectIt = it->second.mEffects.erase(effectIt); effectIt = it->second.mEffects.erase(effectIt);
else else
effectIt++; ++effectIt;
} }
} }
mSpellsChanged = true; mSpellsChanged = true;

View file

@ -194,21 +194,11 @@ namespace MWMechanics
+(actorpos.pos[1] - playerpos.pos[1])*(actorpos.pos[1] - playerpos.pos[1]) +(actorpos.pos[1] - playerpos.pos[1])*(actorpos.pos[1] - playerpos.pos[1])
+(actorpos.pos[2] - playerpos.pos[2])*(actorpos.pos[2] - playerpos.pos[2])); +(actorpos.pos[2] - playerpos.pos[2])*(actorpos.pos[2] - playerpos.pos[2]));
float fight = ptr.getClass().getCreatureStats(ptr).getAiSetting(CreatureStats::AI_Fight).getModified(); float fight = ptr.getClass().getCreatureStats(ptr).getAiSetting(CreatureStats::AI_Fight).getModified();
float disp = 100; //creatures don't have disposition, so set it to 100 by default
if(ptr.getTypeName() == typeid(ESM::NPC).name())
{
disp = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(ptr);
}
if( (fight == 100 ) if( (fight == 100 )
|| (fight >= 95 && d <= 3000) || (fight >= 95 && d <= 3000)
|| (fight >= 90 && d <= 2000) || (fight >= 90 && d <= 2000)
|| (fight >= 80 && d <= 1000) || (fight >= 80 && d <= 1000)
|| (fight >= 80 && disp <= 40)
|| (fight >= 70 && disp <= 35 && d <= 1000)
|| (fight >= 60 && disp <= 30 && d <= 1000)
|| (fight >= 50 && disp == 0)
|| (fight >= 40 && disp <= 10 && d <= 500)
) )
{ {
bool LOS = MWBase::Environment::get().getWorld()->getLOS(ptr,player) bool LOS = MWBase::Environment::get().getWorld()->getLOS(ptr,player)
@ -1039,8 +1029,7 @@ namespace MWMechanics
{ {
const MWWorld::Class &cls = MWWorld::Class::get(iter->first); const MWWorld::Class &cls = MWWorld::Class::get(iter->first);
CreatureStats &stats = cls.getCreatureStats(iter->first); CreatureStats &stats = cls.getCreatureStats(iter->first);
if(!stats.isDead() && stats.getAiSequence().getTypeId() == AiPackage::TypeIdFollow)
if(stats.getAiSequence().getTypeId() == AiPackage::TypeIdFollow && !stats.isDead())
{ {
MWMechanics::AiFollow* package = static_cast<MWMechanics::AiFollow*>(stats.getAiSequence().getActivePackage()); MWMechanics::AiFollow* package = static_cast<MWMechanics::AiFollow*>(stats.getAiSequence().getActivePackage());
if(package->getFollowedActor() == actor.getCellRef().mRefID) if(package->getFollowedActor() == actor.getCellRef().mRefID)
@ -1061,8 +1050,7 @@ namespace MWMechanics
{ {
const MWWorld::Class &cls = MWWorld::Class::get(*iter); const MWWorld::Class &cls = MWWorld::Class::get(*iter);
CreatureStats &stats = cls.getCreatureStats(*iter); CreatureStats &stats = cls.getCreatureStats(*iter);
if(!stats.isDead() && stats.getAiSequence().getTypeId() == AiPackage::TypeIdCombat)
if(stats.getAiSequence().getTypeId() == AiPackage::TypeIdCombat && !stats.isDead())
{ {
MWMechanics::AiCombat* package = static_cast<MWMechanics::AiCombat*>(stats.getAiSequence().getActivePackage()); MWMechanics::AiCombat* package = static_cast<MWMechanics::AiCombat*>(stats.getAiSequence().getActivePackage());
if(package->getTargetId() == actor.getCellRef().mRefID) if(package->getTargetId() == actor.getCellRef().mRefID)

View file

@ -118,7 +118,7 @@ void MWMechanics::AiSequence::clear()
void MWMechanics::AiSequence::stack (const AiPackage& package) void MWMechanics::AiSequence::stack (const AiPackage& package)
{ {
for(std::list<AiPackage *>::iterator it = mPackages.begin(); it != mPackages.end(); it++) for(std::list<AiPackage *>::iterator it = mPackages.begin(); it != mPackages.end(); ++it)
{ {
if(mPackages.front()->getPriority() <= package.getPriority()) if(mPackages.front()->getPriority() <= package.getPriority())
{ {

View file

@ -298,13 +298,15 @@ namespace MWMechanics
if(stats.getTimeToStartDrowning() != mWatchedStats.getTimeToStartDrowning()) if(stats.getTimeToStartDrowning() != mWatchedStats.getTimeToStartDrowning())
{ {
const float fHoldBreathTime = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
.find("fHoldBreathTime")->getFloat();
mWatchedStats.setTimeToStartDrowning(stats.getTimeToStartDrowning()); mWatchedStats.setTimeToStartDrowning(stats.getTimeToStartDrowning());
if(stats.getTimeToStartDrowning() >= 20.0f) if(stats.getTimeToStartDrowning() >= fHoldBreathTime)
winMgr->setDrowningBarVisibility(false); winMgr->setDrowningBarVisibility(false);
else else
{ {
winMgr->setDrowningBarVisibility(true); winMgr->setDrowningBarVisibility(true);
winMgr->setDrowningTimeLeft(stats.getTimeToStartDrowning()); winMgr->setDrowningTimeLeft(stats.getTimeToStartDrowning(), fHoldBreathTime);
} }
} }
@ -338,6 +340,8 @@ namespace MWMechanics
MWWorld::ContainerStoreIterator enchantItem = inv.getSelectedEnchantItem(); MWWorld::ContainerStoreIterator enchantItem = inv.getSelectedEnchantItem();
if (enchantItem != inv.end()) if (enchantItem != inv.end())
winMgr->setSelectedEnchantItem(*enchantItem); winMgr->setSelectedEnchantItem(*enchantItem);
else if (winMgr->getSelectedSpell() == "")
winMgr->unsetSelectedSpell();
} }
if (mUpdatePlayer) if (mUpdatePlayer)

View file

@ -296,7 +296,7 @@ namespace MWMechanics
// add this edge to openset, lowest cost goes to the front // add this edge to openset, lowest cost goes to the front
// TODO: if this causes performance problems a hash table may help // TODO: if this causes performance problems a hash table may help
std::list<int>::iterator it = openset.begin(); std::list<int>::iterator it = openset.begin();
for(it = openset.begin(); it!= openset.end(); it++) for(it = openset.begin(); it!= openset.end(); ++it)
{ {
if(fScore[*it] > fScore[dest]) if(fScore[*it] > fScore[dest])
break; break;

View file

@ -401,10 +401,10 @@ namespace MWMechanics
if (!exploded) if (!exploded)
MWBase::Environment::get().getWorld()->explodeSpell(mHitPosition, mTarget, effects, caster, mId, mSourceName); MWBase::Environment::get().getWorld()->explodeSpell(mHitPosition, mTarget, effects, caster, mId, mSourceName);
if (reflectedEffects.mList.size()) if (!reflectedEffects.mList.empty())
inflict(caster, target, reflectedEffects, range, true); inflict(caster, target, reflectedEffects, range, true);
if (appliedLastingEffects.size()) if (!appliedLastingEffects.empty())
target.getClass().getCreatureStats(target).getActiveSpells().addSpell(mId, mStack, appliedLastingEffects, target.getClass().getCreatureStats(target).getActiveSpells().addSpell(mId, mStack, appliedLastingEffects,
mSourceName, caster.getRefData().getHandle()); mSourceName, caster.getRefData().getHandle());

View file

@ -129,7 +129,7 @@ namespace MWMechanics
if (spell->mData.mType == ESM::Spell::ST_Disease) if (spell->mData.mType == ESM::Spell::ST_Disease)
mSpells.erase(iter++); mSpells.erase(iter++);
else else
iter++; ++iter;
} }
} }
@ -143,7 +143,7 @@ namespace MWMechanics
if (spell->mData.mType == ESM::Spell::ST_Blight) if (spell->mData.mType == ESM::Spell::ST_Blight)
mSpells.erase(iter++); mSpells.erase(iter++);
else else
iter++; ++iter;
} }
} }
@ -157,7 +157,7 @@ namespace MWMechanics
if (Misc::StringUtils::ciEqual(spell->mId, "corprus")) if (Misc::StringUtils::ciEqual(spell->mId, "corprus"))
mSpells.erase(iter++); mSpells.erase(iter++);
else else
iter++; ++iter;
} }
} }
@ -171,7 +171,7 @@ namespace MWMechanics
if (spell->mData.mType == ESM::Spell::ST_Curse) if (spell->mData.mType == ESM::Spell::ST_Curse)
mSpells.erase(iter++); mSpells.erase(iter++);
else else
iter++; ++iter;
} }
} }

View file

@ -411,7 +411,7 @@ Ogre::Node *Animation::getNode(const std::string &name)
NifOgre::TextKeyMap::const_iterator Animation::findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname) NifOgre::TextKeyMap::const_iterator Animation::findGroupStart(const NifOgre::TextKeyMap &keys, const std::string &groupname)
{ {
NifOgre::TextKeyMap::const_iterator iter(keys.begin()); NifOgre::TextKeyMap::const_iterator iter(keys.begin());
for(;iter != keys.end();iter++) for(;iter != keys.end();++iter)
{ {
if(iter->second.compare(0, groupname.size(), groupname) == 0 && if(iter->second.compare(0, groupname.size(), groupname) == 0 &&
iter->second.compare(groupname.size(), 2, ": ") == 0) iter->second.compare(groupname.size(), 2, ": ") == 0)
@ -424,7 +424,7 @@ NifOgre::TextKeyMap::const_iterator Animation::findGroupStart(const NifOgre::Tex
bool Animation::hasAnimation(const std::string &anim) bool Animation::hasAnimation(const std::string &anim)
{ {
AnimSourceList::const_iterator iter(mAnimSources.begin()); AnimSourceList::const_iterator iter(mAnimSources.begin());
for(;iter != mAnimSources.end();iter++) for(;iter != mAnimSources.end();++iter)
{ {
const NifOgre::TextKeyMap &keys = (*iter)->mTextKeys; const NifOgre::TextKeyMap &keys = (*iter)->mTextKeys;
if(findGroupStart(keys, anim) != keys.end()) if(findGroupStart(keys, anim) != keys.end())
@ -465,7 +465,7 @@ float Animation::calcAnimVelocity(const NifOgre::TextKeyMap &keys, NifOgre::Node
stoptime = keyiter->first; stoptime = keyiter->first;
break; break;
} }
keyiter++; ++keyiter;
} }
if(stoptime > starttime) if(stoptime > starttime)
@ -585,13 +585,13 @@ bool Animation::reset(AnimState &state, const NifOgre::TextKeyMap &keys, const s
std::string starttag = groupname+": "+start; std::string starttag = groupname+": "+start;
NifOgre::TextKeyMap::const_iterator startkey(groupstart); NifOgre::TextKeyMap::const_iterator startkey(groupstart);
while(startkey != keys.end() && startkey->second != starttag) while(startkey != keys.end() && startkey->second != starttag)
startkey++; ++startkey;
if(startkey == keys.end() && start == "loop start") if(startkey == keys.end() && start == "loop start")
{ {
starttag = groupname+": start"; starttag = groupname+": start";
startkey = groupstart; startkey = groupstart;
while(startkey != keys.end() && startkey->second != starttag) while(startkey != keys.end() && startkey->second != starttag)
startkey++; ++startkey;
} }
if(startkey == keys.end()) if(startkey == keys.end())
return false; return false;
@ -603,7 +603,7 @@ bool Animation::reset(AnimState &state, const NifOgre::TextKeyMap &keys, const s
// The Scrib's idle3 animation has "Idle3: Stop." instead of "Idle3: Stop". // The Scrib's idle3 animation has "Idle3: Stop." instead of "Idle3: Stop".
// Why, just why? :( // Why, just why? :(
&& (stopkey->second.size() < stoptag.size() || stopkey->second.substr(0,stoptag.size()) != stoptag)) && (stopkey->second.size() < stoptag.size() || stopkey->second.substr(0,stoptag.size()) != stoptag))
stopkey++; ++stopkey;
if(stopkey == keys.end()) if(stopkey == keys.end())
return false; return false;
@ -627,7 +627,7 @@ bool Animation::reset(AnimState &state, const NifOgre::TextKeyMap &keys, const s
state.mLoopStartTime = key->first; state.mLoopStartTime = key->first;
else if(key->second == loopstoptag) else if(key->second == loopstoptag)
state.mLoopStopTime = key->first; state.mLoopStopTime = key->first;
key++; ++key;
} }
} }
@ -776,7 +776,7 @@ void Animation::play(const std::string &groupname, int priority, int groups, boo
/* Look in reverse; last-inserted source has priority. */ /* Look in reverse; last-inserted source has priority. */
AnimSourceList::reverse_iterator iter(mAnimSources.rbegin()); AnimSourceList::reverse_iterator iter(mAnimSources.rbegin());
for(;iter != mAnimSources.rend();iter++) for(;iter != mAnimSources.rend();++iter)
{ {
const NifOgre::TextKeyMap &textkeys = (*iter)->mTextKeys; const NifOgre::TextKeyMap &textkeys = (*iter)->mTextKeys;
AnimState state; AnimState state;
@ -795,7 +795,7 @@ void Animation::play(const std::string &groupname, int priority, int groups, boo
while(textkey != textkeys.end() && textkey->first <= state.mTime) while(textkey != textkeys.end() && textkey->first <= state.mTime)
{ {
handleTextKey(state, groupname, textkey); handleTextKey(state, groupname, textkey);
textkey++; ++textkey;
} }
if(state.mTime >= state.mLoopStopTime && state.mLoopCount > 0) if(state.mTime >= state.mLoopStopTime && state.mLoopCount > 0)
@ -810,7 +810,7 @@ void Animation::play(const std::string &groupname, int priority, int groups, boo
while(textkey != textkeys.end() && textkey->first <= state.mTime) while(textkey != textkeys.end() && textkey->first <= state.mTime)
{ {
handleTextKey(state, groupname, textkey); handleTextKey(state, groupname, textkey);
textkey++; ++textkey;
} }
} }
@ -965,7 +965,7 @@ Ogre::Vector3 Animation::runAnimation(float duration)
while(textkey != textkeys.end() && textkey->first <= state.mTime) while(textkey != textkeys.end() && textkey->first <= state.mTime)
{ {
handleTextKey(state, stateiter->first, textkey); handleTextKey(state, stateiter->first, textkey);
textkey++; ++textkey;
} }
if(state.mTime >= state.mLoopStopTime && state.mLoopCount > 0) if(state.mTime >= state.mLoopStopTime && state.mLoopCount > 0)
@ -979,7 +979,7 @@ Ogre::Vector3 Animation::runAnimation(float duration)
while(textkey != textkeys.end() && textkey->first <= state.mTime) while(textkey != textkeys.end() && textkey->first <= state.mTime)
{ {
handleTextKey(state, stateiter->first, textkey); handleTextKey(state, stateiter->first, textkey);
textkey++; ++textkey;
} }
if(state.mTime >= state.mLoopStopTime) if(state.mTime >= state.mLoopStopTime)

View file

@ -106,7 +106,7 @@ ManualObject *Debugging::createPathgridPoints(const ESM::Pathgrid *pathgrid)
uint32 startIndex = 0; uint32 startIndex = 0;
for(ESM::Pathgrid::PointList::const_iterator it = pathgrid->mPoints.begin(); for(ESM::Pathgrid::PointList::const_iterator it = pathgrid->mPoints.begin();
it != pathgrid->mPoints.end(); it != pathgrid->mPoints.end();
it++, startIndex += 6) ++it, startIndex += 6)
{ {
Vector3 pointPos(it->mX, it->mY, it->mZ); Vector3 pointPos(it->mX, it->mY, it->mZ);

View file

@ -240,25 +240,25 @@ Ogre::AxisAlignedBox Objects::getDimensions(MWWorld::CellStore* cell)
void Objects::enableLights() void Objects::enableLights()
{ {
PtrAnimationMap::const_iterator it = mObjects.begin(); PtrAnimationMap::const_iterator it = mObjects.begin();
for(;it != mObjects.end();it++) for(;it != mObjects.end();++it)
it->second->enableLights(true); it->second->enableLights(true);
} }
void Objects::disableLights() void Objects::disableLights()
{ {
PtrAnimationMap::const_iterator it = mObjects.begin(); PtrAnimationMap::const_iterator it = mObjects.begin();
for(;it != mObjects.end();it++) for(;it != mObjects.end();++it)
it->second->enableLights(false); it->second->enableLights(false);
} }
void Objects::update(float dt, Ogre::Camera* camera) void Objects::update(float dt, Ogre::Camera* camera)
{ {
PtrAnimationMap::const_iterator it = mObjects.begin(); PtrAnimationMap::const_iterator it = mObjects.begin();
for(;it != mObjects.end();it++) for(;it != mObjects.end();++it)
it->second->runAnimation(dt); it->second->runAnimation(dt);
it = mObjects.begin(); it = mObjects.begin();
for(;it != mObjects.end();it++) for(;it != mObjects.end();++it)
it->second->preRender(camera); it->second->preRender(camera);
} }

View file

@ -6,14 +6,9 @@
#include <cstdio> #include <cstdio>
#include <cmath> #include <cmath>
#include <OgreRoot.h>
#include <OgreHardwarePixelBuffer.h> #include <OgreHardwarePixelBuffer.h>
#include <OgreRenderWindow.h>
#include <OgreTextureManager.h> #include <OgreTextureManager.h>
#include <OgreTechnique.h> #include <OgreStringConverter.h>
#include <OgreRectangle2D.h>
#include <OgreMaterialManager.h>
#include <OgreSceneNode.h>
#include <boost/thread.hpp> #include <boost/thread.hpp>
@ -21,9 +16,6 @@
#include "../mwbase/soundmanager.hpp" #include "../mwbase/soundmanager.hpp"
#include "../mwsound/sound_decoder.hpp" #include "../mwsound/sound_decoder.hpp"
#include "../mwsound/sound.hpp" #include "../mwsound/sound.hpp"
#include "../mwbase/inputmanager.hpp"
#include "renderconst.hpp"
#ifdef _WIN32 #ifdef _WIN32
#include <BaseTsd.h> #include <BaseTsd.h>

View file

@ -97,7 +97,7 @@ namespace MWScript
return mScripts.size(); return mScripts.size();
} }
void GlobalScripts::write (ESM::ESMWriter& writer) const void GlobalScripts::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
{ {
for (std::map<std::string, std::pair<bool, Locals> >::const_iterator iter (mScripts.begin()); for (std::map<std::string, std::pair<bool, Locals> >::const_iterator iter (mScripts.begin());
iter!=mScripts.end(); ++iter) iter!=mScripts.end(); ++iter)
@ -113,6 +113,7 @@ namespace MWScript
writer.startRecord (ESM::REC_GSCR); writer.startRecord (ESM::REC_GSCR);
script.save (writer); script.save (writer);
writer.endRecord (ESM::REC_GSCR); writer.endRecord (ESM::REC_GSCR);
progress.increaseProgress();
} }
} }

View file

@ -14,6 +14,11 @@ namespace ESM
class ESMReader; class ESMReader;
} }
namespace Loading
{
class Listener;
}
namespace MWWorld namespace MWWorld
{ {
struct ESMStore; struct ESMStore;
@ -46,7 +51,7 @@ namespace MWScript
int countSavedGameRecords() const; int countSavedGameRecords() const;
void write (ESM::ESMWriter& writer) const; void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, int32_t type); bool readRecord (ESM::ESMReader& reader, int32_t type);
///< Records for variables that do not exist are dropped silently. ///< Records for variables that do not exist are dropped silently.

View file

@ -442,7 +442,7 @@ namespace MWSound
{ {
snditer->first->setFadeout(duration); snditer->first->setFadeout(duration);
} }
snditer++; ++snditer;
} }
} }

View file

@ -196,26 +196,36 @@ void MWState::StateManager::saveGame (const std::string& description, const Slot
writer.addMaster (*iter, 0); // not using the size information anyway -> use value of 0 writer.addMaster (*iter, 0); // not using the size information anyway -> use value of 0
writer.setFormat (ESM::Header::CurrentFormat); writer.setFormat (ESM::Header::CurrentFormat);
writer.setRecordCount ( int recordCount = 1 // saved game header
1 // saved game header
+MWBase::Environment::get().getJournal()->countSavedGameRecords() +MWBase::Environment::get().getJournal()->countSavedGameRecords()
+MWBase::Environment::get().getWorld()->countSavedGameRecords() +MWBase::Environment::get().getWorld()->countSavedGameRecords()
+MWBase::Environment::get().getScriptManager()->getGlobalScripts().countSavedGameRecords() +MWBase::Environment::get().getScriptManager()->getGlobalScripts().countSavedGameRecords()
+MWBase::Environment::get().getDialogueManager()->countSavedGameRecords() +MWBase::Environment::get().getDialogueManager()->countSavedGameRecords()
+1 // global map +1; // global map
); writer.setRecordCount (recordCount);
writer.save (stream); writer.save (stream);
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
listener.setProgressRange(recordCount);
listener.setLabel("#{sNotifyMessage4}");
Loading::ScopedLoad load(&listener);
writer.startRecord (ESM::REC_SAVE); writer.startRecord (ESM::REC_SAVE);
slot->mProfile.save (writer); slot->mProfile.save (writer);
writer.endRecord (ESM::REC_SAVE); writer.endRecord (ESM::REC_SAVE);
listener.increaseProgress();
MWBase::Environment::get().getJournal()->write (writer); MWBase::Environment::get().getJournal()->write (writer, listener);
MWBase::Environment::get().getDialogueManager()->write (writer); MWBase::Environment::get().getDialogueManager()->write (writer, listener);
MWBase::Environment::get().getWorld()->write (writer); MWBase::Environment::get().getWorld()->write (writer, listener);
MWBase::Environment::get().getScriptManager()->getGlobalScripts().write (writer); MWBase::Environment::get().getScriptManager()->getGlobalScripts().write (writer, listener);
MWBase::Environment::get().getWindowManager()->write(writer); MWBase::Environment::get().getWindowManager()->write(writer, listener);
// Ensure we have written the number of records that was estimated
if (writer.getRecordCount() != recordCount+1) // 1 extra for TES3 record
std::cerr << "Warning: number of written savegame records does not match. Estimated: " << recordCount+1 << ", written: " << writer.getRecordCount() << std::endl;
writer.close(); writer.close();
@ -261,6 +271,13 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
std::map<int, int> contentFileMap = buildContentFileIndexMap (reader); std::map<int, int> contentFileMap = buildContentFileIndexMap (reader);
Loading::Listener& listener = *MWBase::Environment::get().getWindowManager()->getLoadingScreen();
listener.setProgressRange(reader.getRecordCount());
listener.setLabel("#{sLoadingMessage14}");
Loading::ScopedLoad load(&listener);
while (reader.hasMoreRecs()) while (reader.hasMoreRecs())
{ {
ESM::NAME n = reader.getRecName(); ESM::NAME n = reader.getRecName();
@ -318,6 +335,7 @@ void MWState::StateManager::loadGame (const Character *character, const Slot *sl
/// \todo log error /// \todo log error
reader.skipRecord(); reader.skipRecord();
} }
listener.increaseProgress();
} }
mCharacterManager.setCurrentCharacter(character); mCharacterManager.setCurrentCharacter(character);

View file

@ -3,7 +3,6 @@
#include "../mwbase/environment.hpp" #include "../mwbase/environment.hpp"
#include "../mwbase/windowmanager.hpp" #include "../mwbase/windowmanager.hpp"
#include "../mwbase/world.hpp" #include "../mwbase/world.hpp"
#include "../mwbase/world.hpp"
#include "../mwworld/player.hpp" #include "../mwworld/player.hpp"
@ -24,7 +23,12 @@ namespace MWWorld
void ActionRead::executeImp (const MWWorld::Ptr& actor) { void ActionRead::executeImp (const MWWorld::Ptr& actor) {
if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()) { //Ensure we're not in combat //Ensure we're not in combat
if(MWBase::Environment::get().getWorld()->getPlayer().isInCombat()
// Reading in combat is still allowed if the scroll/book is not in the player inventory yet
// (since otherwise, there would be no way to pick it up)
&& getTarget().getContainerStore() == &actor.getClass().getContainerStore(actor)
) {
MWBase::Environment::get().getWindowManager()->messageBox("#{sInventoryMessage4}"); MWBase::Environment::get().getWindowManager()->messageBox("#{sInventoryMessage4}");
return; return;
} }

View file

@ -20,7 +20,7 @@ namespace MWWorld
//find any NPC that is following the actor and teleport him too //find any NPC that is following the actor and teleport him too
std::list<MWWorld::Ptr> followers = MWBase::Environment::get().getMechanicsManager()->getActorsFollowing(actor); std::list<MWWorld::Ptr> followers = MWBase::Environment::get().getMechanicsManager()->getActorsFollowing(actor);
for(std::list<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();it++) for(std::list<MWWorld::Ptr>::iterator it = followers.begin();it != followers.end();++it)
{ {
std::cout << "teleporting someone!" << (*it).getCellRef().mRefID; std::cout << "teleporting someone!" << (*it).getCellRef().mRefID;
executeImp(*it); executeImp(*it);

View file

@ -277,17 +277,23 @@ int MWWorld::Cells::countSavedGameRecords() const
return count; return count;
} }
void MWWorld::Cells::write (ESM::ESMWriter& writer) const void MWWorld::Cells::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
{ {
for (std::map<std::pair<int, int>, CellStore>::iterator iter (mExteriors.begin()); for (std::map<std::pair<int, int>, CellStore>::iterator iter (mExteriors.begin());
iter!=mExteriors.end(); ++iter) iter!=mExteriors.end(); ++iter)
if (iter->second.hasState()) if (iter->second.hasState())
{
writeCell (writer, iter->second); writeCell (writer, iter->second);
progress.increaseProgress(); // Assumes that each cell writes one record
}
for (std::map<std::string, CellStore>::iterator iter (mInteriors.begin()); for (std::map<std::string, CellStore>::iterator iter (mInteriors.begin());
iter!=mInteriors.end(); ++iter) iter!=mInteriors.end(); ++iter)
if (iter->second.hasState()) if (iter->second.hasState())
{
writeCell (writer, iter->second); writeCell (writer, iter->second);
progress.increaseProgress(); // Assumes that each cell writes one record
}
} }
bool MWWorld::Cells::readRecord (ESM::ESMReader& reader, int32_t type, bool MWWorld::Cells::readRecord (ESM::ESMReader& reader, int32_t type,

View file

@ -15,6 +15,11 @@ namespace ESM
struct Cell; struct Cell;
} }
namespace Loading
{
class Listener;
}
namespace MWWorld namespace MWWorld
{ {
class ESMStore; class ESMStore;
@ -69,7 +74,7 @@ namespace MWWorld
int countSavedGameRecords() const; int countSavedGameRecords() const;
void write (ESM::ESMWriter& writer) const; void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, int32_t type, bool readRecord (ESM::ESMReader& reader, int32_t type,
const std::map<int, int>& contentFileMap); const std::map<int, int>& contentFileMap);

View file

@ -433,7 +433,6 @@ namespace MWWorld
while(mCell->getNextRef(esm[index], ref, deleted)) while(mCell->getNextRef(esm[index], ref, deleted))
{ {
// Don't load reference if it was moved to a different cell. // Don't load reference if it was moved to a different cell.
std::string lowerCase = Misc::StringUtils::lowerCase(ref.mRefID);
ESM::MovedCellRefTracker::const_iterator iter = ESM::MovedCellRefTracker::const_iterator iter =
std::find(mCell->mMovedRefs.begin(), mCell->mMovedRefs.end(), ref.mRefNum); std::find(mCell->mMovedRefs.begin(), mCell->mMovedRefs.end(), ref.mRefNum);
if (iter != mCell->mMovedRefs.end()) { if (iter != mCell->mMovedRefs.end()) {

View file

@ -187,11 +187,38 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add(const std::string &
MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr, int count, const Ptr& actorPtr, bool setOwner) MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr, int count, const Ptr& actorPtr, bool setOwner)
{ {
MWWorld::ContainerStoreIterator it = addImp(itemPtr, count); Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
MWWorld::ContainerStoreIterator it = end();
if (setOwner && actorPtr.getClass().isActor())
{
// HACK: Set owner on the original item, then reset it after we have copied it
// If we set the owner on the copied item, it would not stack correctly...
std::string oldOwner = itemPtr.getCellRef().mOwner;
if (actorPtr == player)
{
// No point in setting owner to the player - NPCs will not respect this anyway
// Additionally, setting it to "player" would make those items not stack with items that don't have an owner
itemPtr.getCellRef().mOwner = "";
}
else
itemPtr.getCellRef().mOwner = actorPtr.getCellRef().mRefID;
it = addImp(itemPtr, count);
itemPtr.getCellRef().mOwner = oldOwner;
}
else
{
it = addImp(itemPtr, count);
}
// The copy of the original item we just made
MWWorld::Ptr item = *it; MWWorld::Ptr item = *it;
// we may have copied an item from the world, so reset a few things first // we may have copied an item from the world, so reset a few things first
item.getRefData().setBaseNode(NULL); item.getRefData().setBaseNode(NULL); // Especially important, otherwise scripts on the item could think that it's actually in a cell
item.getCellRef().mPos.rot[0] = 0; item.getCellRef().mPos.rot[0] = 0;
item.getCellRef().mPos.rot[1] = 0; item.getCellRef().mPos.rot[1] = 0;
item.getCellRef().mPos.rot[2] = 0; item.getCellRef().mPos.rot[2] = 0;
@ -199,16 +226,11 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr
item.getCellRef().mPos.pos[1] = 0; item.getCellRef().mPos.pos[1] = 0;
item.getCellRef().mPos.pos[2] = 0; item.getCellRef().mPos.pos[2] = 0;
if (setOwner && actorPtr.getClass().isActor())
item.getCellRef().mOwner = actorPtr.getCellRef().mRefID;
std::string script = MWWorld::Class::get(item).getScript(item); std::string script = MWWorld::Class::get(item).getScript(item);
if(script != "") if(script != "")
{ {
CellStore *cell; CellStore *cell;
Ptr player = MWBase::Environment::get().getWorld ()->getPlayerPtr();
if(&(MWWorld::Class::get (player).getContainerStore (player)) == this) if(&(MWWorld::Class::get (player).getContainerStore (player)) == this)
{ {
cell = 0; // Items in player's inventory have cell set to 0, so their scripts will never be removed cell = 0; // Items in player's inventory have cell set to 0, so their scripts will never be removed

View file

@ -153,17 +153,17 @@ void ESMStore::setUp()
+mWeapons.getDynamicSize(); +mWeapons.getDynamicSize();
} }
void ESMStore::write (ESM::ESMWriter& writer) const void ESMStore::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
{ {
mPotions.write (writer); mPotions.write (writer, progress);
mArmors.write (writer); mArmors.write (writer, progress);
mBooks.write (writer); mBooks.write (writer, progress);
mClasses.write (writer); mClasses.write (writer, progress);
mClothes.write (writer); mClothes.write (writer, progress);
mEnchants.write (writer); mEnchants.write (writer, progress);
mSpells.write (writer); mSpells.write (writer, progress);
mWeapons.write (writer); mWeapons.write (writer, progress);
mNpcs.write (writer); mNpcs.write (writer, progress);
} }
bool ESMStore::readRecord (ESM::ESMReader& reader, int32_t type) bool ESMStore::readRecord (ESM::ESMReader& reader, int32_t type)

View file

@ -212,7 +212,7 @@ namespace MWWorld
int countSavedGameRecords() const; int countSavedGameRecords() const;
void write (ESM::ESMWriter& writer) const; void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, int32_t type); bool readRecord (ESM::ESMReader& reader, int32_t type);
///< \return Known type? ///< \return Known type?

View file

@ -77,7 +77,7 @@ namespace MWWorld
return mVariables.size(); return mVariables.size();
} }
void Globals::write (ESM::ESMWriter& writer) const void Globals::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
{ {
for (Collection::const_iterator iter (mVariables.begin()); iter!=mVariables.end(); ++iter) for (Collection::const_iterator iter (mVariables.begin()); iter!=mVariables.end(); ++iter)
{ {
@ -85,6 +85,7 @@ namespace MWWorld
writer.writeHNString ("NAME", iter->first); writer.writeHNString ("NAME", iter->first);
iter->second.write (writer, ESM::Variant::Format_Global); iter->second.write (writer, ESM::Variant::Format_Global);
writer.endRecord (ESM::REC_GLOB); writer.endRecord (ESM::REC_GLOB);
progress.increaseProgress();
} }
} }

View file

@ -16,6 +16,11 @@ namespace ESM
class ESMReader; class ESMReader;
} }
namespace Loading
{
class Listener;
}
namespace MWWorld namespace MWWorld
{ {
class ESMStore; class ESMStore;
@ -46,7 +51,7 @@ namespace MWWorld
int countSavedGameRecords() const; int countSavedGameRecords() const;
void write (ESM::ESMWriter& writer) const; void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, int32_t type); bool readRecord (ESM::ESMReader& reader, int32_t type);
///< Records for variables that do not exist are dropped silently. ///< Records for variables that do not exist are dropped silently.

View file

@ -671,7 +671,7 @@ namespace MWWorld
void PhysicsSystem::queueObjectMovement(const Ptr &ptr, const Ogre::Vector3 &movement) void PhysicsSystem::queueObjectMovement(const Ptr &ptr, const Ogre::Vector3 &movement)
{ {
PtrVelocityList::iterator iter = mMovementQueue.begin(); PtrVelocityList::iterator iter = mMovementQueue.begin();
for(;iter != mMovementQueue.end();iter++) for(;iter != mMovementQueue.end();++iter)
{ {
if(iter->first == ptr) if(iter->first == ptr)
{ {
@ -692,7 +692,7 @@ namespace MWWorld
{ {
const MWBase::World *world = MWBase::Environment::get().getWorld(); const MWBase::World *world = MWBase::Environment::get().getWorld();
PtrVelocityList::iterator iter = mMovementQueue.begin(); PtrVelocityList::iterator iter = mMovementQueue.begin();
for(;iter != mMovementQueue.end();iter++) for(;iter != mMovementQueue.end();++iter)
{ {
float waterlevel = -std::numeric_limits<float>::max(); float waterlevel = -std::numeric_limits<float>::max();
const ESM::Cell *cell = iter->first.getCell()->getCell(); const ESM::Cell *cell = iter->first.getCell()->getCell();

View file

@ -151,7 +151,7 @@ namespace MWWorld
break; break;
} }
} }
if (neighbors.size() == 0) if (neighbors.empty())
MWBase::Environment::get().getWindowManager()->setSneakVisibility(true); MWBase::Environment::get().getWindowManager()->setSneakVisibility(true);
} }
} }
@ -215,7 +215,7 @@ namespace MWWorld
mTeleported = false; mTeleported = false;
} }
void Player::write (ESM::ESMWriter& writer) const void Player::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
{ {
ESM::Player player; ESM::Player player;
@ -245,6 +245,8 @@ namespace MWWorld
writer.startRecord (ESM::REC_PLAY); writer.startRecord (ESM::REC_PLAY);
player.save (writer); player.save (writer);
writer.endRecord (ESM::REC_PLAY); writer.endRecord (ESM::REC_PLAY);
progress.increaseProgress();
} }
bool Player::readRecord (ESM::ESMReader& reader, int32_t type) bool Player::readRecord (ESM::ESMReader& reader, int32_t type)

View file

@ -21,6 +21,11 @@ namespace MWBase
class Ptr; class Ptr;
} }
namespace Loading
{
class Listener;
}
namespace MWWorld namespace MWWorld
{ {
class CellStore; class CellStore;
@ -95,7 +100,7 @@ namespace MWWorld
void clear(); void clear();
void write (ESM::ESMWriter& writer) const; void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
bool readRecord (ESM::ESMReader& reader, int32_t type); bool readRecord (ESM::ESMReader& reader, int32_t type);

View file

@ -8,6 +8,8 @@
#include <components/esm/esmwriter.hpp> #include <components/esm/esmwriter.hpp>
#include <components/loadinglistener/loadinglistener.hpp>
#include "recordcmp.hpp" #include "recordcmp.hpp"
namespace MWWorld namespace MWWorld
@ -313,7 +315,7 @@ namespace MWWorld
return erase(item.mId); return erase(item.mId);
} }
void write (ESM::ESMWriter& writer) const void write (ESM::ESMWriter& writer, Loading::Listener& progress) const
{ {
for (typename Dynamic::const_iterator iter (mDynamic.begin()); iter!=mDynamic.end(); for (typename Dynamic::const_iterator iter (mDynamic.begin()); iter!=mDynamic.end();
++iter) ++iter)
@ -322,6 +324,7 @@ namespace MWWorld
writer.writeHNString ("NAME", iter->second.mId); writer.writeHNString ("NAME", iter->second.mId);
iter->second.save (writer); iter->second.save (writer);
writer.endRecord (T::sRecordId); writer.endRecord (T::sRecordId);
progress.increaseProgress();
} }
} }

View file

@ -686,7 +686,7 @@ bool WeatherManager::isDark() const
return exterior && (mHour < mSunriseTime || mHour > mNightStart - 1); return exterior && (mHour < mSunriseTime || mHour > mNightStart - 1);
} }
void WeatherManager::write(ESM::ESMWriter& writer) void WeatherManager::write(ESM::ESMWriter& writer, Loading::Listener& progress)
{ {
ESM::WeatherState state; ESM::WeatherState state;
state.mHour = mHour; state.mHour = mHour;
@ -701,6 +701,7 @@ void WeatherManager::write(ESM::ESMWriter& writer)
writer.startRecord(ESM::REC_WTHR); writer.startRecord(ESM::REC_WTHR);
state.save(writer); state.save(writer);
writer.endRecord(ESM::REC_WTHR); writer.endRecord(ESM::REC_WTHR);
progress.increaseProgress();
} }
bool WeatherManager::readRecord(ESM::ESMReader& reader, int32_t type) bool WeatherManager::readRecord(ESM::ESMReader& reader, int32_t type)

View file

@ -18,6 +18,11 @@ namespace MWRender
class RenderingManager; class RenderingManager;
} }
namespace Loading
{
class Listener;
}
namespace MWWorld namespace MWWorld
{ {
class Fallback; class Fallback;
@ -158,7 +163,7 @@ namespace MWWorld
/// @see World::isDark /// @see World::isDark
bool isDark() const; bool isDark() const;
void write(ESM::ESMWriter& writer); void write(ESM::ESMWriter& writer, Loading::Listener& progress);
bool readRecord(ESM::ESMReader& reader, int32_t type); bool readRecord(ESM::ESMReader& reader, int32_t type);

View file

@ -268,19 +268,20 @@ namespace MWWorld
int World::countSavedGameRecords() const int World::countSavedGameRecords() const
{ {
return return
mStore.countSavedGameRecords() mCells.countSavedGameRecords()
+mStore.countSavedGameRecords()
+mGlobalVariables.countSavedGameRecords() +mGlobalVariables.countSavedGameRecords()
+1 // player record +1 // player record
+mCells.countSavedGameRecords(); +1; // weather record
} }
void World::write (ESM::ESMWriter& writer) const void World::write (ESM::ESMWriter& writer, Loading::Listener& progress) const
{ {
mStore.write (writer); mCells.write (writer, progress);
mGlobalVariables.write (writer); mStore.write (writer, progress);
mCells.write (writer); mGlobalVariables.write (writer, progress);
mPlayer->write (writer); mPlayer->write (writer, progress);
mWeatherManager->write (writer); mWeatherManager->write (writer, progress);
} }
void World::readRecord (ESM::ESMReader& reader, int32_t type, void World::readRecord (ESM::ESMReader& reader, int32_t type,

View file

@ -194,7 +194,7 @@ namespace MWWorld
virtual int countSavedGameRecords() const; virtual int countSavedGameRecords() const;
virtual void write (ESM::ESMWriter& writer) const; virtual void write (ESM::ESMWriter& writer, Loading::Listener& progress) const;
virtual void readRecord (ESM::ESMReader& reader, int32_t type, virtual void readRecord (ESM::ESMReader& reader, int32_t type,
const std::map<int, int>& contentFileMap); const std::map<int, int>& contentFileMap);

View file

@ -31,6 +31,7 @@ public:
*************************************************************************/ *************************************************************************/
int getVer() const { return mHeader.mData.version; } int getVer() const { return mHeader.mData.version; }
int getRecordCount() const { return mHeader.mData.records; }
float getFVer() const { if(mHeader.mData.version == VER_12) return 1.2; else return 1.3; } float getFVer() const { if(mHeader.mData.version == VER_12) return 1.2; else return 1.3; }
const std::string getAuthor() const { return mHeader.mData.author.toString(); } const std::string getAuthor() const { return mHeader.mData.author.toString(); }
const std::string getDesc() const { return mHeader.mData.desc.toString(); } const std::string getDesc() const { return mHeader.mData.desc.toString(); }

View file

@ -29,7 +29,12 @@ class ESMWriter
void setEncoder(ToUTF8::Utf8Encoder *encoding); void setEncoder(ToUTF8::Utf8Encoder *encoding);
void setAuthor(const std::string& author); void setAuthor(const std::string& author);
void setDescription(const std::string& desc); void setDescription(const std::string& desc);
// Set the record count for writing it in the file header
void setRecordCount (int count); void setRecordCount (int count);
// Counts how many records we have actually written.
// It is a good idea to compare this with the value you wrote into the header (setRecordCount)
// It should be the record count you set + 1 (1 additional record for the TES3 header)
int getRecordCount() { return mRecordCount; }
void setFormat (int format); void setFormat (int format);
void clearMaster(); void clearMaster();

View file

@ -28,7 +28,7 @@ namespace ESM
int type; // 0=esp, 1=esm, 32=ess (unused) int type; // 0=esp, 1=esm, 32=ess (unused)
NAME32 author; // Author's name NAME32 author; // Author's name
NAME256 desc; // File description NAME256 desc; // File description
int records; // Number of records? Not used. int records; // Number of records
}; };
// Defines another files (esm or esp) that this file depends upon. // Defines another files (esm or esp) that this file depends upon.

View file

@ -17,7 +17,7 @@ namespace Loading
virtual void setProgressRange (size_t range) = 0; virtual void setProgressRange (size_t range) = 0;
virtual void setProgress (size_t value) = 0; virtual void setProgress (size_t value) = 0;
virtual void increaseProgress (size_t increase) = 0; virtual void increaseProgress (size_t increase = 1) = 0;
/// Indicate the scene is now ready to be shown /// Indicate the scene is now ready to be shown
virtual void removeWallpaper() = 0; virtual void removeWallpaper() = 0;

View file

@ -4,7 +4,6 @@ set(SDIR ${CMAKE_CURRENT_SOURCE_DIR})
set(DDIR ${OpenMW_BINARY_DIR}/resources/mygui) set(DDIR ${OpenMW_BINARY_DIR}/resources/mygui)
set(MYGUI_FILES set(MYGUI_FILES
bigbars.png
black.png black.png
core.skin core.skin
core.xml core.xml
@ -81,7 +80,6 @@ set(MYGUI_FILES
openmw_companion_window.layout openmw_companion_window.layout
openmw_savegame_dialog.layout openmw_savegame_dialog.layout
openmw_recharge_dialog.layout openmw_recharge_dialog.layout
smallbars.png
DejaVuLGCSansMono.ttf DejaVuLGCSansMono.ttf
markers.png markers.png
../launcher/images/openmw.png ../launcher/images/openmw.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 387 B

View file

@ -13,7 +13,7 @@
<Property key="MultiLine" value="true"/> <Property key="MultiLine" value="true"/>
</Widget> </Widget>
<Widget type="HBox" position="0 89 272 24" align="Right Bottom"> <Widget type="HBox" position="0 89 284 24" align="Right Bottom">
<Widget type="Widget"> <Widget type="Widget">
<UserString key="HStretch" value="true"/> <UserString key="HStretch" value="true"/>
</Widget> </Widget>

View file

@ -42,7 +42,7 @@
<Property key="TextShadow" value="true"/> <Property key="TextShadow" value="true"/>
<Property key="TextShadowColour" value="0 0 0"/> <Property key="TextShadowColour" value="0 0 0"/>
</Widget> </Widget>
<Widget type="ProgressBar" skin="MW_Progress_Loading" position="12 36 196 8" align="Center Top" name="Drowning"> <Widget type="ProgressBar" skin="MW_Progress_LightBlue" position="12 36 196 8" align="Center Top" name="Drowning">
<Property key="NeedMouse" value="false"/> <Property key="NeedMouse" value="false"/>
</Widget> </Widget>
<Widget type="Widget" skin="MW_Progress_Drowning" position="14 38 192 4" align="Center Top" name="Flash"/> <Widget type="Widget" skin="MW_Progress_Drowning" position="14 38 192 4" align="Center Top" name="Flash"/>

View file

@ -19,24 +19,28 @@
</Skin> </Skin>
<!-- Progress bar track, various colors --> <!-- Progress bar track, various colors -->
<Skin name="MW_BarTrack_Red" size="4 8" texture="smallbars.png" > <Skin name="MW_BarTrack_Red" size="4 8" texture="textures\menu_bar_gray.dds" >
<BasisSkin type="MainSkin" offset="0 0 4 8" align="Stretch"> <Property key="Colour" value="0.8274 0.2431 0.129"/>
<State name="normal" offset="0 0 4 8"/> <BasisSkin type="MainSkin" offset="0 0 16 8" align="Stretch">
<State name="normal" offset="0 0 16 8"/>
</BasisSkin> </BasisSkin>
</Skin> </Skin>
<Skin name="MW_BarTrack_Green" size="4 8" texture="smallbars.png" > <Skin name="MW_BarTrack_Green" size="4 8" texture="textures\menu_bar_gray.dds" >
<BasisSkin type="MainSkin" offset="0 0 4 8" align="Stretch"> <Property key="Colour" value="0 0.6823 0.2745"/>
<State name="normal" offset="0 16 4 8"/> <BasisSkin type="MainSkin" offset="0 0 16 8" align="Stretch">
<State name="normal" offset="0 0 16 8"/>
</BasisSkin> </BasisSkin>
</Skin> </Skin>
<Skin name="MW_BarTrack_Blue" size="4 8" texture="smallbars.png" > <Skin name="MW_BarTrack_Blue" size="4 8" texture="textures\menu_bar_gray.dds" >
<BasisSkin type="MainSkin" offset="0 0 4 8" align="Stretch"> <Property key="Colour" value="0.2470 0.3176 0.7411"/>
<State name="normal" offset="0 8 4 8"/> <BasisSkin type="MainSkin" offset="0 0 16 8" align="Stretch">
<State name="normal" offset="0 0 16 8"/>
</BasisSkin> </BasisSkin>
</Skin> </Skin>
<Skin name="MW_BarTrack_Yellow" size="4 8" texture="smallbars.png" > <Skin name="MW_BarTrack_Yellow" size="4 8" texture="textures\menu_bar_gray.dds" >
<BasisSkin type="MainSkin" offset="0 0 4 8" align="Stretch"> <Property key="Colour" value="1 1 0"/>
<State name="normal" offset="0 32 4 8"/> <BasisSkin type="MainSkin" offset="0 0 16 8" align="Stretch">
<State name="normal" offset="0 0 16 8"/>
</BasisSkin> </BasisSkin>
</Skin> </Skin>

View file

@ -4,13 +4,13 @@
<!-- The entire screen --> <!-- The entire screen -->
<Widget type="Widget" layer="LoadingScreen" position="0 0 300 300" name="_Main"> <Widget type="Widget" layer="LoadingScreen" position="0 0 300 300" name="_Main">
<Widget type="Widget" skin="HUD_Box" position="0 200 300 60" align="Bottom HCenter"> <Widget type="Widget" skin="HUD_Box" position="0 245 300 48" align="Bottom HCenter">
<Widget type="TextBox" skin="SandText" position="20 12 260 20" name="LoadingText"> <Widget type="TextBox" skin="SandText" position="20 8 260 18" name="LoadingText">
<Property key="TextAlign" value="Center"/> <Property key="TextAlign" value="Center"/>
</Widget> </Widget>
<Widget type="ScrollBar" skin="MW_ProgressScroll_Loading" position="20 36 260 8" name="ProgressBar"> <Widget type="ScrollBar" skin="MW_ProgressScroll_Loading" position="20 30 260 6" name="ProgressBar">
</Widget> </Widget>
</Widget> </Widget>

View file

@ -2,36 +2,50 @@
<MyGUI type="Skin"> <MyGUI type="Skin">
<!-- Progress bar track, various colors --> <!-- Progress bar track, various colors -->
<Skin name="MW_BigTrack_Red" size="2 14" texture="bigbars.png" > <Skin name="MW_Track_Red" size="16 16" texture="textures\menu_bar_gray.dds" >
<BasisSkin type="MainSkin" offset="0 0 2 14" align="Stretch"> <Property key="Colour" value="0.8274 0.2431 0.129"/>
<State name="normal" offset="0 0 2 14"/> <BasisSkin type="MainSkin" offset="0 0 16 16" align="Stretch">
<State name="normal" offset="0 0 16 16"/>
</BasisSkin> </BasisSkin>
</Skin> </Skin>
<Skin name="MW_BigTrack_Blue" size="2 14" texture="bigbars.png" > <Skin name="MW_Track_Blue" size="2 14" texture="textures\menu_bar_gray.dds" >
<BasisSkin type="MainSkin" offset="0 0 2 14" align="Stretch"> <Property key="Colour" value="0.2470 0.3176 0.7411"/>
<State name="normal" offset="0 14 2 14"/> <BasisSkin type="MainSkin" offset="0 0 16 16" align="Stretch">
<State name="normal" offset="0 0 16 16"/>
</BasisSkin> </BasisSkin>
</Skin> </Skin>
<Skin name="MW_BigTrack_Green" size="2 14" texture="bigbars.png" > <Skin name="MW_Track_Green" size="2 14" texture="textures\menu_bar_gray.dds" >
<BasisSkin type="MainSkin" offset="0 0 2 14" align="Stretch"> <Property key="Colour" value="0 0.6823 0.2745"/>
<State name="normal" offset="0 28 2 14"/> <BasisSkin type="MainSkin" offset="0 0 16 16" align="Stretch">
<State name="normal" offset="0 0 16 16"/>
</BasisSkin> </BasisSkin>
</Skin> </Skin>
<Skin name="MW_BigTrack_Progress_Red_Small" size="2 6" texture="smallbars.png" > <!-- Lighter variants (only uses top half of the gradient) -->
<BasisSkin type="MainSkin" offset="0 0 2 6" align="Stretch"> <Skin name="MW_BigTrack_Progress_Red_Small" size="16 8" texture="textures\menu_bar_gray.dds" >
<State name="normal" offset="0 0 2 8"/> <Property key="Colour" value="1 0 0"/>
<BasisSkin type="MainSkin" offset="0 0 16 8" align="Stretch">
<State name="normal" offset="0 0 16 8"/>
</BasisSkin> </BasisSkin>
</Skin> </Skin>
<Skin name="MW_BigTrack_Progress_Blue_Small" size="2 6" texture="smallbars.png" > <Skin name="MW_BigTrack_Progress_Blue_Small" size="16 8" texture="textures\menu_bar_gray.dds" >
<BasisSkin type="MainSkin" offset="0 0 2 6" align="Stretch"> <Property key="Colour" value="0.3 0.3 1"/>
<State name="normal" offset="0 26 2 6"/> <BasisSkin type="MainSkin" offset="0 0 16 8" align="Stretch">
<State name="normal" offset="0 0 16 8"/>
</BasisSkin>
</Skin>
<Skin name="MW_BigTrack_Progress_Green_Small" size="16 8" texture="textures\menu_bar_gray.dds" >
<Property key="Colour" value="0.298 0.784 0.780"/>
<BasisSkin type="MainSkin" offset="0 0 16 8" align="Stretch">
<State name="normal" offset="0 0 16 8"/>
</BasisSkin> </BasisSkin>
</Skin> </Skin>
<Skin name="ProgressText" size="16 16"> <Skin name="ProgressText" size="16 16">
<Property key="FontName" value="Default"/> <Property key="FontName" value="Default"/>
<Property key="TextAlign" value="Center"/> <Property key="TextAlign" value="Top HCenter"/>
<Property key="TextColour" value="0.75 0.6 0.35"/> <Property key="TextColour" value="0.75 0.6 0.35"/>
<Property key="TextShadow" value="true"/>
<BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch"/> <BasisSkin type="SimpleText" offset="0 0 16 16" align="Stretch"/>
</Skin> </Skin>
@ -39,7 +53,7 @@
<!-- Main energy bar widget definitions. There's one for each color.--> <!-- Main energy bar widget definitions. There's one for each color.-->
<Skin name="MW_Progress_Red" size="64 12"> <Skin name="MW_Progress_Red" size="64 12">
<Property key="TrackSkin" value="MW_BigTrack_Red"/> <Property key="TrackSkin" value="MW_Track_Red"/>
<Property key="TrackWidth" value="1"/> <Property key="TrackWidth" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/> <Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
@ -47,7 +61,7 @@
</Skin> </Skin>
<Skin name="MW_Progress_Green" size="64 12"> <Skin name="MW_Progress_Green" size="64 12">
<Property key="TrackSkin" value="MW_BigTrack_Green"/> <Property key="TrackSkin" value="MW_Track_Green"/>
<Property key="TrackWidth" value="1"/> <Property key="TrackWidth" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/> <Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
@ -55,14 +69,14 @@
</Skin> </Skin>
<Skin name="MW_Progress_Blue" size="64 12"> <Skin name="MW_Progress_Blue" size="64 12">
<Property key="TrackSkin" value="MW_BigTrack_Blue"/> <Property key="TrackSkin" value="MW_Track_Blue"/>
<Property key="TrackWidth" value="1"/> <Property key="TrackWidth" value="1"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/> <Child type="Widget" skin="MW_Box" offset="0 0 64 12" align="Stretch"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 8" align="Stretch" name="Client"/> <Child type="Widget" skin="BlackBG" offset="2 2 60 8" align="Stretch" name="Client"/>
</Skin> </Skin>
<Skin name="MW_Progress_Loading" size="64 6"> <Skin name="MW_Progress_LightBlue" size="64 6">
<Property key="TrackSkin" value="MW_BigTrack_Progress_Blue_Small"/> <Property key="TrackSkin" value="MW_BigTrack_Progress_Blue_Small"/>
<Property key="TrackWidth" value="1"/> <Property key="TrackWidth" value="1"/>
@ -82,7 +96,7 @@
<Property key="MoveToClick" value="false"/> <Property key="MoveToClick" value="false"/>
<Child type="Widget" skin="BlackBG" offset="2 2 60 2" align="Stretch" name="Client"/> <Child type="Widget" skin="BlackBG" offset="2 2 60 2" align="Stretch" name="Client"/>
<Child type="Button" skin="MW_BigTrack_Progress_Blue_Small" offset="0 0 1 6" align="Left VStretch" name="Track"/> <Child type="Button" skin="MW_BigTrack_Progress_Green_Small" offset="0 0 1 6" align="Left VStretch" name="Track"/>
<Child type="Widget" skin="MW_Box" offset="0 0 64 6" align="Stretch"/> <Child type="Widget" skin="MW_Box" offset="0 0 64 6" align="Stretch"/>
</Skin> </Skin>

View file

@ -3,10 +3,10 @@
<MyGUI type="Layout"> <MyGUI type="Layout">
<Widget type="Window" skin="MW_Window_NoCaption" layer="Windows" position="0 0 400 426" name="_Main"> <Widget type="Window" skin="MW_Window_NoCaption" layer="Windows" position="0 0 400 426" name="_Main">
<Property key="MinSize" value="400 496"/> <Property key="MinSize" value="400 446"/>
<Property key="MaxSize" value="400 496"/> <Property key="MaxSize" value="400 446"/>
<Widget type="TabControl" skin="TabControl" position="8 8 368 410" align="Left Top" name="SettingsTab"> <Widget type="TabControl" skin="TabControl" position="8 8 368 360" align="Left Top" name="SettingsTab">
<Property key="ButtonAutoWidth" value="true"/> <Property key="ButtonAutoWidth" value="true"/>
<Widget type="TabItem" skin="" position="4 28 360 312"> <Widget type="TabItem" skin="" position="4 28 360 312">

View file

@ -147,29 +147,29 @@
<Skin name="MW_ChargeBar" size="204 18"> <Skin name="MW_ChargeBar" size="204 18">
<Child type="ProgressBar" skin="MW_Progress_Red" offset="0 0 204 18" align="Right Top Stretch" name="Bar"/> <Child type="ProgressBar" skin="MW_Progress_Red" offset="0 0 204 18" align="Right Top Stretch" name="Bar"/>
<Child type="TextBox" skin="SandTextC" offset="0 0 204 18" align="Right Top Stretch" name="BarText"/> <Child type="TextBox" skin="ProgressText" offset="0 0 204 18" align="Right Top Stretch" name="BarText"/>
</Skin> </Skin>
<Skin name="MW_ChargeBar_Blue" size="204 18"> <Skin name="MW_ChargeBar_Blue" size="204 18">
<Child type="ProgressBar" skin="MW_Progress_Blue" offset="0 0 204 18" align="Right Top Stretch" name="Bar"/> <Child type="ProgressBar" skin="MW_Progress_Blue" offset="0 0 204 18" align="Right Top Stretch" name="Bar"/>
<Child type="TextBox" skin="SandTextC" offset="0 0 204 18" align="Right Top Stretch" name="BarText"/> <Child type="TextBox" skin="ProgressText" offset="0 2 204 18" align="Right Top Stretch" name="BarText"/>
</Skin> </Skin>
<Skin name="MW_DynamicStat_Red" size="204 18"> <Skin name="MW_DynamicStat_Red" size="204 18">
<Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/> <Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/>
<Child type="ProgressBar" skin="MW_Progress_Red" offset="74 0 130 18" align="Right Top" name="Bar"/> <Child type="ProgressBar" skin="MW_Progress_Red" offset="74 0 130 18" align="Right Top" name="Bar"/>
<Child type="TextBox" skin="SandTextC" offset="74 0 130 18" align="Right Top" name="BarText"/> <Child type="TextBox" skin="ProgressText" offset="74 0 130 18" align="Right Top" name="BarText"/>
</Skin> </Skin>
<Skin name="MW_DynamicStat_Blue" size="204 18"> <Skin name="MW_DynamicStat_Blue" size="204 18">
<Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/> <Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/>
<Child type="ProgressBar" skin="MW_Progress_Blue" offset="74 0 130 18" align="Right Top" name="Bar"/> <Child type="ProgressBar" skin="MW_Progress_Blue" offset="74 0 130 18" align="Right Top" name="Bar"/>
<Child type="TextBox" skin="SandTextC" offset="74 0 130 18" align="Right Top" name="BarText"/> <Child type="TextBox" skin="ProgressText" offset="74 0 130 18" align="Right Top" name="BarText"/>
</Skin> </Skin>
<Skin name="MW_DynamicStat_Green" size="204 18"> <Skin name="MW_DynamicStat_Green" size="204 18">
<Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/> <Child type="TextBox" skin="SandText" offset="0 0 100 18" align="Left Top" name="Text"/>
<Child type="ProgressBar" skin="MW_Progress_Green" offset="74 0 130 18" align="Right Top" name="Bar"/> <Child type="ProgressBar" skin="MW_Progress_Green" offset="74 0 130 18" align="Right Top" name="Bar"/>
<Child type="TextBox" skin="SandTextC" offset="74 0 130 18" align="Right Top" name="BarText"/> <Child type="TextBox" skin="ProgressText" offset="74 0 130 18" align="Right Top" name="BarText"/>
</Skin> </Skin>
</MyGUI> </MyGUI>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB