|
Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
|
The PC: the item storage box and all 12 Pokemon boxes. More...
#include <storage.h>
Public Member Functions | |
| Storage (SaveFile *saveFile=nullptr) | |
| < The PC item box. | |
| virtual | ~Storage () |
| void | load (SaveFile *saveFile=nullptr) |
| Expand the PC (items + both box sets) from the save. | |
| void | save (SaveFile *saveFile) |
| Flatten the PC back to the save. | |
| int | boxCount () |
| Total boxes across both sets (12). | |
| PokemonStorageBox * | boxAt (int ind) |
Box ind in the flattened 0..11 space (GC-protected return). | |
| PokemonStorageBox * | freeSpace () |
| First box with room, or null if all full. | |
| bool | depositPokemon (PokemonBox *pokemon) |
Put pokemon in the first box with space. | |
| protected::void | itemsChanged () |
| void | curBoxChanged () |
| void | boxesFormattedChanged () |
| void | pokemonChanged () |
| void | reset () |
| Blank the whole PC. | |
| void | randomize (PlayerBasics *basics) |
| Randomize items and Pokemon. | |
| void | randomizePokemon (PlayerBasics *basics) |
| Randomize just the boxed Pokemon. | |
| void | randomizeItems () |
| Randomize just the PC items. | |
Public Attributes | |
| ItemStorageBox * | items = nullptr |
| int | curBox |
| bool | boxesFormatted = false |
| PokemonStorageSet * | pokemon [maxPokemonStorageSets] |
| The two box sets (6 boxes each). | |
The PC: the item storage box and all 12 Pokemon boxes.
A top-level region of the save. Holds the PC items box and two PokemonStorageSets (pokemon, 6 boxes each = 12). It flattens the two sets into one consecutive 0..11 box space for QML (boxAt() ignores set boundaries), and offers deposit/free-space helpers. curBox is the active box index. Standard expanded-node convention (see SaveFileExpanded).
| Storage::Storage | ( | SaveFile * | saveFile = nullptr | ) |
< The PC item box.
Active PC box index (0..11). Whether the boxes are formatted. Total box count (12).
Definition at line 32 of file storage.cpp.
References items, load(), maxPokemonStorageSets, and pokemon.
|
virtual |
Definition at line 42 of file storage.cpp.
References items, maxPokemonStorageSets, and pokemon.
| PokemonStorageBox * Storage::boxAt | ( | int | ind | ) |
Box ind in the flattened 0..11 space (GC-protected return).
Definition at line 55 of file storage.cpp.
References pokemon, qmlCppOwned(), and setMaxBoxes.
Referenced by freeSpace().
| int Storage::boxCount | ( | ) |
Total boxes across both sets (12).
Definition at line 50 of file storage.cpp.
References maxPokemonBoxes.
Referenced by freeSpace().
| void Storage::boxesFormattedChanged | ( | ) |
Referenced by load(), PokemonBoxSelectModel::PokemonBoxSelectModel(), and reset().
| void Storage::curBoxChanged | ( | ) |
Referenced by load(), PokemonBoxSelectModel::PokemonBoxSelectModel(), and reset().
| bool Storage::depositPokemon | ( | PokemonBox * | pokemon | ) |
Put pokemon in the first box with space.
Definition at line 82 of file storage.cpp.
References freeSpace(), and pokemon.
| PokemonStorageBox * Storage::freeSpace | ( | ) |
First box with room, or null if all full.
Definition at line 65 of file storage.cpp.
References boxAt(), boxCount(), boxesFormatted, and curBox.
Referenced by depositPokemon().
| protected::void Storage::itemsChanged | ( | ) |
| void Storage::load | ( | SaveFile * | saveFile = nullptr | ) |
Expand the PC (items + both box sets) from the save.
Definition at line 93 of file storage.cpp.
References boxesFormatted, boxesFormattedChanged(), curBox, curBoxChanged(), items, pokemon, reset(), setMaxBoxes, and SaveFile::toolset.
Referenced by Storage().
| void Storage::pokemonChanged | ( | ) |
References randomize(), randomizeItems(), randomizePokemon(), and reset().
Referenced by PokemonBoxSelectModel::PokemonBoxSelectModel().
| void Storage::randomize | ( | PlayerBasics * | basics | ) |
Randomize items and Pokemon.
Definition at line 188 of file storage.cpp.
References randomizeItems(), randomizePokemon(), and reset().
Referenced by pokemonChanged(), and randomizePokemon().
| void Storage::randomizeItems | ( | ) |
Randomize just the PC items.
Definition at line 201 of file storage.cpp.
References items.
Referenced by pokemonChanged(), and randomize().
| void Storage::randomizePokemon | ( | PlayerBasics * | basics | ) |
Randomize just the boxed Pokemon.
Definition at line 195 of file storage.cpp.
References maxPokemonStorageSets, pokemon, and randomize().
Referenced by pokemonChanged(), and randomize().
| void Storage::reset | ( | ) |
Blank the whole PC.
Definition at line 174 of file storage.cpp.
References boxesFormatted, boxesFormattedChanged(), curBox, curBoxChanged(), items, maxPokemonStorageSets, pokemon, and reset().
Referenced by load(), pokemonChanged(), randomize(), and reset().
| void Storage::save | ( | SaveFile * | saveFile | ) |
Flatten the PC back to the save.
Definition at line 147 of file storage.cpp.
References boxesFormatted, curBox, items, pokemon, SaveFileToolset::setByte(), setMaxBoxes, and SaveFile::toolset.
| bool Storage::boxesFormatted = false |
Definition at line 91 of file storage.h.
Referenced by freeSpace(), load(), reset(), and save().
| int Storage::curBox |
| ItemStorageBox* Storage::items = nullptr |
Definition at line 89 of file storage.h.
Referenced by load(), randomizeItems(), reset(), save(), Storage(), and ~Storage().
| PokemonStorageSet* Storage::pokemon[maxPokemonStorageSets] |
The two box sets (6 boxes each).
Definition at line 96 of file storage.h.
Referenced by boxAt(), depositPokemon(), load(), randomizePokemon(), reset(), save(), Storage(), and ~Storage().