Pokered Save Editor 2
Pokemon Red & Blue save file editor - Qt 6 C++/QML
Loading...
Searching...
No Matches
PlayerPokemon Class Reference

The player's active party – a specialized PokemonStorageBox. More...

#include <playerpokemon.h>

Inheritance diagram for PlayerPokemon:
Collaboration diagram for PlayerPokemon:

Public Member Functions

 PlayerPokemon (SaveFile *saveFile=nullptr)
virtual ~PlayerPokemon ()
virtual void load (SaveFile *saveFile=nullptr, var16 boxOffset=0)
 Expand the party from the save (boxOffset locates the party block).
virtual void save (SaveFile *saveFile, var16 boxOffset=0)
 Flatten the party back to the save (boxOffset locates the party block).
PokemonPartypartyAt (int ind)
 Party member at ind (GC-protected return).
virtual void randomize (PlayerBasics *basics)
 Randomize the party; basics supplies starter/OT context.
virtual void pokemonNew ()
 Add/initialize a fresh party Pokemon.
Public Member Functions inherited from PokemonStorageBox
 PokemonStorageBox (int maxSize=boxMaxPokemon, SaveFile *saveFile=nullptr, var16 boxOffset=0)
 < How many mons are in the box.
virtual ~PokemonStorageBox ()
int pokemonCount ()
 Number of mons present.
int pokemonMax ()
 Capacity (maxSize).
bool isFull ()
 At capacity.
PokemonBoxpokemonAt (int ind)
 Mon at ind (GC-protected return).
void reset ()
 Empty the box.
bool pokemonMove (int from, int to)
 Reorder a mon within the box.
void pokemonRemove (int ind)
 Remove the mon at ind.
bool relocateAll (PokemonStorageBox *dst)
 Move every mon into dst.
virtual bool relocateOne (PokemonStorageBox *dst, int ind)
 Move one mon into dst.

Additional Inherited Members

Public Attributes inherited from PokemonStorageBox
bool isParty = false
 True if this box is actually the party (affects record format).
QVector< PokemonBox * > pokemon
 The stored mons.
int maxSize = 0
 Capacity.
SaveFilefile
 Owning save.
Protected Member Functions inherited from PokemonStorageBox
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 inherited from PokemonStorageBox
 : void beforePokemonRelocate(PokemonBox* item)
 Emitted before a relocate so models can clean up.

Detailed Description

The player's active party – a specialized PokemonStorageBox.

The party is stored just like a PC box but with party-only extras (live stats), so it inherits PokemonStorageBox and overrides load()/save() to read/write at the party's offset and slot count (maxParty). Members are PokemonParty entries (a PokemonBox plus the computed in-battle stats).

See also
PokemonStorageBox (base), PokemonParty (slot type), PlayerBasics (randomize() consults it for the starter).

Definition at line 41 of file playerpokemon.h.

Constructor & Destructor Documentation

◆ PlayerPokemon()

PlayerPokemon::PlayerPokemon ( SaveFile * saveFile = nullptr)

◆ ~PlayerPokemon()

PlayerPokemon::~PlayerPokemon ( )
virtual

Definition at line 42 of file playerpokemon.cpp.

Member Function Documentation

◆ load()

void PlayerPokemon::load ( SaveFile * saveFile = nullptr,
var16 boxOffset = 0 )
virtual

Expand the party from the save (boxOffset locates the party block).

Reimplemented from PokemonStorageBox.

Definition at line 44 of file playerpokemon.cpp.

References PokemonStorageBox::file, PokemonStorageBox::pokemon, PokemonStorageBox::pokemonChanged(), PokemonStorageBox::pokemonInsertChange(), PokemonStorageBox::reset(), and SaveFile::toolset.

Referenced by PlayerPokemon().

◆ partyAt()

PokemonParty * PlayerPokemon::partyAt ( int ind)

Party member at ind (GC-protected return).

Definition at line 99 of file playerpokemon.cpp.

References PokemonStorageBox::pokemon, and qmlCppOwned().

◆ pokemonNew()

◆ randomize()

void PlayerPokemon::randomize ( PlayerBasics * basics)
virtual

◆ save()

void PlayerPokemon::save ( SaveFile * saveFile,
var16 boxOffset = 0 )
virtual

Flatten the party back to the save (boxOffset locates the party block).

Reimplemented from PokemonStorageBox.

Definition at line 71 of file playerpokemon.cpp.

References PokemonStorageBox::pokemon, SaveFileToolset::setByte(), and SaveFile::toolset.


The documentation for this class was generated from the following files: