Fix #10490: Allow ships to exit depots if another is not moving at the exit point...
[openttd-github.git] / src / economy_base.h
blob4fbc11b24f178e9eb5bf3df2bba168cf3c2a3d37
1 /*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
6 */
8 /** @file economy_base.h Base classes related to the economy. */
10 #ifndef ECONOMY_BASE_H
11 #define ECONOMY_BASE_H
13 #include "cargopacket.h"
14 #include "company_type.h"
16 /** Type of pool to store cargo payments in; little over 1 million. */
17 typedef Pool<CargoPayment, CargoPaymentID, 512, 0xFF000> CargoPaymentPool;
18 /** The actual pool to store cargo payments in. */
19 extern CargoPaymentPool _cargo_payment_pool;
21 /**
22 * Helper class to perform the cargo payment.
24 struct CargoPayment : CargoPaymentPool::PoolItem<&_cargo_payment_pool> {
25 /* CargoPaymentID index member of CargoPaymentPool is 4 bytes. */
26 StationID current_station; ///< NOSAVE: The current station
27 CargoID ct; ///< NOSAVE: The currently handled cargo type
28 Company *owner; ///< NOSAVE: The owner of the vehicle
30 Vehicle *front; ///< The front vehicle to do the payment of
31 Money route_profit; ///< The amount of money to add/remove from the bank account
32 Money visual_profit; ///< The visual profit to show
33 Money visual_transfer; ///< The transfer credits to be shown
35 /** Constructor for pool saveload */
36 CargoPayment() {}
37 CargoPayment(Vehicle *front);
38 ~CargoPayment();
40 Money PayTransfer(const CargoPacket *cp, uint count, TileIndex current_tile);
41 void PayFinalDelivery(const CargoPacket *cp, uint count, TileIndex current_tile);
43 /**
44 * Sets the currently handled cargo type.
45 * @param ct the cargo type to handle from now on.
47 void SetCargo(CargoID ct) { this->ct = ct; }
50 #endif /* ECONOMY_BASE_H */