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

◆ FillWallHolesInSpot()

static bool Terraria.WorldGen.FillWallHolesInSpot ( int originX,
int originY,
int maxWallsThreshold )
inlinestaticprivate

Definition at line 6056 of file WorldGen.cs.

6057 {
6058 if (!InWorld(originX, originY, 2))
6059 {
6060 return false;
6061 }
6066 list2.Add(new Point(originX, originY));
6067 while (list2.Count > 0)
6068 {
6069 list.Clear();
6071 list2.Clear();
6072 while (list.Count > 0)
6073 {
6075 {
6076 return false;
6077 }
6078 Point item = list[0];
6079 if (hashSet.Contains(item))
6080 {
6081 list.Remove(item);
6082 continue;
6083 }
6084 if (!InWorld(item.X, item.Y, 1))
6085 {
6086 list.Remove(item);
6087 continue;
6088 }
6089 hashSet.Add(item);
6090 list.Remove(item);
6091 Tile tile = Main.tile[item.X, item.Y];
6092 if (tile.wall != 0)
6093 {
6094 if (dictionary.ContainsKey(tile.wall))
6095 {
6096 dictionary[tile.wall] = dictionary[tile.wall] + 1;
6097 }
6098 else
6099 {
6100 dictionary[tile.wall] = 1;
6101 }
6102 continue;
6103 }
6104 bool flag = false;
6105 if (!flag)
6106 {
6107 int y = item.Y;
6108 for (int i = item.X - 1; i <= item.X + 1; i++)
6109 {
6110 if (!Main.tile[i, y].active())
6111 {
6112 flag = true;
6113 break;
6114 }
6115 }
6116 }
6117 if (!flag)
6118 {
6119 int x = item.X;
6120 for (int j = item.Y - 1; j <= item.Y + 1; j++)
6121 {
6122 if (!Main.tile[x, j].active())
6123 {
6124 flag = true;
6125 break;
6126 }
6127 }
6128 }
6129 if (flag)
6130 {
6131 Point item2 = new Point(item.X - 1, item.Y);
6132 if (!hashSet.Contains(item2))
6133 {
6134 list2.Add(item2);
6135 }
6136 item2 = new Point(item.X + 1, item.Y);
6137 if (!hashSet.Contains(item2))
6138 {
6139 list2.Add(item2);
6140 }
6141 item2 = new Point(item.X, item.Y - 1);
6142 if (!hashSet.Contains(item2))
6143 {
6144 list2.Add(item2);
6145 }
6146 item2 = new Point(item.X, item.Y + 1);
6147 if (!hashSet.Contains(item2))
6148 {
6149 list2.Add(item2);
6150 }
6151 }
6152 }
6153 }
6154 if (hashSet.Count == 1)
6155 {
6156 return false;
6157 }
6158 ushort wall = 0;
6159 int num = -1;
6161 {
6162 if (item3.Value > num)
6163 {
6164 wall = item3.Key;
6165 num = item3.Value;
6166 }
6167 }
6168 if (num == -1)
6169 {
6170 wall = 2;
6171 }
6172 foreach (Point item4 in hashSet)
6173 {
6174 Tile tile2 = Main.tile[item4.X, item4.Y];
6175 if (tile2.wall == 0)
6176 {
6177 tile2.wall = wall;
6178 }
6179 }
6180 return true;
6181 }
bool ICollection< KeyValuePair< TKey, TValue > >. Remove(KeyValuePair< TKey, TValue > keyValuePair)
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void AddRange(IEnumerable< KeyValuePair< TKey, TValue > > collection)
void Add(TKey key, TValue value)
static bool InWorld(int x, int y, int fluff=0)
Definition WorldGen.cs:5816

References System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.AddRange(), System.Collections.Generic.Dictionary< TKey, TValue >.Clear(), System.Collections.Generic.Dictionary< TKey, TValue >.Contains(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, System.dictionary, Terraria.WorldGen.InWorld(), System.item, System.list, System.Collections.Generic.Dictionary< TKey, TValue >.Remove(), Terraria.Main.tile, and Terraria.Tile.wall.

Referenced by Terraria.WorldGen.FillWallHolesInColumn().