| 1257 | } |
| 1258 | |
| 1259 | bool findHits(EngineInfo *engine, std::vector<Hit> *hit_points, float bias) |
| 1260 | { |
| 1261 | df::coord origin = engine->center; |
| 1262 | |
| 1263 | Hit info; |
| 1264 | info.path = this; |
| 1265 | |
| 1266 | for (auto it = path.begin(); it != path.end(); ++it) |
| 1267 | { |
| 1268 | info.pos = it->second; |
| 1269 | info.dist = point_distance(origin - info.pos); |
| 1270 | info.time = float(info.dist)*(engine->proj_speed+1) + engine->hit_delay + bias; |
| 1271 | get_margin(it, info.time, &info.lmargin, &info.rmargin); |
| 1272 | |
| 1273 | if (info.lmargin > 0 && info.rmargin > 0) |
| 1274 | { |
| 1275 | if (engine->onTarget(info.pos) && engine->isInRange(info.dist)) |
| 1276 | hit_points->push_back(info); |
| 1277 | } |
| 1278 | } |
| 1279 | |
| 1280 | return !hit_points->empty(); |
| 1281 | } |
| 1282 | }; |
| 1283 | |
| 1284 | std::map<df::unit*, UnitPath*> UnitPath::cache; |
no test coverage detected