Skip to content

Commit 17e4cbf

Browse files
Fix paste for Wild Pokemon not updating data in memory
1 parent 6ab6a13 commit 17e4cbf

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project somewhat adheres to [Semantic Versioning](https://semver.org/sp
1212

1313
### Fixed
1414
- Fix metatile images exporting at 2x scale.
15+
- Fix pasting Wild Pokémon data then changing maps resetting the pasted data.
1516
- Fix click-drag map selections behaving unexpectedly when the cursor is outside the map grid.
1617
- Fix events being dragged in negative coordinates lagging behind the cursor.
1718
- Fix the shortcut for duplicating events working while on the Connections tab.

include/ui/montabwidget.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ public slots:
3333
void setTabActive(int index, bool active = true);
3434
void deactivateTab(int tabIndex);
3535

36+
signals:
37+
void edited();
38+
3639
private:
3740
void actionCopyTab(int index);
3841
void actionAddDeleteTab(int index);

src/ui/montabwidget.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ static WildMonInfo encounterClipboard;
1111

1212
MonTabWidget::MonTabWidget(Editor *editor, QWidget *parent) : QTabWidget(parent) {
1313
this->editor = editor;
14+
connect(this, &MonTabWidget::edited, this->editor, &Editor::saveEncounterTabData);
15+
connect(this, &MonTabWidget::edited, this->editor, &Editor::wildMonTableEdited);
16+
1417
populate();
1518
this->tabBar()->installEventFilter(new WheelFilter(this));
1619
}
@@ -64,7 +67,7 @@ void MonTabWidget::paste(int index) {
6467
WildMonInfo newInfo = getDefaultMonInfo(this->editor->project->wildMonFields.at(index));
6568
combineEncounters(newInfo, encounterClipboard);
6669
populateTab(index, newInfo);
67-
emit editor->wildMonTableEdited();
70+
emit edited();
6871
}
6972

7073
void MonTabWidget::actionCopyTab(int index) {
@@ -88,15 +91,12 @@ void MonTabWidget::actionAddDeleteTab(int index) {
8891
if (activeTabs[index]) {
8992
// delete tab
9093
deactivateTab(index);
91-
editor->saveEncounterTabData();
92-
}
93-
else {
94+
} else {
9495
// add tab
9596
populateTab(index, getDefaultMonInfo(editor->project->wildMonFields.at(index)));
96-
editor->saveEncounterTabData();
9797
setCurrentIndex(index);
9898
}
99-
emit editor->wildMonTableEdited();
99+
emit edited();
100100
}
101101

102102
void MonTabWidget::clearTableAt(int tabIndex) {
@@ -123,8 +123,7 @@ void MonTabWidget::populateTab(int tabIndex, WildMonInfo monInfo) {
123123
QTableView *speciesTable = tableAt(tabIndex);
124124

125125
EncounterTableModel *model = new EncounterTableModel(monInfo, editor->project->wildMonFields[tabIndex], this);
126-
connect(model, &EncounterTableModel::edited, editor, &Editor::saveEncounterTabData);
127-
connect(model, &EncounterTableModel::edited, editor, &Editor::wildMonTableEdited);
126+
connect(model, &EncounterTableModel::edited, this, &MonTabWidget::edited);
128127
speciesTable->setModel(model);
129128

130129
speciesTable->setItemDelegateForColumn(EncounterTableModel::ColumnType::Species, new SpeciesComboDelegate(editor->project, this));

0 commit comments

Comments
 (0)