economy_base.h

Go to the documentation of this file.
00001 /* $Id: economy_base.h 16742 2009-07-04 17:39:00Z rubidium $ */
00002 
00005 #ifndef ECONOMY_BASE_H
00006 #define ECONOMY_BASE_H
00007 
00008 #include "cargopacket.h"
00009 
00010 DECLARE_OLD_POOL(CargoPayment, CargoPayment, 9, 125)
00011 
00012 
00015 struct CargoPayment : PoolItem<CargoPayment, CargoPaymentID, &_CargoPayment_pool> {
00016   Vehicle *front;      
00017   Money route_profit;  
00018   Money visual_profit; 
00019 
00020   /* Unsaved variables */
00021   Company *owner;            
00022   StationID current_station; 
00023   CargoID ct;                
00024 
00026   CargoPayment() {}
00027   CargoPayment(Vehicle *front);
00028   ~CargoPayment();
00029 
00030   void PayTransfer(CargoPacket *cp, uint count);
00031   void PayFinalDelivery(CargoPacket *cp, uint count);
00032 
00037   void SetCargo(CargoID ct) { this->ct = ct; }
00038 
00039   inline bool IsValid() const { return this->front != NULL; }
00040 };
00041 
00042 #define FOR_ALL_CARGO_PAYMENTS_FROM(v, start) for (v = GetCargoPayment(start); v != NULL; v = (v->index + 1U < GetCargoPaymentPoolSize()) ? GetCargoPayment(v->index + 1) : NULL) if (v->IsValid())
00043 #define FOR_ALL_CARGO_PAYMENTS(var) FOR_ALL_CARGO_PAYMENTS_FROM(var, 0)
00044 
00049 extern bool _cargo_payment_savegame;
00050 
00051 #endif /* ECONOMY_BASE_H */

Generated on Thu Oct 1 11:03:13 2009 for OpenTTD by  doxygen 1.5.6