| 1088 | return; |
| 1089 | } |
| 1090 | i = bh.missions.Size() - 1; |
| 1091 | if (i < 0) |
| 1092 | { |
| 1093 | return; |
| 1094 | } |
| 1095 | MissionHistory& mh = bh.missions[i]; |
| 1096 | if (stricmp(mh.missionName, mission) != 0) |
| 1097 | { |
| 1098 | return; |
| 1099 | } |
| 1100 | mh.completed = true; |
| 1101 | // LOG_DEBUG(UI, "Campaign: Mission {}:{}:{} completed", (const char *)campaign, (const char *)battle, (const char |
| 1102 | // *)mission); |
| 1103 | } |
| 1104 | |
| 1105 | LSError CampaignHistory::Serialize(ParamArchive& ar) |
| 1106 | { |
| 1107 | PARAM_CHECK(ar.Serialize("campaignName", campaignName, 1)) |
| 1108 | PARAM_CHECK(ar.Serialize("Battles", battles, 1)) |
| 1109 | return LSOK; |
| 1110 | } |
| 1111 | |
| 1112 | void CampaignHistory::LoadWeaponPool(WeaponsInfo& pool) |
| 1113 | { |
| 1114 | MissionHistory* mh = CurrentMission(); |
| 1115 | RptF("Campaign: Loading weapon pool of mission %s", mh ? (const char*)mh->missionName : "<none>"); |
| 1116 | if (!mh) |
| 1117 | { |
| 1118 | return; |
| 1119 | } |
| 1120 | |
| 1121 | for (int i = 0; i < mh->weapons.Size(); i++) |
| 1122 | { |
| 1123 | Ref<WeaponType> weapon = WeaponTypes.New(mh->weapons[i].name); |
| 1124 | if (!weapon) |
| 1125 | { |
| 1126 | continue; |
| 1127 | } |
| 1128 | int count = mh->weapons[i].count; |
| 1129 | for (int j = 0; j < count; j++) |
| 1130 | { |
| 1131 | pool._weaponsPool.Add(weapon); |
| 1132 | } |
| 1133 | } |
| 1134 | for (int i = 0; i < mh->magazines.Size(); i++) |
| 1135 | { |
| 1136 | Ref<MagazineType> type = MagazineTypes.New(mh->magazines[i].name); |
| 1137 | if (!type) |
no test coverage detected