diff -u freeciv-Mar-31/client/tilespec.c freeciv/client/tilespec.c --- freeciv-Mar-31/client/tilespec.c Wed Mar 6 02:44:35 2002 +++ freeciv/client/tilespec.c Thu Apr 11 15:15:16 2002 @@ -432,6 +432,16 @@ assert(sprites.field != NULL); \ } while(FALSE) +/* Sets sprites.field to tag or (if tag isn't available) to alt, + where alt is a pre-existing sprite*/ +#define SET_SPRITE_ALT_PRE(field, tag, alt) do { \ + sprites.field = hash_lookup_data(sprite_hash, tag); \ + if (!sprites.field) { \ + sprites.field = sprites.alt; \ + } \ + assert(sprites.field != NULL); \ + } while(FALSE) + /********************************************************************** Initialize 'sprites' structure based on hardwired tags which freeciv always requires. @@ -447,6 +457,8 @@ SET_SPRITE(treaty_thumb[0], "treaty.disagree_thumb_down"); SET_SPRITE(treaty_thumb[1], "treaty.agree_thumb_up"); + + for(i=0; iwidth>15 || sprites.message_icons[i]->height>20){ + sprite_get_bounding_box(sprites.message_icons[i], + &start_x, &start_y, &end_x, &end_y); + sprites.message_icons[i]=crop_sprite(sprites.message_icons[i], + start_x, start_y, + end_x-start_x, end_y-start_y); + } + } + event_sprites_initialized=1; +} + + + /****************************************************************** Turn off updating of message window *******************************************************************/ @@ -122,12 +144,12 @@ *****************************************************************/ void create_meswin_dialog(void) { - static gchar *titles_[1] = { N_("Messages") }; + static gchar *titles_[2] = { "", N_("Messages") }; static gchar **titles; GtkWidget *scrolled; GtkAccelGroup *accel = gtk_accel_group_new(); - if (!titles) titles = intl_slist(1, titles_); + if (!titles) titles = intl_slist(2, titles_); meswin_dialog_shell = gtk_dialog_new(); gtk_signal_connect( GTK_OBJECT(meswin_dialog_shell),"delete_event", @@ -136,8 +158,9 @@ gtk_window_set_title( GTK_WINDOW(meswin_dialog_shell), _("Messages") ); - meswin_list = gtk_clist_new_with_titles(1, titles); + meswin_list = gtk_clist_new_with_titles(2, titles); gtk_clist_column_titles_passive(GTK_CLIST(meswin_list)); + gtk_clist_set_column_width(GTK_CLIST(meswin_list), 0, 15); scrolled = gtk_scrolled_window_new(NULL,NULL); gtk_container_add(GTK_CONTAINER(scrolled),meswin_list); gtk_scrolled_window_set_policy( GTK_SCROLLED_WINDOW( scrolled ), @@ -208,6 +231,7 @@ static int messages_total = 0; /* current total number of message lines */ static int messages_alloc = 0; /* number allocated for */ static char **string_ptrs = NULL; +static struct Sprite **sprite_ptrs = NULL; static int *xpos = NULL; static int *ypos = NULL; static int *event = NULL; @@ -226,11 +250,13 @@ if (messages_total+2 > messages_alloc) { messages_alloc = messages_total + 32; string_ptrs = fc_realloc(string_ptrs, messages_alloc*sizeof(char*)); + sprite_ptrs = fc_realloc(sprite_ptrs, messages_alloc*sizeof(char*)); xpos = fc_realloc(xpos, messages_alloc*sizeof(int)); ypos = fc_realloc(ypos, messages_alloc*sizeof(int)); event = fc_realloc(event, messages_alloc*sizeof(int)); for( i=messages_total; imessage) + 50); if (strncmp(packet->message, game_prefix1, gp_len1) == 0) { strcpy(s, packet->message + gp_len1); @@ -292,6 +322,11 @@ ypos[messages_total] = packet->y; event[messages_total]= packet->event; string_ptrs[messages_total] = s; + if (packet->eventevent>=0){ + sprite_ptrs[messages_total] = sprites.message_icons[packet->event]; + }else{ + sprite_ptrs[messages_total] = sprites.cooling[3]; + } messages_total++; string_ptrs[messages_total] = NULL; if (!delay_meswin_update) { @@ -324,6 +359,9 @@ **************************************************************************/ void update_meswin_dialog(void) { + char *row_text[2]; + row_text[0]=""; + if (!meswin_dialog_shell) { if (messages_total > 0 && (!game.player_ptr->ai.control || ai_popup_windows)) { @@ -334,22 +372,24 @@ return; } } - if(meswin_dialog_shell) { - int i; - - gtk_clist_freeze(GTK_CLIST(meswin_list)); - gtk_clist_clear(GTK_CLIST(meswin_list)); - - for (i=0; ipixmap, sprite_ptrs[i]->mask); + } + gtk_clist_thaw(GTK_CLIST(meswin_list)); + gtk_widget_show_all(meswin_list); + } } /**************************************************************************