Fixed compilation warnings and a potential bug in MotionPlanner, as reported in #3054

This commit is contained in:
Alessandro Ranellucci 2015-11-04 20:48:44 +01:00
parent 7c7982d9f3
commit f8d2c69713
7 changed files with 12 additions and 10 deletions

View File

@ -459,6 +459,7 @@ class ConfigOptionEnumGeneric : public ConfigOption
};
enum ConfigOptionType {
coNone,
coFloat,
coFloats,
coInt,
@ -500,7 +501,8 @@ class ConfigOptionDef
std::vector<std::string> enum_labels;
t_config_enum_values enum_keys_map;
ConfigOptionDef() : multiline(false), full_width(false), readonly(false),
ConfigOptionDef() : type(coNone),
multiline(false), full_width(false), readonly(false),
height(-1), width(-1), min(INT_MIN), max(INT_MAX) {};
};

View File

@ -2,7 +2,7 @@
namespace Slic3r {
Extruder::Extruder(int id, GCodeConfig *config)
Extruder::Extruder(unsigned int id, GCodeConfig *config)
: id(id),
config(config)
{

View File

@ -10,7 +10,7 @@ namespace Slic3r {
class Extruder
{
public:
int id;
unsigned int id;
double E;
double absolute_E;
double retracted;
@ -18,7 +18,7 @@ class Extruder
double e_per_mm3;
double retract_speed_mm_min;
Extruder(int id, GCodeConfig *config);
Extruder(unsigned int id, GCodeConfig *config);
virtual ~Extruder() {}
void reset();
double extrude(double dE);

View File

@ -283,7 +283,7 @@ ExtrusionLoop::has_overhang_point(const Point &point) const
if (pos != -1) {
// point belongs to this path
// we consider it overhang only if it's not an endpoint
return (path->is_bridge() && pos > 0 && pos != path->polyline.points.size()-1);
return (path->is_bridge() && pos > 0 && pos != (int)(path->polyline.points.size())-1);
}
}
return false;

View File

@ -73,7 +73,7 @@ MotionPlanner::initialize()
}
ExPolygonCollection
MotionPlanner::get_env(size_t island_idx) const
MotionPlanner::get_env(int island_idx) const
{
if (island_idx == -1) {
return ExPolygonCollection(this->outer);

View File

@ -33,7 +33,7 @@ class MotionPlanner
void initialize();
MotionPlannerGraph* init_graph(int island_idx);
ExPolygonCollection get_env(size_t island_idx) const;
ExPolygonCollection get_env(int island_idx) const;
Point nearest_env_point(const ExPolygonCollection &env, const Point &from, const Point &to) const;
};
@ -42,7 +42,7 @@ class MotionPlannerGraph
friend class MotionPlanner;
private:
typedef size_t node_t;
typedef int node_t;
typedef double weight_t;
struct neighbor {
node_t target;

View File

@ -6,7 +6,7 @@
%}
%name{Slic3r::Extruder} class Extruder {
Extruder(int id, GCodeConfig *config);
Extruder(unsigned int id, GCodeConfig *config);
~Extruder();
void reset();
double extrude(double dE);
@ -16,7 +16,7 @@
double extruded_volume();
double used_filament();
int id()
unsigned int id()
%code%{ RETVAL = THIS->id; %};
double E()