Beispiel #1
0
int create_map(map_info *map, int typ, platform **first, platform **last){ //Create part of map
	unsigned int farby[] = {COLOR(0x1007eb), COLOR(0x6008ce), COLOR(0xcef900), COLOR(0x5cb6ff),
	                        COLOR(0x00c500), COLOR(0x592265), COLOR(0x2900b0), COLOR(0xffffff)}; //Platform colors
	int dif;
	int i;
	typ--;
	SDL_Rect surf2 = {0, BACK_Y, 0, 0};
	SDL_Rect surf = {0, 0, gd->screen.width, gd->screen.height};
	SDL_BlitSurface(map->surface, &surf, map->surface, &surf2);

	for(i = 0;i < gd->screen.width;i += BACK_X){
		surf.x = i;
		SDL_BlitSurface(gd->background, NULL, map->surface, &surf);
	}
	remove_empty(first);
	map->previous += 50; // For score
	map->diff += BACK_Y;
	if(map->diff > 0){
		dif=rand()%(gd->screen.width - (int)(gd->screen.width*TYP_X));
		if(map->diff > 30)
			map->diff = 30; //Could be done better
		blit_plosinu(typ%8, dif, map->diff, farby[typ%8], map->surface);
		(*last)->next = (platform *)malloc(sizeof(platform));
		*last = (*last)->next;
		(*last)->x = dif;
		(*last)->y = map->diff;
		(*last)->type = typ%8;
		(*last)->width = (int)(gd->screen.width*TYP_X);
		(*last)->next = NULL;
		dif = rand()%(int)(JUMP_MAX/3.0) + (int)(JUMP_MAX*2.0/3.0);
		map->diff -= dif;
	}
	return 1;
}
Beispiel #2
0
void
test_remove(void)
{
	int ntests = 0, lost_points = 0;
	int result;

	test_remove_path(&ntests, &lost_points);

	ntests++;
	result = remove_dir();
	handle_result(result, &lost_points);

	ntests++;
	result = remove_dot();
	handle_result(result, &lost_points);

	ntests++;
	result = remove_dotdot();
	handle_result(result, &lost_points);

	ntests++;
	result = remove_empty();
	handle_result(result, &lost_points);

	if(!lost_points)
		success(TEST161_SUCCESS, SECRET, "/testbin/badcall");
}
Beispiel #3
0
void
test_remove(void)
{
	test_remove_path();

	remove_dir();
	remove_dot();
	remove_dotdot();
	remove_empty();
}
Beispiel #4
0
/*
  load xml confguration file into memory
*/
int load_config(char *file)
{ 
  doc = xmlReadFile(file, NULL, 0);
  
  if (doc == NULL) {
    fprintf(stderr, "error: could not parse file %s\n", file);
    return (-1);
  } else {    
    /*
     * Get the root element node
     */
    root_element = xmlDocGetRootElement(doc);
    remove_empty(root_element); 
  }

  return (0);
}