Skip to content

Commit

Permalink
CODE add suggested overrides, remove redundant virtual (ceeac)
Browse files Browse the repository at this point in the history
git-svn-id: svn://tron.homeunix.org/simutrans/simutrans/trunk@8692 8aca7d54-2c30-db11-9de9-000461428c89
  • Loading branch information
Dwachs committed Feb 22, 2019
1 parent c1169ab commit ed87b8e
Show file tree
Hide file tree
Showing 87 changed files with 657 additions and 649 deletions.
2 changes: 1 addition & 1 deletion bauer/fabrikbauer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class factory_site_searcher_t: public building_placefinder_t {
public:
factory_site_searcher_t(karte_t* welt, factory_desc_t::site_t site_) : building_placefinder_t(welt), site(site_) {}

virtual bool is_area_ok(koord pos, sint16 w, sint16 h, climate_bits cl) const
bool is_area_ok(koord pos, sint16 w, sint16 h, climate_bits cl) const OVERRIDE
{
if( !building_placefinder_t::is_area_ok(pos, w, h, cl) ) {
return false;
Expand Down
10 changes: 5 additions & 5 deletions bauer/wegbauer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2806,11 +2806,11 @@ void way_builder_t::build_powerline()
// this can drive any river, even a river that has max_speed=0
class fluss_fahrer_t : public test_driver_t
{
bool check_next_tile(const grund_t* gr) const { return gr->get_weg_ribi_unmasked(water_wt)!=0; }
virtual ribi_t::ribi get_ribi(const grund_t* gr) const { return gr->get_weg_ribi_unmasked(water_wt); }
virtual waytype_t get_waytype() const { return invalid_wt; }
virtual int get_cost(const grund_t *, const weg_t *, const sint32, ribi_t::ribi) const { return 1; }
virtual bool is_target(const grund_t *cur,const grund_t *) const { return cur->is_water() && cur->get_grund_hang()==slope_t::flat; }
bool check_next_tile(const grund_t* gr) const OVERRIDE { return gr->get_weg_ribi_unmasked(water_wt)!=0; }
ribi_t::ribi get_ribi(const grund_t* gr) const OVERRIDE { return gr->get_weg_ribi_unmasked(water_wt); }
waytype_t get_waytype() const OVERRIDE { return invalid_wt; }
int get_cost(const grund_t *, const weg_t *, const sint32, ribi_t::ribi) const OVERRIDE { return 1; }
bool is_target(const grund_t *cur,const grund_t *) const OVERRIDE { return cur->is_water() && cur->get_grund_hang()==slope_t::flat; }
};


Expand Down
10 changes: 5 additions & 5 deletions boden/boden.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,19 @@
class boden_t : public grund_t
{
protected:
virtual void calc_image_internal(const bool calc_only_snowline_change);
void calc_image_internal(const bool calc_only_snowline_change) OVERRIDE;

public:
boden_t(loadsave_t *file, koord pos );
boden_t(koord3d pos, slope_t::type slope);

virtual void rdwr(loadsave_t *file);
void rdwr(loadsave_t *file) OVERRIDE;

inline bool ist_natur() const { return !hat_wege() && !is_halt(); }
inline bool ist_natur() const OVERRIDE { return !hat_wege() && !is_halt(); }

const char *get_name() const;
const char *get_name() const OVERRIDE;

grund_t::typ get_typ() const {return boden;}
grund_t::typ get_typ() const OVERRIDE {return boden;}
};

#endif
16 changes: 8 additions & 8 deletions boden/brueckenboden.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,25 +9,25 @@ class brueckenboden_t : public grund_t
uint8 weg_hang;

protected:
void calc_image_internal(const bool calc_only_snowline_change);
void calc_image_internal(const bool calc_only_snowline_change) OVERRIDE;

public:
brueckenboden_t(loadsave_t *file, koord pos ) : grund_t(koord3d(pos,0) ) { rdwr(file); }
brueckenboden_t(koord3d pos, int grund_hang, int weg_hang);

virtual void rdwr(loadsave_t *file);
void rdwr(loadsave_t *file) OVERRIDE;

// map rotation
virtual void rotate90();
void rotate90() OVERRIDE;

virtual sint8 get_weg_yoff() const;
sint8 get_weg_yoff() const OVERRIDE;

slope_t::type get_weg_hang() const { return weg_hang; }
slope_t::type get_weg_hang() const OVERRIDE { return weg_hang; }

const char *get_name() const {return "Brueckenboden";}
typ get_typ() const { return brueckenboden; }
const char *get_name() const OVERRIDE {return "Brueckenboden";}
typ get_typ() const OVERRIDE { return brueckenboden; }

void info(cbuffer_t & buf) const;
void info(cbuffer_t & buf) const OVERRIDE;
};

#endif
6 changes: 3 additions & 3 deletions boden/fundament.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class fundament_t : public grund_t
* The foundation always have the same image.
* @author Hj. Malthaner
*/
void calc_image_internal(const bool calc_only_snowline_change);
void calc_image_internal(const bool calc_only_snowline_change) OVERRIDE;

public:
fundament_t(loadsave_t *file, koord pos );
Expand All @@ -27,9 +27,9 @@ class fundament_t : public grund_t
* @return 'Fundament'.
* @author Hj. Malthaner
*/
const char *get_name() const {return "Fundament";}
const char *get_name() const OVERRIDE {return "Fundament";}

typ get_typ() const { return fundament; }
typ get_typ() const OVERRIDE { return fundament; }

bool set_slope(slope_t::type) { slope = 0; return false; }
};
Expand Down
8 changes: 4 additions & 4 deletions boden/monorailboden.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
class monorailboden_t : public grund_t
{
protected:
void calc_image_internal(const bool calc_only_snowline_change);
void calc_image_internal(const bool calc_only_snowline_change) OVERRIDE;

public:
monorailboden_t(loadsave_t *file, koord pos ) : grund_t( koord3d(pos,0) ) { rdwr(file); }
monorailboden_t(koord3d pos,slope_t::type slope);

virtual void rdwr(loadsave_t *file);
void rdwr(loadsave_t *file) OVERRIDE;

const char *get_name() const {return "Monorailboden";}
typ get_typ() const { return monorailboden; }
const char *get_name() const OVERRIDE {return "Monorailboden";}
typ get_typ() const OVERRIDE { return monorailboden; }
};

#endif
12 changes: 6 additions & 6 deletions boden/tunnelboden.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
class tunnelboden_t : public boden_t
{
protected:
void calc_image_internal(const bool calc_only_snowline_change);
void calc_image_internal(const bool calc_only_snowline_change) OVERRIDE;

public:
tunnelboden_t(loadsave_t *file, koord pos );
tunnelboden_t(koord3d pos, slope_t::type slope_type) : boden_t(pos, slope_type) {}

virtual void rdwr(loadsave_t *file);
void rdwr(loadsave_t *file) OVERRIDE;

slope_t::type get_weg_hang() const { return ist_karten_boden() ? (slope_t::type)slope_t::flat : get_grund_hang(); }
slope_t::type get_weg_hang() const OVERRIDE { return ist_karten_boden() ? (slope_t::type)slope_t::flat : get_grund_hang(); }

const char *get_name() const {return "Tunnelboden";}
typ get_typ() const { return tunnelboden; }
const char *get_name() const OVERRIDE {return "Tunnelboden";}
typ get_typ() const OVERRIDE { return tunnelboden; }

void info(cbuffer_t & buf) const;
void info(cbuffer_t & buf) const OVERRIDE;
};

#endif
14 changes: 7 additions & 7 deletions boden/wasser.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,24 +20,24 @@ class wasser_t : public grund_t
/**
* This method also recalculates ribi and cache_ribi!
*/
void calc_image_internal(const bool calc_only_snowline_change);
void calc_image_internal(const bool calc_only_snowline_change) OVERRIDE;

public:

wasser_t(loadsave_t *file, koord pos ) : grund_t(koord3d(pos,0) ), ribi(ribi_t::none), canal_ribi(ribi_t::none) { rdwr(file); }
wasser_t(koord3d pos);

inline bool is_water() const { return true; }
inline bool is_water() const OVERRIDE { return true; }

// returns correct directions for water and none for the rest ...
ribi_t::ribi get_weg_ribi(waytype_t typ) const { return (typ==water_wt) ? ribi : (ribi_t::ribi)ribi_t::none; }
ribi_t::ribi get_weg_ribi_unmasked(waytype_t typ) const { return (typ==water_wt) ? ribi : (ribi_t::ribi)ribi_t::none; }
ribi_t::ribi get_weg_ribi(waytype_t typ) const OVERRIDE { return (typ==water_wt) ? ribi : (ribi_t::ribi)ribi_t::none; }
ribi_t::ribi get_weg_ribi_unmasked(waytype_t typ) const OVERRIDE { return (typ==water_wt) ? ribi : (ribi_t::ribi)ribi_t::none; }

const char *get_name() const {return "Water";}
grund_t::typ get_typ() const {return wasser;}
const char *get_name() const OVERRIDE {return "Water";}
grund_t::typ get_typ() const OVERRIDE {return wasser;}

// map rotation
void rotate90();
void rotate90() OVERRIDE;

ribi_t::ribi get_canal_ribi() const { return canal_ribi; }

Expand Down
5 changes: 2 additions & 3 deletions boden/wege/kanal.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@
*/
class kanal_t : public weg_t
{

public:
static const way_desc_t *default_kanal;

kanal_t(loadsave_t *file);
kanal_t();

waytype_t get_waytype() const {return water_wt;}
virtual void rdwr(loadsave_t *file);
waytype_t get_waytype() const OVERRIDE {return water_wt;}
void rdwr(loadsave_t *file) OVERRIDE;
};

#endif
4 changes: 2 additions & 2 deletions boden/wege/maglev.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class maglev_t : public schiene_t
*/
maglev_t(loadsave_t *file);

virtual waytype_t get_waytype() const {return maglev_wt;}
waytype_t get_waytype() const OVERRIDE {return maglev_wt;}

void rdwr(loadsave_t *file);
void rdwr(loadsave_t *file) OVERRIDE;
};

#endif
4 changes: 2 additions & 2 deletions boden/wege/monorail.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ class monorail_t : public schiene_t
*/
monorail_t(loadsave_t *file);

virtual waytype_t get_waytype() const {return monorail_wt;}
waytype_t get_waytype() const OVERRIDE {return monorail_wt;}

void rdwr(loadsave_t *file);
void rdwr(loadsave_t *file) OVERRIDE;
};

#endif
4 changes: 2 additions & 2 deletions boden/wege/narrowgauge.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ class narrowgauge_t : public schiene_t
*/
narrowgauge_t(loadsave_t *file);

virtual waytype_t get_waytype() const {return narrowgauge_wt;}
waytype_t get_waytype() const OVERRIDE {return narrowgauge_wt;}

void rdwr(loadsave_t *file);
void rdwr(loadsave_t *file) OVERRIDE;
};

#endif
12 changes: 6 additions & 6 deletions boden/wege/schiene.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ class schiene_t : public weg_t

schiene_t();

virtual waytype_t get_waytype() const {return track_wt;}
waytype_t get_waytype() const OVERRIDE {return track_wt;}

/**
* @return additional info is reservation!
* @author prissi
*/
void info(cbuffer_t & buf) const;
void info(cbuffer_t & buf) const OVERRIDE;

/**
* true, if this rail can be reserved
Expand Down Expand Up @@ -84,27 +84,27 @@ class schiene_t : public weg_t
/* called before deletion;
* last chance to unreserve tiles ...
*/
virtual void cleanup(player_t *player);
void cleanup(player_t *player) OVERRIDE;

/**
* gets the related convoi
* @author prissi
*/
convoihandle_t get_reserved_convoi() const {return reserved;}

void rdwr(loadsave_t *file);
void rdwr(loadsave_t *file) OVERRIDE;

/**
* if a function return here a value with TRANSPARENT_FLAGS set
* then a transparent outline with the color form the lower 8 Bit is drawn
* @author kierongreen
*/
virtual FLAGGED_PIXVAL get_outline_colour() const { return (show_reservations && reserved.is_bound()) ? TRANSPARENT75_FLAG | OUTLINE_FLAG | color_idx_to_rgb(COL_RED) : 0;}
FLAGGED_PIXVAL get_outline_colour() const OVERRIDE { return (show_reservations && reserved.is_bound()) ? TRANSPARENT75_FLAG | OUTLINE_FLAG | color_idx_to_rgb(COL_RED) : 0;}

/*
* to show reservations if needed
*/
virtual image_id get_outline_image() const { return weg_t::get_image(); }
image_id get_outline_image() const OVERRIDE { return weg_t::get_image(); }
};


Expand Down
4 changes: 2 additions & 2 deletions boden/wege/strasse.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class strasse_t : public weg_t
strasse_t(loadsave_t *file);
strasse_t();

inline waytype_t get_waytype() const {return road_wt;}
inline waytype_t get_waytype() const OVERRIDE {return road_wt;}

void set_gehweg(bool janein);

virtual void rdwr(loadsave_t *file);
void rdwr(loadsave_t *file) OVERRIDE;
};

#endif
24 changes: 12 additions & 12 deletions boden/wege/weg.h
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,13 @@ class weg_t : public obj_no_info_t
/**
* Actual image recalculation
*/
void calc_image();
void calc_image() OVERRIDE;

/**
* Called whenever the season or snowline height changes
* return false and the obj_t will be deleted
*/
bool check_season(const bool calc_only_season_change);
bool check_season(const bool calc_only_season_change) OVERRIDE;

/**
* Setzt die erlaubte Höchstgeschwindigkeit
Expand Down Expand Up @@ -180,37 +180,37 @@ class weg_t : public obj_no_info_t
// returns a string with the "official name of the waytype"
static const char *waytype_to_string(waytype_t wt);

virtual void rdwr(loadsave_t *file);
void rdwr(loadsave_t *file) OVERRIDE;

/**
* Info-text for this way
* @author Hj. Malthaner
*/
virtual void info(cbuffer_t & buf) const;
void info(cbuffer_t & buf) const OVERRIDE;

/**
* @return NULL if OK, otherwise an error message
* @author Hj. Malthaner
*/
virtual const char *is_deletable(const player_t *player);
const char *is_deletable(const player_t *player) OVERRIDE;

/**
* Wegtyp zurückliefern
*/
virtual waytype_t get_waytype() const = 0;
waytype_t get_waytype() const OVERRIDE = 0;

/**
* 'Jedes Ding braucht einen Typ.'
* @return Gibt den typ des Objekts zurück.
* @author Hj. Malthaner
*/
typ get_typ() const { return obj_t::way; }
typ get_typ() const OVERRIDE { return obj_t::way; }

/**
* Die Bezeichnung des Wegs
* @author Hj. Malthaner
*/
const char *get_name() const { return desc->get_name(); }
const char *get_name() const OVERRIDE { return desc->get_name(); }

/**
* Add direction bits (ribi) for a way.
Expand Down Expand Up @@ -264,7 +264,7 @@ class weg_t : public obj_no_info_t
* called during map rotation
* @author priss
*/
void rotate90();
void rotate90() OVERRIDE;

/**
* book statistics - is called very often and therefore inline
Expand Down Expand Up @@ -313,14 +313,14 @@ class weg_t : public obj_no_info_t
void clear_sign_flag() { flags &= ~(HAS_SIGN | HAS_SIGNAL); }

inline void set_image( image_id b ) { image = b; }
image_id get_image() const {return image;}
image_id get_image() const OVERRIDE {return image;}

inline void set_foreground_image( image_id b ) { foreground_image = b; }
image_id get_front_image() const {return foreground_image;}
image_id get_front_image() const OVERRIDE {return foreground_image;}


// correct maintenance
void finish_rd();
void finish_rd() OVERRIDE;
} GCC_PACKED;

#endif
1 change: 0 additions & 1 deletion dataobj/scenario.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ class scenario_t
/// the world we are scripting in
karte_t *welt;


/// name of scenario, files are searched in scenario_path/scenario_name/...
/// e.g. my_scenario
plainstring scenario_name;
Expand Down
Loading

0 comments on commit ed87b8e

Please sign in to comment.