mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-25 22:42:04 +02:00
Add files for rebased serializer refactoring done by Ivan
This commit is contained in:
committed by
Arseniy Shestakov
parent
15b4774076
commit
3d1b1f4ba8
49
lib/serializer/CSerializer.cpp
Normal file
49
lib/serializer/CSerializer.cpp
Normal file
@@ -0,0 +1,49 @@
|
||||
#include "StdInc.h"
|
||||
#include "CSerializer.h"
|
||||
|
||||
#include "CGameState.h"
|
||||
#include "mapping/CMap.h"
|
||||
#include "CHeroHandler.h"
|
||||
#include "../mapObjects/CGHeroInstance.h"
|
||||
|
||||
/*
|
||||
* CSerializer.cpp, part of VCMI engine
|
||||
*
|
||||
* Authors: listed in file AUTHORS in main folder
|
||||
*
|
||||
* License: GNU General Public License v2.0 or later
|
||||
* Full text of license available in license.txt file, in main folder
|
||||
*
|
||||
*/
|
||||
|
||||
CSerializer::~CSerializer()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
CSerializer::CSerializer()
|
||||
{
|
||||
smartVectorMembersSerialization = false;
|
||||
sendStackInstanceByIds = false;
|
||||
}
|
||||
|
||||
|
||||
void CSerializer::addStdVecItems(CGameState *gs, LibClasses *lib)
|
||||
{
|
||||
registerVectoredType<CGObjectInstance, ObjectInstanceID>(&gs->map->objects,
|
||||
[](const CGObjectInstance &obj){ return obj.id; });
|
||||
registerVectoredType<CHero, HeroTypeID>(&lib->heroh->heroes,
|
||||
[](const CHero &h){ return h.ID; });
|
||||
registerVectoredType<CGHeroInstance, HeroTypeID>(&gs->map->allHeroes,
|
||||
[](const CGHeroInstance &h){ return h.type->ID; });
|
||||
registerVectoredType<CCreature, CreatureID>(&lib->creh->creatures,
|
||||
[](const CCreature &cre){ return cre.idNumber; });
|
||||
registerVectoredType<CArtifact, ArtifactID>(&lib->arth->artifacts,
|
||||
[](const CArtifact &art){ return art.id; });
|
||||
registerVectoredType<CArtifactInstance, ArtifactInstanceID>(&gs->map->artInstances,
|
||||
[](const CArtifactInstance &artInst){ return artInst.id; });
|
||||
registerVectoredType<CQuest, si32>(&gs->map->quests,
|
||||
[](const CQuest &q){ return q.qid; });
|
||||
|
||||
smartVectorMembersSerialization = true;
|
||||
}
|
||||
Reference in New Issue
Block a user