Beispiel #1
0
        private void CrossCanal(SCOwArea currentArea, SCRequirementsSet requirements, SCOwArea area)
        {
            if ((currentArea.Tile & SCBitFlags.Ocean) == 0)
            {
                foreach (var link in area.Links)
                {
                    var area2 = main.Overworld.Areas[link];

                    if ((area2.Tile & SCBitFlags.Ocean) == 0)
                    {
                        todoset.Enqueue(new SCLogicAreaQueueEntry {
                            AreaId = link, Requirements = requirements
                        });
                    }
                }
            }
            else
            {
                var newRequirements = requirements?.Restrict(SCRequirements.Canal);

                foreach (var link in area.Links)
                {
                    var area2 = main.Overworld.Areas[link];

                    if ((area2.Tile & SCBitFlags.Ocean) > 0)
                    {
                        todoset.Enqueue(new SCLogicAreaQueueEntry {
                            AreaId = link, Requirements = newRequirements
                        });
                    }
                }
            }
        }
Beispiel #2
0
        private void AddToDo(SCOwArea currentArea, short areaId, SCRequirementsSet requirements)
        {
            var area = main.Overworld.Areas[areaId];

            if ((area.Tile & SCBitFlags.Ocean) > 0 && (currentArea.Tile & SCBitFlags.Ocean) == 0 && currentArea != shipDockArea)
            {
                return;
            }

            if (tunnels.TryGetValue(areaId, out var tlist))
            {
                foreach (var tunnel in tlist)
                {
                    var newRequirements = requirements?.Restrict(tunnel.Requirements);
                    todoset.Enqueue(new SCLogicAreaQueueEntry {
                        AreaId = tunnel.AreaId, Requirements = newRequirements
                    });
                }
            }

            if ((area.Tile & SCBitFlags.Bridge) > 0)
            {
                CrossBridge(currentArea, requirements, area);
            }
            else if ((area.Tile & SCBitFlags.Canal) > 0)
            {
                CrossCanal(currentArea, requirements, area);
            }
            else
            {
                todoset.Enqueue(new SCLogicAreaQueueEntry {
                    AreaId = areaId, Requirements = requirements
                });
            }
        }
Beispiel #3
0
        private void CheckArea(short areaId, SCRequirementsSet flags)
        {
            var area = main.Overworld.Areas[areaId];

            var newFlags = flags.Restrict(area.Requirements);

            if (processedAreas.TryGetValue(areaId, out var logicArea))
            {
                if (logicArea.Requirements.Merge(newFlags))
                {
                    foreach (var link in area.Links)
                    {
                        AddToDo(area, link, newFlags);
                    }
                }
            }
            else
            {
                var newLogicArea = new SCLogicArea(areaId, area, newFlags);
                processedAreas.Add(areaId, newLogicArea);

                foreach (var link in area.Links)
                {
                    AddToDo(area, link, newFlags);
                }
            }
        }
Beispiel #4
0
        public bool Merge(SCRequirementsSet bitFlagSet)
        {
            bool result = false;

            foreach (var fl in bitFlagSet)
            {
                result |= Merge(fl);
            }

            return(result);
        }
Beispiel #5
0
        public SCRequirementsSet Ease(SCRequirements requirements)
        {
            var and = 0xFFFFFFFF - (int)requirements;

            var result = new SCRequirementsSet();

            foreach (var req in this)
            {
                result.Merge((SCRequirements)((int)req & and));
            }

            return(result);
        }
Beispiel #6
0
        public bool Merge(SCRequirementsSet bitFlagSet, SCRequirementsSet requirements)
        {
            bool result = false;

            foreach (var req in requirements)
            {
                foreach (var fl in bitFlagSet)
                {
                    result |= Merge(fl | req);
                }
            }

            return(result);
        }
Beispiel #7
0
 public SCRequirementsSet Restrict(SCRequirementsSet flags)
 {
     return(new SCRequirementsSet(this.Select(f1 => flags.Select(f2 => f1 | f2)).SelectMany(x => x)));
 }