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

Holds contents of a single box set, basically a row or array of boxes each holding Pokemon. More...

#include <pokemonstorageset.h>

Inheritance diagram for PokemonStorageSet:
Collaboration diagram for PokemonStorageSet:

Public Member Functions

 PokemonStorageSet (SaveFile *saveFile=nullptr, var16 boxesOffset=0, svar8 skipInd=-1)
virtual ~PokemonStorageSet ()
void load (SaveFile *saveFile=nullptr, var16 boxesOffset=0, svar8 skipInd=-1)
 Auto load or save boxes 1-6 from a single address and skip a box if it's the current box.
void save (SaveFile *saveFile, var16 boxesOffset, svar8 skipInd=-1)
 Auto load or save boxes 1-6 from a single address and skip a box if it's the current box.
void loadSpecific (SaveFile *saveFile=nullptr, var16 offset=0, var8 toBox=0)
 Load a specific box at a specific address into box toBox, overwriting it.
void saveSpecific (SaveFile *saveFile=nullptr, var16 offset=0, var8 fromBox=0)
 Save box fromBox out to a specific address.
PokemonStorageBoxboxAt (int ind)
 Box at ind within this set.
protected::void boxesChanged ()
 Any box in the set changed.
void reset ()
 Empty all six boxes.
void randomize (PlayerBasics *basics)
 Fill the set with constrained random mons.

Public Attributes

PokemonStorageBoxboxes [setMaxBoxes]
 The six boxes (fixed-size; never grows/shrinks).

Detailed Description

Holds contents of a single box set, basically a row or array of boxes each holding Pokemon.

One bank of six PC boxes.

The PC's storage is two of these sets (12 boxes total). The set knows how to load/save all six boxes from one base address, optionally skipping a box – because the "current box" is stored separately in the save, so when expanding a set we skip the slot that the live current-box occupies. loadSpecific()/ saveSpecific() move an individual box to/from a specific address.

See also
PokemonStorageBox (a single box), Storage (owns the two sets + current box).

Definition at line 45 of file pokemonstorageset.h.

Constructor & Destructor Documentation

◆ PokemonStorageSet()

PokemonStorageSet::PokemonStorageSet ( SaveFile * saveFile = nullptr,
var16 boxesOffset = 0,
svar8 skipInd = -1 )
Parameters
boxesOffsetbase address of the six boxes;
skipIndbox to skip (-1 = none).

Definition at line 31 of file pokemonstorageset.cpp.

References boxes, load(), and setMaxBoxes.

◆ ~PokemonStorageSet()

PokemonStorageSet::~PokemonStorageSet ( )
virtual

Definition at line 39 of file pokemonstorageset.cpp.

References boxes, and setMaxBoxes.

Member Function Documentation

◆ boxAt()

PokemonStorageBox * PokemonStorageSet::boxAt ( int ind)

Box at ind within this set.

Definition at line 110 of file pokemonstorageset.cpp.

References boxes.

◆ boxesChanged()

protected::void PokemonStorageSet::boxesChanged ( )

Any box in the set changed.

References randomize(), and reset().

◆ load()

void PokemonStorageSet::load ( SaveFile * saveFile = nullptr,
var16 boxesOffset = 0,
svar8 skipInd = -1 )

Auto load or save boxes 1-6 from a single address and skip a box if it's the current box.

Definition at line 45 of file pokemonstorageset.cpp.

References boxes, reset(), and setMaxBoxes.

Referenced by PokemonStorageSet().

◆ loadSpecific()

void PokemonStorageSet::loadSpecific ( SaveFile * saveFile = nullptr,
var16 offset = 0,
var8 toBox = 0 )

Load a specific box at a specific address into box toBox, overwriting it.

Definition at line 96 of file pokemonstorageset.cpp.

References boxes.

◆ randomize()

void PokemonStorageSet::randomize ( PlayerBasics * basics)

Fill the set with constrained random mons.

Definition at line 88 of file pokemonstorageset.cpp.

References boxes, randomize(), reset(), and setMaxBoxes.

Referenced by boxesChanged(), and randomize().

◆ reset()

void PokemonStorageSet::reset ( )

Empty all six boxes.

Definition at line 82 of file pokemonstorageset.cpp.

References boxes, reset(), and setMaxBoxes.

Referenced by boxesChanged(), load(), randomize(), and reset().

◆ save()

void PokemonStorageSet::save ( SaveFile * saveFile,
var16 boxesOffset,
svar8 skipInd = -1 )

Auto load or save boxes 1-6 from a single address and skip a box if it's the current box.

Definition at line 66 of file pokemonstorageset.cpp.

References boxes, and setMaxBoxes.

◆ saveSpecific()

void PokemonStorageSet::saveSpecific ( SaveFile * saveFile = nullptr,
var16 offset = 0,
var8 fromBox = 0 )

Save box fromBox out to a specific address.

Definition at line 103 of file pokemonstorageset.cpp.

References boxes.

Member Data Documentation

◆ boxes

PokemonStorageBox* PokemonStorageSet::boxes[setMaxBoxes]

The six boxes (fixed-size; never grows/shrinks).

Definition at line 76 of file pokemonstorageset.h.

Referenced by boxAt(), load(), loadSpecific(), PokemonStorageSet(), randomize(), reset(), save(), saveSpecific(), and ~PokemonStorageSet().


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