stk-code_catmod/src/cup_data.hpp
ikework 9d89de895e (1) fixed memory-leak related to vector GrandPrixSelect::m_all_cups. items were allocated with new, but never deleted. changed vector to vector of objects:
old:
  std::vector<CupData*> m_all_cups;
new:
  std::vector<CupData> m_all_cups;

related: 
changed RaceManager::setGrandPrix(const CupData &cup_) to const reference rather than pointer to CupData

(2) made vector CupData::m_tracks private and added getter

(3) CupData::m_name was passed in GrandPrixSelect::GrandPrixSelect() to WidgetSet as const char*
    then it was passed to Widget::_text. changed the latter to std::string and passed it as std::string
    
(4) changed Widget::count_text  to std::string as well .. 

(5) tracked down all uses of Widget::count_text & Widget::_text to plib. changed
all funcs in between to work with std::string rather than const char*

Font::getBBox
WidgetSet::set_label
WidgetSet::get_label
WidgetSet::start
WidgetSet::state
WidgetSet::label

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1238 178a84e3-b1eb-0310-8ba1-8eac791a3b58
2007-09-10 17:03:31 +00:00

60 lines
2.4 KiB
C++

// $Id$
//
// SuperTuxKart - a fun racing game with go-kart
// Copyright (C) 2004-2006 Ingo Ruhnke <grumbel@gmx.de>
// Copyright (C) 2006 Joerg Henirchs, Ingo Ruhnke <grumbel@gmx.de>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef HEADER_CUPDATA_H
#define HEADER_CUPDATA_H
#include <string>
#include <vector>
#include <cassert>
#include "herring_manager.hpp"
/** Simple class that hold the data relevant to a 'cup', aka. a number
of races that has to be completed one after the other */
class CupData
{
std::string m_name; // The name of the cup
std::string m_filename; // Original filename, only for error handling needed
std::string m_description; // Description for this track
std::string m_herring_style; // herring style which overwrites the track default
/** The ident of the tracks in this cup in their right order, ident
means the filename of the .track file without .track extension
(ie. 'volcano') */
std::vector<std::string> m_tracks;
public:
/** Load the CupData from the given filename */
CupData (const std::string filename);
CupData () {}; // empty for initialising
const std::string& getName () const { return m_name; }
const std::string& getDescription () const { return m_description; }
const std::string& getHerringStyle() const { return m_herring_style;}
const std::string& getFilename () const { return m_filename; }
const std::string& getTrack(size_t track_index) const { assert(track_index < m_tracks.size()); return m_tracks[track_index]; }
size_t getTrackCount() const { return m_tracks.size(); }
}
; // CupData
#endif
/* EOF */