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:
@@ -43,7 +43,9 @@ struct window_procs Gem_procs = {
|
||||
| WC_FONT_TEXT | WC_FONT_MAP | WC_FONTSIZ_MESSAGE | WC_FONTSIZ_STATUS
|
||||
| WC_FONTSIZ_MENU | WC_FONTSIZ_TEXT | WC_FONTSIZ_MAP | WC_TILE_WIDTH
|
||||
| WC_TILE_HEIGHT | WC_TILE_FILE | WC_VARY_MSGCOUNT | WC_ASCII_MAP,
|
||||
0L, Gem_init_nhwindows, Gem_player_selection, Gem_askname,
|
||||
0L,
|
||||
{1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, /* color availability */
|
||||
Gem_init_nhwindows, Gem_player_selection, Gem_askname,
|
||||
Gem_get_nh_event, Gem_exit_nhwindows, Gem_suspend_nhwindows,
|
||||
Gem_resume_nhwindows, Gem_create_nhwindow, Gem_clear_nhwindow,
|
||||
Gem_display_nhwindow, Gem_destroy_nhwindow, Gem_curs, Gem_putstr,
|
||||
|
||||
Reference in New Issue
Block a user