Browse Source

Merged building_horde.txt into buildings.json.

Frank Zago 14 years ago
parent
commit
e997b25583
3 changed files with 16 additions and 28 deletions
  1. 0 18
      config/building_horde.txt
  2. 9 0
      config/buildings.json
  3. 7 10
      lib/CTownHandler.cpp

+ 0 - 18
config/building_horde.txt

@@ -1,18 +0,0 @@
-0	1	2
-0	2	-1
-1	1	1
-1	2	4
-2	1	1
-2	2	-1
-3	1	0
-3	2	2
-4	1	0
-4	2	-1
-5	1	0
-5	2	-1
-6	1	0
-6	2	-1
-7	1	0
-7	2	-1
-8	1	0
-8	2	-1

+ 9 - 0
config/buildings.json

@@ -55,6 +55,7 @@
 		  "blit_order": [ 1, 2, 3, 10, 11, 12, 13, 5, 22, 30, 37, 16, 6, 20, 18, 19, 34, 41 ],
 		  "creatures_basic": [ 0, 2, 4, 6, 8, 10, 12, 150 ],
 		  "creatures_upgraded": [ 1, 3, 5, 7, 9, 11, 13 ],
+		  "horde": [ 2, -1 ],
 		},
 
 		{
@@ -107,6 +108,7 @@
 		  "blit_order": [ 33, 40, 35, 42, 16, 32, 39, 0, 1, 2, 3, 4, 31, 18, 38, 19, 34, 24, 41, 25, 5, 30, 37, 14, 10, 11, 12, 13, 17, 21, 22, -1, 27, 28, 29, 15 ],
 		  "creatures_basic": [ 14, 16, 18, 20, 22, 24, 26, 151 ],
 		  "creatures_upgraded": [ 15, 17, 19, 21, 23, 25, 27 ],
+		  "horde": [ 1, 4 ],
 		},
 
 		{
@@ -153,6 +155,7 @@
 		  "blit_order": [ 36, 43, 32, 39, 10, 11, 12, 13, 32, 35, 42, 15, 5, 18, 19 ],
 		  "creatures_basic": [ 28, 30, 32, 34, 36, 38, 40, 152 ],
 		  "creatures_upgraded": [ 29, 31, 33, 35, 37, 39, 41 ],
+		  "horde": [ 1, -1 ],
 		},
 
 		{
@@ -200,6 +203,7 @@
 		  "blit_order": [ 26, 21, 7, 8, 9, 22, 31, 38, 36, 43, 10, 11, 12, 13, 5, 32, 39, 24, 25, 33, 40, 34, 41, 30, 37, 18, 19, 14, 15, 16, 35, 42 ],
 		  "creatures_basic": [ 42, 44, 46, 48, 50, 52, 54, 153 ],
 		  "creatures_upgraded": [ 43, 45, 47, 49, 51, 53, 55 ],
+		  "horde": [ 0, 2 ],
 		},
 
 		{
@@ -251,6 +255,7 @@
 		  "blit_order": [ 17, 0, 1, 2, 3, 4, 7, 8, 9, 32, 39, 26, 15, 14, 34, 41, 16, 5, 33, 40, 31, 38, 6, 30, 18, 37, 19, 22, 20 ]
 		  "creatures_basic": [ 56, 58, 60, 62, 64, 66, 68, 154 ],
 		  "creatures_upgraded": [ 57, 59, 61, 63, 65, 67, 69 ],
+		  "horde": [ 0, -1 ],
 		},
 
 		{
@@ -297,6 +302,7 @@
 		  "blit_order": [ 0, 1, 2, 3, 4, 21, 35, 42, 5, 30, 18, 37, 19, 32, 39, 26, 7, 8, 9, 23 ]
 		  "creatures_basic": [ 70, 72, 74, 76, 78, 80, 82, 155 ],
 		  "creatures_upgraded": [ 71, 73, 75, 77, 79, 81, 83 ],
+		  "horde": [ 0, -1 ],
 		},
 
 		{
@@ -342,6 +348,7 @@
 		  "blit_order": [ 33, 40, 30, 18, 37, 19, 31, 38, 23, 26, 5, 32, 39, 15, 14, 21, 16, 22 ]
 		  "creatures_basic": [ 84, 86, 88, 90, 92, 94, 96, 156 ],
 		  "creatures_upgraded": [ 85, 87, 89, 91, 93, 95, 97 ],
+		  "horde": [ 0, -1 ],
 		},
 
 		{
@@ -389,6 +396,7 @@
 		  "blit_order": [ 16, 15, 14, 34, 41, 31, 38, 10, 11, 12, 13, 29, 0, 1, 2, 33, 40, 30, 18, 37, 19, 5, 36, 43, 26 ]
 		  "creatures_basic": [ 98, 100, 104, 106, 102, 108, 110, 157 ],
 		  "creatures_upgraded": [ 99, 101, 105, 107, 103, 109, 111 ],
+		  "horde": [ 0, -1 ],
 		},
 
 		{
@@ -440,6 +448,7 @@
 		  "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 ],
 		  "creatures_basic": [ 118, 112, 115, 114, 113, 120, 130, 158 ],
 		  "creatures_upgraded": [ 119, 127, 123, 129, 125, 121, 131 ],
+		  "horde": [ 0, -1 ],
 		}
 	],
 

+ 7 - 10
lib/CTownHandler.cpp

@@ -118,6 +118,13 @@ void CTownHandler::loadStructures()
 			level ++;
 		}
 
+		//  Horde building creature level
+		level = 0;
+		BOOST_FOREACH(const JsonNode &node, town_node["horde"].Vector()) {
+			towns[townID].hordeLvl[level] = node.Float();
+			level ++;
+		}
+
 		townID ++;
 	}
 
@@ -165,16 +172,6 @@ void CTownHandler::loadStructures()
 
 	std::ifstream of;
 
-	of.open(DATA_DIR "/config/building_horde.txt");
-	while(!of.eof())
-	{
-		int tid, lid, cid; //town,horde serial,creature level
-		of >> tid >> lid >> cid;
-		towns[tid].hordeLvl[--lid] = cid;
-	}
-	of.close();
-	of.clear();
-
 	of.open(DATA_DIR "/config/mageLevel.txt");
 	of >> si;
 	for(itr=0; itr<si; itr++)