Ejemplo n.º 1
0
Archivo: world.c Proyecto: cmr/iiag
//
// Makes sure everything is in a usable state
// Only does something the first time it is called
//
void assure_world(void)
{
	static int first = 1;

	if (first) {
		world.tm.era   = 3;
		world.tm.year  = 329;
		world.tm.month = 4;
		world.tm.mday  = 5;
		world.tm.wday  = 4;
		world.tm.hour  = 9;
		world.tm.min   = 0;

		crtr_init(&world.plyr, '@' | A_BOLD);
		vector_init(&world.zones);

		world.gcrtrs = new_gclass(NULL);
		world.gitems = new_gclass(NULL);
		world.gmats  = new_gclass(NULL);

		// allocate 16 actions to start
		world.acts = malloc(sizeof(action_node) * 16);
		world.acts_cnt = 0;
		world.acts_alloc = 16;

		// load name data
		world.eth = load_ethnicity("names/misriyyun");

		first = 0;
	}
}
Ejemplo n.º 2
0
void init_world(void)
{
	int x, y;
	cform * f;

	world.zones = malloc(sizeof(zone *));

	load_iforms();
	load_cforms();

	*world.zones = zone_new(500, 300);

	f = cform_new('@' | A_BOLD);
	f->weight = TILE_MAX_WEIGHT / 2;
	f->max_health = 10;

	crtr_init(&world.plyr, f);
	world.plyr.nofree = 1;
	world.plyr.inv = inv_new(500);
	world.plyr.attack = 5;

	do {
		x = random() % get_dispw();
		y = random() % get_disph();
	} while (!crtr_tele(&world.plyr, x, y, *world.zones));

	zone_update(world.plyr.z, x, y);
}
Ejemplo n.º 3
0
creature * crtr_new(cform * f)
{
	creature * c = malloc(sizeof(creature));
	crtr_init(c, f);
	return c;
}