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

◆ Perform()

override bool Terraria.GameContent.Generation.ShapeFloodFill.Perform ( Point origin,
GenAction action )
inline

Definition at line 17 of file ShapeFloodFill.cs.

18 {
21 queue.Enqueue(origin);
22 int num = _maximumActions;
23 while (queue.Count > 0 && num > 0)
24 {
25 Point point = queue.Dequeue();
26 if (!hashSet.Contains(new Point16(point.X, point.Y)) && UnitApply(action, origin, point.X, point.Y))
27 {
28 hashSet.Add(new Point16(point));
29 num--;
30 if (point.X + 1 < Main.maxTilesX - 1)
31 {
32 queue.Enqueue(new Point(point.X + 1, point.Y));
33 }
34 if (point.X - 1 >= 1)
35 {
36 queue.Enqueue(new Point(point.X - 1, point.Y));
37 }
38 if (point.Y + 1 < Main.maxTilesY - 1)
39 {
40 queue.Enqueue(new Point(point.X, point.Y + 1));
41 }
42 if (point.Y - 1 >= 1)
43 {
44 queue.Enqueue(new Point(point.X, point.Y - 1));
45 }
46 }
47 }
48 while (queue.Count > 0)
49 {
50 Point item = queue.Dequeue();
51 if (!hashSet.Contains(new Point16(item.X, item.Y)))
52 {
53 queue.Enqueue(item);
54 break;
55 }
56 }
57 return queue.Count == 0;
58 }
bool ICollection< KeyValuePair< TKey, TValue > >. Contains(KeyValuePair< TKey, TValue > keyValuePair)
void Add(TKey key, TValue value)
bool UnitApply(GenAction action, Point origin, int x, int y, params object[] args)
Definition GenShape.cs:13

References Terraria.GameContent.Generation.ShapeFloodFill._maximumActions, System.Collections.Generic.Dictionary< TKey, TValue >.Add(), System.Collections.Generic.Dictionary< TKey, TValue >.Contains(), System.Collections.Generic.Dictionary< TKey, TValue >.Count, Terraria.Main.maxTilesX, Terraria.Main.maxTilesY, Terraria.WorldBuilding.GenShape.UnitApply(), Microsoft.Xna.Framework.Point.X, and Microsoft.Xna.Framework.Point.Y.