Formatting FIxes (#58)

This commit is contained in:
Kamron Batman 2019-10-04 23:08:13 -07:00 committed by GitHub
parent 57fb9fb525
commit 096d39609e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
1318 changed files with 11633 additions and 22129 deletions

View file

@ -616,10 +616,7 @@ namespace Server.Commands
InternalAvg_OnCommand(e, true);
}
public static bool IsEntity(Type t)
{
return m_EntityType.IsAssignableFrom(t);
}
public static bool IsEntity(Type t) => m_EntityType.IsAssignableFrom(t);
public static bool IsConstructible(ConstructorInfo ctor, AccessLevel accessLevel)
{
@ -628,20 +625,11 @@ namespace Server.Commands
return attrs.Length != 0 && accessLevel >= ((ConstructibleAttribute)attrs[0]).AccessLevel;
}
public static bool IsEnum(Type type)
{
return type.IsSubclassOf(m_EnumType);
}
public static bool IsEnum(Type type) => type.IsSubclassOf(m_EnumType);
public static bool IsType(Type type)
{
return type == m_TypeType || type.IsSubclassOf(m_TypeType);
}
public static bool IsType(Type type) => type == m_TypeType || type.IsSubclassOf(m_TypeType);
public static bool IsParsable(Type type)
{
return type.IsDefined(m_ParsableType, false);
}
public static bool IsParsable(Type type) => type.IsDefined(m_ParsableType, false);
public static object ParseParsable(Type type, string value)
{

View file

@ -4,30 +4,21 @@ namespace Server
{
public class UsageAttribute : Attribute
{
public UsageAttribute(string usage)
{
Usage = usage;
}
public UsageAttribute(string usage) => Usage = usage;
public string Usage{ get; }
}
public class DescriptionAttribute : Attribute
{
public DescriptionAttribute(string description)
{
Description = description;
}
public DescriptionAttribute(string description) => Description = description;
public string Description{ get; }
}
public class AliasesAttribute : Attribute
{
public AliasesAttribute(params string[] aliases)
{
Aliases = aliases;
}
public AliasesAttribute(params string[] aliases) => Aliases = aliases;
public string[] Aliases{ get; }
}

View file

@ -985,16 +985,14 @@ namespace Server.Commands
public static List<DecorationList> ReadAll(string path)
{
using (StreamReader ip = new StreamReader(path))
{
List<DecorationList> list = new List<DecorationList>();
DecorationList v;
using StreamReader ip = new StreamReader(path);
List<DecorationList> list = new List<DecorationList>();
DecorationList v;
while ((v = Read(ip)) != null)
list.Add(v);
while ((v = Read(ip)) != null)
list.Add(v);
return list;
}
return list;
}
public static DecorationList Read(StreamReader ip)

View file

@ -983,16 +983,14 @@ namespace Server.Commands
public static List<DecorationListMag> ReadAll(string path)
{
using (StreamReader ip = new StreamReader(path))
{
List<DecorationListMag> list = new List<DecorationListMag>();
using StreamReader ip = new StreamReader(path);
List<DecorationListMag> list = new List<DecorationListMag>();
DecorationListMag v;
while ((v = Read(ip)) != null)
list.Add(v);
DecorationListMag v;
while ((v = Read(ip)) != null)
list.Add(v);
return list;
}
return list;
}
public static DecorationListMag Read(StreamReader ip)

File diff suppressed because it is too large Load diff

View file

@ -388,13 +388,13 @@ namespace Server.Commands
List<CategoryLine> list = new List<CategoryLine>();
if (File.Exists(path))
using (StreamReader ip = new StreamReader(path))
{
string line;
{
using StreamReader ip = new StreamReader(path);
string line;
while ((line = ip.ReadLine()) != null)
list.Add(new CategoryLine(line));
}
while ((line = ip.ReadLine()) != null)
list.Add(new CategoryLine(line));
}
return list.ToArray();
}

View file

@ -54,10 +54,7 @@ namespace Server.Commands.Generic
{
}
public virtual bool ValidateArgs(BaseCommandImplementor impl, CommandEventArgs e)
{
return true;
}
public virtual bool ValidateArgs(BaseCommandImplementor impl, CommandEventArgs e) => true;
public void AddResponse(string message)
{
@ -128,10 +125,7 @@ namespace Server.Commands.Generic
m_Count = 1;
}
public override string ToString()
{
return m_Count > 1 ? $"{m_Message} ({m_Count})" : m_Message;
}
public override string ToString() => m_Count > 1 ? $"{m_Message} ({m_Count})" : m_Message;
}
}
}

View file

@ -121,10 +121,7 @@ namespace Server.Commands.Generic
{
}
public virtual bool IsValid(object obj)
{
return true;
}
public virtual bool IsValid(object obj) => true;
public virtual void Filter(List<object> list)
{

View file

@ -12,10 +12,7 @@ namespace Server.Commands.Generic
private List<Property> m_Properties;
public DistinctExtension()
{
m_Properties = new List<Property>();
}
public DistinctExtension() => m_Properties = new List<Property>();
public override ExtensionInfo Info => ExtInfo;

View file

@ -11,10 +11,7 @@ namespace Server.Commands.Generic
private List<OrderInfo> m_Orders;
public SortExtension()
{
m_Orders = new List<OrderInfo>();
}
public SortExtension() => m_Orders = new List<OrderInfo>();
public override ExtensionInfo Info => ExtInfo;

View file

@ -31,9 +31,6 @@ namespace Server.Commands.Generic
Conditional = ObjectConditional.ParseDirect(from, arguments, offset, size);
}
public override bool IsValid(object obj)
{
return Conditional.CheckCondition(obj);
}
public override bool IsValid(object obj) => Conditional.CheckCondition(obj);
}
}

View file

@ -30,10 +30,7 @@ namespace Server.Commands.Generic
{
private static List<BaseCommandImplementor> m_Implementors;
public BaseCommandImplementor()
{
Commands = new Dictionary<string, BaseCommand>(StringComparer.OrdinalIgnoreCase);
}
public BaseCommandImplementor() => Commands = new Dictionary<string, BaseCommand>(StringComparer.OrdinalIgnoreCase);
public bool SupportsConditionals{ get; set; }

View file

@ -408,10 +408,7 @@ namespace Server.Commands
AutoSave.Save(true);
}
private static bool FixMap(ref Map map, ref Point3D loc, Item item)
{
return map != null && map != Map.Internal || item.RootParent is Mobile m && FixMap(ref map, ref loc, m);
}
private static bool FixMap(ref Map map, ref Point3D loc, Item item) => map != null && map != Map.Internal || item.RootParent is Mobile m && FixMap(ref map, ref loc, m);
private static bool FixMap(ref Map map, ref Point3D loc, Mobile m)
{

View file

@ -388,15 +388,9 @@ namespace Server.Commands
//AddAlphaRegion( 10, height - 30, width - 20, 20 );
}
public string Color(string text, int color)
{
return $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
}
public string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";
public string Center(string text)
{
return $"<CENTER>{text}</CENTER>";
}
public string Center(string text) => $"<CENTER>{text}</CENTER>";
}
}
}

View file

@ -81,10 +81,8 @@ namespace Server.Commands
AppendPath(ref path, from.AccessLevel.ToString());
path = Path.Combine(path, $"{name}.log");
using (StreamWriter sw = new StreamWriter(path, true))
{
sw.WriteLine("{0}: {1}: {2}", DateTime.UtcNow, from.NetState, text);
}
using StreamWriter sw = new StreamWriter(path, true);
sw.WriteLine("{0}: {1}: {2}", DateTime.UtcNow, @from.NetState, text);
}
catch
{

View file

@ -25,31 +25,29 @@ namespace Server.Commands
{
try
{
using (StreamWriter sw = new StreamWriter("profiles.log", true))
{
sw.WriteLine("# Dump on {0:f}", DateTime.UtcNow);
sw.WriteLine("# Core profiling for " + Core.ProfileTime);
using StreamWriter sw = new StreamWriter("profiles.log", true);
sw.WriteLine("# Dump on {0:f}", DateTime.UtcNow);
sw.WriteLine("# Core profiling for " + Core.ProfileTime);
sw.WriteLine("# Packet send");
BaseProfile.WriteAll(sw, PacketSendProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Packet send");
BaseProfile.WriteAll(sw, PacketSendProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Packet receive");
BaseProfile.WriteAll(sw, PacketReceiveProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Packet receive");
BaseProfile.WriteAll(sw, PacketReceiveProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Timer");
BaseProfile.WriteAll(sw, TimerProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Timer");
BaseProfile.WriteAll(sw, TimerProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Gump response");
BaseProfile.WriteAll(sw, GumpProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Gump response");
BaseProfile.WriteAll(sw, GumpProfile.Profiles);
sw.WriteLine();
sw.WriteLine("# Target response");
BaseProfile.WriteAll(sw, TargetProfile.Profiles);
sw.WriteLine();
}
sw.WriteLine("# Target response");
BaseProfile.WriteAll(sw, TargetProfile.Profiles);
sw.WriteLine();
}
catch
{
@ -75,10 +73,8 @@ namespace Server.Commands
{
try
{
using (StreamWriter sw = new StreamWriter("timerdump.log", true))
{
Timer.DumpInfo(sw);
}
using StreamWriter sw = new StreamWriter("timerdump.log", true);
Timer.DumpInfo(sw);
}
catch
{
@ -190,37 +186,35 @@ namespace Server.Commands
try
{
using (StreamWriter op = new StreamWriter("expandedItems.log", true))
using StreamWriter op = new StreamWriter("expandedItems.log", true);
string[] names =
{
string[] names =
{
"Name",
"Items",
"Bounce",
"Holder",
"Blessed",
"TempFlag",
"SaveFlag",
"Weight",
"Spawner"
};
"Name",
"Items",
"Bounce",
"Holder",
"Blessed",
"TempFlag",
"SaveFlag",
"Weight",
"Spawner"
};
List<KeyValuePair<Type, int[]>> list = typeTable.ToList();
List<KeyValuePair<Type, int[]>> list = typeTable.ToList();
list.Sort(new CountsSorter());
list.Sort(new CountsSorter());
foreach (KeyValuePair<Type, int[]> kvp in list)
{
int[] countTable = kvp.Value;
foreach (KeyValuePair<Type, int[]> kvp in list)
{
int[] countTable = kvp.Value;
op.WriteLine("# {0}", kvp.Key.FullName);
op.WriteLine("# {0}", kvp.Key.FullName);
for (int i = 0; i < countTable.Length; ++i)
if (countTable[i] > 0)
op.WriteLine("{0}\t{1:N0}", names[i], countTable[i]);
for (int i = 0; i < countTable.Length; ++i)
if (countTable[i] > 0)
op.WriteLine("{0}\t{1:N0}", names[i], countTable[i]);
op.WriteLine();
}
op.WriteLine();
}
}
catch
@ -253,20 +247,18 @@ namespace Server.Commands
table[type] = new[] { 1, item.Amount };
}
using (StreamWriter op = new StreamWriter("internal.log"))
using StreamWriter op = new StreamWriter("internal.log");
op.WriteLine("# {0} items found", totalCount);
op.WriteLine("# {0} different types", table.Count);
op.WriteLine();
op.WriteLine();
op.WriteLine("Type\t\tCount\t\tAmount\t\tAvg. Amount");
foreach (KeyValuePair<Type, int[]> de in table)
{
op.WriteLine("# {0} items found", totalCount);
op.WriteLine("# {0} different types", table.Count);
op.WriteLine();
op.WriteLine();
op.WriteLine("Type\t\tCount\t\tAmount\t\tAvg. Amount");
int[] parms = de.Value;
foreach (KeyValuePair<Type, int[]> de in table)
{
int[] parms = de.Value;
op.WriteLine("{0}\t\t{1}\t\t{2}\t\t{3:F2}", de.Key.Name, parms[0], parms[1], (double)parms[1] / parms[0]);
}
op.WriteLine("{0}\t\t{1}\t\t{2}\t\t{3:F2}", de.Key.Name, parms[0], parms[1], (double)parms[1] / parms[0]);
}
}
@ -323,16 +315,14 @@ namespace Server.Commands
list.Sort(new CountSorter());
using (StreamWriter op = new StreamWriter(opFile))
{
op.WriteLine("# Profile of world {0}", type);
op.WriteLine("# Generated on {0}", DateTime.UtcNow);
op.WriteLine();
op.WriteLine();
using StreamWriter op = new StreamWriter(opFile);
op.WriteLine("# Profile of world {0}", type);
op.WriteLine("# Generated on {0}", DateTime.UtcNow);
op.WriteLine();
op.WriteLine();
list.ForEach(kvp =>
op.WriteLine("{0}\t{1:F2}%\t{2}", kvp.Value, 100.0 * kvp.Value / total, kvp.Key));
}
list.ForEach(kvp =>
op.WriteLine("{0}\t{1:F2}%\t{2}", kvp.Value, 100.0 * kvp.Value / total, kvp.Key));
}
catch
{

View file

@ -70,10 +70,7 @@ namespace Server.Commands
}
}
private static bool CIEqual(string l, string r)
{
return Insensitive.Equals(l, r);
}
private static bool CIEqual(string l, string r) => Insensitive.Equals(l, r);
public static CPA GetCPA(PropertyInfo p)
{
@ -346,40 +343,19 @@ namespace Server.Commands
return p == null ? failReason : InternalSetValue(from, logObject, o, p, name, value, true);
}
private static bool IsSerial(Type t)
{
return t == typeofSerial;
}
private static bool IsSerial(Type t) => t == typeofSerial;
private static bool IsType(Type t)
{
return t == typeofType;
}
private static bool IsType(Type t) => t == typeofType;
private static bool IsChar(Type t)
{
return t == typeofChar;
}
private static bool IsChar(Type t) => t == typeofChar;
private static bool IsString(Type t)
{
return t == typeofString;
}
private static bool IsString(Type t) => t == typeofString;
private static bool IsText(Type t)
{
return t == typeofText;
}
private static bool IsText(Type t) => t == typeofText;
private static bool IsEnum(Type t)
{
return t.IsEnum;
}
private static bool IsEnum(Type t) => t.IsEnum;
private static bool IsParsable(Type t)
{
return t == typeofTimeSpan || t.IsDefined(typeofParsable, false);
}
private static bool IsParsable(Type t) => t == typeofTimeSpan || t.IsDefined(typeofParsable, false);
private static object Parse(object o, Type t, string value)
{
@ -390,10 +366,7 @@ namespace Server.Commands
return method?.Invoke(o, m_ParseParams);
}
private static bool IsNumeric(Type t)
{
return Array.IndexOf(m_NumericTypes, t) >= 0;
}
private static bool IsNumeric(Type t) => Array.IndexOf(m_NumericTypes, t) >= 0;
public static string ConstructFromString(Type type, object obj, string value, ref object constructed)
{
@ -551,10 +524,8 @@ namespace Server
protected Property m_Property;
public PropertyException(Property property, string message)
: base(message)
{
: base(message) =>
m_Property = property;
}
public Property Property => m_Property;
}
@ -655,15 +626,9 @@ namespace Server
{
private PropertyInfo[] m_Chain;
public Property(string binding)
{
Binding = binding;
}
public Property(string binding) => Binding = binding;
public Property(PropertyInfo[] chain)
{
m_Chain = chain;
}
public Property(PropertyInfo[] chain) => m_Chain = chain;
public string Binding{ get; }

View file

@ -60,10 +60,7 @@ namespace Server.Commands
{
private double m_Value;
public AllSkillsTarget(double value) : base(-1, false, TargetFlags.None)
{
m_Value = value;
}
public AllSkillsTarget(double value) : base(-1, false, TargetFlags.None) => m_Value = value;
protected override void OnTarget(Mobile from, object targeted)
{

View file

@ -187,101 +187,97 @@ namespace Server
TileMatrix matrix = map.Tiles;
using (FileStream idxStream = OpenWrite(matrix.IndexStream))
using FileStream idxStream = OpenWrite(matrix.IndexStream);
using FileStream mulStream = OpenWrite(matrix.DataStream);
if (idxStream == null || mulStream == null)
{
using (FileStream mulStream = OpenWrite(matrix.DataStream))
badDataFile = true;
continue;
}
BinaryReader idxReader = new BinaryReader(idxStream);
BinaryWriter idxWriter = new BinaryWriter(idxStream);
BinaryWriter mulWriter = new BinaryWriter(mulStream);
foreach (DeltaState state in table.Values)
{
StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, state.m_X, state.m_Y,
matrix.BlockWidth, matrix.BlockHeight, out int oldTileCount);
if (oldTileCount < 0)
continue;
int newTileCount = 0;
StaticTile[] newTiles = new StaticTile[state.m_List.Count];
for (int i = 0; i < state.m_List.Count; ++i)
{
if (idxStream == null || mulStream == null)
{
badDataFile = true;
Item item = state.m_List[i];
int xOffset = item.X - state.m_X * 8;
int yOffset = item.Y - state.m_Y * 8;
if (xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8)
continue;
}
BinaryReader idxReader = new BinaryReader(idxStream);
StaticTile newTile = new StaticTile((ushort)item.ItemID, (byte)xOffset, (byte)yOffset,
(sbyte)item.Z, (short)item.Hue);
BinaryWriter idxWriter = new BinaryWriter(idxStream);
BinaryWriter mulWriter = new BinaryWriter(mulStream);
newTiles[newTileCount++] = newTile;
foreach (DeltaState state in table.Values)
{
StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, state.m_X, state.m_Y,
matrix.BlockWidth, matrix.BlockHeight, out int oldTileCount);
item.Delete();
if (oldTileCount < 0)
continue;
int newTileCount = 0;
StaticTile[] newTiles = new StaticTile[state.m_List.Count];
for (int i = 0; i < state.m_List.Count; ++i)
{
Item item = state.m_List[i];
int xOffset = item.X - state.m_X * 8;
int yOffset = item.Y - state.m_Y * 8;
if (xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8)
continue;
StaticTile newTile = new StaticTile((ushort)item.ItemID, (byte)xOffset, (byte)yOffset,
(sbyte)item.Z, (short)item.Hue);
newTiles[newTileCount++] = newTile;
item.Delete();
++totalFrozen;
}
int mulPos = -1;
int length = -1;
int extra = 0;
if (oldTileCount + newTileCount > 0)
{
mulWriter.Seek(0, SeekOrigin.End);
mulPos = (int)mulWriter.BaseStream.Position;
length = (oldTileCount + newTileCount) * 7;
extra = 1;
for (int i = 0; i < oldTileCount; ++i)
{
StaticTile toWrite = oldTiles[i];
mulWriter.Write((ushort)toWrite.ID);
mulWriter.Write((byte)toWrite.X);
mulWriter.Write((byte)toWrite.Y);
mulWriter.Write((sbyte)toWrite.Z);
mulWriter.Write((short)toWrite.Hue);
}
for (int i = 0; i < newTileCount; ++i)
{
StaticTile toWrite = newTiles[i];
mulWriter.Write((ushort)toWrite.ID);
mulWriter.Write((byte)toWrite.X);
mulWriter.Write((byte)toWrite.Y);
mulWriter.Write((sbyte)toWrite.Z);
mulWriter.Write((short)toWrite.Hue);
}
mulWriter.Flush();
}
int idxPos = (state.m_X * matrix.BlockHeight + state.m_Y) * 12;
idxWriter.Seek(idxPos, SeekOrigin.Begin);
idxWriter.Write(mulPos);
idxWriter.Write(length);
idxWriter.Write(extra);
idxWriter.Flush();
matrix.SetStaticBlock(state.m_X, state.m_Y, null);
}
++totalFrozen;
}
int mulPos = -1;
int length = -1;
int extra = 0;
if (oldTileCount + newTileCount > 0)
{
mulWriter.Seek(0, SeekOrigin.End);
mulPos = (int)mulWriter.BaseStream.Position;
length = (oldTileCount + newTileCount) * 7;
extra = 1;
for (int i = 0; i < oldTileCount; ++i)
{
StaticTile toWrite = oldTiles[i];
mulWriter.Write((ushort)toWrite.ID);
mulWriter.Write((byte)toWrite.X);
mulWriter.Write((byte)toWrite.Y);
mulWriter.Write((sbyte)toWrite.Z);
mulWriter.Write((short)toWrite.Hue);
}
for (int i = 0; i < newTileCount; ++i)
{
StaticTile toWrite = newTiles[i];
mulWriter.Write((ushort)toWrite.ID);
mulWriter.Write((byte)toWrite.X);
mulWriter.Write((byte)toWrite.Y);
mulWriter.Write((sbyte)toWrite.Z);
mulWriter.Write((short)toWrite.Hue);
}
mulWriter.Flush();
}
int idxPos = (state.m_X * matrix.BlockHeight + state.m_Y) * 12;
idxWriter.Seek(idxPos, SeekOrigin.Begin);
idxWriter.Write(mulPos);
idxWriter.Write(length);
idxWriter.Write(extra);
idxWriter.Flush();
matrix.SetStaticBlock(state.m_X, state.m_Y, null);
}
}
@ -351,96 +347,92 @@ namespace Server
TileMatrix matrix = map.Tiles;
using (FileStream idxStream = OpenWrite(matrix.IndexStream))
using FileStream idxStream = OpenWrite(matrix.IndexStream);
using FileStream mulStream = OpenWrite(matrix.DataStream);
if (idxStream == null || mulStream == null)
{
using (FileStream mulStream = OpenWrite(matrix.DataStream))
badDataFile = true;
return;
}
BinaryReader idxReader = new BinaryReader(idxStream);
BinaryWriter idxWriter = new BinaryWriter(idxStream);
BinaryWriter mulWriter = new BinaryWriter(mulStream);
for (int x = xStartBlock; x <= xEndBlock; ++x)
for (int y = yStartBlock; y <= yEndBlock; ++y)
{
StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, x, y, matrix.BlockWidth,
matrix.BlockHeight, out int oldTileCount);
if (oldTileCount < 0)
continue;
int newTileCount = 0;
StaticTile[] newTiles = new StaticTile[oldTileCount];
int baseX = (x << 3) - xTileStart, baseY = (y << 3) - yTileStart;
for (int i = 0; i < oldTileCount; ++i)
{
if (idxStream == null || mulStream == null)
StaticTile oldTile = oldTiles[i];
int px = baseX + oldTile.X;
int py = baseY + oldTile.Y;
if (px < 0 || px >= xTileWidth || py < 0 || py >= yTileHeight)
{
badDataFile = true;
return;
newTiles[newTileCount++] = oldTile;
}
BinaryReader idxReader = new BinaryReader(idxStream);
BinaryWriter idxWriter = new BinaryWriter(idxStream);
BinaryWriter mulWriter = new BinaryWriter(mulStream);
for (int x = xStartBlock; x <= xEndBlock; ++x)
for (int y = yStartBlock; y <= yEndBlock; ++y)
else
{
StaticTile[] oldTiles = ReadStaticBlock(idxReader, mulStream, x, y, matrix.BlockWidth,
matrix.BlockHeight, out int oldTileCount);
++totalUnfrozen;
if (oldTileCount < 0)
continue;
Item item = new Static(oldTile.ID);
int newTileCount = 0;
StaticTile[] newTiles = new StaticTile[oldTileCount];
item.Hue = oldTile.Hue;
int baseX = (x << 3) - xTileStart, baseY = (y << 3) - yTileStart;
for (int i = 0; i < oldTileCount; ++i)
{
StaticTile oldTile = oldTiles[i];
int px = baseX + oldTile.X;
int py = baseY + oldTile.Y;
if (px < 0 || px >= xTileWidth || py < 0 || py >= yTileHeight)
{
newTiles[newTileCount++] = oldTile;
}
else
{
++totalUnfrozen;
Item item = new Static(oldTile.ID);
item.Hue = oldTile.Hue;
item.MoveToWorld(new Point3D(px + xTileStart, py + yTileStart, oldTile.Z), map);
}
}
int mulPos = -1;
int length = -1;
int extra = 0;
if (newTileCount > 0)
{
mulWriter.Seek(0, SeekOrigin.End);
mulPos = (int)mulWriter.BaseStream.Position;
length = newTileCount * 7;
extra = 1;
for (int i = 0; i < newTileCount; ++i)
{
StaticTile toWrite = newTiles[i];
mulWriter.Write((ushort)toWrite.ID);
mulWriter.Write((byte)toWrite.X);
mulWriter.Write((byte)toWrite.Y);
mulWriter.Write((sbyte)toWrite.Z);
mulWriter.Write((short)toWrite.Hue);
}
mulWriter.Flush();
}
int idxPos = (x * matrix.BlockHeight + y) * 12;
idxWriter.Seek(idxPos, SeekOrigin.Begin);
idxWriter.Write(mulPos);
idxWriter.Write(length);
idxWriter.Write(extra);
idxWriter.Flush();
matrix.SetStaticBlock(x, y, null);
item.MoveToWorld(new Point3D(px + xTileStart, py + yTileStart, oldTile.Z), map);
}
}
int mulPos = -1;
int length = -1;
int extra = 0;
if (newTileCount > 0)
{
mulWriter.Seek(0, SeekOrigin.End);
mulPos = (int)mulWriter.BaseStream.Position;
length = newTileCount * 7;
extra = 1;
for (int i = 0; i < newTileCount; ++i)
{
StaticTile toWrite = newTiles[i];
mulWriter.Write((ushort)toWrite.ID);
mulWriter.Write((byte)toWrite.X);
mulWriter.Write((byte)toWrite.Y);
mulWriter.Write((sbyte)toWrite.Z);
mulWriter.Write((short)toWrite.Hue);
}
mulWriter.Flush();
}
int idxPos = (x * matrix.BlockHeight + y) * 12;
idxWriter.Seek(idxPos, SeekOrigin.Begin);
idxWriter.Write(mulPos);
idxWriter.Write(length);
idxWriter.Write(extra);
idxWriter.Flush();
matrix.SetStaticBlock(x, y, null);
}
}