Guild::Guild( ConfigElem& elem ) :
    _guildid( elem.remove_ushort( "GUILDID" ) ),
    _member_serials( elem, "MEMBER" ),
    _allyguild_serials( elem, "ALLYGUILD" ),
    _enemyguild_serials( elem, "ENEMYGUILD" ),
    _proplist(),
    _disbanded(false)
{
    _proplist.readProperties( elem );
}
int xmain( int argc, char* argv[] )
{
    StoreCmdArgs( argc, argv );
    if (FindArg2( "uodata=" ) != NULL)
    {
        config.uo_datafile_root = FindArg2( "uodata=" );
        config.uo_datafile_root = normalized_dir_form( config.uo_datafile_root );
    }
    else
    {
        cout << "Reading pol.cfg." << endl;
        ConfigFile cf( "pol.cfg" );
        ConfigElem elem;

        cf.readraw( elem );
        config.uo_datafile_root = elem.remove_string( "UoDataFileRoot" );
        config.uo_datafile_root = normalized_dir_form( config.uo_datafile_root );
        
        unsigned short max_tile = elem.remove_ushort( "MaxTileID", 0x3FFF );

		if (max_tile != 0x3FFF && max_tile != 0x7FFF)
			config.max_tile_id = 0x3FFF;
		else
			config.max_tile_id = max_tile;
    }


    string main_cfg = "uoconvert.cfg";
	if (FileExists( main_cfg.c_str() ) )
	{
        string temp;
        ConfigElem elem;
        cout << "Reading uoconvert.cfg." << endl;
		ConfigFile cf_main( main_cfg.c_str() );
	    while( cf_main.read( elem ) )
	    {
		    if (elem.type_is( "MultiTypes" ))
		    {
			    temp = elem.remove_string( "Boats" );
			    ISTRINGSTREAM is_boats( temp );
			    string graphicnum;
			    while (is_boats >> graphicnum)
				    BoatTypes.insert(strtoul(graphicnum.c_str(),NULL,0));

			    temp = elem.remove_string( "Houses" );
			    ISTRINGSTREAM is_houses( temp );
			    while (is_houses >> graphicnum)
				    HouseTypes.insert(strtoul(graphicnum.c_str(),NULL,0));

			    temp = elem.remove_string( "Stairs" );
			    ISTRINGSTREAM is_stairs( temp );
			    while (is_stairs >> graphicnum)
				    StairTypes.insert(strtoul(graphicnum.c_str(),NULL,0));
		    }
            else if (elem.type_is( "LOSOptions" ))
Exemple #3
0
int xmain( int argc, char* argv[] )
{
    StoreCmdArgs( argc, argv );
    ConfigFile cf( "pol.cfg" );
    ConfigElem elem;

    cf.readraw( elem );

    config.uo_datafile_root = elem.remove_string( "UoDataFileRoot" );
    config.uo_datafile_root = normalized_dir_form( config.uo_datafile_root );

	unsigned short max_tile = elem.remove_ushort( "MaxTileID", 0x3FFF );

	if (max_tile != 0x3FFF && max_tile != 0x7FFF)
		config.max_tile_id = 0x3FFF;
	else
		config.max_tile_id = max_tile;

	if (argc <= 1)
		return Usage(1);

    if (argv[1][0] == '/' || argv[1][1] == ':')
    {
        config.uo_datafile_root = argv[1];
        --argc;
        ++argv;
    }

	if (stricmp( argv[1], "tiledump" ) == 0)
	{
		return tiledump( argc, argv );
	}
	else if (stricmp( argv[1], "vertile" ) == 0)
	{
		return vertile( argc, argv );
	}
    else if (stricmp( argv[1], "verlandtile" ) == 0)
    {
        return verlandtile( argc, argv );
    }
    else if (stricmp( argv[1], "landtilehist" ) == 0)
    {
        return landtilehist( argc, argv );
    }
	else if (stricmp( argv[1], "flagsearch" ) == 0)
	{
		return flagsearch( argc, argv );
	}
	else if (stricmp( argv[1], "landtileflagsearch" ) == 0)
	{
		return landtileflagsearch( argc, argv );
	}
    else if (stricmp( argv[1], "loschange" ) == 0)
    {
        return loschange( argc, argv );
    }
	else if (stricmp( argv[1], "rawdump" ) == 0)
	{
		return rawdump( argc, argv );
	}
    else if (stricmp( argv[1], "ctable" ) == 0)
    {
        return print_ctable();
    }
    else if (stricmp( argv[1], "sndlist" ) == 0)
    {
        return print_sndlist(argc, argv);
    }
    else if (stricmp( argv[1], "statics" ) == 0)
    {
        return print_statics();
    }
    else if (stricmp( argv[1], "verdata" ) == 0)
    {
        return print_verdata_info();
    }
    else if (stricmp( argv[1], "multis" ) == 0)
    {
        return print_multis();
    }
    else if (stricmp( argv[1], "water" ) == 0)
    {
        return print_water_data();
    }
    else if (stricmp( argv[1], "newstatics" ) == 0)
    {
        return write_pol_static_files( "main" );
    }
    else if (stricmp( argv[1], "staticsmax" ) == 0)
    {
        void staticsmax();
        open_uo_data_files();
        staticsmax();
        return 0;
    }
    else if (stricmp( argv[1], "watersearch" ) == 0)
    {
        return water_search(argc,argv);
    }
    else if (stricmp( argv[1], "zhist" ) == 0)
    {
        return z_histogram();
    }
    else if (stricmp( argv[1], "staticshist" ) == 0)
    {
        return statics_histogram();
    }
    else if (stricmp( argv[1], "writedungmap" ) == 0)
    {
        return write_polmap();
    }
    else if (stricmp( argv[1], "writekeys" ) == 0)
    {
        printf( "Keys written to current.key" );
        return 0;
    }
    else if (stricmp( argv[1], "mapdump" ) == 0)
    {
        return mapdump( argc, argv );
    }
    else if (stricmp( argv[1], "contour" ) == 0)
    {
        return contour( argc, argv );
    }
    else if (stricmp( argv[1], "findlandtile" ) == 0)
    {
        return findlandtile( argc-1, argv+1 );
    }
	else if (stricmp( argv[1], "findlandtileflags" ) == 0)
	{
		return findlandtileflags( argc-1, argv+1 );
	}
    else if (stricmp( argv[1], "findgraphic" ) == 0)
    {
        return findgraphic( argc-1, argv+1 );
    }
    else if (stricmp( argv[1], "defragstatics" ) == 0)
    {
        return defragstatics( argc-1, argv+1 );
    }
    
	return 0;
}