| 132 | const xr_vector<DetailPathManager::STravelPathPoint>& CMovementManager::path() const { return (detail().path()); } |
| 133 | |
| 134 | void CMovementManager::update_path() |
| 135 | { |
| 136 | START_PROFILE("Build Path::update") |
| 137 | |
| 138 | if (!enabled() || wait_for_distributed_computation()) |
| 139 | return; |
| 140 | |
| 141 | if (!game_path().evaluator()) |
| 142 | game_path().set_evaluator(base_game_params()); |
| 143 | |
| 144 | if (!level_path().evaluator()) |
| 145 | level_path().set_evaluator(base_level_params()); |
| 146 | |
| 147 | #pragma todo("Optimize this in case of slowdown or not intended behaviour") |
| 148 | if (!restrictions().actual()) |
| 149 | { |
| 150 | m_path_actuality = false; |
| 151 | } |
| 152 | |
| 153 | restrictions().actual(true); |
| 154 | |
| 155 | if (!actual()) |
| 156 | { |
| 157 | game_path().make_inactual(); |
| 158 | level_path().make_inactual(); |
| 159 | patrol().make_inactual(); |
| 160 | switch (m_path_type) |
| 161 | { |
| 162 | case ePathTypeGamePath: { |
| 163 | m_path_state = ePathStateSelectGameVertex; |
| 164 | break; |
| 165 | } |
| 166 | case ePathTypeLevelPath: { |
| 167 | m_path_state = ePathStateBuildLevelPath; |
| 168 | if (!restrictions().accessible(level_path().dest_vertex_id())) |
| 169 | { |
| 170 | Fvector temp; |
| 171 | level_path().set_dest_vertex(restrictions().accessible_nearest(ai().level_graph().vertex_position(level_path().dest_vertex_id()), temp)); |
| 172 | detail().set_dest_position(temp); |
| 173 | } |
| 174 | else |
| 175 | { |
| 176 | if (!restrictions().accessible(detail().dest_position())) |
| 177 | { |
| 178 | detail().set_dest_position(ai().level_graph().vertex_position(level_path().dest_vertex_id())); |
| 179 | } |
| 180 | } |
| 181 | break; |
| 182 | } |
| 183 | case ePathTypePatrolPath: { |
| 184 | m_path_state = ePathStateSelectPatrolPoint; |
| 185 | break; |
| 186 | } |
| 187 | case ePathTypeNoPath: { |
| 188 | m_path_state = ePathStateDummy; |
| 189 | break; |
| 190 | } |
| 191 | default: NODEFAULT; |
no test coverage detected