subsidy.cpp File Reference

Handling of subsidies. More...

#include "stdafx.h"
#include "company_func.h"
#include "industry.h"
#include "town.h"
#include "news_func.h"
#include "ai/ai.hpp"
#include "station_base.h"
#include "cargotype.h"
#include "strings_func.h"
#include "window_func.h"
#include "subsidy_base.h"
#include "subsidy_func.h"
#include "core/pool_func.hpp"
#include "table/strings.h"

Go to the source code of this file.

Functions

SubsidyPool _subsidy_pool ("Subsidy")
void InitializeSubsidies ()
 Initializes subsidies, files don't have to include subsidy_base,h this way.
Pair SetupSubsidyDecodeParam (const Subsidy *s, bool mode)
static void SetPartOfSubsidyFlag (SourceType type, SourceID index, PartOfSubsidy flag)
 Sets a flag indicating that given town/industry is part of subsidised route.
void RebuildSubsidisedSourceAndDestinationCache ()
void DeleteSubsidyWith (SourceType type, SourceID index)
static bool CheckSubsidyDuplicate (CargoID cargo, SourceType src_type, SourceID src, SourceType dst_type, SourceID dst)
static SubsidyFindSubsidyPassengerRoute ()
static SubsidyFindSubsidyCargoRoute ()
void SubsidyMonthlyLoop ()
bool CheckSubsidised (CargoID cargo_type, CompanyID company, SourceType src_type, SourceID src, const Station *st)
 Tests whether given delivery is subsidised and possibly awards the subsidy to delivering company.


Detailed Description

Handling of subsidies.

Definition in file subsidy.cpp.


Function Documentation

bool CheckSubsidised ( CargoID  cargo_type,
CompanyID  company,
SourceType  src_type,
SourceID  src,
const Station st 
)

Tests whether given delivery is subsidised and possibly awards the subsidy to delivering company.

Parameters:
cargo_type type of cargo
company company delivering the cargo
src_type type of src
src index of source
st station where the cargo is delivered to
Returns:
is the delivery subsidised?

Definition at line 329 of file subsidy.cpp.

References Subsidy::awarded, Subsidy::AwardTo(), SmallVector< T, S >::Begin(), Rect::bottom, Subsidy::cargo_type, Subsidy::dst, Subsidy::dst_type, SmallVector< T, S >::End(), Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::Get(), Station::GetCatchmentRect(), SmallVector< T, S >::Include(), Station::industries_near, INVALID_SOURCE, Subsidy::IsAwarded(), StationRect::IsEmpty(), IsTileType(), Rect::left, MP_HOUSE, POS_DST, POS_SRC, BaseStation::rect, Rect::right, Subsidy::src, Subsidy::src_type, ST_INDUSTRY, ST_TOWN, TileXY(), and Rect::top.

Referenced by DeliverGoods().

static void SetPartOfSubsidyFlag ( SourceType  type,
SourceID  index,
PartOfSubsidy  flag 
) [inline, static]

Sets a flag indicating that given town/industry is part of subsidised route.

Parameters:
type is it a town or an industry?
index index of town/industry
flag flag to set

Definition at line 117 of file subsidy.cpp.

References Pool< Titem, Tindex, Tgrowth_step, Tmax_size, Tcache, Tzero >::PoolItem< Tpool >::Get(), ST_INDUSTRY, and ST_TOWN.


Generated on Wed Dec 30 20:40:18 2009 for OpenTTD by  doxygen 1.5.6