MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / LoadWeaponPool

Method LoadWeaponPool

engine/Poseidon/UI/OptionsUI.cpp:1090–1134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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
1105LSError 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
1112void 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)

Callers 1

CampaignLoadWeaponPoolFunction · 0.80

Calls 4

SizeMethod · 0.45
NewMethod · 0.45
AddMethod · 0.45
RandomValueMethod · 0.45

Tested by

no test coverage detected