Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. Read more...

Feature #912939 ยป 0024-gtk3.22-Show-terrain-image-in-help-dialog.patch

Marko Lindqvist, 2021-01-05 03:20 PM

View differences:

client/gui-gtk-3.22/editgui.c
696 696
****************************************************************************/
697 697
static GdkPixbuf *create_terrain_pixbuf(struct terrain *pterrain)
698 698
{
699
  struct drawn_sprite sprs[80];
700
  int count, w, h, canvas_x, canvas_y, i;
699
  int w, h, i;
701 700
  GdkPixbuf *pixbuf;
702 701
  struct canvas canvas = FC_STATIC_CANVAS_INIT;
703 702
  cairo_t *cr;
......
706 705
  h = tileset_tile_height(tileset);
707 706

  
708 707
  canvas.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, w, h);
709
  canvas_x = 0;
710
  canvas_y = 0;
711 708

  
712 709
  cr = cairo_create(canvas.surface);
713 710
  cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
......
715 712
  cairo_destroy(cr);
716 713

  
717 714
  for (i = 0; i < 3; i++) {
718
    count = fill_basic_terrain_layer_sprite_array(tileset, sprs,
719
                                                  i, pterrain);
720
    put_drawn_sprites(&canvas, 1.0, canvas_x, canvas_y, count, sprs, FALSE);
715
    struct drawn_sprite sprs[80];
716
    int count = fill_basic_terrain_layer_sprite_array(tileset, sprs,
717
                                                      i, pterrain);
718

  
719
    put_drawn_sprites(&canvas, 1.0, 0, 0, count, sprs, FALSE);
721 720
  }
722 721

  
723 722
  pixbuf = surface_get_pixbuf(canvas.surface, w, h);
client/gui-gtk-3.22/helpdlg.c
753 753
  gtk_widget_show(help_tile);
754 754
}
755 755

  
756
/**************************************************************************
757
  Set sprite to show for current terrain.
758
**************************************************************************/
759
static void set_help_tile_from_terrain(struct terrain *pterr)
760
{
761
  struct canvas canvas = FC_STATIC_CANVAS_INIT;
762
  cairo_t *cr;
763
  int i;
764

  
765
  canvas.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
766
                                              tileset_tile_width(tileset),
767
                                              tileset_tile_height(tileset));
768

  
769
  cr = cairo_create(canvas.surface);
770
  cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
771
  cairo_paint(cr);
772
  cairo_destroy(cr);
773

  
774
  for (i = 0; i < 3; i++) {
775
    struct drawn_sprite sprs[80];
776
    int count = fill_basic_terrain_layer_sprite_array(tileset, sprs,
777
                                                      i, pterr);
778

  
779
    put_drawn_sprites(&canvas, 1.0, 0, 0, count, sprs, FALSE);
780
  }
781

  
782
  gtk_image_set_from_surface(GTK_IMAGE(help_tile), canvas.surface);
783
  gtk_widget_show(help_tile);
784
  cairo_surface_destroy(canvas.surface);
785
}
786

  
756 787
/**************************************************************************
757 788
  Display updated help about improvement
758 789
**************************************************************************/
......
1177 1208
  if (pterrain) {
1178 1209
    struct universal for_terr = { .kind = VUT_TERRAIN, .value = { .terrain = pterrain }};
1179 1210

  
1211
    set_help_tile_from_terrain(pterrain);
1212

  
1180 1213
    {
1181 1214
      /* 25 => "1.25"; 50 => "1.5"; 100 => "2.0" */
1182 1215
      int defbonus = pterrain->defense_bonus + 100;
1183 1216
      int frac = defbonus % 100;
1217

  
1184 1218
      if ((frac % 10) == 0) {
1185 1219
        frac /= 10;
1186 1220
      }
1187
- 
    (1-1/1)