| 884 | } |
| 885 | |
| 886 | static command_result GetGrowthList(color_ostream &stream, const EmptyMessage *in, MaterialList *out) |
| 887 | { |
| 888 | if (!Core::getInstance().isWorldLoaded()) { |
| 889 | //out->set_available(false); |
| 890 | return CR_OK; |
| 891 | } |
| 892 | |
| 893 | |
| 894 | |
| 895 | auto *raws = &world->raws; |
| 896 | if (!raws) |
| 897 | return CR_OK;//'. |
| 898 | |
| 899 | |
| 900 | for (size_t i = 0; i < raws->plants.all.size(); i++) |
| 901 | { |
| 902 | df::plant_raw * pp = raws->plants.all[i]; |
| 903 | if (!pp) |
| 904 | continue; |
| 905 | MaterialDefinition * basePlant = out->add_material_list(); |
| 906 | basePlant->set_id(pp->id + ":BASE"); |
| 907 | basePlant->set_name(DF2UTF(pp->name)); |
| 908 | basePlant->mutable_mat_pair()->set_mat_type(-1); |
| 909 | basePlant->mutable_mat_pair()->set_mat_index(i); |
| 910 | #if DF_VERSION_INT > 40001 |
| 911 | for (size_t g = 0; g < pp->growths.size(); g++) |
| 912 | { |
| 913 | df::plant_growth* growth = pp->growths[g]; |
| 914 | if (!growth) |
| 915 | continue; |
| 916 | for (int l = 0; l < GROWTH_LOCATIONS_SIZE; l++) |
| 917 | { |
| 918 | MaterialDefinition * out_growth = out->add_material_list(); |
| 919 | out_growth->set_id(pp->id + ":" + growth->id + +":" + growth_locations[l]); |
| 920 | out_growth->set_name(DF2UTF(growth->name)); |
| 921 | out_growth->mutable_mat_pair()->set_mat_type(g * 10 + l); |
| 922 | out_growth->mutable_mat_pair()->set_mat_index(i); |
| 923 | } |
| 924 | } |
| 925 | #endif |
| 926 | } |
| 927 | return CR_OK; |
| 928 | } |
| 929 | |
| 930 | void CopyBlock(df::map_block * DfBlock, RemoteFortressReader::MapBlock * NetBlock, MapExtras::MapCache * MC, DFCoord pos) |
| 931 | { |