Code:
public void createMap()
{
bool exists = true;
for(int uvw = 0; uvw <= 24;uvw++)
{
for(int xyz = 0; xyz <= 35;xyz++)
{
int lmn = rnd.Next(13);
if(lmn == 0 || lmn == 1 || lmn == 3 || lmn == 4)
{
maplocation[uvw,xyz,0] = rnd2.Next(100,599);
exists = mapLocCount.Contains(maplocation[uvw,xyz,0]);
while(exists == true)
{
int randsysnum2 = new int();
randsysnum2 = rnd3.Next(100,599);
maplocation[uvw,xyz,0] = randsysnum2;
exists = mapLocCount.Contains(maplocation[uvw,xyz,0]);
}
mapLocCount.Push(maplocation[uvw,xyz,0]);
}
else
{
maplocation[uvw,xyz,0] = 0;
}
}
}
}
** HERE ********public void createStartPlaces()
{
bool exists = true;
//int fgh;
for(int bcd = 1; bcd <= 12; bcd++)
{
switch(bcd)
{
case 1:
uvw = 1;
xyz = 1;
break;
case 2:
xyz = 10;
break;
case 3:
xyz = 18;
break;
case 4:
xyz = 27;
break;
case 5:
uvw = 9;
xyz = 1;
break;
case 6:
xyz = 10;
break;
case 7:
xyz = 18;
break;
case 8:
xyz = 27;
break;
case 9:
uvw = 17;
xyz = 1;
break;
case 10:
xyz = 10;
break;
case 11:
xyz = 18;
break;
case 12:
xyz = 27;
break;
}
random = rnd.Next(uvw,uvw+6);
random2 = rnd2.Next(xyz,xyz+6);
// finds a suitable system
while(maplocation[random,random2,0] == 0)
{
random = rnd.Next(uvw,uvw+6);
random2 = rnd2.Next(xyz,xyz+6);
}
// sets the number of systems to 4
//systemType[maplocation[random,random2,1]] = 1;
maplocation[random,random2,1] = 4;
// starts a loop to add subsystems
for(efg = 2; efg <= 4;efg++)
{
if(efg == 2)
{
yhg = 0;
}
//generates a number
maplocation[random,random2,efg] = rnd3.Next(100,599);
//checks if this system number already exists
exists = mapLocCount.Contains(maplocation[random,random2,efg]);
//if it does, repeat the generation until it doesnt exist in the list
while(exists == true)
{
maplocation[random,random2,efg] = rnd4.Next(100,599);
exists = mapLocCount.Contains(maplocation[random,random2,efg]);
}
//assigns the subsystem number to the appropriate adj system number of the parent system
maplocation[random,random2,efg+4] = maplocation[random,random2,efg];
//add the number to the list
mapLocCount.Push(maplocation[random,random2,efg]);
//sets the first subsystem to be a terran planet, no matter what
if(efg == 2)
{
systemType[maplocation[random,random2,efg]] = 13;
pqr[random,random2] = "o";
}
else//allows the other subsystems to be martian venusian or jovian
{
if(efg == 4)
{
if(yhg == 0)
{
rhu = 19;
systemType[maplocation[random,random2,efg]] = rhu;
}
else
{
if(yhg >= 2)
{
rhu = rnd2.Next(16,18);
systemType[maplocation[random,random2,efg]] = rhu;
}
else
{
rhu = rnd2.Next(16,21);
systemType[maplocation[random,random2,efg]] = rhu;
}
}
}
else
{
rhu = rnd2.Next(16,22);
systemType[maplocation[random,random2,efg]] = rhu;
}
}
//assigns the character for the map generator
switch(rhu)
{
case 13:
pqr[random,random2] = pqr[random,random2] + "o";
systemTypeText[maplocation[random,random2,efg]] = " Terran Planet";
break;
case 16:
pqr[random,random2] = pqr[random,random2] + "o";
systemTypeText[maplocation[random,random2,efg]] = " Venusian Planet";
break;
case 17:
pqr[random,random2] = pqr[random,random2] + "o";
systemTypeText[maplocation[random,random2,efg]] = " Martian Planet";
break;
case 18:
pqr[random,random2] = pqr[random,random2] + "o";
systemTypeText[maplocation[random,random2,efg]] = " Jovian Planet";
break;
case 19:
pqr[random,random2] = pqr[random,random2] + "*";
systemTypeText[maplocation[random,random2,efg]] = " Asteroids";
yhg++;
break;
case 20:
pqr[random,random2] = pqr[random,random2] + "*";
systemTypeText[maplocation[random,random2,efg]] = " Asteroids";
yhg++;
break;
case 21:
pqr[random,random2] = pqr[random,random2] + "*";
systemTypeText[maplocation[random,random2,efg]] = " Asteroids";
yhg++;
break;
case 22:
pqr[random,random2] = pqr[random,random2] + "*";
systemTypeText[maplocation[random,random2,efg]] = " Asteroids";
yhg++;
break;
default:
pqr[random,random2] = pqr[random,random2] + "+";
systemTypeText[maplocation[random,random2,efg]] = " ----------";
break;
}
}
}
}
public void setStarTypes()
{
for(int uvw = 0; uvw <= 24; uvw++)
{
for(int xyz = 0; xyz <= 35;xyz++)
{
if(maplocation[uvw,xyz,0] > 0)
{
if(maplocation[uvw,xyz,1] == 4)
{
systemType[maplocation[uvw,xyz,0]] = 1;
systemTypeText[maplocation[uvw,xyz,0]] = " Yellow Dwarf";
}
else
{
int rth = rnd2.Next(1,20);
systemType[maplocation[uvw,xyz,0]] = rth;
}
}
}
}
}
public void moreSubSystems()
{
}
public void systemLinks()
{
}
public void drawMap1()
{
string[] line1 = new string[25];
string[] line2 = new string[25];
string line3 = "\u000a";
string hjg;
string fdi = "";
string wok = "";
for( int uvw = 0 ; uvw <= 24 ; uvw++ )
{
for( int xyz = 0 ; xyz <= 35 ; xyz++ )
{
switch(systemType[maplocation[uvw,xyz,0]])
{
case 1:
wok = "Y";
systemTypeText[maplocation[uvw,xyz,0]] = "Yellow Dwarf";
break;
case 2:
wok = "Y";
systemTypeText[maplocation[uvw,xyz,0]] = "Yellow Dwarf";
break;
case 3:
wok = "S";
systemTypeText[maplocation[uvw,xyz,0]] = "Super Giant";
break;
case 4:
wok = "R";
systemTypeText[maplocation[uvw,xyz,0]] = "Red Dwarf";
break;
case 5:
wok = "G";
systemTypeText[maplocation[uvw,xyz,0]] = "Red Giant";
break;
case 6:
wok = "G";
systemTypeText[maplocation[uvw,xyz,0]] = "Red Giant";
break;
case 7:
wok = "G";
systemTypeText[maplocation[uvw,xyz,0]] = "Red Giant";
break;
case 8:
wok = "G";
systemTypeText[maplocation[uvw,xyz,0]] = "Red Giant";
break;
case 9:
wok = "W";
systemTypeText[maplocation[uvw,xyz,0]] = "White Dwarf";
break;
case 10:
wok = "B";
systemTypeText[maplocation[uvw,xyz,0]] = "Black Dwarf";
break;
case 11:
wok = "L";
systemTypeText[maplocation[uvw,xyz,0]] = "Red Variable";
break;
case 12:
wok = "S";
systemTypeText[maplocation[uvw,xyz,0]] = "Super Giant";
break;
case 13:
wok = "S";
systemTypeText[maplocation[uvw,xyz,0]] = "Super Giant";
break;
case 14:
wok = "S";
systemTypeText[maplocation[uvw,xyz,0]] = "Super Giant";
break;
case 15:
wok = "S";
systemTypeText[maplocation[uvw,xyz,0]] = "Super Giant";
break;
case 16:
wok = "S";
systemTypeText[maplocation[uvw,xyz,0]] = "Super Giant";
break;
case 17:
wok = "V";
systemTypeText[maplocation[uvw,xyz,0]] = "Blue Variable";
break;
case 18:
wok = "C";
systemTypeText[maplocation[uvw,xyz,0]] = "Binary System";
break;
case 19:
wok = "N";
systemTypeText[maplocation[uvw,xyz,0]] = "Neutron Star";
break;
case 20:
wok = "H";
systemTypeText[maplocation[uvw,xyz,0]] = "Black Hole";
break;
default:
wok = "Q";
systemTypeText[maplocation[uvw,xyz,0]] = "Unknown";
break;
}
if(xyz == 35)
{
hjg = "\u000a";
}
else
{
hjg = " ";
}
if(maplocation[uvw,xyz,0] == 0)
{
line1[uvw] = line1[uvw] +" " +hjg;
}
else
{
line1[uvw] = line1[uvw] +maplocation[uvw,xyz,0] +wok +hjg;
}
switch(maplocation[uvw,xyz,1])
{
case 0:
fdi = " ";
break;
case 1:
fdi = " ";
break;
case 2:
fdi = " ";
break;
case 3:
fdi = " ";
break;
case 4:
fdi = "";
break;
}
line2[uvw] = line2[uvw] +pqr[uvw,xyz] +fdi +hjg;
}
}
for(int ijh = 0;ijh <=24;ijh++)
{
lmn = lmn +line1[ijh] +line2[ijh] +line3;
}
maplabel.Text = lmn;
}
public void writeToTextFile()
{
Stack agh = new Stack();
int rdf = mapLocCount.Count;
object[] sig = mapLocCount.ToArray();
Array.Sort(sig);
FileInfo fi = new FileInfo("test.txt");
fi.Delete();
StreamWriter w = new StreamWriter("test.txt");
w.WriteLine(mapLocCount.Count);
w.WriteLine(" ");
for(int wji = 0; wji <= rdf-1;wji++)
{
w.WriteLine(Convert.ToString(sig[wji]) +" " +systemType[(int)sig[wji]] +" " +systemTypeText[(int)sig[wji]]);
}
w.Close();
}