diff --git a/src/libslic3r/GCode/ToolOrdering.cpp b/src/libslic3r/GCode/ToolOrdering.cpp index 9dec86c42..cad3ba67a 100644 --- a/src/libslic3r/GCode/ToolOrdering.cpp +++ b/src/libslic3r/GCode/ToolOrdering.cpp @@ -143,14 +143,14 @@ static double calc_max_layer_height(const PrintConfig &config, double max_object } //calculate the flush weight (first value) and filament change count(second value) -static FilamentChangeStats calc_filament_change_info_by_toolorder(const PrintConfig* config,const std::vector&filament_map,const std::vector&flush_matrix,const std::vector>&layer_sequences) +static FilamentChangeStats calc_filament_change_info_by_toolorder(const PrintConfig* config, const std::vector& filament_map, const std::vector& flush_matrix, const std::vector>& layer_sequences) { FilamentChangeStats ret; - std::map flush_volume_per_filament; + std::unordered_map flush_volume_per_filament; std::vectorlast_filament_per_extruder(2, -1); int total_filament_change_count = 0; - int total_filament_flush_weight = 0; + float total_filament_flush_weight = 0; for (const auto& ls : layer_sequences) { for (const auto& item : ls) { int extruder_id = filament_map[item]; @@ -165,12 +165,12 @@ static FilamentChangeStats calc_filament_change_info_by_toolorder(const PrintCon } for (auto& fv : flush_volume_per_filament) { - int weight = config->filament_density.get_at(fv.first) * 0.001 * fv.second; + float weight = config->filament_density.get_at(fv.first) * 0.001 * fv.second; total_filament_flush_weight += weight; } ret.filament_change_count = total_filament_change_count; - ret.filament_flush_weight = total_filament_flush_weight; + ret.filament_flush_weight = (int)total_filament_flush_weight; return ret; }