1
// $Id: demo_player.cxx,v 1.8 2003/01/15 21:16:41 torangan Exp $
3
// Pingus - A free Lemmings clone
4
// Copyright (C) 2000 Ingo Ruhnke <grumbel@gmx.de>
6
// This program is free software; you can redistribute it and/or
7
// modify it under the terms of the GNU General Public License
8
// as published by the Free Software Foundation; either version 2
9
// of the License, or (at your option) any later version.
11
// This program is distributed in the hope that it will be useful,
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
// GNU General Public License for more details.
16
// You should have received a copy of the GNU General Public License
17
// along with this program; if not, write to the Free Software
18
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22
#include "demo_player.hxx"
23
#include "xml_pdf.hxx"
25
DemoPlayer::DemoPlayer(Server* s, XMLPDF* pdf)
27
events(pdf->get_events())
31
DemoPlayer::~DemoPlayer()
38
while(!events.empty() && events.back().time_stamp == server->get_time())
40
ServerEvent& event = events.back();
42
std::cout << "Sending: ";
43
event.write_xml(std::cout);
49
// Check for unexpected things (might happen if the demo file is broken)
50
if (!events.empty() && events.back().time_stamp < server->get_time())
52
std::cout << "DemoPlayer Bug: We missed a timestamp: " << events.back().time_stamp << std::endl;