Changeset - r19372:42adb924a732
[Not reviewed]
master
0 2 0
frosch - 12 years ago 2012-05-26 14:16:23
frosch@openttd.org
(svn r24287) -Feature [FS#2688]: News item for exclusive transport rights. (based on patch by Grantovich)
2 files changed with 11 insertions and 0 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -807,96 +807,98 @@ STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_OI
 
STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_FARM                      :{BIG_FONT}{BLACK}Improved farming methods at {INDUSTRY} are expected to double production!
 
STR_NEWS_INDUSTRY_PRODUCTION_INCREASE_SMOOTH                    :{BIG_FONT}{BLACK}{STRING} production at {INDUSTRY} increases {COMMA}%!
 
STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_GENERAL                   :{BIG_FONT}{BLACK}{INDUSTRY} production down by 50%
 
STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_FARM                      :{BIG_FONT}{BLACK}Insect infestation causes havoc at {INDUSTRY}!{}Production down by 50%
 
STR_NEWS_INDUSTRY_PRODUCTION_DECREASE_SMOOTH                    :{BIG_FONT}{BLACK}{STRING} production at {INDUSTRY} decreases {COMMA}%!
 

	
 
STR_NEWS_TRAIN_IS_WAITING                                       :{WHITE}{VEHICLE} is waiting in depot
 
STR_NEWS_ROAD_VEHICLE_IS_WAITING                                :{WHITE}{VEHICLE} is waiting in depot
 
STR_NEWS_SHIP_IS_WAITING                                        :{WHITE}{VEHICLE} is waiting in depot
 
STR_NEWS_AIRCRAFT_IS_WAITING                                    :{WHITE}{VEHICLE} is waiting in the aircraft hangar
 

	
 
# Start of order review system
 
# DON'T ADD OR REMOVE LINES HERE
 
STR_NEWS_VEHICLE_HAS_TOO_FEW_ORDERS                             :{WHITE}{VEHICLE} has too few orders in the schedule
 
STR_NEWS_VEHICLE_HAS_VOID_ORDER                                 :{WHITE}{VEHICLE} has a void order
 
STR_NEWS_VEHICLE_HAS_DUPLICATE_ENTRY                            :{WHITE}{VEHICLE} has duplicate orders
 
STR_NEWS_VEHICLE_HAS_INVALID_ENTRY                              :{WHITE}{VEHICLE} has an invalid station in its orders
 
# end of order system
 

	
 
STR_NEWS_VEHICLE_IS_GETTING_OLD                                 :{WHITE}{VEHICLE} is getting old
 
STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD                            :{WHITE}{VEHICLE} is getting very old
 
STR_NEWS_VEHICLE_IS_GETTING_VERY_OLD_AND                        :{WHITE}{VEHICLE} is getting very old and urgently needs replacing
 
STR_NEWS_TRAIN_IS_STUCK                                         :{WHITE}{VEHICLE} can't find a path to continue
 
STR_NEWS_VEHICLE_IS_LOST                                        :{WHITE}{VEHICLE} is lost
 
STR_NEWS_VEHICLE_IS_UNPROFITABLE                                :{WHITE}{VEHICLE}'s profit last year was {CURRENCY_LONG}
 
STR_NEWS_AIRCRAFT_DEST_TOO_FAR                                  :{WHITE}{VEHICLE} can't get to the next destination because it is out of range
 

	
 
STR_NEWS_ORDER_REFIT_FAILED                                     :{WHITE}{VEHICLE} stopped because an ordered refit failed
 
STR_NEWS_VEHICLE_AUTORENEW_FAILED                               :{WHITE}Autorenew failed on {VEHICLE}{}{STRING}
 

	
 
STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE                              :{BIG_FONT}{BLACK}New {STRING} now available!
 
STR_NEWS_NEW_VEHICLE_TYPE                                       :{BIG_FONT}{BLACK}{ENGINE}
 
STR_NEWS_NEW_VEHICLE_NOW_AVAILABLE_WITH_TYPE                    :{BLACK}New {STRING} now available!  -  {ENGINE}
 

	
 
STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO                        :{WHITE}{STATION} no longer accepts {STRING}
 
STR_NEWS_STATION_NO_LONGER_ACCEPTS_CARGO_OR_CARGO               :{WHITE}{STATION} no longer accepts {STRING} or {STRING}
 
STR_NEWS_STATION_NOW_ACCEPTS_CARGO                              :{WHITE}{STATION} now accepts {STRING}
 
STR_NEWS_STATION_NOW_ACCEPTS_CARGO_AND_CARGO                    :{WHITE}{STATION} now accepts {STRING} and {STRING}
 

	
 
STR_NEWS_OFFER_OF_SUBSIDY_EXPIRED                               :{BIG_FONT}{BLACK}Offer of subsidy expired:{}{}{STRING} from {STRING2} to {STRING2} will now not attract a subsidy
 
STR_NEWS_SUBSIDY_WITHDRAWN_SERVICE                              :{BIG_FONT}{BLACK}Subsidy withdrawn:{}{}{STRING} service from {STRING2} to {STRING2} is no longer subsidised
 
STR_NEWS_SERVICE_SUBSIDY_OFFERED                                :{BIG_FONT}{BLACK}Service subsidy offered:{}{}First {STRING} service from {STRING2} to {STRING2} will attract a year's subsidy from the local authority!
 
STR_NEWS_SERVICE_SUBSIDY_AWARDED_HALF                           :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay 50% extra for the next year!
 
STR_NEWS_SERVICE_SUBSIDY_AWARDED_DOUBLE                         :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay double rates for the next year!
 
STR_NEWS_SERVICE_SUBSIDY_AWARDED_TRIPLE                         :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay triple rates for the next year!
 
STR_NEWS_SERVICE_SUBSIDY_AWARDED_QUADRUPLE                      :{BIG_FONT}{BLACK}Service subsidy awarded to {RAW_STRING}!{}{}{STRING} service from {STRING2} to {STRING2} will pay quadruple rates for the next year!
 

	
 
STR_NEWS_ROAD_REBUILDING                                        :{BIG_FONT}{BLACK}Traffic chaos in {TOWN}!{}{}Road rebuilding programme funded by {RAW_STRING} brings 6 months of misery to motorists!
 
STR_NEWS_EXCLUSIVE_RIGHTS_TITLE                                 :{BIG_FONT}{BLACK}Transport monopoly!
 
STR_NEWS_EXCLUSIVE_RIGHTS_DESCRIPTION                           :{BIG_FONT}{BLACK}Local authority of {TOWN} signs contract with {RAW_STRING} for one year of exclusive transport rights!
 

	
 
# Extra view window
 
STR_EXTRA_VIEW_PORT_TITLE                                       :{WHITE}Viewport {COMMA}
 
STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN                                :{BLACK}Copy to viewport
 
STR_EXTRA_VIEW_MOVE_VIEW_TO_MAIN_TT                             :{BLACK}Copy the location of the main view to this viewport
 
STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW                                :{BLACK}Paste from viewport
 
STR_EXTRA_VIEW_MOVE_MAIN_TO_VIEW_TT                             :{BLACK}Paste the location of this viewport to the main view
 

	
 
# Game options window
 
STR_GAME_OPTIONS_CAPTION                                        :{WHITE}Game Options
 
STR_GAME_OPTIONS_CURRENCY_UNITS_FRAME                           :{BLACK}Currency units
 
STR_GAME_OPTIONS_CURRENCY_UNITS_DROPDOWN_TOOLTIP                :{BLACK}Currency units selection
 

	
 
############ start of currency region
 
STR_GAME_OPTIONS_CURRENCY_GBP                                   :British Pound (GBP)
 
STR_GAME_OPTIONS_CURRENCY_USD                                   :American Dollar (USD)
 
STR_GAME_OPTIONS_CURRENCY_EUR                                   :Euro (EUR)
 
STR_GAME_OPTIONS_CURRENCY_JPY                                   :Japanese Yen (JPY)
 
STR_GAME_OPTIONS_CURRENCY_ATS                                   :Austrian Shilling (ATS)
 
STR_GAME_OPTIONS_CURRENCY_BEF                                   :Belgian Franc (BEF)
 
STR_GAME_OPTIONS_CURRENCY_CHF                                   :Swiss Franc (CHF)
 
STR_GAME_OPTIONS_CURRENCY_CZK                                   :Czech Koruna (CZK)
 
STR_GAME_OPTIONS_CURRENCY_DEM                                   :Deutschmark (DEM)
 
STR_GAME_OPTIONS_CURRENCY_DKK                                   :Danish Krone (DKK)
 
STR_GAME_OPTIONS_CURRENCY_ESP                                   :Spanish Peseta (ESP)
 
STR_GAME_OPTIONS_CURRENCY_FIM                                   :Finnish Markka (FIM)
 
STR_GAME_OPTIONS_CURRENCY_FRF                                   :French Franc (FRF)
 
STR_GAME_OPTIONS_CURRENCY_GRD                                   :Greek Drachma (GRD)
 
STR_GAME_OPTIONS_CURRENCY_HUF                                   :Hungarian Forint (HUF)
 
STR_GAME_OPTIONS_CURRENCY_ISK                                   :Icelandic Krona (ISK)
 
STR_GAME_OPTIONS_CURRENCY_ITL                                   :Italian Lira (ITL)
 
STR_GAME_OPTIONS_CURRENCY_NLG                                   :Dutch Guilder (NLG)
 
STR_GAME_OPTIONS_CURRENCY_NOK                                   :Norwegian Krone (NOK)
 
STR_GAME_OPTIONS_CURRENCY_PLN                                   :Polish Złoty (PLN)
 
STR_GAME_OPTIONS_CURRENCY_RON                                   :Romanian Leu (RON)
 
STR_GAME_OPTIONS_CURRENCY_RUR                                   :Russian Rubles (RUR)
 
STR_GAME_OPTIONS_CURRENCY_SIT                                   :Slovenian Tolar (SIT)
 
STR_GAME_OPTIONS_CURRENCY_SEK                                   :Swedish Krona (SEK)
 
STR_GAME_OPTIONS_CURRENCY_TRY                                   :Turkish Lira (TRY)
 
STR_GAME_OPTIONS_CURRENCY_SKK                                   :Slovak Koruna (SKK)
 
STR_GAME_OPTIONS_CURRENCY_BRL                                   :Brazilian Real (BRL)
 
STR_GAME_OPTIONS_CURRENCY_EEK                                   :Estonian Krooni (EEK)
 
STR_GAME_OPTIONS_CURRENCY_LTL                                   :Lithuanian Litas (LTL)
 
STR_GAME_OPTIONS_CURRENCY_KRW                                   :South Korean Won (KRW)
 
STR_GAME_OPTIONS_CURRENCY_ZAR                                   :South African Rand (ZAR)
 
STR_GAME_OPTIONS_CURRENCY_CUSTOM                                :Custom...
 
############ end of currency region
 

	
src/town_cmd.cpp
Show inline comments
 
@@ -2779,96 +2779,105 @@ static CommandCost TownActionBuildStatue
 
{
 
	if (!Object::CanAllocateItem()) return_cmd_error(STR_ERROR_TOO_MANY_OBJECTS);
 

	
 
	TileIndex tile = t->xy;
 
	StatueBuildSearchData statue_data(INVALID_TILE, 0);
 
	if (!CircularTileSearch(&tile, 9, SearchTileForStatue, &statue_data)) return_cmd_error(STR_ERROR_STATUE_NO_SUITABLE_PLACE);
 

	
 
	if (flags & DC_EXEC) {
 
		Backup<CompanyByte> cur_company(_current_company, OWNER_NONE, FILE_LINE);
 
		DoCommand(statue_data.best_position, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
 
		cur_company.Restore();
 
		BuildObject(OBJECT_STATUE, statue_data.best_position, _current_company, t);
 
		SetBit(t->statues, _current_company); // Once found and built, "inform" the Town.
 
		MarkTileDirtyByTile(statue_data.best_position);
 
	}
 
	return CommandCost();
 
}
 

	
 
static CommandCost TownActionFundBuildings(Town *t, DoCommandFlag flags)
 
{
 
	/* Check if it's allowed to buy the rights */
 
	if (!_settings_game.economy.fund_buildings) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
 
		/* Build next tick */
 
		t->grow_counter = 1;
 
		/* If we were not already growing */
 
		SetBit(t->flags, TOWN_IS_FUNDED);
 
		/* And grow for 3 months */
 
		t->fund_buildings_months = 3;
 

	
 
		SetWindowDirty(WC_TOWN_VIEW, t->index);
 
	}
 
	return CommandCost();
 
}
 

	
 
static CommandCost TownActionBuyRights(Town *t, DoCommandFlag flags)
 
{
 
	/* Check if it's allowed to buy the rights */
 
	if (!_settings_game.economy.exclusive_rights) return CMD_ERROR;
 

	
 
	if (flags & DC_EXEC) {
 
		t->exclusive_counter = 12;
 
		t->exclusivity = _current_company;
 

	
 
		ModifyStationRatingAround(t->xy, _current_company, 130, 17);
 

	
 
		SetWindowClassesDirty(WC_STATION_VIEW);
 

	
 
		/* Spawn news message */
 
		CompanyNewsInformation *cni = MallocT<CompanyNewsInformation>(1);
 
		cni->FillData(Company::Get(_current_company));
 
		SetDParam(0, STR_NEWS_EXCLUSIVE_RIGHTS_TITLE);
 
		SetDParam(1, STR_NEWS_EXCLUSIVE_RIGHTS_DESCRIPTION);
 
		SetDParam(2, t->index);
 
		SetDParamStr(3, cni->company_name);
 
		AddNewsItem(STR_MESSAGE_NEWS_FORMAT, NT_GENERAL, NF_COMPANY, NR_TOWN, t->index, NR_NONE, UINT32_MAX, cni);
 
	}
 
	return CommandCost();
 
}
 

	
 
static CommandCost TownActionBribe(Town *t, DoCommandFlag flags)
 
{
 
	if (flags & DC_EXEC) {
 
		if (Chance16(1, 14)) {
 
			/* set as unwanted for 6 months */
 
			t->unwanted[_current_company] = 6;
 

	
 
			/* set all close by station ratings to 0 */
 
			Station *st;
 
			FOR_ALL_STATIONS(st) {
 
				if (st->town == t && st->owner == _current_company) {
 
					for (CargoID i = 0; i < NUM_CARGO; i++) st->goods[i].rating = 0;
 
				}
 
			}
 

	
 
			/* only show errormessage to the executing player. All errors are handled command.c
 
			 * but this is special, because it can only 'fail' on a DC_EXEC */
 
			if (IsLocalCompany()) ShowErrorMessage(STR_ERROR_BRIBE_FAILED, INVALID_STRING_ID, WL_INFO);
 

	
 
			/* decrease by a lot!
 
			 * ChangeTownRating is only for stuff in demolishing. Bribe failure should
 
			 * be independent of any cheat settings
 
			 */
 
			if (t->ratings[_current_company] > RATING_BRIBE_DOWN_TO) {
 
				t->ratings[_current_company] = RATING_BRIBE_DOWN_TO;
 
				SetWindowDirty(WC_TOWN_AUTHORITY, t->index);
 
			}
 
		} else {
 
			ChangeTownRating(t, RATING_BRIBE_UP_STEP, RATING_BRIBE_MAXIMUM, DC_EXEC);
 
		}
 
	}
 
	return CommandCost();
 
}
 

	
 
typedef CommandCost TownActionProc(Town *t, DoCommandFlag flags);
 
static TownActionProc * const _town_action_proc[] = {
 
	TownActionAdvertiseSmall,
 
	TownActionAdvertiseMedium,
 
	TownActionAdvertiseLarge,
 
	TownActionRoadRebuild,
 
	TownActionBuildStatue,
 
	TownActionFundBuildings,
 
	TownActionBuyRights,
 
	TownActionBribe
0 comments (0 inline, 0 general)