Пример #1
0
int main( int argc, char** argv )
{
  unsigned int my_seed = 1;

  t1 = create_terrain();

  if ( argc > 1 )
    my_seed = atoi( argv[1] );
  if ( DO_PRINTF )
    printf( "%s %d: seed: %u\n", argv[0], argc, my_seed );

  generate_true_cost_map( t1, my_seed );

  a1 = create_astar( t1 );

  init_graphics( &argc, argv, t1 );

#ifdef DO_GRAPHICS
  glutMainLoop();
#else
  for( ; ; )
    {
	#ifndef DO_GRAPHICS
		if ( path_done )
			return 0;
	#endif
    my_idlea();
    }
#endif
  return 0;
}
Пример #2
0
static void test_json_report(CuTest * tc) {
    region * r;
    faction * f;
    unit * u;
    cJSON * json;

    cleargame(true);
    turn = 0;
    r = create_region(0, 1, 1, create_terrain("plain"));
    f = addplayer(r, 0, 0);
    u = r->units;
    update_world(0, 0, 1, 1);

    json = json_report(f);
    CuAssertIntEquals(tc, turn, cJSON_GetObjectItem(json, "turn")->valueint);
    free(json);
}