Esempio n. 1
0
bool handle_open_document(const std::string& filename)
{
	bool done = false;
	FileSpecifier file(filename);
	switch (file.GetType())
	{
	case _typecode_scenario:
		set_map_file(file);
		break;
	case _typecode_savegame:
		if (load_and_start_game(file))
		{
			done = true;
		}
		break;
	case _typecode_film:
		if (handle_open_replay(file))
		{
			done = true;
		}
		break;
	case _typecode_physics:
		set_physics_file(file);
		break;
	case _typecode_shapes:
		open_shapes_file(file);
		break;
	case _typecode_sounds:
		SoundManager::instance()->OpenSoundFile(file);
		break;
	default:
		break;
	}
	
	return done;
}
Esempio n. 2
0
static void create() {
    ::create();
    set_map_file(DON_MAP);
    set_room_dir(DON_DIR_ROOMS);

    add_map_symbol(EMP_MAP_HILL,     "^");
    add_ansi_code (EMP_MAP_HILL,     "%^GREY%^");
    add_type_name (EMP_MAP_HILL,     "rough cave");

    add_map_symbol(EMP_MAP_MOUNTAIN, "#");
    add_ansi_code (EMP_MAP_MOUNTAIN, "%^GREY%^");
    add_type_name (EMP_MAP_MOUNTAIN, "cave wall");

    add_map_symbol(EMP_MAP_PLAIN,    ".");
    add_ansi_code (EMP_MAP_PLAIN,    "%^GREY%^");
    add_type_name (EMP_MAP_PLAIN,    "cave");

    add_type_name('O', "way out");
    add_type_name('D', "dragon's nest");

    add_road_type(EMP_MAP_HILL);
    add_road_type(EMP_MAP_PLAIN);
    add_block_type(EMP_MAP_MOUNTAIN);
}
Esempio n. 3
0
// We should not override the options specified in the command line
int parseInfodConfFile(infod_cmdline_t *opts) {

     conf_file_t cf;


     if(!(cf = cf_new(validVarNames))) {
	  fprintf(stderr, "Error generating conf file object\n");
	  return 0;
     }
     printf("Parsing configuration file [%s]\n", opts->opt_confFile);
     if(access(opts->opt_confFile, R_OK) != 0) {
	  fprintf(stderr, "Error: configuration files [%s] does not exists or is not readable\n",
		  opts->opt_confFile);
	  return 0;
     }
     
     if(!cf_parseFile(cf, opts->opt_confFile)) {
	  fprintf(stderr, "Error parsing configuration file\n");
	  return 0;
     }

     conf_var_t ent;
     int        intVal;
     if(cf_getVar(cf, "provider", &ent)) 
	     set_provider(ent.varValue);
     if(cf_getVar(cf, "myip", &ent)) 
	     set_my_ip(ent.varValue);
     if(cf_getVar(cf, "port", &ent)) {
          if(!getInt(ent.varValue, &intVal)) {
               fprintf(stderr, "Error: parameter port is not an integer\n");
               return 0;
          }
          set_port(&intVal);
     }
     if(cf_getVar(cf, "maptype", &ent)) 
	     set_map_type(ent.varValue);
     if(cf_getVar(cf, "mapfile", &ent)) 
	     set_map_file(ent.varValue);
     if(cf_getVar(cf, "mapcmd", &ent)) 
	     set_map_cmd(ent.varValue);
     if(cf_getVar(cf, "timestep", &ent)) {
          if(!getInt(ent.varValue, &intVal)) {
               fprintf(stderr, "Error: parameter timestep is not an integer\n");
               return 0;
          }
          set_time_step(&intVal);
     }
     if(cf_getVar(cf, "gossip-algo", &ent)) 
	     set_gossip_algo(ent.varValue);
     if(cf_getVar(cf, "wintype", &ent)) 
	     set_win_type(ent.varValue);
     if(cf_getVar(cf, "winparam", &ent)) 
	     set_win_param(ent.varValue);

     if(cf_getVar(cf, "avgage", &ent)) {
          if(!getInt(ent.varValue, &intVal)) {
               fprintf(stderr, "Error: parameter avgage is not an integer\n");
               return 0;
          }
          set_avgage(&intVal);
     }
     
     if(cf_getVar(cf, "avgmax", &ent)) {
          if(!getInt(ent.varValue, &intVal)) {
               fprintf(stderr, "Error: parameter avgmax is not an integer\n");
               return 0;
          }
          set_avgmax(&intVal);
     }
     
     if(cf_getVar(cf, "upto-entries", &ent)) {
          if(!getInt(ent.varValue, &intVal)) {
               fprintf(stderr, "Error: parameter upto-entries is not an integer\n");
               return 0;
          }
          set_uptoentries(&intVal);
     }

     if(cf_getVar(cf, "watch-fs", &ent)) 
	     set_watch_fs(ent.varValue);
     if(cf_getVar(cf, "watch-net", &ent)) 
	     set_watch_net(ent.varValue);
     if(cf_getVar(cf, "info-file", &ent)) 
	     set_info_file(ent.varValue);
     if(cf_getVar(cf, "eco-file", &ent)) 
	     set_eco_file(ent.varValue);
     if(cf_getVar(cf, "proc-file", &ent)) 
	     set_proc_file(ent.varValue);
     if(cf_getVar(cf, "jmig-file", &ent)) 
	  set_jmig_file(ent.varValue);
     

     cf_free(cf);
	
	

     return 1;
}