OpenTTD
economy_base.h
Go to the documentation of this file.
1 /* $Id: economy_base.h 25011 2013-02-17 14:50:54Z rubidium $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * 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.
6  * 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.
7  * 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/>.
8  */
9 
12 #ifndef ECONOMY_BASE_H
13 #define ECONOMY_BASE_H
14 
15 #include "cargopacket.h"
16 #include "company_type.h"
17 
22 
26 struct CargoPayment : CargoPaymentPool::PoolItem<&_cargo_payment_pool> {
31 
32  /* Unsaved variables */
34  StationID current_station;
36 
39  CargoPayment(Vehicle *front);
40  ~CargoPayment();
41 
42  Money PayTransfer(const CargoPacket *cp, uint count);
43  void PayFinalDelivery(const CargoPacket *cp, uint count);
44 
49  void SetCargo(CargoID ct) { this->ct = ct; }
50 };
51 
57 #define FOR_ALL_CARGO_PAYMENTS_FROM(var, start) FOR_ALL_ITEMS_FROM(CargoPayment, cargo_payment_index, var, start)
58 
63 #define FOR_ALL_CARGO_PAYMENTS(var) FOR_ALL_CARGO_PAYMENTS_FROM(var, 0)
64 
65 #endif /* ECONOMY_BASE_H */
Company * owner
The owner of the vehicle.
Definition: economy_base.h:33
Vehicle data structure.
Definition: vehicle_base.h:212
CargoPaymentPool _cargo_payment_pool
The actual pool to store cargo payments in.
CargoID ct
The currently handled cargo type.
Definition: economy_base.h:35
Base class for cargo packets.
Vehicle * front
The front vehicle to do the payment of.
Definition: economy_base.h:27
Pool< CargoPayment, CargoPaymentID, 512, 0xFF000 > CargoPaymentPool
Type of pool to store cargo payments in; little over 1 million.
Definition: economy_base.h:19
Money PayTransfer(const CargoPacket *cp, uint count)
Handle payment for transfer of the given cargo packet.
Definition: economy.cpp:1227
Money visual_profit
The visual profit to show.
Definition: economy_base.h:29
Container for cargo from the same location and time.
Definition: cargopacket.h:44
void PayFinalDelivery(const CargoPacket *cp, uint count)
Handle payment for final delivery of the given cargo packet.
Definition: economy.cpp:1207
Money route_profit
The amount of money to add/remove from the bank account.
Definition: economy_base.h:28
CargoPayment()
Constructor for pool saveload.
Definition: economy_base.h:38
Helper class to perform the cargo payment.
Definition: economy_base.h:26
Base class for all PoolItems.
Definition: pool_type.hpp:146
Base class for all pools.
Definition: pool_type.hpp:83
void SetCargo(CargoID ct)
Sets the currently handled cargo type.
Definition: economy_base.h:49
Types related to companies.
byte CargoID
Cargo slots to indicate a cargo type within a game.
Definition: cargo_type.h:22
StationID current_station
The current station.
Definition: economy_base.h:34
Money visual_transfer
The transfer credits to be shown.
Definition: economy_base.h:30