rail_cmd.c
changeset 889 7f8630bfea41
parent 826 0e2b569b737b
child 919 b0d6c7642f99
equal deleted inserted replaced
888:127b65c07558 889:7f8630bfea41
   540 {
   540 {
   541 	int sx, sy;
   541 	int sx, sy;
   542 	int32 ret, total_cost = 0;
   542 	int32 ret, total_cost = 0;
   543 	int railbit;
   543 	int railbit;
   544 
   544 
       
   545 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
       
   546 
   545 	if (flags & DC_EXEC)
   547 	if (flags & DC_EXEC)
   546 		SndPlayTileFx(SND_20_SPLAT_2, TILE_FROM_XY(x,y));
   548 		SndPlayTileFx(SND_20_SPLAT_2, TILE_FROM_XY(x,y));
   547 
   549 
   548 	/* unpack end point */
   550 	/* unpack end point */
   549 	sx = (p1 & 0xFFFF) & ~0xF;
   551 	sx = (p1 & 0xFFFF) & ~0xF;
   589 int32 CmdRemoveRailroadTrack(int x, int y, uint32 flags, uint32 p1, uint32 p2)
   591 int32 CmdRemoveRailroadTrack(int x, int y, uint32 flags, uint32 p1, uint32 p2)
   590 {
   592 {
   591 	int sx, sy;
   593 	int sx, sy;
   592 	int32 ret, total_cost = 0;
   594 	int32 ret, total_cost = 0;
   593 	int railbit;
   595 	int railbit;
       
   596 
       
   597 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
   594 
   598 
   595 	if (flags & DC_EXEC)
   599 	if (flags & DC_EXEC)
   596 		SndPlayTileFx(SND_20_SPLAT_2, TILE_FROM_XY(x,y));
   600 		SndPlayTileFx(SND_20_SPLAT_2, TILE_FROM_XY(x,y));
   597 
   601 
   598 	/* unpack start point */
   602 	/* unpack start point */
   818 }
   822 }
   819 
   823 
   820 int32 CmdRemoveTrainWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
   824 int32 CmdRemoveTrainWaypoint(int x, int y, uint32 flags, uint32 p1, uint32 p2)
   821 {
   825 {
   822 	uint tile = TILE_FROM_XY(x,y);
   826 	uint tile = TILE_FROM_XY(x,y);
       
   827 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
   823 	return RemoveTrainWaypoint(tile, flags, true);
   828 	return RemoveTrainWaypoint(tile, flags, true);
   824 }
   829 }
   825 
   830 
   826 
   831 
   827 // p1 = id of waypoint
   832 // p1 = id of waypoint
   972 	// for vertical/horizontal tracks, double the given signals density
   977 	// for vertical/horizontal tracks, double the given signals density
   973 	// since the original amount will be too dense (shorter tracks)
   978 	// since the original amount will be too dense (shorter tracks)
   974 	byte signal_density = (mode == 1 || mode == 2) ? (p2 >> 24) : (p2 >> 24) * 2;
   979 	byte signal_density = (mode == 1 || mode == 2) ? (p2 >> 24) : (p2 >> 24) * 2;
   975 	byte signals = (p2 >> 8)&0xFF;
   980 	byte signals = (p2 >> 8)&0xFF;
   976 	mode = p2 & 0x1;  // build/remove signals
   981 	mode = p2 & 0x1;  // build/remove signals
       
   982 
       
   983 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
   977 
   984 
   978 	/* unpack end tile */
   985 	/* unpack end tile */
   979 	ex = GET_TILE_X(p1)*16;
   986 	ex = GET_TILE_X(p1)*16;
   980 	ey = GET_TILE_Y(p1)*16;
   987 	ey = GET_TILE_Y(p1)*16;
   981 
   988 
  1131 // p2 = new railtype
  1138 // p2 = new railtype
  1132 int32 CmdConvertRail(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
  1139 int32 CmdConvertRail(int ex, int ey, uint32 flags, uint32 p1, uint32 p2)
  1133 {
  1140 {
  1134 	int32 ret, cost, money;
  1141 	int32 ret, cost, money;
  1135 	int sx,sy,x,y;
  1142 	int sx,sy,x,y;
       
  1143 
       
  1144 	SET_EXPENSES_TYPE(EXPENSES_CONSTRUCTION);
  1136 
  1145 
  1137 	// make sure sx,sy are smaller than ex,ey
  1146 	// make sure sx,sy are smaller than ex,ey
  1138 	sx = GET_TILE_X(p1)*16;
  1147 	sx = GET_TILE_X(p1)*16;
  1139 	sy = GET_TILE_Y(p1)*16;
  1148 	sy = GET_TILE_Y(p1)*16;
  1140 	if (ex < sx) intswap(ex, sx);
  1149 	if (ex < sx) intswap(ex, sx);