src/rail_gui.cpp
changeset 5947 45b168de41f3
parent 5939 77530457a36b
child 5982 54218ea5af1e
equal deleted inserted replaced
5946:ca8d7faa51e5 5947:45b168de41f3
   181 		for (; !(trackstat & 1); trackstat >>= 1) i++;
   181 		for (; !(trackstat & 1); trackstat >>= 1) i++;
   182 	}
   182 	}
   183 
   183 
   184 	if (!_remove_button_clicked) {
   184 	if (!_remove_button_clicked) {
   185 		uint32 p1 = _ctrl_pressed ? 8 : 0;
   185 		uint32 p1 = _ctrl_pressed ? 8 : 0;
   186 		if (!HasSignals(tile) && _cur_year < _patches.semaphore_build_before) {
   186 		if (IsTileType(tile, MP_RAILWAY) && !HasSignals(tile) && _cur_year < _patches.semaphore_build_before) {
   187 			/* Reverse the logic, so semaphores are normally built, and light
   187 			/* Reverse the logic, so semaphores are normally built, and light
   188 			 * signals can be built with ctrl held down. */
   188 			 * signals can be built with ctrl held down. */
   189 			p1 = _ctrl_pressed ? 0 : 8;
   189 			p1 = _ctrl_pressed ? 0 : 8;
   190 		}
   190 		}
   191 		DoCommandP(tile, i + p1, 0, CcPlaySound1E,
   191 		DoCommandP(tile, i + p1, 0, CcPlaySound1E,
   372 	if (thd->drawstyle == HT_RECT) { // one tile case
   372 	if (thd->drawstyle == HT_RECT) { // one tile case
   373 		GenericPlaceSignals(TileVirtXY(thd->selend.x, thd->selend.y));
   373 		GenericPlaceSignals(TileVirtXY(thd->selend.x, thd->selend.y));
   374 		return;
   374 		return;
   375 	}
   375 	}
   376 
   376 
   377 	if (!HasSignals(TileVirtXY(thd->selstart.x, thd->selstart.y)) && _cur_year < _patches.semaphore_build_before) {
   377 	TileIndex start_tile = TileVirtXY(thd->selstart.x, thd->selstart.y);
       
   378 	if (IsTileType(start_tile, MP_RAILWAY) && !HasSignals(start_tile) && _cur_year < _patches.semaphore_build_before) {
   378 		/* Reverse the logic, so semaphores are normally built, and light
   379 		/* Reverse the logic, so semaphores are normally built, and light
   379 		 * signals can be built with ctrl held down. */
   380 		 * signals can be built with ctrl held down. */
   380 		semaphore = _ctrl_pressed ? 0 : 1;
   381 		semaphore = _ctrl_pressed ? 0 : 1;
   381 	}
   382 	}
   382 
   383 
   383 	// _patches.drag_signals_density is given as a parameter such that each user in a network
   384 	// _patches.drag_signals_density is given as a parameter such that each user in a network
   384 	// game can specify his/her own signal density
   385 	// game can specify his/her own signal density
   385 	DoCommandP(
   386 	DoCommandP(
   386 		TileVirtXY(thd->selstart.x, thd->selstart.y),
   387 		start_tile,
   387 		TileVirtXY(thd->selend.x, thd->selend.y),
   388 		TileVirtXY(thd->selend.x, thd->selend.y),
   388 		(semaphore << 3) | (trackstat << 4) | (_patches.drag_signals_density << 24),
   389 		(semaphore << 3) | (trackstat << 4) | (_patches.drag_signals_density << 24),
   389 		CcPlaySound1E,
   390 		CcPlaySound1E,
   390 		_remove_button_clicked ?
   391 		_remove_button_clicked ?
   391 			CMD_REMOVE_SIGNAL_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) :
   392 			CMD_REMOVE_SIGNAL_TRACK | CMD_AUTO | CMD_NO_WATER | CMD_MSG(STR_1013_CAN_T_REMOVE_SIGNALS_FROM) :