MCPcopy Create free account
hub / github.com/DFHack/dfhack / GetPartialPlantRaws

Function GetPartialPlantRaws

plugins/remotefortressreader/remotefortressreader.cpp:2813–2868  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2811}
2812
2813static command_result GetPartialPlantRaws(color_ostream &stream, const ListRequest *in, PlantRawList *out)
2814{
2815 if (!df::global::world)
2816 return CR_FAILURE;
2817
2818 df::world * world = df::global::world;
2819
2820 for (size_t i = 0; i < world->raws.plants.all.size(); i++)
2821 {
2822 df::plant_raw* plant_local = world->raws.plants.all[i];
2823 PlantRaw* plant_remote = out->add_plant_raws();
2824
2825 plant_remote->set_index(i);
2826 plant_remote->set_id(plant_local->id);
2827 plant_remote->set_name(DF2UTF(plant_local->name));
2828 if (!plant_local->flags.is_set(df::plant_raw_flags::TREE))
2829 plant_remote->set_tile(plant_local->tiles.shrub_tile);
2830 else
2831 plant_remote->set_tile(plant_local->tiles.tree_tile);
2832#if DF_VERSION_INT > 34011
2833 for (size_t j = 0; j < plant_local->growths.size(); j++)
2834 {
2835 df::plant_growth* growth_local = plant_local->growths[j];
2836 TreeGrowth * growth_remote = plant_remote->add_growths();
2837 growth_remote->set_index(j);
2838 growth_remote->set_id(growth_local->id);
2839 growth_remote->set_name(DF2UTF(growth_local->name));
2840 for (size_t k = 0; k < growth_local->prints.size(); k++)
2841 {
2842 df::plant_growth_print* print_local = growth_local->prints[k];
2843 GrowthPrint* print_remote = growth_remote->add_prints();
2844 print_remote->set_priority(print_local->priority);
2845 print_remote->set_color(print_local->color[0] | (print_local->color[2] * 8));
2846 print_remote->set_timing_start(print_local->timing_start);
2847 print_remote->set_timing_end(print_local->timing_end);
2848 print_remote->set_tile(print_local->tile_growth);
2849 }
2850 growth_remote->set_timing_start(growth_local->timing_1);
2851 growth_remote->set_timing_end(growth_local->timing_2);
2852 growth_remote->set_twigs(growth_local->locations.bits.twigs);
2853 growth_remote->set_light_branches(growth_local->locations.bits.light_branches);
2854 growth_remote->set_heavy_branches(growth_local->locations.bits.heavy_branches);
2855 growth_remote->set_trunk(growth_local->locations.bits.trunk);
2856 growth_remote->set_roots(growth_local->locations.bits.roots);
2857 growth_remote->set_cap(growth_local->locations.bits.cap);
2858 growth_remote->set_sapling(growth_local->locations.bits.sapling);
2859 growth_remote->set_timing_start(growth_local->timing_1);
2860 growth_remote->set_timing_end(growth_local->timing_2);
2861 growth_remote->set_trunk_height_start(growth_local->trunk_height_perc_1);
2862 growth_remote->set_trunk_height_end(growth_local->trunk_height_perc_2);
2863 CopyMat(growth_remote->mutable_mat(), growth_local->mat_type, growth_local->mat_index);
2864 }
2865#endif
2866 }
2867 return CR_OK;
2868}
2869
2870static command_result CopyScreen(color_ostream &stream, const EmptyMessage *in, ScreenCapture *out)

Callers 1

GetPlantRawsFunction · 0.85

Calls 7

DF2UTFFunction · 0.85
CopyMatFunction · 0.85
is_setMethod · 0.80
set_tileMethod · 0.80
set_priorityMethod · 0.80
sizeMethod · 0.45
set_nameMethod · 0.45

Tested by

no test coverage detected