mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-28 08:48:48 +02:00
Created towns_defs.json from townsDefs.txt.
This commit is contained in:
parent
35622913f9
commit
d49058049e
@ -20,6 +20,7 @@
|
||||
#include "../lib/NetPacks.h"
|
||||
#include "../lib/VCMI_Lib.h"
|
||||
#include "../lib/map.h"
|
||||
#include "../lib/JsonNode.cpp"
|
||||
#include "mapHandler.h"
|
||||
#include "CConfigHandler.h"
|
||||
#include "Client.h"
|
||||
@ -176,28 +177,30 @@ void CClient::save(const std::string & fname)
|
||||
*serv << &save_game;
|
||||
}
|
||||
|
||||
#include <fstream>
|
||||
void initVillagesCapitols(Mapa * map)
|
||||
{
|
||||
std::ifstream ifs(DATA_DIR "/config/townsDefs.txt");
|
||||
int ccc;
|
||||
ifs>>ccc;
|
||||
for(int i=0;i<ccc*2;i++)
|
||||
{
|
||||
const CGDefInfo *n;
|
||||
if(i<ccc)
|
||||
{
|
||||
n = CGI->state->villages[i];
|
||||
map->defy.push_back(CGI->state->forts[i]);
|
||||
}
|
||||
else
|
||||
n = CGI->state->capitols[i%ccc];
|
||||
const JsonNode config(DATA_DIR "/config/towns_defs.json");
|
||||
int idx;
|
||||
|
||||
ifs >> const_cast<CGDefInfo*>(n)->name;
|
||||
if(!n)
|
||||
tlog1 << "*HUGE* Warning - missing town def for " << i << std::endl;
|
||||
else
|
||||
map->defy.push_back(const_cast<CGDefInfo*>(n));
|
||||
idx = 0;
|
||||
BOOST_FOREACH(const JsonNode &t, config["town_defnames"].Vector()) {
|
||||
|
||||
map->defy.push_back(CGI->state->forts[idx]);
|
||||
|
||||
const CGDefInfo *n = CGI->state->villages[idx];
|
||||
const_cast<CGDefInfo*>(n)->name = t["village"].String();
|
||||
map->defy.push_back(const_cast<CGDefInfo*>(n));
|
||||
|
||||
idx++;
|
||||
}
|
||||
|
||||
idx = 0;
|
||||
BOOST_FOREACH(const JsonNode &t, config["town_defnames"].Vector()) {
|
||||
const CGDefInfo *n = CGI->state->capitols[idx];
|
||||
const_cast<CGDefInfo*>(n)->name = t["capitol"].String();
|
||||
map->defy.push_back(const_cast<CGDefInfo*>(n));
|
||||
|
||||
idx++;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,19 +0,0 @@
|
||||
9
|
||||
AVCCAST0.DEF
|
||||
AVCRAMP0.DEF
|
||||
AVCTOWR0.DEF
|
||||
AVCINFT0.DEF
|
||||
AVCNECR0.DEF
|
||||
AVCDUNG0.DEF
|
||||
AVCSTRO0.DEF
|
||||
AVCFTRT0.DEF
|
||||
AVCHFOR0.DEF
|
||||
AVCCASZ0.DEF
|
||||
AVCRAMZ0.DEF
|
||||
AVCTOWZ0.DEF
|
||||
AVCINFZ0.DEF
|
||||
AVCNECZ0.DEF
|
||||
AVCDUNZ0.DEF
|
||||
AVCSTRZ0.DEF
|
||||
AVCFORZ0.DEF
|
||||
AVCHFORZ.DEF
|
14
config/towns_defs.json
Normal file
14
config/towns_defs.json
Normal file
@ -0,0 +1,14 @@
|
||||
{
|
||||
// Graphics for villages and castles on the map, ordered by town id.
|
||||
"town_defnames": [
|
||||
{ "village": "AVCCAST0.DEF", "capitol": "AVCCASZ0.DEF" },
|
||||
{ "village": "AVCRAMP0.DEF", "capitol": "AVCRAMZ0.DEF" },
|
||||
{ "village": "AVCTOWR0.DEF", "capitol": "AVCTOWZ0.DEF" },
|
||||
{ "village": "AVCINFT0.DEF", "capitol": "AVCINFZ0.DEF" },
|
||||
{ "village": "AVCNECR0.DEF", "capitol": "AVCNECZ0.DEF" },
|
||||
{ "village": "AVCDUNG0.DEF", "capitol": "AVCDUNZ0.DEF" },
|
||||
{ "village": "AVCSTRO0.DEF", "capitol": "AVCSTRZ0.DEF" },
|
||||
{ "village": "AVCFTRT0.DEF", "capitol": "AVCFORZ0.DEF" },
|
||||
{ "village": "AVCHFOR0.DEF", "capitol": "AVCHFORZ.DEF" }
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user