OpenTTD Source: src/economy_base.h Source File

OpenTTD Source 13.2.1

economy_base.h
Go to the documentation of this file.
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 */
7
10 #ifndef ECONOMY_BASE_H
11 #define ECONOMY_BASE_H
12
13 #include "cargopacket.h"
14 #include "company_type.h"
15
17 typedef Pool<CargoPayment, CargoPaymentID, 512, 0xFF000> CargoPaymentPool;
19 extern CargoPaymentPool _cargo_payment_pool;
20
24 struct CargoPayment : CargoPaymentPool::PoolItem<&_cargo_payment_pool> {
25 Vehicle *front;
26 Money route_profit;
27 Money visual_profit;
28 Money visual_transfer;
29
30 /* Unsaved variables */
31 Company *owner;
32 StationID current_station;
33 CargoID ct;
34
36 CargoPayment() {}
37 CargoPayment(Vehicle *front);
38 ~CargoPayment();
39
40 Money PayTransfer(const CargoPacket *cp, uint count);
41 void PayFinalDelivery(const CargoPacket *cp, uint count);
42
47 void SetCargo(CargoID ct) { this->ct = ct; }
48 };
49
50 #endif /* ECONOMY_BASE_H */
CargoPayment::visual_profit
Money visual_profit
The visual profit to show.
Definition: economy_base.h:27
CargoPayment::front
Vehicle * front
The front vehicle to do the payment of.
Definition: economy_base.h:25
CargoPayment::current_station
StationID current_station
The current station.
Definition: economy_base.h:32
CargoPayment::visual_transfer
Money visual_transfer
The transfer credits to be shown.
Definition: economy_base.h:28
CargoPayment::CargoPayment
CargoPayment()
Constructor for pool saveload.
Definition: economy_base.h:36
_cargo_payment_pool
CargoPaymentPool _cargo_payment_pool
The actual pool to store cargo payments in.
Vehicle
Vehicle data structure.
Definition: vehicle_base.h:224
CargoPayment::ct
CargoID ct
The currently handled cargo type.
Definition: economy_base.h:33
CargoPayment
Helper class to perform the cargo payment.
Definition: economy_base.h:24
CargoPayment::PayFinalDelivery
void PayFinalDelivery(const CargoPacket *cp, uint count)
Handle payment for final delivery of the given cargo packet.
Definition: economy.cpp:1219
CargoPaymentPool
Pool< CargoPayment, CargoPaymentID, 512, 0xFF000 > CargoPaymentPool
Type of pool to store cargo payments in; little over 1 million.
Definition: economy_base.h:17
cargopacket.h
Pool
Base class for all pools.
Definition: pool_type.hpp:81
CargoPayment::PayTransfer
Money PayTransfer(const CargoPacket *cp, uint count)
Handle payment for transfer of the given cargo packet.
Definition: economy.cpp:1239
CargoPayment::route_profit
Money route_profit
The amount of money to add/remove from the bank account.
Definition: economy_base.h:26
CargoPacket
Container for cargo from the same location and time.
Definition: cargopacket.h:43
OverflowSafeInt< int64 >
CargoID
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:20
CargoPayment::SetCargo
void SetCargo(CargoID ct)
Sets the currently handled cargo type.
Definition: economy_base.h:47
Company
Definition: company_base.h:117
Pool::PoolItem
Base class for all PoolItems.
Definition: pool_type.hpp:234
CargoPayment::owner
Company * owner
The owner of the vehicle.
Definition: economy_base.h:31
company_type.h