Merge pull request #390 from OpenMW/master

Add OpenMW commits up to 28 Feb 2018
0.6.3
David Cernat 7 years ago committed by GitHub
commit 37b349c2f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -41,6 +41,7 @@ Programmers
Cory F. Cohen (cfcohen) Cory F. Cohen (cfcohen)
Cris Mihalache (Mirceam) Cris Mihalache (Mirceam)
crussell187 crussell187
DanielVukelich
darkf darkf
devnexen devnexen
Dieho Dieho

@ -35,9 +35,11 @@ bool Launcher::AdvancedPage::loadSettings()
loadSettingBool(grabCursorCheckBox, "grab cursor", "Input"); loadSettingBool(grabCursorCheckBox, "grab cursor", "Input");
loadSettingBool(toggleSneakCheckBox, "toggle sneak", "Input"); loadSettingBool(toggleSneakCheckBox, "toggle sneak", "Input");
// Other Settings // Saves Settings
loadSettingBool(timePlayedCheckbox, "timeplayed", "Saves"); loadSettingBool(timePlayedCheckbox, "timeplayed", "Saves");
maximumQuicksavesComboBox->setValue(mEngineSettings.getInt("max quicksaves", "Saves"));
// Other Settings
QString screenshotFormatString = QString::fromStdString(mEngineSettings.getString("screenshot format", "General")).toUpper(); QString screenshotFormatString = QString::fromStdString(mEngineSettings.getString("screenshot format", "General")).toUpper();
if (screenshotFormatComboBox->findText(screenshotFormatString) == -1) if (screenshotFormatComboBox->findText(screenshotFormatString) == -1)
screenshotFormatComboBox->addItem(screenshotFormatString); screenshotFormatComboBox->addItem(screenshotFormatString);
@ -69,9 +71,11 @@ void Launcher::AdvancedPage::saveSettings()
saveSettingBool(grabCursorCheckBox, "grab cursor", "Input"); saveSettingBool(grabCursorCheckBox, "grab cursor", "Input");
saveSettingBool(toggleSneakCheckBox, "toggle sneak", "Input"); saveSettingBool(toggleSneakCheckBox, "toggle sneak", "Input");
// Other Settings // Saves Settings
saveSettingBool(timePlayedCheckbox, "timeplayed", "Saves"); saveSettingBool(timePlayedCheckbox, "timeplayed", "Saves");
mEngineSettings.setInt("max quicksaves", "Saves", maximumQuicksavesComboBox->value());
// Other Settings
std::string screenshotFormatString = screenshotFormatComboBox->currentText().toLower().toStdString(); std::string screenshotFormatString = screenshotFormatComboBox->currentText().toLower().toStdString();
if (screenshotFormatString != mEngineSettings.getString("screenshot format", "General")) if (screenshotFormatString != mEngineSettings.getString("screenshot format", "General"))
mEngineSettings.setString("screenshot format", "General", screenshotFormatString); mEngineSettings.setString("screenshot format", "General", screenshotFormatString);

@ -89,7 +89,7 @@ add_openmw_dir (mwmechanics
) )
add_openmw_dir (mwstate add_openmw_dir (mwstate
statemanagerimp charactermanager character statemanagerimp charactermanager character quicksavemanager
) )
add_openmw_dir (mwbase add_openmw_dir (mwbase
@ -258,4 +258,3 @@ endif (MSVC)
if (WIN32) if (WIN32)
INSTALL(TARGETS tes3mp RUNTIME DESTINATION ".") INSTALL(TARGETS tes3mp RUNTIME DESTINATION ".")
endif (WIN32) endif (WIN32)

@ -0,0 +1,38 @@
#include "quicksavemanager.hpp"
MWState::QuickSaveManager::QuickSaveManager(std::string &saveName, unsigned int maxSaves)
{
this->mSaveName = saveName;
this->mMaxSaves = maxSaves;
this->mOldestSlotVisited = NULL;
this->mSlotsVisited = 0;
}
void MWState::QuickSaveManager::visitSave(const Slot *saveSlot)
{
if(mSaveName == saveSlot->mProfile.mDescription)
{
++mSlotsVisited;
if(isOldestSave(saveSlot))
mOldestSlotVisited = saveSlot;
}
}
bool MWState::QuickSaveManager::isOldestSave(const Slot *compare)
{
if(mOldestSlotVisited == NULL)
return true;
return (compare->mTimeStamp <= mOldestSlotVisited->mTimeStamp);
}
bool MWState::QuickSaveManager::shouldCreateNewSlot()
{
return (mSlotsVisited < mMaxSaves);
}
const MWState::Slot *MWState::QuickSaveManager::getNextQuickSaveSlot()
{
if(shouldCreateNewSlot())
return NULL;
return mOldestSlotVisited;
}

@ -0,0 +1,35 @@
#ifndef GAME_STATE_QUICKSAVEMANAGER_H
#define GAME_STATE_QUICKSAVEMANAGER_H
#include <string>
#include "character.hpp"
#include "../mwbase/statemanager.hpp"
namespace MWState{
class QuickSaveManager{
std::string mSaveName;
unsigned int mMaxSaves;
unsigned int mSlotsVisited;
const Slot *mOldestSlotVisited;
private:
bool shouldCreateNewSlot();
bool isOldestSave(const Slot *compare);
public:
QuickSaveManager(std::string &saveName, unsigned int maxSaves);
///< A utility class to manage multiple quicksave slots
///
/// \param saveName The name of the save ("QuickSave", "AutoSave", etc)
/// \param maxSaves The maximum number of save slots to create before recycling old ones
void visitSave(const Slot *saveSlot);
///< Visits the given \a slot \a
const Slot *getNextQuickSaveSlot();
///< Get the slot that the next quicksave should use.
///
///\return Either the oldest quicksave slot visited, or NULL if a new slot can be made
};
}
#endif

@ -37,6 +37,8 @@
#include "../mwscript/globalscripts.hpp" #include "../mwscript/globalscripts.hpp"
#include "quicksavemanager.hpp"
void MWState::StateManager::cleanup (bool force) void MWState::StateManager::cleanup (bool force)
{ {
if (mState!=State_NoGame || force) if (mState!=State_NoGame || force)
@ -324,20 +326,25 @@ void MWState::StateManager::quickSave (std::string name)
return; return;
} }
const Slot* slot = NULL; int maxSaves = Settings::Manager::getInt("max quicksaves", "Saves");
if(maxSaves < 1)
maxSaves = 1;
Character* currentCharacter = getCurrentCharacter(); //Get current character Character* currentCharacter = getCurrentCharacter(); //Get current character
QuickSaveManager saveFinder = QuickSaveManager(name, maxSaves);
//Find quicksave slot
if (currentCharacter) if (currentCharacter)
{ {
for (Character::SlotIterator it = currentCharacter->begin(); it != currentCharacter->end(); ++it) for (Character::SlotIterator it = currentCharacter->begin(); it != currentCharacter->end(); ++it)
{ {
if (it->mProfile.mDescription == name) //Visiting slots allows the quicksave finder to find the oldest quicksave
slot = &*it; saveFinder.visitSave(&*it);
} }
} }
saveGame(name, slot); //Once all the saves have been visited, the save finder can tell us which
//one to replace (or create)
saveGame(name, saveFinder.getNextQuickSaveSlot());
} }
void MWState::StateManager::loadGame(const std::string& filepath) void MWState::StateManager::loadGame(const std::string& filepath)

@ -60,16 +60,32 @@ copyright = u'2017, OpenMW Team'
# The short X.Y version. # The short X.Y version.
# The full version, including alpha/beta/rc tags. # The full version, including alpha/beta/rc tags.
release = version = "UNRELEASED"
def get_openmw_version(haystack):
needle = 'OPENMW_VERSION_MAJOR'
line_counter = 0
for hay in haystack:
if needle in str(hay):
break
line_counter += 1
version = '.'.join([haystack[line_counter][1][1].contents,
haystack[line_counter+1][1][1].contents,
haystack[line_counter+2][1][1].contents])
return version
try: try:
from parse_cmake import parsing from parse_cmake import parsing
cmake_raw = open(project_root+'/CMakeLists.txt', 'r').read() cmake_raw = open(project_root+'/CMakeLists.txt', 'r').read()
cmake_data = parsing.parse(cmake_raw) cmake_data = parsing.parse(cmake_raw)
release = version = '.'.join([cmake_data[24][1][1].contents, release = version = get_openmw_version(cmake_data)
cmake_data[25][1][1].contents,
cmake_data[26][1][1].contents]) except Exception as ex:
except ImportError: print("WARNING: Version will be set to '{0}' because: '{1}'.".format(release, str(ex)))
release = "UNRELEASED" import traceback; traceback.print_exc()
print("WARNING: Unable to import parse_cmake, version will be set to: {0}.".format(release))
# The language for content autogenerated by Sphinx. Refer to documentation # The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages. # for a list of supported languages.

@ -5,7 +5,7 @@ character
--------- ---------
:Type: string :Type: string
:Range: :Range:
:Default: "" :Default: ""
This contains the default character for the Load Game menu and is automatically updated when a different character is selected. This contains the default character for the Load Game menu and is automatically updated when a different character is selected.
@ -32,3 +32,14 @@ This setting determines whether the amount of the time the player has spent play
for each saved game in the Load menu. Currently, the counter includes time spent in menus, including the pause menu, but does not include time spent with the game window minimized. for each saved game in the Load menu. Currently, the counter includes time spent in menus, including the pause menu, but does not include time spent with the game window minimized.
This setting can only be configured by editing the settings configuration file. This setting can only be configured by editing the settings configuration file.
max quicksaves
----------
:Type: integer
:Range: >0
:Default: 1
This setting determines how many quicksave and autosave slots you can have at a time. If greater than 1, quicksaves will be sequentially created each time you quicksave. Once the maximum number of quicksaves has been reached, the oldest quicksave will be recycled the next time you perform a quicksave.
This setting can only be configured by editing the settings configuration file.

@ -7,7 +7,7 @@
# significance of each setting, interaction with other settings, hard # significance of each setting, interaction with other settings, hard
# limits on value ranges and more information in general, please read # limits on value ranges and more information in general, please read
# the detailed documentation at: # the detailed documentation at:
# #
# http://openmw.readthedocs.io/en/master/reference/modding/settings/index.html # http://openmw.readthedocs.io/en/master/reference/modding/settings/index.html
# #
@ -291,6 +291,10 @@ autosave = true
# Display the time played on each save file in the load menu. # Display the time played on each save file in the load menu.
timeplayed = false timeplayed = false
# The maximum number of quick (or auto) save slots to have.
# If all slots are used, the oldest save is reused
max quicksaves = 1
[Sound] [Sound]
# Name of audio device file. Blank means use the default device. # Name of audio device file. Blank means use the default device.
@ -379,7 +383,7 @@ reflect actors = false
# Overrides the value in '[Camera] small feature culling pixel size' specifically for water reflection/refraction textures. # Overrides the value in '[Camera] small feature culling pixel size' specifically for water reflection/refraction textures.
small feature culling pixel size = 20.0 small feature culling pixel size = 20.0
# By what factor water downscales objects. Only works with water shader and refractions on. # By what factor water downscales objects. Only works with water shader and refractions on.
refraction scale = 1.0 refraction scale = 1.0
[Windows] [Windows]

@ -6,7 +6,7 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>434</width> <width>671</width>
<height>373</height> <height>373</height>
</rect> </rect>
</property> </property>
@ -27,9 +27,9 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>-187</y>
<width>393</width> <width>630</width>
<height>437</height> <height>510</height>
</rect> </rect>
</property> </property>
<layout class="QVBoxLayout" name="scrollAreaVerticalLayout"> <layout class="QVBoxLayout" name="scrollAreaVerticalLayout">
@ -139,6 +139,9 @@
</item> </item>
<item> <item>
<widget class="QComboBox" name="showOwnedComboBox"> <widget class="QComboBox" name="showOwnedComboBox">
<property name="currentIndex">
<number>1</number>
</property>
<item> <item>
<property name="text"> <property name="text">
<string>Off</string> <string>Off</string>
@ -207,11 +210,11 @@
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QGroupBox" name="otherGroup"> <widget class="QGroupBox" name="savesGroup">
<property name="title"> <property name="title">
<string>Other</string> <string>Saves</string>
</property> </property>
<layout class="QVBoxLayout" name="otherGroupVerticalLayout"> <layout class="QVBoxLayout" name="savesGroupVerticalLayout">
<item> <item>
<widget class="QCheckBox" name="timePlayedCheckbox"> <widget class="QCheckBox" name="timePlayedCheckbox">
<property name="toolTip"> <property name="toolTip">
@ -222,12 +225,59 @@
</property> </property>
</widget> </widget>
</item> </item>
<item alignment="Qt::AlignLeft">
<widget class="QWidget" name="maximumQuicksavesGroup" native="true">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This setting determines how many quicksave and autosave slots you can have at a time. If greater than 1, quicksaves will be sequentially created each time you quicksave. Once the maximum number of quicksaves has been reached, the oldest quicksave will be recycled the next time you perform a quicksave.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<layout class="QHBoxLayout" name="maximumQuicksavesLayout">
<property name="spacing">
<number>-1</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="maximumQuicksavesLabel">
<property name="text">
<string>Maximum Quicksaves</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="maximumQuicksavesComboBox">
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="otherGroup">
<property name="title">
<string>Other</string>
</property>
<layout class="QVBoxLayout" name="otherGroupVerticalLayout">
<item alignment="Qt::AlignLeft"> <item alignment="Qt::AlignLeft">
<widget class="QWidget" name="screenshotFormatGroup" native="true"> <widget class="QWidget" name="screenshotFormatGroup" native="true">
<property name="toolTip"> <property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Specify the format for screen shots taken by pressing the screen shot key (bound to F12 by default). This setting should be the file extension commonly associated with the desired format. The formats supported will be determined at compilation, but “jpg”, “png”, and “tga” should be allowed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Specify the format for screen shots taken by pressing the screen shot key (bound to F12 by default). This setting should be the file extension commonly associated with the desired format. The formats supported will be determined at compilation, but “jpg”, “png”, and “tga” should be allowed.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="screenshotFormatLayout">
<property name="spacing"> <property name="spacing">
<number>-1</number> <number>-1</number>
</property> </property>

Loading…
Cancel
Save