修复bug
This commit is contained in:
@@ -545,9 +545,24 @@ void register_map_graphics_handler() {
|
||||
{drogon::Get, drogon::Post});
|
||||
}
|
||||
Psc::JSON make_map_view_response(Global* global) {
|
||||
auto ret = global->map_view_config.read([](const auto& config) {
|
||||
return config.to_base_json();
|
||||
auto view = global->map_view_config.read([](const auto& config) {
|
||||
return config;
|
||||
});
|
||||
global->map_resources_config.read([&](const auto& config) {
|
||||
const auto first_key = [&](Map_Tile_Type type) {
|
||||
const auto item = std::ranges::find_if(config.tile_sources, [type](const auto& source) {
|
||||
return source.tile_type == type;
|
||||
});
|
||||
return item == config.tile_sources.end() ? std::string{} : item->key;
|
||||
};
|
||||
if(!config.is_imagery_key(view.map2d.current_imagery_key))
|
||||
view.map2d.current_imagery_key = config.current_imagery_key;
|
||||
if(!config.is_imagery_key(view.map3d.current_imagery_key))
|
||||
view.map3d.current_imagery_key = config.current_imagery_key;
|
||||
if(!view.map3d.current_terrain_key.empty() && !config.is_terrain_key(view.map3d.current_terrain_key))
|
||||
view.map3d.current_terrain_key = first_key(Map_Tile_Type::terrain);
|
||||
});
|
||||
auto ret = view.to_base_json();
|
||||
global->map_resources_config.read([&](const auto& config) {
|
||||
ret.append({"current_imagery_key", config.current_imagery_key});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user