Struct for defining map locations
Esempio n. 1
0
		public ShipDescriptor(string name, StreamReader sr,VarCollection vars):base(null,null,null,null,null,null,null)
		{
			string line="",keyword="",rest="";
			alienShip=true;
			useTanks=true;
			startLocUL=new MapLocation(0,0,0);

			while((line=vars.ReadLine(sr))!=null)
			{
				if(line=="end" || line=="END")
					return;

				int idx = line.IndexOf(':');
				keyword = line.Substring(0,idx).ToLower();
				rest = line.Substring(idx+1);

				switch(keyword)
				{
					case "path":
						basePath=@rest;
						break;
					case "blankpath":
						blankPath=@rest;
						break;
					case "rmppath":
						rmpPath=@rest;
						break;
					case "file":
						basename = rest;
						break;
					case "dependencies":
						dependencies = rest.Split(' ');
						break;
					case "xcomship":
						alienShip=false;
						break;
					case "notanks":
						useTanks=false;
						break;
					default:
						Console.WriteLine("Unknown line in ship: {0} -> {1}",name,line);
						break;
				}
			}
		}
Esempio n. 2
0
		public override void SelectedTileChanged(IMap_Base sender, SelectedTileChangedEventArgs e)
		{
			mapTile = (XCMapTile)e.SelectedTile;
			lastLoc = e.MapLocation;
			Refresh();
		}
Esempio n. 3
0
		public override void ParseLine(string keyword, string rest,StreamReader sr,VarCollection vars)
		{
			switch(keyword)
			{
				case "files":
				{
					Dictionary<string, IMapDesc> subset = new Dictionary<string, IMapDesc>();
					subsets[rest]=subset;
					string line = VarCollection.ReadLine(sr,vars);
					while(line!="end" && line!="END")
					{
						int idx = line.IndexOf(':');
						string fName = line.Substring(0,idx);
						string[] deps = line.Substring(idx+1).Split(' ');
						XCMapDesc imd = new XCMapDesc(fName, rootPath, blankPath, rmpPath, deps, myPal);
						maps[fName] =imd;
						subset[fName]=imd;
						line = VarCollection.ReadLine(sr,vars);
					}
				}
					break;
				case "order":
					mapOrder = rest.Split(' ');
					break;
				case "starttile":
					startTile = int.Parse(rest);
					break;
				case "startloc":
					string[] locs = rest.Split(' ');
					startLoc = new MapLocation[locs.Length];
					for(int i=0;i<locs.Length;i++)
					{
						string[] loc = locs[i].Split(',');
						int r = int.Parse(loc[0]);
						int c = int.Parse(loc[1]);
						int h = int.Parse(loc[2]);
						startLoc[i] = new MapLocation(r,c,h);
					}
					break;
				case "endtile":
					endTile = int.Parse(rest);
					break;
				default:
					xConsole.AddLine(string.Format("Unknown line in tileset {0}-> {1}:{2}",name,keyword,rest));
					break;
			}
		}
Esempio n. 4
0
		public RmpEntry AddRmp(MapLocation loc)
		{
			RmpEntry re = Rmp.AddEntry((byte)loc.Row, (byte)loc.Col, (byte)loc.Height);
			((XCMapTile)this[re.Row, re.Col, re.Height]).Rmp = re;
			return re;
		}