2014-12-02 04:06:01 -07:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "modules/Materials.h"
|
|
|
|
|
|
|
|
#include "df/organic_mat_category.h"
|
|
|
|
|
|
|
|
namespace df {
|
2023-03-10 15:08:31 -07:00
|
|
|
struct creature_raw;
|
|
|
|
struct caste_raw;
|
2014-12-02 04:06:01 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Helper class for mapping the various organic mats between their material indices
|
|
|
|
* and their index in the stockpile_settings structures.
|
|
|
|
*/
|
2023-03-10 15:08:31 -07:00
|
|
|
class OrganicMatLookup {
|
2014-12-02 04:06:01 -07:00
|
|
|
|
2023-03-10 15:08:31 -07:00
|
|
|
// pair of material type and index
|
2014-12-02 04:06:01 -07:00
|
|
|
typedef std::pair<int16_t, int32_t> FoodMatPair;
|
2023-03-10 15:08:31 -07:00
|
|
|
// map for using type,index pairs to find the food index
|
2014-12-02 04:06:01 -07:00
|
|
|
typedef std::map<FoodMatPair, size_t> FoodMatMap;
|
|
|
|
|
|
|
|
public:
|
2023-03-10 15:08:31 -07:00
|
|
|
struct FoodMat {
|
2014-12-02 04:06:01 -07:00
|
|
|
DFHack::MaterialInfo material;
|
2023-03-10 15:08:31 -07:00
|
|
|
df::creature_raw* creature;
|
|
|
|
df::caste_raw* caste;
|
|
|
|
FoodMat(): material(-1), creature(0), caste(0) { }
|
2014-12-02 04:06:01 -07:00
|
|
|
};
|
|
|
|
|
2023-05-04 02:29:07 -06:00
|
|
|
static void food_mat_by_idx(DFHack::color_ostream& out, df::enums::organic_mat_category::organic_mat_category mat_category, std::vector<int16_t>::size_type food_idx, FoodMat& food_mat);
|
|
|
|
static std::string food_token_by_idx(DFHack::color_ostream& out, df::enums::organic_mat_category::organic_mat_category mat_category, std::vector<int16_t>::size_type idx);
|
2014-12-02 04:06:01 -07:00
|
|
|
|
2023-03-10 15:08:31 -07:00
|
|
|
static size_t food_max_size(df::enums::organic_mat_category::organic_mat_category mat_category);
|
|
|
|
static void food_build_map();
|
2014-12-02 04:06:01 -07:00
|
|
|
|
2023-05-04 02:29:07 -06:00
|
|
|
static int16_t food_idx_by_token(DFHack::color_ostream& out, df::enums::organic_mat_category::organic_mat_category mat_category, const std::string& token);
|
2023-03-10 15:08:31 -07:00
|
|
|
|
|
|
|
static DFHack::MaterialInfo food_mat_by_token(const std::string& token);
|
2014-12-02 04:06:01 -07:00
|
|
|
|
|
|
|
static bool index_built;
|
|
|
|
static std::vector<FoodMatMap> food_index;
|
2023-03-10 15:08:31 -07:00
|
|
|
|
2014-12-02 04:06:01 -07:00
|
|
|
private:
|
|
|
|
OrganicMatLookup();
|
|
|
|
};
|