(svn r23147) -Change: [NewGRF v8] Unify the return values of boolean callbacks, and check the results for validity.

This commit is contained in:
frosch
2011-11-08 17:26:49 +00:00
parent b98c7763de
commit 30874b5e81
11 changed files with 90 additions and 28 deletions

View File

@@ -1187,8 +1187,9 @@ CommandCost CmdBuildRailStation(TileIndex tile_org, DoCommandFlag flags, uint32
}
/* Check if the station is buildable */
if (HasBit(statspec->callback_mask, CBM_STATION_AVAIL) && GB(GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE), 0, 8) == 0) {
return CMD_ERROR;
if (HasBit(statspec->callback_mask, CBM_STATION_AVAIL)) {
uint16 cb_res = GetStationCallback(CBID_STATION_AVAILABILITY, 0, 0, statspec, NULL, INVALID_TILE);
if (cb_res != CALLBACK_FAILED && !Convert8bitBooleanCallback(statspec->grf_prop.grffile, CBID_STATION_AVAILABILITY, cb_res)) return CMD_ERROR;
}
}