[mod] Improve test mod.

This commit is contained in:
lzwdgc 2024-04-05 01:17:33 +03:00
parent e1418d1a5c
commit 84c1c29ed6
2 changed files with 16 additions and 1 deletions

View file

@ -263,7 +263,16 @@ int main(int argc, char *argv[]) {
after = mod.add_map_good("location1.mmo", "B_L1_BASE1", after, mmo_storage2::map_good(n));
}
// does not work, crashes. Maybe different item size
// or maybe too many goods
/*for (auto after = "EQP_POLYMER_ARMOR_S1"s; auto &&[n, _] : db["Оборудование"]) {
if (!(false
|| n.contains("_DRIVE_")
|| n.contains("_REACTOR_")
|| n.contains("_ARMOR_")
|| n.contains("_SHIELD_G")
)) {
continue;
}
after = mod.add_map_good("location1.mmo", "B_L1_BASE1", after, mmo_storage2::map_good(n));
}*/
// patch note dev: start money, rating, glider and sector access

View file

@ -332,7 +332,13 @@ struct mod_maker {
::memcpy(f.p + offset, data.data(), data.size());
f.close();
}
std::string add_map_good(path mmo_fn, const std::string &building_name, const std::string &after_good_name, const mmo_storage2::map_good &mg) {
std::string add_map_good(path mmo_fn, const std::string &building_name, const std::string &after_good_name,
const mmo_storage2::map_good &mg) {
log("adding map good to {} after {}: ", building_name, after_good_name, std::string{mg.name});
if (!std::string{mg.cond}.empty()) {
log("cond: {}", std::string{mg.cond});
}
byte_array data((uint8_t*)&mg, (uint8_t*)&mg + sizeof(mg));
add_map_good(mmo_fn, building_name, after_good_name, data);
return mg.name;