mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-31 22:59:54 +02:00
set values for map editor and rmg
This commit is contained in:
parent
02bd52041b
commit
018127b236
@ -41,7 +41,7 @@
|
||||
"alignment": "right",
|
||||
"color": "green",
|
||||
"text": "",
|
||||
"position": {"x": 418, "y": 40}
|
||||
"position": {"x": 418, "y": 48}
|
||||
},
|
||||
{
|
||||
"type": "boxWithBackground",
|
||||
|
@ -35,12 +35,20 @@ In header are parameters describing campaign properties
|
||||
"regions": {...},
|
||||
"name": "Campaign name",
|
||||
"description": "Campaign description",
|
||||
"author": "Author",
|
||||
"authorContact": "Author contact",
|
||||
"campaignVersion": "Campaign version",
|
||||
"creationDateTime": "Creation date and time",
|
||||
"allowDifficultySelection": true,
|
||||
```
|
||||
|
||||
- `"regions"` contains information about background and regions. See section [campaign regions](#regions-description) for more information
|
||||
- `"name"` is a human readable title of campaign
|
||||
- `"description"` is a human readable description of campaign
|
||||
- `"author"` is the author of the campaign
|
||||
- `"authorContact"` is a contact address for the author (e.g. email)
|
||||
- `"campaignVersion"` is creator defined version
|
||||
- `"creationDateTime"` unix time of campaign creation
|
||||
- `"allowDifficultySelection"` is a boolean field (`true`/`false`) which allows or disallows to choose difficulty before scenario start
|
||||
|
||||
# Scenario description
|
||||
|
@ -153,7 +153,7 @@ void CampaignHandler::readHeaderFromJson(CampaignHeader & ret, JsonNode & reader
|
||||
ret.description.appendTextID(reader["description"].String());
|
||||
ret.author.appendRawString(reader["author"].String());
|
||||
ret.authorContact.appendRawString(reader["authorContact"].String());
|
||||
ret.mapVersion.appendRawString(reader["mapVersion"].String());
|
||||
ret.campaignVersion.appendRawString(reader["campaignVersion"].String());
|
||||
ret.creationDateTime = reader["creationDateTime"].Integer();
|
||||
ret.difficultyChosenByPlayer = reader["allowDifficultySelection"].Bool();
|
||||
ret.music = AudioPath::fromJson(reader["music"]);
|
||||
@ -391,7 +391,7 @@ void CampaignHandler::readHeaderFromMemory( CampaignHeader & ret, CBinaryReader
|
||||
ret.description.appendTextID(readLocalizedString(ret, reader, filename, modName, encoding, "description"));
|
||||
ret.author.appendRawString("");
|
||||
ret.authorContact.appendRawString("");
|
||||
ret.mapVersion.appendRawString("");
|
||||
ret.campaignVersion.appendRawString("");
|
||||
ret.creationDateTime = 0;
|
||||
if (ret.version > CampaignVersion::RoE)
|
||||
ret.difficultyChosenByPlayer = reader.readInt8();
|
||||
|
@ -83,7 +83,7 @@ class DLL_LINKAGE CampaignHeader : public boost::noncopyable
|
||||
MetaString description;
|
||||
MetaString author;
|
||||
MetaString authorContact;
|
||||
MetaString mapVersion;
|
||||
MetaString campaignVersion;
|
||||
std::time_t creationDateTime;
|
||||
AudioPath music;
|
||||
std::string filename;
|
||||
@ -122,7 +122,7 @@ public:
|
||||
{
|
||||
h & author;
|
||||
h & authorContact;
|
||||
h & mapVersion;
|
||||
h & campaignVersion;
|
||||
h & creationDateTime;
|
||||
}
|
||||
h & difficultyChosenByPlayer;
|
||||
|
@ -137,6 +137,13 @@ std::unique_ptr<CMap> CMapGenerator::generate()
|
||||
throw;
|
||||
}
|
||||
Load::Progress::finish();
|
||||
|
||||
map->mapInstance->creationDateTime = std::time(nullptr);
|
||||
map->mapInstance->author = MetaString::createFromTextID("core.genrltxt.740");
|
||||
const auto * mapTemplate = mapGenOptions.getMapTemplate();
|
||||
if(mapTemplate)
|
||||
map->mapInstance->mapVersion = MetaString::createFromRawString(mapTemplate->getName());
|
||||
|
||||
return std::move(map->mapInstance);
|
||||
}
|
||||
|
||||
|
@ -201,6 +201,7 @@ std::unique_ptr<CMap> generateEmptyMap(CMapGenOptions & options)
|
||||
{
|
||||
auto map = std::make_unique<CMap>(nullptr);
|
||||
map->version = EMapFormat::VCMI;
|
||||
map->creationDateTime = std::time(nullptr);
|
||||
map->width = options.getWidth();
|
||||
map->height = options.getHeight();
|
||||
map->twoLevel = options.getHasTwoLevels();
|
||||
|
Loading…
x
Reference in New Issue
Block a user