mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-03 00:46:55 +02:00
lib now uses shared_ptr for entities. Removed manual memory management.
This commit is contained in:
@ -13,17 +13,18 @@
|
||||
#include "CGeneralTextHandler.h"
|
||||
#include "GameSettings.h"
|
||||
#include "json/JsonNode.h"
|
||||
#include "VCMI_Lib.h"
|
||||
|
||||
VCMI_LIB_NAMESPACE_BEGIN
|
||||
|
||||
RoadTypeHandler::RoadTypeHandler()
|
||||
{
|
||||
objects.push_back(new RoadType());
|
||||
objects.emplace_back(new RoadType());
|
||||
|
||||
VLC->generaltexth->registerString("core", objects[0]->getNameTextID(), "");
|
||||
}
|
||||
|
||||
RoadType * RoadTypeHandler::loadFromJson(
|
||||
std::shared_ptr<RoadType> RoadTypeHandler::loadFromJson(
|
||||
const std::string & scope,
|
||||
const JsonNode & json,
|
||||
const std::string & identifier,
|
||||
@ -31,7 +32,7 @@ RoadType * RoadTypeHandler::loadFromJson(
|
||||
{
|
||||
assert(identifier.find(':') == std::string::npos);
|
||||
|
||||
auto * info = new RoadType;
|
||||
auto info = std::make_shared<RoadType>();
|
||||
|
||||
info->id = RoadId(index);
|
||||
info->identifier = identifier;
|
||||
|
Reference in New Issue
Block a user