ScummVM API documentation
Ultima::Ultima8::idMan Class Reference

Public Member Functions

 idMan (uint16 begin, uint16 max_end, uint16 startcount=0)
 
bool isFull () const
 check if this idMan is full
 
void clearAll (uint16 new_max=0)
 clear all IDs, reset size to the startcount, and set max_end to new_max
 
uint16 getNewID ()
 
bool reserveID (uint16 id)
 
void clearID (uint16 id)
 release an id
 
bool isIDUsed (uint16 id) const
 check if an ID is in use
 
void setNewMax (uint16 maxEnd)
 
void save (Common::WriteStream *ws) const
 
bool load (Common::ReadStream *rs, uint32 version)
 

Constructor & Destructor Documentation

◆ idMan()

Ultima::Ultima8::idMan::idMan ( uint16  begin,
uint16  max_end,
uint16  startcount = 0 
)
Parameters
beginstart of the range of available IDs
max_endend of the range of available IDs
startcountnumber of IDs to make available initially (0 = all)

Member Function Documentation

◆ getNewID()

uint16 Ultima::Ultima8::idMan::getNewID ( )

get a free ID

Returns
a free ID, or 0 if none are available

◆ reserveID()

bool Ultima::Ultima8::idMan::reserveID ( uint16  id)

mark a given ID as used, expanding if necessary. Note: reserveID is O(n), so don't use too often.

Returns
false if the ID was already used or is out of range

◆ setNewMax()

void Ultima::Ultima8::idMan::setNewMax ( uint16  maxEnd)
inline

increase the maximum size Note: this shouldn't be used in normal circumstances. It exists for dumpMap currently. If that is rewritten not to need more than 32768 object IDs, this function should be deleted.


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