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

Method UpdateVehicles

engine/Poseidon/UI/Map/UIArcade.cpp:357–453  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

355}
356
357void DisplayArcadeUnit::UpdateVehicles(CCombo* combo, const char* vehicle)
358{
359 bool isVehicle = vehicle && *vehicle;
360
361 CCombo* combo2 = dynamic_cast<CCombo*>(GetCtrl(IDC_ARCUNIT_SIDE));
362 PoseidonAssert(combo2);
363 int side = combo2->GetValue(combo2->GetCurSel());
364
365 combo2 = dynamic_cast<CCombo*>(GetCtrl(IDC_ARCUNIT_CLASS));
366 PoseidonAssert(combo2);
367 int sel2 = combo2->GetCurSel();
368 if (sel2 < 0)
369 {
370 return;
371 }
372 RString vehicleClass = combo2->GetData(sel2);
373
374 combo->ClearStrings();
375 const ParamClass* cls = Pars.GetClass("CfgVehicles");
376 RString firstVehicle;
377 for (int i = 0; i < cls->GetEntryCount(); i++)
378 {
379 const ParamEntry& vehEntry = cls->GetEntry(i);
380 const ParamClass* vehCls = dynamic_cast<const ParamClass*>(&vehEntry);
381 if (!vehCls)
382 {
383 continue;
384 }
385 int scope = vehEntry >> "scope";
386 if (scope != 2)
387 {
388 continue;
389 }
390 int vehSide = vehEntry >> "side";
391 if (side == TEmpty)
392 {
393 if (vehSide == TLogic)
394 {
395 continue;
396 }
397 if (vehCls->IsDerivedFrom(*cls->GetClass("Man")))
398 {
399 continue;
400 }
401 }
402 else if (side != vehSide)
403 {
404 continue;
405 }
406
407 RString name = vehEntry >> "vehicleClass";
408 if (name.GetLength() == 0)
409 {
410 continue;
411 }
412 if (strcmp(name, vehicleClass) != 0)
413 {
414 continue;

Callers

nothing calls this directly

Calls 15

GetCtrlFunction · 0.85
saturateMaxFunction · 0.85
ClearStringsMethod · 0.80
GetClassMethod · 0.80
IsDerivedFromMethod · 0.80
AddStringMethod · 0.80
SortItemsMethod · 0.80
GetValueMethod · 0.45
GetCurSelMethod · 0.45
GetDataMethod · 0.45
GetEntryCountMethod · 0.45
GetLengthMethod · 0.45

Tested by

no test coverage detected