forked from teamnwah/openmw-tes3coop
Merge branch 'master' into NonTableFields
Conflicts: apps/opencs/model/tools/tools.cpp apps/opencs/model/world/columnbase.cpp apps/opencs/model/world/commands.cpp apps/opencs/model/world/commands.hpp apps/opencs/model/world/idtable.hpp apps/opencs/model/world/refidadapter.cpp apps/opencs/model/world/refidadapter.hpp apps/opencs/view/world/dialoguesubview.hpp
This commit is contained in:
commit
5eefcd862f
359 changed files with 2231 additions and 1682 deletions
|
@ -39,6 +39,7 @@ Programmers
|
|||
Eli2
|
||||
Emanuel Guével (potatoesmaster)
|
||||
eroen
|
||||
escondida
|
||||
Evgeniy Mineev (sandstranger)
|
||||
Fil Krynicki (filkry)
|
||||
Gašper Sedej
|
||||
|
|
39
CHANGELOG.md
39
CHANGELOG.md
|
@ -1,3 +1,42 @@
|
|||
0.35.1
|
||||
------
|
||||
|
||||
Bug #781: incorrect trajectory of the sun
|
||||
Bug #1079: Wrong starting position in "Character Stuff Wonderland"
|
||||
Bug #1443: Repetitive taking of a stolen object is repetitively considered as a crime
|
||||
Bug #1533: Divine Intervention goes to the wrong place.
|
||||
Bug #1714: No visual indicator for time passed during training
|
||||
Bug #1916: Telekinesis does not allow safe opening of traps
|
||||
Bug #2227: Editor: addon file name inconsistency
|
||||
Bug #2271: Player can melee enemies from water with impunity
|
||||
Bug #2275: Objects with bigger scale move further using Move script
|
||||
Bug #2285: Aryon's Dominator enchantment does not work properly
|
||||
Bug #2290: No punishment for stealing gold from owned containers
|
||||
Bug #2328: Launcher does not respond to Ctrl+C
|
||||
Bug #2334: Drag-and-drop on a content file in the launcher creates duplicate items
|
||||
Bug #2338: Arrows reclaimed from corpses do not stack sometimes
|
||||
Bug #2344: Launcher - Settings importer running correctly?
|
||||
Bug #2346: Launcher - Importing plugins into content list screws up the load order
|
||||
Bug #2348: Mod: H.E.L.L.U.V.A. Handy Holdables does not appear in the content list
|
||||
Bug #2353: Detect Animal detects dead creatures
|
||||
Bug #2354: Cmake does not respect LIB_SUFFIX
|
||||
Bug #2356: Active magic set inactive when switching magic items
|
||||
Bug #2361: ERROR: ESM Error: Previous record contains unread bytes
|
||||
Bug #2382: Switching spells with "next spell" or "previous spell" while holding shift promps delete spell dialog
|
||||
Bug #2388: Regression: Can't toggle map on/off
|
||||
Bug #2392: MOD Shrines - Restore Health and Cancel Options adds 100 health points
|
||||
Bug #2394: List of Data Files tab in openmw-laucher needs to show all content files.
|
||||
Bug #2402: Editor: skills saved incorrectly
|
||||
Bug #2408: Equipping a constant effect Restore Health/Magicka/Fatigue item will permanently boost the stat it's restoring
|
||||
Bug #2415: It is now possible to fall off the prison ship into the water when starting a new game
|
||||
Bug #2419: MOD MCA crash to desktop
|
||||
Bug #2420: Game crashes when character enters a certain area
|
||||
Bug #2421: infinite loop when using cycle weapon without having a weapon
|
||||
Feature #2221: Cannot dress dead NPCs
|
||||
Feature #2349: Check CMake sets correct MSVC compiler settings for release build.
|
||||
Feature #2397: Set default values for global mandatory records.
|
||||
Feature #2412: Basic joystick support
|
||||
|
||||
0.35.0
|
||||
------
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ message(STATUS "Configuring OpenMW...")
|
|||
|
||||
set(OPENMW_VERSION_MAJOR 0)
|
||||
set(OPENMW_VERSION_MINOR 35)
|
||||
set(OPENMW_VERSION_RELEASE 0)
|
||||
set(OPENMW_VERSION_RELEASE 1)
|
||||
|
||||
set(OPENMW_VERSION_COMMITHASH "")
|
||||
set(OPENMW_VERSION_TAGHASH "")
|
||||
|
@ -97,43 +97,6 @@ endif()
|
|||
# We probably support older versions than this.
|
||||
cmake_minimum_required(VERSION 2.6)
|
||||
|
||||
# source directory: libs
|
||||
|
||||
set(LIBS_DIR ${CMAKE_SOURCE_DIR}/libs)
|
||||
|
||||
set(OENGINE_OGRE
|
||||
${LIBS_DIR}/openengine/ogre/renderer.cpp
|
||||
${LIBS_DIR}/openengine/ogre/lights.cpp
|
||||
${LIBS_DIR}/openengine/ogre/selectionbuffer.cpp
|
||||
${LIBS_DIR}/openengine/ogre/imagerotate.cpp
|
||||
)
|
||||
|
||||
set(OENGINE_GUI
|
||||
${LIBS_DIR}/openengine/gui/loglistener.cpp
|
||||
${LIBS_DIR}/openengine/gui/manager.cpp
|
||||
${LIBS_DIR}/openengine/gui/layout.cpp
|
||||
)
|
||||
|
||||
set(OENGINE_BULLET
|
||||
${LIBS_DIR}/openengine/bullet/BtOgre.cpp
|
||||
${LIBS_DIR}/openengine/bullet/BtOgreExtras.h
|
||||
${LIBS_DIR}/openengine/bullet/BtOgreGP.h
|
||||
${LIBS_DIR}/openengine/bullet/BtOgrePG.h
|
||||
${LIBS_DIR}/openengine/bullet/physic.cpp
|
||||
${LIBS_DIR}/openengine/bullet/physic.hpp
|
||||
${LIBS_DIR}/openengine/bullet/BulletShapeLoader.cpp
|
||||
${LIBS_DIR}/openengine/bullet/BulletShapeLoader.h
|
||||
${LIBS_DIR}/openengine/bullet/trace.cpp
|
||||
${LIBS_DIR}/openengine/bullet/trace.h
|
||||
|
||||
)
|
||||
|
||||
set(OENGINE_ALL ${OENGINE_OGRE} ${OENGINE_GUI} ${OENGINE_BULLET})
|
||||
source_group(libs\\openengine FILES ${OENGINE_ALL})
|
||||
|
||||
set(OPENMW_LIBS ${OENGINE_ALL})
|
||||
set(OPENMW_LIBS_HEADER)
|
||||
|
||||
# Sound setup
|
||||
set(FFmpeg_FIND_COMPONENTS AVCODEC AVFORMAT AVUTIL SWSCALE SWRESAMPLE AVRESAMPLE)
|
||||
unset(FFMPEG_LIBRARIES CACHE)
|
||||
|
@ -266,7 +229,8 @@ endif ()
|
|||
endif(WIN32)
|
||||
endif(OGRE_STATIC)
|
||||
|
||||
include_directories("."
|
||||
include_directories("." ${LIBS_DIR}
|
||||
SYSTEM
|
||||
${OGRE_INCLUDE_DIR} ${OGRE_INCLUDE_DIR}/Ogre ${OGRE_INCLUDE_DIR}/OGRE ${OGRE_INCLUDE_DIRS} ${OGRE_PLUGIN_INCLUDE_DIRS}
|
||||
${OGRE_INCLUDE_DIR}/Overlay ${OGRE_Overlay_INCLUDE_DIR}
|
||||
${SDL2_INCLUDE_DIR}
|
||||
|
@ -275,7 +239,7 @@ include_directories("."
|
|||
${MYGUI_INCLUDE_DIRS}
|
||||
${MYGUI_PLATFORM_INCLUDE_DIRS}
|
||||
${OPENAL_INCLUDE_DIR}
|
||||
${LIBS_DIR}
|
||||
${BULLET_INCLUDE_DIRS}
|
||||
)
|
||||
|
||||
link_directories(${SDL2_LIBRARY_DIRS} ${Boost_LIBRARY_DIRS} ${OGRE_LIB_DIR} ${MYGUI_LIB_DIR})
|
||||
|
@ -385,22 +349,22 @@ if (NOT WIN32 AND NOT APPLE)
|
|||
"${OpenMW_BINARY_DIR}/openmw-cs.desktop")
|
||||
endif()
|
||||
|
||||
# Compiler settings
|
||||
if (CMAKE_COMPILER_IS_GNUCC)
|
||||
set_property(GLOBAL APPEND_STRING PROPERTY COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-reorder -std=c++98 -pedantic -Wno-long-long")
|
||||
# CXX Compiler settings
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-unused-parameter -Wno-reorder -std=c++98 -pedantic -Wno-long-long")
|
||||
|
||||
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
||||
OUTPUT_VARIABLE GCC_VERSION)
|
||||
if ("${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
||||
set_property(GLOBAL APPEND_STRING PROPERTY COMPILE_FLAGS "-Wno-unused-but-set-parameter")
|
||||
endif("${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL GNU AND "${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-but-set-parameter")
|
||||
endif(CMAKE_CXX_COMPILER_ID STREQUAL GNU AND "${GCC_VERSION}" VERSION_GREATER 4.6 OR "${GCC_VERSION}" VERSION_EQUAL 4.6)
|
||||
elseif (MSVC)
|
||||
# Enable link-time code generation globally for all linking
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG")
|
||||
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /LTCG")
|
||||
set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG")
|
||||
endif (CMAKE_COMPILER_IS_GNUCC)
|
||||
endif (CMAKE_CXX_COMPILER_ID STREQUAL GNU OR CMAKE_CXX_COMPILER_ID STREQUAL Clang)
|
||||
|
||||
IF(NOT WIN32 AND NOT APPLE)
|
||||
# Linux building
|
||||
|
@ -572,6 +536,10 @@ if(WIN32)
|
|||
include(CPack)
|
||||
endif(WIN32)
|
||||
|
||||
# Libs
|
||||
include_directories(libs)
|
||||
add_subdirectory(libs/openengine)
|
||||
|
||||
# Extern
|
||||
add_subdirectory (extern/shiny)
|
||||
add_subdirectory (extern/ogre-ffmpeg-videoplayer)
|
||||
|
@ -705,7 +673,7 @@ if (WIN32)
|
|||
set(WARNINGS "${WARNINGS} /wd${d}")
|
||||
endforeach(d)
|
||||
|
||||
set_property(GLOBAL APPEND_STRING PROPERTY COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNINGS} ${MT_BUILD}")
|
||||
|
||||
# boost::wave has a few issues with signed / unsigned conversions, so we suppress those here
|
||||
set(SHINY_WARNINGS "${WARNINGS} /wd4245")
|
||||
|
|
|
@ -6,7 +6,7 @@ OpenMW
|
|||
OpenMW is an attempt at recreating the engine for the popular role-playing game
|
||||
Morrowind by Bethesda Softworks. You need to own and install the original game for OpenMW to work.
|
||||
|
||||
* Version: 0.35.0
|
||||
* Version: 0.35.1
|
||||
* License: GPL (see docs/license/GPL3.txt for more information)
|
||||
* Website: http://www.openmw.org
|
||||
* IRC: #openmw on irc.freenode.net
|
||||
|
|
|
@ -460,7 +460,7 @@ int clone(Arguments& info)
|
|||
for (Stats::iterator it = stats.begin(); it != stats.end(); ++it)
|
||||
{
|
||||
name.val = it->first;
|
||||
float amount = it->second;
|
||||
int amount = it->second;
|
||||
std::cout << std::setw(digitCount) << amount << " " << name.toString() << " ";
|
||||
|
||||
if (++i % 3 == 0)
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
#include <boost/format.hpp>
|
||||
|
||||
namespace
|
||||
{
|
||||
|
||||
void printAIPackage(ESM::AIPackage p)
|
||||
{
|
||||
std::cout << " AI Type: " << aiTypeLabel(p.mType)
|
||||
|
@ -16,7 +19,7 @@ void printAIPackage(ESM::AIPackage p)
|
|||
std::cout << " Duration: " << p.mWander.mDuration << std::endl;
|
||||
std::cout << " Time of Day: " << (int)p.mWander.mTimeOfDay << std::endl;
|
||||
if (p.mWander.mShouldRepeat != 1)
|
||||
std::cout << " Should repeat: " << (bool)p.mWander.mShouldRepeat << std::endl;
|
||||
std::cout << " Should repeat: " << (bool)(p.mWander.mShouldRepeat != 0) << std::endl;
|
||||
|
||||
std::cout << " Idle: ";
|
||||
for (int i = 0; i != 8; i++)
|
||||
|
@ -149,6 +152,26 @@ void printEffectList(ESM::EffectList effects)
|
|||
}
|
||||
}
|
||||
|
||||
void printTransport(const std::vector<ESM::Transport::Dest>& transport)
|
||||
{
|
||||
std::vector<ESM::Transport::Dest>::const_iterator dit;
|
||||
for (dit = transport.begin(); dit != transport.end(); ++dit)
|
||||
{
|
||||
std::cout << " Destination Position: "
|
||||
<< boost::format("%12.3f") % dit->mPos.pos[0] << ","
|
||||
<< boost::format("%12.3f") % dit->mPos.pos[1] << ","
|
||||
<< boost::format("%12.3f") % dit->mPos.pos[2] << ")" << std::endl;
|
||||
std::cout << " Destination Rotation: "
|
||||
<< boost::format("%9.6f") % dit->mPos.rot[0] << ","
|
||||
<< boost::format("%9.6f") % dit->mPos.rot[1] << ","
|
||||
<< boost::format("%9.6f") % dit->mPos.rot[2] << ")" << std::endl;
|
||||
if (dit->mCellName != "")
|
||||
std::cout << " Destination Cell: " << dit->mCellName << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
namespace EsmTool {
|
||||
|
||||
RecordBase *
|
||||
|
@ -631,6 +654,8 @@ void Record<ESM::Creature>::print()
|
|||
for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit)
|
||||
std::cout << " Spell: " << *sit << std::endl;
|
||||
|
||||
printTransport(mData.getTransport());
|
||||
|
||||
std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl;
|
||||
std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl;
|
||||
std::cout << " AI Fight:" << (int)mData.mAiData.mFight << std::endl;
|
||||
|
@ -1042,20 +1067,7 @@ void Record<ESM::NPC>::print()
|
|||
for (sit = mData.mSpells.mList.begin(); sit != mData.mSpells.mList.end(); ++sit)
|
||||
std::cout << " Spell: " << *sit << std::endl;
|
||||
|
||||
std::vector<ESM::NPC::Dest>::iterator dit;
|
||||
for (dit = mData.mTransport.begin(); dit != mData.mTransport.end(); ++dit)
|
||||
{
|
||||
std::cout << " Destination Position: "
|
||||
<< boost::format("%12.3f") % dit->mPos.pos[0] << ","
|
||||
<< boost::format("%12.3f") % dit->mPos.pos[1] << ","
|
||||
<< boost::format("%12.3f") % dit->mPos.pos[2] << ")" << std::endl;
|
||||
std::cout << " Destination Rotation: "
|
||||
<< boost::format("%9.6f") % dit->mPos.rot[0] << ","
|
||||
<< boost::format("%9.6f") % dit->mPos.rot[1] << ","
|
||||
<< boost::format("%9.6f") % dit->mPos.rot[2] << ")" << std::endl;
|
||||
if (dit->mCellName != "")
|
||||
std::cout << " Destination Cell: " << dit->mCellName << std::endl;
|
||||
}
|
||||
printTransport(mData.getTransport());
|
||||
|
||||
std::cout << " Artifical Intelligence: " << mData.mHasAI << std::endl;
|
||||
std::cout << " AI Hello:" << (int)mData.mAiData.mHello << std::endl;
|
||||
|
|
|
@ -23,18 +23,18 @@ namespace ESSImport
|
|||
}
|
||||
for (int i=0; i<8; ++i)
|
||||
{
|
||||
cStats.mAttributes[i].mBase = acdt.mAttributes[i][1];
|
||||
cStats.mAttributes[i].mMod = acdt.mAttributes[i][0];
|
||||
cStats.mAttributes[i].mCurrent = acdt.mAttributes[i][0];
|
||||
cStats.mAttributes[i].mBase = static_cast<int>(acdt.mAttributes[i][1]);
|
||||
cStats.mAttributes[i].mMod = static_cast<int>(acdt.mAttributes[i][0]);
|
||||
cStats.mAttributes[i].mCurrent = static_cast<int>(acdt.mAttributes[i][0]);
|
||||
}
|
||||
cStats.mGoldPool = acdt.mGoldPool;
|
||||
cStats.mTalkedTo = acdt.mFlags & TalkedToPlayer;
|
||||
cStats.mAttacked = acdt.mFlags & Attacked;
|
||||
cStats.mTalkedTo = (acdt.mFlags & TalkedToPlayer) != 0;
|
||||
cStats.mAttacked = (acdt.mFlags & Attacked) != 0;
|
||||
}
|
||||
|
||||
void convertACSC (const ACSC& acsc, ESM::CreatureStats& cStats)
|
||||
{
|
||||
cStats.mDead = acsc.mFlags & Dead;
|
||||
cStats.mDead = (acsc.mFlags & Dead) != 0;
|
||||
}
|
||||
|
||||
void convertNpcData (const ActorData& actorData, ESM::NpcStats& npcStats)
|
||||
|
|
|
@ -553,7 +553,7 @@ public:
|
|||
ESM::WeatherState weather;
|
||||
weather.mCurrentWeather = toString(mGame.mGMDT.mCurrentWeather);
|
||||
weather.mNextWeather = toString(mGame.mGMDT.mNextWeather);
|
||||
weather.mRemainingTransitionTime = mGame.mGMDT.mWeatherTransition/100.f*(0.015*24*3600);
|
||||
weather.mRemainingTransitionTime = mGame.mGMDT.mWeatherTransition/100.f*(0.015f*24*3600);
|
||||
weather.mHour = mContext->mHour;
|
||||
weather.mWindSpeed = 0.f;
|
||||
weather.mTimePassed = 0.0;
|
||||
|
|
|
@ -43,7 +43,7 @@ namespace ESSImport
|
|||
{
|
||||
unsigned int deleted;
|
||||
esm.getHT(deleted);
|
||||
mDeleted = (deleted >> 24) & 0x2; // the other 3 bytes seem to be uninitialized garbage
|
||||
mDeleted = ((deleted >> 24) & 0x2) != 0; // the other 3 bytes seem to be uninitialized garbage
|
||||
}
|
||||
|
||||
if (esm.isNextSub("MVRF"))
|
||||
|
|
|
@ -110,7 +110,7 @@ int wmain(int argc, wchar_t *wargv[]) {
|
|||
std::cerr << "cfg file does not exist" << std::endl;
|
||||
|
||||
MwIniImporter importer;
|
||||
importer.setVerbose(vm.count("verbose"));
|
||||
importer.setVerbose(vm.count("verbose") != 0);
|
||||
|
||||
// Font encoding settings
|
||||
std::string encoding(vm["encoding"].as<std::string>());
|
||||
|
|
|
@ -5,7 +5,7 @@ set (OPENCS_SRC main.cpp
|
|||
opencs_units (. editor)
|
||||
|
||||
opencs_units (model/doc
|
||||
document operation saving documentmanager loader runner
|
||||
document operation saving documentmanager loader runner operationholder
|
||||
)
|
||||
|
||||
opencs_units_noqt (model/doc
|
||||
|
@ -166,7 +166,8 @@ qt4_wrap_ui(OPENCS_UI_HDR ${OPENCS_UI})
|
|||
qt4_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR_QT})
|
||||
qt4_add_resources(OPENCS_RES_SRC ${OPENCS_RES})
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR} ${BULLET_INCLUDE_DIRS})
|
||||
# for compiled .ui files
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if(APPLE)
|
||||
set (OPENCS_MAC_ICON ${CMAKE_SOURCE_DIR}/files/mac/openmw-cs.icns)
|
||||
|
@ -176,7 +177,6 @@ endif(APPLE)
|
|||
|
||||
add_executable(openmw-cs
|
||||
MACOSX_BUNDLE
|
||||
${OENGINE_BULLET}
|
||||
${OPENCS_SRC}
|
||||
${OPENCS_UI_HDR}
|
||||
${OPENCS_MOC_SRC}
|
||||
|
@ -200,6 +200,7 @@ if(APPLE)
|
|||
endif(APPLE)
|
||||
|
||||
target_link_libraries(openmw-cs
|
||||
${OENGINE_LIBRARY}
|
||||
${OGRE_LIBRARIES}
|
||||
${OGRE_Overlay_LIBRARIES}
|
||||
${OGRE_STATIC_PLUGINS}
|
||||
|
|
|
@ -2254,7 +2254,8 @@ CSMDoc::Document::Document (const Files::ConfigurationManager& configuration,
|
|||
mTools (*this), mResDir(resDir),
|
||||
mProjectPath ((configuration.getUserDataPath() / "projects") /
|
||||
(savePath.filename().string() + ".project")),
|
||||
mSaving (*this, mProjectPath, encoding),
|
||||
mSavingOperation (*this, mProjectPath, encoding),
|
||||
mSaving (&mSavingOperation),
|
||||
mRunner (mProjectPath), mPhysics(boost::shared_ptr<CSVWorld::PhysicsSystem>())
|
||||
{
|
||||
if (mContentFiles.empty())
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "saving.hpp"
|
||||
#include "blacklist.hpp"
|
||||
#include "runner.hpp"
|
||||
#include "operationholder.hpp"
|
||||
|
||||
class QAbstractItemModel;
|
||||
|
||||
|
@ -32,7 +33,7 @@ namespace ESM
|
|||
|
||||
namespace Files
|
||||
{
|
||||
class ConfigurationManager;
|
||||
struct ConfigurationManager;
|
||||
}
|
||||
|
||||
namespace CSMWorld
|
||||
|
@ -59,7 +60,8 @@ namespace CSMDoc
|
|||
CSMWorld::Data mData;
|
||||
CSMTools::Tools mTools;
|
||||
boost::filesystem::path mProjectPath;
|
||||
Saving mSaving;
|
||||
Saving mSavingOperation;
|
||||
OperationHolder mSaving;
|
||||
boost::filesystem::path mResDir;
|
||||
Blacklist mBlacklist;
|
||||
Runner mRunner;
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
|
||||
namespace Files
|
||||
{
|
||||
class ConfigurationManager;
|
||||
struct ConfigurationManager;
|
||||
}
|
||||
|
||||
namespace CSMDoc
|
||||
|
|
|
@ -29,9 +29,9 @@ void CSMDoc::Operation::prepareStages()
|
|||
CSMDoc::Operation::Operation (int type, bool ordered, bool finalAlways)
|
||||
: mType (type), mStages(std::vector<std::pair<Stage *, int> >()), mCurrentStage(mStages.begin()),
|
||||
mCurrentStep(0), mCurrentStepTotal(0), mTotalSteps(0), mOrdered (ordered),
|
||||
mFinalAlways (finalAlways), mError(false)
|
||||
mFinalAlways (finalAlways), mError(false), mConnected (false)
|
||||
{
|
||||
connect (this, SIGNAL (finished()), this, SLOT (operationDone()));
|
||||
mTimer = new QTimer (this);
|
||||
}
|
||||
|
||||
CSMDoc::Operation::~Operation()
|
||||
|
@ -42,15 +42,17 @@ CSMDoc::Operation::~Operation()
|
|||
|
||||
void CSMDoc::Operation::run()
|
||||
{
|
||||
mTimer->stop();
|
||||
|
||||
if (!mConnected)
|
||||
{
|
||||
connect (mTimer, SIGNAL (timeout()), this, SLOT (executeStage()));
|
||||
mConnected = true;
|
||||
}
|
||||
|
||||
prepareStages();
|
||||
|
||||
QTimer timer;
|
||||
|
||||
timer.connect (&timer, SIGNAL (timeout()), this, SLOT (executeStage()));
|
||||
|
||||
timer.start (0);
|
||||
|
||||
exec();
|
||||
mTimer->start (0);
|
||||
}
|
||||
|
||||
void CSMDoc::Operation::appendStage (Stage *stage)
|
||||
|
@ -65,7 +67,7 @@ bool CSMDoc::Operation::hasError() const
|
|||
|
||||
void CSMDoc::Operation::abort()
|
||||
{
|
||||
if (!isRunning())
|
||||
if (!mTimer->isActive())
|
||||
return;
|
||||
|
||||
mError = true;
|
||||
|
@ -116,10 +118,11 @@ void CSMDoc::Operation::executeStage()
|
|||
emit reportMessage (iter->mId, iter->mMessage, iter->mHint, mType);
|
||||
|
||||
if (mCurrentStage==mStages.end())
|
||||
exit();
|
||||
operationDone();
|
||||
}
|
||||
|
||||
void CSMDoc::Operation::operationDone()
|
||||
{
|
||||
mTimer->stop();
|
||||
emit done (mType, mError);
|
||||
}
|
||||
|
|
|
@ -3,7 +3,8 @@
|
|||
|
||||
#include <vector>
|
||||
|
||||
#include <QThread>
|
||||
#include <QObject>
|
||||
#include <QTimer>
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
|
@ -14,7 +15,7 @@ namespace CSMDoc
|
|||
{
|
||||
class Stage;
|
||||
|
||||
class Operation : public QThread
|
||||
class Operation : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -27,6 +28,8 @@ namespace CSMDoc
|
|||
int mOrdered;
|
||||
bool mFinalAlways;
|
||||
bool mError;
|
||||
bool mConnected;
|
||||
QTimer *mTimer;
|
||||
|
||||
void prepareStages();
|
||||
|
||||
|
@ -38,8 +41,6 @@ namespace CSMDoc
|
|||
|
||||
virtual ~Operation();
|
||||
|
||||
virtual void run();
|
||||
|
||||
void appendStage (Stage *stage);
|
||||
///< The ownership of \a stage is transferred to *this.
|
||||
///
|
||||
|
@ -60,6 +61,8 @@ namespace CSMDoc
|
|||
|
||||
void abort();
|
||||
|
||||
void run();
|
||||
|
||||
private slots:
|
||||
|
||||
void executeStage();
|
||||
|
|
65
apps/opencs/model/doc/operationholder.cpp
Normal file
65
apps/opencs/model/doc/operationholder.cpp
Normal file
|
@ -0,0 +1,65 @@
|
|||
|
||||
#include "operationholder.hpp"
|
||||
|
||||
#include "operation.hpp"
|
||||
|
||||
CSMDoc::OperationHolder::OperationHolder (Operation *operation) : mRunning (false)
|
||||
{
|
||||
if (operation)
|
||||
setOperation (operation);
|
||||
}
|
||||
|
||||
void CSMDoc::OperationHolder::setOperation (Operation *operation)
|
||||
{
|
||||
mOperation = operation;
|
||||
mOperation->moveToThread (&mThread);
|
||||
|
||||
connect (
|
||||
mOperation, SIGNAL (progress (int, int, int)),
|
||||
this, SIGNAL (progress (int, int, int)));
|
||||
|
||||
connect (
|
||||
mOperation, SIGNAL (reportMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)),
|
||||
this, SIGNAL (reportMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)));
|
||||
|
||||
connect (
|
||||
mOperation, SIGNAL (done (int, bool)),
|
||||
this, SLOT (doneSlot (int, bool)));
|
||||
|
||||
connect (this, SIGNAL (abortSignal()), mOperation, SLOT (abort()));
|
||||
|
||||
connect (&mThread, SIGNAL (started()), mOperation, SLOT (run()));
|
||||
}
|
||||
|
||||
bool CSMDoc::OperationHolder::isRunning() const
|
||||
{
|
||||
return mRunning;
|
||||
}
|
||||
|
||||
void CSMDoc::OperationHolder::start()
|
||||
{
|
||||
mRunning = true;
|
||||
mThread.start();
|
||||
}
|
||||
|
||||
void CSMDoc::OperationHolder::abort()
|
||||
{
|
||||
mRunning = false;
|
||||
emit abortSignal();
|
||||
}
|
||||
|
||||
void CSMDoc::OperationHolder::abortAndWait()
|
||||
{
|
||||
if (mRunning)
|
||||
{
|
||||
mThread.quit();
|
||||
mThread.wait();
|
||||
}
|
||||
}
|
||||
|
||||
void CSMDoc::OperationHolder::doneSlot (int type, bool failed)
|
||||
{
|
||||
mRunning = false;
|
||||
mThread.quit();
|
||||
emit done (type, failed);
|
||||
}
|
56
apps/opencs/model/doc/operationholder.hpp
Normal file
56
apps/opencs/model/doc/operationholder.hpp
Normal file
|
@ -0,0 +1,56 @@
|
|||
#ifndef CSM_DOC_OPERATIONHOLDER_H
|
||||
#define CSM_DOC_OPERATIONHOLDER_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QThread>
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class UniversalId;
|
||||
}
|
||||
|
||||
namespace CSMDoc
|
||||
{
|
||||
class Operation;
|
||||
|
||||
class OperationHolder : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
QThread mThread;
|
||||
Operation *mOperation;
|
||||
bool mRunning;
|
||||
|
||||
public:
|
||||
|
||||
OperationHolder (Operation *operation = 0);
|
||||
|
||||
void setOperation (Operation *operation);
|
||||
|
||||
bool isRunning() const;
|
||||
|
||||
void start();
|
||||
|
||||
void abort();
|
||||
|
||||
// Abort and wait until thread has finished.
|
||||
void abortAndWait();
|
||||
|
||||
private slots:
|
||||
|
||||
void doneSlot (int type, bool failed);
|
||||
|
||||
signals:
|
||||
|
||||
void progress (int current, int max, int type);
|
||||
|
||||
void reportMessage (const CSMWorld::UniversalId& id, const std::string& message,
|
||||
const std::string& hint, int type);
|
||||
|
||||
void done (int type, bool failed);
|
||||
|
||||
void abortSignal();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -6,7 +6,7 @@
|
|||
#include <QTemporaryFile>
|
||||
#include <QTextStream>
|
||||
|
||||
#include "operation.hpp"
|
||||
#include "operationholder.hpp"
|
||||
|
||||
CSMDoc::Runner::Runner (const boost::filesystem::path& projectPath)
|
||||
: mRunning (false), mStartup (0), mProjectPath (projectPath)
|
||||
|
@ -145,7 +145,7 @@ void CSMDoc::Runner::readyReadStandardOutput()
|
|||
}
|
||||
|
||||
|
||||
CSMDoc::SaveWatcher::SaveWatcher (Runner *runner, Operation *operation)
|
||||
CSMDoc::SaveWatcher::SaveWatcher (Runner *runner, OperationHolder *operation)
|
||||
: QObject (runner), mRunner (runner)
|
||||
{
|
||||
connect (operation, SIGNAL (done (int, bool)), this, SLOT (saveDone (int, bool)));
|
||||
|
|
|
@ -16,6 +16,8 @@ class QTemporaryFile;
|
|||
|
||||
namespace CSMDoc
|
||||
{
|
||||
class OperationHolder;
|
||||
|
||||
class Runner : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -74,7 +76,7 @@ namespace CSMDoc
|
|||
public:
|
||||
|
||||
/// *this attaches itself to runner
|
||||
SaveWatcher (Runner *runner, Operation *operation);
|
||||
SaveWatcher (Runner *runner, OperationHolder *operation);
|
||||
|
||||
private slots:
|
||||
|
||||
|
|
|
@ -93,6 +93,10 @@ CSMDoc::Saving::Saving (Document& document, const boost::filesystem::path& proje
|
|||
|
||||
appendStage (new WritePathgridCollectionStage (mDocument, mState));
|
||||
|
||||
appendStage (new WriteLandCollectionStage (mDocument, mState));
|
||||
|
||||
appendStage (new WriteLandTextureCollectionStage (mDocument, mState));
|
||||
|
||||
// close file and clean up
|
||||
appendStage (new CloseSaveStage (mState));
|
||||
|
||||
|
|
|
@ -90,7 +90,7 @@ void CSMDoc::WriteHeaderStage::perform (int stage, Messages& messages)
|
|||
|
||||
CSMDoc::WriteDialogueCollectionStage::WriteDialogueCollectionStage (Document& document,
|
||||
SavingState& state, bool journal)
|
||||
: mDocument (document), mState (state),
|
||||
: mState (state),
|
||||
mTopics (journal ? document.getData().getJournals() : document.getData().getTopics()),
|
||||
mInfos (journal ? document.getData().getJournalInfos() : document.getData().getTopicInfos())
|
||||
{}
|
||||
|
@ -353,6 +353,74 @@ void CSMDoc::WritePathgridCollectionStage::perform (int stage, Messages& message
|
|||
}
|
||||
|
||||
|
||||
CSMDoc::WriteLandCollectionStage::WriteLandCollectionStage (Document& document,
|
||||
SavingState& state)
|
||||
: mDocument (document), mState (state)
|
||||
{}
|
||||
|
||||
int CSMDoc::WriteLandCollectionStage::setup()
|
||||
{
|
||||
return mDocument.getData().getLand().getSize();
|
||||
}
|
||||
|
||||
void CSMDoc::WriteLandCollectionStage::perform (int stage, Messages& messages)
|
||||
{
|
||||
const CSMWorld::Record<CSMWorld::Land>& land =
|
||||
mDocument.getData().getLand().getRecord (stage);
|
||||
|
||||
if (land.mState==CSMWorld::RecordBase::State_Modified ||
|
||||
land.mState==CSMWorld::RecordBase::State_ModifiedOnly)
|
||||
{
|
||||
CSMWorld::Land record = land.get();
|
||||
|
||||
mState.getWriter().startRecord (record.mLand->sRecordId);
|
||||
|
||||
record.mLand->save (mState.getWriter());
|
||||
if(record.mLand->mLandData)
|
||||
record.mLand->mLandData->save (mState.getWriter());
|
||||
|
||||
mState.getWriter().endRecord (record.mLand->sRecordId);
|
||||
}
|
||||
else if (land.mState==CSMWorld::RecordBase::State_Deleted)
|
||||
{
|
||||
/// \todo write record with delete flag
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CSMDoc::WriteLandTextureCollectionStage::WriteLandTextureCollectionStage (Document& document,
|
||||
SavingState& state)
|
||||
: mDocument (document), mState (state)
|
||||
{}
|
||||
|
||||
int CSMDoc::WriteLandTextureCollectionStage::setup()
|
||||
{
|
||||
return mDocument.getData().getLandTextures().getSize();
|
||||
}
|
||||
|
||||
void CSMDoc::WriteLandTextureCollectionStage::perform (int stage, Messages& messages)
|
||||
{
|
||||
const CSMWorld::Record<CSMWorld::LandTexture>& landTexture =
|
||||
mDocument.getData().getLandTextures().getRecord (stage);
|
||||
|
||||
if (landTexture.mState==CSMWorld::RecordBase::State_Modified ||
|
||||
landTexture.mState==CSMWorld::RecordBase::State_ModifiedOnly)
|
||||
{
|
||||
CSMWorld::LandTexture record = landTexture.get();
|
||||
|
||||
mState.getWriter().startRecord (record.sRecordId);
|
||||
|
||||
record.save (mState.getWriter());
|
||||
|
||||
mState.getWriter().endRecord (record.sRecordId);
|
||||
}
|
||||
else if (landTexture.mState==CSMWorld::RecordBase::State_Deleted)
|
||||
{
|
||||
/// \todo write record with delete flag
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CSMDoc::CloseSaveStage::CloseSaveStage (SavingState& state)
|
||||
: mState (state)
|
||||
{}
|
||||
|
|
|
@ -126,7 +126,6 @@ namespace CSMDoc
|
|||
|
||||
class WriteDialogueCollectionStage : public Stage
|
||||
{
|
||||
Document& mDocument;
|
||||
SavingState& mState;
|
||||
const CSMWorld::IdCollection<ESM::Dialogue>& mTopics;
|
||||
CSMWorld::InfoCollection& mInfos;
|
||||
|
@ -209,6 +208,40 @@ namespace CSMDoc
|
|||
///< Messages resulting from this stage will be appended to \a messages.
|
||||
};
|
||||
|
||||
|
||||
class WriteLandCollectionStage : public Stage
|
||||
{
|
||||
Document& mDocument;
|
||||
SavingState& mState;
|
||||
|
||||
public:
|
||||
|
||||
WriteLandCollectionStage (Document& document, SavingState& state);
|
||||
|
||||
virtual int setup();
|
||||
///< \return number of steps
|
||||
|
||||
virtual void perform (int stage, Messages& messages);
|
||||
///< Messages resulting from this stage will be appended to \a messages.
|
||||
};
|
||||
|
||||
|
||||
class WriteLandTextureCollectionStage : public Stage
|
||||
{
|
||||
Document& mDocument;
|
||||
SavingState& mState;
|
||||
|
||||
public:
|
||||
|
||||
WriteLandTextureCollectionStage (Document& document, SavingState& state);
|
||||
|
||||
virtual int setup();
|
||||
///< \return number of steps
|
||||
|
||||
virtual void perform (int stage, Messages& messages);
|
||||
///< Messages resulting from this stage will be appended to \a messages.
|
||||
};
|
||||
|
||||
class CloseSaveStage : public Stage
|
||||
{
|
||||
SavingState& mState;
|
||||
|
|
|
@ -26,30 +26,30 @@
|
|||
#include "referencecheck.hpp"
|
||||
#include "startscriptcheck.hpp"
|
||||
|
||||
CSMDoc::Operation *CSMTools::Tools::get (int type)
|
||||
CSMDoc::OperationHolder *CSMTools::Tools::get (int type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case CSMDoc::State_Verifying: return mVerifier;
|
||||
case CSMDoc::State_Verifying: return &mVerifier;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
const CSMDoc::Operation *CSMTools::Tools::get (int type) const
|
||||
const CSMDoc::OperationHolder *CSMTools::Tools::get (int type) const
|
||||
{
|
||||
return const_cast<Tools *> (this)->get (type);
|
||||
}
|
||||
|
||||
CSMDoc::Operation *CSMTools::Tools::getVerifier()
|
||||
CSMDoc::OperationHolder *CSMTools::Tools::getVerifier()
|
||||
{
|
||||
if (!mVerifier)
|
||||
if (!mVerifierOperation)
|
||||
{
|
||||
mVerifier = new CSMDoc::Operation (CSMDoc::State_Verifying, false);
|
||||
mVerifierOperation = new CSMDoc::Operation (CSMDoc::State_Verifying, false);
|
||||
|
||||
connect (mVerifier, SIGNAL (progress (int, int, int)), this, SIGNAL (progress (int, int, int)));
|
||||
connect (mVerifier, SIGNAL (done (int, bool)), this, SIGNAL (done (int, bool)));
|
||||
connect (mVerifier,
|
||||
connect (&mVerifier, SIGNAL (progress (int, int, int)), this, SIGNAL (progress (int, int, int)));
|
||||
connect (&mVerifier, SIGNAL (done (int, bool)), this, SIGNAL (done (int, bool)));
|
||||
connect (&mVerifier,
|
||||
SIGNAL (reportMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)),
|
||||
this, SLOT (verifierMessage (const CSMWorld::UniversalId&, const std::string&, const std::string&, int)));
|
||||
|
||||
|
@ -60,46 +60,48 @@ CSMDoc::Operation *CSMTools::Tools::getVerifier()
|
|||
mandatoryIds.push_back ("Month");
|
||||
mandatoryIds.push_back ("PCRace");
|
||||
|
||||
mVerifier->appendStage (new MandatoryIdStage (mData.getGlobals(),
|
||||
mVerifierOperation->appendStage (new MandatoryIdStage (mData.getGlobals(),
|
||||
CSMWorld::UniversalId (CSMWorld::UniversalId::Type_Globals), mandatoryIds));
|
||||
|
||||
mVerifier->appendStage (new SkillCheckStage (mData.getSkills()));
|
||||
mVerifierOperation->appendStage (new SkillCheckStage (mData.getSkills()));
|
||||
|
||||
mVerifier->appendStage (new ClassCheckStage (mData.getClasses()));
|
||||
mVerifierOperation->appendStage (new ClassCheckStage (mData.getClasses()));
|
||||
|
||||
mVerifier->appendStage (new FactionCheckStage (mData.getFactions()));
|
||||
mVerifierOperation->appendStage (new FactionCheckStage (mData.getFactions()));
|
||||
|
||||
mVerifier->appendStage (new RaceCheckStage (mData.getRaces()));
|
||||
mVerifierOperation->appendStage (new RaceCheckStage (mData.getRaces()));
|
||||
|
||||
mVerifier->appendStage (new SoundCheckStage (mData.getSounds()));
|
||||
mVerifierOperation->appendStage (new SoundCheckStage (mData.getSounds()));
|
||||
|
||||
mVerifier->appendStage (new RegionCheckStage (mData.getRegions()));
|
||||
mVerifierOperation->appendStage (new RegionCheckStage (mData.getRegions()));
|
||||
|
||||
mVerifier->appendStage (new BirthsignCheckStage (mData.getBirthsigns()));
|
||||
mVerifierOperation->appendStage (new BirthsignCheckStage (mData.getBirthsigns()));
|
||||
|
||||
mVerifier->appendStage (new SpellCheckStage (mData.getSpells()));
|
||||
mVerifierOperation->appendStage (new SpellCheckStage (mData.getSpells()));
|
||||
|
||||
mVerifier->appendStage (new ReferenceableCheckStage (mData.getReferenceables().getDataSet(), mData.getRaces(), mData.getClasses(), mData.getFactions()));
|
||||
mVerifierOperation->appendStage (new ReferenceableCheckStage (mData.getReferenceables().getDataSet(), mData.getRaces(), mData.getClasses(), mData.getFactions()));
|
||||
|
||||
mVerifier->appendStage (new ReferenceCheckStage(mData.getReferences(), mData.getReferenceables(), mData.getCells(), mData.getFactions()));
|
||||
mVerifierOperation->appendStage (new ReferenceCheckStage(mData.getReferences(), mData.getReferenceables(), mData.getCells(), mData.getFactions()));
|
||||
|
||||
mVerifier->appendStage (new ScriptCheckStage (mDocument));
|
||||
mVerifierOperation->appendStage (new ScriptCheckStage (mDocument));
|
||||
|
||||
mVerifier->appendStage (new StartScriptCheckStage (mData.getStartScripts(), mData.getScripts()));
|
||||
mVerifierOperation->appendStage (new StartScriptCheckStage (mData.getStartScripts(), mData.getScripts()));
|
||||
|
||||
mVerifier->appendStage(
|
||||
mVerifierOperation->appendStage(
|
||||
new BodyPartCheckStage(
|
||||
mData.getBodyParts(),
|
||||
mData.getResources(
|
||||
CSMWorld::UniversalId( CSMWorld::UniversalId::Type_Meshes )),
|
||||
mData.getRaces() ));
|
||||
|
||||
mVerifier.setOperation (mVerifierOperation);
|
||||
}
|
||||
|
||||
return mVerifier;
|
||||
return &mVerifier;
|
||||
}
|
||||
|
||||
CSMTools::Tools::Tools (CSMDoc::Document& document)
|
||||
: mDocument (document), mData (document.getData()), mVerifier (0), mNextReportNumber (0)
|
||||
: mDocument (document), mData (document.getData()), mVerifierOperation (0), mNextReportNumber (0)
|
||||
{
|
||||
// index 0: load error log
|
||||
mReports.insert (std::make_pair (mNextReportNumber++, new ReportModel));
|
||||
|
@ -108,7 +110,11 @@ CSMTools::Tools::Tools (CSMDoc::Document& document)
|
|||
|
||||
CSMTools::Tools::~Tools()
|
||||
{
|
||||
delete mVerifier;
|
||||
if (mVerifierOperation)
|
||||
{
|
||||
mVerifier.abortAndWait();
|
||||
delete mVerifierOperation;
|
||||
}
|
||||
|
||||
for (std::map<int, ReportModel *>::iterator iter (mReports.begin()); iter!=mReports.end(); ++iter)
|
||||
delete iter->second;
|
||||
|
@ -126,7 +132,7 @@ CSMWorld::UniversalId CSMTools::Tools::runVerifier()
|
|||
|
||||
void CSMTools::Tools::abortOperation (int type)
|
||||
{
|
||||
if (CSMDoc::Operation *operation = get (type))
|
||||
if (CSMDoc::OperationHolder *operation = get (type))
|
||||
operation->abort();
|
||||
}
|
||||
|
||||
|
@ -141,7 +147,7 @@ int CSMTools::Tools::getRunningOperations() const
|
|||
int result = 0;
|
||||
|
||||
for (int i=0; sOperations[i]!=-1; ++i)
|
||||
if (const CSMDoc::Operation *operation = get (sOperations[i]))
|
||||
if (const CSMDoc::OperationHolder *operation = get (sOperations[i]))
|
||||
if (operation->isRunning())
|
||||
result |= sOperations[i];
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include <map>
|
||||
|
||||
#include "../doc/operationholder.hpp"
|
||||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class Data;
|
||||
|
@ -27,7 +29,8 @@ namespace CSMTools
|
|||
|
||||
CSMDoc::Document& mDocument;
|
||||
CSMWorld::Data& mData;
|
||||
CSMDoc::Operation *mVerifier;
|
||||
CSMDoc::Operation *mVerifierOperation;
|
||||
CSMDoc::OperationHolder mVerifier;
|
||||
std::map<int, ReportModel *> mReports;
|
||||
int mNextReportNumber;
|
||||
std::map<int, int> mActiveReports; // type, report number
|
||||
|
@ -36,12 +39,12 @@ namespace CSMTools
|
|||
Tools (const Tools&);
|
||||
Tools& operator= (const Tools&);
|
||||
|
||||
CSMDoc::Operation *getVerifier();
|
||||
CSMDoc::OperationHolder *getVerifier();
|
||||
|
||||
CSMDoc::Operation *get (int type);
|
||||
CSMDoc::OperationHolder *get (int type);
|
||||
///< Returns a 0-pointer, if operation hasn't been used yet.
|
||||
|
||||
const CSMDoc::Operation *get (int type) const;
|
||||
const CSMDoc::OperationHolder *get (int type) const;
|
||||
///< Returns a 0-pointer, if operation hasn't been used yet.
|
||||
|
||||
public:
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace CSMWorld
|
|||
{
|
||||
class IdTable;
|
||||
class IdTable;
|
||||
class RecordBase;
|
||||
struct RecordBase;
|
||||
class NestedTableWrapperBase;
|
||||
|
||||
class ModifyCommand : public QUndoCommand
|
||||
|
|
|
@ -745,7 +745,7 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages)
|
|||
if (index!=-1 && !mBase)
|
||||
mLand.getRecord (index).mModified.mLand->loadData (
|
||||
ESM::Land::DATA_VHGT | ESM::Land::DATA_VNML | ESM::Land::DATA_VCLR |
|
||||
ESM::Land::DATA_VTEX);
|
||||
ESM::Land::DATA_VTEX | ESM::Land::DATA_WNAM);
|
||||
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
/*! \brief
|
||||
* Clas for holding the model. Uses typical qt table abstraction/interface for granting access to the individiual fields of the records,
|
||||
* Some records are holding nested data (for instance inventory list of the npc). In casses like this, table model offers interface
|
||||
* to access nested data in the qt way – that is specify parent. Since some of those nested data require multiple columns to
|
||||
* to access nested data in the qt way – that is specify parent. Since some of those nested data require multiple columns to
|
||||
* represent informations, single int (default way to index model in the qmodelindex) is not sufficiant. Therefore tablemodelindex class
|
||||
* can hold two ints for the sake of indexing two dimensions of the table. This model does not support multiple levels of the nested
|
||||
* data. Vast majority of methods makes sense only for the top level data.
|
||||
|
@ -19,7 +19,7 @@
|
|||
namespace CSMWorld
|
||||
{
|
||||
class CollectionBase;
|
||||
class RecordBase;
|
||||
struct RecordBase;
|
||||
class NestedTableWrapperBase;
|
||||
|
||||
class IdTable : public IdTableBase
|
||||
|
|
|
@ -26,7 +26,7 @@ void CSMWorld::InfoCollection::load (const Info& record, bool base)
|
|||
|
||||
if (!record2.get().mPrev.empty())
|
||||
{
|
||||
index = getIndex (record2.get().mPrev, topic);
|
||||
index = getInfoIndex (record2.get().mPrev, topic);
|
||||
|
||||
if (index!=-1)
|
||||
++index;
|
||||
|
@ -34,7 +34,7 @@ void CSMWorld::InfoCollection::load (const Info& record, bool base)
|
|||
|
||||
if (index==-1 && !record2.get().mNext.empty())
|
||||
{
|
||||
index = getIndex (record2.get().mNext, topic);
|
||||
index = getInfoIndex (record2.get().mNext, topic);
|
||||
}
|
||||
|
||||
if (index==-1)
|
||||
|
@ -60,7 +60,7 @@ void CSMWorld::InfoCollection::load (const Info& record, bool base)
|
|||
}
|
||||
}
|
||||
|
||||
int CSMWorld::InfoCollection::getIndex (const std::string& id, const std::string& topic) const
|
||||
int CSMWorld::InfoCollection::getInfoIndex (const std::string& id, const std::string& topic) const
|
||||
{
|
||||
std::string fullId = Misc::StringUtils::lowerCase (topic) + "#" + id;
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
namespace ESM
|
||||
{
|
||||
class Dialogue;
|
||||
struct Dialogue;
|
||||
}
|
||||
|
||||
namespace CSMWorld
|
||||
|
@ -22,7 +22,7 @@ namespace CSMWorld
|
|||
|
||||
void load (const Info& record, bool base);
|
||||
|
||||
int getIndex (const std::string& id, const std::string& topic) const;
|
||||
int getInfoIndex (const std::string& id, const std::string& topic) const;
|
||||
///< Return index for record \a id or -1 (if not present; deleted records are considered)
|
||||
///
|
||||
/// \param id info ID without topic prefix
|
||||
|
|
|
@ -22,6 +22,8 @@ namespace CSMWorld
|
|||
|
||||
virtual RecordBase *clone() const = 0;
|
||||
|
||||
virtual RecordBase *modifiedCopy() const = 0;
|
||||
|
||||
virtual void assign (const RecordBase& record) = 0;
|
||||
///< Will throw an exception if the types don't match.
|
||||
|
||||
|
@ -38,8 +40,15 @@ namespace CSMWorld
|
|||
ESXRecordT mBase;
|
||||
ESXRecordT mModified;
|
||||
|
||||
Record();
|
||||
|
||||
Record(State state,
|
||||
const ESXRecordT *base = 0, const ESXRecordT *modified = 0);
|
||||
|
||||
virtual RecordBase *clone() const;
|
||||
|
||||
virtual RecordBase *modifiedCopy() const;
|
||||
|
||||
virtual void assign (const RecordBase& record);
|
||||
|
||||
const ESXRecordT& get() const;
|
||||
|
@ -58,6 +67,29 @@ namespace CSMWorld
|
|||
///< Merge modified into base.
|
||||
};
|
||||
|
||||
template <typename ESXRecordT>
|
||||
Record<ESXRecordT>::Record()
|
||||
: mBase(), mModified()
|
||||
{ }
|
||||
|
||||
template <typename ESXRecordT>
|
||||
Record<ESXRecordT>::Record(State state, const ESXRecordT *base, const ESXRecordT *modified)
|
||||
{
|
||||
if(base)
|
||||
mBase = *base;
|
||||
|
||||
if(modified)
|
||||
mModified = *modified;
|
||||
|
||||
this->mState = state;
|
||||
}
|
||||
|
||||
template <typename ESXRecordT>
|
||||
RecordBase *Record<ESXRecordT>::modifiedCopy() const
|
||||
{
|
||||
return new Record<ESXRecordT> (State_ModifiedOnly, 0, &(this->get()));
|
||||
}
|
||||
|
||||
template <typename ESXRecordT>
|
||||
RecordBase *Record<ESXRecordT>::clone() const
|
||||
{
|
||||
|
|
|
@ -5,8 +5,6 @@
|
|||
|
||||
namespace CSMWorld
|
||||
{
|
||||
class Cell;
|
||||
|
||||
/// \brief Wrapper for CellRef sub record
|
||||
struct CellRef : public ESM::CellRef
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
namespace CSMWorld
|
||||
{
|
||||
struct Cell;
|
||||
struct UniversalId;
|
||||
class UniversalId;
|
||||
|
||||
/// \brief References in cells
|
||||
class RefCollection : public Collection<CellRef>
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace CSMWorld
|
|||
{
|
||||
class RefIdColumn;
|
||||
class RefIdData;
|
||||
class RecordBase;
|
||||
struct RecordBase;
|
||||
class NestedTableWrapperBase;
|
||||
class HelperBase;
|
||||
|
||||
|
|
|
@ -160,10 +160,16 @@ namespace CSMWorld
|
|||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||
|
||||
RecordT record2 = record.get();
|
||||
if (column==mModel.mModel)
|
||||
record.get().mModel = value.toString().toUtf8().constData();
|
||||
record2.mModel = value.toString().toUtf8().constData();
|
||||
else
|
||||
{
|
||||
BaseRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||
return;
|
||||
}
|
||||
|
||||
record.setModified(record2);
|
||||
}
|
||||
|
||||
struct NameColumns : public ModelColumns
|
||||
|
@ -220,12 +226,18 @@ namespace CSMWorld
|
|||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||
|
||||
RecordT record2 = record.get();
|
||||
if (column==mName.mName)
|
||||
record.get().mName = value.toString().toUtf8().constData();
|
||||
record2.mName = value.toString().toUtf8().constData();
|
||||
else if (column==mName.mScript)
|
||||
record.get().mScript = value.toString().toUtf8().constData();
|
||||
record2.mScript = value.toString().toUtf8().constData();
|
||||
else
|
||||
{
|
||||
ModelRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||
return;
|
||||
}
|
||||
|
||||
record.setModified(record2);
|
||||
}
|
||||
|
||||
struct InventoryColumns : public NameColumns
|
||||
|
@ -287,14 +299,20 @@ namespace CSMWorld
|
|||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||
|
||||
RecordT record2 = record.get();
|
||||
if (column==mInventory.mIcon)
|
||||
record.get().mIcon = value.toString().toUtf8().constData();
|
||||
record2.mIcon = value.toString().toUtf8().constData();
|
||||
else if (column==mInventory.mWeight)
|
||||
record.get().mData.mWeight = value.toFloat();
|
||||
record2.mData.mWeight = value.toFloat();
|
||||
else if (column==mInventory.mValue)
|
||||
record.get().mData.mValue = value.toInt();
|
||||
record2.mData.mValue = value.toInt();
|
||||
else
|
||||
{
|
||||
NameRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||
return;
|
||||
}
|
||||
|
||||
record.setModified(record2);
|
||||
}
|
||||
|
||||
class PotionRefIdAdapter : public InventoryRefIdAdapter<ESM::Potion>
|
||||
|
@ -368,12 +386,18 @@ namespace CSMWorld
|
|||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||
|
||||
RecordT record2 = record.get();
|
||||
if (column==mEnchantable.mEnchantment)
|
||||
record.get().mEnchant = value.toString().toUtf8().constData();
|
||||
record2.mEnchant = value.toString().toUtf8().constData();
|
||||
else if (column==mEnchantable.mEnchantmentPoints)
|
||||
record.get().mData.mEnchant = value.toInt();
|
||||
record2.mData.mEnchant = value.toInt();
|
||||
else
|
||||
{
|
||||
InventoryRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||
return;
|
||||
}
|
||||
|
||||
record.setModified(record2);
|
||||
}
|
||||
|
||||
struct ToolColumns : public InventoryColumns
|
||||
|
@ -430,12 +454,18 @@ namespace CSMWorld
|
|||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||
|
||||
RecordT record2 = record.get();
|
||||
if (column==mTools.mQuality)
|
||||
record.get().mData.mQuality = value.toFloat();
|
||||
record2.mData.mQuality = value.toFloat();
|
||||
else if (column==mTools.mUses)
|
||||
record.get().mData.mUses = value.toInt();
|
||||
record2.mData.mUses = value.toInt();
|
||||
else
|
||||
{
|
||||
InventoryRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||
return;
|
||||
}
|
||||
|
||||
record.setModified(record2);
|
||||
}
|
||||
|
||||
struct ActorColumns : public NameColumns
|
||||
|
@ -527,16 +557,17 @@ namespace CSMWorld
|
|||
Record<RecordT>& record = static_cast<Record<RecordT>&> (
|
||||
data.getRecord (RefIdData::LocalIndex (index, BaseRefIdAdapter<RecordT>::getType())));
|
||||
|
||||
RecordT record2 = record.get();
|
||||
if (column==mActors.mHasAi)
|
||||
record.get().mHasAI = value.toInt();
|
||||
record2.mHasAI = value.toInt();
|
||||
else if (column==mActors.mHello)
|
||||
record.get().mAiData.mHello = value.toInt();
|
||||
record2.mAiData.mHello = value.toInt();
|
||||
else if (column==mActors.mFlee)
|
||||
record.get().mAiData.mFlee = value.toInt();
|
||||
record2.mAiData.mFlee = value.toInt();
|
||||
else if (column==mActors.mFight)
|
||||
record.get().mAiData.mFight = value.toInt();
|
||||
record2.mAiData.mFight = value.toInt();
|
||||
else if (column==mActors.mAlarm)
|
||||
record.get().mAiData.mAlarm = value.toInt();
|
||||
record2.mAiData.mAlarm = value.toInt();
|
||||
else
|
||||
{
|
||||
typename std::map<const RefIdColumn *, unsigned int>::const_iterator iter =
|
||||
|
@ -544,15 +575,20 @@ namespace CSMWorld
|
|||
if (iter!=mActors.mServices.end())
|
||||
{
|
||||
if (value.toInt()!=0)
|
||||
record.get().mAiData.mServices |= iter->second;
|
||||
record2.mAiData.mServices |= iter->second;
|
||||
else
|
||||
record.get().mAiData.mServices &= ~iter->second;
|
||||
record2.mAiData.mServices &= ~iter->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
NameRefIdAdapter<RecordT>::setData (column, data, index, value);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
record.setModified(record2);
|
||||
}
|
||||
|
||||
class ApparatusRefIdAdapter : public InventoryRefIdAdapter<ESM::Apparatus>
|
||||
{
|
||||
const RefIdColumn *mType;
|
||||
|
|
|
@ -522,8 +522,7 @@ void CSMWorld::RefIdCollection::cloneRecord(const std::string& origin,
|
|||
const std::string& destination,
|
||||
const CSMWorld::UniversalId::Type type)
|
||||
{
|
||||
std::auto_ptr<RecordBase> newRecord(mData.getRecord(mData.searchId(origin)).clone());
|
||||
newRecord->mState = RecordBase::State_ModifiedOnly;
|
||||
std::auto_ptr<RecordBase> newRecord(mData.getRecord(mData.searchId(origin)).modifiedCopy());
|
||||
mAdapters.find(type)->second->setId(*newRecord, destination);
|
||||
mData.insertRecord(*newRecord, type, destination);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ namespace Ogre
|
|||
namespace CSMWorld
|
||||
{
|
||||
class Data;
|
||||
class CellRef;
|
||||
struct CellRef;
|
||||
}
|
||||
|
||||
namespace CSVWorld
|
||||
|
|
|
@ -30,7 +30,7 @@ void CSVTools::ReportTable::contextMenuEvent (QContextMenuEvent *event)
|
|||
void CSVTools::ReportTable::mouseMoveEvent (QMouseEvent *event)
|
||||
{
|
||||
if (event->buttons() & Qt::LeftButton)
|
||||
startDrag (*this);
|
||||
startDragFromTable (*this);
|
||||
}
|
||||
|
||||
void CSVTools::ReportTable::mouseDoubleClickEvent (QMouseEvent *event)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <utility>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
|
||||
#include <QGridLayout>
|
||||
#include <QLabel>
|
||||
|
@ -42,8 +43,12 @@ QAbstractItemDelegate(parent),
|
|||
mTable(table)
|
||||
{}
|
||||
|
||||
void CSVWorld::NotEditableSubDelegate::setEditorData (QLabel* editor, const QModelIndex& index) const
|
||||
void CSVWorld::NotEditableSubDelegate::setEditorData (QWidget* editor, const QModelIndex& index) const
|
||||
{
|
||||
QLabel* label = qobject_cast<QLabel*>(editor);
|
||||
if(!label)
|
||||
return;
|
||||
|
||||
QVariant v = index.data(Qt::EditRole);
|
||||
if (!v.isValid())
|
||||
{
|
||||
|
@ -56,16 +61,17 @@ void CSVWorld::NotEditableSubDelegate::setEditorData (QLabel* editor, const QMod
|
|||
|
||||
if (QVariant::String == v.type())
|
||||
{
|
||||
editor->setText(v.toString());
|
||||
} else //else we are facing enums
|
||||
label->setText(v.toString());
|
||||
}
|
||||
else //else we are facing enums
|
||||
{
|
||||
int data = v.toInt();
|
||||
std::vector<std::string> enumNames (CSMWorld::Columns::getEnums (static_cast<CSMWorld::Columns::ColumnId> (mTable->getColumnId (index.column()))));
|
||||
editor->setText(QString::fromUtf8(enumNames.at(data).c_str()));
|
||||
label->setText(QString::fromUtf8(enumNames.at(data).c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
void CSVWorld::NotEditableSubDelegate::setModelData (QWidget* editor, QAbstractItemModel* model, const QModelIndex& index, CSMWorld::ColumnBase::Display display) const
|
||||
void CSVWorld::NotEditableSubDelegate::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
|
||||
{
|
||||
//not editable widgets will not save model data
|
||||
}
|
||||
|
@ -82,8 +88,7 @@ QSize CSVWorld::NotEditableSubDelegate::sizeHint (const QStyleOptionViewItem& op
|
|||
|
||||
QWidget* CSVWorld::NotEditableSubDelegate::createEditor (QWidget *parent,
|
||||
const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index,
|
||||
CSMWorld::ColumnBase::Display display) const
|
||||
const QModelIndex& index) const
|
||||
{
|
||||
return new QLabel(parent);
|
||||
}
|
||||
|
@ -226,6 +231,11 @@ void CSVWorld::DialogueDelegateDispatcher::setEditorData (QWidget* editor, const
|
|||
}
|
||||
}
|
||||
|
||||
void CSVWorld::DialogueDelegateDispatcher::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const
|
||||
{
|
||||
setModelData(editor, model, index, CSMWorld::ColumnBase::Display_None);
|
||||
}
|
||||
|
||||
void CSVWorld::DialogueDelegateDispatcher::setModelData(QWidget* editor, QAbstractItemModel* model, const QModelIndex& index, CSMWorld::ColumnBase::Display display) const
|
||||
{
|
||||
std::map<int, CommandDelegate*>::const_iterator delegateIt(mDelegates.find(display));
|
||||
|
@ -260,7 +270,7 @@ QWidget* CSVWorld::DialogueDelegateDispatcher::makeEditor(CSMWorld::ColumnBase::
|
|||
QWidget* editor = NULL;
|
||||
if (! (mTable->flags (index) & Qt::ItemIsEditable))
|
||||
{
|
||||
return mNotEditableDelegate.createEditor(qobject_cast<QWidget*>(mParent), QStyleOptionViewItem(), index, display);
|
||||
return mNotEditableDelegate.createEditor(qobject_cast<QWidget*>(mParent), QStyleOptionViewItem(), index);
|
||||
}
|
||||
|
||||
std::map<int, CommandDelegate*>::iterator delegateIt(mDelegates.find(display));
|
||||
|
@ -271,6 +281,8 @@ QWidget* CSVWorld::DialogueDelegateDispatcher::makeEditor(CSMWorld::ColumnBase::
|
|||
|
||||
DialogueDelegateDispatcherProxy* proxy = new DialogueDelegateDispatcherProxy(editor, display);
|
||||
|
||||
// NOTE: For each entry in CSVWorld::CommandDelegate::createEditor() a corresponding entry
|
||||
// is required here
|
||||
if (qobject_cast<DropLineEdit*>(editor))
|
||||
{
|
||||
connect(editor, SIGNAL(editingFinished()), proxy, SLOT(editorDataCommited()));
|
||||
|
@ -295,10 +307,12 @@ QWidget* CSVWorld::DialogueDelegateDispatcher::makeEditor(CSMWorld::ColumnBase::
|
|||
{
|
||||
connect(editor, SIGNAL(currentIndexChanged (int)), proxy, SLOT(editorDataCommited()));
|
||||
}
|
||||
else if (qobject_cast<QAbstractSpinBox*>(editor))
|
||||
else if (qobject_cast<QAbstractSpinBox*>(editor) || qobject_cast<QLineEdit*>(editor))
|
||||
{
|
||||
connect(editor, SIGNAL(editingFinished()), proxy, SLOT(editorDataCommited()));
|
||||
}
|
||||
else // throw an exception because this is a coding error
|
||||
throw std::logic_error ("Dialogue editor type missing");
|
||||
|
||||
connect(proxy, SIGNAL(editorDataCommited(QWidget*, const QModelIndex&, CSMWorld::ColumnBase::Display)),
|
||||
this, SLOT(editorDataCommited(QWidget*, const QModelIndex&, CSMWorld::ColumnBase::Display)));
|
||||
|
|
|
@ -42,12 +42,9 @@ namespace CSVWorld
|
|||
NotEditableSubDelegate(const CSMWorld::IdTable* table,
|
||||
QObject * parent = 0);
|
||||
|
||||
virtual void setEditorData (QLabel* editor,
|
||||
const QModelIndex& index) const;
|
||||
virtual void setEditorData (QWidget* editor, const QModelIndex& index) const;
|
||||
|
||||
virtual void setModelData (QWidget* editor, QAbstractItemModel* model,
|
||||
const QModelIndex& index,
|
||||
CSMWorld::ColumnBase::Display display) const;
|
||||
virtual void setModelData (QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
|
||||
|
||||
virtual void paint (QPainter* painter,
|
||||
const QStyleOptionViewItem& option,
|
||||
|
@ -60,8 +57,7 @@ namespace CSVWorld
|
|||
|
||||
virtual QWidget *createEditor (QWidget *parent,
|
||||
const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index,
|
||||
CSMWorld::ColumnBase::Display display = CSMWorld::ColumnBase::Display_None) const;
|
||||
const QModelIndex& index) const;
|
||||
};
|
||||
|
||||
//this can't be nested into the DialogueDelegateDispatcher, because it needs to emit signals
|
||||
|
@ -136,10 +132,9 @@ namespace CSVWorld
|
|||
virtual void setEditorData (QWidget* editor,
|
||||
const QModelIndex& index) const;
|
||||
|
||||
virtual void setModelData (QWidget* editor,
|
||||
QAbstractItemModel* model,
|
||||
const QModelIndex& index,
|
||||
CSMWorld::ColumnBase::Display display) const;
|
||||
virtual void setModelData (QWidget* editor, QAbstractItemModel* model, const QModelIndex& index) const;
|
||||
|
||||
virtual void setModelData (QWidget* editor, QAbstractItemModel* model, const QModelIndex& index, CSMWorld::ColumnBase::Display display) const;
|
||||
|
||||
virtual void paint (QPainter* painter,
|
||||
const QStyleOptionViewItem& option,
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "../../model/world/tablemimedata.hpp"
|
||||
#include "dragrecordtable.hpp"
|
||||
|
||||
void CSVWorld::DragRecordTable::startDrag (const CSVWorld::DragRecordTable& table)
|
||||
void CSVWorld::DragRecordTable::startDragFromTable (const CSVWorld::DragRecordTable& table)
|
||||
{
|
||||
CSMWorld::TableMimeData* mime = new CSMWorld::TableMimeData (table.getDraggedRecords(), mDocument);
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ namespace CSVWorld
|
|||
void setEditLock(bool locked);
|
||||
|
||||
protected:
|
||||
void startDrag(const DragRecordTable& table);
|
||||
void startDragFromTable(const DragRecordTable& table);
|
||||
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ QWidget *CSVWorld::EnumDelegate::createEditor(QWidget *parent,
|
|||
const QModelIndex& index) const
|
||||
{
|
||||
return createEditor(parent, option, index, CSMWorld::ColumnBase::Display_None);
|
||||
//overloading virtual functions is HARD
|
||||
}
|
||||
|
||||
QWidget *CSVWorld::EnumDelegate::createEditor(QWidget *parent, const QStyleOptionViewItem& option,
|
||||
|
|
|
@ -345,7 +345,7 @@ void CSVWorld::RegionMap::viewInTable()
|
|||
|
||||
void CSVWorld::RegionMap::mouseMoveEvent (QMouseEvent* event)
|
||||
{
|
||||
startDrag(*this);
|
||||
startDragFromTable(*this);
|
||||
}
|
||||
|
||||
std::vector< CSMWorld::UniversalId > CSVWorld::RegionMap::getDraggedRecords() const
|
||||
|
|
|
@ -635,7 +635,7 @@ void CSVWorld::Table::mouseMoveEvent (QMouseEvent* event)
|
|||
{
|
||||
if (event->buttons() & Qt::LeftButton)
|
||||
{
|
||||
startDrag(*this);
|
||||
startDragFromTable(*this);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -139,6 +139,12 @@ void CSVWorld::CommandDelegate::setModelData (QWidget *editor, QAbstractItemMode
|
|||
///< \todo provide some kind of feedback to the user, indicating that editing is currently not possible.
|
||||
}
|
||||
|
||||
QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index) const
|
||||
{
|
||||
return createEditor (parent, option, index, CSMWorld::ColumnBase::Display_None);
|
||||
}
|
||||
|
||||
QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index, CSMWorld::ColumnBase::Display display) const
|
||||
{
|
||||
|
@ -152,6 +158,8 @@ QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleO
|
|||
}
|
||||
}
|
||||
|
||||
// NOTE: for each editor type (e.g. QLineEdit) there needs to be a corresponding
|
||||
// entry in CSVWorld::DialogueDelegateDispatcher::makeEditor()
|
||||
switch (display)
|
||||
{
|
||||
case CSMWorld::ColumnBase::Display_Colour:
|
||||
|
@ -228,6 +236,11 @@ bool CSVWorld::CommandDelegate::isEditLocked() const
|
|||
return mEditLock;
|
||||
}
|
||||
|
||||
void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelIndex& index) const
|
||||
{
|
||||
setEditorData (editor, index, false);
|
||||
}
|
||||
|
||||
void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay) const
|
||||
{
|
||||
QVariant v = index.data(Qt::EditRole);
|
||||
|
|
|
@ -130,10 +130,14 @@ namespace CSVWorld
|
|||
virtual void setModelData (QWidget *editor, QAbstractItemModel *model,
|
||||
const QModelIndex& index) const;
|
||||
|
||||
virtual QWidget *createEditor (QWidget *parent,
|
||||
const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index) const;
|
||||
|
||||
virtual QWidget *createEditor (QWidget *parent,
|
||||
const QStyleOptionViewItem& option,
|
||||
const QModelIndex& index,
|
||||
CSMWorld::ColumnBase::Display display = CSMWorld::ColumnBase::Display_None) const;
|
||||
CSMWorld::ColumnBase::Display display) const;
|
||||
|
||||
void setEditLock (bool locked);
|
||||
|
||||
|
@ -141,8 +145,9 @@ namespace CSVWorld
|
|||
|
||||
///< \return Does column require update?
|
||||
|
||||
virtual void setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay = false) const;
|
||||
virtual void setEditorData (QWidget *editor, const QModelIndex& index) const;
|
||||
|
||||
virtual void setEditorData (QWidget *editor, const QModelIndex& index, bool tryDisplay) const;
|
||||
|
||||
public slots:
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ set(GAME
|
|||
)
|
||||
|
||||
if (ANDROID)
|
||||
set(GAME ${GAME} android_commandLine.cpp)
|
||||
set(GAME ${GAME} android_main.c)
|
||||
endif()
|
||||
|
||||
|
@ -104,7 +105,6 @@ find_package(Boost REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
|||
|
||||
if (NOT ANDROID)
|
||||
add_executable(openmw
|
||||
${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
|
||||
${OPENMW_FILES}
|
||||
${GAME} ${GAME_HEADER}
|
||||
${APPLE_BUNDLE_RESOURCES}
|
||||
|
@ -112,7 +112,6 @@ if (NOT ANDROID)
|
|||
else ()
|
||||
add_library(openmw
|
||||
SHARED
|
||||
${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
|
||||
${OPENMW_FILES}
|
||||
${GAME} ${GAME_HEADER}
|
||||
)
|
||||
|
@ -120,9 +119,10 @@ endif ()
|
|||
|
||||
# Sound stuff - here so CMake doesn't stupidly recompile EVERYTHING
|
||||
# when we change the backend.
|
||||
include_directories(${SOUND_INPUT_INCLUDES} ${BULLET_INCLUDE_DIRS})
|
||||
include_directories(${SOUND_INPUT_INCLUDES})
|
||||
|
||||
target_link_libraries(openmw
|
||||
${OENGINE_LIBRARY}
|
||||
${OGRE_LIBRARIES}
|
||||
${OGRE_STATIC_PLUGINS}
|
||||
${SHINY_LIBRARIES}
|
||||
|
|
18
apps/openmw/android_commandLine.cpp
Normal file
18
apps/openmw/android_commandLine.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "android_commandLine.h"
|
||||
#include "string.h"
|
||||
|
||||
const char *argvData[15];
|
||||
int argcData;
|
||||
|
||||
JNIEXPORT void JNICALL Java_ui_activity_GameActivity_commandLine(JNIEnv *env,
|
||||
jobject obj, jint argc, jobjectArray stringArray) {
|
||||
jboolean iscopy;
|
||||
argcData = (int) argc;
|
||||
argvData[0]="openmw";
|
||||
for (int i = 0; i < argcData; i++) {
|
||||
jstring string = (jstring) (*env).GetObjectArrayElement(stringArray, i);
|
||||
argvData[i+1] = (env)->GetStringUTFChars(string, &iscopy);
|
||||
}
|
||||
|
||||
}
|
||||
|
16
apps/openmw/android_commandLine.h
Normal file
16
apps/openmw/android_commandLine.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
|
||||
|
||||
/* DO NOT EDIT THIS FILE - it is machine generated */
|
||||
#include <jni.h>
|
||||
#ifndef _Included_ui_activity_GameActivity_commandLine
|
||||
#define _Included_ui_activity_GameActivity_commandLine
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
JNIEXPORT void JNICALL Java_ui_activity_GameActivity_commandLine(JNIEnv *env, jobject obj,jint argcData, jobjectArray stringArray);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
|
@ -1,10 +1,8 @@
|
|||
|
||||
#include "../../SDL_internal.h"
|
||||
|
||||
#ifdef __ANDROID__
|
||||
#include "SDL_main.h"
|
||||
|
||||
|
||||
/*******************************************************************************
|
||||
Functions called by JNI
|
||||
*******************************************************************************/
|
||||
|
@ -12,26 +10,22 @@
|
|||
|
||||
/* Called before to initialize JNI bindings */
|
||||
|
||||
|
||||
|
||||
extern void SDL_Android_Init(JNIEnv* env, jclass cls);
|
||||
extern int argcData;
|
||||
extern const char *argvData[15];
|
||||
|
||||
|
||||
int Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls, jobject obj)
|
||||
{
|
||||
int Java_org_libsdl_app_SDLActivity_nativeInit(JNIEnv* env, jclass cls,
|
||||
jobject obj) {
|
||||
|
||||
SDL_Android_Init(env, cls);
|
||||
|
||||
SDL_SetMainReady();
|
||||
|
||||
|
||||
/* Run the application code! */
|
||||
|
||||
int status;
|
||||
char *argv[2];
|
||||
argv[0] = SDL_strdup("openmw");
|
||||
argv[1] = NULL;
|
||||
status = main(1, argv);
|
||||
|
||||
status = main(argcData+1, argvData);
|
||||
|
||||
/* Do not issue an exit or the whole application will terminate instead of just the SDL thread */
|
||||
/* exit(status); */
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
#include <SDL.h>
|
||||
|
||||
#include <openengine/misc/rng.hpp>
|
||||
|
||||
#include <components/compiler/extensions0.hpp>
|
||||
|
||||
#include <components/bsa/resources.hpp>
|
||||
|
@ -191,15 +193,13 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager)
|
|||
, mExportFonts(false)
|
||||
, mNewGame (false)
|
||||
{
|
||||
std::srand ( std::time(NULL) );
|
||||
OEngine::Misc::Rng::init();
|
||||
std::srand ( static_cast<unsigned int>(std::time(NULL)) );
|
||||
MWClass::registerClasses();
|
||||
|
||||
Uint32 flags = SDL_INIT_VIDEO|SDL_INIT_NOPARACHUTE|SDL_INIT_GAMECONTROLLER|SDL_INIT_JOYSTICK;
|
||||
if(SDL_WasInit(flags) == 0)
|
||||
{
|
||||
//kindly ask SDL not to trash our OGL context
|
||||
//might this be related to http://bugzilla.libsdl.org/show_bug.cgi?id=748 ?
|
||||
SDL_SetHint(SDL_HINT_RENDER_DRIVER, "software");
|
||||
SDL_SetMainReady();
|
||||
if(SDL_Init(flags) != 0)
|
||||
{
|
||||
|
|
|
@ -290,7 +290,7 @@ public:
|
|||
std::streamsize write(const char *str, std::streamsize size)
|
||||
{
|
||||
// Make a copy for null termination
|
||||
std::string tmp (str, size);
|
||||
std::string tmp (str, static_cast<unsigned int>(size));
|
||||
// Write string to Visual Studio Debug output
|
||||
OutputDebugString (tmp.c_str ());
|
||||
return size;
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace MWWorld
|
|||
namespace MWSound
|
||||
{
|
||||
class Sound;
|
||||
class Sound_Decoder;
|
||||
struct Sound_Decoder;
|
||||
typedef boost::shared_ptr<Sound_Decoder> DecoderPtr;
|
||||
}
|
||||
|
||||
|
|
|
@ -149,17 +149,14 @@ namespace MWBase
|
|||
|
||||
/// \todo investigate, if we really need to expose every single lousy UI element to the outside world
|
||||
virtual MWGui::DialogueWindow* getDialogueWindow() = 0;
|
||||
virtual MWGui::ContainerWindow* getContainerWindow() = 0;
|
||||
virtual MWGui::InventoryWindow* getInventoryWindow() = 0;
|
||||
virtual MWGui::BookWindow* getBookWindow() = 0;
|
||||
virtual MWGui::ScrollWindow* getScrollWindow() = 0;
|
||||
virtual MWGui::CountDialog* getCountDialog() = 0;
|
||||
virtual MWGui::ConfirmationDialog* getConfirmationDialog() = 0;
|
||||
virtual MWGui::TradeWindow* getTradeWindow() = 0;
|
||||
virtual MWGui::SpellBuyingWindow* getSpellBuyingWindow() = 0;
|
||||
virtual MWGui::TravelWindow* getTravelWindow() = 0;
|
||||
virtual MWGui::SpellWindow* getSpellWindow() = 0;
|
||||
virtual MWGui::Console* getConsole() = 0;
|
||||
|
||||
virtual void updateSpellWindow() = 0;
|
||||
|
||||
virtual void setConsoleSelectedObject(const MWWorld::Ptr& object) = 0;
|
||||
|
||||
virtual void wmUpdateFps(float fps, unsigned int triangleCount, unsigned int batchCount) = 0;
|
||||
|
||||
|
@ -181,12 +178,6 @@ namespace MWBase
|
|||
virtual void configureSkills (const SkillList& major, const SkillList& minor) = 0;
|
||||
///< configure skill groups, each set contains the skill ID for that group.
|
||||
|
||||
virtual void setReputation (int reputation) = 0;
|
||||
///< set the current reputation value
|
||||
|
||||
virtual void setBounty (int bounty) = 0;
|
||||
///< set the current bounty value
|
||||
|
||||
virtual void updateSkillArea() = 0;
|
||||
///< update display of skills, factions, birth sign, reputation and bounty
|
||||
|
||||
|
@ -303,6 +294,12 @@ namespace MWBase
|
|||
virtual void startTraining(MWWorld::Ptr actor) = 0;
|
||||
virtual void startRepair(MWWorld::Ptr actor) = 0;
|
||||
virtual void startRepairItem(MWWorld::Ptr item) = 0;
|
||||
virtual void startTravel(const MWWorld::Ptr& actor) = 0;
|
||||
virtual void startSpellBuying(const MWWorld::Ptr& actor) = 0;
|
||||
virtual void startTrade(const MWWorld::Ptr& actor) = 0;
|
||||
virtual void openContainer(const MWWorld::Ptr& container, bool loot) = 0;
|
||||
virtual void showBook(const MWWorld::Ptr& item, bool showTakeButton) = 0;
|
||||
virtual void showScroll(const MWWorld::Ptr& item, bool showTakeButton) = 0;
|
||||
|
||||
virtual void showSoulgemDialog (MWWorld::Ptr item) = 0;
|
||||
|
||||
|
@ -332,9 +329,8 @@ namespace MWBase
|
|||
/// Does the current stack of GUI-windows permit saving?
|
||||
virtual bool isSavingAllowed() const = 0;
|
||||
|
||||
/// Returns the current Modal
|
||||
/** Used to send exit command to active Modal when Esc is pressed **/
|
||||
virtual MWGui::WindowModal* getCurrentModal() const = 0;
|
||||
/// Send exit command to active Modal window
|
||||
virtual void exitCurrentModal() = 0;
|
||||
|
||||
/// Sets the current Modal
|
||||
/** Used to send exit command to active Modal when Esc is pressed **/
|
||||
|
|
|
@ -49,7 +49,7 @@ namespace MWRender
|
|||
|
||||
namespace MWMechanics
|
||||
{
|
||||
class Movement;
|
||||
struct Movement;
|
||||
}
|
||||
|
||||
namespace MWWorld
|
||||
|
@ -205,10 +205,8 @@ namespace MWBase
|
|||
///< Return a pointer to a liveCellRef which contains \a ptr.
|
||||
/// \note Search is limited to the active cells.
|
||||
|
||||
/// \todo enable reference in the OGRE scene
|
||||
virtual void enable (const MWWorld::Ptr& ptr) = 0;
|
||||
|
||||
/// \todo disable reference in the OGRE scene
|
||||
virtual void disable (const MWWorld::Ptr& ptr) = 0;
|
||||
|
||||
virtual void advanceTime (double hours) = 0;
|
||||
|
|
|
@ -155,7 +155,7 @@ namespace MWClass
|
|||
|
||||
bool Apparatus::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Apparatus;
|
||||
return (npcServices & ESM::NPC::Apparatus) != 0;
|
||||
}
|
||||
|
||||
float Apparatus::getWeight(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -154,9 +154,9 @@ namespace MWClass
|
|||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
float iWeight = gmst.find (typeGmst)->getInt();
|
||||
float iWeight = floor(gmst.find(typeGmst)->getFloat());
|
||||
|
||||
float epsilon = 5e-4;
|
||||
float epsilon = 0.0005f;
|
||||
|
||||
if (ref->mBase->mData.mWeight == 0)
|
||||
return ESM::Skill::Unarmored;
|
||||
|
@ -262,7 +262,7 @@ namespace MWClass
|
|||
|
||||
info.enchant = ref->mBase->mEnchant;
|
||||
if (!info.enchant.empty())
|
||||
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
|
||||
info.remainingEnchantCharge = static_cast<int>(ptr.getCellRef().getEnchantmentCharge());
|
||||
|
||||
info.text = text;
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ namespace MWClass
|
|||
|
||||
info.enchant = ref->mBase->mEnchant;
|
||||
if (!info.enchant.empty())
|
||||
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
|
||||
info.remainingEnchantCharge = static_cast<int>(ptr.getCellRef().getEnchantmentCharge());
|
||||
|
||||
info.text = text;
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
|
||||
#include "creature.hpp"
|
||||
|
||||
#include <openengine/misc/rng.hpp>
|
||||
|
||||
#include <components/esm/loadcrea.hpp>
|
||||
#include <components/esm/creaturestate.hpp>
|
||||
|
||||
|
@ -103,9 +105,9 @@ namespace MWClass
|
|||
data->mCreatureStats.setAttribute(ESM::Attribute::Endurance, ref->mBase->mData.mEndurance);
|
||||
data->mCreatureStats.setAttribute(ESM::Attribute::Personality, ref->mBase->mData.mPersonality);
|
||||
data->mCreatureStats.setAttribute(ESM::Attribute::Luck, ref->mBase->mData.mLuck);
|
||||
data->mCreatureStats.setHealth (ref->mBase->mData.mHealth);
|
||||
data->mCreatureStats.setMagicka (ref->mBase->mData.mMana);
|
||||
data->mCreatureStats.setFatigue (ref->mBase->mData.mFatigue);
|
||||
data->mCreatureStats.setHealth(static_cast<float>(ref->mBase->mData.mHealth));
|
||||
data->mCreatureStats.setMagicka(static_cast<float>(ref->mBase->mData.mMana));
|
||||
data->mCreatureStats.setFatigue(static_cast<float>(ref->mBase->mData.mFatigue));
|
||||
|
||||
data->mCreatureStats.setLevel(ref->mBase->mData.mLevel);
|
||||
|
||||
|
@ -164,7 +166,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||
|
||||
MWRender::Actors& actors = renderingInterface.getActors();
|
||||
actors.insertCreature(ptr, model, ref->mBase->mFlags & ESM::Creature::Weapon);
|
||||
actors.insertCreature(ptr, model, (ref->mBase->mFlags & ESM::Creature::Weapon) != 0);
|
||||
}
|
||||
|
||||
void Creature::insertObject(const MWWorld::Ptr& ptr, const std::string& model, MWWorld::PhysicsSystem& physics) const
|
||||
|
@ -249,7 +251,7 @@ namespace MWClass
|
|||
|
||||
float hitchance = MWMechanics::getHitChance(ptr, victim, ref->mBase->mData.mCombat);
|
||||
|
||||
if((::rand()/(RAND_MAX+1.0)) > hitchance/100.0f)
|
||||
if(OEngine::Misc::Rng::rollProbability() >= hitchance/100.0f)
|
||||
{
|
||||
victim.getClass().onHit(victim, 0.0f, false, MWWorld::Ptr(), ptr, false);
|
||||
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
|
||||
|
@ -288,9 +290,7 @@ namespace MWClass
|
|||
if(attack)
|
||||
{
|
||||
damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength());
|
||||
damage *= gmst.find("fDamageStrengthBase")->getFloat() +
|
||||
(stats.getAttribute(ESM::Attribute::Strength).getModified() * gmst.find("fDamageStrengthMult")->getFloat() * 0.1);
|
||||
MWMechanics::adjustWeaponDamage(damage, weapon);
|
||||
MWMechanics::adjustWeaponDamage(damage, weapon, ptr);
|
||||
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
|
||||
}
|
||||
|
||||
|
@ -355,7 +355,7 @@ namespace MWClass
|
|||
if(!object.isEmpty())
|
||||
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
|
||||
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
const std::string &script = ptr.get<ESM::Creature>()->mBase->mScript;
|
||||
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
|
||||
|
@ -376,9 +376,8 @@ namespace MWClass
|
|||
// Check for knockdown
|
||||
float agilityTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified() * getGmst().fKnockDownMult->getFloat();
|
||||
float knockdownTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified()
|
||||
* getGmst().iKnockDownOddsMult->getInt() * 0.01 + getGmst().iKnockDownOddsBase->getInt();
|
||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||
if (ishealth && agilityTerm <= damage && knockdownTerm <= roll)
|
||||
* getGmst().iKnockDownOddsMult->getInt() * 0.01f + getGmst().iKnockDownOddsBase->getInt();
|
||||
if (ishealth && agilityTerm <= damage && knockdownTerm <= OEngine::Misc::Rng::roll0to99())
|
||||
{
|
||||
getCreatureStats(ptr).setKnockedDown(true);
|
||||
|
||||
|
@ -493,7 +492,7 @@ namespace MWClass
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::Creature> *ref = ptr.get<ESM::Creature>();
|
||||
|
||||
return (ref->mBase->mFlags & ESM::Creature::Weapon);
|
||||
return (ref->mBase->mFlags & ESM::Creature::Weapon) != 0;
|
||||
}
|
||||
|
||||
std::string Creature::getScript (const MWWorld::Ptr& ptr) const
|
||||
|
@ -508,7 +507,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return ref->mBase->mFlags & ESM::Creature::Essential;
|
||||
return (ref->mBase->mFlags & ESM::Creature::Essential) != 0;
|
||||
}
|
||||
|
||||
void Creature::registerSelf()
|
||||
|
@ -528,7 +527,7 @@ namespace MWClass
|
|||
MWMechanics::CreatureStats& stats = getCreatureStats(ptr);
|
||||
const GMST& gmst = getGmst();
|
||||
|
||||
float walkSpeed = gmst.fMinWalkSpeedCreature->getFloat() + 0.01 * stats.getAttribute(ESM::Attribute::Speed).getModified()
|
||||
float walkSpeed = gmst.fMinWalkSpeedCreature->getFloat() + 0.01f * stats.getAttribute(ESM::Attribute::Speed).getModified()
|
||||
* (gmst.fMaxWalkSpeedCreature->getFloat() - gmst.fMinWalkSpeedCreature->getFloat());
|
||||
|
||||
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
|
@ -626,7 +625,7 @@ namespace MWClass
|
|||
float Creature::getCapacity (const MWWorld::Ptr& ptr) const
|
||||
{
|
||||
const MWMechanics::CreatureStats& stats = getCreatureStats (ptr);
|
||||
return stats.getAttribute(0).getModified()*5;
|
||||
return static_cast<float>(stats.getAttribute(0).getModified() * 5);
|
||||
}
|
||||
|
||||
float Creature::getEncumbrance (const MWWorld::Ptr& ptr) const
|
||||
|
@ -682,7 +681,7 @@ namespace MWClass
|
|||
++sound;
|
||||
}
|
||||
if(!sounds.empty())
|
||||
return sounds[(int)(rand()/(RAND_MAX+1.0)*sounds.size())]->mSound;
|
||||
return sounds[OEngine::Misc::Rng::rollDice(sounds.size())]->mSound;
|
||||
}
|
||||
|
||||
if (type == ESM::SoundGenerator::Land)
|
||||
|
@ -713,7 +712,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::Creature> *ref =
|
||||
ptr.get<ESM::Creature>();
|
||||
|
||||
return ref->mBase->mFlags & ESM::Creature::Flies;
|
||||
return (ref->mBase->mFlags & ESM::Creature::Flies) != 0;
|
||||
}
|
||||
|
||||
bool Creature::canSwim(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -167,19 +167,19 @@ namespace MWClass
|
|||
if (opening)
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->fadeOutSound3D(ptr,
|
||||
closeSound, 0.5);
|
||||
float offset = ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265 * 2.0;
|
||||
closeSound, 0.5f);
|
||||
float offset = ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265f * 2.0f;
|
||||
action->setSoundOffset(offset);
|
||||
action->setSound(openSound);
|
||||
}
|
||||
else
|
||||
{
|
||||
MWBase::Environment::get().getSoundManager()->fadeOutSound3D(ptr,
|
||||
openSound, 0.5);
|
||||
float offset = 1.0 - ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265 * 2.0;
|
||||
openSound, 0.5f);
|
||||
float offset = 1.0f - ptr.getRefData().getLocalRotation().rot[2]/ 3.14159265f * 2.0f;
|
||||
//most if not all door have closing bang somewhere in the middle of the sound,
|
||||
//so we divide offset by two
|
||||
action->setSoundOffset(offset * 0.5);
|
||||
action->setSoundOffset(offset * 0.5f);
|
||||
action->setSound(closeSound);
|
||||
}
|
||||
|
||||
|
|
|
@ -192,7 +192,7 @@ namespace MWClass
|
|||
|
||||
bool Ingredient::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Ingredients;
|
||||
return (npcServices & ESM::NPC::Ingredients) != 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace MWClass
|
|||
assert (ref->mBase != NULL);
|
||||
|
||||
if(!model.empty())
|
||||
physics.addObject(ptr, model, ref->mBase->mData.mFlags & ESM::Light::Carry);
|
||||
physics.addObject(ptr, model, (ref->mBase->mData.mFlags & ESM::Light::Carry) != 0);
|
||||
|
||||
if (!ref->mBase->mSound.empty() && !(ref->mBase->mData.mFlags & ESM::Light::OffDefault))
|
||||
MWBase::Environment::get().getSoundManager()->playSound3D(ptr, ref->mBase->mSound, 1.0, 1.0,
|
||||
|
@ -205,7 +205,7 @@ namespace MWClass
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::Light> *ref = ptr.get<ESM::Light>();
|
||||
if (ptr.getCellRef().getCharge() == -1)
|
||||
return ref->mBase->mData.mTime;
|
||||
return static_cast<float>(ref->mBase->mData.mTime);
|
||||
else
|
||||
return ptr.getCellRef().getChargeFloat();
|
||||
}
|
||||
|
@ -221,7 +221,7 @@ namespace MWClass
|
|||
|
||||
bool Light::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Lights;
|
||||
return (npcServices & ESM::NPC::Lights) != 0;
|
||||
}
|
||||
|
||||
float Light::getWeight(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -173,7 +173,7 @@ namespace MWClass
|
|||
|
||||
bool Lockpick::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Picks;
|
||||
return (npcServices & ESM::NPC::Picks) != 0;
|
||||
}
|
||||
|
||||
int Lockpick::getItemMaxHealth (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -259,7 +259,7 @@ namespace MWClass
|
|||
{
|
||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||
ptr.get<ESM::Miscellaneous>();
|
||||
return ref->mBase->mData.mIsKey;
|
||||
return ref->mBase->mData.mIsKey != 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
|
||||
#include <OgreSceneNode.h>
|
||||
|
||||
#include <openengine/misc/rng.hpp>
|
||||
|
||||
#include <components/esm/loadmgef.hpp>
|
||||
#include <components/esm/loadnpc.hpp>
|
||||
#include <components/esm/npcstate.hpp>
|
||||
|
@ -66,12 +68,12 @@ namespace
|
|||
double i = floor(d);
|
||||
d -= i;
|
||||
if(d < 0.5)
|
||||
return i;
|
||||
return static_cast<int>(i);
|
||||
if(d > 0.5)
|
||||
return i + 1.0;
|
||||
return static_cast<int>(i) + 1;
|
||||
if(is_even(i))
|
||||
return i;
|
||||
return i + 1.0;
|
||||
return static_cast<int>(i);
|
||||
return static_cast<int>(i) + 1;
|
||||
}
|
||||
|
||||
void autoCalculateAttributes (const ESM::NPC* npc, MWMechanics::CreatureStats& creatureStats)
|
||||
|
@ -116,7 +118,7 @@ namespace
|
|||
continue;
|
||||
|
||||
// is this a minor or major skill?
|
||||
float add=0.2;
|
||||
float add=0.2f;
|
||||
for (int k=0; k<5; ++k)
|
||||
{
|
||||
if (class_->mData.mSkills[k][0] == j)
|
||||
|
@ -149,7 +151,7 @@ namespace
|
|||
|| class_->mData.mAttribute[1] == ESM::Attribute::Endurance)
|
||||
multiplier += 1;
|
||||
|
||||
creatureStats.setHealth(static_cast<int> (0.5 * (strength + endurance)) + multiplier * (creatureStats.getLevel() - 1));
|
||||
creatureStats.setHealth(floor(0.5f * (strength + endurance)) + multiplier * (creatureStats.getLevel() - 1));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -279,8 +281,6 @@ namespace MWClass
|
|||
gmst.fKnockDownMult = store.find("fKnockDownMult");
|
||||
gmst.iKnockDownOddsMult = store.find("iKnockDownOddsMult");
|
||||
gmst.iKnockDownOddsBase = store.find("iKnockDownOddsBase");
|
||||
gmst.fDamageStrengthBase = store.find("fDamageStrengthBase");
|
||||
gmst.fDamageStrengthMult = store.find("fDamageStrengthMult");
|
||||
gmst.fCombatArmorMinMult = store.find("fCombatArmorMinMult");
|
||||
|
||||
inited = true;
|
||||
|
@ -475,7 +475,6 @@ namespace MWClass
|
|||
void Npc::hit(const MWWorld::Ptr& ptr, int type) const
|
||||
{
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
const GMST& gmst = getGmst();
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting> &store = world->getStore().get<ESM::GameSetting>();
|
||||
|
||||
|
@ -507,7 +506,7 @@ namespace MWClass
|
|||
if(otherstats.isDead()) // Can't hit dead actors
|
||||
return;
|
||||
|
||||
if(ptr.getRefData().getHandle() == "player")
|
||||
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->setEnemy(victim);
|
||||
|
||||
int weapskill = ESM::Skill::HandToHand;
|
||||
|
@ -516,7 +515,7 @@ namespace MWClass
|
|||
|
||||
float hitchance = MWMechanics::getHitChance(ptr, victim, ptr.getClass().getSkill(ptr, weapskill));
|
||||
|
||||
if((::rand()/(RAND_MAX+1.0)) > hitchance/100.0f)
|
||||
if (OEngine::Misc::Rng::rollProbability() >= hitchance / 100.0f)
|
||||
{
|
||||
othercls.onHit(victim, 0.0f, false, weapon, ptr, false);
|
||||
MWMechanics::reduceWeaponCondition(0.f, false, weapon, ptr);
|
||||
|
@ -538,10 +537,8 @@ namespace MWClass
|
|||
if(attack)
|
||||
{
|
||||
damage = attack[0] + ((attack[1]-attack[0])*stats.getAttackStrength());
|
||||
damage *= gmst.fDamageStrengthBase->getFloat() +
|
||||
(stats.getAttribute(ESM::Attribute::Strength).getModified() * gmst.fDamageStrengthMult->getFloat() * 0.1);
|
||||
}
|
||||
MWMechanics::adjustWeaponDamage(damage, weapon);
|
||||
MWMechanics::adjustWeaponDamage(damage, weapon, ptr);
|
||||
MWMechanics::reduceWeaponCondition(damage, true, weapon, ptr);
|
||||
healthdmg = true;
|
||||
}
|
||||
|
@ -549,7 +546,7 @@ namespace MWClass
|
|||
{
|
||||
MWMechanics::getHandToHandDamage(ptr, victim, damage, healthdmg);
|
||||
}
|
||||
if(ptr.getRefData().getHandle() == "player")
|
||||
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
skillUsageSucceeded(ptr, weapskill, 0);
|
||||
|
||||
|
@ -625,7 +622,7 @@ namespace MWClass
|
|||
if(!object.isEmpty())
|
||||
getCreatureStats(ptr).setLastHitObject(object.getClass().getId(object));
|
||||
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker.getRefData().getHandle() == "player")
|
||||
if(setOnPcHitMe && !attacker.isEmpty() && attacker == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
{
|
||||
const std::string &script = ptr.getClass().getScript(ptr);
|
||||
/* Set the OnPCHitMe script variable. The script is responsible for clearing it. */
|
||||
|
@ -648,8 +645,7 @@ namespace MWClass
|
|||
const GMST& gmst = getGmst();
|
||||
|
||||
int chance = store.get<ESM::GameSetting>().find("iVoiceHitOdds")->getInt();
|
||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||
if (roll < chance)
|
||||
if (OEngine::Misc::Rng::roll0to99() < chance)
|
||||
{
|
||||
MWBase::Environment::get().getDialogueManager()->say(ptr, "hit");
|
||||
}
|
||||
|
@ -657,9 +653,8 @@ namespace MWClass
|
|||
// Check for knockdown
|
||||
float agilityTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified() * gmst.fKnockDownMult->getFloat();
|
||||
float knockdownTerm = getCreatureStats(ptr).getAttribute(ESM::Attribute::Agility).getModified()
|
||||
* gmst.iKnockDownOddsMult->getInt() * 0.01 + gmst.iKnockDownOddsBase->getInt();
|
||||
roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||
if (ishealth && agilityTerm <= damage && knockdownTerm <= roll)
|
||||
* gmst.iKnockDownOddsMult->getInt() * 0.01f + gmst.iKnockDownOddsBase->getInt();
|
||||
if (ishealth && agilityTerm <= damage && knockdownTerm <= OEngine::Misc::Rng::roll0to99())
|
||||
{
|
||||
getCreatureStats(ptr).setKnockedDown(true);
|
||||
|
||||
|
@ -685,12 +680,12 @@ namespace MWClass
|
|||
MWWorld::InventoryStore::Slot_RightPauldron, MWWorld::InventoryStore::Slot_RightPauldron,
|
||||
MWWorld::InventoryStore::Slot_LeftGauntlet, MWWorld::InventoryStore::Slot_RightGauntlet
|
||||
};
|
||||
int hitslot = hitslots[(int)(::rand()/(RAND_MAX+1.0)*20.0)];
|
||||
int hitslot = hitslots[OEngine::Misc::Rng::rollDice(20)];
|
||||
|
||||
float unmitigatedDamage = damage;
|
||||
float x = damage / (damage + getArmorRating(ptr));
|
||||
damage *= std::max(gmst.fCombatArmorMinMult->getFloat(), x);
|
||||
int damageDiff = unmitigatedDamage - damage;
|
||||
int damageDiff = static_cast<int>(unmitigatedDamage - damage);
|
||||
if (damage < 1)
|
||||
damage = 1;
|
||||
|
||||
|
@ -708,7 +703,7 @@ namespace MWClass
|
|||
if (armorhealth == 0)
|
||||
armor = *inv.unequipItem(armor, ptr);
|
||||
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
skillUsageSucceeded(ptr, armor.getClass().getEquipmentSkill(armor), 0);
|
||||
|
||||
switch(armor.getClass().getEquipmentSkill(armor))
|
||||
|
@ -724,7 +719,7 @@ namespace MWClass
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if(ptr.getRefData().getHandle() == "player")
|
||||
else if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
skillUsageSucceeded(ptr, ESM::Skill::Unarmored, 0);
|
||||
}
|
||||
}
|
||||
|
@ -737,7 +732,7 @@ namespace MWClass
|
|||
if(damage > 0.0f)
|
||||
{
|
||||
sndMgr->playSound3D(ptr, "Health Damage", 1.0f, 1.0f);
|
||||
if (ptr.getRefData().getHandle() == "player")
|
||||
if (ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
MWBase::Environment::get().getWindowManager()->activateHitOverlay();
|
||||
}
|
||||
float health = getCreatureStats(ptr).getHealth().getCurrent() - damage;
|
||||
|
@ -815,7 +810,7 @@ namespace MWClass
|
|||
const MWWorld::Ptr& actor) const
|
||||
{
|
||||
// player got activated by another NPC
|
||||
if(ptr.getRefData().getHandle() == "player")
|
||||
if(ptr == MWBase::Environment::get().getWorld()->getPlayerPtr())
|
||||
return boost::shared_ptr<MWWorld::Action>(new MWWorld::ActionTalk(actor));
|
||||
|
||||
// Werewolfs can't activate NPCs
|
||||
|
@ -938,7 +933,7 @@ namespace MWClass
|
|||
gmst.fJumpEncumbranceMultiplier->getFloat() *
|
||||
(1.0f - Npc::getEncumbrance(ptr)/Npc::getCapacity(ptr));
|
||||
|
||||
float a = npcdata->mNpcStats.getSkill(ESM::Skill::Acrobatics).getModified();
|
||||
float a = static_cast<float>(npcdata->mNpcStats.getSkill(ESM::Skill::Acrobatics).getModified());
|
||||
float b = 0.0f;
|
||||
if(a > 50.0f)
|
||||
{
|
||||
|
@ -993,7 +988,7 @@ namespace MWClass
|
|||
MWWorld::LiveCellRef<ESM::NPC> *ref =
|
||||
ptr.get<ESM::NPC>();
|
||||
|
||||
return ref->mBase->mFlags & ESM::NPC::Essential;
|
||||
return (ref->mBase->mFlags & ESM::NPC::Essential) != 0;
|
||||
}
|
||||
|
||||
void Npc::registerSelf()
|
||||
|
@ -1097,7 +1092,7 @@ namespace MWClass
|
|||
if (it == invStore.end() || it->getTypeName() != typeid(ESM::Armor).name())
|
||||
{
|
||||
// unarmored
|
||||
ratings[i] = (fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill);
|
||||
ratings[i] = static_cast<int>((fUnarmoredBase1 * unarmoredSkill) * (fUnarmoredBase2 * unarmoredSkill));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
namespace ESM
|
||||
{
|
||||
class GameSetting;
|
||||
struct GameSetting;
|
||||
}
|
||||
|
||||
namespace MWClass
|
||||
|
@ -38,8 +38,6 @@ namespace MWClass
|
|||
const ESM::GameSetting *fKnockDownMult;
|
||||
const ESM::GameSetting *iKnockDownOddsMult;
|
||||
const ESM::GameSetting *iKnockDownOddsBase;
|
||||
const ESM::GameSetting *fDamageStrengthBase;
|
||||
const ESM::GameSetting *fDamageStrengthMult;
|
||||
const ESM::GameSetting *fCombatArmorMinMult;
|
||||
};
|
||||
|
||||
|
|
|
@ -185,7 +185,7 @@ namespace MWClass
|
|||
|
||||
bool Potion::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Potions;
|
||||
return (npcServices & ESM::NPC::Potions) != 0;
|
||||
}
|
||||
|
||||
float Potion::getWeight(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace MWClass
|
|||
|
||||
bool Probe::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::Probes;
|
||||
return (npcServices & ESM::NPC::Probes) != 0;
|
||||
}
|
||||
|
||||
int Probe::getItemMaxHealth (const MWWorld::Ptr& ptr) const
|
||||
|
|
|
@ -172,7 +172,7 @@ namespace MWClass
|
|||
|
||||
bool Repair::canSell (const MWWorld::Ptr& item, int npcServices) const
|
||||
{
|
||||
return npcServices & ESM::NPC::RepairItem;
|
||||
return (npcServices & ESM::NPC::RepairItem) != 0;
|
||||
}
|
||||
|
||||
float Repair::getWeight(const MWWorld::Ptr &ptr) const
|
||||
|
|
|
@ -345,7 +345,7 @@ namespace MWClass
|
|||
info.enchant = ref->mBase->mEnchant;
|
||||
|
||||
if (!info.enchant.empty())
|
||||
info.remainingEnchantCharge = ptr.getCellRef().getEnchantmentCharge();
|
||||
info.remainingEnchantCharge = static_cast<int>(ptr.getCellRef().getEnchantmentCharge());
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getFullHelp()) {
|
||||
text += MWGui::ToolTips::getCellRefString(ptr.getCellRef());
|
||||
|
|
|
@ -179,11 +179,8 @@ namespace MWDialogue
|
|||
bool isCompanion = !mActor.getClass().getScript(mActor).empty()
|
||||
&& mActor.getRefData().getLocals().getIntVar(mActor.getClass().getScript(mActor), "companion");
|
||||
if (isCompanion)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(MWGui::GM_Companion);
|
||||
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mActor);
|
||||
}
|
||||
}
|
||||
|
||||
bool DialogueManager::compile (const std::string& cmd,std::vector<Interpreter::Type_Code>& code)
|
||||
{
|
||||
|
@ -383,7 +380,8 @@ namespace MWDialogue
|
|||
|| services & ESM::NPC::Misc)
|
||||
windowServices |= MWGui::DialogueWindow::Service_Trade;
|
||||
|
||||
if(mActor.getTypeName() == typeid(ESM::NPC).name() && !mActor.get<ESM::NPC>()->mBase->mTransport.empty())
|
||||
if((mActor.getTypeName() == typeid(ESM::NPC).name() && !mActor.get<ESM::NPC>()->mBase->getTransport().empty())
|
||||
|| (mActor.getTypeName() == typeid(ESM::Creature).name() && !mActor.get<ESM::Creature>()->mBase->getTransport().empty()))
|
||||
windowServices |= MWGui::DialogueWindow::Service_Travel;
|
||||
|
||||
if (services & ESM::NPC::Spells)
|
||||
|
@ -444,7 +442,7 @@ namespace MWDialogue
|
|||
if (mActor.getClass().isNpc())
|
||||
{
|
||||
MWMechanics::NpcStats& npcStats = mActor.getClass().getNpcStats(mActor);
|
||||
npcStats.setBaseDisposition(npcStats.getBaseDisposition() + mPermanentDispositionChange);
|
||||
npcStats.setBaseDisposition(static_cast<int>(npcStats.getBaseDisposition() + mPermanentDispositionChange));
|
||||
}
|
||||
mPermanentDispositionChange = 0;
|
||||
mTemporaryDispositionChange = 0;
|
||||
|
@ -521,7 +519,7 @@ namespace MWDialogue
|
|||
mPermanentDispositionChange += perm;
|
||||
|
||||
// change temp disposition so that final disposition is between 0...100
|
||||
int curDisp = MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor);
|
||||
float curDisp = static_cast<float>(MWBase::Environment::get().getMechanicsManager()->getDerivedDisposition(mActor));
|
||||
if (curDisp + mTemporaryDispositionChange < 0)
|
||||
mTemporaryDispositionChange = -curDisp;
|
||||
else if (curDisp + mTemporaryDispositionChange > 100)
|
||||
|
@ -564,7 +562,7 @@ namespace MWDialogue
|
|||
|
||||
int DialogueManager::getTemporaryDispositionChange() const
|
||||
{
|
||||
return mTemporaryDispositionChange;
|
||||
return static_cast<int>(mTemporaryDispositionChange);
|
||||
}
|
||||
|
||||
void DialogueManager::applyDispositionChange(int delta)
|
||||
|
|
|
@ -41,8 +41,8 @@ void BackgroundImage::adjustSize()
|
|||
|
||||
MyGUI::IntSize screenSize = getSize();
|
||||
|
||||
int leftPadding = std::max(0.0, (screenSize.width - screenSize.height * mAspect) / 2);
|
||||
int topPadding = std::max(0.0, (screenSize.height - screenSize.width / mAspect) / 2);
|
||||
int leftPadding = std::max(0, static_cast<int>(screenSize.width - screenSize.height * mAspect) / 2);
|
||||
int topPadding = std::max(0, static_cast<int>(screenSize.height - screenSize.width / mAspect) / 2);
|
||||
|
||||
mChild->setCoord(leftPadding, topPadding, screenSize.width - leftPadding*2, screenSize.height - topPadding*2);
|
||||
}
|
||||
|
|
|
@ -16,8 +16,8 @@
|
|||
namespace MWGui
|
||||
{
|
||||
struct TypesetBookImpl;
|
||||
struct PageDisplay;
|
||||
struct BookPageImpl;
|
||||
class PageDisplay;
|
||||
class BookPageImpl;
|
||||
|
||||
static bool ucsSpace (int codePoint);
|
||||
static bool ucsLineBreak (int codePoint);
|
||||
|
@ -326,7 +326,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||
mLine = NULL;
|
||||
}
|
||||
|
||||
void sectionBreak (float margin)
|
||||
void sectionBreak (int margin)
|
||||
{
|
||||
add_partial_text();
|
||||
|
||||
|
@ -465,7 +465,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||
{
|
||||
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
|
||||
if (gi)
|
||||
space_width += gi->advance + gi->bearingX;
|
||||
space_width += static_cast<int>(gi->advance + gi->bearingX);
|
||||
stream.consume ();
|
||||
}
|
||||
|
||||
|
@ -475,7 +475,7 @@ struct TypesetBookImpl::Typesetter : BookTypesetter
|
|||
{
|
||||
MyGUI::GlyphInfo* gi = style->mFont->getGlyphInfo (stream.peek ());
|
||||
if (gi)
|
||||
word_width += gi->advance + gi->bearingX;
|
||||
word_width += static_cast<int>(gi->advance + gi->bearingX);
|
||||
stream.consume ();
|
||||
}
|
||||
|
||||
|
@ -623,15 +623,15 @@ namespace
|
|||
|
||||
RenderXform (MyGUI::ICroppedRectangle* croppedParent, MyGUI::RenderTargetInfo const & renderTargetInfo)
|
||||
{
|
||||
clipTop = croppedParent->_getMarginTop ();
|
||||
clipLeft = croppedParent->_getMarginLeft ();
|
||||
clipRight = croppedParent->getWidth () - croppedParent->_getMarginRight ();
|
||||
clipBottom = croppedParent->getHeight () - croppedParent->_getMarginBottom ();
|
||||
clipTop = static_cast<float>(croppedParent->_getMarginTop());
|
||||
clipLeft = static_cast<float>(croppedParent->_getMarginLeft ());
|
||||
clipRight = static_cast<float>(croppedParent->getWidth () - croppedParent->_getMarginRight ());
|
||||
clipBottom = static_cast<float>(croppedParent->getHeight() - croppedParent->_getMarginBottom());
|
||||
|
||||
absoluteLeft = croppedParent->getAbsoluteLeft();
|
||||
absoluteTop = croppedParent->getAbsoluteTop();
|
||||
leftOffset = renderTargetInfo.leftOffset;
|
||||
topOffset = renderTargetInfo.topOffset;
|
||||
absoluteLeft = static_cast<float>(croppedParent->getAbsoluteLeft());
|
||||
absoluteTop = static_cast<float>(croppedParent->getAbsoluteTop());
|
||||
leftOffset = static_cast<float>(renderTargetInfo.leftOffset);
|
||||
topOffset = static_cast<float>(renderTargetInfo.topOffset);
|
||||
|
||||
pixScaleX = renderTargetInfo.pixScaleX;
|
||||
pixScaleY = renderTargetInfo.pixScaleY;
|
||||
|
@ -1136,7 +1136,7 @@ public:
|
|||
|
||||
MyGUI::Colour colour = isActive ? (this_->mItemActive ? run.mStyle->mActiveColour: run.mStyle->mHotColour) : run.mStyle->mNormalColour;
|
||||
|
||||
glyphStream.reset (section.mRect.left + line.mRect.left + run.mLeft, line.mRect.top, colour);
|
||||
glyphStream.reset(static_cast<float>(section.mRect.left + line.mRect.left + run.mLeft), static_cast<float>(line.mRect.top), colour);
|
||||
|
||||
Utf8Stream stream (run.mRange);
|
||||
|
||||
|
@ -1164,7 +1164,7 @@ public:
|
|||
|
||||
RenderXform renderXform (mCroppedParent, textFormat.mRenderItem->getRenderTarget()->getInfo());
|
||||
|
||||
GlyphStream glyphStream (textFormat.mFont, mCoord.left, mCoord.top-mViewTop,
|
||||
GlyphStream glyphStream(textFormat.mFont, static_cast<float>(mCoord.left), static_cast<float>(mCoord.top - mViewTop),
|
||||
-1 /*mNode->getNodeDepth()*/, vertices, renderXform);
|
||||
|
||||
int visit_top = (std::max) (mViewTop, mViewTop + int (renderXform.clipTop ));
|
||||
|
|
|
@ -71,7 +71,7 @@ namespace MWGui
|
|||
/// to begin when additional text is inserted. Pagination attempts to keep
|
||||
/// sections together on a single page. The margin parameter adds additional space
|
||||
/// before the next line of text.
|
||||
virtual void sectionBreak (float margin = 0) = 0;
|
||||
virtual void sectionBreak (int margin = 0) = 0;
|
||||
|
||||
/// Changes the alignment for the current section of text.
|
||||
virtual void setSectionAlignment (Alignment sectionAlignment) = 0;
|
||||
|
|
|
@ -73,7 +73,7 @@ namespace MWGui
|
|||
mPages.clear();
|
||||
}
|
||||
|
||||
void BookWindow::open (MWWorld::Ptr book)
|
||||
void BookWindow::open (MWWorld::Ptr book, bool showTakeButton)
|
||||
{
|
||||
mBook = book;
|
||||
|
||||
|
@ -90,7 +90,7 @@ namespace MWGui
|
|||
|
||||
updatePages();
|
||||
|
||||
setTakeButtonShow(true);
|
||||
setTakeButtonShow(showTakeButton);
|
||||
}
|
||||
|
||||
void BookWindow::exit()
|
||||
|
|
|
@ -16,10 +16,7 @@ namespace MWGui
|
|||
|
||||
virtual void exit();
|
||||
|
||||
void open(MWWorld::Ptr book);
|
||||
void setTakeButtonShow(bool show);
|
||||
void nextPage();
|
||||
void prevPage();
|
||||
void open(MWWorld::Ptr book, bool showTakeButton);
|
||||
void setInventoryAllowed(bool allowed);
|
||||
|
||||
protected:
|
||||
|
@ -28,6 +25,10 @@ namespace MWGui
|
|||
void onCloseButtonClicked (MyGUI::Widget* sender);
|
||||
void onTakeButtonClicked (MyGUI::Widget* sender);
|
||||
void onMouseWheel(MyGUI::Widget* _sender, int _rel);
|
||||
void setTakeButtonShow(bool show);
|
||||
|
||||
void nextPage();
|
||||
void prevPage();
|
||||
|
||||
void updatePages();
|
||||
void clearPages();
|
||||
|
|
|
@ -330,20 +330,7 @@ namespace MWGui
|
|||
|
||||
updatePlayerHealth();
|
||||
|
||||
//TODO This bit gets repeated a few times; wrap it in a function
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else if (mCreationStage >= CSE_ClassChosen)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_ClassChosen;
|
||||
}
|
||||
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
||||
}
|
||||
|
||||
void CharacterCreation::onPickClassDialogBack()
|
||||
|
@ -397,19 +384,7 @@ namespace MWGui
|
|||
mNameDialog = 0;
|
||||
}
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else if (mCreationStage >= CSE_NameChosen)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Race);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_NameChosen;
|
||||
}
|
||||
handleDialogDone(CSE_NameChosen, GM_Race);
|
||||
}
|
||||
|
||||
void CharacterCreation::onRaceDialogBack()
|
||||
|
@ -456,19 +431,7 @@ namespace MWGui
|
|||
|
||||
updatePlayerHealth();
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else if (mCreationStage >= CSE_RaceChosen)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Class);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_RaceChosen;
|
||||
}
|
||||
handleDialogDone(CSE_RaceChosen, GM_Class);
|
||||
}
|
||||
|
||||
void CharacterCreation::onBirthSignDialogDone(WindowBase* parWindow)
|
||||
|
@ -484,15 +447,7 @@ namespace MWGui
|
|||
|
||||
updatePlayerHealth();
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
if (mCreationStage >= CSE_BirthSignChosen)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_BirthSignChosen;
|
||||
}
|
||||
handleDialogDone(CSE_BirthSignChosen, GM_Review);
|
||||
}
|
||||
|
||||
void CharacterCreation::onBirthSignDialogBack()
|
||||
|
@ -543,19 +498,7 @@ namespace MWGui
|
|||
|
||||
updatePlayerHealth();
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else if (mCreationStage >= CSE_ClassChosen)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_ClassChosen;
|
||||
}
|
||||
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
||||
}
|
||||
|
||||
void CharacterCreation::onCreateClassDialogBack()
|
||||
|
@ -711,19 +654,7 @@ namespace MWGui
|
|||
|
||||
updatePlayerHealth();
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else if (mCreationStage >= CSE_ClassChosen)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Birth);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = CSE_ClassChosen;
|
||||
}
|
||||
handleDialogDone(CSE_ClassChosen, GM_Birth);
|
||||
}
|
||||
|
||||
CharacterCreation::~CharacterCreation()
|
||||
|
@ -739,4 +670,20 @@ namespace MWGui
|
|||
delete mReviewDialog;
|
||||
}
|
||||
|
||||
void CharacterCreation::handleDialogDone(CSE currentStage, int nextMode)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->popGuiMode();
|
||||
if (mCreationStage == CSE_ReviewNext)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Review);
|
||||
}
|
||||
else if (mCreationStage >= currentStage)
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode((GuiMode)nextMode);
|
||||
}
|
||||
else
|
||||
{
|
||||
mCreationStage = currentStage;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,6 +104,8 @@ namespace MWGui
|
|||
};
|
||||
|
||||
CSE mCreationStage; // Which state the character creating is in, controls back/next/ok buttons
|
||||
|
||||
void handleDialogDone(CSE currentStage, int nextMode);
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ void CompanionWindow::updateEncumbranceBar()
|
|||
return;
|
||||
float capacity = mPtr.getClass().getCapacity(mPtr);
|
||||
float encumbrance = mPtr.getClass().getEncumbrance(mPtr);
|
||||
mEncumbranceBar->setValue(encumbrance, capacity);
|
||||
mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity));
|
||||
|
||||
if (mModel && mModel->hasProfit(mPtr))
|
||||
{
|
||||
|
|
|
@ -9,8 +9,8 @@ namespace MWGui
|
|||
{
|
||||
|
||||
ControllerRepeatEvent::ControllerRepeatEvent() :
|
||||
mInit(0.5),
|
||||
mStep(0.1),
|
||||
mInit(0.5f),
|
||||
mStep(0.1f),
|
||||
mEnabled(true),
|
||||
mTimeLeft(0)
|
||||
{
|
||||
|
|
|
@ -7,12 +7,14 @@
|
|||
#include <MyGUI_ProgressBar.h>
|
||||
|
||||
#include <components/widgets/list.hpp>
|
||||
#include <components/translation/translation.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
#include "../mwbase/soundmanager.hpp"
|
||||
#include "../mwbase/dialoguemanager.hpp"
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
|
@ -20,12 +22,7 @@
|
|||
#include "../mwworld/containerstore.hpp"
|
||||
#include "../mwworld/esmstore.hpp"
|
||||
|
||||
#include "../mwdialogue/dialoguemanagerimp.hpp"
|
||||
|
||||
#include "widgets.hpp"
|
||||
#include "tradewindow.hpp"
|
||||
#include "spellbuyingwindow.hpp"
|
||||
#include "travelwindow.hpp"
|
||||
#include "bookpage.hpp"
|
||||
|
||||
#include "journalbooks.hpp" // to_utf8_span
|
||||
|
@ -337,54 +334,28 @@ namespace MWGui
|
|||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
if (topic == gmst.find("sPersuasion")->getString())
|
||||
{
|
||||
mPersuasionDialog.setVisible(true);
|
||||
}
|
||||
else if (topic == gmst.find("sCompanionShare")->getString())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Companion);
|
||||
MWBase::Environment::get().getWindowManager()->showCompanionWindow(mPtr);
|
||||
}
|
||||
else if (!MWBase::Environment::get().getDialogueManager()->checkServiceRefused())
|
||||
{
|
||||
if (topic == gmst.find("sBarter")->getString())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Barter);
|
||||
MWBase::Environment::get().getWindowManager()->getTradeWindow()->startTrade(mPtr);
|
||||
}
|
||||
MWBase::Environment::get().getWindowManager()->startTrade(mPtr);
|
||||
else if (topic == gmst.find("sSpells")->getString())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellBuying);
|
||||
MWBase::Environment::get().getWindowManager()->getSpellBuyingWindow()->startSpellBuying(mPtr);
|
||||
}
|
||||
MWBase::Environment::get().getWindowManager()->startSpellBuying(mPtr);
|
||||
else if (topic == gmst.find("sTravel")->getString())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Travel);
|
||||
MWBase::Environment::get().getWindowManager()->getTravelWindow()->startTravel(mPtr);
|
||||
}
|
||||
MWBase::Environment::get().getWindowManager()->startTravel(mPtr);
|
||||
else if (topic == gmst.find("sSpellMakingMenuTitle")->getString())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_SpellCreation);
|
||||
MWBase::Environment::get().getWindowManager()->startSpellMaking (mPtr);
|
||||
}
|
||||
else if (topic == gmst.find("sEnchanting")->getString())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Enchanting);
|
||||
MWBase::Environment::get().getWindowManager()->startEnchanting (mPtr);
|
||||
}
|
||||
else if (topic == gmst.find("sServiceTrainingTitle")->getString())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Training);
|
||||
MWBase::Environment::get().getWindowManager()->startTraining (mPtr);
|
||||
}
|
||||
else if (topic == gmst.find("sRepair")->getString())
|
||||
{
|
||||
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_MerchantRepair);
|
||||
MWBase::Environment::get().getWindowManager()->startRepair (mPtr);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DialogueWindow::startDialogue(MWWorld::Ptr actor, std::string npcName, bool resetHistory)
|
||||
{
|
||||
|
@ -440,8 +411,6 @@ namespace MWGui
|
|||
bool isCompanion = !mPtr.getClass().getScript(mPtr).empty()
|
||||
&& mPtr.getRefData().getLocals().getIntVar(mPtr.getClass().getScript(mPtr), "companion");
|
||||
|
||||
bool anyService = mServices > 0 || isCompanion || mPtr.getTypeName() == typeid(ESM::NPC).name();
|
||||
|
||||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
|
@ -472,7 +441,7 @@ namespace MWGui
|
|||
if (isCompanion)
|
||||
mTopicsList->addItem(gmst.find("sCompanionShare")->getString());
|
||||
|
||||
if (anyService)
|
||||
if (mTopicsList->getItemCount() > 0)
|
||||
mTopicsList->addSeparator();
|
||||
|
||||
|
||||
|
@ -549,7 +518,7 @@ namespace MWGui
|
|||
size_t range = book->getSize().second - viewHeight;
|
||||
mScrollBar->setScrollRange(range);
|
||||
mScrollBar->setScrollPosition(range-1);
|
||||
mScrollBar->setTrackSize(viewHeight / static_cast<float>(book->getSize().second) * mScrollBar->getLineSize());
|
||||
mScrollBar->setTrackSize(static_cast<int>(viewHeight / static_cast<float>(book->getSize().second) * mScrollBar->getLineSize()));
|
||||
onScrollbarMoved(mScrollBar, range-1);
|
||||
}
|
||||
else
|
||||
|
@ -637,14 +606,14 @@ namespace MWGui
|
|||
if (dispositionVisible && !dispositionWasVisible)
|
||||
{
|
||||
mDispositionBar->setVisible(true);
|
||||
float offset = mDispositionBar->getHeight()+5;
|
||||
int offset = mDispositionBar->getHeight()+5;
|
||||
mTopicsList->setCoord(mTopicsList->getCoord() + MyGUI::IntCoord(0,offset,0,-offset));
|
||||
mTopicsList->adjustSize();
|
||||
}
|
||||
else if (!dispositionVisible && dispositionWasVisible)
|
||||
{
|
||||
mDispositionBar->setVisible(false);
|
||||
float offset = mDispositionBar->getHeight()+5;
|
||||
int offset = mDispositionBar->getHeight()+5;
|
||||
mTopicsList->setCoord(mTopicsList->getCoord() - MyGUI::IntCoord(0,offset,0,-offset));
|
||||
mTopicsList->adjustSize();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "../mwmechanics/npcstats.hpp"
|
||||
|
||||
#include "inventorywindow.hpp"
|
||||
#include "console.hpp"
|
||||
#include "spellicons.hpp"
|
||||
#include "itemmodel.hpp"
|
||||
#include "draganddrop.hpp"
|
||||
|
@ -262,7 +261,7 @@ namespace MWGui
|
|||
|
||||
void HUD::setDrowningTimeLeft(float time, float maxTime)
|
||||
{
|
||||
size_t progress = time/maxTime*200.0;
|
||||
size_t progress = static_cast<size_t>(time / maxTime * 200);
|
||||
mDrowning->setProgressPosition(progress);
|
||||
|
||||
bool isDrowning = (progress == 0);
|
||||
|
@ -309,7 +308,7 @@ namespace MWGui
|
|||
MWWorld::Ptr object = MWBase::Environment::get().getWorld()->getFacedObject();
|
||||
|
||||
if (mode == GM_Console)
|
||||
MWBase::Environment::get().getWindowManager()->getConsole()->setSelectedObject(object);
|
||||
MWBase::Environment::get().getWindowManager()->setConsoleSelectedObject(object);
|
||||
else if ((mode == GM_Container) || (mode == GM_Inventory))
|
||||
{
|
||||
// pick up object
|
||||
|
@ -631,7 +630,7 @@ namespace MWGui
|
|||
mEnemyHealth->setProgressRange(100);
|
||||
// Health is usually cast to int before displaying. Actors die whenever they are < 1 health.
|
||||
// Therefore any value < 1 should show as an empty health bar. We do the same in statswindow :)
|
||||
mEnemyHealth->setProgressPosition(int(stats.getHealth().getCurrent()) / stats.getHealth().getModified() * 100);
|
||||
mEnemyHealth->setProgressPosition(static_cast<size_t>(stats.getHealth().getCurrent() / stats.getHealth().getModified() * 100));
|
||||
|
||||
static const float fNPCHealthBarFade = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find("fNPCHealthBarFade")->getFloat();
|
||||
if (fNPCHealthBarFade > 0.f)
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
#include "../mwbase/scriptmanager.hpp"
|
||||
#include "../mwrender/characterpreview.hpp"
|
||||
|
||||
#include "bookwindow.hpp"
|
||||
#include "scrollwindow.hpp"
|
||||
#include "spellwindow.hpp"
|
||||
#include "itemview.hpp"
|
||||
#include "inventoryitemmodel.hpp"
|
||||
#include "sortfilteritemmodel.hpp"
|
||||
|
@ -101,7 +98,7 @@ namespace MWGui
|
|||
void InventoryWindow::adjustPanes()
|
||||
{
|
||||
const float aspect = 0.5; // fixed aspect ratio for the avatar image
|
||||
float leftPaneWidth = (mMainWidget->getSize().height-44-mArmorRating->getHeight()) * aspect;
|
||||
int leftPaneWidth = static_cast<int>((mMainWidget->getSize().height - 44 - mArmorRating->getHeight()) * aspect);
|
||||
mLeftPane->setSize( leftPaneWidth, mMainWidget->getSize().height-44 );
|
||||
mRightPane->setCoord( mLeftPane->getPosition().left + leftPaneWidth + 4,
|
||||
mRightPane->getPosition().top,
|
||||
|
@ -153,10 +150,10 @@ namespace MWGui
|
|||
}
|
||||
|
||||
MyGUI::IntSize viewSize = MyGUI::RenderManager::getInstance().getViewSize();
|
||||
MyGUI::IntPoint pos (Settings::Manager::getFloat(setting + " x", "Windows") * viewSize.width,
|
||||
Settings::Manager::getFloat(setting + " y", "Windows") * viewSize.height);
|
||||
MyGUI::IntSize size (Settings::Manager::getFloat(setting + " w", "Windows") * viewSize.width,
|
||||
Settings::Manager::getFloat(setting + " h", "Windows") * viewSize.height);
|
||||
MyGUI::IntPoint pos(static_cast<int>(Settings::Manager::getFloat(setting + " x", "Windows") * viewSize.width),
|
||||
static_cast<int>(Settings::Manager::getFloat(setting + " y", "Windows") * viewSize.height));
|
||||
MyGUI::IntSize size(static_cast<int>(Settings::Manager::getFloat(setting + " w", "Windows") * viewSize.width),
|
||||
static_cast<int>(Settings::Manager::getFloat(setting + " h", "Windows") * viewSize.height));
|
||||
|
||||
if (size.width != mMainWidget->getWidth() || size.height != mMainWidget->getHeight())
|
||||
mPreviewResize = true;
|
||||
|
@ -317,8 +314,7 @@ namespace MWGui
|
|||
|
||||
void InventoryWindow::updateItemView()
|
||||
{
|
||||
if (MWBase::Environment::get().getWindowManager()->getSpellWindow())
|
||||
MWBase::Environment::get().getWindowManager()->getSpellWindow()->updateSpells();
|
||||
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
|
||||
|
||||
mItemView->update();
|
||||
mPreviewDirty = true;
|
||||
|
@ -432,13 +428,6 @@ namespace MWGui
|
|||
|
||||
action->execute (MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
||||
// this is necessary for books/scrolls: if they are already in the player's inventory,
|
||||
// the "Take" button should not be visible.
|
||||
// NOTE: the take button is "reset" when the window opens, so we can safely do the following
|
||||
// without screwing up future book windows
|
||||
MWBase::Environment::get().getWindowManager()->getBookWindow()->setTakeButtonShow(false);
|
||||
MWBase::Environment::get().getWindowManager()->getScrollWindow()->setTakeButtonShow(false);
|
||||
|
||||
mSkippedToEquip = MWWorld::Ptr();
|
||||
}
|
||||
else
|
||||
|
@ -519,7 +508,7 @@ namespace MWGui
|
|||
float capacity = player.getClass().getCapacity(player);
|
||||
float encumbrance = player.getClass().getEncumbrance(player);
|
||||
mTradeModel->adjustEncumbrance(encumbrance);
|
||||
mEncumbranceBar->setValue(encumbrance, capacity);
|
||||
mEncumbranceBar->setValue(static_cast<int>(encumbrance), static_cast<int>(capacity));
|
||||
}
|
||||
|
||||
void InventoryWindow::onFrame()
|
||||
|
@ -568,8 +557,7 @@ namespace MWGui
|
|||
void InventoryWindow::notifyContentChanged()
|
||||
{
|
||||
// update the spell window just in case new enchanted items were added to inventory
|
||||
if (MWBase::Environment::get().getWindowManager()->getSpellWindow())
|
||||
MWBase::Environment::get().getWindowManager()->getSpellWindow()->updateSpells();
|
||||
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
|
||||
|
||||
MWBase::Environment::get().getMechanicsManager()->updateMagicEffects(
|
||||
MWBase::Environment::get().getWorld()->getPlayerPtr());
|
||||
|
@ -626,8 +614,7 @@ namespace MWGui
|
|||
|
||||
MWBase::Environment::get().getMechanicsManager()->itemTaken(player, newObject, MWWorld::Ptr(), count);
|
||||
|
||||
if (MWBase::Environment::get().getWindowManager()->getSpellWindow())
|
||||
MWBase::Environment::get().getWindowManager()->getSpellWindow()->updateSpells();
|
||||
MWBase::Environment::get().getWindowManager()->updateSpellWindow();
|
||||
}
|
||||
|
||||
void InventoryWindow::cycle(bool next)
|
||||
|
|
|
@ -141,10 +141,10 @@ void ItemView::onSelectedBackground(MyGUI::Widget *sender)
|
|||
|
||||
void ItemView::onMouseWheel(MyGUI::Widget *_sender, int _rel)
|
||||
{
|
||||
if (mScrollView->getViewOffset().left + _rel*0.3 > 0)
|
||||
if (mScrollView->getViewOffset().left + _rel*0.3f > 0)
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(mScrollView->getViewOffset().left + _rel*0.3, 0));
|
||||
mScrollView->setViewOffset(MyGUI::IntPoint(static_cast<int>(mScrollView->getViewOffset().left + _rel*0.3f), 0));
|
||||
}
|
||||
|
||||
void ItemView::setSize(const MyGUI::IntSize &_value)
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include <MyGUI_ScrollBar.h>
|
||||
|
||||
#include <openengine/misc/rng.hpp>
|
||||
|
||||
#include "../mwbase/windowmanager.hpp"
|
||||
#include "../mwbase/mechanicsmanager.hpp"
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -17,7 +19,7 @@ namespace MWGui
|
|||
{
|
||||
JailScreen::JailScreen()
|
||||
: WindowBase("openmw_jail_screen.layout"),
|
||||
mTimeAdvancer(0.01),
|
||||
mTimeAdvancer(0.01f),
|
||||
mDays(1),
|
||||
mFadeTimeRemaining(0)
|
||||
{
|
||||
|
@ -66,7 +68,7 @@ namespace MWGui
|
|||
void JailScreen::onJailProgressChanged(int cur, int /*total*/)
|
||||
{
|
||||
mProgressBar->setScrollPosition(0);
|
||||
mProgressBar->setTrackSize(cur / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize());
|
||||
mProgressBar->setTrackSize(static_cast<int>(cur / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize()));
|
||||
}
|
||||
|
||||
void JailScreen::onJailFinished()
|
||||
|
@ -83,7 +85,7 @@ namespace MWGui
|
|||
std::set<int> skills;
|
||||
for (int day=0; day<mDays; ++day)
|
||||
{
|
||||
int skill = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * ESM::Skill::Length;
|
||||
int skill = OEngine::Misc::Rng::rollDice(ESM::Skill::Length);
|
||||
skills.insert(skill);
|
||||
|
||||
MWMechanics::SkillValue& value = player.getClass().getNpcStats(player).getSkill(skill);
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include <MyGUI_Gui.h>
|
||||
#include <MyGUI_TextBox.h>
|
||||
|
||||
#include <openengine/misc/rng.hpp>
|
||||
|
||||
#include <components/settings/settings.hpp>
|
||||
|
||||
#include "../mwbase/environment.hpp"
|
||||
|
@ -33,8 +35,8 @@ namespace MWGui
|
|||
: mSceneMgr(sceneMgr)
|
||||
, mWindow(rw)
|
||||
, WindowBase("openmw_loading_screen.layout")
|
||||
, mLastRenderTime(0.f)
|
||||
, mLastWallpaperChangeTime(0.f)
|
||||
, mLastRenderTime(0)
|
||||
, mLastWallpaperChangeTime(0)
|
||||
, mProgress(0)
|
||||
, mVSyncWasEnabled(false)
|
||||
{
|
||||
|
@ -146,7 +148,7 @@ namespace MWGui
|
|||
|
||||
if (!mResources.empty())
|
||||
{
|
||||
std::string const & randomSplash = mResources.at (rand() % mResources.size());
|
||||
std::string const & randomSplash = mResources.at(OEngine::Misc::Rng::rollDice(mResources.size()));
|
||||
|
||||
Ogre::TextureManager::getSingleton ().load (randomSplash, Ogre::ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
|
||||
|
||||
|
@ -173,7 +175,7 @@ namespace MWGui
|
|||
return;
|
||||
mProgress = value;
|
||||
mProgressBar->setScrollPosition(0);
|
||||
mProgressBar->setTrackSize(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize());
|
||||
mProgressBar->setTrackSize(static_cast<int>(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize()));
|
||||
draw();
|
||||
}
|
||||
|
||||
|
@ -182,7 +184,7 @@ namespace MWGui
|
|||
mProgressBar->setScrollPosition(0);
|
||||
size_t value = mProgress + increase;
|
||||
mProgress = value;
|
||||
mProgressBar->setTrackSize(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize());
|
||||
mProgressBar->setTrackSize(static_cast<int>(value / (float)(mProgressBar->getScrollRange()) * mProgressBar->getLineSize()));
|
||||
draw();
|
||||
}
|
||||
|
||||
|
@ -193,7 +195,7 @@ namespace MWGui
|
|||
time = (time-2)*-1;
|
||||
|
||||
mProgressBar->setTrackSize(50);
|
||||
mProgressBar->setScrollPosition(time * (mProgressBar->getScrollRange()-1));
|
||||
mProgressBar->setScrollPosition(static_cast<size_t>(time * (mProgressBar->getScrollRange() - 1)));
|
||||
draw();
|
||||
}
|
||||
|
||||
|
|
|
@ -244,14 +244,14 @@ namespace MWGui
|
|||
// Image space is -Y up, cells are Y up
|
||||
nY = 1 - (worldY - cellSize * cellY) / cellSize;
|
||||
|
||||
float cellDx = cellX - mCurX;
|
||||
float cellDy = cellY - mCurY;
|
||||
float cellDx = static_cast<float>(cellX - mCurX);
|
||||
float cellDy = static_cast<float>(cellY - mCurY);
|
||||
|
||||
markerPos.cellX = cellX;
|
||||
markerPos.cellY = cellY;
|
||||
|
||||
widgetPos = MyGUI::IntPoint(nX * mMapWidgetSize + (1+cellDx) * mMapWidgetSize,
|
||||
nY * mMapWidgetSize - (cellDy-1) * mMapWidgetSize);
|
||||
widgetPos = MyGUI::IntPoint(static_cast<int>(nX * mMapWidgetSize + (1 + cellDx) * mMapWidgetSize),
|
||||
static_cast<int>(nY * mMapWidgetSize - (cellDy-1) * mMapWidgetSize));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -263,8 +263,8 @@ namespace MWGui
|
|||
markerPos.cellY = cellY;
|
||||
|
||||
// Image space is -Y up, cells are Y up
|
||||
widgetPos = MyGUI::IntPoint(nX * mMapWidgetSize + (1+(cellX-mCurX)) * mMapWidgetSize,
|
||||
nY * mMapWidgetSize + (1-(cellY-mCurY)) * mMapWidgetSize);
|
||||
widgetPos = MyGUI::IntPoint(static_cast<int>(nX * mMapWidgetSize + (1 + (cellX - mCurX)) * mMapWidgetSize),
|
||||
static_cast<int>(nY * mMapWidgetSize + (1-(cellY-mCurY)) * mMapWidgetSize));
|
||||
}
|
||||
|
||||
markerPos.nX = nX;
|
||||
|
@ -309,8 +309,8 @@ namespace MWGui
|
|||
markerWidget->setUserString("ToolTipType", "Layout");
|
||||
markerWidget->setUserString("ToolTipLayout", "TextToolTipOneLine");
|
||||
markerWidget->setUserString("Caption_TextOneLine", MyGUI::TextIterator::toTagsString(marker.mNote));
|
||||
markerWidget->setNormalColour(MyGUI::Colour(1.0,0.3,0.3));
|
||||
markerWidget->setHoverColour(MyGUI::Colour(1.0,0.5,0.5));
|
||||
markerWidget->setNormalColour(MyGUI::Colour(1.0f, 0.3f, 0.3f));
|
||||
markerWidget->setHoverColour(MyGUI::Colour(1.0f, 0.5f, 0.5f));
|
||||
markerWidget->setUserData(marker);
|
||||
markerWidget->setNeedMouseFocus(true);
|
||||
customMarkerCreated(markerWidget);
|
||||
|
@ -424,7 +424,7 @@ namespace MWGui
|
|||
|
||||
void LocalMapBase::setPlayerPos(int cellX, int cellY, const float nx, const float ny)
|
||||
{
|
||||
MyGUI::IntPoint pos(mMapWidgetSize+nx*mMapWidgetSize-16, mMapWidgetSize+ny*mMapWidgetSize-16);
|
||||
MyGUI::IntPoint pos(static_cast<int>(mMapWidgetSize + nx*mMapWidgetSize - 16), static_cast<int>(mMapWidgetSize + ny*mMapWidgetSize - 16));
|
||||
pos.left += (cellX - mCurX) * mMapWidgetSize;
|
||||
pos.top -= (cellY - mCurY) * mMapWidgetSize;
|
||||
|
||||
|
@ -435,7 +435,7 @@ namespace MWGui
|
|||
mCompass->setPosition(pos);
|
||||
MyGUI::IntPoint middle (pos.left+16, pos.top+16);
|
||||
MyGUI::IntCoord viewsize = mLocalMap->getCoord();
|
||||
MyGUI::IntPoint viewOffset(0.5*viewsize.width - middle.left, 0.5*viewsize.height - middle.top);
|
||||
MyGUI::IntPoint viewOffset((viewsize.width / 2) - middle.left, (viewsize.height / 2) - middle.top);
|
||||
mLocalMap->setViewOffset(viewOffset);
|
||||
}
|
||||
}
|
||||
|
@ -668,7 +668,7 @@ namespace MWGui
|
|||
else
|
||||
{
|
||||
worldPos.x = (x + nX) * cellSize;
|
||||
worldPos.y = (y + (1.0-nY)) * cellSize;
|
||||
worldPos.y = (y + (1.0f-nY)) * cellSize;
|
||||
}
|
||||
|
||||
mEditingMarker.mWorldX = worldPos.x;
|
||||
|
@ -737,8 +737,8 @@ namespace MWGui
|
|||
int markerSize = 12;
|
||||
int offset = mGlobalMapRender->getCellSize()/2 - markerSize/2;
|
||||
MyGUI::IntCoord widgetCoord(
|
||||
worldX * mGlobalMapRender->getWidth()+offset,
|
||||
worldY * mGlobalMapRender->getHeight()+offset,
|
||||
static_cast<int>(worldX * mGlobalMapRender->getWidth()+offset),
|
||||
static_cast<int>(worldY * mGlobalMapRender->getHeight() + offset),
|
||||
markerSize, markerSize);
|
||||
|
||||
MyGUI::Widget* markerWidget = mGlobalMap->createWidget<MyGUI::Widget>("MarkerButton",
|
||||
|
@ -827,18 +827,7 @@ namespace MWGui
|
|||
if (MWBase::Environment::get().getWorld ()->isCellExterior ())
|
||||
{
|
||||
Ogre::Vector3 pos = MWBase::Environment::get().getWorld ()->getPlayerPtr().getRefData ().getBaseNode ()->_getDerivedPosition ();
|
||||
|
||||
float worldX, worldY;
|
||||
mGlobalMapRender->worldPosToImageSpace (pos.x, pos.y, worldX, worldY);
|
||||
worldX *= mGlobalMapRender->getWidth();
|
||||
worldY *= mGlobalMapRender->getHeight();
|
||||
|
||||
mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(worldX - 16, worldY - 16));
|
||||
|
||||
// set the view offset so that player is in the center
|
||||
MyGUI::IntSize viewsize = mGlobalMap->getSize();
|
||||
MyGUI::IntPoint viewoffs(0.5*viewsize.width - worldX, 0.5*viewsize.height - worldY);
|
||||
mGlobalMap->setViewOffset(viewoffs);
|
||||
setGlobalMapPlayerPosition(pos.x, pos.y);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -854,11 +843,11 @@ namespace MWGui
|
|||
x *= mGlobalMapRender->getWidth();
|
||||
y *= mGlobalMapRender->getHeight();
|
||||
|
||||
mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(x - 16, y - 16));
|
||||
mPlayerArrowGlobal->setPosition(MyGUI::IntPoint(static_cast<int>(x - 16), static_cast<int>(y - 16)));
|
||||
|
||||
// set the view offset so that player is in the center
|
||||
MyGUI::IntSize viewsize = mGlobalMap->getSize();
|
||||
MyGUI::IntPoint viewoffs(0.5*viewsize.width - x, 0.5*viewsize.height - y);
|
||||
MyGUI::IntPoint viewoffs(static_cast<int>(viewsize.width * 0.5f - x), static_cast<int>(viewsize.height *0.5 - y));
|
||||
mGlobalMap->setViewOffset(viewoffs);
|
||||
}
|
||||
|
||||
|
|
|
@ -59,11 +59,11 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
|||
float fRepairMult = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>()
|
||||
.find("fRepairMult")->getFloat();
|
||||
|
||||
float p = std::max(1, basePrice);
|
||||
float r = std::max(1, static_cast<int>(maxDurability / p));
|
||||
float p = static_cast<float>(std::max(1, basePrice));
|
||||
float r = static_cast<float>(std::max(1, static_cast<int>(maxDurability / p)));
|
||||
|
||||
int x = ((maxDurability - durability) / r);
|
||||
x = (fRepairMult * x);
|
||||
int x = static_cast<int>((maxDurability - durability) / r);
|
||||
x = static_cast<int>(fRepairMult * x);
|
||||
|
||||
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(mActor, x, true);
|
||||
|
||||
|
@ -105,10 +105,10 @@ void MerchantRepair::startRepair(const MWWorld::Ptr &actor)
|
|||
|
||||
void MerchantRepair::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||
{
|
||||
if (mList->getViewOffset().top + _rel*0.3 > 0)
|
||||
if (mList->getViewOffset().top + _rel*0.3f > 0)
|
||||
mList->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
mList->setViewOffset(MyGUI::IntPoint(0, mList->getViewOffset().top + _rel*0.3));
|
||||
mList->setViewOffset(MyGUI::IntPoint(0, static_cast<int>(mList->getViewOffset().top + _rel*0.3f)));
|
||||
}
|
||||
|
||||
void MerchantRepair::open()
|
||||
|
|
|
@ -70,7 +70,7 @@ namespace MWGui
|
|||
it = mMessageBoxes.begin();
|
||||
while(it != mMessageBoxes.end())
|
||||
{
|
||||
(*it)->update(height);
|
||||
(*it)->update(static_cast<int>(height));
|
||||
height += (*it)->getHeight();
|
||||
++it;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "pickpocketitemmodel.hpp"
|
||||
|
||||
#include <openengine/misc/rng.hpp>
|
||||
|
||||
#include "../mwmechanics/npcstats.hpp"
|
||||
#include "../mwworld/class.hpp"
|
||||
|
||||
|
@ -12,11 +14,13 @@ namespace MWGui
|
|||
int chance = thief.getClass().getSkill(thief, ESM::Skill::Sneak);
|
||||
|
||||
mSourceModel->update();
|
||||
|
||||
// build list of items that player is unable to find when attempts to pickpocket.
|
||||
if (hideItems)
|
||||
{
|
||||
for (size_t i = 0; i<mSourceModel->getItemCount(); ++i)
|
||||
{
|
||||
if (std::rand() / static_cast<float>(RAND_MAX) * 100 > chance)
|
||||
if (chance <= OEngine::Misc::Rng::roll0to99())
|
||||
mHiddenItems.push_back(mSourceModel->getItem(i));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,17 @@ namespace MWGui
|
|||
while (key->getChildCount()) // Destroy number label
|
||||
MyGUI::Gui::getInstance().destroyWidget(key->getChildAt(0));
|
||||
|
||||
if (index == 9)
|
||||
{
|
||||
mAssigned[index] = Type_HandToHand;
|
||||
|
||||
MyGUI::ImageBox* image = key->createWidget<MyGUI::ImageBox>("ImageBox",
|
||||
MyGUI::IntCoord(14, 13, 32, 32), MyGUI::Align::Default);
|
||||
image->setImageTexture("icons\\k\\stealth_handtohand.dds");
|
||||
image->setNeedMouseFocus(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
mAssigned[index] = Type_Unassigned;
|
||||
|
||||
MyGUI::TextBox* textBox = key->createWidgetReal<MyGUI::TextBox>("SandText", MyGUI::FloatCoord(0,0,1,1), MyGUI::Align::Default);
|
||||
|
@ -101,6 +112,7 @@ namespace MWGui
|
|||
textBox->setCaption (MyGUI::utility::toString(index+1));
|
||||
textBox->setNeedMouseFocus (false);
|
||||
}
|
||||
}
|
||||
|
||||
void QuickKeysMenu::onQuickKeyButtonClicked(MyGUI::Widget* sender)
|
||||
{
|
||||
|
@ -338,6 +350,11 @@ namespace MWGui
|
|||
store.setSelectedEnchantItem(it);
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Spell);
|
||||
}
|
||||
else if (type == Type_HandToHand)
|
||||
{
|
||||
store.unequipSlot(MWWorld::InventoryStore::Slot_CarriedRight, player);
|
||||
MWBase::Environment::get().getWorld()->getPlayer().setDrawState(MWMechanics::DrawState_Weapon);
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------------------------------------
|
||||
|
@ -409,6 +426,7 @@ namespace MWGui
|
|||
switch (type)
|
||||
{
|
||||
case Type_Unassigned:
|
||||
case Type_HandToHand:
|
||||
break;
|
||||
case Type_Item:
|
||||
case Type_MagicItem:
|
||||
|
@ -489,6 +507,7 @@ namespace MWGui
|
|||
break;
|
||||
}
|
||||
case Type_Unassigned:
|
||||
case Type_HandToHand:
|
||||
unassign(button, i);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -37,15 +37,16 @@ namespace MWGui
|
|||
|
||||
void activateQuickKey(int index);
|
||||
|
||||
/// @note This enum is serialized, so don't move the items around!
|
||||
enum QuickKeyType
|
||||
{
|
||||
Type_Item,
|
||||
Type_Magic,
|
||||
Type_MagicItem,
|
||||
Type_Unassigned
|
||||
Type_Unassigned,
|
||||
Type_HandToHand
|
||||
};
|
||||
|
||||
|
||||
void write (ESM::ESMWriter& writer);
|
||||
void readRecord (ESM::ESMReader& reader, uint32_t type);
|
||||
void clear();
|
||||
|
|
|
@ -203,7 +203,7 @@ namespace MWGui
|
|||
|
||||
void RaceDialog::onHeadRotate(MyGUI::ScrollBar* scroll, size_t _position)
|
||||
{
|
||||
float angle = (float(_position) / (scroll->getScrollRange()-1) - 0.5) * 3.14 * 2;
|
||||
float angle = (float(_position) / (scroll->getScrollRange()-1) - 0.5f) * 3.14f * 2;
|
||||
mPreview->update (angle);
|
||||
mPreviewDirty = true;
|
||||
mCurrentAngle = angle;
|
||||
|
@ -404,7 +404,7 @@ namespace MWGui
|
|||
skillWidget = mSkillList->createWidget<Widgets::MWSkill>("MW_StatNameValue", coord1, MyGUI::Align::Default,
|
||||
std::string("Skill") + MyGUI::utility::toString(i));
|
||||
skillWidget->setSkillNumber(skillId);
|
||||
skillWidget->setSkillValue(Widgets::MWSkill::SkillValue(race->mData.mBonus[i].mBonus));
|
||||
skillWidget->setSkillValue(Widgets::MWSkill::SkillValue(static_cast<float>(race->mData.mBonus[i].mBonus)));
|
||||
ToolTips::createSkillToolTip(skillWidget, skillId);
|
||||
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#include <MyGUI_ScrollView.h>
|
||||
#include <MyGUI_Gui.h>
|
||||
|
||||
#include <openengine/misc/rng.hpp>
|
||||
|
||||
#include <components/esm/records.hpp>
|
||||
|
||||
#include "../mwbase/world.hpp"
|
||||
|
@ -119,7 +121,7 @@ void Recharge::updateView()
|
|||
|
||||
Widgets::MWDynamicStatPtr chargeWidget = mView->createWidget<Widgets::MWDynamicStat>
|
||||
("MW_ChargeBar", MyGUI::IntCoord(72, currentY+2, 199, 20), MyGUI::Align::Default);
|
||||
chargeWidget->setValue(iter->getCellRef().getEnchantmentCharge(), enchantment->mData.mCharge);
|
||||
chargeWidget->setValue(static_cast<int>(iter->getCellRef().getEnchantmentCharge()), enchantment->mData.mCharge);
|
||||
chargeWidget->setNeedMouseFocus(false);
|
||||
|
||||
currentY += 32 + 4;
|
||||
|
@ -149,11 +151,11 @@ void Recharge::onItemClicked(MyGUI::Widget *sender)
|
|||
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
|
||||
MWMechanics::NpcStats& npcStats = player.getClass().getNpcStats(player);
|
||||
|
||||
float luckTerm = 0.1 * stats.getAttribute(ESM::Attribute::Luck).getModified();
|
||||
float luckTerm = 0.1f * stats.getAttribute(ESM::Attribute::Luck).getModified();
|
||||
if (luckTerm < 1|| luckTerm > 10)
|
||||
luckTerm = 1;
|
||||
|
||||
float intelligenceTerm = 0.2 * stats.getAttribute(ESM::Attribute::Intelligence).getModified();
|
||||
float intelligenceTerm = 0.2f * stats.getAttribute(ESM::Attribute::Intelligence).getModified();
|
||||
|
||||
if (intelligenceTerm > 20)
|
||||
intelligenceTerm = 20;
|
||||
|
@ -161,7 +163,7 @@ void Recharge::onItemClicked(MyGUI::Widget *sender)
|
|||
intelligenceTerm = 1;
|
||||
|
||||
float x = (npcStats.getSkill(ESM::Skill::Enchant).getModified() + intelligenceTerm + luckTerm) * stats.getFatigueTerm();
|
||||
int roll = std::rand()/ (static_cast<double> (RAND_MAX) + 1) * 100; // [0, 99]
|
||||
int roll = OEngine::Misc::Rng::roll0to99();
|
||||
if (roll < x)
|
||||
{
|
||||
std::string soul = gem.getCellRef().getSoul();
|
||||
|
@ -197,10 +199,10 @@ void Recharge::onItemClicked(MyGUI::Widget *sender)
|
|||
|
||||
void Recharge::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||
{
|
||||
if (mView->getViewOffset().top + _rel*0.3 > 0)
|
||||
if (mView->getViewOffset().top + _rel*0.3f > 0)
|
||||
mView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
mView->setViewOffset(MyGUI::IntPoint(0, mView->getViewOffset().top + _rel*0.3));
|
||||
mView->setViewOffset(MyGUI::IntPoint(0, static_cast<int>(mView->getViewOffset().top + _rel*0.3f)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -150,10 +150,10 @@ void Repair::onRepairItem(MyGUI::Widget *sender)
|
|||
|
||||
void Repair::onMouseWheel(MyGUI::Widget* _sender, int _rel)
|
||||
{
|
||||
if (mRepairView->getViewOffset().top + _rel*0.3 > 0)
|
||||
if (mRepairView->getViewOffset().top + _rel*0.3f > 0)
|
||||
mRepairView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
mRepairView->setViewOffset(MyGUI::IntPoint(0, mRepairView->getViewOffset().top + _rel*0.3));
|
||||
mRepairView->setViewOffset(MyGUI::IntPoint(0, static_cast<int>(mRepairView->getViewOffset().top + _rel*0.3f)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -146,21 +146,21 @@ namespace MWGui
|
|||
|
||||
void ReviewDialog::setHealth(const MWMechanics::DynamicStat<float>& value)
|
||||
{
|
||||
mHealth->setValue(value.getCurrent(), value.getModified());
|
||||
mHealth->setValue(static_cast<int>(value.getCurrent()), static_cast<int>(value.getModified()));
|
||||
std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
|
||||
mHealth->setUserString("Caption_HealthDescription", "#{sHealthDesc}\n" + valStr);
|
||||
}
|
||||
|
||||
void ReviewDialog::setMagicka(const MWMechanics::DynamicStat<float>& value)
|
||||
{
|
||||
mMagicka->setValue(value.getCurrent(), value.getModified());
|
||||
mMagicka->setValue(static_cast<int>(value.getCurrent()), static_cast<int>(value.getModified()));
|
||||
std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
|
||||
mMagicka->setUserString("Caption_HealthDescription", "#{sIntDesc}\n" + valStr);
|
||||
}
|
||||
|
||||
void ReviewDialog::setFatigue(const MWMechanics::DynamicStat<float>& value)
|
||||
{
|
||||
mFatigue->setValue(value.getCurrent(), value.getModified());
|
||||
mFatigue->setValue(static_cast<int>(value.getCurrent()), static_cast<int>(value.getModified()));
|
||||
std::string valStr = MyGUI::utility::toString(value.getCurrent()) + "/" + MyGUI::utility::toString(value.getModified());
|
||||
mFatigue->setUserString("Caption_HealthDescription", "#{sFatDesc}\n" + valStr);
|
||||
}
|
||||
|
@ -180,7 +180,7 @@ namespace MWGui
|
|||
MyGUI::TextBox* widget = mSkillWidgetMap[skillId];
|
||||
if (widget)
|
||||
{
|
||||
float modified = value.getModified(), base = value.getBase();
|
||||
float modified = static_cast<float>(value.getModified()), base = static_cast<float>(value.getBase());
|
||||
std::string text = MyGUI::utility::toString(std::floor(modified));
|
||||
std::string state = "normal";
|
||||
if (modified > base)
|
||||
|
@ -376,7 +376,7 @@ namespace MWGui
|
|||
if (mSkillView->getViewOffset().top + _rel*0.3 > 0)
|
||||
mSkillView->setViewOffset(MyGUI::IntPoint(0, 0));
|
||||
else
|
||||
mSkillView->setViewOffset(MyGUI::IntPoint(0, mSkillView->getViewOffset().top + _rel*0.3));
|
||||
mSkillView->setViewOffset(MyGUI::IntPoint(0, static_cast<int>(mSkillView->getViewOffset().top + _rel*0.3)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
namespace MWState
|
||||
{
|
||||
class Character;
|
||||
class Slot;
|
||||
struct Slot;
|
||||
}
|
||||
|
||||
namespace MWGui
|
||||
|
|
|
@ -48,7 +48,7 @@ namespace MWGui
|
|||
center();
|
||||
}
|
||||
|
||||
void ScrollWindow::open (MWWorld::Ptr scroll)
|
||||
void ScrollWindow::open (MWWorld::Ptr scroll, bool showTakeButton)
|
||||
{
|
||||
// no 3d sounds because the object could be in a container.
|
||||
MWBase::Environment::get().getSoundManager()->playSound ("scroll", 1.0, 1.0);
|
||||
|
@ -71,7 +71,7 @@ namespace MWGui
|
|||
|
||||
mTextView->setViewOffset(MyGUI::IntPoint(0,0));
|
||||
|
||||
setTakeButtonShow(true);
|
||||
setTakeButtonShow(showTakeButton);
|
||||
}
|
||||
|
||||
void ScrollWindow::exit()
|
||||
|
|
|
@ -17,14 +17,14 @@ namespace MWGui
|
|||
public:
|
||||
ScrollWindow ();
|
||||
|
||||
void open (MWWorld::Ptr scroll);
|
||||
void open (MWWorld::Ptr scroll, bool showTakeButton);
|
||||
virtual void exit();
|
||||
void setTakeButtonShow(bool show);
|
||||
void setInventoryAllowed(bool allowed);
|
||||
|
||||
protected:
|
||||
void onCloseButtonClicked (MyGUI::Widget* _sender);
|
||||
void onTakeButtonClicked (MyGUI::Widget* _sender);
|
||||
void setTakeButtonShow(bool show);
|
||||
|
||||
private:
|
||||
Gui::ImageButton* mCloseButton;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue