OpenTTD Source: src/economy_base.h Source File

OpenTTD Source 15.0-beta1

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;
19extern CargoPaymentPool _cargo_payment_pool;
20
24 struct CargoPayment : CargoPaymentPool::PoolItem<&_cargo_payment_pool> {
25 /* CargoPaymentID index member of CargoPaymentPool is 4 bytes. */
26 StationID current_station;
27 Company *owner;
28
29 Vehicle *front;
30 Money route_profit;
31 Money visual_profit;
32 Money visual_transfer;
33
35 CargoPayment() {}
36 CargoPayment(Vehicle *front);
37 ~CargoPayment();
38
39 Money PayTransfer(CargoID cargo, const CargoPacket *cp, uint count, TileIndex current_tile);
40 void PayFinalDelivery(CargoID cargo, const CargoPacket *cp, uint count, TileIndex current_tile);
41};
42
43#endif /* ECONOMY_BASE_H */
CargoID
uint8_t CargoID
Cargo slots to indicate a cargo type within a game.
Definition cargo_type.h:22
cargopacket.h
Base class for cargo packets.
OverflowSafeInt< int64_t >
company_type.h
Types related to companies.
CargoPaymentPool
Pool< CargoPayment, CargoPaymentID, 512, 0xFF000 > CargoPaymentPool
Type of pool to store cargo payments in; little over 1 million.
Definition economy_base.h:17
_cargo_payment_pool
CargoPaymentPool _cargo_payment_pool
The actual pool to store cargo payments in.
CargoPacket
Container for cargo from the same location and time.
Definition cargopacket.h:40
CargoPayment
Helper class to perform the cargo payment.
Definition economy_base.h:24
CargoPayment::CargoPayment
CargoPayment()
Constructor for pool saveload.
Definition economy_base.h:35
CargoPayment::owner
Company * owner
NOSAVE: The owner of the vehicle.
Definition economy_base.h:27
CargoPayment::PayTransfer
Money PayTransfer(CargoID cargo, const CargoPacket *cp, uint count, TileIndex current_tile)
Handle payment for transfer of the given cargo packet.
Definition economy.cpp:1258
CargoPayment::current_station
StationID current_station
NOSAVE: The current station.
Definition economy_base.h:26
CargoPayment::PayFinalDelivery
void PayFinalDelivery(CargoID cargo, const CargoPacket *cp, uint count, TileIndex current_tile)
Handle payment for final delivery of the given cargo packet.
Definition economy.cpp:1236
CargoPayment::front
Vehicle * front
The front vehicle to do the payment of.
Definition economy_base.h:29
CargoPayment::visual_transfer
Money visual_transfer
The transfer credits to be shown.
Definition economy_base.h:32
CargoPayment::visual_profit
Money visual_profit
The visual profit to show.
Definition economy_base.h:31
CargoPayment::route_profit
Money route_profit
The amount of money to add/remove from the bank account.
Definition economy_base.h:30
Company
Definition company_base.h:133
Pool::PoolItem
Base class for all PoolItems.
Definition pool_type.hpp:237
Pool
Base class for all pools.
Definition pool_type.hpp:80
StrongType::Typedef< uint32_t, struct TileIndexTag, StrongType::Compare, StrongType::Integer, StrongType::Compatible< int32_t >, StrongType::Compatible< int64_t > >
Vehicle
Vehicle data structure.
Definition vehicle_base.h:244