chap Class Reference

Class containing all the information about a chapter, derive from base. More...

#include <chap.h>

Inheritance diagram for chap:
base

List of all members.

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.

Detailed Description

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

Todo:
add a name to chapter and maybe other stuff like description

Definition at line 27 of file chap.h.


Constructor & Destructor Documentation

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.


Member Function Documentation

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

Parameters:
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
Returns:
Pointer to the item created if succesful, 0 instead

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()

Returns:
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

Parameters:
Id Id of the item to search
Returns:
The item if succesful, 0 instead

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

Parameters:
Id Id of the chap
c Pointer to the core
xmlChap Pointer to the IXMLReader you want to load
Returns:
The first lieu of the Chapter if succesful, -1 instead

Todo:
replace the log by a warning function

Definition at line 93 of file chap.cpp.

References addItem(), listItem, and base::log().

Referenced by coeur::loadChap().

bool chap::OnEvent ( const SEvent &  event  ) 

Called when an event occured.

This method is called when an event has to be treated, but this class do not wait event so this function does nothing

Parameters:
event The event to parse
Returns:
Always false

Definition at line 190 of file chap.cpp.

int chap::update (  )  [virtual]

Updating(should be call on each loop).

Does nothing, apart from slowing the game

Returns:
always 0

Reimplemented from base.

Definition at line 141 of file chap.cpp.


Member Data Documentation

std::vector<item>* chap::listItem [private]

Contain all the item needed by the chapter.

Definition at line 56 of file chap.h.

Referenced by addItem(), chap(), close(), getItemFromId(), init(), and ~chap().


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Enumerations Enumerator Friends

Generated on Wed Sep 9 18:20:15 2009 for The Merry Turnip by  doxygen 1.6.1