TModLoader v1.4.4.9
TModLoader source code documentation
Loading...
Searching...
No Matches

◆ CountTiles()

static void Terraria.WorldGen.CountTiles ( int X)
inlinestatic

Definition at line 65686 of file WorldGen.cs.

65687 {
65688 if (X == 0)
65689 {
65694 tGood = (byte)Math.Round((double)totalGood / (double)totalSolid * 100.0);
65695 tEvil = (byte)Math.Round((double)totalEvil / (double)totalSolid * 100.0);
65696 tBlood = (byte)Math.Round((double)totalBlood / (double)totalSolid * 100.0);
65697 if (tGood == 0 && totalGood > 0)
65698 {
65699 tGood = 1;
65700 }
65701 if (tEvil == 0 && totalEvil > 0)
65702 {
65703 tEvil = 1;
65704 }
65705 if (tBlood == 0 && totalBlood > 0)
65706 {
65707 tBlood = 1;
65708 }
65709 if (Main.netMode == 2)
65710 {
65711 NetMessage.SendData(57);
65712 }
65713 totalEvil2 = 0;
65714 totalSolid2 = 0;
65715 totalGood2 = 0;
65716 totalBlood2 = 0;
65717 }
65718 ushort num = 0;
65719 ushort num2 = 0;
65720 int num3 = 0;
65721 int num4 = 0;
65722 int num5 = 0;
65723 do
65724 {
65725 int num6;
65726 int num7;
65727 if (num4 == 0)
65728 {
65729 num6 = 0;
65730 num5 = (int)(Main.worldSurface + 1.0);
65731 num7 = 5;
65732 }
65733 else
65734 {
65735 num6 = num5;
65736 num5 = Main.maxTilesY;
65737 num7 = 1;
65738 }
65739 for (int i = num6; i < num5; i++)
65740 {
65741 Tile tile = Main.tile[X, i];
65742 if (tile == null)
65743 {
65744 Tile tile3 = (Main.tile[X, i] = default(Tile));
65745 tile = tile3;
65746 }
65747 num = tile.type;
65748 if (num != 0 || tile.active())
65749 {
65750 if (num == num2)
65751 {
65752 num3 += num7;
65753 continue;
65754 }
65755 tileCounts[num2] += num3;
65756 num2 = num;
65757 num3 = num7;
65758 }
65759 }
65760 tileCounts[num2] += num3;
65761 num3 = 0;
65762 num4++;
65763 }
65764 while (num4 < 2);
65766 }
static int totalEvil2
Definition WorldGen.cs:1182
static int totalSolid
Definition WorldGen.cs:1180
static int totalEvil
Definition WorldGen.cs:1174
static int totalSolid2
Definition WorldGen.cs:1188
static byte tBlood
Definition WorldGen.cs:1192
static int totalBlood2
Definition WorldGen.cs:1184
static int totalGood2
Definition WorldGen.cs:1186
static int totalBlood
Definition WorldGen.cs:1176
static void AddUpAlignmentCounts(bool clearCounts=false)
static int totalGood
Definition WorldGen.cs:1178
static byte tEvil
Definition WorldGen.cs:1190
static byte tGood
Definition WorldGen.cs:1194
static int[] tileCounts
Definition WorldGen.cs:1172

References Terraria.Tile.active(), Terraria.Main.maxTilesY, Terraria.Main.netMode, Terraria.NetMessage.SendData(), Terraria.Main.tile, Terraria.Tile.type, and Terraria.Main.worldSurface.

+ Here is the call graph for this function: