From 32025a1fa2c9969c5ff4377d5a93855e3115f775 Mon Sep 17 00:00:00 2001 From: cbnolok Date: Tue, 2 Jan 2018 15:36:19 +0100 Subject: [PATCH] Version 0.1.4. Added: menu actions to load a single client/scripts profile. Added: search dialog now shows the last search parameters. Fixed: on Windows, increased the delay between each keystroke, since sometimes the client didn't receive a letter. Changed: set the focus on the object list view after searching an item. Changed: automatic version string generator. --- .travis.yml | 6 +- appveyor_generateversion.py | 5 +- src/forms/maintab_chars.cpp | 22 ++++--- src/forms/maintab_chars.h | 1 + src/forms/maintab_items.cpp | 22 ++++--- src/forms/maintab_items.h | 1 + src/forms/mainwindow.cpp | 65 ++++++++++++++++--- src/forms/mainwindow.h | 5 +- src/forms/subdlg_searchobj.cpp | 37 +++++++++-- src/forms/subdlg_searchobj.h | 5 +- src/forms/subdlg_searchobj.ui | 2 +- .../keystrokesender_windows.cpp | 6 +- src/spherescript/scriptsearch.cpp | 6 +- src/spherescript/scriptsearch.h | 31 +++++---- src/sysio.cpp | 6 +- src/uofiles/uoart.cpp | 10 +-- src/version.h | 2 +- 17 files changed, 168 insertions(+), 64 deletions(-) diff --git a/.travis.yml b/.travis.yml index 57dad3f..4e5395d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -47,6 +47,10 @@ before_script: - printf '#ifndef VERSION_H\n' > src/version.h - printf '#define VERSION_H\n' >> src/version.h - printf '#define LEVIATHAN_VERSION \\\n' >> src/version.h + - | + if [[ -z "$TRAVIS_TAG" ]]; then + printf "$TRAVIS_TAG - " >> src/version.h + fi - git log -1 --format=%ci >> src/version.h - printf '\n#endif // VERSION_H' >> src/version.h @@ -59,7 +63,7 @@ script: #after_success: # Pack everything in a zip - - tar -czf LeviathanLinux64-automated-${TRAVIS_TAG}.zip Leviathan ../icons + - tar -czf LeviathanLinux64-automated-${TRAVIS_TAG}.zip Leviathan deploy: provider: releases diff --git a/appveyor_generateversion.py b/appveyor_generateversion.py index 3757638..7589df9 100644 --- a/appveyor_generateversion.py +++ b/appveyor_generateversion.py @@ -8,7 +8,10 @@ f.write("#define VERSION_H\n") f.write("#define LEVIATHAN_VERSION \\\n") # date is in ISO 8601 format (like 2016-02-18T15:18:39.0000000Z), where Z is the time zone -f.write("%s\n" % environ.get("APPVEYOR_REPO_COMMIT_TIMESTAMP")) +if ("APPVEYOR_REPO_TAG_NAME" in environ): + f.write("%s - %s\n" % (environ.get("APPVEYOR_REPO_TAG_NAME"), environ.get("APPVEYOR_REPO_COMMIT_TIMESTAMP"))) +else: + f.write("%s\n" % environ.get("APPVEYOR_REPO_COMMIT_TIMESTAMP")) f.write("#endif // VERSION_H\n") f.close() diff --git a/src/forms/maintab_chars.cpp b/src/forms/maintab_chars.cpp index 6db7e93..ad47b26 100644 --- a/src/forms/maintab_chars.cpp +++ b/src/forms/maintab_chars.cpp @@ -309,21 +309,27 @@ void MainTab_Chars::doSearch(bool backwards) return; } + // look up the m_categoryMap map to see if we have loaded the QStandardItem corresponding to the ScriptCategory of the object ScriptCategory* category = obj->m_category; - auto categoryIt = mapSearchByKey(m_categoryMap, category); + auto categoryIt = mapSearchByKey(m_categoryMap, category); // it's an iterator if (categoryIt == m_categoryMap.end()) // not found? odd.. return; //QStandardItem* categoryQ = categoryIt->first; + // look up the m_subsectionMap map to see if we have loaded the QStandardItem corresponding to the ScriptSubsection of the object ScriptSubsection* subsection = obj->m_subsection; - auto subsectionIt = mapSearchByKey(m_subsectionMap, subsection); + auto subsectionIt = mapSearchByKey(m_subsectionMap, subsection); // it's an iterator if (subsectionIt == m_subsectionMap.end()) // not found? odd.. return; QStandardItem* subsectionQ = subsectionIt->first; + // now that i have the subsection's QStandardItem, get its QModelIndex QModelIndex emptyIdx; QModelIndex subsectionIdx = m_organizer_model->indexFromItem(subsectionQ); //QModelIndex categoryIdx = m_organizer_model->indexFromItem(categoryQ); + + // store the previous loaded subsection: if the current subsection is the same of the previous, there's no need to + // empty and load again the whole subsection list static QModelIndex prevSubsectionIdx; ui->treeView_organizer->scrollTo(subsectionIdx, QAbstractItemView::PositionAtCenter); @@ -331,7 +337,7 @@ void MainTab_Chars::doSearch(bool backwards) ui->treeView_organizer->selectionModel()->select(subsectionIdx, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Current); if (subsectionIdx != prevSubsectionIdx) { - onManual_treeView_organizer_selectionChanged(subsectionIdx, emptyIdx); + onManual_treeView_organizer_selectionChanged(subsectionIdx, emptyIdx); // load the new subsection into treeView_objList prevSubsectionIdx = subsectionIdx; } @@ -339,6 +345,7 @@ void MainTab_Chars::doSearch(bool backwards) QModelIndex objIdx = m_objList_model->indexFromItem(objQ); onManual_treeView_objList_selectionChanged(objIdx, emptyIdx); + ui->treeView_objList->setFocus(); ui->treeView_objList->scrollTo(objIdx, QAbstractItemView::PositionAtCenter); ui->treeView_objList->selectionModel()->select(objIdx, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Toggle); } @@ -349,6 +356,8 @@ void MainTab_Chars::on_pushButton_search_clicked() return; SubDlg_SearchObj dlg(window()); + if (m_lastSearchData.initialized) + dlg.setSearchData(m_lastSearchData); if (!dlg.exec()) return; @@ -358,11 +367,8 @@ void MainTab_Chars::on_pushButton_search_clicked() objTree(SCRIPTOBJ_TYPE_SPAWN) }; - ScriptSearch::SearchBy_t searchBy; - bool caseSensitive; - std::string key; - dlg.getSearchData(searchBy, caseSensitive, key); - m_scriptSearch.reset(new ScriptSearch(trees, searchBy, caseSensitive, key)); + m_lastSearchData = dlg.getSearchData(); + m_scriptSearch.reset(new ScriptSearch(trees, m_lastSearchData)); doSearch(false); } diff --git a/src/forms/maintab_chars.h b/src/forms/maintab_chars.h index 7385c6a..0c77349 100644 --- a/src/forms/maintab_chars.h +++ b/src/forms/maintab_chars.h @@ -55,6 +55,7 @@ private slots: QStandardItemModel *m_objList_model; std::unique_ptr m_scriptSearch; + ScriptSearch::SearchData_t m_lastSearchData; void doSearch (bool backwards); }; diff --git a/src/forms/maintab_items.cpp b/src/forms/maintab_items.cpp index e19972e..59b022e 100644 --- a/src/forms/maintab_items.cpp +++ b/src/forms/maintab_items.cpp @@ -350,21 +350,27 @@ void MainTab_Items::doSearch(bool backwards) return; } + // look up the m_categoryMap map to see if we have loaded the QStandardItem corresponding to the ScriptCategory of the object ScriptCategory* category = obj->m_category; - auto categoryIt = mapSearchByKey(m_categoryMap, category); + auto categoryIt = mapSearchByKey(m_categoryMap, category); // it's an iterator if (categoryIt == m_categoryMap.end()) // not found? odd.. return; //QStandardItem* categoryQ = categoryIt->first; + // look up the m_subsectionMap map to see if we have loaded the QStandardItem corresponding to the ScriptSubsection of the object ScriptSubsection* subsection = obj->m_subsection; - auto subsectionIt = mapSearchByKey(m_subsectionMap, subsection); + auto subsectionIt = mapSearchByKey(m_subsectionMap, subsection); // it's an iterator if (subsectionIt == m_subsectionMap.end()) // not found? odd.. return; QStandardItem* subsectionQ = subsectionIt->first; + // now that i have the subsection's QStandardItem, get its QModelIndex QModelIndex emptyIdx; QModelIndex subsectionIdx = m_organizer_model->indexFromItem(subsectionQ); //QModelIndex categoryIdx = m_organizer_model->indexFromItem(categoryQ); + + // store the previous loaded subsection: if the current subsection is the same of the previous, there's no need to + // empty and load again the whole subsection list static QModelIndex prevSubsectionIdx; ui->treeView_organizer->scrollTo(subsectionIdx, QAbstractItemView::PositionAtCenter); @@ -372,7 +378,7 @@ void MainTab_Items::doSearch(bool backwards) ui->treeView_organizer->selectionModel()->select(subsectionIdx, QItemSelectionModel::ClearAndSelect | QItemSelectionModel::Current); if (subsectionIdx != prevSubsectionIdx) { - onManual_treeView_organizer_selectionChanged(subsectionIdx, emptyIdx); + onManual_treeView_organizer_selectionChanged(subsectionIdx, emptyIdx); // load the new subsection into treeView_objList prevSubsectionIdx = subsectionIdx; } @@ -380,6 +386,7 @@ void MainTab_Items::doSearch(bool backwards) QModelIndex objIdx = m_objList_model->indexFromItem(objQ); onManual_treeView_objList_selectionChanged(objIdx, emptyIdx); + ui->treeView_objList->setFocus(); ui->treeView_objList->scrollTo(objIdx, QAbstractItemView::PositionAtCenter); ui->treeView_objList->selectionModel()->select(objIdx, QItemSelectionModel::SelectCurrent | QItemSelectionModel::Toggle); } @@ -390,6 +397,8 @@ void MainTab_Items::on_pushButton_search_clicked() return; SubDlg_SearchObj dlg(window()); + if (m_lastSearchData.initialized) + dlg.setSearchData(m_lastSearchData); if (!dlg.exec()) return; @@ -400,11 +409,8 @@ void MainTab_Items::on_pushButton_search_clicked() objTree(SCRIPTOBJ_TYPE_MULTI) }; - ScriptSearch::SearchBy_t searchBy; - bool caseSensitive; - std::string key; - dlg.getSearchData(searchBy, caseSensitive, key); - m_scriptSearch.reset(new ScriptSearch(trees, searchBy, caseSensitive, key)); + m_lastSearchData = dlg.getSearchData(); + m_scriptSearch.reset(new ScriptSearch(trees, m_lastSearchData)); doSearch(false); } diff --git a/src/forms/maintab_items.h b/src/forms/maintab_items.h index 84c7da1..94c288a 100644 --- a/src/forms/maintab_items.h +++ b/src/forms/maintab_items.h @@ -59,6 +59,7 @@ private slots: QStandardItemModel *m_objList_model; std::unique_ptr m_scriptSearch; + ScriptSearch::SearchData_t m_lastSearchData; void doSearch (bool backwards); }; diff --git a/src/forms/mainwindow.cpp b/src/forms/mainwindow.cpp index a550858..a27b062 100644 --- a/src/forms/mainwindow.cpp +++ b/src/forms/mainwindow.cpp @@ -11,6 +11,7 @@ #include "dlg_profileclient_options.h" #include "dlg_profilescripts_options.h" #include +#include MainWindow::MainWindow(QWidget *parent) : @@ -20,10 +21,10 @@ MainWindow::MainWindow(QWidget *parent) : ui->setupUi(this); // Setting version in the title bar - #define STRINGIFY(x) #x - #define TOSTRING(x) STRINGIFY(x) + #define _STRINGIFY(x) #x + #define TOSTRING(x) _STRINGIFY(x) QString version = TOSTRING(LEVIATHAN_VERSION); - #undef STRINGIFY + #undef _STRINGIFY #undef TOSTRING #ifndef BUILD_NOT_AUTOMATIC version += "(automated)"; @@ -39,30 +40,62 @@ MainWindow::MainWindow(QWidget *parent) : /* Setting up the menubar */ // Generate Client Profiles menu entries - QAction *actionEditClientProfiles = new QAction("Edit Client Profiles", this); + QAction *actionEditClientProfiles = new QAction("Edit Client Profiles", nullptr); ui->menuProfiles->addAction(actionEditClientProfiles); connect(actionEditClientProfiles, SIGNAL(triggered(bool)), this, SLOT(onManual_actionEditClientProfiles_triggered())); - QAction *actionLoadDefaultClientProfile = new QAction("Load default Client Profile", this); + QAction *actionLoadDefaultClientProfile = new QAction("Load default Client Profile", nullptr); ui->menuProfiles->addAction(actionLoadDefaultClientProfile); connect(actionLoadDefaultClientProfile, SIGNAL(triggered(bool)), this, SLOT(onManual_actionLoadDefaultClientProfile_triggered())); + if (!g_clientProfiles.empty()) + { + QMenu *menuLoadClientProfile = new QMenu("Load Client Profile...", nullptr); + QSignalMapper* clientProfilesSignalMapper = new QSignalMapper(); + std::vector clientProfileActions; + for (size_t i = 0; i < g_clientProfiles.size(); ++i) + { + clientProfileActions.emplace_back(new QAction(g_clientProfiles[i].m_name.c_str(), nullptr)); + menuLoadClientProfile->addAction(clientProfileActions[i]); + connect(clientProfileActions[i], SIGNAL(triggered()), clientProfilesSignalMapper, SLOT(map())); + clientProfilesSignalMapper->setMapping(clientProfileActions[i], (int)i); + } + connect(clientProfilesSignalMapper, SIGNAL(mapped(int)), this, SLOT(onManual_actionLoadClientProfile_mapped(int))); + ui->menuProfiles->addMenu(menuLoadClientProfile); + } + ui->menuProfiles->addSeparator(); // Generate Scripts Profiles menu entries - QAction *actionEditScriptsProfiles = new QAction("Edit Scripts Profiles", this); + QAction *actionEditScriptsProfiles = new QAction("Edit Scripts Profiles", nullptr); ui->menuProfiles->addAction(actionEditScriptsProfiles); connect(actionEditScriptsProfiles, SIGNAL(triggered(bool)), this, SLOT(onManual_actionEditScriptsProfiles_triggered())); - QAction *actionLoadDefaultScriptsProfile = new QAction("Load default Scripts Profile", this); + QAction *actionLoadDefaultScriptsProfile = new QAction("Load default Scripts Profile", nullptr); ui->menuProfiles->addAction(actionLoadDefaultScriptsProfile); connect(actionLoadDefaultScriptsProfile, SIGNAL(triggered(bool)), this, SLOT(onManual_actionLoadDefaultScriptsProfile_triggered())); + if (!g_scriptsProfiles.empty()) + { + QMenu *menuLoadScriptsProfile = new QMenu("Load Scripts Profile...", nullptr); + QSignalMapper* scriptsProfilesSignalMapper = new QSignalMapper(); + std::vector scriptsProfileActions; + for (size_t i = 0; i < g_scriptsProfiles.size(); ++i) + { + scriptsProfileActions.emplace_back(new QAction(g_scriptsProfiles[i].m_name.c_str(), nullptr)); + menuLoadScriptsProfile->addAction(scriptsProfileActions[i]); + connect(scriptsProfileActions[i], SIGNAL(triggered()), scriptsProfilesSignalMapper, SLOT(map())); + scriptsProfilesSignalMapper->setMapping(scriptsProfileActions[i], (int)i); + } + connect(scriptsProfilesSignalMapper, SIGNAL(mapped(int)), this, SLOT(onManual_actionLoadScriptsProfile_mapped(int))); + ui->menuProfiles->addMenu(menuLoadScriptsProfile); + } + // TODO: add in a submenu the actions to load every single, stored profile // Generate Settings entry //ui->menuProfiles->addSeparator(); - QAction *actionSettings = new QAction("Settings", this); + QAction *actionSettings = new QAction("Settings", nullptr); //ui->menuProfiles->addAction(actionSettings); ui->menuBar->addAction(actionSettings); connect(actionSettings, SIGNAL(triggered(bool)), this, SLOT(onManual_actionSettings_triggered())); @@ -93,6 +126,11 @@ MainWindow::~MainWindow() } +void MainWindow::on_tabWidget_currentChanged(int /* UNUSED: index */) +{ + ui->tabWidget->currentWidget()->setFocus(); // i need the keyboard focus to be able to use CTRL + F to start a search +} + /* Menu bar actions */ void MainWindow::onManual_actionEditClientProfiles_triggered() @@ -128,6 +166,16 @@ void MainWindow::onManual_actionSettings_triggered() dlg.exec(); } +void MainWindow::onManual_actionLoadClientProfile_mapped(int index) +{ + loadClientProfile(index); +} + +void MainWindow::onManual_actionLoadScriptsProfile_mapped(int index) +{ + loadScriptProfile(index); +} + void MainWindow::on_checkBox_onTop_toggled(bool checked) { if (checked) @@ -225,4 +273,3 @@ void MainWindow::loadScriptProfile(int index) m_MainTab_Items_inst->updateViews(); } - diff --git a/src/forms/mainwindow.h b/src/forms/mainwindow.h index 6b02b6c..2993c9d 100644 --- a/src/forms/mainwindow.h +++ b/src/forms/mainwindow.h @@ -20,14 +20,17 @@ class MainWindow : public QMainWindow ~MainWindow(); private slots: + void on_tabWidget_currentChanged(int /* UNUSED: index */); void onManual_actionEditScriptsProfiles_triggered(); void onManual_actionLoadDefaultScriptsProfile_triggered(); void onManual_actionEditClientProfiles_triggered(); void onManual_actionLoadDefaultClientProfile_triggered(); void onManual_actionSettings_triggered(); + void onManual_actionLoadClientProfile_mapped(int index); + void onManual_actionLoadScriptsProfile_mapped(int index); void on_checkBox_onTop_toggled(bool checked); void on_checkBox_focus_toggled(bool checked); - void loadDefaultProfiles(); + void loadDefaultProfiles(); private: Ui::MainWindow *ui; diff --git a/src/forms/subdlg_searchobj.cpp b/src/forms/subdlg_searchobj.cpp index 9a074d6..76dc9fa 100644 --- a/src/forms/subdlg_searchobj.cpp +++ b/src/forms/subdlg_searchobj.cpp @@ -10,20 +10,45 @@ SubDlg_SearchObj::SubDlg_SearchObj(QWidget *parent) : setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint); ui->setupUi(this); + ui->radioButton_description->setChecked(true); // default QTimer::singleShot(50, ui->lineEdit_value, SLOT(setFocus())); } -void SubDlg_SearchObj::getSearchData(ScriptSearch::SearchBy_t &searchBy, bool &caseSensitive, std::string &key) +ScriptSearch::SearchData_t SubDlg_SearchObj::getSearchData() { + ScriptSearch::SearchData_t ret; + using s_t = ScriptSearch::SearchBy_t; if (ui->radioButton_id->isChecked()) - searchBy = s_t::ID; + ret.searchBy = s_t::ID; else if (ui->radioButton_defname->isChecked()) - searchBy = s_t::Defname; + ret.searchBy = s_t::Defname; else //if (ui->radioButton_description->isChecked()) - searchBy = s_t::Description; - caseSensitive = ui->checkBox_casesensitive->isChecked(); - key = ui->lineEdit_value->text().toStdString(); + ret.searchBy = s_t::Description; + + ret.caseSensitive = ui->checkBox_casesensitive->isChecked(); + ret.key = ui->lineEdit_value->text().toStdString(); + + ret.initialized = true; + return ret; +} + +void SubDlg_SearchObj::setSearchData(ScriptSearch::SearchData_t data) +{ + if (!data.initialized) + return; + + ui->checkBox_casesensitive->setChecked(data.caseSensitive); + ui->lineEdit_value->setText(data.key.c_str()); + + using s_t = ScriptSearch::SearchBy_t; + switch (data.searchBy) + { + case s_t::ID: ui->radioButton_id->setChecked(true); break; + case s_t::Defname: ui->radioButton_defname->setChecked(true); break; + //case s_t::Description: + default: ui->radioButton_description->setChecked(true); break; + } } SubDlg_SearchObj::~SubDlg_SearchObj() diff --git a/src/forms/subdlg_searchobj.h b/src/forms/subdlg_searchobj.h index b15a477..b113cff 100644 --- a/src/forms/subdlg_searchobj.h +++ b/src/forms/subdlg_searchobj.h @@ -16,7 +16,10 @@ class SubDlg_SearchObj : public QDialog public: explicit SubDlg_SearchObj(QWidget *parent = 0); ~SubDlg_SearchObj(); - void getSearchData(ScriptSearch::SearchBy_t &searchBy, bool &caseSensitive, std::string &key); + + ScriptSearch::SearchData_t getSearchData(); + void setSearchData(ScriptSearch::SearchData_t data); + private slots: void on_pushButton_ok_clicked(); diff --git a/src/forms/subdlg_searchobj.ui b/src/forms/subdlg_searchobj.ui index 2c0e084..0373bb0 100644 --- a/src/forms/subdlg_searchobj.ui +++ b/src/forms/subdlg_searchobj.ui @@ -125,7 +125,7 @@ Description - + true diff --git a/src/keystrokesender/keystrokesender_windows.cpp b/src/keystrokesender/keystrokesender_windows.cpp index 2d374e4..aaadc46 100644 --- a/src/keystrokesender/keystrokesender_windows.cpp +++ b/src/keystrokesender/keystrokesender_windows.cpp @@ -9,6 +9,8 @@ #include #include +const int delayKeystrokes = 50; //milliseconds + namespace keystrokesender { @@ -104,7 +106,7 @@ bool KeystrokeSender_Windows::sendEnter() // KeyDown PostMessage(m_UOHandle, WM_KEYDOWN, VK_RETURN, (LPARAM)( 1 )); - std::this_thread::sleep_for(std::chrono::milliseconds(40)); + std::this_thread::sleep_for(std::chrono::milliseconds(delayKeystrokes)); // KeyUp PostMessage(m_UOHandle, WM_KEYUP, VK_RETURN, (LPARAM)( 1 | (1 << 30) | (1 << 31) )); @@ -133,7 +135,7 @@ bool KeystrokeSender_Windows::sendString(const char * const str, bool enterTermi { if (!sendChar(str[i])) return false; - std::this_thread::sleep_for(std::chrono::milliseconds(40)); + std::this_thread::sleep_for(std::chrono::milliseconds(delayKeystrokes)); } if (enterTerminated) diff --git a/src/spherescript/scriptsearch.cpp b/src/spherescript/scriptsearch.cpp index 179fd77..354c6ae 100644 --- a/src/spherescript/scriptsearch.cpp +++ b/src/spherescript/scriptsearch.cpp @@ -3,12 +3,12 @@ #include ScriptSearch::ScriptSearch - (const std::vector &trees, SearchBy_t searchBy, bool caseSensitive, std::string key) : - m_trees(trees), m_searchBy(searchBy), m_caseSensitive(caseSensitive), m_key(key), + (const std::vector &trees, SearchData_t data) : + m_trees(trees), m_searchBy(data.searchBy), m_caseSensitive(data.caseSensitive), m_key(data.key), m_curTreeIdx(0), m_it(m_trees[0]->begin()), m_lastFoundTreeIdx(0), m_it_lastFound(m_trees[0]->end()), m_lastOperation(LastOperation_t::None) { - if (!caseSensitive) + if (!data.caseSensitive) strToUpper(m_key); } diff --git a/src/spherescript/scriptsearch.h b/src/spherescript/scriptsearch.h index 4522826..0cc7551 100644 --- a/src/spherescript/scriptsearch.h +++ b/src/spherescript/scriptsearch.h @@ -15,17 +15,26 @@ struct ScriptSearch Description }; - /* - typedef struct SearchData_s + enum class LastOperation_t + { + None, + Next, + Previous + }; + + typedef struct SearchData_s // to comfortably pass the data relating to a search session { - SearchBy_t searchBy; - bool caseSensitive; - std::string key; + SearchBy_t searchBy; + bool caseSensitive; + std::string key; + + bool initialized; // needed by SubDlg_SearchObj + SearchData_s(): initialized(false) {} } SearchData_t; - */ + public: - ScriptSearch(const std::vector &trees, SearchBy_t searchBy, bool caseSensitive, std::string key); + ScriptSearch(const std::vector &trees, SearchData_t data); ScriptObj* next(); ScriptObj* previous(); @@ -39,13 +48,7 @@ struct ScriptSearch ScriptObjTree::iterator m_it; size_t m_lastFoundTreeIdx; ScriptObjTree::iterator m_it_lastFound; - - enum class LastOperation_t - { - None, - Next, - Previous - } m_lastOperation; + LastOperation_t m_lastOperation; ScriptObj *isMatch(); }; diff --git a/src/sysio.cpp b/src/sysio.cpp index b62388a..b42d007 100644 --- a/src/sysio.cpp +++ b/src/sysio.cpp @@ -15,7 +15,7 @@ bool isValidFile(std::string filePath) { struct stat info; - if(stat( filePath.c_str(), &info ) != 0) + if (stat( filePath.c_str(), &info ) != 0) return false; else return true; @@ -25,9 +25,9 @@ bool isValidDirectory(std::string directoryPath) { struct stat info; - if(stat( directoryPath.c_str(), &info ) != 0) + if (stat( directoryPath.c_str(), &info ) != 0) return false; - else if(info.st_mode & S_IFDIR) + else if (info.st_mode & S_IFDIR) return true; else return false; diff --git a/src/uofiles/uoart.cpp b/src/uofiles/uoart.cpp index 3c4262a..1fd7869 100644 --- a/src/uofiles/uoart.cpp +++ b/src/uofiles/uoart.cpp @@ -44,7 +44,7 @@ QImage* UOArt::drawArt(unsigned int id, unsigned int hueIndex, bool partialHue) } fs_art.seekg(lookup); - int_fast16_t width = 0, height = 0; + int16_t width = 0, height = 0; QImage* img = nullptr; @@ -83,7 +83,7 @@ QImage* UOArt::drawArt(unsigned int id, unsigned int hueIndex, bool partialHue) img->fill(0); // Algorithm from Punt's C++ Ultima SDK - uint_fast16_t rawcolor_argb16 = 0; + uint16_t rawcolor_argb16 = 0; int X = 22; int Y = 0; int linewidth = 2; @@ -163,7 +163,7 @@ QImage* UOArt::drawArt(unsigned int id, unsigned int hueIndex, bool partialHue) When the line is completed, simply reset X to 0, increase Y, and seek to the next lookup in the lookupTable array and continue. */ - uint_fast32_t flags = 0; + uint32_t flags = 0; fs_art.read(reinterpret_cast(&flags), 4); fs_art.read(reinterpret_cast(&width), 2); fs_art.read(reinterpret_cast(&height), 2); @@ -183,7 +183,7 @@ QImage* UOArt::drawArt(unsigned int id, unsigned int hueIndex, bool partialHue) X=0; fs_art.seekg(lookups[Y] * 2 + datastart); - uint_fast16_t xOffset = 1, xRun = 1; + uint16_t xOffset = 1, xRun = 1; while (xOffset + xRun != 0) { fs_art.read(reinterpret_cast(&xOffset), 2); @@ -193,7 +193,7 @@ QImage* UOArt::drawArt(unsigned int id, unsigned int hueIndex, bool partialHue) X += xOffset ; for (unsigned jj=0; jj < xRun; ++jj) { - uint_fast16_t rawcolor_argb16 = 0; + uint16_t rawcolor_argb16 = 0; fs_art.read(reinterpret_cast(&rawcolor_argb16), 2); ARGB16 color_argb16 = ARGB16(rawcolor_argb16); if (hueIndex != 0) diff --git a/src/version.h b/src/version.h index 1640855..c4f83be 100644 --- a/src/version.h +++ b/src/version.h @@ -1,7 +1,7 @@ #ifndef VERSION_H #define VERSION_H -#define LEVIATHAN_VERSION 0.1.3a +#define LEVIATHAN_VERSION 0.1.4 #define BUILD_NOT_AUTOMATIC #endif // VERSION_H