mirror of
https://github.com/vcmi/vcmi.git
synced 2025-07-17 01:32:21 +02:00
Integrate buildings4.txt into buildings.json. It's ligthly tested because I can't find what this file is supposed to define.
This commit is contained in:
@ -421,5 +421,88 @@
|
|||||||
],
|
],
|
||||||
"blit_order": [ -1, 27, 28, 16, 34, 41, 6, 20, 33, 40, 36, 43, 21, 0, 1, 2, 3, 4, 5, 15, 14, 17, 35, 42, 30, 18, 37, 19, 10, 11, 12, 13, 29 ]
|
"blit_order": [ -1, 27, 28, 16, 34, 41, 6, 20, 33, 40, 36, 43, 21, 0, 1, 2, 3, 4, 5, 15, 14, 17, 35, 42, 30, 18, 37, 19, 10, 11, 12, 13, 29 ]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"town_groups": // Not sure what that is.
|
||||||
|
[
|
||||||
|
{
|
||||||
|
// Applies to all castles
|
||||||
|
"id": -1,
|
||||||
|
"groups" : [
|
||||||
|
[ 0, 1, 2, 3, 4 ],
|
||||||
|
[ 6, 20 ],
|
||||||
|
[ 7, 8, 9 ],
|
||||||
|
[ 10, 11, 12, 13 ],
|
||||||
|
[ 30, 37 ],
|
||||||
|
[ 31, 38 ],
|
||||||
|
[ 32, 39 ],
|
||||||
|
[ 33, 40 ],
|
||||||
|
[ 34, 41 ],
|
||||||
|
[ 35, 42 ],
|
||||||
|
[ 36, 43 ],
|
||||||
|
[ 24, 25 ],
|
||||||
|
[ 18, 19 ]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"groups" : [
|
||||||
|
[ 24, 25, 34, 41 ],
|
||||||
|
[ 17, 21 ],
|
||||||
|
[ 31, 18, 38, 19 ]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"groups" : [
|
||||||
|
[ 18, 19, 31, 38 ]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"groups" : [
|
||||||
|
[ 18, 19, 30, 37 ],
|
||||||
|
[ 32, 39, 24, 25 ]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 4,
|
||||||
|
"groups" : [
|
||||||
|
[ 30, 37, 18, 19 ]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 5,
|
||||||
|
"groups" : [
|
||||||
|
[ 30, 37, 18, 19 ]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 6,
|
||||||
|
"groups" : [
|
||||||
|
[ 21 ],
|
||||||
|
[ 30, 37, 18, 19 ]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 7,
|
||||||
|
"groups" : [
|
||||||
|
[ 30, 37, 18, 19 ]
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
{
|
||||||
|
"id": 8,
|
||||||
|
"groups" : [
|
||||||
|
[ 30, 37, 18, 19 ]
|
||||||
|
],
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -1,111 +0,0 @@
|
|||||||
1
|
|
||||||
ALL
|
|
||||||
GROUP
|
|
||||||
0
|
|
||||||
1
|
|
||||||
2
|
|
||||||
3
|
|
||||||
4
|
|
||||||
GROUP
|
|
||||||
6
|
|
||||||
20
|
|
||||||
GROUP
|
|
||||||
7
|
|
||||||
8
|
|
||||||
9
|
|
||||||
GROUP
|
|
||||||
10
|
|
||||||
11
|
|
||||||
12
|
|
||||||
13
|
|
||||||
GROUP
|
|
||||||
30
|
|
||||||
37
|
|
||||||
GROUP
|
|
||||||
31
|
|
||||||
38
|
|
||||||
GROUP
|
|
||||||
32
|
|
||||||
39
|
|
||||||
GROUP
|
|
||||||
33
|
|
||||||
40
|
|
||||||
GROUP
|
|
||||||
34
|
|
||||||
41
|
|
||||||
GROUP
|
|
||||||
35
|
|
||||||
42
|
|
||||||
GROUP
|
|
||||||
36
|
|
||||||
43
|
|
||||||
GROUP
|
|
||||||
24
|
|
||||||
25
|
|
||||||
GROUP
|
|
||||||
18
|
|
||||||
19
|
|
||||||
CASTLE 1
|
|
||||||
GROUP
|
|
||||||
24
|
|
||||||
25
|
|
||||||
34
|
|
||||||
41
|
|
||||||
GROUP
|
|
||||||
17
|
|
||||||
21
|
|
||||||
GROUP
|
|
||||||
31
|
|
||||||
18
|
|
||||||
38
|
|
||||||
19
|
|
||||||
CASTLE 2
|
|
||||||
GROUP
|
|
||||||
18
|
|
||||||
19
|
|
||||||
31
|
|
||||||
38
|
|
||||||
CASTLE 3
|
|
||||||
GROUP
|
|
||||||
18
|
|
||||||
19
|
|
||||||
30
|
|
||||||
37
|
|
||||||
GROUP
|
|
||||||
32
|
|
||||||
39
|
|
||||||
24
|
|
||||||
25
|
|
||||||
CASTLE 4
|
|
||||||
GROUP
|
|
||||||
30
|
|
||||||
37
|
|
||||||
18
|
|
||||||
19
|
|
||||||
CASTLE 5
|
|
||||||
GROUP
|
|
||||||
30
|
|
||||||
37
|
|
||||||
18
|
|
||||||
19
|
|
||||||
CASTLE 6
|
|
||||||
GROUP
|
|
||||||
21
|
|
||||||
GROUP
|
|
||||||
30
|
|
||||||
37
|
|
||||||
18
|
|
||||||
19
|
|
||||||
CASTLE 7
|
|
||||||
GROUP
|
|
||||||
30
|
|
||||||
37
|
|
||||||
18
|
|
||||||
19
|
|
||||||
CASTLE 8
|
|
||||||
GROUP
|
|
||||||
30
|
|
||||||
37
|
|
||||||
18
|
|
||||||
19
|
|
||||||
EOD
|
|
@ -6,6 +6,7 @@
|
|||||||
#include "../lib/VCMI_Lib.h"
|
#include "../lib/VCMI_Lib.h"
|
||||||
#include "CGeneralTextHandler.h"
|
#include "CGeneralTextHandler.h"
|
||||||
#include "../lib/JsonNode.h"
|
#include "../lib/JsonNode.h"
|
||||||
|
#include <boost/foreach.hpp>
|
||||||
|
|
||||||
extern CLodHandler * bitmaph;
|
extern CLodHandler * bitmaph;
|
||||||
void loadToIt(std::string &dest, const std::string &src, int &iter, int mode);
|
void loadToIt(std::string &dest, const std::string &src, int &iter, int mode);
|
||||||
@ -184,88 +185,49 @@ void CTownHandler::loadStructures()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//read borders and areas names
|
int group_num=0;
|
||||||
int format;
|
|
||||||
std::string s;
|
// Iterate for each city
|
||||||
|
BOOST_FOREACH(const JsonNode &town_node, config["town_groups"].Vector()) {
|
||||||
|
townID = town_node["id"].Float();
|
||||||
|
|
||||||
|
// Iterate for each group for that city
|
||||||
|
BOOST_FOREACH(const JsonNode &group, town_node["groups"].Vector()) {
|
||||||
|
|
||||||
|
group_num ++;
|
||||||
|
|
||||||
|
// Iterate for each bulding value in the group
|
||||||
|
BOOST_FOREACH(const JsonNode &value, group.Vector()) {
|
||||||
|
int buildingID = value.Float();
|
||||||
|
|
||||||
//read groups
|
|
||||||
of.open(DATA_DIR "/config/buildings4.txt");
|
|
||||||
of >> format;
|
|
||||||
if(format!=1)
|
|
||||||
{
|
|
||||||
tlog1 << "Unhandled format of buildings4.txt \n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
of >> s;
|
|
||||||
int itr=1;
|
|
||||||
while(!of.eof())
|
|
||||||
{
|
|
||||||
std::vector<std::map<int, Structure*> >::iterator i;
|
std::vector<std::map<int, Structure*> >::iterator i;
|
||||||
std::map<int, Structure*>::iterator i2;
|
std::map<int, Structure*>::iterator i2;
|
||||||
int buildingID;
|
|
||||||
int castleID;
|
if (townID >= 0) {
|
||||||
itr++;
|
if ((i = structures.begin() + townID) != structures.end()) {
|
||||||
if (s == "CASTLE")
|
if ((i2=(i->find(buildingID)))!=(i->end()))
|
||||||
{
|
i2->second->group = group_num;
|
||||||
of >> castleID;
|
else
|
||||||
}
|
tlog3 << "Warning3: No building "<<buildingID<<" in the castle "<<townID<<std::endl;
|
||||||
else if(s == "ALL")
|
|
||||||
{
|
|
||||||
castleID = -1;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
tlog3 << "Warning3: Castle "<<townID<<" not defined."<<std::endl;
|
||||||
break;
|
} else {
|
||||||
}
|
// Set group for selected building in ALL castles
|
||||||
of >> s;
|
for (i=structures.begin();i!=structures.end();i++) {
|
||||||
while(1) //read groups for castle
|
for(i2=i->begin(); i2!=i->end(); i2++) {
|
||||||
{
|
if(i2->first == buildingID) {
|
||||||
if (s == "GROUP")
|
i2->second->group = group_num;
|
||||||
{
|
|
||||||
while(1)
|
|
||||||
{
|
|
||||||
of >> s;
|
|
||||||
if((s == "GROUP") || (s == "EOD") || (s == "CASTLE")) //
|
|
||||||
break;
|
|
||||||
buildingID = atoi(s.c_str());
|
|
||||||
if(castleID>=0)
|
|
||||||
{
|
|
||||||
if((i = structures.begin() + castleID) != structures.end())
|
|
||||||
if((i2=(i->find(buildingID)))!=(i->end()))
|
|
||||||
i2->second->group = itr;
|
|
||||||
else
|
|
||||||
tlog3 << "Warning3: No building "<<buildingID<<" in the castle "<<castleID<<std::endl;
|
|
||||||
else
|
|
||||||
tlog3 << "Warning3: Castle "<<castleID<<" not defined."<<std::endl;
|
|
||||||
}
|
|
||||||
else //set group for selected building in ALL castles
|
|
||||||
{
|
|
||||||
for(i=structures.begin();i!=structures.end();i++)
|
|
||||||
{
|
|
||||||
for(i2=i->begin(); i2!=i->end(); i2++)
|
|
||||||
{
|
|
||||||
if(i2->first == buildingID)
|
|
||||||
{
|
|
||||||
i2->second->group = itr;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(s == "CASTLE")
|
|
||||||
break;
|
|
||||||
itr++;
|
|
||||||
}//if (s == "GROUP")
|
|
||||||
else if(s == "EOD")
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
of.close();
|
|
||||||
of.clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string & CTown::Name() const
|
const std::string & CTown::Name() const
|
||||||
{
|
{
|
||||||
if(name.length())
|
if(name.length())
|
||||||
|
Reference in New Issue
Block a user