1
0
Fork 0

(svn r16310) [0.7] -Backport from trunk:

- Fix: Parameter is invalid when it is equal to length of an array (r16308)
- Fix: Close all windows before unloading the AI system as closing the content-download window will rescan for AIs [FS#2901] (r16306)
- Fix: ICC (Intel C++ Compiler) defined __GNUC__ but does not define __builtin_bswap32, so fall back to the default swap method for ICC (r16295)
- Fix: Road vehicles were unable to find a depot when turning around (in some cases), causing 'nearest depot' orders to be occasionally lost [FS#2893] (r16291
release/0.7
rubidium 2009-05-15 10:24:13 +00:00
parent 30eff93341
commit 085b498c28
7 changed files with 45 additions and 23 deletions

View File

@ -815,6 +815,7 @@ check_params() {
fi
if [ "$os" = "OSX" ]; then
check_osx_sdk
# Test on G5
if [ "$enable_osx_g5" != "0" ]; then
@ -1617,6 +1618,30 @@ set_universal_binary_flags() {
fi
}
check_osx_sdk() {
cat > tmp.osx.cpp << EOF
#include <AvailabilityMacros.h>
#if !defined(MAC_OS_X_VERSION_10_5)
# error "Need newer SDK"
#endif
int main() {
return 0;
}
EOF
execute="$cxx_host $CFLAGS -E tmp.osx.cpp -o - 2>&1"
eval $execute > /dev/null
ret=$?
log 2 "executing $execute"
log 2 " exit code $ret"
rm -f tmp.osx.cpp
if [ "$ret" != "0" ]; then
log 1 "I couldn't detect any XCode >= 2.5 on your system"
log 1 "please install/upgrade your XCode"
exit 1
fi
}
check_direct_music() {
echo "
#include <windows.h>
@ -2601,31 +2626,31 @@ make_sed() {
if [ "$icon_theme_dir" != "" ]; then
SRC_REPLACE="$SRC_REPLACE
s#!!ICON_THEME_DIR!!#$prefix_dir/$icon_theme_dir#g;
s~!!ICON_THEME_DIR!!~$prefix_dir/$icon_theme_dir~g;
"
else
SRC_REPLACE="$SRC_REPLACE
s#!!ICON_THEME_DIR!!##g;
s~!!ICON_THEME_DIR!!~~g;
"
fi
if [ "$man_dir" != "" ]; then
SRC_REPLACE="$SRC_REPLACE
s#!!MAN_DIR!!#$prefix_dir/$man_dir#g;
s~!!MAN_DIR!!~$prefix_dir/$man_dir~g;
"
else
SRC_REPLACE="$SRC_REPLACE
s#!!MAN_DIR!!##g;
s~!!MAN_DIR!!~~g;
"
fi
if [ "$menu_dir" != "" ]; then
SRC_REPLACE="$SRC_REPLACE
s#!!MENU_DIR!!#$prefix_dir/$menu_dir#g;
s~!!MENU_DIR!!~$prefix_dir/$menu_dir~g;
"
else
SRC_REPLACE="$SRC_REPLACE
s#!!MENU_DIR!!##g;
s~!!MENU_DIR!!~~g;
"
fi
}

View File

@ -318,7 +318,7 @@ static FORCEINLINE T ROR(const T x, const uint8 n)
*/
static FORCEINLINE uint32 BSWAP32(uint32 x)
{
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ >= 3))
#if !defined(__ICC) && defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && __GNUC_MINOR__ >= 3))
/* GCC >= 4.3 provides a builtin, resulting in faster code */
return (uint32)__builtin_bswap32((int32)x);
#else

View File

@ -300,9 +300,6 @@ static void InitializeDynamicVariables()
*/
static void ShutdownGame()
{
/* stop the AI */
AI::Uninitialize(false);
IConsoleFree();
if (_network_available) NetworkShutDown(); // Shut down the network and close any open connections
@ -311,6 +308,9 @@ static void ShutdownGame()
UnInitWindowSystem();
/* stop the AI */
AI::Uninitialize(false);
/* Uninitialize airport state machines */
UnInitializeAirports();

View File

@ -1820,7 +1820,7 @@ CommandCost CmdBuildAirport(TileIndex tile, DoCommandFlag flags, uint32 p1, uint
if (distant_join && (!_settings_game.station.distant_join_stations || !IsValidStationID(station_to_join))) return CMD_ERROR;
/* Check if a valid, buildable airport was chosen for construction */
if (p1 > lengthof(_airport_sections) || !HasBit(GetValidAirports(), p1)) return CMD_ERROR;
if (p1 >= lengthof(_airport_sections) || !HasBit(GetValidAirports(), p1)) return CMD_ERROR;
if (!CheckIfAuthorityAllowsNewStation(tile, flags)) {
return CMD_ERROR;

View File

@ -60,11 +60,9 @@ static void GenerateDesertArea(TileIndex end, TileIndex start)
_generating_world = true;
BEGIN_TILE_LOOP(tile, size_x, size_y, TileXY(sx, sy)) {
if (GetTileType(tile) != MP_WATER) {
SetTropicZone(tile, (_ctrl_pressed) ? TROPICZONE_NORMAL : TROPICZONE_DESERT);
DoCommandP(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
MarkTileDirtyByTile(tile);
}
SetTropicZone(tile, (_ctrl_pressed) ? TROPICZONE_NORMAL : TROPICZONE_DESERT);
DoCommandP(tile, 0, 0, CMD_LANDSCAPE_CLEAR);
MarkTileDirtyByTile(tile);
} END_TILE_LOOP(tile, size_x, size_y, 0);
_generating_world = false;
}

View File

@ -2429,7 +2429,7 @@ uint GetMaskOfTownActions(int *nump, CompanyID cid, const Town *t)
*/
CommandCost CmdDoTownAction(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32 p2, const char *text)
{
if (!IsValidTownID(p1) || p2 > lengthof(_town_action_proc)) return CMD_ERROR;
if (!IsValidTownID(p1) || p2 >= lengthof(_town_action_proc)) return CMD_ERROR;
Town *t = GetTown(p1);

View File

@ -1219,13 +1219,12 @@ Trackdir GetVehicleTrackdir(const Vehicle *v)
if (IsStandardRoadStopTile(v->tile)) // We'll assume the road vehicle is facing outwards
return DiagDirToDiagTrackdir(GetRoadStopDir(v->tile)); // Road vehicle in a station
if (IsDriveThroughStopTile(v->tile)) return DiagDirToDiagTrackdir(DirToDiagDir(v->direction));
/* Drive through road stops / wormholes (tunnels) */
if (v->u.road.state > RVSB_TRACKDIR_MASK) return DiagDirToDiagTrackdir(DirToDiagDir(v->direction));
/* If vehicle's state is a valid track direction (vehicle is not turning around) return it */
if (!IsReversingRoadTrackdir((Trackdir)v->u.road.state)) return (Trackdir)v->u.road.state;
/* Vehicle is turning around, get the direction from vehicle's direction */
return DiagDirToDiagTrackdir(DirToDiagDir(v->direction));
/* If vehicle's state is a valid track direction (vehicle is not turning around) return it,
* otherwise transform it into a valid track direction */
return (Trackdir)((IsReversingRoadTrackdir((Trackdir)v->u.road.state)) ? (v->u.road.state - 6) : v->u.road.state);
/* case VEH_AIRCRAFT: case VEH_EFFECT: case VEH_DISASTER: */
default: return INVALID_TRACKDIR;