Commit b202d49a authored by Jonathan Michalon's avatar Jonathan Michalon
Browse files

Cosmetics: as things are going on, we must change output

Added row / column output on board dump. The goal is to ease testing of tile
addition by a user (next step I think).
Commented out quite some debug messages, as what they were debugging
could be considered as correct for now. We could / should implement a
debug handel with levels, grouping the outputs and allowing easy on/off.
parent 2bf39e2d
......@@ -333,6 +333,13 @@ ovcc_board_dump (OVCCBoard *board)
gint i, j, line;
guint mask;
OVCCPosition pos;
/* Output the position numbers */
g_print (" ");
for (j=board->leftedge; j<=board->rightedge; j++) {
g_print ("|%3i |", j);
}
g_print ("\n");
for (i=board->topedge; i<=board->bottomedge; i++) {
pos.y = i;
......@@ -354,6 +361,13 @@ ovcc_board_dump (OVCCBoard *board)
mask = OVCC_TILE_DUMP_BOTTOM;
break;
}
if (line == 2) {
g_print ("%3i ", i);
} else if (line == -1 || line == 5) {
g_print ("----");
} else {
g_print (" ");
}
for (j=board->leftedge; j<=board->rightedge; j++) {
pos.x = j;
if (ovcc_board_is_tile_there (board, &pos)) {
......@@ -371,4 +385,10 @@ ovcc_board_dump (OVCCBoard *board)
g_print ("\n");
}
}
/* Output the position numbers */
g_print (" ");
for (j=board->leftedge; j<=board->rightedge; j++) {
g_print ("|%3i |", j);
}
g_print ("\n");
}
......@@ -471,7 +471,7 @@ ovcc_tile_new_auto_v (OVCCTileID id,
}
}
g_debug ("Checking consistency of tile #%d...", id);
/* g_debug ("Checking consistency of tile #%d...", id); */
for (side_i = 0; success && side_i < OVCC_TILE_SIDE_NUM; side_i++) {
int side_j;
......@@ -490,7 +490,11 @@ ovcc_tile_new_auto_v (OVCCTileID id,
success = FALSE;
}
}
g_debug (success ? "Tile seems consistent." : "Tile seems bad!");
if (success) {
/* g_debug ("Tile seems consistent."); */
} else {
g_debug ("Tile seems bad!");
}
return success ? ovcc_tile_new_v (id, sides, center) : NULL;
}
......
......@@ -131,7 +131,7 @@ free_tile (gpointer data)
{
OVCCTile *tile = data;
ovcc_tile_dump (tile, OVCC_TILE_DUMP_ALL);
/* ovcc_tile_dump (tile, OVCC_TILE_DUMP_ALL); */
ovcc_tile_unref (tile);
}
......@@ -471,13 +471,13 @@ read_side (xmlNode *node,
for (child = node->children; success && child; child = child->next) {
if (child->type == XML_ELEMENT_NODE) {
if (xmlStrcmp (TF_SIDE_TYPE, child->name) == 0) {
g_debug ("Found a side type (%s)", child->children->content);
/* g_debug ("Found a side type (%s)", child->children->content); */
type = ovcc_tile_content_type_from_string (child->children->content);
} else if (xmlStrcmp (TF_SIDE_RELS, child->name) == 0) {
g_debug ("Found side relations");
/* g_debug ("Found side relations"); */
relations = read_side_relations (child);
} else if (xmlStrcmp (TF_SIDE_ATTRS, child->name) == 0) {
g_debug ("Found side attributes");
/* g_debug ("Found side attributes"); */
attributes = read_side_attributes (child);
} /*else {
g_warning ("Malformed file! Unexpected element <%s> inside <%s>",
......@@ -539,7 +539,7 @@ read_tile (xmlNode *node,
for (child = node->children; success && child; child = child->next) {
if (child->type == XML_ELEMENT_NODE) {
if (xmlStrcmp (TF_CENTER, child->name) == 0) {
g_debug ("Found a center (%s)", child->children->content);
/* g_debug ("Found a center (%s)", child->children->content); */
center_type = ovcc_tile_content_type_from_string (child->children->content);
} else if (xmlStrcmp (TF_SIDE, child->name) == 0) {
OVCCTileSide *side;
......@@ -549,7 +549,7 @@ read_tile (xmlNode *node,
if (side) {
sides[side_pos] = side;
}
g_debug ("Found sides");
/* g_debug ("Found sides"); */
} /*else {
g_set_error (error, G_MARKUP_ERROR, G_MARKUP_ERROR_UNKNOWN_ELEMENT,
"[%s:%u] Element <%s> contains unknown element <%s>",
......@@ -562,7 +562,7 @@ read_tile (xmlNode *node,
if (success) {
GError *err = NULL;
g_debug ("Tile ID is %u", id);
/* g_debug ("Tile ID is %u", id); */
/* create the tile */
tile = ovcc_tile_new_auto_v (id, sides, center_type, &err);
if (! tile) {
......
......@@ -548,7 +548,7 @@ read_first (xmlNode *node,
if (success) {
OVCCTile *tile;
g_debug ("first tile is: %u", id);
/* g_debug ("first tile is: %u", id); */
tile = ovcc_tilesdef_get_tile (tiles, id);
if (! tile) {
g_set_error (error, OVCC_TILESET_ERROR, OVCC_TILESET_ERROR_MISSING_TILE,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment