1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-24 08:32:34 +02:00

Created buildings5.json from buildings5.txt.

This commit is contained in:
Frank Zago 2011-09-03 20:45:27 +00:00
parent eff17aa850
commit 2787830c00
3 changed files with 71 additions and 61 deletions

61
config/buildings5.json Normal file
View File

@ -0,0 +1,61 @@
{
// Conversion table of buildings between vcmi and H3
"table": [
{ "town": -1, "h3": 0, "vcmi": 11 },
{ "town": -1, "h3": 1, "vcmi": 12 },
{ "town": -1, "h3": 2, "vcmi": 13 },
{ "town": -1, "h3": 3, "vcmi": 7 },
{ "town": -1, "h3": 4, "vcmi": 8 },
{ "town": -1, "h3": 5, "vcmi": 9 },
{ "town": -1, "h3": 6, "vcmi": 5 },
{ "town": -1, "h3": 7, "vcmi": 16 },
{ "town": -1, "h3": 8, "vcmi": 14 },
{ "town": -1, "h3": 9, "vcmi": 15 },
{ "town": -1, "h3": 10, "vcmi": 17 },
{ "town": -1, "h3": 11, "vcmi": 0 },
{ "town": -1, "h3": 12, "vcmi": 1 },
{ "town": -1, "h3": 13, "vcmi": 2 },
{ "town": -1, "h3": 14, "vcmi": 3 },
{ "town": -1, "h3": 15, "vcmi": 4 },
{ "town": -1, "h3": 16, "vcmi": 6 },
{ "town": -1, "h3": 17, "vcmi": 26 },
{ "town": -1, "h3": 18, "vcmi": 17 },
{ "town": -1, "h3": 19, "vcmi": 22 },
{ "town": -1, "h3": 20, "vcmi": 22 },
{ "town": -1, "h3": 21, "vcmi": 23 },
{ "town": -1, "h3": 22, "vcmi": 30 },
{ "town": -1, "h3": 23, "vcmi": 37 },
{ "town": -1, "h3": 24, "vcmi": -1 },
{ "town": -1, "h3": 25, "vcmi": 31 },
{ "town": -1, "h3": 26, "vcmi": 38 },
{ "town": -1, "h3": 27, "vcmi": -2 },
{ "town": -1, "h3": 28, "vcmi": 32 },
{ "town": -1, "h3": 29, "vcmi": 39 },
{ "town": -1, "h3": 30, "vcmi": -3 },
{ "town": -1, "h3": 31, "vcmi": 33 },
{ "town": -1, "h3": 32, "vcmi": 40 },
{ "town": -1, "h3": 33, "vcmi": -4 },
{ "town": -1, "h3": 34, "vcmi": 34 },
{ "town": -1, "h3": 35, "vcmi": 41 },
{ "town": -1, "h3": 36, "vcmi": -5 },
{ "town": -1, "h3": 37, "vcmi": 35 },
{ "town": -1, "h3": 38, "vcmi": 42 },
{ "town": -1, "h3": 39, "vcmi": 36 },
{ "town": -1, "h3": 40, "vcmi": 43 },
{ "town": 0, "h3": 20, "vcmi": 21 },
{ "town": 1, "h3": 19, "vcmi": 21 },
{ "town": 2, "h3": 18, "vcmi": 22 },
{ "town": 2, "h3": 19, "vcmi": 23 },
{ "town": 2, "h3": 20, "vcmi": 21 },
{ "town": 3, "h3": 20, "vcmi": 23 },
{ "town": 3, "h3": 18, "vcmi": 21 },
{ "town": 4, "h3": 19, "vcmi": 21 },
{ "town": 5, "h3": 20, "vcmi": 23 },
{ "town": 5, "h3": 18, "vcmi": 21 },
{ "town": 6, "h3": 19, "vcmi": 21 },
{ "town": 7, "h3": 20, "vcmi": 17 },
{ "town": 7, "h3": 18, "vcmi": 22 },
{ "town": 7, "h3": 19, "vcmi": 21 },
{ "town": 8, "h3": 18, "vcmi": 21 }
]
}

View File

@ -1,56 +0,0 @@
-1 0 11
-1 1 12
-1 2 13
-1 3 7
-1 4 8
-1 5 9
-1 6 5
-1 7 16
-1 8 14
-1 9 15
-1 10 17
-1 11 0
-1 12 1
-1 13 2
-1 14 3
-1 15 4
-1 16 6
-1 17 26
-1 18 17
-1 19 22
-1 20 22
-1 21 23
-1 22 30
-1 23 37
-1 24 -1
-1 25 31
-1 26 38
-1 27 -2
-1 28 32
-1 29 39
-1 30 -3
-1 31 33
-1 32 40
-1 33 -4
-1 34 34
-1 35 41
-1 36 -5
-1 37 35
-1 38 42
-1 39 36
-1 40 43
0 20 21
1 19 21
2 18 22
2 19 23
2 20 21
3 20 23
3 18 21
4 19 21
5 20 23
5 18 21
6 19 21
7 20 17
7 18 22
7 19 21
8 18 21

View File

@ -13,6 +13,7 @@
#include <assert.h>
#include "CSpellHandler.h"
#include <boost/foreach.hpp>
#include "../lib/JsonNode.h"
/*
* map.cpp, part of VCMI engine
@ -28,14 +29,18 @@ static std::set<si32> convertBuildings(const std::set<si32> h3m, int castleID, b
{
std::map<int,int> mapa;
std::set<si32> ret;
std::ifstream b5(DATA_DIR "/config/buildings5.txt");
while(!b5.eof())
// Note: this file is parsed many times.
const JsonNode config(DATA_DIR "/config/buildings5.json");
BOOST_FOREACH(const JsonNode &entry, config["table"].Vector())
{
int h3, VCMI, town;
b5 >> town >> h3 >> VCMI;
int town = entry["town"].Float();
if ( town == castleID || town == -1 )
mapa[h3]=VCMI;
mapa[entry["h3"].Float()] = entry["vcmi"].Float();
}
for(std::set<si32>::const_iterator i=h3m.begin();i!=h3m.end();i++)
{
if(mapa[*i]>=0)