Use unique_ptr instead of auto_ptr
This commit is contained in:
parent
75c1f02615
commit
e1f61040e5
@ -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
|
// we are using auto_ptr to make sure the XML node is released when leaving
|
||||||
// the scope
|
// 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")
|
if(root.get() == NULL || root->getName()!="challenge")
|
||||||
{
|
{
|
||||||
|
@ -44,7 +44,7 @@ IconButtonWidget::IconButtonWidget(ScaleMode scale_mode, const bool tab_stop,
|
|||||||
m_texture = NULL;
|
m_texture = NULL;
|
||||||
m_deactivated_texture = NULL;
|
m_deactivated_texture = NULL;
|
||||||
m_highlight_texture = NULL;
|
m_highlight_texture = NULL;
|
||||||
|
|
||||||
m_custom_aspect_ratio = 1.0f;
|
m_custom_aspect_ratio = 1.0f;
|
||||||
|
|
||||||
m_texture_w = 0;
|
m_texture_w = 0;
|
||||||
@ -112,7 +112,7 @@ void IconButtonWidget::add()
|
|||||||
// irrlicht widgets don't support scaling while keeping aspect ratio
|
// irrlicht widgets don't support scaling while keeping aspect ratio
|
||||||
// so, happily, let's implement it ourselves
|
// so, happily, let's implement it ourselves
|
||||||
float useAspectRatio = -1.0f;
|
float useAspectRatio = -1.0f;
|
||||||
|
|
||||||
if (m_properties[PROP_CUSTOM_RATIO] != "")
|
if (m_properties[PROP_CUSTOM_RATIO] != "")
|
||||||
{
|
{
|
||||||
StringUtils::fromString(m_properties[PROP_CUSTOM_RATIO],
|
StringUtils::fromString(m_properties[PROP_CUSTOM_RATIO],
|
||||||
@ -227,7 +227,7 @@ void IconButtonWidget::add()
|
|||||||
m_id = m_element->getID();
|
m_id = m_element->getID();
|
||||||
if (m_tab_stop) m_element->setTabOrder(m_id);
|
if (m_tab_stop) m_element->setTabOrder(m_id);
|
||||||
m_element->setTabGroup(false);
|
m_element->setTabGroup(false);
|
||||||
|
|
||||||
if (!m_is_visible)
|
if (!m_is_visible)
|
||||||
m_element->setVisible(false);
|
m_element->setVisible(false);
|
||||||
}
|
}
|
||||||
@ -334,7 +334,7 @@ video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* textur
|
|||||||
|
|
||||||
std::string name = texture->getName().getPath().c_str();
|
std::string name = texture->getName().getPath().c_str();
|
||||||
name += "_disabled";
|
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);
|
/*compain_if_not_found*/false);
|
||||||
if (t == NULL)
|
if (t == NULL)
|
||||||
{
|
{
|
||||||
@ -342,7 +342,7 @@ video::ITexture* IconButtonWidget::getDeactivatedTexture(video::ITexture* textur
|
|||||||
u32 g;
|
u32 g;
|
||||||
|
|
||||||
video::IVideoDriver* driver = irr_driver->getVideoDriver();
|
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->getSize(), texture->lock(), false));
|
||||||
texture->unlock();
|
texture->unlock();
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
|
|||||||
// Ignore no-racing tracks:
|
// Ignore no-racing tracks:
|
||||||
if(!track->isRaceTrack())
|
if(!track->isRaceTrack())
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()))
|
if (PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
@ -132,10 +132,10 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
|
|||||||
|
|
||||||
const Track *track = track_manager->getTrack(track_index);
|
const Track *track = track_manager->getTrack(track_index);
|
||||||
std::string id = track->getIdent();
|
std::string id = track->getIdent();
|
||||||
|
|
||||||
if (PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()))
|
if (PlayerManager::getCurrentPlayer()->isLocked(track->getIdent()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
bool is_already_added = false;
|
bool is_already_added = false;
|
||||||
for (unsigned int i = 0; i < m_tracks.size(); i++)
|
for (unsigned int i = 0; i < m_tracks.size(); i++)
|
||||||
{
|
{
|
||||||
@ -145,7 +145,7 @@ void GrandPrixData::changeTrackNumber(const unsigned int number_of_tracks,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_already_added)
|
if (!is_already_added)
|
||||||
{
|
{
|
||||||
m_tracks.push_back(id);
|
m_tracks.push_back(id);
|
||||||
@ -251,7 +251,7 @@ void GrandPrixData::reload()
|
|||||||
m_laps.clear();
|
m_laps.clear();
|
||||||
m_reversed.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)
|
if (root.get() == NULL)
|
||||||
{
|
{
|
||||||
Log::error("GrandPrixData",
|
Log::error("GrandPrixData",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user