Files

32 lines
1001 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Darklord.js — addBloodSpreadFrontier() (satır 1340)
[← Darklord.js](index.md) · [← Master](../../wiki.md)
```javascript
function addBloodSpreadFrontier(pool, x, z)
{
if (!pool.frontier) pool.frontier = [];
if (!pool.frontierMap) pool.frontierMap = {};
if (!pool.visited) pool.visited = {};
x = Math.floor(Number(x || 0));
z = Math.floor(Number(z || 0));
var key = bloodSpreadVisitKey(x, z);
if (pool.visited[key] || pool.frontierMap[key]) return false;
pool.frontierMap[key] = true;
pool.frontier.push({ x: x, z: z });
while (pool.frontier.length > BLOOD_SPREAD_FRONTIER_LIMIT)
{
var cut = Math.floor(Math.random() * pool.frontier.length);
var removed = pool.frontier[cut];
pool.frontier[cut] = pool.frontier[pool.frontier.length - 1];
pool.frontier.pop();
if (removed) delete pool.frontierMap[bloodSpreadVisitKey(removed.x, removed.z)];
}
return true;
}
```