| 825 | } |
| 826 | |
| 827 | void CBotManager::PickNextTrigger() |
| 828 | { |
| 829 | short lowest = -1; |
| 830 | bool found0 = false; // True if found a trigger with nr 0 |
| 831 | |
| 832 | loopv(ents) |
| 833 | { |
| 834 | entity &e = ents[i]; |
| 835 | |
| 836 | if (OUTBORD(e.x, e.y)) continue; |
| 837 | |
| 838 | vec o(e.x, e.y, S(e.x, e.y)->floor+player1->eyeheight); |
| 839 | |
| 840 | node_s *pWptNearEnt = NULL; |
| 841 | |
| 842 | pWptNearEnt = WaypointClass.GetNearestTriggerWaypoint(o, 2.0f); |
| 843 | |
| 844 | if (pWptNearEnt) |
| 845 | { |
| 846 | if ((pWptNearEnt->sTriggerNr > 0) && |
| 847 | ((pWptNearEnt->sTriggerNr < lowest) || (lowest == -1))) |
| 848 | lowest = pWptNearEnt->sTriggerNr; |
| 849 | if (pWptNearEnt->sTriggerNr == 0) found0 = true; |
| 850 | } |
| 851 | |
| 852 | #ifdef WP_FLOOD |
| 853 | pWptNearEnt = WaypointClass.GetNearestTriggerFloodWP(o, 2.0f); |
| 854 | |
| 855 | if (pWptNearEnt) |
| 856 | { |
| 857 | if ((pWptNearEnt->sTriggerNr > 0) && |
| 858 | ((pWptNearEnt->sTriggerNr < lowest) || (lowest == -1))) |
| 859 | lowest = pWptNearEnt->sTriggerNr; |
| 860 | if (pWptNearEnt->sTriggerNr == 0) found0 = true; |
| 861 | } |
| 862 | |
| 863 | #endif |
| 864 | } |
| 865 | |
| 866 | if ((lowest == -1) && found0) lowest = 0; |
| 867 | |
| 868 | if (lowest != -1) |
| 869 | m_sCurrentTriggerNr = lowest; |
| 870 | } |
| 871 | |
| 872 | botent *CBotManager::CreateBot(const char *team, const char *skill, const char *name) |
| 873 | { |