Core Rules
WoTC AD&D 2nd Edition -- Drakein API Reference
Loading...
Searching...
No Matches
CoreRules::ICharacterMiniOb Class Referenceabstract

One roster entry (one row of Chars/index.chr). More...

#include <ICharacterMiniOb.h>

Public Types

enum  DisplayDetailIndex {
  ddi_CharacterType = 0 , ddi_PlayerName = 1 , ddi_Party = 2 , ddi_Race = 3 ,
  ddi_Class = 4 , ddi_Level = 5 , ddi_Kit = 6 , ddi_Count = 7
}
 Display-detail slot positions cached on the MiniOb. More...

Public Member Functions

virtual ~ICharacterMiniOb ()=default
virtual const char * GetCharacterName () const =0
 Character's display name. Empty for a fresh, unedited record.
virtual const char * GetFileName () const =0
 Per-character .dat filename (hex-stem form).
virtual const char * GetRace () const =0
 Character's race name.
virtual const char * GetParty () const =0
 Character's party name (group affiliation).
virtual bool IsNPC () const =0
 true if this MiniOb represents an NPC (DM-side roster).
virtual const char * GetDisplayDetail (DisplayDetailIndex idx) const =0
 Read a cached display field by slot.
virtual ICharacterRecordGetRecord ()=0
 Get the full heavy character record.
virtual bool Save ()=0
 Save this single character to disk (.chr + Drakein.dat record).
virtual ICharacterMiniObClone () const =0
 Deep copy of this MiniOb via Serialize round-trip.

Detailed Description

One roster entry (one row of Chars/index.chr).

Read-only from a consumer's POV; mutate via GetRecord() instead.

Member Enumeration Documentation

◆ DisplayDetailIndex

Display-detail slot positions cached on the MiniOb.

Each slot maps to a roster-row column shown in the character tree. ddi_Level is text-formatted (e.g. "5/5" for a multi-class).

Enumerator
ddi_CharacterType 

"Core Rules" or "Skills & Powers"

ddi_PlayerName 

Player name (extension-backed).

ddi_Party 

Party name.

ddi_Race 

Race name.

ddi_Class 

Composed class display ("Fighter/Mage").

ddi_Level 

Text-formatted level ("5/5").

ddi_Kit 

Class kit display name.

ddi_Count 

Slot count sentinel.

Constructor & Destructor Documentation

◆ ~ICharacterMiniOb()

virtual CoreRules::ICharacterMiniOb::~ICharacterMiniOb ( )
virtualdefault

Member Function Documentation

◆ Clone()

virtual ICharacterMiniOb * CoreRules::ICharacterMiniOb::Clone ( ) const
pure virtual

Deep copy of this MiniOb via Serialize round-trip.

Returns
A new heap-allocated MiniOb (caller takes ownership; release via DestroyCharacterMiniOb).

◆ GetCharacterName()

virtual const char * CoreRules::ICharacterMiniOb::GetCharacterName ( ) const
pure virtual

Character's display name. Empty for a fresh, unedited record.

◆ GetDisplayDetail()

virtual const char * CoreRules::ICharacterMiniOb::GetDisplayDetail ( DisplayDetailIndex idx) const
pure virtual

Read a cached display field by slot.

The cache is populated/refreshed automatically by ICharacterRecord setters when fields they derive from change (e.g. SetClassDisplay() refreshes ddi_Class).

Parameters
idxDisplay-detail slot to read.
Returns
Cached text; empty string for out-of-range slot.

◆ GetFileName()

virtual const char * CoreRules::ICharacterMiniOb::GetFileName ( ) const
pure virtual

Per-character .dat filename (hex-stem form).

Internal state – no setter. Empty until the first save mints it.

◆ GetParty()

virtual const char * CoreRules::ICharacterMiniOb::GetParty ( ) const
pure virtual

Character's party name (group affiliation).

◆ GetRace()

virtual const char * CoreRules::ICharacterMiniOb::GetRace ( ) const
pure virtual

Character's race name.

◆ GetRecord()

virtual ICharacterRecord * CoreRules::ICharacterMiniOb::GetRecord ( )
pure virtual

Get the full heavy character record.

Lazy-loads on first call.

Always non-null: a missing or unreadable per-character file produces a fresh empty record (the "new character" path – the first save will mint a filename). Repeated calls do not re-load.

The record is owned by this MiniOb (ultimately by Character_Index); do NOT delete it. All character data lives behind this pointer – there is no other way to reach a character's fields.

Returns
The heavy record. Never nullptr.

◆ IsNPC()

virtual bool CoreRules::ICharacterMiniOb::IsNPC ( ) const
pure virtual

true if this MiniOb represents an NPC (DM-side roster).

◆ Save()

virtual bool CoreRules::ICharacterMiniOb::Save ( )
pure virtual

Save this single character to disk (.chr + Drakein.dat record).

Per-character incremental save. Writes the heavy record (.chr) and – if loaded and modified – its extension (Drakein.dat record) at the aligned hex stem. Also commits this character's row in index.chr via a read-merge-write pass (other in-memory MiniObs' dirty state is left untouched).

Independent of SaveDatabases() so a consumer can persist one character without committing other pending edits.

Returns
false on I/O error; true otherwise.

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