Fixed crash in replay recorder when too many events happened.

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@11858 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
hikerstk 2012-11-04 10:08:35 +00:00
parent 2d93303425
commit 37fa73991b

View File

@ -25,6 +25,7 @@
#include "race/race_manager.hpp"
#include "tracks/track.hpp"
#include <algorithm>
#include <stdio.h>
#include <string>
@ -171,7 +172,10 @@ void ReplayRecorder::Save()
fprintf(fd, "model: %s\n", world->getKart(k)->getIdent().c_str());
fprintf(fd, "size: %d\n", m_count_transforms[k]);
for(unsigned int i=0; i<m_count_transforms[k]; i++)
unsigned int num_transforms =
std::min((unsigned int)stk_config->m_max_history,
m_count_transforms[k] );
for(unsigned int i=0; i<num_transforms; i++)
{
const TransformEvent *p=&(m_transform_events[k][i]);
fprintf(fd, "%f %f %f %f %f %f %f %f\n",