| 1070 | } |
| 1071 | } |
| 1072 | |
| 1073 | void DisplayMap::UpdateWeaponsInBriefing() |
| 1074 | { |
| 1075 | // create structure |
| 1076 | AIUnit* me = GWorld->FocusOn(); |
| 1077 | if (!me) |
| 1078 | { |
| 1079 | return; |
| 1080 | } |
| 1081 | AIGroup* grp = me->GetGroup(); |
| 1082 | if (!grp) |
| 1083 | { |
| 1084 | return; |
| 1085 | } |
| 1086 | |
| 1087 | AIUnit* oldUnit = nullptr; |
| 1088 | if (_currentUnit >= 0 && _currentUnit < _weaponsInfo._weapons.Size()) |
| 1089 | { |
| 1090 | oldUnit = _weaponsInfo._weapons[_currentUnit].unit; |
| 1091 | } |
| 1092 | |
| 1093 | _currentUnit = -1; |
| 1094 | _currentSlot = -1; |
| 1095 | _weaponsInfo._weapons.Resize(0); |
| 1096 | |
| 1097 | for (int i = 0; i < MAX_UNITS_PER_GROUP; i++) |
| 1098 | { |
| 1099 | AIUnit* unit = grp->UnitWithID(i + 1); |
| 1100 | if (unit) |
| 1101 | { |
| 1102 | _weaponsInfo._weapons.Add(UnitWeaponsInfo(unit)); |
| 1103 | } |
| 1104 | } |
| 1105 | if (oldUnit) |
| 1106 | { |
| 1107 | for (int i = 0; i < _weaponsInfo._weapons.Size(); i++) |
| 1108 | { |
| 1109 | if (_weaponsInfo._weapons[i].unit == oldUnit) |
| 1110 | { |
| 1111 | _currentUnit = i; |
| 1112 | break; |
| 1113 | } |
| 1114 | } |
| 1115 | } |
| 1116 | if (_currentUnit < 0) |
| 1117 | { |
| 1118 | for (int i = 0; i < _weaponsInfo._weapons.Size(); i++) |
| 1119 | { |
| 1120 | if (_weaponsInfo._weapons[i].unit == me) |
| 1121 | { |
| 1122 | _currentUnit = i; |
| 1123 | break; |
| 1124 | } |
| 1125 | } |
| 1126 | } |
| 1127 | PoseidonAssert(_currentUnit >= 0); |
| 1128 | |
| 1129 | // create html page |
no test coverage detected