(svn r15434) -Codechange: bit of type safety for the DC_xxx flags.

This commit is contained in:
rubidium
2009-02-09 21:20:05 +00:00
parent cd0b38d234
commit d846eef0b6
42 changed files with 197 additions and 194 deletions

View File

@@ -303,7 +303,7 @@ static inline bool ValParamTrackOrientation(Track track) {return IsValidTrack(tr
* @param p1 railtype of being built piece (normal, mono, maglev)
* @param p2 rail track to build
*/
CommandCost CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdBuildSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Slope tileh;
RailType railtype = (RailType)p1;
@@ -442,7 +442,7 @@ CommandCost CmdBuildSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p
* @param p1 unused
* @param p2 rail orientation
*/
CommandCost CmdRemoveSingleRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdRemoveSingleRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Track track = (Track)p2;
TrackBits trackbit;
@@ -668,7 +668,7 @@ static CommandCost ValidateAutoDrag(Trackdir *trackdir, TileIndex start, TileInd
* - p2 = (bit 4-6) - track-orientation, valid values: 0-5 (Track enum)
* - p2 = (bit 7) - 0 = build, 1 = remove tracks
*/
static CommandCost CmdRailTrackHelper(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
static CommandCost CmdRailTrackHelper(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost ret, total_cost(EXPENSES_CONSTRUCTION);
Track track = (Track)GB(p2, 4, 3);
@@ -718,7 +718,7 @@ static CommandCost CmdRailTrackHelper(TileIndex tile, uint32 flags, uint32 p1, u
* - p2 = (bit 7) - 0 = build, 1 = remove tracks
* @see CmdRailTrackHelper
*/
CommandCost CmdBuildRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdBuildRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return CmdRailTrackHelper(tile, flags, p1, ClrBit(p2, 7), text);
}
@@ -734,7 +734,7 @@ CommandCost CmdBuildRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint3
* - p2 = (bit 7) - 0 = build, 1 = remove tracks
* @see CmdRailTrackHelper
*/
CommandCost CmdRemoveRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdRemoveRailroadTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return CmdRailTrackHelper(tile, flags, p1, SetBit(p2, 7), text);
}
@@ -748,7 +748,7 @@ CommandCost CmdRemoveRailroadTrack(TileIndex tile, uint32 flags, uint32 p1, uint
* @todo When checking for the tile slope,
* distingush between "Flat land required" and "land sloped in wrong direction"
*/
CommandCost CmdBuildTrainDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdBuildTrainDepot(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Slope tileh;
@@ -812,7 +812,7 @@ CommandCost CmdBuildTrainDepot(TileIndex tile, uint32 flags, uint32 p1, uint32 p
* @param p2 used for CmdBuildManySignals() to copy direction of first signal
* TODO: p2 should be replaced by two bits for "along" and "against" the track.
*/
CommandCost CmdBuildSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdBuildSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Track track = (Track)GB(p1, 0, 3);
bool ctrl_pressed = HasBit(p1, 3); // was the CTRL button pressed
@@ -1024,7 +1024,7 @@ static bool CheckSignalAutoFill(TileIndex &tile, Trackdir &trackdir, int &signal
* - p2 = (bit 7- 9) - default signal type
* - p2 = (bit 24-31) - user defined signals_density
*/
static CommandCost CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
static CommandCost CmdSignalTrackHelper(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost ret, total_cost(EXPENSES_CONSTRUCTION);
int signal_ctr;
@@ -1150,7 +1150,7 @@ static CommandCost CmdSignalTrackHelper(TileIndex tile, uint32 flags, uint32 p1,
* - p2 = (bit 24-31) - user defined signals_density
* @see CmdSignalTrackHelper
*/
CommandCost CmdBuildSignalTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdBuildSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return CmdSignalTrackHelper(tile, flags, p1, p2,text);
}
@@ -1164,7 +1164,7 @@ CommandCost CmdBuildSignalTrack(TileIndex tile, uint32 flags, uint32 p1, uint32
* - (bit 4) - 0 = signals, 1 = semaphores
* @param p2 unused
*/
CommandCost CmdRemoveSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdRemoveSingleSignal(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
Track track = (Track)GB(p1, 0, 3);
@@ -1219,7 +1219,7 @@ CommandCost CmdRemoveSingleSignal(TileIndex tile, uint32 flags, uint32 p1, uint3
* - p2 = (bit 24-31) - user defined signals_density
* @see CmdSignalTrackHelper
*/
CommandCost CmdRemoveSignalTrack(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdRemoveSignalTrack(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
return CmdSignalTrackHelper(tile, flags, p1, SetBit(p2, 5), text); // bit 5 is remove bit
}
@@ -1244,7 +1244,7 @@ Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data)
* @param p1 start tile of drag
* @param p2 new railtype to convert to
*/
CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, const char *text)
CommandCost CmdConvertRail(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
RailType totype = (RailType)p2;
@@ -1417,7 +1417,7 @@ CommandCost CmdConvertRail(TileIndex tile, uint32 flags, uint32 p1, uint32 p2, c
return (cost.GetCost() == 0) ? CMD_ERROR : cost;
}
static CommandCost RemoveTrainDepot(TileIndex tile, uint32 flags)
static CommandCost RemoveTrainDepot(TileIndex tile, DoCommandFlag flags)
{
if (!CheckTileOwnership(tile) && _current_company != OWNER_WATER)
return CMD_ERROR;
@@ -1446,7 +1446,7 @@ static CommandCost RemoveTrainDepot(TileIndex tile, uint32 flags)
return CommandCost(EXPENSES_CONSTRUCTION, _price.remove_train_depot);
}
static CommandCost ClearTile_Track(TileIndex tile, byte flags)
static CommandCost ClearTile_Track(TileIndex tile, DoCommandFlag flags)
{
CommandCost cost(EXPENSES_CONSTRUCTION);
CommandCost ret;
@@ -2547,7 +2547,7 @@ static CommandCost TestAutoslopeOnRailTile(TileIndex tile, uint flags, uint z_ol
return cost;
}
static CommandCost TerraformTile_Track(TileIndex tile, uint32 flags, uint z_new, Slope tileh_new)
static CommandCost TerraformTile_Track(TileIndex tile, DoCommandFlag flags, uint z_new, Slope tileh_new)
{
uint z_old;
Slope tileh_old = GetTileSlope(tile, &z_old);