1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

- VCMI will now read templates from mods

- Added partial schema for RMG template
This commit is contained in:
DjWarmonger 2015-05-26 18:19:41 +02:00
parent 4e25d74e74
commit 2e70d8a084
6 changed files with 80 additions and 2 deletions

View File

@ -0,0 +1,12 @@
{
"name" : "Default templates",
"description" : "A set of random map templates for VCMI",
"version" : "0.99",
"author" : "VCMI Team",
"contact" : "http://forum.vcmi.eu/index.php",
"modType" : "Templates",
"templates" : [
"config/defaultTemplates/rmg"
],
}

View File

@ -0,0 +1,63 @@
{
"type":"object",
"$schema": "",
"title" : "VCMI random map template format",
"description" : "Format used to define random map templates in VCMI",
"definitions" :
{
"zone":{
"type": "object",
"required" : ["type", "monsters", "size", "level"],
"properties":{
"type":{"$ref" : "#/definitions/type"},
"size":{"$ref" : "#/definitions/size"},
"playerTowns":{"$ref" : "#/definitions/playerTowns"},
"neuralTowns":{"$ref" : "#/definitions/neuralTowns"},
"townsAreSameType":{"$ref" : "#/definitions/townsAreSameType"},
"monsters":{"$ref" : "#/definitions/monsters"},
"mines":{"$ref" : "#/definitions/mines"},
"treasure":{
"type":"array",
"items":{
"type": "object",
"properties":{
"min": {"type":"number", "minimum" : 0},
"max": {"type":"number", "minimum" : 0},
"density": {"type":"number", "minimum" : 1}
},
"additionalProperties" : false
}
}
}
},
"type" :{
"type" : "object",
"enum": ["playerStart", "treasure", "junction"]
"additionalProperties" : false
"type":"string"
},
"size":{
"type": "number",
"minimum": 1,
"additionalProperties" : false,
}
},
"properties":
{
"zones":{
"type": "array",
"items":{"$ref" : "#/definitions/zone" }
},
"connections":{
"type": "array",
"items":{"$ref" : "#/definitions/connection"}
}
"required" : ["zones", "connections"],
"additionalProperties" : false
}
}

View File

@ -385,6 +385,7 @@ CContentHandler::CContentHandler()
handlers.insert(std::make_pair("objects", ContentTypeHandler(VLC->objtypeh, "object")));
handlers.insert(std::make_pair("heroes", ContentTypeHandler(VLC->heroh, "hero")));
handlers.insert(std::make_pair("spells", ContentTypeHandler(VLC->spellh, "spell")));
handlers.insert(std::make_pair("templates", ContentTypeHandler((IHandlerBase *)VLC->tplh, "template")));
//TODO: any other types of moddables?
}

View File

@ -942,6 +942,8 @@ enum class ESpellSchool: ui8
EARTH = 3
};
ID_LIKE_OPERATORS_DECLS(SpellID, SpellID::ESpellID)
// Typedef declarations
typedef ui8 TFaction;
typedef si64 TExpType;

View File

@ -115,12 +115,12 @@ void LibClasses::init()
createHandler(terviewh, "Terrain view pattern", pomtime);
createHandler(tplh, "Template", pomtime); //templates need already resolved identifiers (refactor?)
logGlobal->infoStream()<<"\tInitializing handlers: "<< totalTime.getDiff();
modh->load();
createHandler(tplh, "Template", pomtime); //templates need already resolved identifiers (refactor?)
modh->afterLoad();
//FIXME: make sure that everything is ok after game restart