|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
Holds contents of a single Pokemon storage box. More...
#include <pokemonstoragebox.h>
Public Member Functions | |
| PokemonStorageBox (int maxSize=boxMaxPokemon, SaveFile *saveFile=nullptr, var16 boxOffset=0) | |
| < How many mons are in the box. | |
| virtual | ~PokemonStorageBox () |
| virtual void | load (SaveFile *saveFile=nullptr, var16 boxOffset=0) |
| Expand the box from the save. | |
| virtual void | save (SaveFile *saveFile, var16 boxOffset=0) |
| Flatten the box to the save. | |
| int | pokemonCount () |
| Number of mons present. | |
| int | pokemonMax () |
| Capacity (maxSize). | |
| bool | isFull () |
| At capacity. | |
| PokemonBox * | pokemonAt (int ind) |
Mon at ind (GC-protected return). | |
| void | reset () |
| Empty the box. | |
| virtual void | randomize (PlayerBasics *basics) |
| Fill with constrained random mons. | |
| bool | pokemonMove (int from, int to) |
| Reorder a mon within the box. | |
| void | pokemonRemove (int ind) |
Remove the mon at ind. | |
| virtual void | pokemonNew () |
| Add a fresh mon. | |
| bool | relocateAll (PokemonStorageBox *dst) |
Move every mon into dst. | |
| virtual bool | relocateOne (PokemonStorageBox *dst, int ind) |
Move one mon into dst. | |
Public Attributes | |
| bool | isParty = false |
| True if this box is actually the party (affects record format). | |
| QVector< PokemonBox * > | pokemon |
| The stored mons. | |
| int | maxSize = 0 |
| Capacity. | |
| SaveFile * | file |
| Owning save. | |
Protected Member Functions | |
| void | pokemonChanged () |
| Box contents changed. | |
| void | pokemonMoveChange (int from, int to) |
| A mon moved slot. | |
| void | pokemonRemoveChange (int ind) |
| A mon was removed. | |
| void | pokemonInsertChange () |
| A mon was inserted. | |
| void | pokemonResetChange () |
| The box was reset. | |
Protected Attributes | |
| : void beforePokemonRelocate(PokemonBox* item) | |
| Emitted before a relocate so models can clean up. | |
Holds contents of a single Pokemon storage box.
A container of PokemonBox records – one PC box (or, when subclassed by PlayerPokemon, the party).
Owns a vector of pokemon up to maxSize and provides QML-facing count/full state plus slot access, reordering, removal, insertion, and box-to-box relocation. The isParty flag distinguishes a party from a box, which matters because party and box records are NOT interchangeable on disk (PokemonBox::isBoxMon()).
Definition at line 48 of file pokemonstoragebox.h.
| PokemonStorageBox::PokemonStorageBox | ( | int | maxSize = boxMaxPokemon, |
| SaveFile * | saveFile = nullptr, | ||
| var16 | boxOffset = 0 ) |
< How many mons are in the box.
Is the box at capacity? Box capacity.
| maxSize | Capacity. |
| saveFile | Source save. |
| boxOffset | Box location in the save. |
Definition at line 34 of file pokemonstoragebox.cpp.
References load(), and maxSize.
Referenced by PlayerPokemon::PlayerPokemon(), pokemonResetChange(), relocateAll(), and relocateOne().
|
virtual |
Definition at line 53 of file pokemonstoragebox.cpp.
References pokemon.
| bool PokemonStorageBox::isFull | ( | ) |
Expand the box from the save.
Reimplemented in PlayerPokemon.
Definition at line 160 of file pokemonstoragebox.cpp.
References file, maxSize, pokemon, pokemonChanged(), pokemonInsertChange(), reset(), and SaveFile::toolset.
Referenced by PokemonStorageBox().
| PokemonBox * PokemonStorageBox::pokemonAt | ( | int | ind | ) |
Mon at ind (GC-protected return).
Definition at line 74 of file pokemonstoragebox.cpp.
References pokemon, and qmlCppOwned().
|
protected |
Box contents changed.
Referenced by PlayerPokemon::load(), load(), PokemonBoxSelectModel::PokemonBoxSelectModel(), pokemonMove(), PlayerPokemon::pokemonNew(), pokemonNew(), PokemonOverviewModel::PokemonOverviewModel(), pokemonRemove(), PlayerPokemon::randomize(), randomize(), relocateOne(), and reset().
| int PokemonStorageBox::pokemonCount | ( | ) |
Number of mons present.
Definition at line 59 of file pokemonstoragebox.cpp.
References pokemon.
Referenced by PokemonStorageModel::checkedDelete(), PokemonBoxSelectModel::getDecoratedName(), and PokemonOverviewModel::rebuild().
|
protected |
A mon was inserted.
Referenced by PlayerPokemon::load(), load(), PlayerPokemon::pokemonNew(), pokemonNew(), PlayerPokemon::randomize(), randomize(), relocateOne(), and PokemonStorageModel::switchBox().
| int PokemonStorageBox::pokemonMax | ( | ) |
Capacity (maxSize).
Definition at line 64 of file pokemonstoragebox.cpp.
References maxSize.
Referenced by PokemonStorageModel::checkedDelete(), PokemonBoxSelectModel::getDecoratedName(), relocateAll(), and relocateOne().
| bool PokemonStorageBox::pokemonMove | ( | int | from, |
| int | to ) |
Reorder a mon within the box.
Definition at line 79 of file pokemonstoragebox.cpp.
References pokemon, pokemonChanged(), and pokemonMoveChange().
Referenced by PokemonStorageModel::checkedMoveDown(), PokemonStorageModel::checkedMoveToBottom(), PokemonStorageModel::checkedMoveToTop(), PokemonStorageModel::checkedMoveUp(), and pokemonResetChange().
|
protected |
A mon moved slot.
Referenced by pokemonMove(), and PokemonStorageModel::switchBox().
|
virtual |
Add a fresh mon.
Reimplemented in PlayerPokemon.
Definition at line 115 of file pokemonstoragebox.cpp.
References file, maxSize, PokemonBox::newPokemon(), pokemon, pokemonChanged(), pokemonInsertChange(), and PokemonRandom::Random_Starters.
Referenced by pokemonResetChange().
| void PokemonStorageBox::pokemonRemove | ( | int | ind | ) |
Remove the mon at ind.
Definition at line 102 of file pokemonstoragebox.cpp.
References pokemon, pokemonChanged(), and pokemonRemoveChange().
Referenced by PokemonStorageModel::checkedDelete(), and pokemonResetChange().
|
protected |
A mon was removed.
Referenced by pokemonRemove(), relocateOne(), and PokemonStorageModel::switchBox().
|
protected |
The box was reset.
References pokemonMove(), pokemonNew(), pokemonRemove(), PokemonStorageBox(), randomize(), relocateAll(), relocateOne(), and reset().
Referenced by reset(), and PokemonStorageModel::switchBox().
|
virtual |
Fill with constrained random mons.
Reimplemented in PlayerPokemon.
Definition at line 224 of file pokemonstoragebox.cpp.
References Random::inst(), maxSize, pokemon, pokemonChanged(), pokemonInsertChange(), PokemonBox::randomize(), Random::rangeInclusive(), and reset().
Referenced by pokemonResetChange().
| bool PokemonStorageBox::relocateAll | ( | PokemonStorageBox * | dst | ) |
Move every mon into dst.
Definition at line 126 of file pokemonstoragebox.cpp.
References pokemon, pokemonMax(), PokemonStorageBox(), and relocateOne().
Referenced by pokemonResetChange().
|
virtual |
Move one mon into dst.
Definition at line 138 of file pokemonstoragebox.cpp.
References pokemon, pokemonChanged(), pokemonInsertChange(), pokemonMax(), pokemonRemoveChange(), and PokemonStorageBox().
Referenced by PokemonStorageModel::checkedTransfer(), pokemonResetChange(), and relocateAll().
| void PokemonStorageBox::reset | ( | ) |
Empty the box.
Definition at line 213 of file pokemonstoragebox.cpp.
References pokemon, pokemonChanged(), and pokemonResetChange().
Referenced by PlayerPokemon::load(), load(), pokemonResetChange(), PlayerPokemon::randomize(), and randomize().
Flatten the box to the save.
Reimplemented in PlayerPokemon.
Definition at line 186 of file pokemonstoragebox.cpp.
References maxSize, pokemon, SaveFileToolset::setByte(), and SaveFile::toolset.
|
protected |
Emitted before a relocate so models can clean up.
Definition at line 68 of file pokemonstoragebox.h.
| SaveFile* PokemonStorageBox::file |
Owning save.
Definition at line 96 of file pokemonstoragebox.h.
Referenced by PlayerPokemon::load(), load(), PlayerPokemon::pokemonNew(), and pokemonNew().
| bool PokemonStorageBox::isParty = false |
True if this box is actually the party (affects record format).
Definition at line 93 of file pokemonstoragebox.h.
Referenced by PlayerPokemon::PlayerPokemon().
| int PokemonStorageBox::maxSize = 0 |
Capacity.
Definition at line 95 of file pokemonstoragebox.h.
Referenced by isFull(), load(), PlayerPokemon::PlayerPokemon(), pokemonMax(), PlayerPokemon::pokemonNew(), pokemonNew(), PokemonStorageBox(), randomize(), and save().
| QVector<PokemonBox*> PokemonStorageBox::pokemon |
The stored mons.
Definition at line 94 of file pokemonstoragebox.h.
Referenced by PokemonStorageModel::checkedDelete(), PokemonStorageModel::checkedMoveDown(), PokemonStorageModel::checkedMoveToBottom(), PokemonStorageModel::checkedMoveToTop(), PokemonStorageModel::checkedMoveUp(), PokemonStorageModel::checkedToggleAll(), PokemonStorageModel::checkedTransfer(), PokemonStorageModel::clearCheckedStateGone(), PokemonStorageModel::data(), PokemonStorageModel::dragReorder(), PokemonStorageModel::getPartyMon(), isFull(), PlayerPokemon::load(), load(), PlayerPokemon::partyAt(), pokemonAt(), pokemonCount(), pokemonMove(), PlayerPokemon::pokemonNew(), pokemonNew(), pokemonRemove(), PlayerPokemon::randomize(), randomize(), PokemonOverviewModel::rebuild(), relocateAll(), relocateOne(), reset(), PokemonStorageModel::rowCount(), PlayerPokemon::save(), save(), PokemonStorageModel::setData(), and ~PokemonStorageBox().