mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-12 02:19:41 +00:00
(svn r9765) -Codechange: constify some class functions.
This commit is contained in:
parent
dce7dcb664
commit
951c74806f
@ -130,11 +130,11 @@ struct Aircraft : public Vehicle {
|
|||||||
/** We want to 'destruct' the right class. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~Aircraft() {}
|
virtual ~Aircraft() {}
|
||||||
|
|
||||||
const char *GetTypeString() { return "aircraft"; }
|
const char *GetTypeString() const { return "aircraft"; }
|
||||||
void MarkDirty();
|
void MarkDirty();
|
||||||
void UpdateDeltaXY(Direction direction);
|
void UpdateDeltaXY(Direction direction);
|
||||||
ExpensesType GetExpenseType(bool income) { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; }
|
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_AIRCRAFT_INC : EXPENSES_AIRCRAFT_RUN; }
|
||||||
WindowClass GetVehicleListWindowClass() { return WC_AIRCRAFT_LIST; }
|
WindowClass GetVehicleListWindowClass() const { return WC_AIRCRAFT_LIST; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* AIRCRAFT_H */
|
#endif /* AIRCRAFT_H */
|
||||||
|
@ -38,11 +38,11 @@ struct RoadVehicle : public Vehicle {
|
|||||||
/** We want to 'destruct' the right class. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~RoadVehicle() {}
|
virtual ~RoadVehicle() {}
|
||||||
|
|
||||||
const char *GetTypeString() { return "road vehicle"; }
|
const char *GetTypeString() const { return "road vehicle"; }
|
||||||
void MarkDirty();
|
void MarkDirty();
|
||||||
void UpdateDeltaXY(Direction direction);
|
void UpdateDeltaXY(Direction direction);
|
||||||
ExpensesType GetExpenseType(bool income) { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; }
|
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; }
|
||||||
WindowClass GetVehicleListWindowClass() { return WC_ROADVEH_LIST; }
|
WindowClass GetVehicleListWindowClass() const { return WC_ROADVEH_LIST; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* ROADVEH_H */
|
#endif /* ROADVEH_H */
|
||||||
|
@ -39,11 +39,11 @@ struct Ship: public Vehicle {
|
|||||||
/** We want to 'destruct' the right class. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~Ship() {}
|
virtual ~Ship() {}
|
||||||
|
|
||||||
const char *GetTypeString() { return "ship"; }
|
const char *GetTypeString() const { return "ship"; }
|
||||||
void MarkDirty();
|
void MarkDirty();
|
||||||
void UpdateDeltaXY(Direction direction);
|
void UpdateDeltaXY(Direction direction);
|
||||||
ExpensesType GetExpenseType(bool income) { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; }
|
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_SHIP_INC : EXPENSES_SHIP_RUN; }
|
||||||
WindowClass GetVehicleListWindowClass() { return WC_SHIPS_LIST; }
|
WindowClass GetVehicleListWindowClass() const { return WC_SHIPS_LIST; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* SHIP_H */
|
#endif /* SHIP_H */
|
||||||
|
@ -243,11 +243,11 @@ struct Train : public Vehicle {
|
|||||||
/** We want to 'destruct' the right class. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~Train() {}
|
virtual ~Train() {}
|
||||||
|
|
||||||
const char *GetTypeString() { return "train"; }
|
const char *GetTypeString() const { return "train"; }
|
||||||
void MarkDirty();
|
void MarkDirty();
|
||||||
void UpdateDeltaXY(Direction direction);
|
void UpdateDeltaXY(Direction direction);
|
||||||
ExpensesType GetExpenseType(bool income) { return income ? EXPENSES_TRAIN_INC : EXPENSES_TRAIN_RUN; }
|
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_TRAIN_INC : EXPENSES_TRAIN_RUN; }
|
||||||
WindowClass GetVehicleListWindowClass() { return WC_TRAINS_LIST; }
|
WindowClass GetVehicleListWindowClass() const { return WC_TRAINS_LIST; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* TRAIN_H */
|
#endif /* TRAIN_H */
|
||||||
|
@ -352,7 +352,7 @@ struct Vehicle {
|
|||||||
* Get a string 'representation' of the vehicle type.
|
* Get a string 'representation' of the vehicle type.
|
||||||
* @return the string representation.
|
* @return the string representation.
|
||||||
*/
|
*/
|
||||||
virtual const char* GetTypeString() = 0;
|
virtual const char* GetTypeString() const = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Marks the vehicles to be redrawn and updates cached variables
|
* Marks the vehicles to be redrawn and updates cached variables
|
||||||
@ -370,12 +370,12 @@ struct Vehicle {
|
|||||||
* Sets the expense type associated to this vehicle type
|
* Sets the expense type associated to this vehicle type
|
||||||
* @param income whether this is income or (running) expenses of the vehicle
|
* @param income whether this is income or (running) expenses of the vehicle
|
||||||
*/
|
*/
|
||||||
virtual ExpensesType GetExpenseType(bool income) { return EXPENSES_OTHER; }
|
virtual ExpensesType GetExpenseType(bool income) const { return EXPENSES_OTHER; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Invalidates the vehicle list window of this type of vehicle
|
* Invalidates the vehicle list window of this type of vehicle
|
||||||
*/
|
*/
|
||||||
virtual WindowClass GetVehicleListWindowClass() { return WC_NONE; }
|
virtual WindowClass GetVehicleListWindowClass() const { return WC_NONE; }
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -400,7 +400,7 @@ struct SpecialVehicle : public Vehicle {
|
|||||||
/** We want to 'destruct' the right class. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~SpecialVehicle() {}
|
virtual ~SpecialVehicle() {}
|
||||||
|
|
||||||
const char *GetTypeString() { return "special vehicle"; }
|
const char *GetTypeString() const { return "special vehicle"; }
|
||||||
void UpdateDeltaXY(Direction direction);
|
void UpdateDeltaXY(Direction direction);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -419,7 +419,7 @@ struct DisasterVehicle : public Vehicle {
|
|||||||
/** We want to 'destruct' the right class. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~DisasterVehicle() {}
|
virtual ~DisasterVehicle() {}
|
||||||
|
|
||||||
const char *GetTypeString() { return "disaster vehicle"; }
|
const char *GetTypeString() const { return "disaster vehicle"; }
|
||||||
void UpdateDeltaXY(Direction direction);
|
void UpdateDeltaXY(Direction direction);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -438,7 +438,7 @@ struct InvalidVehicle : public Vehicle {
|
|||||||
/** We want to 'destruct' the right class. */
|
/** We want to 'destruct' the right class. */
|
||||||
virtual ~InvalidVehicle() {}
|
virtual ~InvalidVehicle() {}
|
||||||
|
|
||||||
const char *GetTypeString() { return "invalid vehicle"; }
|
const char *GetTypeString() const { return "invalid vehicle"; }
|
||||||
};
|
};
|
||||||
|
|
||||||
#define is_custom_sprite(x) (x >= 0xFD)
|
#define is_custom_sprite(x) (x >= 0xFD)
|
||||||
|
Loading…
Reference in New Issue
Block a user