[atomix/wip/kill-libxml] Code cleanup
- From: Robert Roth <robertroth src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [atomix/wip/kill-libxml] Code cleanup
- Date: Sat, 17 Jan 2015 22:44:16 +0000 (UTC)
commit 87c114bdcc2982de8a9deca4ae4a0ce6632f1f44
Author: Robert Roth <robert roth off gmail com>
Date: Sun Jan 18 00:43:50 2015 +0200
Code cleanup
src/level.c | 65 -----------------------------------
src/main.c | 13 -------
src/playfield.c | 89 ------------------------------------------------
src/playfield.h | 4 --
src/tile.c | 102 -------------------------------------------------------
src/tile.h | 4 --
6 files changed, 0 insertions(+), 277 deletions(-)
---
diff --git a/src/level.c b/src/level.c
index 655819e..7981674 100644
--- a/src/level.c
+++ b/src/level.c
@@ -169,68 +169,3 @@ PlayField *level_get_scenario (Level *level)
return level->priv->scenario;
}
-#if 0
-void level_save_xml (Level *level, gchar *filename)
-{
- xmlDocPtr doc;
- xmlAttrPtr attr;
- xmlNodePtr level_node;
- xmlNodePtr playfield_node;
- xmlNodePtr goal_node;
- xmlNodePtr child_node;
- gchar *str_buffer;
- gint length;
-
- str_buffer = g_malloc(5 * sizeof (gchar));
-
- /* create xml doc */
- doc = xmlNewDoc ("1.0");
- xmlSetDocCompressMode (doc, 9);
-
- /* level name */
- level_node = xmlNewDocNode (doc, NULL, "LEVEL", NULL);
- doc->xmlRootNode = level_node;
- attr = xmlSetProp (level_node, "name", g_strdup(level->name));
-
- /* set revision number */
- child_node = xmlNewChild (level_node, NULL, "REVISION", "2");
-
- /* time */
- child_node = xmlNewChild (level_node, NULL, "TIME", NULL);
- length = g_snprintf (str_buffer, 5, "%i", level->time);
- attr = xmlSetProp (child_node, "secs", g_strdup (str_buffer));
-
- /* level */
- child_node = xmlNewChild (level_node, NULL, "LEVEL", NULL);
- attr = xmlSetProp (child_node, "name", g_strdup (level->level_name));
-
- /* next */
- child_node = xmlNewChild (level_node, NULL, "NEXT", NULL);
- attr = xmlSetProp (child_node, "level", g_strdup (level->next));
-
- /* first level */
- if (level->first_level)
- {
- child_node = xmlNewChild (level_node, NULL, "FIRST_LEVEL", NULL);
- }
-
- /* bonus level */
- if (level->bonus_level)
- {
- child_node = xmlNewChild (level_node, NULL, "BONUS_LEVEL", NULL);
- }
-
- /* Playfield */
- playfield_node = xmlNewChild (level_node, NULL, "PLAYFIELD", NULL);
- playfield_save_xml (level->playfield, playfield_node);
-
- /* Goal */
- goal_node = xmlNewChild (level_node, NULL, "GOAL", NULL);
- playfield_save_xml (level->goal, goal_node);
-
- xmlSaveFile (filename, doc);
-
- xmlFreeDoc (doc);
- g_free (str_buffer);
-}
-#endif
diff --git a/src/main.c b/src/main.c
index ac89851..51e8d40 100644
--- a/src/main.c
+++ b/src/main.c
@@ -448,19 +448,6 @@ static void view_congratulations (void)
gtk_widget_destroy (GTK_WIDGET (dlg));
}
-#if 0
-dlg = gtk_message_dialog_new (GTK_WINDOW (app->mainwin),
- GTK_DIALOG_MODAL,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_OK,
- "%s", _("Couldn't find at least one level."));
-gtk_dialog_run (GTK_DIALOG (dlg));
-gtk_widget_destroy (GTK_WIDGET (dlg));
-
-
-_("Do you want to finish the game?"));
-#endif
-
/* ===============================================================
UI update functions
diff --git a/src/playfield.c b/src/playfield.c
index dfd0d67..99cab3c 100644
--- a/src/playfield.c
+++ b/src/playfield.c
@@ -500,95 +500,6 @@ static void read_tile (PlayField *pf, guint row, guint col, xmlNodePtr node)
}
}
-#if 0
-/*
- * Creates the XML representation of an PlayField.
- * pf = Playfield to save
- * pf_node = reference to the <PLAYFIELD> Tag node
- */
-void playfield_save_xml (PlayField *pf, xmlNodePtr pf_node)
-{
- PlayFieldPrivate *priv;
- gint row, col;
- xmlAttrPtr attr;
- xmlNodePtr tile_node;
- gint max_row = 0;
- gint min_row = 10000;
- gint max_col = 0;
- gint min_col = 10000;
- gint n_rows, n_cols;
-
- g_return_if_fail (IS_PLAYFIELD (pf));
- priv = pf->priv;
-
- /* determine the really used playfield size */
- for (row = 0; row < priv->n_rows; row++)
- {
- for (col = 0; col < priv->n_cols; col++)
- {
- Tile *tile = playfield_get_tile (pf, row, col);
- if (tile_get_tile_type (tile) != TILE_TYPE_UNKNOWN)
- {
- max_row = MAX (max_row, row);
- min_row = MIN (min_row, row);
- max_col = MAX (max_col, col);
- min_col = MIN (min_col, col);
- }
- }
- }
-
- /* number of columns and rows */
- n_rows = max_row - min_row + 1;
- n_cols = max_col - min_col + 1;
-
- if ((n_rows > 0) && (n_cols > 0))
- {
- gchar *str_buffer;
- gint length;
-
- str_buffer = g_malloc (5 * sizeof (gchar));
-
- length = g_snprintf (str_buffer, 5, "%i", n_rows);
- attr = xmlSetProp (pf_node, "rows", g_strdup (str_buffer));
- length = g_snprintf (str_buffer, 5, "%i", n_cols);
- attr = xmlSetProp (pf_node, "cols", g_strdup (str_buffer));
-
- /* add every non empty tile */
- for (row = 0; row < priv->n_rows; row++)
- {
- for (col = 0; col < priv->n_cols; col++)
- {
- Tile *tile = playfield_get_tile (pf, row, col);
- if (tile_get_tile_type (tile) != TILE_TYPE_UNKNOWN)
- {
- tile_node = xmlNewChild (pf_node, NULL, "TILE", NULL);
- length = g_snprintf (str_buffer, 5, "%i", row - min_row);
- attr = xmlSetProp (tile_node, "row", g_strdup (str_buffer));
- length = g_snprintf (str_buffer, 5, "%i", col - min_col);
- attr = xmlSetProp (tile_node, "col", g_strdup (str_buffer));
- tile_save_xml (tile, tile_node);
- }
- }
- }
- g_free (str_buffer);
- }
- else
- {
- gchar *str_buffer;
- gint length;
-
- str_buffer = g_malloc (5 * sizeof (gchar));
-
- length = g_snprintf (str_buffer, 5, "%i", priv->n_rows);
- attr = xmlSetProp (pf_node, "rows", g_strdup (str_buffer));
- length = g_snprintf (str_buffer, 5, "%i", priv->n_cols);
- attr = xmlSetProp (pf_node, "cols", g_strdup (str_buffer));
-
- g_free (str_buffer);
- }
-}
-#endif
-
/*=================================================================
Functions for generating playfields from basic level descriptions.
diff --git a/src/playfield.h b/src/playfield.h
index db68a2a..9933a60 100644
--- a/src/playfield.h
+++ b/src/playfield.h
@@ -82,8 +82,4 @@ PlayField *playfield_generate_environment (PlayField * pf, Theme * theme);
PlayField *playfield_generate_shadow (PlayField * pf);
-#if 0
-void playfield_save_xml (PlayField * pf, xmlNodePtr node);
-#endif
-
#endif /* _ATOMIX_PLAY_FIELD_H */
diff --git a/src/tile.c b/src/tile.c
index 708fbd2..d4545a2 100644
--- a/src/tile.c
+++ b/src/tile.c
@@ -273,71 +273,7 @@ void tile_print (Tile *tile)
}
g_print ("%s ", type_str);
-#if 0
- g_print ("Tile TYPE: %s BASE_ID: %i LINK_IDs: ",
- type_str, tile->priv->base_id);
- for (link = 0; link < TILE_LINK_LAST; link++)
- {
- if (tile->priv->link_id[link])
- {
- switch (link)
- {
- case TILE_LINK_LEFT:
- g_print ("left, ");
- break;
-
- case TILE_LINK_RIGHT:
- g_print ("right, ");
- break;
-
- case TILE_LINK_TOP:
- g_print ("top, ");
- break;
-
- case TILE_LINK_BOTTOM:
- g_print ("bottom,");
- break;
-
- case TILE_LINK_TOP_LEFT:
- g_print ("top-left, ");
- break;
-
- case TILE_LINK_TOP_RIGHT:
- g_print ("top-right, ");
- break;
-
- case TILE_LINK_BOTTOM_LEFT:
- g_print ("bottom-left, ");
- break;
-
- case TILE_LINK_BOTTOM_RIGHT:
- g_print ("bottom-right, ");
- break;
-
- case TILE_LINK_LEFT_DOUBLE:
- g_print ("left-double, ");
- break;
-
- case TILE_LINK_RIGHT_DOUBLE:
- g_print ("right-double, ");
- break;
-
- case TILE_LINK_TOP_DOUBLE:
- g_print ("top-double, ");
- break;
-
- case TILE_LINK_BOTTOM_DOUBLE:
- g_print ("bottom-double, ");
- break;
-
- default:
- g_print ("Unknown, ");
- break;
- }
- }
- }
-#endif
}
@@ -430,41 +366,3 @@ Tile *tile_new_from_xml (xmlNodePtr node)
return tile;
}
-#if 0
-void tile_save_xml (Tile *tile, xmlNodePtr tile_node)
-{
- xmlNodePtr child;
- gchar *str_buffer;
- gint length;
- GSList *conn_id;
- TileType type;
- gint img_id;
-
- str_buffer = g_malloc (5 * sizeof (gchar));
-
- if (tile && tile_node)
- {
- /* add tile type */
- type = tile_get_type (tile);
- length = g_snprintf (str_buffer, 5, "%i", (gint) type);
- child = xmlNewChild (tile_node, NULL, "TYPE", str_buffer);
-
- /* add image id */
- img_id = tile_get_image_id (tile);
- length = g_snprintf (str_buffer, 5, "%i", img_id);
- child = xmlNewChild (tile_node, NULL, "IMG_ID", str_buffer);
-
- /* add link id */
- conn_id = tile->conn_ids;
- while (conn_id)
- {
- gint value = GPOINTER_TO_QUARK (conn_id->data);
- length = g_snprintf (str_buffer, 5, "%i", value);
- child = xmlNewChild (tile_node, NULL, "CONN_ID", str_buffer);
- conn_id = conn_id->next;
- }
- }
-
- g_free (str_buffer);
-}
-#endif
diff --git a/src/tile.h b/src/tile.h
index c175a79..f4a3bb8 100644
--- a/src/tile.h
+++ b/src/tile.h
@@ -88,8 +88,4 @@ void tile_print (Tile * tile);
gboolean tile_is_equal (Tile * tile, Tile * comp);
-#if 0
-void tile_save_xml (Tile * tile, xmlNodePtr parent);
-#endif
-
#endif /* _TILE_H */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]