~ubuntu-branches/debian/jessie/aisleriot/jessie

« back to all changes in this revision

Viewing changes to src/game.c

  • Committer: Package Import Robot
  • Author(s): Emilio Pozuelo Monfort, Jeremy Bicha, Robert Ancell, Rico Tzschichholz, Emilio Pozuelo Monfort
  • Date: 2013-05-25 19:56:23 UTC
  • mfrom: (1.1.2)
  • Revision ID: package-import@ubuntu.com-20130525195623-im6ppfonxjy1jarp
Tags: 1:3.8.0-1
[ Jeremy Bicha ]
* New upstream release.
* debian/control.in:
  - Build-depend on desktop-file-utils
  - Recommend yelp
  - Remove obsolete libgstreamer build-depends 

[ Robert Ancell ]
* debian/aisleriot.install:
* debian/aisleriot.menu:
* debian/patches/02_desktop-path.patch:
* debian/pixmaps/freecell.xpm:
  - Updated as freecell.desktop is removed

[ Rico Tzschichholz ]
* debian/control.in: Bump Build-Deps on libgtk-3-dev (>= 3.4.0),
  libglib2.0-dev (>= 2.32.0)

[ Emilio Pozuelo Monfort ]
* debian/watch:
  + Fixed, it wasn't tracking new versions.

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
#include <glib.h>
28
28
#include <glib/gi18n.h>
29
29
 
 
30
#ifdef HAVE_CLUTTER
 
31
#include <clutter/clutter.h>
 
32
#endif
 
33
 
30
34
#include "ar-debug.h"
31
35
#include "ar-runtime.h"
32
36
#include "ar-string-utils.h"
247
251
  for (i = 0; i < n_slots; ++i) {
248
252
    ArSlot *slot = game->slots->pdata[i];
249
253
 
 
254
#ifdef HAVE_CLUTTER
 
255
    if (slot->slot_renderer) {
 
256
      clutter_actor_destroy (slot->slot_renderer);
 
257
      g_object_unref (slot->slot_renderer);
 
258
    }
 
259
 
 
260
    g_byte_array_free (slot->old_cards, TRUE);
 
261
#else
250
262
    g_ptr_array_free (slot->card_images, TRUE);
 
263
#endif /* HAVE_CLUTTER */
251
264
    g_byte_array_free (slot->cards, TRUE);
252
265
 
253
266
    g_slice_free (ArSlot, slot);
657
670
  slot->expanded_down = expanded_down != FALSE;
658
671
  slot->expanded_right = expanded_right != FALSE;
659
672
 
 
673
#ifdef HAVE_CLUTTER
 
674
  slot->old_cards = g_byte_array_sized_new (SLOT_CARDS_N_PREALLOC);
 
675
#else
660
676
  slot->card_images = g_ptr_array_sized_new (SLOT_CARDS_N_PREALLOC);
 
677
#endif
661
678
 
662
679
  slot->needs_update = TRUE;
663
680
 
2555
2572
  return game->score ? game->score : "";
2556
2573
}
2557
2574
 
 
2575
#ifdef HAVE_CLUTTER
 
2576
 
 
2577
void
 
2578
aisleriot_game_get_card_offset (ArSlot *slot,
 
2579
                                guint card_num,
 
2580
                                gboolean old_cards,
 
2581
                                gint *xoff, gint *yoff)
 
2582
{
 
2583
  gint n_cards, exposed;
 
2584
 
 
2585
  if (old_cards) {
 
2586
    n_cards = (gint) slot->old_cards->len;
 
2587
    exposed = (gint) slot->old_exposed;
 
2588
  } else {
 
2589
    n_cards = (gint) slot->cards->len;
 
2590
    exposed = (gint) slot->exposed;
 
2591
  }
 
2592
 
 
2593
  if (card_num >= n_cards - exposed) {
 
2594
    gint idx = card_num + exposed - n_cards;
 
2595
    *xoff = slot->pixeldx * idx;
 
2596
    *yoff = slot->pixeldy * idx;
 
2597
  } else {
 
2598
    *xoff = 0;
 
2599
    *yoff = 0;
 
2600
  }
 
2601
}
 
2602
 
 
2603
void
 
2604
aisleriot_game_reset_old_cards (ArSlot *slot)
 
2605
{
 
2606
  g_byte_array_set_size (slot->old_cards, 0);
 
2607
  g_byte_array_append (slot->old_cards, slot->cards->data, slot->cards->len);
 
2608
  slot->old_exposed = slot->exposed;
 
2609
}
 
2610
 
 
2611
#endif /* HAVE_CLUTTER */
 
2612
 
2558
2613
static void
2559
2614
append_games_from_path (GHashTable *hash_table,
2560
2615
                        const char *path,