#include <spawn_point.hpp>
Public Member Functions | |
SpawnPoint (const Reader &lisp) | |
Public Attributes | |
std::string | name |
Vector | pos |
Direction | auto_dir |
automatically start walking in this direction |
Definition at line 29 of file spawn_point.hpp.
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 }
std::string worldmap::SpawnPoint::name |
automatically start walking in this direction
Definition at line 36 of file spawn_point.hpp.
Referenced by SpawnPoint().