fix: 引擎使用传入的 _planner,不再内部 new DefaultDefensePlanner

- 构造函数传入的 planner 之前从未使用(死代码)
- Initialize 内删除了重复的 DB catalog 加载和 new DefaultDefensePlanner
- 现在统一由调用方注入 Planner
This commit is contained in:
tian 2026-06-13 12:20:51 +08:00
parent 45387fee73
commit 3ba8e4f604

View File

@ -130,15 +130,8 @@ namespace CounterDrone.Core.Simulation
var threats = BuildDroneGroups(config);
if (fireUnits.Count > 0 && threats.Count > 0)
{
using (var ammoDb = new SQLiteConnection(_paths.GetMainDbPath()))
{
var catalog = new List<AmmunitionSpec>(ammoDb.Table<AmmunitionSpec>().ToList());
if (catalog.Count == 0)
catalog = DefaultAmmunition.GetAll();
var planner = new DefaultDefensePlanner(catalog);
var result = planner.Plan(fireUnits, threats, _scene);
SetFireSchedule(result.Best.MergedSchedule);
}
var result = _planner.Plan(fireUnits, threats, _scene);
SetFireSchedule(result.Best.MergedSchedule);
}
}