has_color() performance fixes
Performance profiling showed that multiple strcmpi() calls were occurring each and every time a character was going to the map. This update: - honors the WC_COLOR capability - It allows a window-port to control individual color availability should the window-port wish to do so. - Makes checking on the individual colors for the active window-port is a straightforward table lookup at the CLR_ offset. iflags.use_color remains a master on/off switch for use of color, regardless of the capability compiled into the game (default TRUE). The has_color() routine, which is now a shared routine in src/windows.c, could likely be made into a simple macro to eliminate the function call, but this update does not go that far. This hits a lot of port files due to the window-port interface change, mostly cookie-cutter.
This commit is contained in:
@@ -1282,6 +1282,9 @@ int color;
|
||||
xputs(hilites[color]);
|
||||
}
|
||||
|
||||
#if 0
|
||||
/* Replaced by src/windows.c general proc or a macro in 3.6.3 */
|
||||
|
||||
/* not to be confused with has_colors() in unixtty.c */
|
||||
int
|
||||
has_color(color)
|
||||
@@ -1316,7 +1319,7 @@ int color;
|
||||
return hilites[color] != (char *) 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* 0 */
|
||||
#endif /* TEXTCOLOR */
|
||||
|
||||
#endif /* TTY_GRAPHICS && !NO_TERMS */
|
||||
|
||||
Reference in New Issue
Block a user