summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordarkvater <darkvater@openttd.org>2004-08-16 14:48:35 +0000
committerdarkvater <darkvater@openttd.org>2004-08-16 14:48:35 +0000
commit68c9b7c3ad902784c07b0d76c81c87e073c826b3 (patch)
tree7adb6f3ca0f68bd8744d5835a42dd6919a93f4c2
parentd33c833a82808c256562b7f3a7e07251613d14ca (diff)
downloadopenttd-68c9b7c3ad902784c07b0d76c81c87e073c826b3.tar.xz
(svn r66) -Fix Station list updated on station deletion/station rename
-Changed debug messages to comply with DEBUG(name, level) heuristics
-rw-r--r--airport.c6
-rw-r--r--grfspecial.c7
-rw-r--r--industry_gui.c2
-rw-r--r--misc_gui.c19
-rw-r--r--namegen.c5
-rw-r--r--station_cmd.c2
-rw-r--r--station_gui.c5
-rw-r--r--town_gui.c2
-rw-r--r--ttd.c2
-rw-r--r--variables.h1
10 files changed, 26 insertions, 25 deletions
diff --git a/airport.c b/airport.c
index d090dbb61..270f26c14 100644
--- a/airport.c
+++ b/airport.c
@@ -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);
{
diff --git a/grfspecial.c b/grfspecial.c
index 69a905be0..47f7bc31c 100644
--- a/grfspecial.c
+++ b/grfspecial.c
@@ -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) {
diff --git a/industry_gui.c b/industry_gui.c
index 015e657d8..09e3c97d2 100644
--- a/industry_gui.c
+++ b/industry_gui.c
@@ -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...");
}
diff --git a/misc_gui.c b/misc_gui.c
index c1b30b0a9..755ca0c79 100644
--- a/misc_gui.c
+++ b/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()
diff --git a/namegen.c b/namegen.c
index 9b0829ff3..e1cb08bb5 100644
--- a/namegen.c
+++ b/namegen.c
@@ -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 */
diff --git a/station_cmd.c b/station_cmd.c
index 17471e419..df9a387f8 100644
--- a/station_cmd.c
+++ b/station_cmd.c
@@ -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);
}
diff --git a/station_gui.c b/station_gui.c
index ade69f691..a10ad0c47 100644
--- a/station_gui.c
+++ b/station_gui.c
@@ -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)
diff --git a/town_gui.c b/town_gui.c
index a8e5718e3..5571bcfc9 100644
--- a/town_gui.c
+++ b/town_gui.c
@@ -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...");
}
diff --git a/ttd.c b/ttd.c
index 78ee234b3..eff9d9d29 100644
--- a/ttd.c
+++ b/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;
diff --git a/variables.h b/variables.h
index fcb7f1736..a992b1e12 100644
--- a/variables.h
+++ b/variables.h
@@ -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