void Item_factory::load_item_templates(){ load_item_templates_from("data/raw/items/melee.json"); load_item_templates_from("data/raw/items/ranged.json"); load_item_templates_from("data/raw/items/ammo.json"); load_item_templates_from("data/raw/items/mods.json"); load_item_templates_from("data/raw/items/tools.json"); load_item_templates_from("data/raw/items/comestibles.json"); load_item_templates_from("data/raw/items/armor.json"); load_item_templates_from("data/raw/items/books.json"); load_item_groups_from("data/raw/item_groups.json"); }
void Item_factory::load_item_templates() throw(std::string){ try { load_item_templates_from("data/raw/items/melee.json"); load_item_templates_from("data/raw/items/ranged.json"); load_item_templates_from("data/raw/items/ammo.json"); load_item_templates_from("data/raw/items/mods.json"); load_item_templates_from("data/raw/items/tools.json"); load_item_templates_from("data/raw/items/containers.json"); load_item_templates_from("data/raw/items/comestibles.json"); load_item_templates_from("data/raw/items/armor.json"); load_item_templates_from("data/raw/items/books.json"); load_item_templates_from("data/raw/items/archery.json"); load_item_groups_from("data/raw/item_groups.json"); } catch (std::string &error_message) { throw; } }
//Will eventually be deprecated - Loads existing item format into the item factory, and vice versa void Item_factory::init(game* main_game) throw(std::string){ try { load_item_templates(); // this one HAS to be called after game is created } catch (std::string &error_message) { throw; } // Make a copy of our items loaded from JSON std::map<Item_tag, itype*> new_templates = m_templates; //Copy the hardcoded template pointers to the factory list m_templates.insert(main_game->itypes.begin(), main_game->itypes.end()); //Copy the JSON-derived items to the legacy list main_game->itypes.insert(new_templates.begin(), new_templates.end()); //And add them to the various item lists, as needed. for(std::map<Item_tag, itype*>::iterator iter = new_templates.begin(); iter != new_templates.end(); ++iter) { standard_itype_ids.push_back(iter->first); } load_item_groups_from(main_game, "data/raw/item_groups.json"); }
void Item_factory::load_item_templates(){ load_item_templates_from("data/raw/items/instruments.json"); load_item_templates_from("data/raw/items/melee.json"); load_item_groups_from("data/raw/item_groups.json"); }