SpawnPoint Class Reference

#include <spawn_point.hpp>

List of all members.

Public Member Functions

 SpawnPoint ()
 SpawnPoint (const SpawnPoint &other)
 SpawnPoint (const Reader &lisp)

Public Attributes

std::string name
Vector pos


Detailed Description

Definition at line 23 of file spawn_point.hpp.


Constructor & Destructor Documentation

SpawnPoint::SpawnPoint (  ) 

Definition at line 23 of file spawn_point.cpp.

00023                        :
00024   name(),
00025   pos()
00026 {}

SpawnPoint::SpawnPoint ( const SpawnPoint other  ) 

Definition at line 28 of file spawn_point.cpp.

00028                                               :
00029   name(other.name), 
00030   pos(other.pos)
00031 {}

SpawnPoint::SpawnPoint ( const Reader lisp  ) 

Definition at line 33 of file spawn_point.cpp.

References lisp::Lisp::get(), lisp::ListIterator::item(), log_warning, name, lisp::ListIterator::next(), pos, lisp::ListIterator::value(), Vector::x, and Vector::y.

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


Member Data Documentation

std::string SpawnPoint::name

Definition at line 30 of file spawn_point.hpp.

Referenced by Sector::parse_old_format(), and SpawnPoint().

Vector SpawnPoint::pos

Definition at line 31 of file spawn_point.hpp.

Referenced by Sector::activate(), Sector::parse_old_format(), SpawnPoint(), and FlipLevelTransformer::transform_spawnpoint().


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