Changeset - r5688:886f58370749
[Not reviewed]
master
0 5 0
maedhros - 17 years ago 2007-01-15 22:18:35
maedhros@openttd.org
(svn r8151) -Feature: Automatically build semaphores before a configurable date, which can be set by each network player seperately.
5 files changed with 20 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/lang/english.txt
Show inline comments
 
@@ -1117,6 +1117,7 @@ STR_CONFIG_PATCHES_ENDING_YEAR          
 
STR_CONFIG_PATCHES_SMOOTH_ECONOMY                               :{LTBLUE}Enable smooth economy (more, smaller changes)
 
STR_CONFIG_PATCHES_ALLOW_SHARES                                 :{LTBLUE}Allow buying shares from other companies
 
STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY                         :{LTBLUE}When dragging, place signals every: {ORANGE}{STRING1} tile(s)
 
STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE                  :{LTBLUE}Automatically build semaphores before: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_TOOLBAR_POS                                  :{LTBLUE}Position of main toolbar: {ORANGE}{STRING1}
 
STR_CONFIG_PATCHES_TOOLBAR_POS_LEFT                             :Left
 
STR_CONFIG_PATCHES_TOOLBAR_POS_CENTER                           :Centre
src/rail_gui.cpp
Show inline comments
 
@@ -7,6 +7,7 @@
 
#include "table/sprites.h"
 
#include "table/strings.h"
 
#include "functions.h"
 
#include "date.h"
 
#include "map.h"
 
#include "tile.h"
 
#include "window.h"
 
@@ -181,7 +182,13 @@ static void GenericPlaceSignals(TileInde
 
	}
 

	
 
	if (!_remove_button_clicked) {
 
		DoCommandP(tile, i + (_ctrl_pressed ? 8 : 0), 0, CcPlaySound1E,
 
		uint32 p1 = _ctrl_pressed ? 8 : 0;
 
		if (!HasSignals(tile) && _cur_year < _patches.semaphore_build_before) {
 
			/* Reverse the logic, so semaphores are normally built, and light
 
			 * signals can be built with ctrl held down. */
 
			p1 = _ctrl_pressed ? 0 : 8;
 
		}
 
		DoCommandP(tile, i + p1, 0, CcPlaySound1E,
 
			CMD_BUILD_SIGNALS | CMD_AUTO | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE));
 
	} else {
 
		DoCommandP(tile, i, 0, CcPlaySound1E,
 
@@ -360,18 +367,25 @@ static void HandleAutoSignalPlacement(vo
 
{
 
	TileHighlightData *thd = &_thd;
 
	byte trackstat = thd->drawstyle & 0xF; // 0..5
 
	byte semaphore = _ctrl_pressed ? 1 : 0;
 

	
 
	if (thd->drawstyle == HT_RECT) { // one tile case
 
		GenericPlaceSignals(TileVirtXY(thd->selend.x, thd->selend.y));
 
		return;
 
	}
 

	
 
	if (!HasSignals(TileVirtXY(thd->selstart.x, thd->selstart.y)) && _cur_year < _patches.semaphore_build_before) {
 
		/* Reverse the logic, so semaphores are normally built, and light
 
		 * signals can be built with ctrl held down. */
 
		semaphore = _ctrl_pressed ? 0 : 1;
 
	}
 

	
 
	// _patches.drag_signals_density is given as a parameter such that each user in a network
 
	// game can specify his/her own signal density
 
	DoCommandP(
 
		TileVirtXY(thd->selstart.x, thd->selstart.y),
 
		TileVirtXY(thd->selend.x, thd->selend.y),
 
		(_ctrl_pressed ? 1 << 3 : 0) | (trackstat << 4) | (_patches.drag_signals_density << 24),
 
		(semaphore << 3) | (trackstat << 4) | (_patches.drag_signals_density << 24),
 
		CcPlaySound1E,
 
		_remove_button_clicked ?
 
			CMD_REMOVE_SIGNAL_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) :
src/settings.cpp
Show inline comments
 
@@ -1292,6 +1292,7 @@ const SettingDesc _patch_settings[] = {
 
	SDT_BOOL(Patches, signal_side,                   N, 0,  true,        STR_CONFIG_PATCHES_SIGNALSIDE,          RedrawScreen),
 
	SDT_BOOL(Patches, always_small_airport,          0, 0, false,        STR_CONFIG_PATCHES_SMALL_AIRPORTS,      NULL),
 
	 SDT_VAR(Patches, drag_signals_density,SLE_UINT8,S, 0,  4, 1, 20, 0, STR_CONFIG_PATCHES_DRAG_SIGNALS_DENSITY,NULL),
 
	 SDT_VAR(Patches, semaphore_build_before,SLE_INT32, S, NC, 1975, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_SEMAPHORE_BUILD_BEFORE_DATE, NULL),
 

	
 
	/***************************************************************************/
 
	/* Vehicle section of the GUI-configure patches window */
src/settings_gui.cpp
Show inline comments
 
@@ -585,6 +585,7 @@ static const char *_patches_construction
 
	"always_small_airport",
 
	"drag_signals_density",
 
	"oil_refinery_limit",
 
	"semaphore_build_before",
 
};
 

	
 
static const char *_patches_stations[] = {
src/variables.h
Show inline comments
 
@@ -186,6 +186,7 @@ typedef struct Patches {
 
	uint8 map_y;
 

	
 
	byte drag_signals_density;          // many signals density
 
	Year semaphore_build_before;        // Build semaphore signals automatically before this year
 
	bool ainew_active;                  // Is the new AI active?
 
	bool ai_in_multiplayer;             // Do we allow AIs in multiplayer
 

	
0 comments (0 inline, 0 general)