Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
halloffame.h
Go to the documentation of this file.
1/*
2 * Copyright 2020 Twilight
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15*/
16#pragma once
17#include <QObject>
18#include <QVector>
19#include <QQmlListProperty>
20#include <pse-common/types.h>
22
23class SaveFile;
24class HoFRecord;
25
26constexpr var8 recordsMax = 50;
27
37class SAVEFILE_AUTOPORT HallOfFame : public QObject
38{
39 Q_OBJECT
40
41public:
42 HallOfFame(SaveFile* saveFile = nullptr);
43 virtual ~HallOfFame();
44
45 void load(SaveFile* saveFile = nullptr);
46 void save(SaveFile* saveFile);
47
48 // Since Qt has tied my hands in so many ways on fixing the issue of no arrays
49 // but primitive arrays being able to be sent to QML, I'm left with no other
50 // options outside of a custom model to flood classes with a series of methods
51 // for each and every array of any kind that's not primitive
52 Q_INVOKABLE int recordCount();
53 Q_INVOKABLE int recordMax();
54 Q_INVOKABLE HoFRecord* recordAt(int ind);
55 Q_INVOKABLE void recordSwap(int from, int to);
56 Q_INVOKABLE void recordRemove(int ind);
57 Q_INVOKABLE void recordNew();
58
59signals:
61
62public slots:
63 void reset();
64 void randomize();
65
66public:
67 // All Hall of Fame Records
68 QVector<HoFRecord*> records;
69};
QVector< HoFRecord * > records
Every Hall of Fame record.
Definition halloffame.h:68
int recordCount()
Number of records.
void save(SaveFile *saveFile)
Flatten the Hall of Fame records to the save.
void randomize()
Fill with random records.
HallOfFame(SaveFile *saveFile=nullptr)
HoFRecord * recordAt(int ind)
Record ind (GC-protected return).
void load(SaveFile *saveFile=nullptr)
Expand the Hall of Fame records from the save.
protected::void recordsChanged()
void reset()
Clear all records.
void recordNew()
Add a fresh record.
int recordMax()
Capacity (recordsMax).
void recordSwap(int from, int to)
Reorder records.
void recordRemove(int ind)
Remove record ind.
One Hall of Fame record: the team that beat the Elite Four, in order.
Definition hofrecord.h:37
One loaded save: the raw 32 KB bytes, their expanded object tree, and the tools that move between the...
Definition savefile.h:46
Project-wide fixed-width integer aliases (var8, var16, ...).
var8e var8
Everyday 8-bit alias. Exact (not "fastest") to dodge the pointer-width bug noted above.
Definition types.h:124
constexpr var8 recordsMax
Maximum Hall of Fame records the save keeps.
Definition halloffame.h:26
Import/export macro for the savefile library, plus the central list of QObject types kept deliberatel...
#define SAVEFILE_AUTOPORT
Expands to the correct dllexport/dllimport decoration for this library.