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

Method Import

engine/Poseidon/UI/Map/UIMapDisplay.cpp:400–466  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

398}
399
400bool WeaponsInfo::Import(const ParamEntry& superclass)
401{
402 const ParamEntry* cls = superclass.FindEntry("Weapons");
403 if (cls)
404 {
405 int mask = MaskSlotPrimary | MaskSlotSecondary | MaskSlotBinocular | MaskSlotHandGun;
406 for (int i = 0; i < cls->GetEntryCount(); i++)
407 {
408 const ParamEntry& entry = cls->GetEntry(i);
409 Ref<WeaponType> weapon = WeaponTypes.New(entry.GetName());
410 if (!weapon)
411 {
412 continue;
413 }
414 if (weapon->_scope < 2)
415 {
416 continue;
417 }
418 if ((weapon->_weaponType & mask) == 0)
419 {
420 continue;
421 }
422 int count = entry >> "count";
423 for (int j = 0; j < count; j++)
424 {
425 _weaponsPool.Add(weapon);
426 }
427 }
428 }
429 cls = superclass.FindEntry("Magazines");
430 if (cls)
431 {
432 int mask = MaskSlotItem | MaskSlotHandGunItem;
433 for (int i = 0; i < cls->GetEntryCount(); i++)
434 {
435 const ParamEntry& entry = cls->GetEntry(i);
436 Ref<MagazineType> type = MagazineTypes.New(entry.GetName());
437 if (!type)
438 {
439 continue;
440 }
441 if (type->_scope < 2)
442 {
443 continue;
444 }
445 if ((type->_magazineType & mask) == 0)
446 {
447 continue;
448 }
449 int count = entry >> "count";
450 for (int j = 0; j < count; j++)
451 {
452 Ref<Magazine> magazine = new Magazine(type);
453 magazine->_ammo = type->_maxAmmo;
454 magazine->_reloadMagazine = 0;
455 magazine->_reload = 0;
456 if (type->_modes.Size() > 0)
457 {

Callers 1

Calls 7

FindEntryMethod · 0.45
GetEntryCountMethod · 0.45
NewMethod · 0.45
GetNameMethod · 0.45
AddMethod · 0.45
SizeMethod · 0.45
RandomValueMethod · 0.45

Tested by

no test coverage detected