worldmap::SpawnPoint Class Reference

#include <spawn_point.hpp>

List of all members.

Public Member Functions

 SpawnPoint (const Reader &lisp)

Public Attributes

std::string name
Vector pos
Direction auto_dir
 automatically start walking in this direction


Detailed Description

Definition at line 29 of file spawn_point.hpp.


Constructor & Destructor Documentation

SpawnPoint::SpawnPoint ( const Reader lisp  ) 

Definition at line 26 of file spawn_point.cpp.

References auto_dir, log_warning, name, pos, worldmap::string_to_direction(), Vector::x, and Vector::y.

00026                                           : 
00027   name(),
00028   pos(),
00029   auto_dir(D_NONE)
00030 {
00031   pos.x = -1;
00032   pos.y = -1;
00033   lisp::ListIterator iter(&slisp);
00034   while(iter.next()) {
00035     const std::string& token = iter.item();
00036     if(token == "name") {
00037       iter.value()->get(name);
00038     } else if(token == "x") {
00039       iter.value()->get(pos.x);
00040     } else if(token == "y") {
00041       iter.value()->get(pos.y);
00042     } else if(token == "auto-dir") {
00043       std::string s = "";
00044       iter.value()->get(s);
00045       auto_dir = string_to_direction(s);
00046     } else {
00047       log_warning << "unknown token '" << token << "' in SpawnPoint" << std::endl;
00048     }
00049   }
00050 
00051   if(name == "")
00052     throw std::runtime_error("No name specified for spawnpoint");
00053   if(pos.x < 0 || pos.y < 0)
00054     throw std::runtime_error("Invalid coordinates for spawnpoint");
00055 }


Member Data Documentation

std::string worldmap::SpawnPoint::name

Definition at line 34 of file spawn_point.hpp.

Referenced by SpawnPoint().

Vector worldmap::SpawnPoint::pos

Definition at line 35 of file spawn_point.hpp.

Referenced by SpawnPoint().

Direction worldmap::SpawnPoint::auto_dir

automatically start walking in this direction

Definition at line 36 of file spawn_point.hpp.

Referenced by SpawnPoint().


The documentation for this class was generated from the following files:
Generated on Mon Jun 9 03:38:41 2014 for SuperTux by  doxygen 1.5.1