Changeset - r59:034fc567bd50
[Not reviewed]
master
0 3 0
darkvater - 20 years ago 2004-08-15 21:10:08
darkvater@openttd.org
(svn r60) -Fix: signal_density is given as a parameter to autosignal. This means all players can define it for themselves.
-Fix a few warnings
3 files changed with 16 insertions and 15 deletions:
0 comments (0 inline, 0 general)
rail_cmd.c
Show inline comments
 
@@ -918,9 +918,9 @@ int32 CmdBuildSignals(int x, int y, uint
 
			/* If CmdBuildManySignals is called with copying signals, just copy the style of the first signal
 
			* given as parameter by CmdBuildManySignals */
 
			switch (track) {
 
			case 2: case 4: _map3_lo[tile] = (p2&0xC0) | _map3_lo[tile]&~0xC0; break;
 
			case 3: case 5: _map3_lo[tile] = (p2&0x30) | _map3_lo[tile]&~0x30; break;
 
			default : _map3_lo[tile] = (p2&0xF0) | _map3_lo[tile]&0xF;
 
			case 2: case 4: _map3_lo[tile] = (p2&0xC0) | (_map3_lo[tile]&~0xC0); break;
 
			case 3: case 5: _map3_lo[tile] = (p2&0x30) | (_map3_lo[tile]&~0x30); break;
 
			default : _map3_lo[tile] = (p2&0xF0) | (_map3_lo[tile]&0xF);
 
			}
 
			// convert between signal<->semaphores when dragging
 
			HASBIT(p1, 3) ? SETBIT(_map3_hi[tile], 2) : CLRBIT(_map3_hi[tile], 2);
 
@@ -936,10 +936,11 @@ int32 CmdBuildSignals(int x, int y, uint
 
/*	Build many signals by dragging: AutoSignals
 
		x,y= start tile
 
		p1 = end tile
 
		p2 = (byte 0)		- 0 = build, 1 = remove signals
 
		p2 = (byte 3)		- 0 = signals, 1 = semaphores
 
		p2 = (byte 7-4)	- track-orientation
 
		p2 = (byte 8-)	- track style
 
		p2 = (byte 0)			- 0 = build, 1 = remove signals
 
		p2 = (byte 3)			- 0 = signals, 1 = semaphores
 
		p2 = (byte 7-4)		- track-orientation
 
		p2 = (byte 8-)		- track style
 
		p2 = (byte 24-31)	- user defined signals_density
 
 */
 
int32 CmdBuildManySignals(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 
{
 
@@ -951,8 +952,8 @@ int32 CmdBuildManySignals(int x, int y, 
 
	int mode = (p2 >> 4)&0xF;
 
	// for vertical/horizontal tracks, double the given signals density
 
	// since the original amount will be too dense (shorter tracks)
 
	byte signal_density = (mode == 1 || mode == 2) ? _patches.drag_signals_density : _patches.drag_signals_density * 2;
 
	byte signals = p2 >> 8;
 
	byte signal_density = (mode == 1 || mode == 2) ? (p2 >> 24) : (p2 >> 24) * 2;
 
	byte signals = (p2 >> 8)&0xFF;
 
	mode = p2 & 0x1;  // build/remove signals
 

	
 
	/* unpack end tile */
 
@@ -974,13 +975,13 @@ int32 CmdBuildManySignals(int x, int y, 
 
					if (_map3_lo[tile]&0x30) 
 
						signals = _map3_lo[tile]&0x30;
 
					else
 
						signals = 0x30 | _map3_lo[tile]&0xC0;
 
						signals = 0x30 | (_map3_lo[tile]&0xC0);
 
					break;
 
				case 0x10: case 4: /* west corner (N-S), north corner (W-E) */
 
					if (_map3_lo[tile]&0xC0) 
 
						signals = _map3_lo[tile]&0xC0;
 
					else
 
						signals = 0xC0 | _map3_lo[tile]&0x30;
 
						signals = 0xC0 | (_map3_lo[tile]&0x30);
 
					break;
 
			}
 
		}
rail_gui.c
Show inline comments
 
@@ -516,7 +516,7 @@ static void HandleAutodirPlacement()
 
static void HandleAutoSignalPlacement()
 
{
 
	TileHighlightData *thd = &_thd;
 
	int mode;
 
	int mode = 0;
 
	uint trackstat = 0;
 

	
 
	int dx = thd->selstart.x - (thd->selend.x&~0xF);
 
@@ -541,8 +541,10 @@ static void HandleAutoSignalPlacement()
 
				trackstat = (thd->drawstyle & 1) ? 4 : 8;
 
		}
 

	
 
		/* _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(TILE_FROM_XY(thd->selstart.x, thd->selstart.y), TILE_FROM_XY(thd->selend.x, thd->selend.y), 
 
		(mode << 4) | (_remove_button_clicked + (_ctrl_pressed ? 8 : 0)) | (trackstat << 8), 
 
		(mode << 4) | (_remove_button_clicked + (_ctrl_pressed ? 8 : 0)) | (trackstat << 8) | (_patches.drag_signals_density << 24), 
 
		CcPlaySound1E, 
 
		(_remove_button_clicked ?	CMD_BUILD_MANY_SIGNALS | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) :
 
															CMD_BUILD_MANY_SIGNALS | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE) ) );									
station_cmd.c
Show inline comments
 
@@ -63,8 +63,6 @@ static Station *GetStationAround(uint ti
 

	
 
TileIndex GetStationTileForVehicle(Vehicle *v, Station *st)
 
{
 
	TileIndex required_tile=0;
 

	
 
	switch (v->type) {
 
		case VEH_Train: 		return st->train_tile;
 
		case VEH_Aircraft:	return st->airport_tile;
0 comments (0 inline, 0 general)