1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

* WIP on event condition format

* Hero portrait serialization
* Fix town spells serialization

* Added support for float exponential part in Json
* Added support for int64 in Json
* Added basic Hero definitions serialization
* Added rumors serialization
* Advanced player info serialization.
* Added Disposed heroes serialization, (!) not covered with tests yet
* Added Local event serialization
* Added Pandoras box serialization
* Added Seer hut reward serialization
* Added CQuest serialization
* Added API for map object instance names serialization.
* Added random dwelling options serialization
* Advanced town options serialization
* Advanced hero options serialization
* More map format tests
* A lot of fixes, cleanup and refactoring
This commit is contained in:
AlexVinS
2016-11-13 13:38:42 +03:00
parent 5127061e28
commit a85b4cf2a5
70 changed files with 18728 additions and 687 deletions

View File

@ -328,9 +328,9 @@ void CGObjectInstance::serializeJson(JsonSerializeFormat & handler)
handler.serializeString("type", typeName);
handler.serializeString("subtype", subTypeName);
handler.serializeNumeric("x", pos.x);
handler.serializeNumeric("y", pos.y);
handler.serializeNumeric("l", pos.z);
handler.serializeInt("x", pos.x);
handler.serializeInt("y", pos.y);
handler.serializeInt("l", pos.z);
appearance.writeJson(handler.getCurrent()["template"], false);
}
@ -352,32 +352,12 @@ void CGObjectInstance::serializeJsonOptions(JsonSerializeFormat & handler)
void CGObjectInstance::serializeJsonOwner(JsonSerializeFormat & handler)
{
std::string temp;
ui8 temp = tempOwner.getNum();
//todo: use enum serialize
if(handler.saving)
{
if(tempOwner.isValidPlayer())
{
temp = GameConstants::PLAYER_COLOR_NAMES[tempOwner.getNum()];
handler.serializeString("owner", temp);
}
}
else
{
tempOwner = PlayerColor::NEUTRAL;//this method assumes that object is ownable
handler.serializeEnum("owner", temp, PlayerColor::NEUTRAL.getNum(), GameConstants::PLAYER_COLOR_NAMES);
handler.serializeString("owner", temp);
if(temp != "")
{
auto rawOwner = vstd::find_pos(GameConstants::PLAYER_COLOR_NAMES, temp);
if(rawOwner >=0)
tempOwner = PlayerColor(rawOwner);
else
logGlobal->errorStream() << "Invalid owner :" << temp;
}
}
if(!handler.saving)
tempOwner = PlayerColor(temp);
}
CGObjectInstanceBySubIdFinder::CGObjectInstanceBySubIdFinder(CGObjectInstance * obj) : obj(obj)