git-svn-id: svn://svn.ijw.co.nz/svn/OpenRa@1294 993157c7-ee19-0410-b2c4-bb4e9862e678

This commit is contained in:
(no author)
2007-07-17 12:27:42 +00:00
parent 75d6c359f1
commit 4273d4abfe
5 changed files with 30 additions and 3 deletions

21
OpenRa.Game/Log.cs Normal file
View File

@@ -0,0 +1,21 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
namespace OpenRa.Game
{
static class Log
{
static StreamWriter writer = File.CreateText("../../../log.txt");
static Log()
{
writer.AutoFlush = true;
}
public static void Write(string format, params object[] args)
{
writer.WriteLine(format, args);
}
}
}

View File

@@ -60,9 +60,7 @@ namespace OpenRa.Game
foreach (TreeReference treeReference in map.Trees)
world.Add(new Tree(treeReference, treeCache, map));
PrecacheStructure("proc");
PrecacheStructure("fact");
PrecacheUnit("mcv");
SequenceProvider.ForcePrecache();
world.Add(new Mcv(new int2(5, 5), 3));
world.Add(new Mcv(new int2(7, 5), 2));

View File

@@ -42,6 +42,7 @@
<ItemGroup>
<Compile Include="Actor.cs" />
<Compile Include="Animation.cs" />
<Compile Include="Log.cs" />
<Compile Include="Sequence.cs" />
<Compile Include="ConstructionYard.cs" />
<Compile Include="float2.cs" />

View File

@@ -19,6 +19,8 @@ namespace OpenRa.Game
LoadSequencesForUnit(eUnit);
}
public static void ForcePrecache() { } // force static ctor to run
static void LoadSequencesForUnit(XmlElement eUnit)
{
string unitName = eUnit.GetAttribute("name");

View File

@@ -36,6 +36,8 @@ namespace OpenRa.Game
static Range<int> AddUnit( string name )
{
Log.Write("Loading SHP for {0}", name);
int low = sprites.Count;
ShpReader reader = Load(name + ".shp");
foreach (ImageHeader h in reader)
@@ -43,6 +45,9 @@ namespace OpenRa.Game
Range<int> sequence = new Range<int>(low, sprites.Count - 1);
sequences.Add(name, sequence);
Log.Write("Loaded SHP for {0}", name);
return sequence;
}
}