make --restrict-room floor-specific
This commit is contained in:
+17
-6
@@ -3191,8 +3191,8 @@ Action a_optimize_materialized_map(
|
||||
and parameters). Event count always takes precedence; that is, a map\n\
|
||||
with fewer events is always considered better than any map with more\n\
|
||||
events, regardless of the enemy counts.\n\
|
||||
--restrict-room=ROOM-ID: Ignore all enemies outside of this room (may be\n\
|
||||
given multiple times).\n\
|
||||
--restrict-room=FLOOR:ROOM-ID: Ignore all enemies outside of this room\n\
|
||||
(may be given multiple times).\n\
|
||||
--threads=NUM-THREADS: Limits parallelism; by default, uses one thread\n\
|
||||
per CPU core.\n\
|
||||
--debug: Enables debug logging.\n\
|
||||
@@ -3214,12 +3214,20 @@ Action a_optimize_materialized_map(
|
||||
minimize_types.emplace(std::stoul(arg, nullptr, 0), std::make_pair(0xFF, 0));
|
||||
} else if (tokens.size() == 3) {
|
||||
minimize_types.emplace(std::stoul(tokens[0], nullptr, 0), std::make_pair(std::stoul(tokens[1], nullptr, 0), std::stoul(tokens[2], nullptr, 0)));
|
||||
} else {
|
||||
throw std::runtime_error("invalid vlaue for --minimize");
|
||||
}
|
||||
}
|
||||
|
||||
std::unordered_set<uint16_t> room_ids;
|
||||
std::unordered_set<uint32_t> floor_room_ids; // (floor << 16) | room_id
|
||||
for (const auto& arg : args.get_multi<std::string>("restrict-room")) {
|
||||
room_ids.emplace(std::stoul(arg, nullptr, 0));
|
||||
auto tokens = phosg::split(arg, ':');
|
||||
if (tokens.size() != 2) {
|
||||
throw std::runtime_error("invalid vlaue for --restrict-room");
|
||||
}
|
||||
uint8_t floor = std::stoul(tokens[0], nullptr, 0);
|
||||
uint16_t room_id = std::stoul(tokens[1], nullptr, 0);
|
||||
floor_room_ids.emplace((floor << 16) | room_id);
|
||||
}
|
||||
|
||||
size_t num_threads = args.get<size_t>("threads", 0);
|
||||
@@ -3230,8 +3238,11 @@ Action a_optimize_materialized_map(
|
||||
auto materialized = map_file->materialize_random_sections(seed);
|
||||
|
||||
auto is_minimize_target = [&](const MapFile::EnemySetEntry& ene) -> bool {
|
||||
if (!room_ids.empty() && !room_ids.count(ene.room)) {
|
||||
return false;
|
||||
if (!floor_room_ids.empty()) {
|
||||
uint32_t floor_room_id_key = (ene.floor << 8) | ene.room;
|
||||
if (!floor_room_ids.count(floor_room_id_key)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (minimize_types.empty()) {
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user