}
static void
-gtk_map_render_waypoint(GtkWidget *widget, guint x1, guint y1)
+gtk_map_render_waypoint(GtkWidget *widget, guint x, guint y)
{
GtkMap *map;
GtkMapPriv *priv;
gc=priv->gc_waypoint;
-if ((x1 > priv->buf_width_pixels) || (y1 > priv->buf_height_pixels))
+if ((x > priv->buf_width_pixels) || (y > priv->buf_height_pixels))
return;
-gdk_draw_arc(widget->window, gc, FALSE, x1 - priv->draw_width, y1 - priv->draw_width, 2 * priv->draw_width, 2 * priv->draw_width, 0, 360 * 64);
+
+gdk_draw_arc(widget->window, gc, FALSE, x - priv->draw_width, y - priv->draw_width, 2 * priv->draw_width, 2 * priv->draw_width, 0, 360 * 64);
}
+/**
+ * gtk_map_render_path_segment:
+ * @widget
+ * @unitx1
+ * @unity1
+ * @unitx2
+ * @unity2
+ *
+ * Draw a path segment from unitx/y1 to unitx/y2
+ */
static void
gtk_map_render_path_segment(GtkWidget *widget, guint unitx1, guint unity1, guint unitx2, guint unity2)
{
}
}
+/**
+ * gtk_map_render_path:
+ * @widget
+ * @path
+ * @event
+ *
+ */
static void
gtk_map_render_path(GtkWidget *widget, Path *path, GdkEventExpose *event)
{
priv=GTK_MAP_GET_PRIVATE(map);
for (curr = path->head, wcurr = path->whead; curr++ != path->tail;) {
- /* Draw the line from (curr - 1) to (curr). */
+ /* Draw the line from (curr - 1) to (curr). */
gtk_map_render_path_segment(widget, curr[-1].unitx, curr[-1].unity, curr->unitx, curr->unity);
+
/* Now, check if curr is a waypoint. */
if (wcurr && wcurr <= path->wtail && wcurr->point == curr) {
- guint x1 = unit2bufx(wcurr->point->unitx);
- guint y1 = unit2bufy(wcurr->point->unity);
+ guint wx;
+ guint wy;
+
+ wx=unit2bufx(wcurr->point->unitx);
+ wy=unit2bufy(wcurr->point->unity);
- gtk_map_render_waypoint(widget, x1, y1);
+ gtk_map_render_waypoint(widget, wx, wy);
wcurr++;
}
}
GTK_MAP_TILE_SIZE_PIXELS,
GTK_MAP_TILE_SIZE_PIXELS);
} else {
- gtk_map_render_tile(GTK_MAP(map),
+ gtk_map_render_tile(widget,
new_base_tilex + new_x,
new_base_tiley + new_y,
new_x * GTK_MAP_TILE_SIZE_PIXELS,
gboolean
gtk_map_goto_position(GtkWidget *widget, Position *pos)
{
-g_return_if_fail(GTK_IS_MAP(widget));
-g_return_if_fail(pos);
+g_return_val_if_fail(GTK_IS_MAP(widget), FALSE);
+g_return_val_if_fail(pos, FALSE);
if (pos->valid==FALSE)
return FALSE;
for (y = 0; y < priv->buf_height_tiles; ++y)
for (x = 0; x < priv->buf_width_tiles; ++x)
- gtk_map_render_tile(map, priv->base_tilex + x, priv->base_tiley + y, x * GTK_MAP_TILE_SIZE_PIXELS, y * GTK_MAP_TILE_SIZE_PIXELS, FALSE);
+ gtk_map_render_tile(widget, priv->base_tilex + x, priv->base_tiley + y, x * GTK_MAP_TILE_SIZE_PIXELS, y * GTK_MAP_TILE_SIZE_PIXELS, FALSE);
gtk_widget_queue_draw(widget);
}
GtkMap *map;
GtkMapPriv *priv;
+g_return_val_if_fail(GTK_IS_MAP(widget), FALSE);
+
+map=GTK_MAP(widget);
+priv=GTK_MAP_GET_PRIVATE(map);
+
/* Check that we have a track path set */
return TRUE;
}