Class containing all the information about a chapter, derive from base. More...
#include <chap.h>
Public Member Functions | |
chap () | |
Constructor. | |
~chap () | |
Destructor. | |
int | init (int, coeur *, IXMLReader *) |
Init the chapter. | |
int | update () |
Updating(should be call on each loop). | |
int | close () |
Close the base. | |
item | addItem (int id, stringc tex, int it, int cr) |
add an Item to the item list (chap::listItem) | |
item | getItemFromId (int id) |
Get an item from the list (chap::listItem) by its id. | |
bool | OnEvent (const SEvent &) |
Called when an event occured. | |
Private Attributes | |
std::vector< item > * | listItem |
Contain all the item needed by the chapter. |
Class containing all the information about a chapter, derive from base.
This class contain mainly the item list (chap::listItem) of the chapter.
When you call the init (chap::init()) function it will read an xml containing a list of item and store them in the class.
If you want to know more about chapter and how the xml must be formated, see chap.xml
Definition at line 27 of file chap.h.
chap::chap | ( | ) |
Constructor.
Construct the chap class, call base::base() and create chap::listItem.
Definition at line 77 of file chap.cpp.
References listItem.
chap::~chap | ( | ) |
Destructor.
Destruct the chap class, delete chap::listItem.
Definition at line 83 of file chap.cpp.
References listItem.
item chap::addItem | ( | int | Id, | |
stringc | tex, | |||
int | Combi, | |||
int | CombiResult | |||
) |
add an Item to the item list (chap::listItem)
Create the item, init it (item::init()) and add it to the chap::listItem
Id | Id of the item | |
tex | Pointer to the irrlicht texture corresponding to the item | |
Combi | Id of the item whith which this one can be combine | |
CombiResult | Id of the item resulting from the combinaison |
Definition at line 165 of file chap.cpp.
References item::init(), listItem, and base::log().
Referenced by BOOST_PYTHON_MODULE(), and init().
int chap::close | ( | ) | [virtual] |
Close the base.
Remove all the item from chap::listItem and call base::close()
Reimplemented from base.
Definition at line 148 of file chap.cpp.
References listItem, and base::log().
Referenced by coeur::close(), and coeur::loadChap().
item chap::getItemFromId | ( | int | Id | ) |
Get an item from the list (chap::listItem) by its id.
Check for all element of chap::listItem if the id correspond to Id
Id | Id of the item to search |
Definition at line 178 of file chap.cpp.
References listItem.
Referenced by BOOST_PYTHON_MODULE(), and coeur::getItem().
int chap::init | ( | int | Id, | |
coeur * | c, | |||
IXMLReader * | xmlChap | |||
) |
Init the chapter.
Call base::init() and read xmlChap
Id | Id of the chap | |
c | Pointer to the core | |
xmlChap | Pointer to the IXMLReader you want to load |
Definition at line 93 of file chap.cpp.
References addItem(), listItem, and base::log().
Referenced by coeur::loadChap().
bool chap::OnEvent | ( | const SEvent & | event | ) |
int chap::update | ( | ) | [virtual] |
std::vector<item>* chap::listItem [private] |