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

One edge connection of a map (the seam to a neighbouring map). More...

#include <mapdbentryconnect.h>

Inheritance diagram for MapDBEntryConnect:
Collaboration diagram for MapDBEntryConnect:

Public Types

enum  ConnectDir { NORTH , SOUTH , EAST , WEST }
 The four connectable edges. More...

Public Member Functions

int stripLocation () const
int mapPos () const
int stripSize () const
int yAlign () const
int xAlign () const
int window () const
ConnectDir getDir () const
const QString getMap () const
int getStripMove () const
int getStripOffset () const
bool getFlag () const
MapDBEntrygetToMap () const
MapDBEntrygetFromMap () const
MapDBEntrygetParent () const
void qmlProtect (const QQmlEngine *const engine) const
 Pin to C++ ownership.

Static Public Attributes

static const constexpr int worldMapPtr = 0xC6E8
 < Strip source pointer.

Protected Member Functions

 MapDBEntryConnect ()
 Empty entry.
 MapDBEntryConnect (const ConnectDir dir, MapDBEntry *const fromMap, const QJsonValue &data)
 Build a dir connection on fromMap from JSON.
void deepLink ()
 Resolve the connected map.
void qmlRegister () const
 Register with QML.

Protected Attributes

ConnectDir dir = ConnectDir::NORTH
 Edge direction.
QString map = ""
 Connected map name.
int stripMove = 0
 Strip centering.
int stripOffset = 0
 Strip position.
bool flag = false
 +3 offset flag (purpose unknown; see note).
MapDBEntrytoMap = nullptr
 Resolved connected map (deepLink).
MapDBEntryfromMap = nullptr
 Owning map.
MapDBEntryparent = nullptr

Friends

class MapDBEntry

Detailed Description

One edge connection of a map (the seam to a neighbouring map).

The DB counterpart to the save's MapConnData – and, per the forewarning above, the single most complicated data structure in Gen 1. The pointer/offset fields (stripLocation, mapPos, stripSize, yAlign / xAlign, window) are the raw connection math; their AKA names are noted inline. The ConnectDir says which edge. deepLink() resolves toMap. See db.md.

See also
MapDBEntry (parent), MapConnData (the save-side connection).

Definition at line 60 of file mapdbentryconnect.h.

Member Enumeration Documentation

◆ ConnectDir

The four connectable edges.

Enumerator
NORTH 
SOUTH 
EAST 
WEST 

Definition at line 83 of file mapdbentryconnect.h.

Constructor & Destructor Documentation

◆ MapDBEntryConnect() [1/2]

MapDBEntryConnect::MapDBEntryConnect ( )
protected

Empty entry.

Definition at line 30 of file mapdbentryconnect.cpp.

References qmlRegister().

◆ MapDBEntryConnect() [2/2]

MapDBEntryConnect::MapDBEntryConnect ( const ConnectDir dir,
MapDBEntry *const fromMap,
const QJsonValue & data )
protected

Build a dir connection on fromMap from JSON.

Definition at line 33 of file mapdbentryconnect.cpp.

References dir, flag, fromMap, map, MapDBEntry, parent, qmlRegister(), stripMove, and stripOffset.

Member Function Documentation

◆ deepLink()

void MapDBEntryConnect::deepLink ( )
protected

Resolve the connected map.

Definition at line 52 of file mapdbentryconnect.cpp.

References MapsDB::getInd(), MapsDB::inst(), map, and toMap.

◆ getDir()

MapDBEntryConnect::ConnectDir MapDBEntryConnect::getDir ( ) const
See also
getDir property.

Definition at line 108 of file mapdbentryconnect.cpp.

References dir.

◆ getFlag()

bool MapDBEntryConnect::getFlag ( ) const
See also
getFlag property.

Definition at line 93 of file mapdbentryconnect.cpp.

References flag.

◆ getFromMap()

MapDBEntry * MapDBEntryConnect::getFromMap ( ) const
See also
getFromMap property.

Definition at line 83 of file mapdbentryconnect.cpp.

References fromMap, and MapDBEntry.

◆ getMap()

const QString MapDBEntryConnect::getMap ( ) const
See also
getMap property.

Definition at line 113 of file mapdbentryconnect.cpp.

References map.

◆ getParent()

MapDBEntry * MapDBEntryConnect::getParent ( ) const
See also
getParent property.

Definition at line 73 of file mapdbentryconnect.cpp.

References MapDBEntry, and parent.

◆ getStripMove()

int MapDBEntryConnect::getStripMove ( ) const
See also
getStripMove property.

Definition at line 103 of file mapdbentryconnect.cpp.

References stripMove.

◆ getStripOffset()

int MapDBEntryConnect::getStripOffset ( ) const
See also
getStripOffset property.

Definition at line 98 of file mapdbentryconnect.cpp.

References stripOffset.

◆ getToMap()

MapDBEntry * MapDBEntryConnect::getToMap ( ) const
See also
getToMap property.

Definition at line 88 of file mapdbentryconnect.cpp.

References MapDBEntry, and toMap.

Referenced by MapConnData::loadFromData().

◆ mapPos()

int MapDBEntryConnect::mapPos ( ) const
See also
mapPos property (AKA Strip Dst).

Definition at line 151 of file mapdbentryconnect.cpp.

References dir, fromMap, NORTH, SOUTH, stripMove, WEST, and worldMapPtr.

Referenced by MapConnData::loadFromData().

◆ qmlProtect()

void MapDBEntryConnect::qmlProtect ( const QQmlEngine *const engine) const

Pin to C++ ownership.

Definition at line 78 of file mapdbentryconnect.cpp.

References Utility::qmlProtectUtil().

◆ qmlRegister()

void MapDBEntryConnect::qmlRegister ( ) const
protected

Register with QML.

Definition at line 62 of file mapdbentryconnect.cpp.

Referenced by MapDBEntryConnect(), and MapDBEntryConnect().

◆ stripLocation()

int MapDBEntryConnect::stripLocation ( ) const
See also
stripLocation property (AKA Strip Source).

Definition at line 118 of file mapdbentryconnect.cpp.

References dir, NORTH, SOUTH, stripOffset, toMap, and WEST.

Referenced by MapConnData::loadFromData().

◆ stripSize()

int MapDBEntryConnect::stripSize ( ) const
See also
stripSize property (AKA stripWidth).

Definition at line 178 of file mapdbentryconnect.cpp.

References dir, flag, fromMap, NORTH, SOUTH, stripMove, stripOffset, toMap, and WEST.

Referenced by MapConnData::loadFromData().

◆ window()

int MapDBEntryConnect::window ( ) const
See also
window property.

Definition at line 288 of file mapdbentryconnect.cpp.

References dir, NORTH, SOUTH, toMap, WEST, and worldMapPtr.

Referenced by MapConnData::loadFromData().

◆ xAlign()

int MapDBEntryConnect::xAlign ( ) const
See also
xAlign property.

Definition at line 257 of file mapdbentryconnect.cpp.

References dir, NORTH, SOUTH, stripMove, stripOffset, toMap, and WEST.

Referenced by MapConnData::loadFromData().

◆ yAlign()

int MapDBEntryConnect::yAlign ( ) const
See also
yAlign property.

Definition at line 232 of file mapdbentryconnect.cpp.

References dir, NORTH, SOUTH, stripMove, stripOffset, toMap, and WEST.

Referenced by MapConnData::loadFromData().

◆ MapDBEntry

friend class MapDBEntry
friend

Definition at line 161 of file mapdbentryconnect.h.

References MapDBEntry.

Referenced by getFromMap(), getParent(), getToMap(), MapDBEntry, and MapDBEntryConnect().

Member Data Documentation

◆ dir

ConnectDir MapDBEntryConnect::dir = ConnectDir::NORTH
protected

Edge direction.

Definition at line 139 of file mapdbentryconnect.h.

Referenced by getDir(), MapDBEntryConnect(), mapPos(), stripLocation(), stripSize(), window(), xAlign(), and yAlign().

◆ flag

bool MapDBEntryConnect::flag = false
protected

+3 offset flag (purpose unknown; see note).

Definition at line 152 of file mapdbentryconnect.h.

Referenced by getFlag(), MapDBEntryConnect(), and stripSize().

◆ fromMap

MapDBEntry* MapDBEntryConnect::fromMap = nullptr
protected

Owning map.

Definition at line 158 of file mapdbentryconnect.h.

Referenced by getFromMap(), MapDBEntryConnect(), mapPos(), and stripSize().

◆ map

QString MapDBEntryConnect::map = ""
protected

Connected map name.

Definition at line 142 of file mapdbentryconnect.h.

Referenced by deepLink(), getMap(), and MapDBEntryConnect().

◆ parent

MapDBEntry* MapDBEntryConnect::parent = nullptr
protected

Definition at line 159 of file mapdbentryconnect.h.

Referenced by getParent(), and MapDBEntryConnect().

◆ stripMove

int MapDBEntryConnect::stripMove = 0
protected

Strip centering.

Definition at line 145 of file mapdbentryconnect.h.

Referenced by getStripMove(), MapDBEntryConnect(), mapPos(), stripSize(), xAlign(), and yAlign().

◆ stripOffset

int MapDBEntryConnect::stripOffset = 0
protected

Strip position.

Definition at line 148 of file mapdbentryconnect.h.

Referenced by getStripOffset(), MapDBEntryConnect(), stripLocation(), stripSize(), xAlign(), and yAlign().

◆ toMap

MapDBEntry* MapDBEntryConnect::toMap = nullptr
protected

Resolved connected map (deepLink).

Definition at line 155 of file mapdbentryconnect.h.

Referenced by deepLink(), getToMap(), stripLocation(), stripSize(), window(), xAlign(), and yAlign().

◆ worldMapPtr

const constexpr int MapDBEntryConnect::worldMapPtr = 0xC6E8
staticconstexpr

< Strip source pointer.

Strip destination pointer. Connection size (blocks). Player Y offset (steps). Player X offset (steps). View/UL-corner pointer. Which edge this connects. Connected map name. Strip centering. Strip position. The +3 offset flag (see field note). Resolved connected map. Map owning this connection. Same as fromMap (alias). Fixed overworld-map RAM pointer (see note).

Definition at line 80 of file mapdbentryconnect.h.

Referenced by AreaMap::coordsToPtr(), mapPos(), and window().


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