Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
hofrecord.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 <pse-common/types.h>
21
22class SaveFile;
23class HoFPokemon;
24
25constexpr var8 maxPokemon = 6;
26
36class SAVEFILE_AUTOPORT HoFRecord : public QObject
37{
38 Q_OBJECT
39
40public:
42 HoFRecord(SaveFile* saveFile = nullptr, var8 ind = 0);
43 virtual ~HoFRecord();
44
45 void load(SaveFile* saveFile = nullptr, var8 ind = 0);
46 void save(SaveFile* saveFile, var8 ind);
47
48 Q_INVOKABLE int pokemonCount();
49 Q_INVOKABLE int pokemonMax();
50 Q_INVOKABLE HoFPokemon* pokemonAt(int ind);
51 Q_INVOKABLE void pokemonSwap(int from, int to);
52 Q_INVOKABLE void pokemonRemove(int ind);
53 Q_INVOKABLE void pokemonNew();
54
55signals:
57
58public slots:
59 void reset();
60 void randomize();
61
62public:
63 QVector<HoFPokemon*> pokemon;
64};
One Pokemon entry within a Hall of Fame record: species, level, name.
Definition hofpokemon.h:34
void pokemonNew()
Add a fresh mon.
Definition hofrecord.cpp:79
void save(SaveFile *saveFile, var8 ind)
Flatten record ind to the save.
protected::void pokemonChanged()
The record's mon list changed.
void reset()
Empty this record.
void randomize()
Fill with random mons.
void load(SaveFile *saveFile=nullptr, var8 ind=0)
Expand record ind from the save.
Definition hofrecord.cpp:88
HoFRecord(SaveFile *saveFile=nullptr, var8 ind=0)
Definition hofrecord.cpp:30
QVector< HoFPokemon * > pokemon
The recorded team.
Definition hofrecord.h:63
int pokemonMax()
Capacity (maxPokemon).
Definition hofrecord.cpp:46
void pokemonRemove(int ind)
Remove mon ind.
Definition hofrecord.cpp:67
HoFPokemon * pokemonAt(int ind)
Mon at ind (GC-protected return).
Definition hofrecord.cpp:51
void pokemonSwap(int from, int to)
Reorder mons.
Definition hofrecord.cpp:56
int pokemonCount()
Mons in this record.
Definition hofrecord.cpp:41
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 maxPokemon
Mons recorded per Hall of Fame entry (a full party).
Definition hofrecord.h:25
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.