Browse Source

Created obstacles.json from obstacles.txt.

Frank Zago 14 years ago
parent
commit
3cb92baf18
3 changed files with 125 additions and 132 deletions
  1. 113 0
      config/obstacles.json
  2. 0 105
      config/obstacles.txt
  3. 12 27
      lib/CHeroHandler.cpp

+ 113 - 0
config/obstacles.json

@@ -0,0 +1,113 @@
+{
+	// Battle obstacles
+	// id:
+	// defname: graphics
+	// blockmap: X - blocked, N - not blocked, L - description goes to the next line, starting with the left bottom hex
+	// terrains: bitmap of allowed terrains - 
+	// 			 		1. sand/shore   2. sand/mesas   3. dirt/birches   4. dirt/hills   5. dirt/pines   6. grass/hills   
+	//					7. grass/pines   8. lava   9. magic plains   10. snow/mountains   11. snow/trees   12. subterranean
+	//					13. swamp/trees  14. fiery fields   15. rock lands   16. magic clouds   17. lucid pools
+	//					18. holy ground   19. clover field  20. evil fog   21. "favourable winds" text on magic plains background
+	// 					22. cursed ground   23. rough  24. ship to ship   25. ship
+	// shift_x, shift_y: shift of obstacle's position in the battlefield <x shift, y shift>,
+	// 					eg. if it's <-1, 2> obstacle will be printed one pixel to the left and two to the bottom]
+
+	"obstacles": [
+		{ "id": 5, "defname": "OBBDT01.DEF", "blockmap": "LNXXX", "terrains": "1111110000000000000000100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 56, "defname": "OBBHS02.DEF", "blockmap": "XXLNX", "terrains": "1100000000000000000000100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 57, "defname": "OBBHS03.DEF", "blockmap": "LXXX", "terrains": "1111100000000000000000100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 91, "defname": "OBBHS04.DEF", "blockmap": "XXLNXX", "terrains": "1100000000000000000000000", "shift_x": -40, "shift_y": -20 },
+		{ "id": 58, "defname": "OBBHS11A.DEF", "blockmap": "XXXLNXXX", "terrains": "100000000000000000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 59, "defname": "OBBHS12B.DEF", "blockmap": "NXXLNXX", "terrains": "1100000000000000000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 60, "defname": "OBBHS14B.DEF", "blockmap": "NXLNXX", "terrains": "1111100000000000000000100", "shift_x": 36, "shift_y": 0 },
+		{ "id": 92, "defname": "OBBHS16A.DEF", "blockmap": "XLNXX", "terrains": "1100000000000000000000000", "shift_x": -8, "shift_y": -28 },
+		{ "id": 55, "defname": "OBBTS04.DEF", "blockmap": "XLXX", "terrains": "0000000000000000000000011", "shift_x": -30, "shift_y": -1 },
+		{ "id": 71, "defname": "OBCFS00.DEF", "blockmap": "X", "terrains": "0000000000000000001000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 72, "defname": "OBCFS01.DEF", "blockmap": "XX", "terrains": "0000000000000000001000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 73, "defname": "OBCFS02.DEF", "blockmap": "XXLNXX", "terrains": "0000000000000000001000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 74, "defname": "OBCFS03.DEF", "blockmap": "NXXLNXX", "terrains": "0000000000000000001000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 0, "defname": "OBDINO1.DEF", "blockmap": "XX", "terrains": "1111110000000000000000100", "shift_x": 14, "shift_y": 0 },
+		{ "id": 2, "defname": "OBDINO2.DEF", "blockmap": "LXXX", "terrains": "1111110000000000000000100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 1, "defname": "OBDINO3.DEF", "blockmap": "XXXLXX", "terrains": "1111110000000000000000100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 6, "defname": "OBDRK01.DEF", "blockmap": "XX", "terrains": "1111110000000000000000100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 7, "defname": "OBDRK02.DEF", "blockmap": "LXX", "terrains": "1111110000000000000000100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 8, "defname": "OBDRK03.DEF", "blockmap": "X", "terrains": "1111110000000000000000100", "shift_x": -8, "shift_y": -8 },
+		{ "id": 9, "defname": "OBDRK04.DEF", "blockmap": "LXX", "terrains": "1111110000000000000000100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 10, "defname": "OBDSH01.DEF", "blockmap": "LXX", "terrains": "1111110000000000000000100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 93, "defname": "OBDSM01.DEF", "blockmap": "NNXXXLNNXXXLNNXX", "terrains": "00000000000000000000000", "shift_x": 36, "shift_y": 0 },
+		{ "id": 17, "defname": "OBDSM02.DEF", "blockmap": "XXLNX", "terrains": "1111100000000000000000100", "shift_x": -9, "shift_y": -2 },
+		{ "id": 18, "defname": "OBDSS17.DEF", "blockmap": "XXLNXXX", "terrains": "1111100000000000000000100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 11, "defname": "OBDTF03.DEF", "blockmap": "XX", "terrains": "1111100000000000000001100", "shift_x": 14, "shift_y": 0 },
+		{ "id": 12, "defname": "OBDTS03.DEF", "blockmap": "LLNXXXX", "terrains": "1111100000000000000001100", "shift_x": 14, "shift_y": 0 },
+		{ "id": 13, "defname": "OBDTS04.DEF", "blockmap": "LNXX", "terrains": "1111100000000000000001100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 14, "defname": "OBDTS14.DEF", "blockmap": "XXLNNX", "terrains": "1111100000000000000001100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 15, "defname": "OBDTS15.DEF", "blockmap": "XLXLNX", "terrains": "1111100000000000000001100", "shift_x": -30, "shift_y": 0 },
+		{ "id": 66, "defname": "OBEFS00.DEF", "blockmap": "X", "terrains": "0000000000000000000100000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 67, "defname": "OBEFS01.DEF", "blockmap": "XX", "terrains": "0000000000000000000100000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 68, "defname": "OBEFS02.DEF", "blockmap": "NXLXXX", "terrains": "0000000000000000000100000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 69, "defname": "OBEFS03.DEF", "blockmap": "LNXX", "terrains": "0000000000000000000100000", "shift_x": 0, "shift_y": 0 },
+		{ "id": 70, "defname": "OBEFS04.DEF", "blockmap": "NNXXXLNXXX", "terrains": "000000000000000000100000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 79, "defname": "OBFFS00.DEF", "blockmap": "X", "terrains": "0000000000000100000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 80, "defname": "OBFFS01.DEF", "blockmap": "XX", "terrains": "0000000000000100000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 81, "defname": "OBFFS02.DEF", "blockmap": "NXLXXX", "terrains": "0000000000000100000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 82, "defname": "OBFFS03.DEF", "blockmap": "XXLNXXX", "terrains": "0000000000000100000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 83, "defname": "OBFFS04.DEF", "blockmap": "XXXLXXXX", "terrains": "000000000000100000000000", "shift_x": -8, "shift_y": -42 },
+		{ "id": 19, "defname": "OBGLG01.DEF", "blockmap": "XX", "terrains": "0000000000001000000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 94, "defname": "OBGRK01.DEF", "blockmap": "XX", "terrains": "0000000000001000000000000", "shift_x": 14, "shift_y": -42 },
+		{ "id": 23, "defname": "OBGRK02.DEF", "blockmap": "XX", "terrains": "0000000000001000000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 20, "defname": "OBGRS02.DEF", "blockmap": "NXX", "terrains": "0000000000001000000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 22, "defname": "OBGRS01.DEF", "blockmap": "XXXXLNXXXX", "terrains": "000011010001000000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 35, "defname": "OBGRS03.DEF", "blockmap": "XXXXXXX", "terrains": "1111111010000000000000100", "shift_x": 0, "shift_y": 0 },
+		{ "id": 21, "defname": "OBGST01.DEF", "blockmap": "X", "terrains": "1111111010000000000000100", "shift_x": 14, "shift_y": 0 },
+		{ "id": 61, "defname": "OBHGS00.DEF", "blockmap": "X", "terrains": "0000000000000000010000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 62, "defname": "OBHGS01.DEF", "blockmap": "XX", "terrains": "0000000000000000010000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 63, "defname": "OBHGS02.DEF", "blockmap": "X", "terrains": "0000000000000000010000000", "shift_x": -30, "shift_y": -84 },
+		{ "id": 64, "defname": "OBHGS03.DEF", "blockmap": "XXX", "terrains": "0000000000000000010000000", "shift_x": 14, "shift_y": -42 },
+		{ "id": 65, "defname": "OBHGS04.DEF", "blockmap": "XXXX", "terrains": "0000000000000000010000000", "shift_x": 14, "shift_y": -84 },
+		{ "id": 75, "defname": "OBLPS00.DEF", "blockmap": "X", "terrains": "0000000000000000100000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 76, "defname": "OBLPS01.DEF", "blockmap": "XX", "terrains": "0000000000000000100000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 77, "defname": "OBLPS02.DEF", "blockmap": "NXXLNX", "terrains": "0000000000000000100000000", "shift_x": 36, "shift_y": 0 },
+		{ "id": 78, "defname": "OBLPS03.DEF", "blockmap": "XXXXLNXXXX", "terrains": "000000000000000100000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 48, "defname": "OBLVS01.DEF", "blockmap": "XXLNNX", "terrains": "0000000100000000000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 49, "defname": "OBLVS02.DEF", "blockmap": "XXXLXXX", "terrains": "0000000100000000000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 50, "defname": "OBLVS03.DEF", "blockmap": "XXXXLNXXX", "terrains": "000000100000000000000000", "shift_x": -30, "shift_y": 0 },
+		{ "id": 51, "defname": "OBLVS04.DEF", "blockmap": "XXX", "terrains": "0000000100000000000000000", "shift_x": 14, "shift_y": -42 },
+		{ "id": 52, "defname": "OBLVS09.DEF", "blockmap": "XXLNXXLNNXX", "terrains": "000000100000000000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 53, "defname": "OBLVS17.DEF", "blockmap": "NNXLXXXX", "terrains": "000000100000000000000000", "shift_x": -30, "shift_y": 0 },
+		{ "id": 54, "defname": "OBLVS22.DEF", "blockmap": "XXXLXXXX", "terrains": "000000100000000000000000", "shift_x": -30, "shift_y": 0 },
+		{ "id": 88, "defname": "OBMCS00.DEF", "blockmap": "X", "terrains": "0000000000000001000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 89, "defname": "OBMCS01.DEF", "blockmap": "XLNX", "terrains": "0000000000000001000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 90, "defname": "OBMCS02.DEF", "blockmap": "NXXLXX", "terrains": "0000000000000001000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 41, "defname": "OBRGS01.DEF", "blockmap": "XLXX", "terrains": "1111100000000000000001100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 40, "defname": "OBRGS02.DEF", "blockmap": "NXXLNXXX", "terrains": "111100000000000000001100", "shift_x": 14, "shift_y": 0 },
+		{ "id": 42, "defname": "OBRGS03.DEF", "blockmap": "XXLNX", "terrains": "1111100000000000000001100", "shift_x": -8, "shift_y": 0 },
+		{ "id": 43, "defname": "OBRGS04.DEF", "blockmap": "XXLX", "terrains": "1111100000000000000001100", "shift_x": -30, "shift_y": 0 },
+		{ "id": 44, "defname": "OBRGS05.DEF", "blockmap": "NXLXX", "terrains": "1111100000000000000001100", "shift_x": -30, "shift_y": 0 },
+		{ "id": 16, "defname": "OBRGS06.DEF", "blockmap": "NXXXXXXLNNNNNNNXLNNNNNNNNX", "terrains": "11100000000000000001100", "shift_x": -30, "shift_y": -30 },
+		{ "id": 84, "defname": "OBRLS00.DEF", "blockmap": "X", "terrains": "0000000000000010000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 85, "defname": "OBRLS01.DEF", "blockmap": "XX", "terrains": "0000000000000010000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 86, "defname": "OBRLS02.DEF", "blockmap": "XXX", "terrains": "0000000000000010000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 87, "defname": "OBRLS03.DEF", "blockmap": "XLNXX", "terrains": "0000000000000010000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 4, "defname": "OBSKEL1.DEF", "blockmap": "XX", "terrains": "1111110000000000000001100", "shift_x": 14, "shift_y": 0 },
+		{ "id": 3, "defname": "OBSKEL2.DEF", "blockmap": "XX", "terrains": "1111110000000000000001100", "shift_x": 14, "shift_y": 0 },
+		{ "id": 24, "defname": "OBSNS01.DEF", "blockmap": "XXX", "terrains": "0000000001100000000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 25, "defname": "OBSNS02.DEF", "blockmap": "NXXXX", "terrains": "0000000001100000000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 26, "defname": "OBSNS03.DEF", "blockmap": "XLXLX", "terrains": "0000000001100000000000000", "shift_x": -30, "shift_y": 0 },
+		{ "id": 27, "defname": "OBSNS04.DEF", "blockmap": "XXX", "terrains": "0000000001100000000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 28, "defname": "OBSNS05.DEF", "blockmap": "X", "terrains": "0000000001100000000000000", "shift_x": -30, "shift_y": 0 },
+		{ "id": 29, "defname": "OBSNS06.DEF", "blockmap": "LNXX", "terrains": "0000000001100000000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 30, "defname": "OBSNS07.DEF", "blockmap": "XX", "terrains": "0000000001100000000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 31, "defname": "OBSNS08.DEF", "blockmap": "LNXXX", "terrains": "0000000001100000000000000", "shift_x": 36, "shift_y": 0 },
+		{ "id": 32, "defname": "OBSNS09.DEF", "blockmap": "XXXXLNNXXXX", "terrains": "000000001100000000000000", "shift_x": -8, "shift_y": 0 },
+		{ "id": 33, "defname": "OBSNS10.DEF", "blockmap": "XXLNXLNXXLNNXXX", "terrains": "000000001100000000000000", "shift_x": -30, "shift_y": -30 },
+		{ "id": 45, "defname": "OBSUS01.DEF", "blockmap": "XXLXXX", "terrains": "0000000000010000000000000", "shift_x": -8, "shift_y": -42 },
+		{ "id": 46, "defname": "OBSUS02.DEF", "blockmap": "XXX", "terrains": "0000000000010000000000000", "shift_x": 14, "shift_y": -42 },
+		{ "id": 47, "defname": "OBSUS11B.DEF", "blockmap": "XXXLXXXX", "terrains": "000000000010000000000000", "shift_x": -9, "shift_y": -43 },
+		{ "id": 34, "defname": "OBSWS01.DEF", "blockmap": "LNX", "terrains": "0000000000001000000000000", "shift_x": 36, "shift_y": 0 },
+		{ "id": 95, "defname": "OBSWS02.DEF", "blockmap": "XXXXXXX", "terrains": "0000000000001000000000000", "shift_x": -8, "shift_y": -42 },
+		{ "id": 36, "defname": "OBSWS03.DEF", "blockmap": "XX", "terrains": "0000000000001000000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 37, "defname": "OBSWS04.DEF", "blockmap": "XXX", "terrains": "0000000000001000000000000", "shift_x": 14, "shift_y": 0 },
+		{ "id": 38, "defname": "OBSWS11B.DEF", "blockmap": "XXXXLXXXX", "terrains": "000000000001000000000000", "shift_x": -30, "shift_y": -40 },
+		{ "id": 39, "defname": "OBSWS13A.DEF", "blockmap": "XXXXLXX", "terrains": "0000000000001000000000000", "shift_x": 14, "shift_y": 0 }
+	]
+}

+ 0 - 105
config/obstacles.txt

@@ -1,105 +0,0 @@
-BATTLE OBSTACLES
-[id] [Def name] [blockmap] [allowed terrins] [two numbers: shift of obstacle's position in the battlefield <x shift, y shift>, eg. if it's <-1, 2> obstacle will be printed one pixel to the left and two to the bottom]
-{terrains: 1. sand/shore   2. sand/mesas   3. dirt/birches   4. dirt/hills   5. dirt/pines   6. grass/hills   
-7. grass/pines   8. lava   9. magic plains   10. snow/mountains   11. snow/trees   12. subterranean   13. swamp/trees  
- 14. fiery fields   15. rock lands   16. magic clouds   17. lucid pools   18. holy ground   19. clover field  
-  20. evil fog   21. "favourable winds" text on magic plains background   22. cursed ground   23. rough 
-    24. ship to ship   25. ship}
-{blockmap: X - blocked, N - not blocked, L - description goes to the next line, staring with the left bottom hex }
-5	OBBDT01.DEF	LNXXX			1111110000000000000000100	-8	0
-56	OBBHS02.DEF	XXLNX			1100000000000000000000100	-8	0
-57	OBBHS03.DEF	LXXX			1111100000000000000000100	-8	0
-91	OBBHS04.DEF	XXLNXX			1100000000000000000000000	-40	-20
-58	OBBHS11A.DEF	XXXLNXXX		1100000000000000000000000	-8	0
-59	OBBHS12B.DEF	NXXLNXX			1100000000000000000000000	-8	0
-60	OBBHS14B.DEF	NXLNXX			1111100000000000000000100	36	0
-92	OBBHS16A.DEF	XLNXX			1100000000000000000000000	-8	-28
-55	OBBTS04.DEF	XLXX			0000000000000000000000011	-30	-1
-71	OBCFS00.DEF	X			0000000000000000001000000	14	0
-72	OBCFS01.DEF	XX			0000000000000000001000000	14	0
-73	OBCFS02.DEF	XXLNXX			0000000000000000001000000	-8	0
-74	OBCFS03.DEF	NXXLNXX			0000000000000000001000000	-8	0
-0	OBDINO1.DEF	XX			1111110000000000000000100	14	0
-2	OBDINO2.DEF	LXXX			1111110000000000000000100	-8	0
-1	OBDINO3.DEF	XXXLXX			1111110000000000000000100	-8	0
-6	OBDRK01.DEF	XX			1111110000000000000000100	-8	0
-7	OBDRK02.DEF	LXX			1111110000000000000000100	-8	0
-8	OBDRK03.DEF	X			1111110000000000000000100	-8	-8
-9	OBDRK04.DEF	LXX			1111110000000000000000100	-8	0
-10	OBDSH01.DEF	LXX			1111110000000000000000100	-8	0
-93	OBDSM01.DEF	NNXXXLNNXXXLNNXX	1100000000000000000000000	36	0
-17	OBDSM02.DEF	XXLNX			1111100000000000000000100	-9	-2
-18	OBDSS17.DEF	XXLNXXX			1111100000000000000000100	-8	0
-11	OBDTF03.DEF	XX			1111100000000000000001100	14	0
-12	OBDTS03.DEF	LLNXXXX			1111100000000000000001100	14	0
-13	OBDTS04.DEF	LNXX			1111100000000000000001100	-8	0
-14	OBDTS14.DEF	XXLNNX			1111100000000000000001100	-8	0
-15	OBDTS15.DEF	XLXLNX			1111100000000000000001100	-30	0
-66	OBEFS00.DEF	X			0000000000000000000100000	14	0
-67	OBEFS01.DEF	XX			0000000000000000000100000	14	0
-68	OBEFS02.DEF	NXLXXX			0000000000000000000100000	-8	0
-69	OBEFS03.DEF	LNXX			0000000000000000000100000	0	0
-70	OBEFS04.DEF	NNXXXLNXXX		0000000000000000000100000	-8	0
-79	OBFFS00.DEF	X			0000000000000100000000000	14	0
-80	OBFFS01.DEF	XX			0000000000000100000000000	14	0
-81	OBFFS02.DEF	NXLXXX			0000000000000100000000000	-8	0
-82	OBFFS03.DEF	XXLNXXX			0000000000000100000000000	-8	0
-83	OBFFS04.DEF	XXXLXXXX		0000000000000100000000000	-8	-42
-19	OBGLG01.DEF	XX			0000000000001000000000000	-8	0
-94	OBGRK01.DEF	XX			0000000000001000000000000	14	-42
-23	OBGRK02.DEF	XX			0000000000001000000000000	14	0
-20	OBGRS02.DEF	NXX			0000000000001000000000000	14	0
-22	OBGRS01.DEF	XXXXLNXXXX		0000011010001000000000000	-8	0
-35	OBGRS03.DEF	XXXXXXX			1111111010000000000000100	0	0
-21	OBGST01.DEF	X			1111111010000000000000100	14	0
-61	OBHGS00.DEF	X			0000000000000000010000000	14	0
-62	OBHGS01.DEF	XX			0000000000000000010000000	14	0
-63	OBHGS02.DEF	X			0000000000000000010000000	-30	-84
-64	OBHGS03.DEF	XXX			0000000000000000010000000	14	-42
-65	OBHGS04.DEF	XXXX			0000000000000000010000000	14	-84
-75	OBLPS00.DEF	X			0000000000000000100000000	14	0
-76	OBLPS01.DEF	XX			0000000000000000100000000	14	0
-77	OBLPS02.DEF	NXXLNX			0000000000000000100000000	36	0
-78	OBLPS03.DEF	XXXXLNXXXX		0000000000000000100000000	-8	0
-48	OBLVS01.DEF	XXLNNX			0000000100000000000000000	-8	0
-49	OBLVS02.DEF	XXXLXXX			0000000100000000000000000	-8	0
-50	OBLVS03.DEF	XXXXLNXXX		0000000100000000000000000	-30	0
-51	OBLVS04.DEF	XXX			0000000100000000000000000	14	-42
-52	OBLVS09.DEF	XXLNXXLNNXX		0000000100000000000000000	-8	0
-53	OBLVS17.DEF	NNXLXXXX		0000000100000000000000000	-30	0
-54	OBLVS22.DEF	XXXLXXXX		0000000100000000000000000	-30	0
-88	OBMCS00.DEF	X			0000000000000001000000000	14	0
-89	OBMCS01.DEF	XLNX			0000000000000001000000000	-8	0
-90	OBMCS02.DEF	NXXLXX			0000000000000001000000000	-8	0
-41	OBRGS01.DEF	XLXX			1111100000000000000001100	-8	0
-40	OBRGS02.DEF	NXXLNXXX		1111100000000000000001100	14	0
-42	OBRGS03.DEF	XXLNX			1111100000000000000001100	-8	0
-43	OBRGS04.DEF	XXLX			1111100000000000000001100	-30	0
-44	OBRGS05.DEF	NXLXX			1111100000000000000001100	-30	0
-16	OBRGS06.DEF NXXXXXXLNNNNNNNXLNNNNNNNNX	1111100000000000000001100	-30	-30
-84	OBRLS00.DEF	X			0000000000000010000000000	14	0
-85	OBRLS01.DEF	XX			0000000000000010000000000	14	0
-86	OBRLS02.DEF	XXX			0000000000000010000000000	14	0
-87	OBRLS03.DEF	XLNXX			0000000000000010000000000	-8	0
-4	OBSKEL1.DEF	XX			1111110000000000000001100	14	0
-3	OBSKEL2.DEF	XX			1111110000000000000001100	14	0
-24	OBSNS01.DEF	XXX			0000000001100000000000000	14	0
-25	OBSNS02.DEF	NXXXX			0000000001100000000000000	14	0
-26	OBSNS03.DEF	XLXLX			0000000001100000000000000	-30	0
-27	OBSNS04.DEF	XXX			0000000001100000000000000	14	0
-28	OBSNS05.DEF	X			0000000001100000000000000	-30	0
-29	OBSNS06.DEF	LNXX			0000000001100000000000000	-8	0
-30	OBSNS07.DEF	XX			0000000001100000000000000	14	0
-31	OBSNS08.DEF	LNXXX			0000000001100000000000000	36	0
-32	OBSNS09.DEF	XXXXLNNXXXX		0000000001100000000000000	-8	0
-33	OBSNS10.DEF	XXLNXLNXXLNNXXX		0000000001100000000000000	-30	-30
-45	OBSUS01.DEF	XXLXXX			0000000000010000000000000	-8	-42
-46	OBSUS02.DEF	XXX			0000000000010000000000000	14	-42
-47	OBSUS11B.DEF	XXXLXXXX		0000000000010000000000000	-9	-43
-34	OBSWS01.DEF	LNX			0000000000001000000000000	36	0
-95	OBSWS02.DEF	XXXXXXX			0000000000001000000000000	-8	-42
-36	OBSWS03.DEF	XX			0000000000001000000000000	14	0
-37	OBSWS04.DEF	XXX			0000000000001000000000000	14	0
-38	OBSWS11B.DEF	XXXXLXXXX		0000000000001000000000000	-30	-40
-39	OBSWS13A.DEF	XXXXLXX			0000000000001000000000000	14	0
--1

+ 12 - 27
lib/CHeroHandler.cpp

@@ -144,34 +144,19 @@ CHeroHandler::CHeroHandler()
 
 void CHeroHandler::loadObstacles()
 {
-	std::ifstream inp;
-	inp.open(DATA_DIR "/config/obstacles.txt", std::ios_base::in|std::ios_base::binary);
-	if(!inp.is_open())
-	{
-		tlog1<<"missing file: config/obstacles.txt"<<std::endl;
-	}
-	else
-	{
-		const int MAX_DUMP = 10000;
-		char dump[MAX_DUMP+1];
+	const JsonNode config(DATA_DIR "/config/obstacles.json");
 
-		for(int i=0; i<8; ++i)
-		{
-			inp.getline(dump, MAX_DUMP);
-		}
-		while(true)
-		{
-			CObstacleInfo obi;
-			inp>>obi.ID;
-			if(obi.ID == -1) break;
-			inp>>obi.defName;
-			inp>>obi.blockmap;
-			inp>>obi.allowedTerrains;
-			inp>>obi.posShift.first;
-			inp>>obi.posShift.second;
-			obstacles[obi.ID] = obi;
-		}
-		inp.close();
+	BOOST_FOREACH(const JsonNode &obs, config["obstacles"].Vector()) {
+		CObstacleInfo obi;
+
+		obi.ID = obs["id"].Float();
+		obi.defName = obs["defname"].String();
+		obi.blockmap = obs["blockmap"].String();
+		obi.allowedTerrains = obs["terrains"].String();
+		obi.posShift.first = obs["shift_x"].Float();
+		obi.posShift.second = obs["shift_y"].Float();
+
+		obstacles[obi.ID] = obi;
 	}
 }