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

Function get_place_keys

plugins/blueprint.cpp:1096–1185  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1094}
1095
1096static void get_place_keys(color_ostream &out, ostringstream &keys, df::building_stockpilest* sp, bool add_label, bool add_properties) {
1097 df::stockpile_group_set &flags = sp->settings.flags;
1098 if (flags.bits.animals) keys << 'a';
1099 if (flags.bits.food) keys << 'f';
1100 if (flags.bits.furniture) keys << 'u';
1101 if (flags.bits.coins) keys << 'n';
1102 if (flags.bits.corpses) keys << 'y';
1103 if (flags.bits.refuse) keys << 'r';
1104 if (flags.bits.stone) keys << 's';
1105 if (flags.bits.wood) keys << 'w';
1106 if (flags.bits.gems) keys << 'e';
1107 if (flags.bits.bars_blocks) keys << 'b';
1108 if (flags.bits.cloth) keys << 'h';
1109 if (flags.bits.leather) keys << 'l';
1110 if (flags.bits.ammo) keys << 'z';
1111 if (flags.bits.sheet) keys << 'S';
1112 if (flags.bits.finished_goods) keys << 'g';
1113 if (flags.bits.weapons) keys << 'p';
1114 if (flags.bits.armor) keys << 'd';
1115
1116 if (keys.str().empty())
1117 keys << 'c';
1118
1119 if (!add_label && !add_properties)
1120 return;
1121
1122 if (add_label)
1123 keys << "/" << "sp_" << sp->id;
1124
1125 if (!add_properties)
1126 return;
1127
1128 vector<string> properties;
1129
1130 if (!sp->name.empty())
1131 properties.push_back("name=" + quotify_inner(sp->name));
1132
1133 // only include take_from and give_to targets if they are named
1134 vector<string> take_from, give_to;
1135 for (auto & target : sp->links.take_from_pile) {
1136 if (target->name.empty())
1137 continue;
1138 take_from.push_back(target->name);
1139 }
1140 for (auto & target : sp->links.take_from_workshop) {
1141 if (target->name.empty())
1142 continue;
1143 take_from.push_back(target->name);
1144 }
1145 for (auto & target : sp->links.give_to_pile) {
1146 if (target->name.empty())
1147 continue;
1148 give_to.push_back(target->name);
1149 }
1150 for (auto & target : sp->links.give_to_workshop) {
1151 if (target->name.empty())
1152 continue;
1153 give_to.push_back(target->name);

Callers 1

get_tile_placeFunction · 0.85

Calls 7

quotify_innerFunction · 0.85
int_to_stringFunction · 0.85
CallLuaModuleFunctionFunction · 0.85
lua_tobooleanFunction · 0.85
join_stringsFunction · 0.50
emptyMethod · 0.45
strMethod · 0.45

Tested by

no test coverage detected