[gnome-games] Really remove ggz support from gnibbles
- From: Jason Clinton <jclinton src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-games] Really remove ggz support from gnibbles
- Date: Mon, 25 Jul 2011 04:21:03 +0000 (UTC)
commit 79a73fc4221af7a74fcdaf73578cbfec0b67fea6
Author: Jeremy Bicha <jbicha ubuntu com>
Date: Sun Jul 24 05:18:47 2011 -0400
Really remove ggz support from gnibbles
Despite ggz support being removed in 2009, it actually wasn't
completely removed, resulting in a useless Game>Network Game menu
button.
This fixes https://bugzilla.gnome.org/show_bug.cgi?id=621037
gnibbles/board.c | 10 ---
gnibbles/boni.c | 10 ---
gnibbles/gnibbles.6 | 3 +-
gnibbles/gnibbles.c | 6 +--
gnibbles/help/C/gnibbles.xml | 25 +-------
gnibbles/help/C/network-games.xml | 119 ---------------------------------
gnibbles/help/Makefile.am | 3 +-
gnibbles/main.c | 131 ++-----------------------------------
gnibbles/main.h | 2 -
gnibbles/preferences.c | 27 ++------
gnibbles/warpmanager.c | 20 +-----
gnibbles/worm.c | 16 +----
12 files changed, 23 insertions(+), 349 deletions(-)
---
diff --git a/gnibbles/board.c b/gnibbles/board.c
index ef0884a..7e08601 100644
--- a/gnibbles/board.c
+++ b/gnibbles/board.c
@@ -37,10 +37,6 @@
#include "worm.h"
#include "boni.h"
-#ifdef GGZ_CLIENT
-#include "ggz-network.h"
-#endif
-
extern GnibblesWorm *worms[];
extern GnibblesProperties *properties;
extern GnibblesWarpManager *warpmanager;
@@ -363,12 +359,6 @@ gnibbles_board_level_add_bonus (GnibblesBoard *board, gint regular)
{
gint x, y, good;
-#ifdef GGZ_CLIENT
- if (!network_is_host ()) {
- return;
- }
-#endif
-
if (regular) {
good = 0;
} else {
diff --git a/gnibbles/boni.c b/gnibbles/boni.c
index 95364d0..029f6cf 100644
--- a/gnibbles/boni.c
+++ b/gnibbles/boni.c
@@ -86,11 +86,6 @@ gnibbles_boni_add_bonus (GnibblesBoni * boni, gint t_x, gint t_y,
boni->numbonuses++;
if (t_type != BONUSREGULAR)
games_sound_play ("appear");
-#ifdef GGZ_CLIENT
- if (ggz_network_mode) {
- network_add_bonus (t_x, t_y, t_type, t_fake, t_countdown);
- }
-#endif
}
void
@@ -138,11 +133,6 @@ gnibbles_boni_remove_bonus (GnibblesBoni * boni, gint x, gint y)
{
int i;
-#ifdef GGZ_CLIENT
- if (ggz_network_mode) {
- network_remove_bonus (x, y);
- }
-#endif
for (i = 0; i < boni->numbonuses; i++) {
if ((x == boni->bonuses[i]->x &&
y == boni->bonuses[i]->y) ||
diff --git a/gnibbles/gnibbles.6 b/gnibbles/gnibbles.6
index 5ca3083..142e119 100644
--- a/gnibbles/gnibbles.6
+++ b/gnibbles/gnibbles.6
@@ -24,8 +24,7 @@ Nibbles \- A worm game for GNOME
is a game where the user controls a snake. The snake moves around the
board, eating diamonds while avoiding the walls placed around it.
.P
-The game can be played against the computer or against other players,
-locally or over the network.
+The game can be played against the computer or against other players.
.SH OPTIONS
This program only accepts the standard GNOME and GTK options.
.SH AUTHORS
diff --git a/gnibbles/gnibbles.c b/gnibbles/gnibbles.c
index b9a2487..52a3e80 100644
--- a/gnibbles/gnibbles.c
+++ b/gnibbles/gnibbles.c
@@ -45,10 +45,6 @@
#include "board.h"
#include "worm.h"
-#ifdef GGZ_CLIENT
-#include "ggz-network.h"
-#endif
-
GnibblesWorm *worms[NUMWORMS];
GnibblesBoni *boni = NULL;
@@ -342,7 +338,7 @@ gboolean
gnibbles_keypress_worms (guint keyval)
{
gint i;
- gint numworms = ggz_network_mode ? 1 : properties->numworms;
+ gint numworms = properties->numworms;
for (i = 0; i < numworms; i++) {
if (worms[i]->human)
diff --git a/gnibbles/help/C/gnibbles.xml b/gnibbles/help/C/gnibbles.xml
index 82468bb..ee05ce3 100644
--- a/gnibbles/help/C/gnibbles.xml
+++ b/gnibbles/help/C/gnibbles.xml
@@ -2,7 +2,6 @@
<!DOCTYPE article PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
"http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY legal SYSTEM "legal.xml">
- <!ENTITY NETWORKGAMES SYSTEM "network-games.xml">
<!ENTITY appversion "2.20">
<!ENTITY manrevision "2.20">
<!ENTITY date "May 2007">
@@ -159,8 +158,8 @@
possible to play against worms with artificial intelligence.
</para>
<para>
- &appname; also features <link linkend="network-games">multiplayer</link> support with up to six competing
- human players in hotseat or network mode.
+ &appname; also features multiplayer support with up to six competing
+ human players in hotseat mode.
</para>
</sect1>
@@ -254,17 +253,6 @@ section. For example -->
<listitem>
<para>
<menuchoice>
- <shortcut>
- <keysym>Ctrl+G</keysym>
- </shortcut>
- <guimenuitem>Network Game</guimenuitem>
- </menuchoice>
- This starts a network multiplayer game using GGZ Gaming Zone.
- </para>
- </listitem>
- <listitem>
- <para>
- <menuchoice>
<guimenuitem>Scores</guimenuitem>
</menuchoice>
This shows the high scores.
@@ -540,15 +528,6 @@ section. For example -->
</sect1>
-<!-- ============= Network games ===============================================
- This doc is common to gnome-games. The file is pulled in from gnibbles directory
- as a SVN symlink, and included here. Therefore translators only have to translate
- the network stuff once, instead of one time for each game.
- ================================ -->
-
- &NETWORKGAMES;
-
-
<!-- ============= Authors ================================ -->
<sect1 id="authors">
diff --git a/gnibbles/help/Makefile.am b/gnibbles/help/Makefile.am
index 4b49d58..f6896cd 100644
--- a/gnibbles/help/Makefile.am
+++ b/gnibbles/help/Makefile.am
@@ -5,8 +5,7 @@ DOC_LINGUAS = ca cs de el en_GB es eu fr it oc sl sr sr latin sv zh_CN
DOC_MODULE = gnibbles
DOC_ENTITIES = \
- legal.xml \
- network-games.xml
+ legal.xml
DOC_FIGURES = \
figures/game.png \
diff --git a/gnibbles/main.c b/gnibbles/main.c
index 802793b..664f5b9 100644
--- a/gnibbles/main.c
+++ b/gnibbles/main.c
@@ -54,13 +54,6 @@
#include "board.h"
#include "worm.h"
-#ifdef GGZ_CLIENT
-#include <libgames-support/games-dlg-chat.h>
-#include <libgames-support/games-dlg-players.h>
-#include "ggz-network.h"
-#include <ggz-embed.h>
-#endif
-
#define DEFAULT_WIDTH 650
#define DEFAULT_HEIGHT 520
@@ -111,8 +104,6 @@ static gint end_game_cb (GtkAction * action, gpointer data);
static void hide_logo (void);
static GtkAction *new_game_action;
-static GtkAction *new_network_action;
-static GtkAction *player_list_action;
GtkAction *pause_action;
static GtkAction *end_game_action;
static GtkAction *preferences_action;
@@ -128,23 +119,6 @@ hide_cursor (void)
}
static void
-network_gui_update (void)
-{
-
-#ifdef GGZ_CLIENT
- if (ggz_network_mode) {
- gtk_widget_show (chat);
- } else {
- gtk_widget_hide (chat);
- }
- gtk_action_set_visible (new_game_action, !ggz_network_mode);
- gtk_action_set_visible (player_list_action, ggz_network_mode);
- gtk_container_check_resize (GTK_CONTAINER (window));
-
-#endif
-}
-
-static void
show_cursor (void)
{
clutter_stage_show_cursor (CLUTTER_STAGE (stage));
@@ -156,14 +130,6 @@ game_running (void)
return (main_id || dummy_id || restart_id || games_pause_action_get_is_paused (GAMES_PAUSE_ACTION (pause_action)));
}
-static void
-on_player_list (void)
-{
-#ifdef GGZ_CLIENT
- create_or_raise_dlg_players (GTK_WINDOW (window));
-#endif
-}
-
/* Avoid a race condition where a redraw is attempted
* between the window being destroyed and the destroy
* event being sent. */
@@ -280,17 +246,6 @@ configure_event_cb (GtkWidget *widget, GdkEventConfigure *event, gpointer data)
return FALSE;
}
-#ifdef GGZ_CLIENT
-static gboolean
-network_loop (gpointer data)
-{
- if (ggz_network_mode) {
- network_move_worms ();
- }
- return TRUE;
-}
-#endif
-
static gboolean
new_game_2_cb (GtkWidget * widget, gpointer data)
{
@@ -299,21 +254,11 @@ new_game_2_cb (GtkWidget * widget, gpointer data)
keyboard_id = g_signal_connect (G_OBJECT (stage),
"key-press-event",
G_CALLBACK (key_press_cb), NULL);
-#ifdef GGZ_CLIENT
- if (!main_id && ggz_network_mode && network_is_host ()) {
- main_id = g_timeout_add (GAMEDELAY * (properties->gamespeed + NETDELAY),
- (GSourceFunc) network_loop, NULL);
- } else
-#endif
- if (!main_id && !ggz_network_mode) {
+ if (!main_id) {
main_id = g_timeout_add (GAMEDELAY * properties->gamespeed,
(GSourceFunc) main_loop, NULL);
}
-#ifdef GGZ_CLIENT
- if (!add_bonus_id && network_is_host ()) {
-#else
if (!add_bonus_id) {
-#endif
add_bonus_id = g_timeout_add (BONUSDELAY *
properties->gamespeed,
(GSourceFunc) add_bonus_cb, NULL);
@@ -329,23 +274,16 @@ gboolean
new_game (void)
{
int i;
-
- gtk_action_set_sensitive (new_network_action, FALSE);
-
- if (ggz_network_mode) {
- gtk_action_set_sensitive (pause_action, FALSE);
- } else {
- gtk_action_set_sensitive (pause_action, TRUE);
- }
+ gtk_action_set_sensitive (pause_action, TRUE);
gtk_action_set_sensitive (end_game_action, TRUE);
- gtk_action_set_sensitive (preferences_action, !ggz_network_mode);
+ gtk_action_set_sensitive (preferences_action, TRUE);
if (game_running ()) {
end_game (FALSE);
main_id = 0;
}
- if (ggz_network_mode || !properties->random) {
+ if (!properties->random) {
current_level = properties->startlevel;
} else {
current_level = rand () % MAXLEVEL + 1;
@@ -363,7 +301,6 @@ new_game (void)
}
games_pause_action_set_is_paused (GAMES_PAUSE_ACTION (pause_action), FALSE);
- gtk_action_set_visible (player_list_action, ggz_network_mode);
if (restart_id) {
g_source_remove (restart_id);
@@ -380,8 +317,6 @@ new_game (void)
dummy_id = g_timeout_add_seconds (1, (GSourceFunc) new_game_2_cb, NULL);
- network_gui_update ();
-
return TRUE;
}
@@ -451,27 +386,17 @@ end_game (gboolean show_splash)
if (show_splash) {
render_logo ();
- gtk_action_set_sensitive (new_network_action, TRUE);
gtk_action_set_sensitive (pause_action, FALSE);
gtk_action_set_sensitive (end_game_action, FALSE);
gtk_action_set_sensitive (preferences_action, TRUE);
}
- network_gui_update ();
games_pause_action_set_is_paused (GAMES_PAUSE_ACTION (pause_action), FALSE);
}
static gboolean
end_game_cb (GtkAction * action, gpointer data)
{
-
-#ifdef GGZ_CLIENT
- if (ggz_network_mode) {
- ggz_embed_leave_table ();
- gtk_notebook_set_current_page (GTK_NOTEBOOK (notebook), NETWORK_PAGE);
- }
-#endif
-
end_game (TRUE);
return FALSE;
}
@@ -566,9 +491,6 @@ main_loop (gpointer data)
str = g_strdup_printf (_("Game over! The game has been won by %s!"),
names[winner]);
-#ifdef GGZ_CLIENT
- add_chat_text (str);
-#endif
g_free (str);
if (keyboard_id) {
@@ -609,14 +531,6 @@ main_loop (gpointer data)
}
if (status == NEWROUND) {
-#ifdef GGZ_CLIENT
- if (ggz_network_mode) {
- end_game (TRUE);
- add_chat_text (_("The game is over."));
- return FALSE;
- }
-#endif
-
if (keyboard_id) {
g_signal_handler_disconnect (G_OBJECT (stage), keyboard_id);
keyboard_id = 0;
@@ -653,10 +567,9 @@ main_loop (gpointer data)
g_source_remove (main_id);
main_id = 0;
}
- if ((current_level < MAXLEVEL) && (!properties->random
- || ggz_network_mode)) {
+ if ((current_level < MAXLEVEL) && (!properties->random)) {
current_level++;
- } else if (properties->random && !ggz_network_mode) {
+ } else if (properties->random) {
tmp = rand () % MAXLEVEL + 1;
while (tmp == current_level)
tmp = rand () % MAXLEVEL + 1;
@@ -690,14 +603,6 @@ static const GtkActionEntry action_entry[] = {
{"HelpMenu", NULL, N_("_Help")},
{"NewGame", GAMES_STOCK_NEW_GAME, NULL, NULL, NULL,
G_CALLBACK (new_game_cb)},
-#ifdef GGZ_CLIENT
- {"NewNetworkGame", GAMES_STOCK_NETWORK_GAME, NULL, NULL, NULL,
- G_CALLBACK (on_network_game)},
-#else
- {"NewNetworkGame", GAMES_STOCK_NETWORK_GAME, NULL, NULL, NULL, NULL},
-#endif
- {"PlayerList", GAMES_STOCK_PLAYER_LIST, NULL, NULL, NULL,
- G_CALLBACK (on_player_list)},
{"EndGame", GAMES_STOCK_END_GAME, NULL, NULL, NULL,
G_CALLBACK (end_game_cb)},
{"Scores", GAMES_STOCK_SCORES, NULL, NULL, NULL,
@@ -714,8 +619,6 @@ static const char ui_description[] =
" <menubar name='MainMenu'>"
" <menu action='GameMenu'>"
" <menuitem action='NewGame'/>"
- " <menuitem action='NewNetworkGame'/>"
- " <menuitem action='PlayerList'/>"
" <menuitem action='EndGame'/>"
" <separator/>"
" <menuitem action='Pause'/>"
@@ -762,12 +665,6 @@ create_menus (GtkUIManager * ui_manager)
"Preferences");
fullscreen_action = GTK_ACTION (games_fullscreen_action_new ("Fullscreen", GTK_WINDOW(window)));
gtk_action_group_add_action_with_accel (action_group, fullscreen_action, NULL);
- new_network_action = gtk_action_group_get_action (action_group,
- "NewNetworkGame");
-#ifndef GGZ_CLIENT
- gtk_action_set_sensitive (new_network_action, FALSE);
-#endif
- player_list_action = gtk_action_group_get_action (action_group, "PlayerList");
}
@@ -829,11 +726,6 @@ setup_window (void)
gtk_container_add (GTK_CONTAINER (packing), clutter_widget);
-#ifdef GGZ_CLIENT
- chat = create_chat_widget ();
- gtk_box_pack_start (GTK_BOX (vbox), chat, FALSE, TRUE, 0);
-#endif
-
g_signal_connect (G_OBJECT (clutter_widget), "configure_event",
G_CALLBACK (configure_event_cb), NULL);
@@ -850,9 +742,6 @@ setup_window (void)
gtk_container_add (GTK_CONTAINER (window), vbox);
gtk_widget_show_all (window);
-#ifdef GGZ_CLIENT
- gtk_widget_hide (chat);
-#endif
scoreboard = gnibbles_scoreboard_new (statusbar);
}
@@ -1045,15 +934,9 @@ main (int argc, char **argv)
gnibbles_load_pixmap (properties->tilesize);
gnibbles_load_logo (properties->tilesize);
-#ifdef GGZ_CLIENT
- network_init ();
- network_gui_update ();
-#endif
-
gtk_action_set_sensitive (pause_action, FALSE);
gtk_action_set_sensitive (end_game_action, FALSE);
- gtk_action_set_visible (new_game_action, !ggz_network_mode);
- gtk_action_set_visible (player_list_action, ggz_network_mode);
+ gtk_action_set_visible (new_game_action, TRUE);
gtk_main ();
diff --git a/gnibbles/main.h b/gnibbles/main.h
index c49e16e..1a1d855 100644
--- a/gnibbles/main.h
+++ b/gnibbles/main.h
@@ -26,10 +26,8 @@
#include "gnibbles.h"
#define MAIN_PAGE 0
-#define NETWORK_PAGE 1
-gboolean ggz_network_mode;
int player_id;
int num_players;
int seat;
diff --git a/gnibbles/preferences.c b/gnibbles/preferences.c
index ea793f0..9108fff2 100644
--- a/gnibbles/preferences.c
+++ b/gnibbles/preferences.c
@@ -30,10 +30,6 @@
#include <libgames-support/games-controls.h>
#include <libgames-support/games-pause-action.h>
-#ifdef GGZ_CLIENT
-#include "ggz-network.h"
-#endif
-
#include "preferences.h"
#include "main.h"
@@ -50,18 +46,6 @@ extern GnibblesProperties *properties;
GtkWidget *start_level_label, *start_level_spin_button;
GtkWidget *num_human, *num_ai;
-
-static void
-network_set_preferences (void)
-{
-#ifdef GGZ_CLIENT
- if (ggz_network_mode) {
- network_req_settings (properties->gamespeed,
- properties->fakes, properties->startlevel);
- }
-#endif
-}
-
static void
destroy_cb (GtkWidget * widget, gpointer data)
{
@@ -69,7 +53,6 @@ destroy_cb (GtkWidget * widget, gpointer data)
gtk_action_activate (pause_action);
unpause = 0;
}
- network_set_preferences ();
pref_dialog = NULL;
}
@@ -318,7 +301,7 @@ gnibbles_preferences_cb (GtkWidget * widget, gpointer data)
gtk_check_button_new_with_mnemonic (_("_Play levels in random order"));
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
- if (running || ggz_network_mode)
+ if (running)
gtk_widget_set_sensitive (button, FALSE);
if (properties->random)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
@@ -380,7 +363,7 @@ gnibbles_preferences_cb (GtkWidget * widget, gpointer data)
gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
gtk_table_attach (GTK_TABLE (table2), label2, 0, 1, 1, 2, GTK_FILL, 0, 0, 0);
- if (running || ggz_network_mode)
+ if (running)
gtk_widget_set_sensitive (label2, FALSE);
adjustment = gtk_adjustment_new ((gfloat) properties->human, 0.0,
@@ -391,7 +374,7 @@ gnibbles_preferences_cb (GtkWidget * widget, gpointer data)
gtk_label_set_mnemonic_widget (GTK_LABEL (label2), num_human);
gtk_table_attach_defaults (GTK_TABLE (table2), num_human, 1, 2, 1, 2);
- if (running || ggz_network_mode)
+ if (running)
gtk_widget_set_sensitive (num_human, FALSE);
g_signal_connect (GTK_ADJUSTMENT (adjustment), "value_changed",
G_CALLBACK (num_worms_cb), num_human);
@@ -400,7 +383,7 @@ gnibbles_preferences_cb (GtkWidget * widget, gpointer data)
gtk_misc_set_alignment (GTK_MISC (label2), 0, 0.5);
gtk_table_attach (GTK_TABLE (table2), label2, 0, 1, 2, 3, GTK_FILL, 0, 0, 0);
- if (running || ggz_network_mode)
+ if (running)
gtk_widget_set_sensitive (label2, FALSE);
adjustment = gtk_adjustment_new ((gfloat) properties->ai, 0.0,
@@ -411,7 +394,7 @@ gnibbles_preferences_cb (GtkWidget * widget, gpointer data)
gtk_label_set_mnemonic_widget (GTK_LABEL (label2), num_ai);
gtk_table_attach_defaults (GTK_TABLE (table2), num_ai, 1, 2, 2, 3);
- if (running || ggz_network_mode)
+ if (running)
gtk_widget_set_sensitive (num_ai, FALSE);
g_signal_connect (GTK_ADJUSTMENT (adjustment), "value_changed",
G_CALLBACK (num_worms_cb), num_ai);
diff --git a/gnibbles/warpmanager.c b/gnibbles/warpmanager.c
index 040f87d..4aeea88 100644
--- a/gnibbles/warpmanager.c
+++ b/gnibbles/warpmanager.c
@@ -132,14 +132,8 @@ gnibbles_warpmanager_worm_change_pos (GnibblesWarpManager * warpmanager,
if (warpmanager->warps[i]->wx == -1) {
good = 0;
while (!good) {
- // In network games, warps should be fair.
- if (ggz_network_mode) {
- x = 10 % BOARDWIDTH;
- y = 10 % BOARDHEIGHT;
- } else {
- x = rand () % BOARDWIDTH;
- y = rand () % BOARDHEIGHT;
- }
+ x = rand () % BOARDWIDTH;
+ y = rand () % BOARDHEIGHT;
if (board->walls[x][y] == EMPTYCHAR)
good = 1;
}
@@ -184,14 +178,8 @@ gnibbles_warpmanager_worm_change_tail_pos (GnibblesWarpManager * warpmanager,
if (warpmanager->warps[i]->wx == -1) {
good = 0;
while (!good) {
- // In network games, warps should be fair.
- if (ggz_network_mode) {
- x = 10 % BOARDWIDTH;
- y = 10 % BOARDHEIGHT;
- } else {
- x = rand () % BOARDWIDTH;
- y = rand () % BOARDHEIGHT;
- }
+ x = rand () % BOARDWIDTH;
+ y = rand () % BOARDHEIGHT;
if (board->walls[x][y] == EMPTYCHAR)
good = 1;
}
diff --git a/gnibbles/worm.c b/gnibbles/worm.c
index 65172b6..880f2d6 100644
--- a/gnibbles/worm.c
+++ b/gnibbles/worm.c
@@ -39,9 +39,6 @@
#include "warpmanager.h"
#include "properties.h"
#include "board.h"
-#ifdef GGZ_CLIENT
-#include "ggz-network.h"
-#endif
#include "worm.h"
@@ -111,16 +108,7 @@ worm_set_direction (int worm, int dir)
void
worm_handle_direction (int worm, int dir)
{
- if (ggz_network_mode) {
-#ifdef GGZ_CLIENT
- network_game_move (dir);
-
- worms[0]->direction = dir;
- worms[0]->keypress = 1;
-#endif
- } else {
- worm_set_direction (worm, dir);
- }
+ worm_set_direction (worm, dir);
}
static void
@@ -201,7 +189,7 @@ gnibbles_worm_handle_keypress (GnibblesWorm * worm, guint keyval)
if (worm->lives <= 0)
return FALSE;
- props = properties->wormprops[ggz_network_mode ? 0 : worm->number];
+ props = properties->wormprops[worm->number];
propsUp = toupper(props->up);
propsLeft = toupper(props->left);
propsDown = toupper(props->down);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]