コード例 #1
0
ファイル: world.cpp プロジェクト: Atlantis-PBEM/Atlantis
void CountNames()
{
	Aoutfile names;
	AString *name;

	Awrite(AString("Regions ") + nregions);

	// Dump all the names we created to a file so the GM can scan
	// them easily (to check for randomly generated rude words,
	// for example)
	names.OpenByName("names.out");
	forlist(&regionnames) {
		name = (AString *) elem;
		names.PutStr(*name);
	}
	names.Close();
}
コード例 #2
0
ファイル: world.cpp プロジェクト: nedbrek/Atlantis
void Game::CreateWorld()
{
	int nx = 0;
	int ny = 1;
	if(Globals->MULTI_HEX_NEXUS) {
		ny = 2;
		while(nx <= 0) {
			Awrite("How many hexes should the nexus region be?");
			nx = Agetint();
			if (nx == 1) ny = 1;
			else if (nx % 2) {
				nx = 0;
				Awrite("The width must be a multiple of 2.");
			}
		}
	} else {
		nx = 1;
	}

    int xx = 0;
    while (xx <= 0) {
        Awrite("How wide should the map be? ");
        xx = Agetint();
        if( xx % 8 ) {
            xx = 0;
            Awrite( "The width must be a multiple of 8." );
        }
    }
    int yy = 0;
    while (yy <= 0) {
        Awrite("How tall should the map be? ");
        yy = Agetint();
        if( yy % 8 ) {
            yy = 0;
            Awrite( "The height must be a multiple of 8." );
        }
    }

	regions.CreateLevels(2 + Globals->UNDERWORLD_LEVELS +
			Globals->UNDERDEEP_LEVELS + Globals->ABYSS_LEVEL);

    SetupNames();

	// Leave the Nexus level in even if we're not going to use it;
	// It makes the main body of code more general
	regions.CreateNexusLevel( 0, nx, ny, "nexus" );
    regions.CreateSurfaceLevel( 1, xx, yy, 0 );

    // Create underworld levels
	int i;
	for(i = 2; i < Globals->UNDERWORLD_LEVELS+2; i++) {
		int xs = regions.GetLevelXScale(i);
		int ys = regions.GetLevelYScale(i);
		regions.CreateUnderworldLevel(i, xx/xs, yy/ys, "underworld");
	}
	// Underdeep levels
	for(i=Globals->UNDERWORLD_LEVELS+2;
			i<(Globals->UNDERWORLD_LEVELS+Globals->UNDERDEEP_LEVELS+2); i++) {
		int xs = regions.GetLevelXScale(i);
		int ys = regions.GetLevelYScale(i);
		regions.CreateUnderdeepLevel(i, xx/xs, yy/ys, "underdeep");
	}

	if(Globals->ABYSS_LEVEL) {
		regions.CreateAbyssLevel(Globals->UNDERWORLD_LEVELS +
				Globals->UNDERDEEP_LEVELS + 2, "abyss");
	}

	CountNames();

	if(Globals->UNDERWORLD_LEVELS+Globals->UNDERDEEP_LEVELS == 1) {
		regions.MakeShaftLinks( 2, 1, 8 );
	} else if(Globals->UNDERWORLD_LEVELS+Globals->UNDERDEEP_LEVELS) {
		int i, ii;
		// shafts from surface to underworld
		regions.MakeShaftLinks(2, 1, 10);
		for(i=3; i<Globals->UNDERWORLD_LEVELS+2; i++) {
			regions.MakeShaftLinks(i, 1, 10*i-10);
		}
		// Shafts from underworld to underworld
		if(Globals->UNDERWORLD_LEVELS > 1) {
			for(i = 3; i < Globals->UNDERWORLD_LEVELS+2; i++) {
				for(ii = 2; ii < i; ii++) {
					if(i == ii+1) {
						regions.MakeShaftLinks(i, ii, 12);
					} else {
						regions.MakeShaftLinks(i, ii, 24);
					}
				}
			}
		}
		// underdeeps to underworld
		if(Globals->UNDERDEEP_LEVELS && Globals->UNDERWORLD_LEVELS) {
			// Connect the topmost of the underdeep to the bottommost
			// underworld
			regions.MakeShaftLinks(Globals->UNDERWORLD_LEVELS+2,
					Globals->UNDERWORLD_LEVELS+1, 12);
		}
		// Now, connect the underdeep levels together
		if(Globals->UNDERDEEP_LEVELS > 1) {
			for(i = Globals->UNDERWORLD_LEVELS+3;
					i < Globals->UNDERWORLD_LEVELS+Globals->UNDERDEEP_LEVELS+2;
					i++) {
				for(ii = Globals->UNDERWORLD_LEVELS+2; ii < i; ii++) {
					if(i == ii+1) {
						regions.MakeShaftLinks(i, ii, 12);
					} else {
						regions.MakeShaftLinks(i, ii, 25);
					}
				}
			}
		}
	}

    // We can leave this one - it sets the starting cities
    if (Globals->NEXUS_EXISTS)
        regions.SetACNeighbors( 0, 1, xx, yy );

    regions.InitSetupGates( 1 );
	// Set up gates on all levels of the underworld
	for(int i=2; i < Globals->UNDERWORLD_LEVELS+2; i++) {
		regions.InitSetupGates( i );
	}
	// Underdeep has no gates, only the possible shafts above.

    regions.FinalSetupGates();

    regions.CalcDensities();
}
コード例 #3
0
ファイル: world.cpp プロジェクト: nedbrek/Atlantis
void CountNames()
{
	Awrite(AString("Regions ") + nregions);
}
コード例 #4
0
ファイル: faction.cpp プロジェクト: davisd123/Atlantis
void Faction::View()
{
	AString temp;
	temp = AString("Faction ") + num + AString(" : ") + *name;
	Awrite(temp);
}