Commit 14bd66ec authored by Jonathan Michalon's avatar Jonathan Michalon

Renamed and corrected namespace "tiles" to "tileset"

parent 39917935
......@@ -3,7 +3,7 @@ noinst_PROGRAMS = test
libovcc_la_CPPFLAGS = -DG_LOG_DOMAIN=\"libovcc\"
libovcc_la_SOURCES = tile.c \
tiles.c
tileset.c
test_LDADD = libovcc.la -lpthread
test_SOURCES = test.c
......@@ -20,7 +20,7 @@
#include <libxml/parser.h>
#include <gio/gio.h>
#include "tiles.h"
#include "tileset.h"
int
......@@ -37,14 +37,14 @@ main (int argc,
if (argc >= 2) {
file = g_file_new_for_commandline_arg (argv[1]);
tileset = ovcc_tile_set_new ();
if (! ovcc_tile_set_load (tileset, file, NULL, &err)) {
tileset = ovcc_tileset_new ();
if (! ovcc_tileset_load (tileset, file, NULL, &err)) {
g_critical ("Load error: %s", err ? err->message : "???");
g_clear_error (&err);
} else {
success = TRUE;
}
ovcc_tile_set_free (tileset);
ovcc_tileset_free (tileset);
g_object_unref (file);
}
......
......@@ -22,7 +22,7 @@
#include <libxml/tree.h>
#include <string.h>
#include "tiles.h"
#include "tileset.h"
#include "tile.h"
......@@ -47,7 +47,7 @@ free_tile (gpointer data)
*
*/
OVCCTileSet *
ovcc_tile_set_new (void)
ovcc_tileset_new (void)
{
OVCCTileSet *set;
......@@ -66,7 +66,7 @@ ovcc_tile_set_new (void)
*
*/
void
ovcc_tile_set_free (OVCCTileSet *set)
ovcc_tileset_free (OVCCTileSet *set)
{
if (set) {
g_hash_table_destroy (set->tiles);
......@@ -81,7 +81,7 @@ ovcc_tile_set_free (OVCCTileSet *set)
* Removes all tiles in the given tile set.
*/
void
ovcc_tile_set_clear (OVCCTileSet *set)
ovcc_tileset_clear (OVCCTileSet *set)
{
g_hash_table_remove_all (set->tiles);
}
......@@ -90,27 +90,27 @@ ovcc_tile_set_clear (OVCCTileSet *set)
* @brief Removes a tile from a set
* @param set A TileSet
* @param id The ID of the tile to remove from the set.
* @returns TRUE if the tile was remove, false if it wasn't found in the set.
* @returns TRUE if the tile was removed, false if it wasn't found in the set.
*
*
*/
gboolean
ovcc_tile_set_remove (OVCCTileSet *set,
ovcc_tileset_remove (OVCCTileSet *set,
OVCCTileID id)
{
return g_hash_table_remove (set->tiles, GINT_TO_POINTER (id));
}
/**
* @brief Gets whether a tile is on a set
* @brief Get whether a tile is in a set
* @param set A TileSet
* @param id The ID of the tile to search for
* @returns TRUE if the tile is found on the set, FALSE otherwise.
* @returns TRUE if the tile is found in the set, FALSE otherwise.
*
* Searches for a tile in a set.
*/
gboolean
ovcc_tile_set_has_tile (OVCCTileSet *set,
ovcc_tileset_has_tile (OVCCTileSet *set,
OVCCTileID id)
{
return g_hash_table_lookup (set->tiles, GINT_TO_POINTER (id)) != NULL;
......@@ -123,13 +123,19 @@ ovcc_tile_set_has_tile (OVCCTileSet *set,
*
*/
gboolean
ovcc_tile_set_is_empty (OVCCTileSet *set)
ovcc_tileset_is_empty (OVCCTileSet *set)
{
return g_hash_table_size (set->tiles) == 0;
}
/**
* @brief Add a Tile to a TileSet
* @param set The TileSet to use
* @param tile The Tile to add
*
*/
void
ovcc_tile_set_add_tile (OVCCTileSet *set,
ovcc_tileset_add_tile (OVCCTileSet *set,
OVCCTile *tile)
{
g_hash_table_insert (set->tiles, GINT_TO_POINTER (ovcc_tile_get_id (tile)),
......@@ -397,7 +403,7 @@ read_tiles (xmlNode *node,
if (! tile) {
success = FALSE;
} else {
ovcc_tile_set_add_tile (set, tile);
ovcc_tileset_add_tile (set, tile);
}
} /*else {
success = FALSE;
......@@ -443,7 +449,7 @@ read_tiledoc (xmlNode *node,
*
*/
gboolean
ovcc_tile_set_load (OVCCTileSet *set,
ovcc_tileset_load (OVCCTileSet *set,
GFile *tiles,
GFile *tileset,
GError **error)
......
......@@ -31,18 +31,18 @@
typedef struct s_OVCCTileSet OVCCTileSet;
OVCCTileSet *ovcc_tile_set_new (void);
void ovcc_tile_set_free (OVCCTileSet *set);
gboolean ovcc_tile_set_load (OVCCTileSet *set,
GFile *tiles,
GFile *tileset,
GError **error);
void ovcc_tile_set_clear (OVCCTileSet *set);
gboolean ovcc_tile_set_remove (OVCCTileSet *set,
OVCCTileID id);
gboolean ovcc_tile_set_has_tile (OVCCTileSet *set,
OVCCTileID id);
gboolean ovcc_tile_set_is_empty (OVCCTileSet *set);
OVCCTileSet *ovcc_tileset_new (void);
void ovcc_tileset_free (OVCCTileSet *set);
gboolean ovcc_tileset_load (OVCCTileSet *set,
GFile *tiles,
GFile *tileset,
GError **error);
void ovcc_tileset_clear (OVCCTileSet *set);
gboolean ovcc_tileset_remove (OVCCTileSet *set,
OVCCTileID id);
gboolean ovcc_tileset_has_tile (OVCCTileSet *set,
OVCCTileID id);
gboolean ovcc_tileset_is_empty (OVCCTileSet *set);
#endif /* guard */
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