Use unique_ptr instead of auto_ptr

This commit is contained in:
deve 2015-08-06 13:54:29 +02:00
parent 75c1f02615
commit e1f61040e5
3 changed files with 11 additions and 11 deletions

View File

@ -53,7 +53,7 @@ ChallengeData::ChallengeData(const std::string& filename)
// we are using auto_ptr to make sure the XML node is released when leaving
// the scope
std::auto_ptr<XMLNode> root(new XMLNode( filename ));
std::unique_ptr<XMLNode> root(new XMLNode( filename ));
if(root.get() == NULL || root->getName()!="challenge")
{

View File

@ -44,7 +44,7 @@ IconButtonWidget::IconButtonWidget(ScaleMode scale_mode, const bool tab_stop,
m_texture = NULL;
m_deactivated_texture = NULL;
m_highlight_texture = NULL;
m_custom_aspect_ratio = 1.0f;
m_texture_w = 0;
@ -112,7 +112,7 @@ void IconButtonWidget::add()
// irrlicht widgets don't support scaling while keeping aspect ratio
// so, happily, let's implement it ourselves
float useAspectRatio = -1.0f;
if (m_properties[PROP_CUSTOM_RATIO] != "")
{
StringUtils::fromString(m_properties[PROP_CUSTOM_RATIO],
@ -227,7 +227,7 @@ void IconButtonWidget::add()
m_id = m_element->getID();
if (m_tab_stop) m_element->setTabOrder(m_id);
m_element->setTabGroup(false);
if (!m_is_visible)
m_element->setVisible(false);
}
@ -334,7 +334,7 @@ video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* textur
std::string name = texture->getName().getPath().c_str();
name += "_disabled";
t = irr_driver->getTexture(name, /*premul*/false, /*prediv*/false,
t = irr_driver->getTexture(name, /*premul*/false, /*prediv*/false,
/*compain_if_not_found*/false);
if (t == NULL)
{
@ -342,7 +342,7 @@ video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* textur
u32 g;
video::IVideoDriver* driver = irr_driver->getVideoDriver();
std::auto_ptr<video::IImage> image (driver->createImageFromData (texture->getColorFormat(),
std::unique_ptr<video::IImage> image (driver->createImageFromData (texture->getColorFormat(),
texture->getSize(), texture->lock(), false));
texture->unlock();

View File

@ -106,7 +106,7 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
// Ignore no-racing tracks:
if(!track->isRaceTrack())
continue;
if (PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()))
continue;
@ -132,10 +132,10 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
const Track *track = track_manager->getTrack(track_index);
std::string id = track->getIdent();
if (PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()))
continue;
bool is_already_added = false;
for (unsigned int i = 0; i < m_tracks.size(); i++)
{
@ -145,7 +145,7 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
break;
}
}
if (!is_already_added)
{
m_tracks.push_back(id);
@ -251,7 +251,7 @@ void GrandPrixData::reload()
m_laps.clear();
m_reversed.clear();
std::auto_ptr<XMLNode> root(file_manager->createXMLTree(m_filename));
std::unique_ptr<XMLNode> root(file_manager->createXMLTree(m_filename));
if (root.get() == NULL)
{
Log::error("GrandPrixData",