1
0
Fork 0

(svn r20148) [1.0] -Backport from trunk:

- Add [Debian]: Debug symbols package (r20129)
- Change: Improve desync debugging and crash log data (r20138, r20136)
- Fix: Ships were not marked as dirty when stopping inside a depot [FS#3880] (r20142)
- Fix: Some windows ignored all hotkeys [FS#3902] (r20141, r20140, r20139)
- Fix: Do not allow building a rail track to the water using a tree-tile [FS#3695] (r20110)
- Fix: [NoAI] AITown::GetRating() returned wrong values [FS#3934] (r20103)
release/1.0
rubidium 2010-07-14 19:29:13 +00:00
parent a519bd4bf8
commit e8ab381e3f
13 changed files with 133 additions and 78 deletions

View File

@ -8047,7 +8047,7 @@ ERROR: HasNext() is invalid as Begin() is never called
GetPopulation(): 737
GetLocation(): 6446
GetHouseCount(): 26
GetRating(): 5
GetRating(): 6
Town 11
IsValidTown(): true
GetName(): Fort Frindston
@ -8082,7 +8082,7 @@ ERROR: HasNext() is invalid as Begin() is never called
GetPopulation(): 807
GetLocation(): 42338
GetHouseCount(): 33
GetRating(): 5
GetRating(): 6
Town 16
IsValidTown(): true
GetName(): Kennville
@ -8117,7 +8117,7 @@ ERROR: HasNext() is invalid as Begin() is never called
GetPopulation(): 437
GetLocation(): 22585
GetHouseCount(): 15
GetRating(): 5
GetRating(): 6
Town 21
IsValidTown(): true
GetName(): Franinghead

View File

@ -25,3 +25,13 @@ Description: reimplementation of Transport Tycoon Deluxe with enhancements
package and optional sound files from the openttd-opensfx package (which is in
non-free). Alternatively, OpenTTD can use the graphics files from the original
Transport Tycoon Deluxe game (See README.Debian on how to set this up).
Package: openttd-dbg
Architecture: any
Section: debug
Priority: extra
Depends: openttd (= ${binary:Version}), ${misc:Depends}
Description: debugging symbols for openttd
This package contains the debugging symbols for OpenTTD, the reimplementation
of the Micropose game "Transport Tycoon Deluxe" with lots of new features and
enhancements.

View File

@ -7,13 +7,14 @@ wrapper instead of the openttd binary directly.
Index: media/openttd.desktop.in
===================================================================
--- a/media/openttd.desktop.in (revision 17228)
--- a/media/openttd.desktop.in (revision 20124)
+++ b/media/openttd.desktop.in (working copy)
@@ -6,6 +6,6 @@
@@ -5,7 +5,7 @@
Version=1.1
Name=!!MENU_NAME!!
Comment=A clone of Transport Tycoon Deluxe
Icon=openttd
-Exec=!!TTD!!
+Exec=/usr/share/games/openttd/openttd-wrapper
Terminal=false
Categories=!!MENU_GROUP!!
Comment=A clone of Transport Tycoon Deluxe

View File

@ -17,7 +17,7 @@ endif
# to be explicit about the dependencies, in case we're not running in a
# clean build root.
override_dh_auto_configure:
./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/openttd --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig --with-icu --with-liblzo2 --without-iconv
./configure $(CROSS) --prefix-dir=/usr --install-dir=debian/openttd --without-allegro --with-zlib --with-sdl --with-png --with-freetype --with-fontconfig --with-icu --with-liblzo2 --without-iconv --disable-strip CFLAGS="$(CFLAGS) -g"
# Do some extra installation
override_dh_auto_install:
@ -41,3 +41,7 @@ override_dh_auto_test:
# target, while there isn't.
override_dh_auto_clean:
[ ! -f Makefile ] || $(MAKE) mrproper
# We want to strip the debug informatiton into the -dbg package.
override_dh_strip:
dh_strip --dbg-package=openttd-dbg

View File

@ -14,6 +14,7 @@
#include "ai_cargo.hpp"
#include "ai_error.hpp"
#include "../../town.h"
#include "../../town_type.h"
#include "../../strings_func.h"
#include "../../company_func.h"
#include "../../station_base.h"
@ -172,8 +173,25 @@
if (company == AICompany::COMPANY_INVALID) return TOWN_RATING_INVALID;
const Town *t = ::Town::Get(town_id);
if (!HasBit(t->have_ratings, company)) return TOWN_RATING_NONE;
return max(TOWN_RATING_APPALLING, (TownRating)((t->ratings[company] / 200) + 3));
if (!HasBit(t->have_ratings, company)) {
return TOWN_RATING_NONE;
} else if (t->ratings[company] <= RATING_APPALLING) {
return TOWN_RATING_APPALLING;
} else if (t->ratings[company] <= RATING_VERYPOOR) {
return TOWN_RATING_VERY_POOR;
} else if (t->ratings[company] <= RATING_POOR) {
return TOWN_RATING_POOR;
} else if (t->ratings[company] <= RATING_MEDIOCRE) {
return TOWN_RATING_MEDIOCRE;
} else if (t->ratings[company] <= RATING_GOOD) {
return TOWN_RATING_GOOD;
} else if (t->ratings[company] <= RATING_VERYGOOD) {
return TOWN_RATING_VERY_GOOD;
} else if (t->ratings[company] <= RATING_EXCELLENT) {
return TOWN_RATING_EXCELLENT;
} else {
return TOWN_RATING_OUTSTANDING;
}
}
/* static */ int AITown::GetAllowedNoise(TownID town_id)

View File

@ -109,22 +109,25 @@ char *CrashLog::LogConfiguration(char *buffer, const char *last) const
buffer += seprintf(buffer, last,
"Configuration:\n"
" Blitter: %s\n"
" Graphics set: %s\n"
" Graphics set: %s (%d)\n"
" Language: %s\n"
" Music driver: %s\n"
" Music set: %s\n"
" Music set: %s (%d)\n"
" Network: %s\n"
" Sound driver: %s\n"
" Sound set: %s\n"
" Sound set: %s (%d)\n"
" Video driver: %s\n\n",
BlitterFactoryBase::GetCurrentBlitter() == NULL ? "none" : BlitterFactoryBase::GetCurrentBlitter()->GetName(),
BaseGraphics::GetUsedSet() == NULL ? "none" : BaseGraphics::GetUsedSet()->name,
BaseGraphics::GetUsedSet() == NULL ? -1 : BaseGraphics::GetUsedSet()->version,
StrEmpty(_dynlang.curr_file) ? "none" : _dynlang.curr_file,
_music_driver == NULL ? "none" : _music_driver->GetName(),
BaseMusic::GetUsedSet() == NULL ? "none" : BaseMusic::GetUsedSet()->name,
BaseMusic::GetUsedSet() == NULL ? -1 : BaseMusic::GetUsedSet()->version,
_networking ? (_network_server ? "server" : "client") : "no",
_sound_driver == NULL ? "none" : _sound_driver->GetName(),
BaseSounds::GetUsedSet() == NULL ? "none" : BaseSounds::GetUsedSet()->name,
BaseSounds::GetUsedSet() == NULL ? -1 : BaseSounds::GetUsedSet()->version,
_video_driver == NULL ? "none" : _video_driver->GetName()
);

View File

@ -677,7 +677,7 @@ struct GenerateLandscapeWindow : public QueryStringBaseWindow {
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state;
EventState state = ES_NOT_HANDLED;
this->HandleEditBoxKey(GLAND_RANDOM_EDITBOX, key, keycode, state);
/* the seed is unsigned, therefore atoi cannot be used.
* As UINT32_MAX is a 'magic' value (use random seed) it

View File

@ -1124,58 +1124,72 @@ static void CheckCaches()
Vehicle *v;
FOR_ALL_VEHICLES(v) {
if (v != v->First() || v->vehstatus & VS_CRASHED) continue;
if (v != v->First() || v->vehstatus & VS_CRASHED || !v->IsPrimaryVehicle()) continue;
uint length = 0;
for (const Vehicle *u = v; u != NULL; u = u->Next()) length++;
VehicleCache *veh_cache = CallocT<VehicleCache>(length);
TrainCache *tra_cache = CallocT<TrainCache>(length);
RoadVehicleCache *roa_cache = CallocT<RoadVehicleCache>(length);
AircraftCache *air_cache = CallocT<AircraftCache>(length);
length = 0;
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
veh_cache[length] = u->vcache;
switch (u->type) {
case VEH_TRAIN:
tra_cache[length] = Train::From(u)->tcache;
break;
case VEH_ROAD:
roa_cache[length] = RoadVehicle::From(u)->rcache;
break;
case VEH_AIRCRAFT:
air_cache[length] = Aircraft::From(u)->acache;
default:
break;
}
length++;
}
switch (v->type) {
case VEH_ROAD: {
RoadVehicle *rv = RoadVehicle::From(v);
RoadVehicleCache cache;
memset(&cache, 0, sizeof(cache));
cache = rv->rcache;
RoadVehUpdateCache(rv);
if (memcmp(&cache, &rv->rcache, sizeof(RoadVehicleCache)) != 0) {
DEBUG(desync, 2, "cache mismatch: vehicle %i, company %i, unit number %i", v->index, (int)v->owner, v->unitnumber);
}
} break;
case VEH_TRAIN: {
uint length = 0;
Train *t = Train::From(v);
for (Vehicle *u = t; u != NULL; u = u->Next()) length++;
TrainCache *wagons = CallocT<TrainCache>(length);
length = 0;
for (Train *u = t; u != NULL; u = u->Next()) wagons[length++] = u->tcache;
t->ConsistChanged(true);
length = 0;
for (Train *u = t; u != NULL; u = u->Next()) {
if (memcmp(&wagons[length], &u->tcache, sizeof(TrainCache)) != 0) {
DEBUG(desync, 2, "cache mismatch: vehicle %i, company %i, unit number %i, wagon %i", v->index, (int)v->owner, v->unitnumber, length);
}
length++;
}
free(wagons);
} break;
case VEH_AIRCRAFT: {
Aircraft *a = Aircraft::From(v);
AircraftCache cache;
memset(&cache, 0, sizeof(cache));
cache = a->acache;
UpdateAircraftCache(a);
if (memcmp(&cache, &a->acache, sizeof(AircraftCache)) != 0) {
DEBUG(desync, 2, "cache mismatch: vehicle %i, company %i, unit number %i", v->index, (int)v->owner, v->unitnumber);
}
} break;
default:
break;
case VEH_TRAIN: Train::From(v)->ConsistChanged(true); break;
case VEH_ROAD: RoadVehUpdateCache(RoadVehicle::From(v)); break;
case VEH_AIRCRAFT: UpdateAircraftCache(Aircraft::From(v)); break;
default: break;
}
length = 0;
for (const Vehicle *u = v; u != NULL; u = u->Next()) {
if (memcmp(&veh_cache[length], &u->vcache, sizeof(VehicleCache)) != 0) {
DEBUG(desync, 2, "vehicle cache mismatch: type %i, vehicle %i, company %i, unit number %i, wagon %i", (int)v->type, v->index, (int)v->owner, v->unitnumber, length);
}
switch (u->type) {
case VEH_TRAIN:
if (memcmp(&tra_cache[length], &Train::From(u)->tcache, sizeof(TrainCache)) != 0) {
DEBUG(desync, 2, "train cache mismatch: vehicle %i, company %i, unit number %i, wagon %i", v->index, (int)v->owner, v->unitnumber, length);
}
break;
case VEH_ROAD:
if (memcmp(&tra_cache[length], &RoadVehicle::From(u)->rcache, sizeof(RoadVehicleCache)) != 0) {
DEBUG(desync, 2, "road vehicle cache mismatch: vehicle %i, company %i, unit number %i, wagon %i", v->index, (int)v->owner, v->unitnumber, length);
}
break;
case VEH_AIRCRAFT:
if (memcmp(&air_cache[length], &Aircraft::From(u)->acache, sizeof(AircraftCache)) != 0) {
DEBUG(desync, 2, "aircraft cache mismatch: vehicle %i, company %i, unit number %i", v->index, (int)v->owner, v->unitnumber);
}
break;
default:
break;
}
length++;
}
free(veh_cache);
free(tra_cache);
free(roa_cache);
free(air_cache);
}
/* Check whether the caches are still valid */

View File

@ -340,7 +340,7 @@ Foundation GetRailFoundation(Slope tileh, TrackBits bits)
static CommandCost CheckRailSlope(Slope tileh, TrackBits rail_bits, TrackBits existing, TileIndex tile)
{
/* don't allow building on the lower side of a coast */
if (IsTileType(tile, MP_WATER) || (IsTileType(tile, MP_RAILWAY) && (GetRailGroundType(tile) == RAIL_GROUND_WATER))) {
if (GetFloodingBehaviour(tile) != FLOOD_NONE) {
if (!IsSteepSlope(tileh) && ((~_valid_tracks_on_leveled_foundation[tileh] & (rail_bits | existing)) != 0)) return_cmd_error(STR_ERROR_CAN_T_BUILD_ON_WATER);
}

View File

@ -1188,7 +1188,7 @@ public:
virtual EventState OnKeyPress(uint16 key, uint16 keycode)
{
EventState state;
EventState state = ES_NOT_HANDLED;
if (this->HandleEditBoxKey(TSEW_TOWNNAME_EDITBOX, key, keycode, state) == HEBR_CANCEL) {
this->UnfocusFocusedWidget();
}

View File

@ -1011,11 +1011,14 @@ void VehicleEnterDepot(Vehicle *v)
SetWindowClassesDirty(WC_ROADVEH_LIST);
break;
case VEH_SHIP:
case VEH_SHIP: {
SetWindowClassesDirty(WC_SHIPS_LIST);
Ship::From(v)->state = TRACK_BIT_DEPOT;
RecalcShipStuff(v);
Ship *ship = Ship::From(v);
ship->state = TRACK_BIT_DEPOT;
ship->UpdateViewport(true, true);
SetWindowDirty(WC_VEHICLE_DEPOT, v->tile);
break;
}
case VEH_AIRCRAFT:
SetWindowClassesDirty(WC_AIRCRAFT_LIST);

View File

@ -16,6 +16,18 @@
#include "company_type.h"
#include "slope_type.h"
/**
* Describes the behaviour of a tile during flooding.
*/
enum FloodingBehaviour {
FLOOD_NONE, ///< The tile does not flood neighboured tiles.
FLOOD_ACTIVE, ///< The tile floods neighboured tiles.
FLOOD_PASSIVE, ///< The tile does not actively flood neighboured tiles, but it prevents them from drying up.
FLOOD_DRYUP, ///< The tile drys up if it is not constantly flooded from neighboured tiles.
};
FloodingBehaviour GetFloodingBehaviour(TileIndex tile);
void TileLoop_Water(TileIndex tile);
bool FloodHalftile(TileIndex t);
void DoFloodTile(TileIndex target);

View File

@ -38,16 +38,6 @@
#include "table/sprites.h"
#include "table/strings.h"
/**
* Describes the behaviour of a tile during flooding.
*/
enum FloodingBehaviour {
FLOOD_NONE, ///< The tile does not flood neighboured tiles.
FLOOD_ACTIVE, ///< The tile floods neighboured tiles.
FLOOD_PASSIVE, ///< The tile does not actively flood neighboured tiles, but it prevents them from drying up.
FLOOD_DRYUP, ///< The tile drys up if it is not constantly flooded from neighboured tiles.
};
/**
* Describes from which directions a specific slope can be flooded (if the tile is floodable at all).
*/
@ -794,7 +784,7 @@ static void FloodVehicle(Vehicle *v)
*
* @return Behaviour of the tile
*/
static FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
FloodingBehaviour GetFloodingBehaviour(TileIndex tile)
{
/* FLOOD_ACTIVE: 'single-corner-raised'-coast, sea, sea-shipdepots, sea-buoys, sea-docks (water part), rail with flooded halftile, sea-water-industries, sea-oilrigs
* FLOOD_DRYUP: coast with more than one corner raised, coast with rail-track, coast with trees