1
0
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:
Ivan Savenko
2024-05-16 22:05:51 +00:00
parent 0d427980bc
commit 7461df161c
68 changed files with 173 additions and 174 deletions

View File

@ -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;