src/station.cpp
branchNewGRF_ports
changeset 6719 4cc327ad39d5
parent 6585 7da94b26498a
child 6720 35756db7e577
equal deleted inserted replaced
6718:5a8b295aa345 6719:4cc327ad39d5
    53 	random_bits = 0; // Random() must be called when station is really built (DC_EXEC)
    53 	random_bits = 0; // Random() must be called when station is really built (DC_EXEC)
    54 	waiting_triggers = 0;
    54 	waiting_triggers = 0;
    55 }
    55 }
    56 
    56 
    57 /**
    57 /**
    58 	* Clean up a station by clearing vehicle orders and invalidating windows.
    58  * Clean up a station by clearing vehicle orders and invalidating windows.
    59 	* Aircraft-Hangar orders need special treatment here, as the hangars are
    59  * Aircraft-Hangar orders need special treatment here, as the hangars are
    60 	* actually part of a station (tiletype is STATION), but the order type
    60  * actually part of a station (tiletype is STATION), but the order type
    61 	* is OT_GOTO_DEPOT.
    61  * is OT_GOTO_DEPOT.
    62 	* @param st Station to be deleted
    62  */
    63 	*/
       
    64 Station::~Station()
    63 Station::~Station()
    65 {
    64 {
    66 	DEBUG(station, cDebugCtorLevel, "I-%3d", index);
    65 	DEBUG(station, cDebugCtorLevel, "I-%3d", index);
    67 
    66 
    68 	DeleteName(string_id);
    67 	DeleteName(string_id);
   104 void Station::operator delete(void *p, int st_idx)
   103 void Station::operator delete(void *p, int st_idx)
   105 {
   104 {
   106 }
   105 }
   107 
   106 
   108 /** Called when new facility is built on the station. If it is the first facility
   107 /** Called when new facility is built on the station. If it is the first facility
   109 	* it initializes also 'xy' and 'random_bits' members */
   108  * it initializes also 'xy' and 'random_bits' members */
   110 void Station::AddFacility(byte new_facility_bit, TileIndex facil_xy)
   109 void Station::AddFacility(byte new_facility_bit, TileIndex facil_xy)
   111 {
   110 {
   112 	if (facilities == 0) {
   111 	if (facilities == 0) {
   113 		xy = facil_xy;
   112 		xy = facil_xy;
   114 		random_bits = Random();
   113 		random_bits = Random();
   121 void Station::MarkDirty() const
   120 void Station::MarkDirty() const
   122 {
   121 {
   123 	if (sign.width_1 != 0) {
   122 	if (sign.width_1 != 0) {
   124 		InvalidateWindowWidget(WC_STATION_VIEW, index, 1);
   123 		InvalidateWindowWidget(WC_STATION_VIEW, index, 1);
   125 
   124 
       
   125 		/* We use ZOOM_LVL_MAX here, as every viewport can have an other zoom,
       
   126 		 *  and there is no way for us to know which is the biggest. So make the
       
   127 		 *  biggest area dirty, and we are safe for sure. */
   126 		MarkAllViewportsDirty(
   128 		MarkAllViewportsDirty(
   127 			sign.left - 6,
   129 			sign.left - 6,
   128 			sign.top,
   130 			sign.top,
   129 			sign.left + (sign.width_1 << 2) + 12,
   131 			sign.left + ScaleByZoom(sign.width_1 + 12, ZOOM_LVL_MAX),
   130 			sign.top + 48);
   132 			sign.top + ScaleByZoom(12, ZOOM_LVL_MAX));
   131 	}
   133 	}
   132 }
   134 }
   133 
   135 
   134 void Station::MarkTilesDirty() const
   136 void Station::MarkTilesDirty() const
   135 {
   137 {
   180 
   182 
   181 
   183 
   182 /** Obtain the length of a platform
   184 /** Obtain the length of a platform
   183  * @pre tile must be a railway station tile
   185  * @pre tile must be a railway station tile
   184  * @param tile A tile that contains the platform in question
   186  * @param tile A tile that contains the platform in question
   185  * @returns The length of the platform
   187  * @return The length of the platform
   186  */
   188  */
   187 uint Station::GetPlatformLength(TileIndex tile) const
   189 uint Station::GetPlatformLength(TileIndex tile) const
   188 {
   190 {
   189 	TileIndex t;
   191 	TileIndex t;
   190 	TileIndexDiff delta;
   192 	TileIndexDiff delta;