From 4e46f403a9710ed3cda61b6615e3c0c7bdf992d8 Mon Sep 17 00:00:00 2001 From: Nathan Jeffords Date: Mon, 28 Jan 2013 22:07:39 -0800 Subject: [PATCH 1/9] added some more warning to ignore in MSVC --- CMakeLists.txt | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2313d2d958..9c4ce5cd8e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -496,7 +496,7 @@ if (WIN32) # Warnings that aren't enabled normally and don't need to be enabled # They're unneeded and sometimes completely retarded warnings that /Wall enables # Not going to bother commenting them as they tend to warn on every standard library files - 4061 4263 4264 4266 4350 4514 4548 4571 4610 4619 4623 4625 4626 4628 4640 4668 4710 4711 4820 4826 4917 4946 + 4061 4263 4264 4266 4350 4371 4514 4548 4571 4610 4619 4623 4625 4626 4628 4640 4668 4710 4711 4820 4826 4917 4946 # Warnings that are thrown on standard libraries and not OpenMW 4347 # Non-template function with same name and parameter count as template function @@ -506,6 +506,11 @@ if (WIN32) 4738 # Storing 32-bit float result in memory, possible loss of performance 4986 # Undocumented warning that occurs in the crtdbg.h file 4996 # Function was declared deprecated + + # cause by ogre extensivly + 4193 # #pragma warning(pop) : no matching '#pragma warning(push)' + 4251 # class 'XXXX' needs to have dll-interface to be used by clients of class 'YYYY' + 4275 # non dll-interface struct 'XXXX' used as base for dll-interface class 'YYYY' # OpenMW specific warnings 4099 # Type mismatch, declared class or struct is defined with other type From 85697e4628d3cd983f7b706dc890da97e0634027 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 2 Feb 2013 13:24:28 +0100 Subject: [PATCH 2/9] reverted to C++03 --- CMakeLists.txt | 4 ++-- apps/openmw/mwworld/actionequip.cpp | 12 ++++++------ components/bsa/bsa_archive.cpp | 2 +- components/files/constrainedfiledatastream.cpp | 9 +++------ 4 files changed, 12 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9c4ce5cd8e..c944730ab0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -306,7 +306,7 @@ endif() # Compiler settings if (CMAKE_COMPILER_IS_GNUCC) - add_definitions (-Wall -Wextra -Wno-unused-parameter -Wno-reorder -std=c++0x -pedantic) + add_definitions (-Wall -Wextra -Wno-unused-parameter -Wno-reorder -std=c++03 -pedantic -Wno-long-long) # Silence warnings in OGRE headers. Remove once OGRE got fixed! add_definitions (-Wno-ignored-qualifiers) @@ -506,7 +506,7 @@ if (WIN32) 4738 # Storing 32-bit float result in memory, possible loss of performance 4986 # Undocumented warning that occurs in the crtdbg.h file 4996 # Function was declared deprecated - + # cause by ogre extensivly 4193 # #pragma warning(pop) : no matching '#pragma warning(push)' 4251 # class 'XXXX' needs to have dll-interface to be used by clients of class 'YYYY' diff --git a/apps/openmw/mwworld/actionequip.cpp b/apps/openmw/mwworld/actionequip.cpp index 60260a812b..f3191e8bb2 100644 --- a/apps/openmw/mwworld/actionequip.cpp +++ b/apps/openmw/mwworld/actionequip.cpp @@ -32,7 +32,7 @@ namespace MWWorld } assert(it != invStore.end()); - + std::string npcRace = actor.get()->mBase->mRace; // equip the item in the first free slot @@ -43,7 +43,7 @@ namespace MWWorld // Beast races cannot equip shoes / boots, or full helms (head part vs hair part) if(npcRace == "argonian" || npcRace == "khajiit") { - if(*slot == MWWorld::InventoryStore::Slot_Helmet){ + if(*slot == MWWorld::InventoryStore::Slot_Helmet){ std::vector parts; if(it.getType() == MWWorld::ContainerStore::Type_Clothing) @@ -54,22 +54,22 @@ namespace MWWorld bool allow = true; for(std::vector::iterator itr = parts.begin(); itr != parts.end(); ++itr) { - if((*itr).mPart == ESM::PartReferenceType::PRT_Head) + if((*itr).mPart == ESM::PRT_Head) { if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() ) MWBase::Environment::get().getWindowManager()->messageBox ("#{sNotifyMessage13}", std::vector()); - + allow = false; break; } } - + if(!allow) break; } if (*slot == MWWorld::InventoryStore::Slot_Boots) - { + { // Only notify the player, not npcs if(actor == MWBase::Environment::get().getWorld()->getPlayer().getPlayer() ) { diff --git a/components/bsa/bsa_archive.cpp b/components/bsa/bsa_archive.cpp index 5274564a63..8117dbdfd7 100644 --- a/components/bsa/bsa_archive.cpp +++ b/components/bsa/bsa_archive.cpp @@ -91,7 +91,7 @@ public: std::string searchable = normalize_path (proper.begin () + prefix, proper.end ()); - mIndex.insert (std::make_pair (std::move (searchable), std::move (proper))); + mIndex.insert (std::make_pair (searchable, proper)); } } diff --git a/components/files/constrainedfiledatastream.cpp b/components/files/constrainedfiledatastream.cpp index dd2985e561..321bcf7c8c 100644 --- a/components/files/constrainedfiledatastream.cpp +++ b/components/files/constrainedfiledatastream.cpp @@ -3,11 +3,8 @@ #include #include -#ifndef __clang__ -#include -#else -#include -#endif + +#include namespace { @@ -29,7 +26,7 @@ public: mBufferOrigin = 0; mBufferExtent = 0; } - + size_t read(void* buf, size_t count) { From 827261e8b4c4fb2761429fa79c1c88721ae1602e Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 2 Feb 2013 13:42:11 +0100 Subject: [PATCH 3/9] increased version number --- CMakeLists.txt | 2 +- readme.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c944730ab0..165db6b792 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,7 +15,7 @@ include (OpenMWMacros) # Version set (OPENMW_VERSION_MAJOR 0) -set (OPENMW_VERSION_MINOR 20) +set (OPENMW_VERSION_MINOR 21) set (OPENMW_VERSION_RELEASE 0) set (OPENMW_VERSION "${OPENMW_VERSION_MAJOR}.${OPENMW_VERSION_MINOR}.${OPENMW_VERSION_RELEASE}") diff --git a/readme.txt b/readme.txt index 21ae855309..d94ccd7f08 100644 --- a/readme.txt +++ b/readme.txt @@ -3,7 +3,7 @@ OpenMW: A reimplementation of The Elder Scrolls III: Morrowind 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.20.0 +Version: 0.21.0 License: GPL (see GPL3.txt for more information) Website: http://www.openmw.org From 67a1ec51665822ea03fa89906488a7872566f5c8 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sat, 2 Feb 2013 16:14:58 +0100 Subject: [PATCH 4/9] added provisional startup dialogue --- apps/opencs/CMakeLists.txt | 4 +-- apps/opencs/editor.cpp | 46 ++++++++++++++++++++++++++-- apps/opencs/editor.hpp | 7 ++++- apps/opencs/view/doc/startup.cpp | 20 ++++++++++++ apps/opencs/view/doc/startup.hpp | 24 +++++++++++++++ apps/opencs/view/doc/view.cpp | 4 +++ apps/opencs/view/doc/view.hpp | 2 ++ apps/opencs/view/doc/viewmanager.cpp | 1 + apps/opencs/view/doc/viewmanager.hpp | 2 ++ 9 files changed, 104 insertions(+), 6 deletions(-) create mode 100644 apps/opencs/view/doc/startup.cpp create mode 100644 apps/opencs/view/doc/startup.hpp diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index abbc953ca4..d3634a66e4 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -12,7 +12,7 @@ set (OPENCS_SRC model/tools/mandatoryid.cpp model/tools/reportmodel.cpp view/doc/viewmanager.cpp view/doc/view.cpp view/doc/operations.cpp view/doc/operation.cpp view/doc/subviewfactory.cpp - view/doc/subview.cpp + view/doc/subview.cpp view/doc/startup.cpp view/world/table.cpp view/world/tablesubview.cpp view/world/subviews.cpp view/world/util.cpp view/world/dialoguesubview.cpp @@ -33,7 +33,7 @@ set (OPENCS_HDR model/tools/mandatoryid.hpp model/tools/reportmodel.hpp view/doc/viewmanager.hpp view/doc/view.hpp view/doc/operations.hpp view/doc/operation.hpp view/doc/subviewfactory.hpp - view/doc/subview.hpp view/doc/subviewfactoryimp.hpp + view/doc/subview.hpp view/doc/subviewfactoryimp.hpp view/doc/startup.hpp view/world/table.hpp view/world/tablesubview.hpp view/world/subviews.hpp view/world/util.hpp view/world/dialoguesubview.hpp diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 1632ed220d..2340c71ee2 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -11,10 +11,19 @@ CS::Editor::Editor() : mViewManager (mDocumentManager), mNewDocumentIndex (0) { connect (&mViewManager, SIGNAL (newDocumentRequest ()), this, SLOT (createDocument ())); + connect (&mViewManager, SIGNAL (loadDocumentRequest ()), this, SLOT (loadDocument ())); + + connect (&mStartup, SIGNAL (createDocument()), this, SLOT (createDocument ())); + connect (&mStartup, SIGNAL (loadDocument()), this, SLOT (loadDocument ())); } void CS::Editor::createDocument() { + mStartup.hide(); + + /// \todo open the ESX picker instead + /// \todo remove the following code for creating initial records into the document manager + std::ostringstream stream; stream << "NewDocument" << (++mNewDocumentIndex); @@ -23,7 +32,39 @@ void CS::Editor::createDocument() static const char *sGlobals[] = { - "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 + "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 + }; + + for (int i=0; sGlobals[i]; ++i) + { + ESM::Global record; + record.mId = sGlobals[i]; + record.mValue = i==0 ? 1 : 0; + record.mType = ESM::VT_Float; + document->getData().getGlobals().add (record); + } + + document->getData().merge(); /// \todo remove once proper ESX loading is implemented + + mViewManager.addView (document); +} + +void CS::Editor::loadDocument() +{ + mStartup.hide(); + + /// \todo open the ESX picker instead + /// \todo replace the manual record creation and load the ESX files instead + + std::ostringstream stream; + + stream << "Document" << (++mNewDocumentIndex); + + CSMDoc::Document *document = mDocumentManager.addDocument (stream.str()); + + static const char *sGlobals[] = + { + "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 }; for (int i=0; sGlobals[i]; ++i) @@ -42,8 +83,7 @@ void CS::Editor::createDocument() int CS::Editor::run() { - /// \todo Instead of creating an empty document, open a small welcome dialogue window with buttons for new/load/recent projects - createDocument(); + mStartup.show(); return QApplication::exec(); } \ No newline at end of file diff --git a/apps/opencs/editor.hpp b/apps/opencs/editor.hpp index 60f7beaf1d..0cd780f7fc 100644 --- a/apps/opencs/editor.hpp +++ b/apps/opencs/editor.hpp @@ -4,7 +4,9 @@ #include #include "model/doc/documentmanager.hpp" + #include "view/doc/viewmanager.hpp" +#include "view/doc/startup.hpp" namespace CS { @@ -16,6 +18,7 @@ namespace CS CSMDoc::DocumentManager mDocumentManager; CSVDoc::ViewManager mViewManager; + CSVDoc::StartupDialogue mStartup; // not implemented Editor (const Editor&); @@ -28,9 +31,11 @@ namespace CS int run(); ///< \return error status - public slots: + private slots: void createDocument(); + + void loadDocument(); }; } diff --git a/apps/opencs/view/doc/startup.cpp b/apps/opencs/view/doc/startup.cpp new file mode 100644 index 0000000000..7861a1c2ef --- /dev/null +++ b/apps/opencs/view/doc/startup.cpp @@ -0,0 +1,20 @@ + +#include "startup.hpp" + +#include +#include + +CSVDoc::StartupDialogue::StartupDialogue() +{ + QHBoxLayout *layout = new QHBoxLayout (this); + + QPushButton *createDocument = new QPushButton ("new", this); + connect (createDocument, SIGNAL (clicked()), this, SIGNAL (createDocument())); + layout->addWidget (createDocument); + + QPushButton *loadDocument = new QPushButton ("load", this); + connect (loadDocument, SIGNAL (clicked()), this, SIGNAL (loadDocument())); + layout->addWidget (loadDocument); + + setLayout (layout); +} \ No newline at end of file diff --git a/apps/opencs/view/doc/startup.hpp b/apps/opencs/view/doc/startup.hpp new file mode 100644 index 0000000000..f24d2a64ba --- /dev/null +++ b/apps/opencs/view/doc/startup.hpp @@ -0,0 +1,24 @@ +#ifndef CSV_DOC_STARTUP_H +#define CSV_DOC_STARTUP_H + +#include + +namespace CSVDoc +{ + class StartupDialogue : public QWidget + { + Q_OBJECT + + public: + + StartupDialogue(); + + signals: + + void createDocument(); + + void loadDocument(); + }; +} + +#endif diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index 13edb6e749..d6639e59ca 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -32,6 +32,10 @@ void CSVDoc::View::setupFileMenu() connect (new_, SIGNAL (triggered()), this, SIGNAL (newDocumentRequest())); file->addAction (new_); + QAction *open = new QAction (tr ("Open"), this); + connect (open, SIGNAL (triggered()), this, SIGNAL (loadDocumentRequest())); + file->addAction (open); + mSave = new QAction (tr ("&Save"), this); connect (mSave, SIGNAL (triggered()), this, SLOT (save())); file->addAction (mSave); diff --git a/apps/opencs/view/doc/view.hpp b/apps/opencs/view/doc/view.hpp index b1dedafe92..05d7210dce 100644 --- a/apps/opencs/view/doc/view.hpp +++ b/apps/opencs/view/doc/view.hpp @@ -84,6 +84,8 @@ namespace CSVDoc void newDocumentRequest(); + void loadDocumentRequest(); + public slots: void addSubView (const CSMWorld::UniversalId& id); diff --git a/apps/opencs/view/doc/viewmanager.cpp b/apps/opencs/view/doc/viewmanager.cpp index 22847c78b7..b01b9ce342 100644 --- a/apps/opencs/view/doc/viewmanager.cpp +++ b/apps/opencs/view/doc/viewmanager.cpp @@ -57,6 +57,7 @@ CSVDoc::View *CSVDoc::ViewManager::addView (CSMDoc::Document *document) view->show(); connect (view, SIGNAL (newDocumentRequest ()), this, SIGNAL (newDocumentRequest())); + connect (view, SIGNAL (loadDocumentRequest ()), this, SIGNAL (loadDocumentRequest())); updateIndices(); diff --git a/apps/opencs/view/doc/viewmanager.hpp b/apps/opencs/view/doc/viewmanager.hpp index 5e4b1be075..91a80d4962 100644 --- a/apps/opencs/view/doc/viewmanager.hpp +++ b/apps/opencs/view/doc/viewmanager.hpp @@ -46,6 +46,8 @@ namespace CSVDoc void newDocumentRequest(); + void loadDocumentRequest(); + private slots: void documentStateChanged (int state, CSMDoc::Document *document); From d6a73a2a02d4d49bb733a59d8e1442ed819d831c Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 3 Feb 2013 11:41:31 +0100 Subject: [PATCH 5/9] updated changelog --- readme.txt | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/readme.txt b/readme.txt index d94ccd7f08..91690ff574 100644 --- a/readme.txt +++ b/readme.txt @@ -94,6 +94,38 @@ Allowed options: CHANGELOG +0.21.0 + +Bug #253: Dialogs don't work for Russian version of Morrowind +Bug #267: Activating creatures without dialogue can still activate the dialogue GUI +Bug #354: True flickering lights +Bug #386: The main menu's first entry is wrong (in french) +Bug #479: Adding the spell "Ash Woe Blight" to the player causes strange attribute oscillations +Bug #495: Activation Range +Bug #497: Failed Disposition check doesn't stop a dialogue entry from being returned +Bug #498: Failing a disposition check shouldn't eliminate topics from the the list of those available +Bug #500: Disposition for most NPCs is 0/100 +Bug #501: Getdisposition command wrongly returns base disposition +Bug #506: Journal UI doesn't update anymore +Bug #507: EnableRestMenu is not a valid command - change it to EnableRest +Bug #508: Crash in Ald Daedroth Shrine +Bug #517: Wrong price calculation when untrading an item +Bug #521: MWGui::InventoryWindow creates a duplicate player actor at the origin +Bug #524: Beast races are able to wear shoes +Bug #527: Background music fails to play +Bug #533: The arch at Gnisis entrance is not displayed +Bug #536: The same entry can be added multiple times to the journal +Bug #539: Race selection is broken +Feature #39: Video Playback +Feature #151: ^-escape sequences in text output +Feature #392: Add AI related script functions +Feature #456: Determine required ini fallback values and adjust the ini importer accordingly +Feature #460: Experimental DirArchives improvements +Feature #540: Execute scripts of objects in containers/inventories in active cells +Task #401: Review GMST fixing +Task #453: Unify case smashing/folding +Task #512: Rewrite utf8 component + 0.20.0 Bug #366: Changing the player's race during character creation does not change the look of the player character From a4872e321717ca7f3017bf5bbcbe36d2e8232da1 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 3 Feb 2013 13:30:40 +0100 Subject: [PATCH 6/9] rewrote the opencs cmake scripts (more compact and no more annoying warnings) --- apps/opencs/CMakeLists.txt | 83 +++++++++++++++++++++++++------------- cmake/OpenMWMacros.cmake | 48 ++++++++++++++++++++++ 2 files changed, 104 insertions(+), 27 deletions(-) diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt index abbc953ca4..d1cfbea524 100644 --- a/apps/opencs/CMakeLists.txt +++ b/apps/opencs/CMakeLists.txt @@ -1,46 +1,75 @@ -set (OPENCS_SRC - main.cpp editor.cpp +set (OPENCS_SRC main.cpp) - model/doc/documentmanager.cpp model/doc/document.cpp +opencs_units (. editor) - model/world/universalid.cpp model/world/idcollection.cpp model/world/data.cpp model/world/idtable.cpp - model/world/commands.cpp model/world/idtableproxymodel.cpp model/world/record.cpp - model/world/columnbase.cpp - model/tools/tools.cpp model/tools/operation.cpp model/tools/stage.cpp model/tools/verifier.cpp - model/tools/mandatoryid.cpp model/tools/reportmodel.cpp +opencs_units (model/doc + document + ) + +opencs_units_noqt (model/doc + documentmanager + ) + +opencs_hdrs_noqt (model/doc + state + ) + - view/doc/viewmanager.cpp view/doc/view.cpp view/doc/operations.cpp view/doc/operation.cpp view/doc/subviewfactory.cpp - view/doc/subview.cpp +opencs_units (model/world + idtable idtableproxymodel + ) - view/world/table.cpp view/world/tablesubview.cpp view/world/subviews.cpp view/world/util.cpp - view/world/dialoguesubview.cpp +opencs_units_noqt (model/world + universalid data record idcollection commands columnbase + ) - view/tools/reportsubview.cpp view/tools/subviews.cpp +opencs_hdrs_noqt (model/world + columns ) -set (OPENCS_HDR - editor.hpp - model/doc/documentmanager.hpp model/doc/document.hpp model/doc/state.hpp +opencs_units (model/tools + tools operation reportmodel + ) - model/world/universalid.hpp model/world/record.hpp model/world/idcollection.hpp model/world/data.hpp - model/world/idtable.hpp model/world/columns.hpp model/world/idtableproxymodel.hpp - model/world/commands.hpp model/world/columnbase.hpp +opencs_units_noqt (model/tools + stage verifier mandatoryid + ) - model/tools/tools.hpp model/tools/operation.hpp model/tools/stage.hpp model/tools/verifier.hpp - model/tools/mandatoryid.hpp model/tools/reportmodel.hpp - view/doc/viewmanager.hpp view/doc/view.hpp view/doc/operations.hpp view/doc/operation.hpp view/doc/subviewfactory.hpp - view/doc/subview.hpp view/doc/subviewfactoryimp.hpp +opencs_units (view/doc + viewmanager view operations operation subview + ) - view/world/table.hpp view/world/tablesubview.hpp view/world/subviews.hpp view/world/util.hpp - view/world/dialoguesubview.hpp +opencs_units_noqt (view/doc + subviewfactory + ) - view/tools/reportsubview.hpp view/tools/subviews.hpp +opencs_hdrs_noqt (view/doc + subviewfactoryimp ) + +opencs_units (view/world + table tablesubview + ) + +opencs_units_noqt (view/world + dialoguesubview util subviews + ) + + +opencs_units (view/tools + reportsubview + ) + +opencs_units_noqt (view/tools + subviews + ) + + set (OPENCS_US ) @@ -57,7 +86,7 @@ find_package(Qt4 COMPONENTS QtCore QtGui QtXml QtXmlPatterns REQUIRED) include(${QT_USE_FILE}) qt4_wrap_ui(OPENCS_UI_HDR ${OPENCS_UI}) -qt4_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR}) +qt4_wrap_cpp(OPENCS_MOC_SRC ${OPENCS_HDR_QT}) qt4_add_resources(OPENCS_RES_SRC ${OPENCS_RES}) include_directories(${CMAKE_CURRENT_BINARY_DIR}) diff --git a/cmake/OpenMWMacros.cmake b/cmake/OpenMWMacros.cmake index e6f45fdb1f..d13568a688 100644 --- a/cmake/OpenMWMacros.cmake +++ b/cmake/OpenMWMacros.cmake @@ -29,3 +29,51 @@ get_filename_component(filename ${f} NAME) configure_file(${source_dir}/${f} ${destination_dir}/${filename} COPYONLY) endforeach (f) endmacro (copy_all_files) + +macro (add_file project type file) +list (APPEND ${project}${type} ${file}) +endmacro (add_file) + +macro (add_unit project dir unit) +add_file (${project} _HDR ${comp} "${dir}/${unit}.hpp") +add_file (${project} _SRC ${comp} "${dir}/${unit}.cpp") +endmacro (add_unit) + +macro (add_qt_unit project dir unit) +add_file (${project} _HDR ${comp} "${dir}/${unit}.hpp") +add_file (${project} _HDR_QT ${comp} "${dir}/${unit}.hpp") +add_file (${project} _SRC ${comp} "${dir}/${unit}.cpp") +endmacro (add_qt_unit) + +macro (add_hdr project dir unit) +add_file (${project} _HDR ${comp} "${dir}/${unit}.hpp") +endmacro (add_hdr) + +macro (add_qt_hdr project dir unit) +add_file (${project} _HDR ${comp} "${dir}/${unit}.hpp") +add_file (${project} _HDR_QT ${comp} "${dir}/${unit}.hpp") +endmacro (add_qt_hdr) + +macro (opencs_units dir) +foreach (u ${ARGN}) +add_qt_unit (OPENCS ${dir} ${u}) +endforeach (u) +endmacro (opencs_units) + +macro (opencs_units_noqt dir) +foreach (u ${ARGN}) +add_unit (OPENCS ${dir} ${u}) +endforeach (u) +endmacro (opencs_units) + +macro (opencs_hdrs dir) +foreach (u ${ARGN}) +add_qt_hdr (OPENCS ${dir} ${u}) +endforeach (u) +endmacro (opencs_hdrs) + +macro (opencs_hdrs_noqt dir) +foreach (u ${ARGN}) +add_hdr (OPENCS ${dir} ${u}) +endforeach (u) +endmacro (opencs_hdrs) From a002b253d10fd882a29ef5917ac46f0cc281a932 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 3 Feb 2013 16:18:17 +0100 Subject: [PATCH 7/9] silenced a cmake warning --- cmake/OpenMWMacros.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/OpenMWMacros.cmake b/cmake/OpenMWMacros.cmake index d13568a688..bb200ee570 100644 --- a/cmake/OpenMWMacros.cmake +++ b/cmake/OpenMWMacros.cmake @@ -64,7 +64,7 @@ macro (opencs_units_noqt dir) foreach (u ${ARGN}) add_unit (OPENCS ${dir} ${u}) endforeach (u) -endmacro (opencs_units) +endmacro (opencs_units_noqt) macro (opencs_hdrs dir) foreach (u ${ARGN}) @@ -76,4 +76,4 @@ macro (opencs_hdrs_noqt dir) foreach (u ${ARGN}) add_hdr (OPENCS ${dir} ${u}) endforeach (u) -endmacro (opencs_hdrs) +endmacro (opencs_hdrs_noqt) From 4c973a0f6767570a4ed07d0265fe949e7f0f7beb Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 4 Feb 2013 13:46:54 +0100 Subject: [PATCH 8/9] constructing documents from a file list instead of a single name --- apps/opencs/editor.cpp | 12 +++++-- apps/opencs/model/doc/document.cpp | 42 +++++++++++++++++++++-- apps/opencs/model/doc/document.hpp | 10 ++++-- apps/opencs/model/doc/documentmanager.cpp | 5 +-- apps/opencs/model/doc/documentmanager.hpp | 7 +++- 5 files changed, 66 insertions(+), 10 deletions(-) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 2340c71ee2..57e31e19ea 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -22,13 +22,16 @@ void CS::Editor::createDocument() mStartup.hide(); /// \todo open the ESX picker instead - /// \todo remove the following code for creating initial records into the document manager + /// \todo move the following code for creating initial records into the document manager std::ostringstream stream; stream << "NewDocument" << (++mNewDocumentIndex); - CSMDoc::Document *document = mDocumentManager.addDocument (stream.str()); + std::vector files; + files.push_back (stream.str()); + + CSMDoc::Document *document = mDocumentManager.addDocument (files, true); static const char *sGlobals[] = { @@ -60,7 +63,10 @@ void CS::Editor::loadDocument() stream << "Document" << (++mNewDocumentIndex); - CSMDoc::Document *document = mDocumentManager.addDocument (stream.str()); + std::vector files; + files.push_back (stream.str()); + + CSMDoc::Document *document = mDocumentManager.addDocument (files, false); static const char *sGlobals[] = { diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 9d26944832..93d664314e 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -1,10 +1,48 @@ #include "document.hpp" -CSMDoc::Document::Document (const std::string& name) +#include + +void CSMDoc::Document::load (const std::vector::const_iterator& begin, + const std::vector::const_iterator& end) +{ + for (std::vector::const_iterator iter (begin); iter!=end; ++iter) + std::cout << "pretending to load " << iter->string() << std::endl; + + /// \todo load content files +} + +void CSMDoc::Document::createBase() +{ + std::cout << "pretending to create base file records" << std::endl; + + /// \todo create mandatory records for base content file +} + +CSMDoc::Document::Document (const std::vector& files, bool new_) : mTools (mData) { - mName = name; ///< \todo replace with ESX list + if (files.empty()) + throw std::runtime_error ("Empty content file sequence"); + + /// \todo adjust last file name: + /// \li make sure it is located in the data-local directory (adjust path if necessary) + /// \li make sure the extension matches the new scheme (change it if necesarry) + + mName = files.back().filename().string(); + + if (files.size()>1 || !new_) + { + std::vector::const_iterator end = files.end(); + + if (new_) + --end; + + load (files.begin(), end); + } + + if (new_ && files.size()==1) + createBase(); connect (&mUndoStack, SIGNAL (cleanChanged (bool)), this, SLOT (modificationStateChanged (bool))); diff --git a/apps/opencs/model/doc/document.hpp b/apps/opencs/model/doc/document.hpp index 43e8bba37b..28cc19d449 100644 --- a/apps/opencs/model/doc/document.hpp +++ b/apps/opencs/model/doc/document.hpp @@ -3,6 +3,8 @@ #include +#include + #include #include #include @@ -38,10 +40,14 @@ namespace CSMDoc Document (const Document&); Document& operator= (const Document&); + void load (const std::vector::const_iterator& begin, + const std::vector::const_iterator& end); + + void createBase(); + public: - Document (const std::string& name); - ///< \todo replace name with ESX list + Document (const std::vector& files, bool new_); QUndoStack& getUndoStack(); diff --git a/apps/opencs/model/doc/documentmanager.cpp b/apps/opencs/model/doc/documentmanager.cpp index 8ae2764f24..740c0b5827 100644 --- a/apps/opencs/model/doc/documentmanager.cpp +++ b/apps/opencs/model/doc/documentmanager.cpp @@ -14,9 +14,10 @@ CSMDoc::DocumentManager::~DocumentManager() delete *iter; } -CSMDoc::Document *CSMDoc::DocumentManager::addDocument (const std::string& name) +CSMDoc::Document *CSMDoc::DocumentManager::addDocument (const std::vector& files, + bool new_) { - Document *document = new Document (name); + Document *document = new Document (files, new_); mDocuments.push_back (document); diff --git a/apps/opencs/model/doc/documentmanager.hpp b/apps/opencs/model/doc/documentmanager.hpp index 730c7fae1d..a307b76a57 100644 --- a/apps/opencs/model/doc/documentmanager.hpp +++ b/apps/opencs/model/doc/documentmanager.hpp @@ -4,6 +4,8 @@ #include #include +#include + namespace CSMDoc { class Document; @@ -21,8 +23,11 @@ namespace CSMDoc ~DocumentManager(); - Document *addDocument (const std::string& name); + Document *addDocument (const std::vector& files, bool new_); ///< The ownership of the returned document is not transferred to the caller. + /// + /// \param new_ Do not load the last content file in \a files and instead create in an + /// appropriate way. bool removeDocument (Document *document); ///< \return last document removed? From ba0d13fc12f2be6b483a09025b329f97974ae9b4 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Mon, 4 Feb 2013 13:50:38 +0100 Subject: [PATCH 9/9] moved code for creating new base content records into the Document class --- apps/opencs/editor.cpp | 19 +------------------ apps/opencs/model/doc/document.cpp | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/apps/opencs/editor.cpp b/apps/opencs/editor.cpp index 57e31e19ea..7156db94e7 100644 --- a/apps/opencs/editor.cpp +++ b/apps/opencs/editor.cpp @@ -22,7 +22,6 @@ void CS::Editor::createDocument() mStartup.hide(); /// \todo open the ESX picker instead - /// \todo move the following code for creating initial records into the document manager std::ostringstream stream; @@ -33,22 +32,6 @@ void CS::Editor::createDocument() CSMDoc::Document *document = mDocumentManager.addDocument (files, true); - static const char *sGlobals[] = - { - "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 - }; - - for (int i=0; sGlobals[i]; ++i) - { - ESM::Global record; - record.mId = sGlobals[i]; - record.mValue = i==0 ? 1 : 0; - record.mType = ESM::VT_Float; - document->getData().getGlobals().add (record); - } - - document->getData().merge(); /// \todo remove once proper ESX loading is implemented - mViewManager.addView (document); } @@ -57,7 +40,7 @@ void CS::Editor::loadDocument() mStartup.hide(); /// \todo open the ESX picker instead - /// \todo replace the manual record creation and load the ESX files instead + /// \todo remove the manual record creation and load the ESX files instead std::ostringstream stream; diff --git a/apps/opencs/model/doc/document.cpp b/apps/opencs/model/doc/document.cpp index 93d664314e..14e34d0baf 100644 --- a/apps/opencs/model/doc/document.cpp +++ b/apps/opencs/model/doc/document.cpp @@ -14,9 +14,19 @@ void CSMDoc::Document::load (const std::vector::const_i void CSMDoc::Document::createBase() { - std::cout << "pretending to create base file records" << std::endl; + static const char *sGlobals[] = + { + "Day", "DaysPassed", "GameHour", "Month", "PCRace", "PCVampire", "PCWerewolf", "PCYear", 0 + }; - /// \todo create mandatory records for base content file + for (int i=0; sGlobals[i]; ++i) + { + ESM::Global record; + record.mId = sGlobals[i]; + record.mValue = i==0 ? 1 : 0; + record.mType = ESM::VT_Float; + getData().getGlobals().add (record); + } } CSMDoc::Document::Document (const std::vector& files, bool new_)