/* * RegisterTypes.h, 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 * */ #pragma once #include "../CHeroHandler.h" #include "../CPlayerState.h" #include "../CStack.h" #include "../RiverHandler.h" #include "../RoadHandler.h" #include "../TerrainHandler.h" #include "../battle/BattleInfo.h" #include "../battle/CObstacleInstance.h" #include "../bonuses/Limiters.h" #include "../bonuses/Propagators.h" #include "../bonuses/Updaters.h" #include "../campaign/CampaignState.h" #include "../gameState/CGameState.h" #include "../gameState/CGameStateCampaign.h" #include "../gameState/TavernHeroesPool.h" #include "../mapObjects/CGCreature.h" #include "../mapObjects/CGDwelling.h" #include "../mapObjects/CGMarket.h" #include "../mapObjects/CGPandoraBox.h" #include "../mapObjects/CGTownInstance.h" #include "../mapObjects/CQuest.h" #include "../mapObjects/MiscObjects.h" #include "../mapObjects/ObjectTemplate.h" #include "../mapObjects/TownBuildingInstance.h" #include "../mapping/CMap.h" #include "../mapping/CMapInfo.h" #include "../networkPacks/PacksForClient.h" #include "../networkPacks/PacksForClientBattle.h" #include "../networkPacks/PacksForLobby.h" #include "../networkPacks/PacksForServer.h" #include "../networkPacks/SetRewardableConfiguration.h" #include "../networkPacks/SetStackEffect.h" #include "../rmg/CMapGenOptions.h" VCMI_LIB_NAMESPACE_BEGIN /// This method defines all types that are part of Serializeable hieararchy and can be serialized as their base type /// Each class is registered with a unique index that is used to determine correct type on deserialization /// For example, if CGHeroInstance is serialized as pointer to CGObjectInstance serializer will write type index for CGHeroInstance, followed by CGHeroInstance::serialize() call /// Similarly, on deserialize, game will look up type index of object that was serialized as this CGObjectInstance and will load it as CGHeroInstance instead /// Meaning, these type indexes must NEVER change. /// If type is removed please only remove corresponding type, without adjusting indexes of following types /// NOTE: when removing type please consider potential save compatibility handling /// Similarly, when adding new type make sure to add it to the very end of this list with new type index template void registerTypes(Serializer &s) { static_assert(std::is_abstract_v, "If this type is no longer abstract consider registering it for serialization with ID 1"); static_assert(std::is_abstract_v, "If this type is no longer abstract consider registering it for serialization with ID 3"); static_assert(std::is_abstract_v, "If this type is no longer abstract consider registering it for serialization with ID 11"); static_assert(std::is_abstract_v, "If this type is no longer abstract consider registering it for serialization with ID 29"); static_assert(std::is_abstract_v, "If this type is no longer abstract consider registering it for serialization with ID 83"); static_assert(std::is_abstract_v, "If this type is no longer abstract consider registering it for serialization with ID 153"); static_assert(std::is_abstract_v, "If this type is no longer abstract consider registering it for serialization with ID 161"); static_assert(std::is_abstract_v, "If this type is no longer abstract consider registering it for serialization with ID 168"); s.template registerType(2); s.template registerType(4); s.template registerType(5); s.template registerType(6); s.template registerType(7); s.template registerType(8); s.template registerType(9); s.template registerType(10); s.template registerType(12); s.template registerType(13); s.template registerType(14); s.template registerType(15); s.template registerType(16); s.template registerType(17); s.template registerType(18); s.template registerType(19); s.template registerType(20); s.template registerType(21); s.template registerType(22); s.template registerType(23); s.template registerType(24); s.template registerType(25); s.template registerType(26); s.template registerType(27); s.template registerType(28); s.template registerType(30); s.template registerType(31); s.template registerType(32); s.template registerType(33); s.template registerType(34); s.template registerType(35); s.template registerType(36); s.template registerType(37); s.template registerType(38); s.template registerType(39); s.template registerType(40); s.template registerType(41); s.template registerType(42); s.template registerType(43); s.template registerType(44); s.template registerType(45); s.template registerType(46); s.template registerType(47); s.template registerType(48); s.template registerType(49); s.template registerType(50); s.template registerType(51); s.template registerType(52); s.template registerType(53); s.template registerType(56); s.template registerType(57); s.template registerType(58); s.template registerType(59); s.template registerType(60); s.template registerType(61); s.template registerType(62); s.template registerType(63); s.template registerType(64); s.template registerType(65); s.template registerType(66); s.template registerType(67); s.template registerType(68); s.template registerType(69); s.template registerType(70); s.template registerType(71); s.template registerType(72); s.template registerType(73); s.template registerType(74); s.template registerType(75); s.template registerType(76); s.template registerType(77); s.template registerType(78); s.template registerType(79); s.template registerType(80); s.template registerType(82); s.template registerType(84); s.template registerType(85); s.template registerType(86); s.template registerType(87); s.template registerType(88); s.template registerType(89); s.template registerType(90); s.template registerType(91); s.template registerType(92); s.template registerType(93); s.template registerType(94); s.template registerType(95); s.template registerType(96); s.template registerType(97); s.template registerType(98); s.template registerType(99); s.template registerType(100); s.template registerType(101); s.template registerType(102); s.template registerType(103); s.template registerType(104); s.template registerType(105); s.template registerType(106); s.template registerType(107); s.template registerType(108); s.template registerType(109); s.template registerType(110); s.template registerType(111); s.template registerType(112); s.template registerType(113); s.template registerType(114); s.template registerType(115); s.template registerType(116); s.template registerType(117); s.template registerType(118); s.template registerType(119); s.template registerType(120); s.template registerType(121); s.template registerType(122); s.template registerType(123); s.template registerType(124); s.template registerType(125); s.template registerType(126); s.template registerType(127); s.template registerType(128); s.template registerType(129); s.template registerType(130); s.template registerType(131); s.template registerType(132); s.template registerType(133); s.template registerType(134); s.template registerType(135); s.template registerType(136); s.template registerType(137); s.template registerType(138); s.template registerType(139); s.template registerType(140); s.template registerType(141); s.template registerType(142); s.template registerType(143); s.template registerType(144); s.template registerType(145); s.template registerType(146); s.template registerType(147); s.template registerType(148); s.template registerType(149); s.template registerType(150); s.template registerType(151); s.template registerType(152); s.template registerType(154); s.template registerType(155); s.template registerType(156); s.template registerType(157); s.template registerType(158); s.template registerType(159); s.template registerType(160); s.template registerType(162); s.template registerType(163); s.template registerType(164); s.template registerType(165); s.template registerType(166); s.template registerType(167); s.template registerType(169); s.template registerType(170); s.template registerType(171); s.template registerType(172); s.template registerType(173); s.template registerType(174); s.template registerType(175); s.template registerType(176); s.template registerType(177); s.template registerType(178); s.template registerType(179); s.template registerType(180); s.template registerType(181); s.template registerType(182); s.template registerType(183); s.template registerType(184); s.template registerType(185); s.template registerType(186); s.template registerType(187); s.template registerType(188); s.template registerType(189); s.template registerType(190); s.template registerType(191); s.template registerType(192); s.template registerType(193); s.template registerType(194); s.template registerType(195); s.template registerType(196); s.template registerType(197); s.template registerType(198); s.template registerType(199); s.template registerType(200); s.template registerType(201); s.template registerType(202); s.template registerType(203); s.template registerType(204); s.template registerType(205); s.template registerType(206); s.template registerType(207); s.template registerType(208); s.template registerType(209); s.template registerType(210); s.template registerType(211); s.template registerType(212); s.template registerType(213); s.template registerType(214); s.template registerType(215); s.template registerType(216); s.template registerType(217); s.template registerType(218); s.template registerType(219); s.template registerType(220); s.template registerType(221); s.template registerType(222); s.template registerType(223); s.template registerType(224); s.template registerType(225); s.template registerType(226); s.template registerType(227); s.template registerType(228); s.template registerType(229); s.template registerType(230); s.template registerType(231); s.template registerType(232); s.template registerType(233); s.template registerType(234); s.template registerType(235); s.template registerType(236); s.template registerType(237); s.template registerType(238); s.template registerType(239); s.template registerType(240); } VCMI_LIB_NAMESPACE_END