SoW Reddog
Jan-03-2014, 12:45
OK, here's the thing. I've got a dictionary "SpawnPoints", which holds two keys, "Biggin_Hill" and "Zutkerque"
So why, when I run the code below as part of OnBattleInit() do I get the following printout in the message window
SpawnPoint:Biggin_Hill
SpawnPoint:Zutkerque
Abbeville
yes
and then it stop working and when looking in the console the error is "item not found in dictionary" or somesuch. I KNOW it's not in there, it shouldn't be trying to do anything with Abbeville. I cannot see the wood for the trees, please someone put me out of my misery.
List<string> spawns = new List<string>(SpawnPoints.Keys);
foreach (string s in spawns)
{
GamePlay.gpLogServer(null, "SpawnPoint:" + s, null);
}
foreach (AiAirport ap in GamePlay.gpAirports())
{
GamePlay.gpLogServer(null, ap.Name(), null);
if(SpawnPoints.ContainsKey(ap.Name())); //Does List of SpawnBases contain this airfield?
{
GamePlay.gpLogServer(null, "yes", null);
if(SpawnPoints[ap.Name()].Item1==true)//Is airfield Active?
{
//do some stuff
}
}
}
So why, when I run the code below as part of OnBattleInit() do I get the following printout in the message window
SpawnPoint:Biggin_Hill
SpawnPoint:Zutkerque
Abbeville
yes
and then it stop working and when looking in the console the error is "item not found in dictionary" or somesuch. I KNOW it's not in there, it shouldn't be trying to do anything with Abbeville. I cannot see the wood for the trees, please someone put me out of my misery.
List<string> spawns = new List<string>(SpawnPoints.Keys);
foreach (string s in spawns)
{
GamePlay.gpLogServer(null, "SpawnPoint:" + s, null);
}
foreach (AiAirport ap in GamePlay.gpAirports())
{
GamePlay.gpLogServer(null, ap.Name(), null);
if(SpawnPoints.ContainsKey(ap.Name())); //Does List of SpawnBases contain this airfield?
{
GamePlay.gpLogServer(null, "yes", null);
if(SpawnPoints[ap.Name()].Item1==true)//Is airfield Active?
{
//do some stuff
}
}
}