Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | Friends | List of all members
core::file::NPC Class Reference

File data for NPCs. More...

#include <NPC.hpp>

Public Member Functions

 NPC ()=default
 Construct a new NPC file. More...
 
bool save (const std::string &file) const
 Saves the NPC data to the given file. More...
 
bool saveBundle (bl::serial::binary::OutputStream &output, bl::resource::bundle::FileHandlerContext &ctx) const
 Saves the data from this object to the given bundle and registers depency files if any. More...
 
bool load (const std::string &file, bl::tmap::Direction spawnDir=bl::tmap::Direction::Up)
 Loads the NPC data from the given file. More...
 
bool loadDev (std::istream &input)
 Loads the NPC from the json stream. More...
 
bool loadProd (bl::serial::binary::InputStream &input)
 Loads the NPC from it's binary format. More...
 
std::string & name ()
 The name of the NPC. More...
 
const std::string & name () const
 The name of the NPC. More...
 
std::string & animation ()
 The directory of the movement animations. More...
 
const std::string & animation () const
 The directory of the movement animations. More...
 
std::string & conversation ()
 The conversation file of the NPC. More...
 
const std::string & conversation () const
 The conversation file of the NPC. More...
 
Behaviorbehavior ()
 The behavior of the NPC. More...
 
Behavior behavior () const
 The behavior of the NPC. More...
 

Friends

struct bl::serial::SerializableObject< NPC >
 

Detailed Description

File data for NPCs.

Definition at line 26 of file NPC.hpp.

Constructor & Destructor Documentation

◆ NPC()

core::file::NPC::NPC ( )
default

Construct a new NPC file.

Member Function Documentation

◆ animation() [1/2]

std::string & core::file::NPC::animation ( )

The directory of the movement animations.

Definition at line 54 of file NPC.cpp.

◆ animation() [2/2]

const std::string & core::file::NPC::animation ( ) const

The directory of the movement animations.

Definition at line 56 of file NPC.cpp.

◆ behavior() [1/2]

Behavior & core::file::NPC::behavior ( )

The behavior of the NPC.

Definition at line 62 of file NPC.cpp.

◆ behavior() [2/2]

Behavior core::file::NPC::behavior ( ) const

The behavior of the NPC.

Definition at line 64 of file NPC.cpp.

◆ conversation() [1/2]

std::string & core::file::NPC::conversation ( )

The conversation file of the NPC.

Definition at line 58 of file NPC.cpp.

◆ conversation() [2/2]

const std::string & core::file::NPC::conversation ( ) const

The conversation file of the NPC.

Definition at line 60 of file NPC.cpp.

◆ load()

bool core::file::NPC::load ( const std::string &  file,
bl::tmap::Direction  spawnDir = bl::tmap::Direction::Up 
)

Loads the NPC data from the given file.

Parameters
fileThe file to load from
spawnDirThe direction to put into the standing behavior on load
Returns
True on success, false on error

Definition at line 36 of file NPC.cpp.

◆ loadDev()

bool core::file::NPC::loadDev ( std::istream &  input)

Loads the NPC from the json stream.

Parameters
inputJSON input stream
Returns
True if the NPC could be loaded, false on error

Definition at line 42 of file NPC.cpp.

◆ loadProd()

bool core::file::NPC::loadProd ( bl::serial::binary::InputStream &  input)

Loads the NPC from it's binary format.

Parameters
inputThe input stream to load from
Returns
True if the NPC could be loaded, false otherwise

Definition at line 46 of file NPC.cpp.

◆ name() [1/2]

std::string & core::file::NPC::name ( )

The name of the NPC.

Definition at line 50 of file NPC.cpp.

◆ name() [2/2]

const std::string & core::file::NPC::name ( ) const

The name of the NPC.

Definition at line 52 of file NPC.cpp.

◆ save()

bool core::file::NPC::save ( const std::string &  file) const

Saves the NPC data to the given file.

Parameters
fileThe file to save to
Returns
True on success, false on error

Definition at line 10 of file NPC.cpp.

◆ saveBundle()

bool core::file::NPC::saveBundle ( bl::serial::binary::OutputStream &  output,
bl::resource::bundle::FileHandlerContext &  ctx 
) const

Saves the data from this object to the given bundle and registers depency files if any.

Parameters
outputStream to output to
ctxContext to register dependencies with
Returns
True if serialization succeeded, false otherwise

Definition at line 15 of file NPC.cpp.

Friends And Related Function Documentation

◆ bl::serial::SerializableObject< NPC >

friend struct bl::serial::SerializableObject< NPC >
friend

Definition at line 129 of file NPC.hpp.


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