diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 776da9f40..996025b9e 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -1,3 +1,18 @@ +### Version 32.0 Patch Notes + +*** +- moved the gridview controls (grouping, searching, population counts) to their own toolbar, which can be moved, hidden, etc. +- changed the unit details dock to display skills, attributes, preferences, etc. in individual dock windows instead of using tables/trees in a splitter. +- updated some thought descriptions +- updated/fixed skill_level functions for scripts and updated the documentation +- added is_female() script function +- removed alchemy from the hauling labours in the default view + +- fixed script functions for get_gender, get_orientation, trained_level +- fixes an issue with rusted dabbling skills showing as legendary +- fixed typos +- fixes setting nicknames/professions (felliott) + ### Version 31.0 Patch Notes *** diff --git a/inc/defines.h b/inc/defines.h index 53a3fdf08..73eb61038 100644 --- a/inc/defines.h +++ b/inc/defines.h @@ -27,7 +27,7 @@ THE SOFTWARE. #define PRODUCT "Dwarf Therapist" #ifndef DT_VERSION_MAJOR - #define DT_VERSION_MAJOR 31 + #define DT_VERSION_MAJOR 32 #endif #ifndef DT_VERSION_MINOR diff --git a/inc/grid_view/viewcolumn.h b/inc/grid_view/viewcolumn.h index d0e8bcc7b..ed4b88d4a 100644 --- a/inc/grid_view/viewcolumn.h +++ b/inc/grid_view/viewcolumn.h @@ -74,7 +74,6 @@ class ViewColumn : public QObject { default: return "DEFAULT"; } - return "???"; } static inline COLUMN_SORT_TYPE get_sort_type(const QString &name) { diff --git a/inc/healthinfo.h b/inc/healthinfo.h index 1f3a5be14..07966f62d 100644 --- a/inc/healthinfo.h +++ b/inc/healthinfo.h @@ -18,6 +18,7 @@ class HealthInfo{ m_symbol = "???"; m_color_name = "#FF0000"; m_severity = 99; + m_type_flags = 0; m_cat_id = eHealth::HI_UNK; } diff --git a/inc/models/dwarfmodelproxy.h b/inc/models/dwarfmodelproxy.h index 7a694451d..9f3f92774 100644 --- a/inc/models/dwarfmodelproxy.h +++ b/inc/models/dwarfmodelproxy.h @@ -67,8 +67,6 @@ class DwarfModelProxy: public QSortFilterProxyModel { QString get_script(const QString script_name) {return m_scripts.value(script_name).script_body;} void clear_script(const QString script_name = ""); void clear_script(const FILTER_SCRIPT_TYPE sType, const bool refresh); - - void refresh_script(); QList get_filtered_dwarves(); public slots: diff --git a/src/dfinstance.cpp b/src/dfinstance.cpp index 0304f809a..e0f308980 100644 --- a/src/dfinstance.cpp +++ b/src/dfinstance.cpp @@ -81,10 +81,14 @@ DFInstance::DFInstance(QObject* parent) , m_heartbeat_timer(new QTimer(this)) , m_dwarf_race_id(0) , m_dwarf_civ_id(0) + , m_current_year(0) + , m_cur_year_tick(0) + , m_cur_time(0) , m_languages(0x0) , m_fortress(0x0) , m_fortress_name(tr("Embarking")) , m_fortress_name_translated("") + , m_squad_vector(0) { // let subclasses start the heartbeat timer, since we don't want to be // checking before we're connected @@ -1048,9 +1052,12 @@ bool DFInstance::add_new_layout(const QString & version, QFile & file) { } MemoryLayout *temp = new MemoryLayout(newFileName); - if (temp && temp->is_valid()) { + if(temp && temp->is_valid()) { LOGI << "adding valid layout" << temp->game_version() << temp->checksum(); m_memory_layouts.insert(temp->checksum().toLower(), temp); + }else{ + LOGI << "ignoring invalid layout from file:" << newFileName; + delete temp; } return true; } diff --git a/src/dwarf.cpp b/src/dwarf.cpp index e9a702f99..4c81d53f8 100644 --- a/src/dwarf.cpp +++ b/src/dwarf.cpp @@ -1069,11 +1069,13 @@ void Dwarf::read_syndromes(){ int race_id = s.get_transform_race(); if(race_id >= 0){ Race *r_trans = m_df->get_race(race_id); - Caste *c_trans = r_trans->get_caste_by_id(0); - if(r_trans && r_trans->flags().has_flag(NIGHT_CREATURE) && c_trans && c_trans->flags().has_flag(CRAZED)){ - is_curse = true; - m_curse_type = eCurse::WEREBEAST; - m_curse_name = r_trans->name(); + if(r_trans){ + Caste *c_trans = r_trans->get_caste_by_id(0); + if(r_trans && r_trans->flags().has_flag(NIGHT_CREATURE) && c_trans && c_trans->flags().has_flag(CRAZED)){ + is_curse = true; + m_curse_type = eCurse::WEREBEAST; + m_curse_name = r_trans->name(); + } } }else if(s.display_name().contains("werecurse",Qt::CaseInsensitive)){ //older version without the necessary offset, use a generic name if it seems like a werecurse diff --git a/src/dwarfdetailswidget.cpp b/src/dwarfdetailswidget.cpp index 97bbf1eb4..629d022d0 100644 --- a/src/dwarfdetailswidget.cpp +++ b/src/dwarfdetailswidget.cpp @@ -159,6 +159,7 @@ DwarfDetailsWidget::DwarfDetailsWidget(QWidget *parent, Qt::WindowFlags flags) dock_area->setObjectName("unit_details_dock_area"); dock_area->setWindowFlags(Qt::Widget); dock_area->setCentralWidget(0); + dock_area->setTabPosition(Qt::AllDockWidgetAreas,QTabWidget::North); ui->verticalLayout->addWidget(dock_area); foreach(QDockWidget *dw, this->findChildren()){ diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 506c3c94b..072372744 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -92,6 +92,7 @@ MainWindow::MainWindow(QWidget *parent) , m_force_connect(false) , m_try_download(true) , m_deleting_settings(false) + , m_toolbar_configured(false) , m_act_sep_optimize(0) , m_btn_optimize(0) { @@ -462,12 +463,15 @@ void MainWindow::read_dwarves() { } //save the ids of the currently selected dwarfs QVector ids; - foreach(Dwarf *d, m_view_manager->get_selected_dwarfs()){ - ids << d->id(); - } - //clear selected dwarfs in the view - if(m_view_manager) + if(m_view_manager){ + foreach(Dwarf *d, m_view_manager->get_selected_dwarfs()){ + if(d){ + ids << d->id(); + } + } + //clear selected dwarfs in the view m_view_manager->clear_selected(); + } //clear data in each column for each view foreach(GridView *gv, m_view_manager->views()){ @@ -522,8 +526,9 @@ void MainWindow::read_dwarves() { i->setData(data,Qt::UserRole+1); filters->appendRow(i); } - if(!dwarf_found) + if(!dwarf_found && dock){ dock->clear(false); + } filters->sort(0,Qt::AscendingOrder); @@ -963,35 +968,37 @@ void MainWindow::save_gridview_csv() QFile f( fileName ); if (f.exists()) f.remove(); - f.open(QIODevice::WriteOnly | QIODevice::Text); - QTextStream out(&f); - - QStringList row; - row.append(tr("Name")); - foreach(ViewColumnSet *set, gv->sets()) { - foreach(ViewColumn *col, set->columns()) { - if (col->type() != CT_SPACER) - row.append(col->title()); + + if(f.open(QIODevice::WriteOnly | QIODevice::Text)){ + QTextStream out(&f); + + QStringList row; + row.append(tr("Name")); + foreach(ViewColumnSet *set, gv->sets()) { + foreach(ViewColumn *col, set->columns()) { + if (col->type() != CT_SPACER) + row.append(col->title()); + } } - } - out << row.join(",") << endl; - row.clear(); - - QList dwarves = m_proxy->get_filtered_dwarves(); - foreach(Dwarf *d, dwarves){ - if(d->is_animal() || d->is_adult() || (!DT->hide_non_adults() && !d->is_adult())){ - row.append(d->nice_name()); - foreach(ViewColumnSet *set, gv->sets()) { - foreach(ViewColumn *col, set->columns()) { - if (col->type() != CT_SPACER) - row.append(col->get_cell_value(d)); + out << row.join(",") << endl; + row.clear(); + + QList dwarves = m_proxy->get_filtered_dwarves(); + foreach(Dwarf *d, dwarves){ + if(d->is_animal() || d->is_adult() || (!DT->hide_non_adults() && !d->is_adult())){ + row.append(d->nice_name()); + foreach(ViewColumnSet *set, gv->sets()) { + foreach(ViewColumn *col, set->columns()) { + if (col->type() != CT_SPACER) + row.append(col->get_cell_value(d)); + } } + out << row.join(",") << endl; + row.clear(); } - out << row.join(",") << endl; - row.clear(); } + f.close(); } - f.close(); } void MainWindow::export_gridviews() { diff --git a/src/models/dwarfmodel.cpp b/src/models/dwarfmodel.cpp index ec99fc401..9419703f7 100644 --- a/src/models/dwarfmodel.cpp +++ b/src/models/dwarfmodel.cpp @@ -504,6 +504,9 @@ void DwarfModel::build_row(const QString &key) { } foreach(Dwarf *d, m_grouped_dwarves.value(key)) { + if(!d) + continue; + QStandardItem *i_name = new QStandardItem(d->nice_name()); bool name_italic = false; @@ -515,7 +518,7 @@ void DwarfModel::build_row(const QString &key) { } //background gradients for nobles - if(d && m_highlight_nobles){ + if(m_highlight_nobles){ if(d->noble_position() != ""){ QColor col = m_df->fortress()->get_noble_color(d->historical_id()); i_name->setData(build_gradient_brush(col,col.alpha(),0,QPoint(0,0),QPoint(1,0)),Qt::BackgroundRole); @@ -524,7 +527,7 @@ void DwarfModel::build_row(const QString &key) { } //set cursed colors - if(d && m_highlight_cursed){ + if(m_highlight_cursed){ switch(d->get_curse_type()){ case eCurse::VAMPIRE: case eCurse::WEREBEAST: diff --git a/src/models/dwarfmodelproxy.cpp b/src/models/dwarfmodelproxy.cpp index 149c90b5e..a7796f15a 100644 --- a/src/models/dwarfmodelproxy.cpp +++ b/src/models/dwarfmodelproxy.cpp @@ -133,10 +133,6 @@ void DwarfModelProxy::clear_script(const FILTER_SCRIPT_TYPE sType, const bool re } } -void DwarfModelProxy::refresh_script(){ - invalidateFilter(); -} - bool DwarfModelProxy::filterAcceptsRow(int source_row, const QModelIndex &source_parent) const { bool matches = true;