mirror of https://github.com/OpenTTD/OpenTTD.git
(svn r66) -Fix Station list updated on station deletion/station rename
-Changed debug messages to comply with DEBUG(name, level) heuristics
This commit is contained in:
parent
d33c833a82
commit
68c9b7c3ad
|
@ -92,10 +92,8 @@ static void AirportFTAClass_Constructor(AirportFTAClass *Airport,
|
|||
|
||||
// build the state machine
|
||||
AirportBuildAutomata(Airport, FA);
|
||||
//#ifdef _DEBUG
|
||||
// {printf("#Elements %2d; #Terminals %2d in %d group(s); #Helipads %2d in %d group(s)\n", Airport->nofelements,
|
||||
// Airport->nofterminals, Airport->nofterminalgroups, Airport->nofhelipads, Airport->nofhelipadgroups);}
|
||||
//#endif
|
||||
// DEBUG(misc, 1) ("#Elements %2d; #Terminals %2d in %d group(s); #Helipads %2d in %d group(s)", Airport->nofelements,
|
||||
// Airport->nofterminals, Airport->nofterminalgroups, Airport->nofhelipads, Airport->nofhelipadgroups);
|
||||
|
||||
|
||||
{
|
||||
|
|
|
@ -39,14 +39,13 @@ enum grfmsg_severity {
|
|||
static void CDECL grfmsg(enum grfmsg_severity severity, const char *str, ...)
|
||||
{
|
||||
static const char * const severitystr[4] = { "Notice", "Warning", "Error", "Fatal" };
|
||||
char buf[1024];
|
||||
va_list va;
|
||||
|
||||
if(_debug_misc_level==0) return;
|
||||
va_start(va, str);
|
||||
fprintf(stderr, "[%s][%s] ", _cur_grffile, severitystr[severity]);
|
||||
vfprintf(stderr, str, va);
|
||||
vsprintf(buf, str, va);
|
||||
va_end(va);
|
||||
fprintf(stderr, "\n");
|
||||
DEBUG(grf, 1) ("[%s][%s] %s", _cur_grffile, severitystr[severity], buf);
|
||||
}
|
||||
|
||||
static byte INLINE grf_load_byte(byte **buf) {
|
||||
|
|
|
@ -465,6 +465,8 @@ static void MakeSortedIndustryList()
|
|||
_last_industry_idx = 255; // used for "cache"
|
||||
|
||||
qsort(_industry_sort, n, 1, IndustrySorter);
|
||||
|
||||
//DEBUG(misc, 1) ("Resorting Industries list...");
|
||||
}
|
||||
|
||||
|
||||
|
|
19
misc_gui.c
19
misc_gui.c
|
@ -149,18 +149,17 @@ static void Place_LandInfo(uint tile)
|
|||
GetAcceptedCargo(tile, &lid.ac);
|
||||
GetTileDesc(tile, &lid.td);
|
||||
|
||||
#if defined(_DEBUG)
|
||||
#if defined(_DEBUG)
|
||||
{
|
||||
printf("TILE: %#x (%i,%i)\n", tile, GET_TILE_X(tile), GET_TILE_Y(tile));
|
||||
printf("_map_type_and_height=%#x\n", _map_type_and_height[tile]);
|
||||
printf("_map2=%#x\n", _map2[tile]);
|
||||
printf("_map3_lo=%#x\n", _map3_lo[tile]);
|
||||
printf("_map3_hi=%#x\n", _map3_hi[tile]);
|
||||
printf("_map5=%#x\n", _map5[tile]);
|
||||
printf("_map_owner=%#x\n", _map_owner[tile]);
|
||||
printf("\n");
|
||||
DEBUG(misc, 0) ("TILE: %#x (%i,%i)", tile, GET_TILE_X(tile), GET_TILE_Y(tile));
|
||||
DEBUG(misc, 0) ("_map_type_and_height=%#x", _map_type_and_height[tile]);
|
||||
DEBUG(misc, 0) ("_map2=%#x", _map2[tile]);
|
||||
DEBUG(misc, 0) ("_map3_lo=%#x", _map3_lo[tile]);
|
||||
DEBUG(misc, 0) ("_map3_hi=%#x", _map3_hi[tile]);
|
||||
DEBUG(misc, 0) ("_map5=%#x", _map5[tile]);
|
||||
DEBUG(misc, 0) ("_map_owner=%#x", _map_owner[tile]);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
void PlaceLandBlockInfo()
|
||||
|
|
|
@ -1986,15 +1986,12 @@ uint32 GetOldTownName(uint32 townnameparts, byte old_town_name_type)
|
|||
* 0000 0000 0000 0000 0000 0000 1111 1111 */
|
||||
return FIXNUM(townnameparts - 86, NUM_FRENCH_1, 0);
|
||||
case 2: /* German */
|
||||
#ifdef _DEBUG
|
||||
printf("German Townnames are buggy... (%d)\n", townnameparts);
|
||||
#endif
|
||||
DEBUG(misc, 0) ("German Townnames are buggy... (%d)", townnameparts);
|
||||
return townnameparts;
|
||||
case 4: /* Latin-American */
|
||||
/* 0000 0000 0000 0000 0000 0000 1111 1111 */
|
||||
return FIXNUM(townnameparts, NUM_SPANISH_1, 0);
|
||||
case 5: /* Silly */
|
||||
//AppendPart(&buf, GETNUM(16, NUM_SILLY_2),silly_2);
|
||||
/* NUM_SILLY_1 - lower 16 bits
|
||||
* NUM_SILLY_2 - upper 16 bits without leading 1 (first 8 bytes)
|
||||
* 1000 0000 2222 2222 0000 0000 1111 1111 */
|
||||
|
|
|
@ -1998,6 +1998,7 @@ static void DeleteStation(Station *st)
|
|||
DeleteName(st->string_id);
|
||||
MarkStationDirty(st);
|
||||
_station_sort_dirty = true;
|
||||
InvalidateWindowClasses(WC_STATION_LIST);
|
||||
|
||||
index = st->index;
|
||||
DeleteWindowById(WC_STATION_VIEW, index);
|
||||
|
@ -2403,6 +2404,7 @@ static void ChangeTileOwner_Station(uint tile, byte old_player, byte new_player)
|
|||
_map_owner[tile] = new_player;
|
||||
st->owner = new_player;
|
||||
_station_sort_dirty = true;
|
||||
InvalidateWindowClasses(WC_STATION_LIST);
|
||||
} else {
|
||||
DoCommandByTile(tile, 0, 0, DC_EXEC, CMD_LANDSCAPE_CLEAR);
|
||||
}
|
||||
|
|
|
@ -107,9 +107,8 @@ static void MakeSortedStationList(Window *w)
|
|||
|
||||
_last_station_idx = 255; // used for "cache"
|
||||
qsort(_station_sort, n, sizeof(_station_sort[0]), StationSorterByName);
|
||||
//#ifdef _DEBUG
|
||||
// {printf("Resorting Stations list...\n");}
|
||||
//#endif
|
||||
|
||||
//DEBUG(misc, 1) ("Resorting Stations list...");
|
||||
}
|
||||
|
||||
static void PlayerStationsWndProc(Window *w, WindowEvent *e)
|
||||
|
|
|
@ -392,6 +392,8 @@ static void MakeSortedTownList()
|
|||
|
||||
_last_town_idx = 255; // used for "cache"
|
||||
qsort(_town_sort, n, 1, _town_sort_order & 2 ? TownSorterByPop : TownSorterByName);
|
||||
|
||||
//DEBUG(misc, 1) ("Resorting Towns list...");
|
||||
}
|
||||
|
||||
|
||||
|
|
2
ttd.c
2
ttd.c
|
@ -428,6 +428,7 @@ void SetDebugString(const char *s)
|
|||
|
||||
_debug_spritecache_level = v;
|
||||
_debug_misc_level = v;
|
||||
_debug_grf_level = v;
|
||||
}
|
||||
|
||||
// individual levels
|
||||
|
@ -443,6 +444,7 @@ void SetDebugString(const char *s)
|
|||
// check debugging levels
|
||||
if IS_LVL("misc") p = &_debug_misc_level;
|
||||
else if IS_LVL("spritecache") p = &_debug_spritecache_level;
|
||||
else if IS_LVL("grf") p = &_debug_grf_level;
|
||||
else {
|
||||
ShowInfoF("Unknown debug level '%.*s'", s-t, t);
|
||||
return;
|
||||
|
|
|
@ -426,6 +426,7 @@ VARDEF bool _ignore_wrong_grf;
|
|||
/* Debugging levels */
|
||||
VARDEF int _debug_spritecache_level;
|
||||
VARDEF int _debug_misc_level;
|
||||
VARDEF int _debug_grf_level;
|
||||
|
||||
void CDECL debug(const char *s, ...);
|
||||
#define DEBUG(name, level) if (level == 0 || _debug_ ## name ## _level >= level) debug
|
||||
|
|
Loading…
Reference in New Issue