(svn r66) -Fix Station list updated on station deletion/station rename
authordarkvater
Mon, 16 Aug 2004 14:48:35 +0000
changeset 65 f9f866bc609c
parent 64 93656f16d50a
child 66 d0f669221657
(svn r66) -Fix Station list updated on station deletion/station rename
-Changed debug messages to comply with DEBUG(name, level) heuristics
airport.c
grfspecial.c
industry_gui.c
misc_gui.c
namegen.c
station_cmd.c
station_gui.c
town_gui.c
ttd.c
variables.h
--- a/airport.c	Mon Aug 16 13:54:37 2004 +0000
+++ b/airport.c	Mon Aug 16 14:48:35 2004 +0000
@@ -92,10 +92,8 @@
 
 	// 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);
 
 
 	{
--- a/grfspecial.c	Mon Aug 16 13:54:37 2004 +0000
+++ b/grfspecial.c	Mon Aug 16 14:48:35 2004 +0000
@@ -39,14 +39,13 @@
 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) {
--- a/industry_gui.c	Mon Aug 16 13:54:37 2004 +0000
+++ b/industry_gui.c	Mon Aug 16 14:48:35 2004 +0000
@@ -465,6 +465,8 @@
 	_last_industry_idx = 255; // used for "cache"
 
 	qsort(_industry_sort, n, 1, IndustrySorter);
+
+	//DEBUG(misc, 1) ("Resorting Industries list...");
 }
 
 
--- a/misc_gui.c	Mon Aug 16 13:54:37 2004 +0000
+++ b/misc_gui.c	Mon Aug 16 14:48:35 2004 +0000
@@ -149,18 +149,17 @@
 	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()
--- a/namegen.c	Mon Aug 16 13:54:37 2004 +0000
+++ b/namegen.c	Mon Aug 16 14:48:35 2004 +0000
@@ -1986,15 +1986,12 @@
 			 *	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 */
--- a/station_cmd.c	Mon Aug 16 13:54:37 2004 +0000
+++ b/station_cmd.c	Mon Aug 16 14:48:35 2004 +0000
@@ -1998,6 +1998,7 @@
 	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 @@
 		_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);
 	}
--- a/station_gui.c	Mon Aug 16 13:54:37 2004 +0000
+++ b/station_gui.c	Mon Aug 16 14:48:35 2004 +0000
@@ -107,9 +107,8 @@
 
 	_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)
--- a/town_gui.c	Mon Aug 16 13:54:37 2004 +0000
+++ b/town_gui.c	Mon Aug 16 14:48:35 2004 +0000
@@ -392,6 +392,8 @@
 
 	_last_town_idx = 255; // used for "cache"
 	qsort(_town_sort, n, 1, _town_sort_order & 2 ? TownSorterByPop : TownSorterByName);
+
+	//DEBUG(misc, 1) ("Resorting Towns list...");
 }
 
 
--- a/ttd.c	Mon Aug 16 13:54:37 2004 +0000
+++ b/ttd.c	Mon Aug 16 14:48:35 2004 +0000
@@ -428,6 +428,7 @@
 		
 		_debug_spritecache_level = v;
 		_debug_misc_level = v;
+		_debug_grf_level = v;
 	}
 
 	// individual levels
@@ -443,6 +444,7 @@
 		// 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;
--- a/variables.h	Mon Aug 16 13:54:37 2004 +0000
+++ b/variables.h	Mon Aug 16 14:48:35 2004 +0000
@@ -426,6 +426,7 @@
 /* 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