~ubuntu-branches/ubuntu/wily/gnome-chess/wily

« back to all changes in this revision

Viewing changes to src/chess-game.c

  • Committer: Package Import Robot
  • Author(s): Emilio Pozuelo Monfort, Jeremy Bicha, Emilio Pozuelo Monfort
  • Date: 2013-05-25 18:48:35 UTC
  • mfrom: (0.1.6 sid) (1.1.4)
  • Revision ID: package-import@ubuntu.com-20130525184835-jdun5lv3y5ztbqx3
Tags: 1:3.8.2-1
[ Jeremy Bicha ]
* Package split from gnome-games
* Add transitional package for rename from glchess

[ Emilio Pozuelo Monfort ]
* debian/control.in:
  + Swith valac-0.18 build dependency to valac (>= 0.18).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* chess-game.c generated by valac 0.20.0, the Vala compiler
 
1
/* chess-game.c generated by valac 0.18.1, the Vala compiler
2
2
 * generated from chess-game.vala, do not modify */
3
3
 
4
4
 
110
110
        GObjectClass parent_class;
111
111
};
112
112
 
 
113
struct _ChessPlayerPrivate {
 
114
        gboolean _local_human;
 
115
};
 
116
 
113
117
typedef enum  {
114
118
        PIECE_TYPE_PAWN,
115
119
        PIECE_TYPE_ROOK,
250
254
 
251
255
GType color_get_type (void) G_GNUC_CONST;
252
256
GType chess_player_get_type (void) G_GNUC_CONST;
 
257
#define CHESS_PLAYER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_CHESS_PLAYER, ChessPlayerPrivate))
253
258
enum  {
254
 
        CHESS_PLAYER_DUMMY_PROPERTY
 
259
        CHESS_PLAYER_DUMMY_PROPERTY,
 
260
        CHESS_PLAYER_LOCAL_HUMAN
255
261
};
256
262
ChessPlayer* chess_player_new (Color color);
257
263
ChessPlayer* chess_player_construct (GType object_type, Color color);
261
267
void chess_player_undo (ChessPlayer* self);
262
268
gboolean chess_player_resign (ChessPlayer* self);
263
269
gboolean chess_player_claim_draw (ChessPlayer* self);
 
270
gboolean chess_player_get_local_human (ChessPlayer* self);
 
271
void chess_player_set_local_human (ChessPlayer* self, gboolean value);
264
272
static void g_cclosure_user_marshal_BOOLEAN__STRING_BOOLEAN (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
265
273
static void g_cclosure_user_marshal_BOOLEAN__VOID (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data);
266
274
static void chess_player_finalize (GObject* obj);
 
275
static void _vala_chess_player_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
 
276
static void _vala_chess_player_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
267
277
gpointer chess_piece_ref (gpointer instance);
268
278
void chess_piece_unref (gpointer instance);
269
279
GParamSpec* param_spec_chess_piece (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
528
538
}
529
539
 
530
540
 
 
541
gboolean chess_player_get_local_human (ChessPlayer* self) {
 
542
        gboolean result;
 
543
        gboolean _tmp0_;
 
544
        g_return_val_if_fail (self != NULL, FALSE);
 
545
        _tmp0_ = self->priv->_local_human;
 
546
        result = _tmp0_;
 
547
        return result;
 
548
}
 
549
 
 
550
 
 
551
void chess_player_set_local_human (ChessPlayer* self, gboolean value) {
 
552
        gboolean _tmp0_;
 
553
        g_return_if_fail (self != NULL);
 
554
        _tmp0_ = value;
 
555
        self->priv->_local_human = _tmp0_;
 
556
        g_object_notify ((GObject *) self, "local-human");
 
557
}
 
558
 
 
559
 
531
560
static void g_cclosure_user_marshal_BOOLEAN__STRING_BOOLEAN (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) {
532
561
        typedef gboolean (*GMarshalFunc_BOOLEAN__STRING_BOOLEAN) (gpointer data1, const char* arg_1, gboolean arg_2, gpointer data2);
533
562
        register GMarshalFunc_BOOLEAN__STRING_BOOLEAN callback;
576
605
 
577
606
static void chess_player_class_init (ChessPlayerClass * klass) {
578
607
        chess_player_parent_class = g_type_class_peek_parent (klass);
 
608
        g_type_class_add_private (klass, sizeof (ChessPlayerPrivate));
 
609
        G_OBJECT_CLASS (klass)->get_property = _vala_chess_player_get_property;
 
610
        G_OBJECT_CLASS (klass)->set_property = _vala_chess_player_set_property;
579
611
        G_OBJECT_CLASS (klass)->finalize = chess_player_finalize;
 
612
        g_object_class_install_property (G_OBJECT_CLASS (klass), CHESS_PLAYER_LOCAL_HUMAN, g_param_spec_boolean ("local-human", "local-human", "local-human", FALSE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
580
613
        g_signal_new ("start_turn", TYPE_CHESS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
581
614
        g_signal_new ("do_move", TYPE_CHESS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_BOOLEAN__STRING_BOOLEAN, G_TYPE_BOOLEAN, 2, G_TYPE_STRING, G_TYPE_BOOLEAN);
582
615
        g_signal_new ("do_undo", TYPE_CHESS_PLAYER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
586
619
 
587
620
 
588
621
static void chess_player_instance_init (ChessPlayer * self) {
 
622
        self->priv = CHESS_PLAYER_GET_PRIVATE (self);
 
623
        self->priv->_local_human = FALSE;
589
624
}
590
625
 
591
626
 
608
643
}
609
644
 
610
645
 
 
646
static void _vala_chess_player_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
 
647
        ChessPlayer * self;
 
648
        self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_CHESS_PLAYER, ChessPlayer);
 
649
        switch (property_id) {
 
650
                case CHESS_PLAYER_LOCAL_HUMAN:
 
651
                g_value_set_boolean (value, chess_player_get_local_human (self));
 
652
                break;
 
653
                default:
 
654
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
655
                break;
 
656
        }
 
657
}
 
658
 
 
659
 
 
660
static void _vala_chess_player_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
 
661
        ChessPlayer * self;
 
662
        self = G_TYPE_CHECK_INSTANCE_CAST (object, TYPE_CHESS_PLAYER, ChessPlayer);
 
663
        switch (property_id) {
 
664
                case CHESS_PLAYER_LOCAL_HUMAN:
 
665
                chess_player_set_local_human (self, g_value_get_boolean (value));
 
666
                break;
 
667
                default:
 
668
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
 
669
                break;
 
670
        }
 
671
}
 
672
 
 
673
 
611
674
GType piece_type_get_type (void) {
612
675
        static volatile gsize piece_type_type_id__volatile = 0;
613
676
        if (g_once_init_enter (&piece_type_type_id__volatile)) {
4976
5039
                        if (_tmp109_) {
4977
5040
                                const gchar* _tmp110_;
4978
5041
                                _tmp110_ = move;
4979
 
                                g_debug ("chess-game.vala:1119: Move %s missing destination", _tmp110_);
 
5042
                                g_debug ("chess-game.vala:1129: Move %s missing destination", _tmp110_);
4980
5043
                                result = FALSE;
4981
5044
                                if (r0) {
4982
5045
                                        *r0 = _vala_r0;
5155
5218
                                                                                if (_tmp155_ >= 0) {
5156
5219
                                                                                        const gchar* _tmp156_;
5157
5220
                                                                                        _tmp156_ = move;
5158
 
                                                                                        g_debug ("chess-game.vala:1150: Move %s is ambiguous", _tmp156_);
 
5221
                                                                                        g_debug ("chess-game.vala:1160: Move %s is ambiguous", _tmp156_);
5159
5222
                                                                                        result = FALSE;
5160
5223
                                                                                        _chess_piece_unref0 (piece);
5161
5224
                                                                                        if (r0) {
5190
5253
                                if (_tmp159_ < 0) {
5191
5254
                                        const gchar* _tmp160_;
5192
5255
                                        _tmp160_ = move;
5193
 
                                        g_debug ("chess-game.vala:1161: Move %s has no matches", _tmp160_);
 
5256
                                        g_debug ("chess-game.vala:1171: Move %s has no matches", _tmp160_);
5194
5257
                                        result = FALSE;
5195
5258
                                        if (r0) {
5196
5259
                                                *r0 = _vala_r0;
5242
5305
        if (_tmp173_ != '\0') {
5243
5306
                const gchar* _tmp174_;
5244
5307
                _tmp174_ = move;
5245
 
                g_debug ("chess-game.vala:1177: Move %s has unexpected characters", _tmp174_);
 
5308
                g_debug ("chess-game.vala:1187: Move %s has unexpected characters", _tmp174_);
5246
5309
                result = FALSE;
5247
5310
                if (r0) {
5248
5311
                        *r0 = _vala_r0;
5613
5676
                                                _tmp14__length1 = moves_length1;
5614
5677
                                                _tmp15_ = i;
5615
5678
                                                _tmp16_ = _tmp14_[_tmp15_];
5616
 
                                                g_warning ("chess-game.vala:1267: Invalid move %s", _tmp16_);
 
5679
                                                g_warning ("chess-game.vala:1277: Invalid move %s", _tmp16_);
5617
5680
                                        }
5618
5681
                                }
5619
5682
                        }