Example #1
0
int main(int argc, char **argv)
{
	GOC_IStream* is = NULL;
	GOC_Iterator* it = NULL;
	GOC_Properties* props = NULL;
	if ( argc != 2 )
	{
		GOC_INFO("Podaj jako argument plik typu properties");
		return -1;
	}
	is = goc_fileIStreamOpen(argv[1]);
	props = goc_propertiesAlloc();
	props = goc_propertiesLoad(props, is);

	it = goc_propertiesListCategories(props);
	while ( goc_iteratorHasNext(it) )
	{
		GOC_Category* cat = (GOC_Category*)goc_iteratorNext(it);
		printf("GOC_Category: %s\n", cat->name);
		GOC_Iterator* pit = goc_propertiesListCategory(props, cat->name);
		while ( goc_iteratorHasNext(pit) )
		{
			GOC_Property* p = (GOC_Property*)goc_iteratorNext(pit);
			printf("\t%s = %s\n", p->name, p->value);
		}
		free(pit);
		printf("\n");
	}
	free(it);


	props = goc_propertiesFree(props);
	goc_isClose(is);
	return 0;
}
Example #2
0
static void loadConfiguration(GOC_HANDLER terrain, GOC_HANDLER build, GOC_HANDLER front)
{
	GOC_IStream* is = NULL;
	GOC_Properties* props = NULL;

	is = goc_fileIStreamOpen( "aaow.properties" );
	if ( is )
	{
		props = goc_propertiesLoad( props, is );
		goc_isClose( is );
	}

	// definiuj wartosci
	goc_maparawSetBPV(terrain, 2); // 2 bity na warto¶æ
	goc_maparawAddChar(terrain, getChar(props, "terrain.tree.char", 't'), getColor(props, "terrain.tree.color", GOC_GREEN), 0);
	goc_maparawAddChar(terrain, getChar(props, "terrain.dirt.char", '.'), getColor(props, "terrain.dirt.color", GOC_WHITE), 1);
	goc_maparawAddChar(terrain, getChar(props, "terrain.river.char", '='), getColor(props, "terrain.river.color", GOC_CYAN), 2);
	goc_maparawAddChar(terrain, getChar(props, "terrain.mountain.char", '^'), getColor(props, "terrain.mountain.color", GOC_RED), 3);

	/* Now commented - all comes from listener calculation
	// definiuj wartosci
	goc_mapaposAddChar(build,  0 , GOC_WHITE, 0x00); // nic - don't add!
	goc_mapaposAddChar(build, getChar(props, "build.supply.char", 'S'), GOC_WHITE, 0x01); // supply
	goc_mapaposAddChar(build, getChar(props, "build.factory.char", 'f'), GOC_WHITE, 0x02); // factory
	goc_mapaposAddChar(build, getChar(props, "build.city.char", 'O'), GOC_WHITE, 0x03); // city
	goc_mapaposAddChar(build, getChar(props, "build.airport.char", 'L'), GOC_WHITE, 0x04); // airport
	goc_mapaposAddChar(build, getChar(props, "build.village.char", 'o'), GOC_WHITE, 0x05); // village
	goc_mapaposAddChar(build, getChar(props, "build.fort.char", '#'), GOC_WHITE, 0x06); // fort
	goc_mapaposAddChar(build, getChar(props, "build.capital.char", '0'), GOC_WHITE, 0x07); // capital
	goc_mapaposAddChar(build, getChar(props, "build.bridge.vertical.char", '-'), GOC_WHITE, 0x08); // bridge
	goc_mapaposAddChar(build, getChar(props, "build.bridge.horizontal.char", '|'), GOC_WHITE, 0x09); // bridge
	*/

	goc_maparawSetBPV(front, 2); // 2 bity na warto¶æ
	goc_maparawAddChar(front, 0, GOC_WHITE, 0);
	goc_maparawAddChar(front, getChar(props, "front.char", 'x'), GOC_RED | GOC_FBOLD, 1);
	goc_maparawAddChar(front, getChar(props, "front.char", 'x'), GOC_GREEN | GOC_FBOLD, 2);
	goc_maparawAddChar(front, getChar(props, "front.char", 'x'), GOC_CYAN | GOC_FBOLD, 3);
	props = goc_propertiesFree( props );
}