00001 00005 /* Copyright © 2009, 2010 James Legg. 00006 This program is free software: you can redistribute it and/or modify 00007 it under the terms of the GNU General Public License as published by 00008 the Free Software Foundation, either version 3 of the License, or 00009 (at your option) any later version. 00010 */ 00011 #ifndef REPLAY_READER_H_ 00012 #define REPLAY_READER_H_ 00013 00014 #include <istream> 00015 #include <vector> 00016 #include <set> 00017 00018 #include "Physics/TickObserver.h" 00019 #include "InputReport.h" 00020 #include "InputDeviceReplay.h" 00021 #include "GameScene.h" 00022 #include "LoadScene.h" 00023 00024 namespace Engine 00025 { 00026 00049 class ReplayReader 00050 : public Physics::TickObserver 00051 { 00052 public: 00058 ReplayReader(std::istream & data); 00059 virtual ~ReplayReader(); 00060 00062 virtual void posttick(); 00063 00065 void operator ()(GameScene *); 00066 00068 Scene * get_scene(); 00069 protected: 00070 struct ReplayEvent 00071 { 00072 unsigned long int tick_number; 00073 InputReport::ReportType type; 00074 int value; 00075 long unsigned int car_identifier; 00076 }; 00077 00079 void ReadEvents(std::istream & data); 00080 00082 std::vector<ReplayEvent> replay_events; 00083 00085 std::vector<ReplayEvent>::iterator current_iterator; 00086 00088 std::vector<boost::shared_ptr<InputDeviceReplay> > devices; 00090 std::map<long unsigned int, Engine::InputHandler::iterator> input_map; 00091 std::vector<std::pair<Engine::InputHandler::iterator, unsigned int> > game_scene_devices_list; 00092 00094 LoadScene<GameScene, ReplayReader> * load_scene; 00096 GameScene * scene; 00097 }; 00098 00099 } 00100 00101 #endif /*REPLAY_READER_H_*/
Generated at Mon Sep 6 00:41:12 2010 by Doxygen version 1.4.7 for Racer version svn335.