economy_base.h

Go to the documentation of this file.
00001 /* $Id: economy_base.h 17734 2009-10-06 23:01:35Z rubidium $ */
00002 
00003 /*
00004  * This file is part of OpenTTD.
00005  * 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.
00006  * 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.
00007  * 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/>.
00008  */
00009 
00012 #ifndef ECONOMY_BASE_H
00013 #define ECONOMY_BASE_H
00014 
00015 #include "cargopacket.h"
00016 #include "company_type.h"
00017 
00019 typedef Pool<CargoPayment, CargoPaymentID, 512, 64000> CargoPaymentPool;
00021 extern CargoPaymentPool _cargo_payment_pool;
00022 
00026 struct CargoPayment : CargoPaymentPool::PoolItem<&_cargo_payment_pool> {
00027   Vehicle *front;      
00028   Money route_profit;  
00029   Money visual_profit; 
00030 
00031   /* Unsaved variables */
00032   Company *owner;            
00033   StationID current_station; 
00034   CargoID ct;                
00035 
00037   CargoPayment() {}
00038   CargoPayment(Vehicle *front);
00039   ~CargoPayment();
00040 
00041   Money PayTransfer(const CargoPacket *cp, uint count);
00042   void PayFinalDelivery(const CargoPacket *cp, uint count);
00043 
00048   void SetCargo(CargoID ct) { this->ct = ct; }
00049 };
00050 
00051 #define FOR_ALL_CARGO_PAYMENTS_FROM(var, start) FOR_ALL_ITEMS_FROM(CargoPayment, cargo_payment_index, var, start)
00052 #define FOR_ALL_CARGO_PAYMENTS(var) FOR_ALL_CARGO_PAYMENTS_FROM(var, 0)
00053 
00054 #endif /* ECONOMY_BASE_H */

Generated on Sat Jul 31 21:37:46 2010 for OpenTTD by  doxygen 1.6.1