示例#1
0
static void
mmo_end_of_route(mmo_data_t *data)
{
#ifdef MMO_DBG
	const char *sobj = "CObjRoute";
#endif
	route_head *rte = data->data;
	int rtept = rte->rte_waypt_ct;
	int i;
	char buf[64];
		
	if (data->visible && data->loop) {
		DBG((sobj, "route \"%s\" is a loop.\n", data->name));
		(void) mmo_read_object(NULL);
		rtept--;
	}

	if (mmo_version >= 0x12) {
		mmo_fillbuf(buf, 7, 1);
		DBG((sobj, "route data (since 0x12): "));
		mmo_printbuf(buf, 7, "");
		
		rte->line_color.bbggrr = le_read32(&buf[0]);
		rte->line_color.opacity = 255 - (buf[6] * 51);
		DBG((sobj, "color = 0x%06X\n", rte->line_color.bbggrr));
		DBG((sobj, "transparency = %d (-> %d)\n", buf[6], rte->line_color.opacity));
	}

	if (data->visible) {
		for (i = 0; i < rtept; i++) (void) mmo_read_object(NULL);
	}
	if (data->loop && (data->done > 1)) {
		queue *elem;
					
		elem = QUEUE_FIRST(&rte->waypoint_list);
		dequeue(elem);
		ENQUEUE_TAIL(&rte->waypoint_list, elem);
	}

	if (rte->rte_waypt_ct == 0) {	/* don't keep empty routes */
		route_del_head(rte);
		data->data = NULL;
	}
}
示例#2
0
static void
any_route_add_head( route_head *rte, queue *head ) {
	ENQUEUE_TAIL( head, &rte->Q );
}