duncan
Mom and Dad were wrong!
|
#include <world.h>
Public Types | |
typedef CharList< Character > | CList |
Public Member Functions | |
World (const std::string &) | |
World (const World &) | |
const World & | operator= (const World &) |
void | name_changed (Player *) |
const PlayerPacket::pointer_t | next_outgoing () |
void | pop_outgoing () |
void | update (double) |
void | join (Player *) |
void | disconnect (Player *) |
void | packet (net::data_t *, size_t, Player *) |
net::maphash_t | maphash () |
const std::string & | mapname () |
bool | is_vacant (double, double, Character *) const |
size_t | width () const |
size_t | height () const |
Store information about a world.
Contains a map, players, etc...
see LICENSE
World::World | ( | const std::string & | filename | ) |
Initialise the queue of available indices, and load all the data.
filename | name of file |
World::World | ( | const World & | o | ) |
Copy constructor, differing from the default one in two ways: 1. copy-constructing a KDTree optimises it, so tree_age_ is set to 0 2. path_finder_ is initialised using this World, rather than being copy-constructed and pointing to o
void World::disconnect | ( | Player * | p | ) |
size_t World::height | ( | ) | const [virtual] |
bool World::is_vacant | ( | double | row, |
double | col, | ||
Character * | ignore | ||
) | const [virtual] |
row | coordinate of top-left corner |
col | coordinate of top-left corner |
ignore | pointer to Player to ignore |
Reimplemented from server::PathWorld.
void World::join | ( | Player * | p | ) |
Add a player to the queue for joining the world.
p | pointer to player |
net::maphash_t World::maphash | ( | ) |
Get the map hash.
const std::string & World::mapname | ( | ) |
Get the map name.
void World::name_changed | ( | Player * | p | ) |
Notify other players that a player has changed her name.
p | player whose name changed |
const PlayerPacket::pointer_t World::next_outgoing | ( | ) |
Gets a pointer to the next queued packet associated with this World.
Same differences from default as copy constructor (since KDTree's operator= also optimises).
void World::packet | ( | net::data_t * | buf, |
size_t | size, | ||
Player * | p | ||
) |
Process a packet from a client.
buf | packet data |
size | size (in bytes) of packet |
p | peer from whom packet was sent |
void World::pop_outgoing | ( | ) |
Discards a packet from the front of the queue of packets to be sent. Does nothing if the queue is empty.
void World::update | ( | double | dt | ) |
Move all the players.
size_t World::width | ( | ) | const [virtual] |