From 0a58d1f2cf19a3c9b1f2abbe157ac5798fcaab20 Mon Sep 17 00:00:00 2001 From: Frank Zago Date: Wed, 31 Aug 2011 00:35:04 +0000 Subject: [PATCH] Created town_pictures.json from townPics.txt. --- client/Graphics.cpp | 16 +++++----------- config/townPics.txt | 10 ---------- config/town_pictures.json | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 21 deletions(-) delete mode 100644 config/townPics.txt create mode 100644 config/town_pictures.json diff --git a/client/Graphics.cpp b/client/Graphics.cpp index f41be6bff..bb96d7864 100644 --- a/client/Graphics.cpp +++ b/client/Graphics.cpp @@ -201,19 +201,13 @@ void Graphics::loadPaletteAndColors() playerColors[i].unused = 0; } neutralColor->r = 0x84; neutralColor->g = 0x84; neutralColor->b = 0x84; neutralColor->unused = 0x0;//gray + const JsonNode config(DATA_DIR "/config/town_pictures.json"); + BOOST_FOREACH(const JsonNode &p, config["town_pictures"].Vector()) { - std::ifstream tpics(DATA_DIR "/config/townPics.txt"); - assert(tpics.is_open()); - while(!tpics.eof()) - { - tpics >> pals; - townBgs.push_back(pals); - tpics >> pals; - guildBgs.push_back(pals); - tpics >> pals; - buildingPics.push_back(pals); + townBgs.push_back(p["town_background"].String()); + guildBgs.push_back(p["guild_background"].String()); + buildingPics.push_back(p["building_picture"].String()); } - tpics.close(); } void Graphics::initializeBattleGraphics() diff --git a/config/townPics.txt b/config/townPics.txt deleted file mode 100644 index 1e450275f..000000000 --- a/config/townPics.txt +++ /dev/null @@ -1,10 +0,0 @@ -TBCSBACK.bmp TPMAGECS.bmp HALLCSTL.DEF -TBRMBACK.bmp TPMAGERM.bmp HALLRAMP.DEF -TBTWBACK.bmp TPMAGETW.bmp HALLTOWR.DEF -TBINBACK.bmp TPMAGEIN.bmp HALLINFR.DEF -TBNCBACK.bmp TPMAGENC.bmp HALLNECR.DEF -TBDNBACK.bmp TPMAGEDN.bmp HALLDUNG.DEF -TBSTBACK.bmp TPMAGEST.bmp HALLSTRN.DEF -TBFRBACK.bmp TPMAGEFR.bmp HALLFORT.DEF -TBELBACK.bmp TPMAGEEL.bmp HALLELEM.DEF - diff --git a/config/town_pictures.json b/config/town_pictures.json new file mode 100644 index 000000000..fe07a8361 --- /dev/null +++ b/config/town_pictures.json @@ -0,0 +1,17 @@ +{ + // Some town pictures, ordered by the town number (0 to 8) + // town_background: background inside the town + // guild_background: background inside the mage guild + // building_picture: picture inside the city hall + "town_pictures": [ + { "town_background": "TBCSBACK.bmp", "guild_background": "TPMAGECS.bmp", "building_picture": "HALLCSTL.DEF" }, + { "town_background": "TBRMBACK.bmp", "guild_background": "TPMAGERM.bmp", "building_picture": "HALLRAMP.DEF" }, + { "town_background": "TBTWBACK.bmp", "guild_background": "TPMAGETW.bmp", "building_picture": "HALLTOWR.DEF" }, + { "town_background": "TBINBACK.bmp", "guild_background": "TPMAGEIN.bmp", "building_picture": "HALLINFR.DEF" }, + { "town_background": "TBNCBACK.bmp", "guild_background": "TPMAGENC.bmp", "building_picture": "HALLNECR.DEF" }, + { "town_background": "TBDNBACK.bmp", "guild_background": "TPMAGEDN.bmp", "building_picture": "HALLDUNG.DEF" }, + { "town_background": "TBSTBACK.bmp", "guild_background": "TPMAGEST.bmp", "building_picture": "HALLSTRN.DEF" }, + { "town_background": "TBFRBACK.bmp", "guild_background": "TPMAGEFR.bmp", "building_picture": "HALLFORT.DEF" }, + { "town_background": "TBELBACK.bmp", "guild_background": "TPMAGEEL.bmp", "building_picture": "HALLELEM.DEF" } + ] +}