(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
This commit is contained in:
		
							
								
								
									
										23
									
								
								rail_cmd.c
									
									
									
									
									
								
							
							
						
						
									
										23
									
								
								rail_cmd.c
									
									
									
									
									
								
							@@ -918,9 +918,9 @@ int32 CmdBuildSignals(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
				
			|||||||
			/* If CmdBuildManySignals is called with copying signals, just copy the style of the first signal
 | 
								/* If CmdBuildManySignals is called with copying signals, just copy the style of the first signal
 | 
				
			||||||
			* given as parameter by CmdBuildManySignals */
 | 
								* given as parameter by CmdBuildManySignals */
 | 
				
			||||||
			switch (track) {
 | 
								switch (track) {
 | 
				
			||||||
			case 2: case 4: _map3_lo[tile] = (p2&0xC0) | _map3_lo[tile]&~0xC0; break;
 | 
								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;
 | 
								case 3: case 5: _map3_lo[tile] = (p2&0x30) | (_map3_lo[tile]&~0x30); break;
 | 
				
			||||||
			default : _map3_lo[tile] = (p2&0xF0) | _map3_lo[tile]&0xF;
 | 
								default : _map3_lo[tile] = (p2&0xF0) | (_map3_lo[tile]&0xF);
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			// convert between signal<->semaphores when dragging
 | 
								// convert between signal<->semaphores when dragging
 | 
				
			||||||
			HASBIT(p1, 3) ? SETBIT(_map3_hi[tile], 2) : CLRBIT(_map3_hi[tile], 2);
 | 
								HASBIT(p1, 3) ? SETBIT(_map3_hi[tile], 2) : CLRBIT(_map3_hi[tile], 2);
 | 
				
			||||||
@@ -936,10 +936,11 @@ int32 CmdBuildSignals(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
				
			|||||||
/*	Build many signals by dragging: AutoSignals
 | 
					/*	Build many signals by dragging: AutoSignals
 | 
				
			||||||
		x,y= start tile
 | 
							x,y= start tile
 | 
				
			||||||
		p1 = end tile
 | 
							p1 = end tile
 | 
				
			||||||
		p2 = (byte 0)		- 0 = build, 1 = remove signals
 | 
							p2 = (byte 0)			- 0 = build, 1 = remove signals
 | 
				
			||||||
		p2 = (byte 3)		- 0 = signals, 1 = semaphores
 | 
							p2 = (byte 3)			- 0 = signals, 1 = semaphores
 | 
				
			||||||
		p2 = (byte 7-4)	- track-orientation
 | 
							p2 = (byte 7-4)		- track-orientation
 | 
				
			||||||
		p2 = (byte 8-)	- track style
 | 
							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)
 | 
					int32 CmdBuildManySignals(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
@@ -951,8 +952,8 @@ int32 CmdBuildManySignals(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
				
			|||||||
	int mode = (p2 >> 4)&0xF;
 | 
						int mode = (p2 >> 4)&0xF;
 | 
				
			||||||
	// for vertical/horizontal tracks, double the given signals density
 | 
						// for vertical/horizontal tracks, double the given signals density
 | 
				
			||||||
	// since the original amount will be too dense (shorter tracks)
 | 
						// 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 signal_density = (mode == 1 || mode == 2) ? (p2 >> 24) : (p2 >> 24) * 2;
 | 
				
			||||||
	byte signals = p2 >> 8;
 | 
						byte signals = (p2 >> 8)&0xFF;
 | 
				
			||||||
	mode = p2 & 0x1;  // build/remove signals
 | 
						mode = p2 & 0x1;  // build/remove signals
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* unpack end tile */
 | 
						/* unpack end tile */
 | 
				
			||||||
@@ -974,13 +975,13 @@ int32 CmdBuildManySignals(int x, int y, uint32 flags, uint32 p1, uint32 p2)
 | 
				
			|||||||
					if (_map3_lo[tile]&0x30) 
 | 
										if (_map3_lo[tile]&0x30) 
 | 
				
			||||||
						signals = _map3_lo[tile]&0x30;
 | 
											signals = _map3_lo[tile]&0x30;
 | 
				
			||||||
					else
 | 
										else
 | 
				
			||||||
						signals = 0x30 | _map3_lo[tile]&0xC0;
 | 
											signals = 0x30 | (_map3_lo[tile]&0xC0);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
				case 0x10: case 4: /* west corner (N-S), north corner (W-E) */
 | 
									case 0x10: case 4: /* west corner (N-S), north corner (W-E) */
 | 
				
			||||||
					if (_map3_lo[tile]&0xC0) 
 | 
										if (_map3_lo[tile]&0xC0) 
 | 
				
			||||||
						signals = _map3_lo[tile]&0xC0;
 | 
											signals = _map3_lo[tile]&0xC0;
 | 
				
			||||||
					else
 | 
										else
 | 
				
			||||||
						signals = 0xC0 | _map3_lo[tile]&0x30;
 | 
											signals = 0xC0 | (_map3_lo[tile]&0x30);
 | 
				
			||||||
					break;
 | 
										break;
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -516,7 +516,7 @@ static void HandleAutodirPlacement()
 | 
				
			|||||||
static void HandleAutoSignalPlacement()
 | 
					static void HandleAutoSignalPlacement()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	TileHighlightData *thd = &_thd;
 | 
						TileHighlightData *thd = &_thd;
 | 
				
			||||||
	int mode;
 | 
						int mode = 0;
 | 
				
			||||||
	uint trackstat = 0;
 | 
						uint trackstat = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	int dx = thd->selstart.x - (thd->selend.x&~0xF);
 | 
						int dx = thd->selstart.x - (thd->selend.x&~0xF);
 | 
				
			||||||
@@ -541,8 +541,10 @@ static void HandleAutoSignalPlacement()
 | 
				
			|||||||
				trackstat = (thd->drawstyle & 1) ? 4 : 8;
 | 
									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), 
 | 
							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, 
 | 
							CcPlaySound1E, 
 | 
				
			||||||
		(_remove_button_clicked ?	CMD_BUILD_MANY_SIGNALS | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) :
 | 
							(_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) ) );									
 | 
																				CMD_BUILD_MANY_SIGNALS | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1010_CAN_T_BUILD_SIGNALS_HERE) ) );									
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -63,8 +63,6 @@ static Station *GetStationAround(uint tile, int w, int h, int closest_station)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
TileIndex GetStationTileForVehicle(Vehicle *v, Station *st)
 | 
					TileIndex GetStationTileForVehicle(Vehicle *v, Station *st)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	TileIndex required_tile=0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	switch (v->type) {
 | 
						switch (v->type) {
 | 
				
			||||||
		case VEH_Train: 		return st->train_tile;
 | 
							case VEH_Train: 		return st->train_tile;
 | 
				
			||||||
		case VEH_Aircraft:	return st->airport_tile;
 | 
							case VEH_Aircraft:	return st->airport_tile;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user