(svn r17113) -Change [FS#265][FS#2094][FS#2589]: apply the subsidy when subsidy's destination is in station's catchment area and cargo packets originate from subsidy's source
-Change [FS#1134]: subsidies aren't bound to stations after awarding anymore, they still apply to town or industry, no matter what station is used for loading and unloading. Awarded subsidies from older savegames are lost -Change [NoAI]: due to these changes, AISubsidy::GetSource and AISubsidy::GetDestination now return STATION_INVALID for awarded subsidies
This commit is contained in:
@@ -16,17 +16,33 @@ void InitializeCargoPackets()
|
||||
_cargopacket_pool.CleanPool();
|
||||
}
|
||||
|
||||
CargoPacket::CargoPacket(StationID source, uint16 count)
|
||||
CargoPacket::CargoPacket(StationID source, uint16 count, SourceType source_type, SourceID source_id)
|
||||
{
|
||||
if (source != INVALID_STATION) assert(count != 0);
|
||||
|
||||
this->source = source;
|
||||
// this->feeder_share = 0; // no need to zero already zeroed data (by operator new)
|
||||
this->source_xy = (source != INVALID_STATION) ? Station::Get(source)->xy : 0;
|
||||
this->loaded_at_xy = this->source_xy;
|
||||
this->source = source;
|
||||
|
||||
this->count = count;
|
||||
this->days_in_transit = 0;
|
||||
this->feeder_share = 0;
|
||||
// this->days_in_transit = 0;
|
||||
|
||||
this->source_type = source_type;
|
||||
this->source_id = source_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Invalidates (sets source_id to INVALID_SOURCE) all cargo packets from given source
|
||||
* @param src_type type of source
|
||||
* @param src index of source
|
||||
*/
|
||||
/* static */ void CargoPacket::InvalidateAllFrom(SourceType src_type, SourceID src)
|
||||
{
|
||||
CargoPacket *cp;
|
||||
FOR_ALL_CARGOPACKETS(cp) {
|
||||
if (cp->source_type == src_type && cp->source_id == src) cp->source_id = INVALID_SOURCE;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -149,6 +165,9 @@ bool CargoList::MoveTo(CargoList *dest, uint count, CargoList::MoveToAction mta,
|
||||
cp_new->days_in_transit = cp->days_in_transit;
|
||||
cp_new->feeder_share = fs;
|
||||
|
||||
cp_new->source_type = cp->source_type;
|
||||
cp_new->source_id = cp->source_id;
|
||||
|
||||
cp_new->count = count;
|
||||
dest->packets.push_back(cp_new);
|
||||
|
||||
|
Reference in New Issue
Block a user