[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Re: 拡張パック


「建物総合」についての追加ソースはアーカイブにしました。
http://members.tripod.co.jp/chiname/archives/src.generic.zip

本体に加えた修正は以下の通りです。

Index: StructureContribution.cs
===================================================================
RCS file: /cvsroot/freetrain/FreeTrain/core/contributions/common/StructureContribution.cs,v
retrieving revision 1.8
diff -u -r1.8 StructureContribution.cs
--- StructureContribution.cs	27 Mar 2003 01:56:12 -0000	1.8
+++ StructureContribution.cs	7 Jul 2003 00:20:09 -0000
@@ -12,6 +12,14 @@
 
 namespace freetrain.contributions.common
 {
+	public interface AbstractExStructure
+	{
+		int unitPrice { get; }
+		SIZE size { get; }
+		int minHeight { get; }
+		int maxHeight { get; }
+	}
+
 	/// <summary>
 	/// Generic structure contribution.
 	/// 
 
Index: FixedSizeStructureContribution.cs
===================================================================
RCS file: /cvsroot/freetrain/FreeTrain/core/contributions/common/FixedSizeStructureContribution.cs,v
retrieving revision 1.7
diff -u -r1.7 FixedSizeStructureContribution.cs
--- FixedSizeStructureContribution.cs	27 Mar 2003 01:56:12 -0000	1.7
+++ FixedSizeStructureContribution.cs	7 Jul 2003 00:20:09 -0000
@@ -33,7 +34,19 @@
 			sprites = PluginUtil.getSpriteLoader(spr).load3D( spr, size.x, size.y, height );
 		}
 
-		/// <summary>Price of this structure.</summary>
+		public FixedSizeStructureContribution(AbstractExStructure master, XmlElement pic, XmlElement main, bool opposite ) : base (main) 
+		{
+			price = master.unitPrice;			
+			int height = master.maxHeight;
+			if( opposite )
+				size = new Distance(master.size.y, master.size.x, height);
+			else
+				this.size = new Distance( master.size, height);
+
+			sprites = PluginUtil.getSpriteLoader(pic).load3D( pic, size.x, size.y, height );
+		}
+	
+	/// <summary>Price of this structure.</summary>
 		public readonly int price;			// TODO: should be moved up
 
 		/// <summary>

Index: VarHeightBuildingContribution.cs
===================================================================
RCS file: /cvsroot/freetrain/FreeTrain/core/contributions/structs/VarHeightBuildingContribution.cs,v
retrieving revision 1.6
diff -u -r1.6 VarHeightBuildingContribution.cs
--- VarHeightBuildingContribution.cs	27 Mar 2003 01:56:13 -0000	1.6
+++ VarHeightBuildingContribution.cs	7 Jul 2003 00:22:47 -0000
@@ -36,6 +36,24 @@
 			middle = PluginUtil.getSpriteLoader(m).load2D( m, size );
 		}
 
+		public VarHeightBuildingContribution(AbstractExStructure master, XmlElement pic, XmlElement main, bool opposite ) : base (main) 
+		{
+			price = master.unitPrice;
+			if( opposite )
+				size = new SIZE(master.size.y, master.size.x);
+			else
+				size = master.size;
+			minHeight = master.minHeight;
+			maxHeight = master.maxHeight;
+
+
+			tops    = loadSpriteSets( pic.SelectNodes("top"   ) );
+			bottoms = loadSpriteSets( pic.SelectNodes("bottom") );
+
+			XmlElement m = (XmlElement)XmlUtil.selectSingleNode(pic,"middle");
+			middle = PluginUtil.getSpriteLoader(m).load2D( m, size );
+		}
+
 		protected override StructureGroup getGroup( string name ) {
 			return PluginManager.theInstance.varHeightBuildingsGroup[name];
 		}
@@ -104,6 +122,21 @@
 			for( int i=bottoms.Length-1; i>=0; i-- )
 				drawer.draw( bottoms[i], 0, 0, z++ );
 			drawer.draw( middle, 0,0, z++ );
+			for( int i=tops.Length-1; i>=0; i-- )
+				drawer.draw( tops[i], 0, 0, z++ );
+
+			return drawer;
+		}
+
+		public PreviewDrawer createPreview( Size pixelSize ,int height ) 
+		{
+			PreviewDrawer drawer = new PreviewDrawer( pixelSize, size, maxHeight/*middle*/ );
+			int mh = height-2;
+			int z=0;
+			for( int i=bottoms.Length-1; i>=0; i-- )
+				drawer.draw( bottoms[i], 0, 0, z++ );
+			for( int i = 0; i< mh; i++ )
+				drawer.draw( middle, 0,0, z++ );
 			for( int i=tops.Length-1; i>=0; i-- )
 				drawer.draw( tops[i], 0, 0, z++ );
 
Index: CommercialStructureContribution.cs
===================================================================
RCS file: /cvsroot/freetrain/FreeTrain/core/contributions/structs/CommercialStructureContribution.cs,v
retrieving revision 1.3
diff -u -r1.3 CommercialStructureContribution.cs
--- CommercialStructureContribution.cs	27 Mar 2003 01:56:13 -0000	1.3
+++ CommercialStructureContribution.cs	7 Jul 2003 00:22:47 -0000
@@ -22,6 +22,9 @@
 		/// <exception cref="XmlException">If the parsing fails</exception>
 		public CommercialStructureContribution( XmlElement e ) : base(e) {}
 
+		public CommercialStructureContribution( AbstractExStructure master, XmlElement pic, XmlElement main, bool opposite) 
+			: base(master, pic, main,opposite) {}
+
 		protected override StructureGroup getGroup( string name ) {
 			return PluginManager.theInstance.commercialStructureGroup[name];
 		}

Index: SpriteFactory.cs
===================================================================
RCS file: /cvsroot/freetrain/FreeTrain/core/framework/graphics/SpriteFactory.cs,v
retrieving revision 1.2
diff -u -r1.2 SpriteFactory.cs
--- SpriteFactory.cs	25 Dec 2002 02:02:43 -0000	1.2
+++ SpriteFactory.cs	7 Jul 2003 00:23:42 -0000
@@ -23,6 +23,8 @@
 		public static SpriteFactory getSpriteFactory( XmlNode sprite ) {
 			XmlElement type = (XmlElement)sprite.SelectSingleNode("spriteType");
 			if(type==null)
+				type = (XmlElement)sprite.SelectSingleNode("colorVariation");
+			if(type==null)
 				// if none is specified, use the default sprite factory
 				return new SimpleSpriteFactory();
 			else {


_______________________________________________
FreeTrain-general mailing list
FreeTrain-general@lists.sourceforge.jp
http://lists.sourceforge.jp/mailman/listinfo/freetrain-general

題名

名前

メッセージ