Show empty spots that are buried & never allow setting of buried empty spots

Closes #45
This commit is contained in:
Cuyler36 2019-01-09 01:17:15 -05:00
parent 0d804d6e4c
commit 8d4c884ae2
4 changed files with 11 additions and 8 deletions

View file

@ -105,7 +105,9 @@ public static Image GetItemPic(int itemsize, Item item, SaveType saveType)
const int width = 16;
const int height = 16;
var bmpData = new byte[1024];
var itemColor = item == null ? new byte[] { 0xFF, 0xFF, 0x00, 0x00 } : BitConverter.GetBytes(ItemData.GetItemColor(ItemData.GetItemType(item.ItemId, saveType)));
var itemColor = item == null
? new byte[] {0xFF, 0xFF, 0x00, 0x00}
: BitConverter.GetBytes(ItemData.GetItemColor(ItemData.GetItemType(item.ItemId, saveType)));
for (var i = 0; i < 1024; i+=4)
itemColor.CopyTo(bmpData, i);

View file

@ -77,11 +77,7 @@ public uint ToUInt32()
public bool Equals(Item other)
{
if (ReferenceEquals(other, null)) return false;
if (ReferenceEquals(other, this)) return true;
return other.ItemId == ItemId &&
other.Flag1 == Flag1 &&
other.Flag2 == Flag2;
return ReferenceEquals(other, this);
}
public bool Equals(ushort other) => ItemId == other;

View file

@ -114,6 +114,11 @@ public bool SetItemBuried(Item item, bool buried, SaveGeneration generation)
var itemIdx = Array.IndexOf(Items, item);
if (itemIdx < 0 || itemIdx > 255) return false;
if (item.Type == ItemType.Empty)
{
buried = false; // Don't allow "empty" spots to be buried no matter what.
}
int offset;
switch (generation)
{

View file

@ -88,8 +88,8 @@ public static void DrawBuriedIcons(Bitmap map, WorldAcre acre, int itemSize)
for (var i = 0; i < acre.Items.Length; i++)
{
var item = acre.Items[i];
if (!acre.IsItemBuried(item, Save.SaveInstance.SaveGeneration) ||
item.Type == ItemType.Empty) continue;
if (!acre.IsItemBuried(item, Save.SaveInstance.SaveGeneration)) continue;
bitmapGraphics.DrawImage(buriedIcon, (i % 16) * itemSize + 1,
(i / 16) * itemSize + 1, itemSize - 1, itemSize - 1);
}