void CUWPsWindow::RefreshWindow(bool includeTree) { ChkCuwp cuwp = {}; if ( includeTree ) { cuwpTree.EmptySubTree(NULL); int cuwpCapacity = chkd.maps.curr->CuwpCapacity(); for ( int i = 0; i < cuwpCapacity; i++ ) { if ( chkd.maps.curr->IsCuwpUsed(i) ) cuwpTree.InsertTreeItem(NULL, std::string("CUWP #" + std::to_string(i)).c_str(), i); else cuwpTree.InsertTreeItem(NULL, std::string("(#" + std::to_string(i) + ")").c_str(), i); } } if ( selectedCuwp != -1 && chkd.maps.curr->GetCuwp(selectedCuwp, cuwp) ) { checkUsed.SetCheck(chkd.maps.curr->IsCuwpUsed(selectedCuwp)); editHitpointPercent.SetEditNum<u8>(cuwp.percentHitpoints); editManaPercent.SetEditNum<u8>(cuwp.percentEnergyPoints); editShieldPercent.SetEditNum<u8>(cuwp.percentShieldPoints); editResources.SetEditNum<u32>(cuwp.resourceAmount); editHanger.SetEditNum<u16>(cuwp.numInHanger); checkInvincible.SetCheck(cuwp.IsUnitInvincible()); checkBurrowed.SetCheck(cuwp.IsUnitBurrowed()); checkLifted.SetCheck(cuwp.IsBuildingInTransit()); checkHallucinated.SetCheck(cuwp.IsUnitHallucinated()); checkCloaked.SetCheck(cuwp.IsUnitCloaked()); } else DisableEditing(); }
void CUWPsWindow::NotifyButtonClicked(int idFrom, HWND hWndFrom) { ChkCuwp cuwp = {}; if ( chkd.maps.curr->GetCuwp(selectedCuwp, cuwp) ) { switch ( idFrom ) { case CheckInvincible: cuwp.SetUnitIsInvincible(checkInvincible.isChecked()); break; case CheckBurrowed: cuwp.SetUnitIsBurrowed(checkBurrowed.isChecked()); break; case CheckLifted: cuwp.SetBuildingInTransit(checkLifted.isChecked()); break; case CheckHallucinated: cuwp.SetUnitIsHallucinated(checkHallucinated.isChecked()); break; case CheckCloaked: cuwp.SetUnitIsCloaked(checkCloaked.isChecked()); break; } chkd.maps.curr->ReplaceCuwp(cuwp, selectedCuwp); } std::cout << "CUWP Notify Button Clicked" << std::endl; }
void CUWPsWindow::NotifyButtonClicked(int idFrom, HWND hWndFrom) { ChkCuwp cuwp = {}; if ( CM->GetCuwp(selectedCuwp, cuwp) ) { switch ( idFrom ) { case CheckInvincible: cuwp.SetUnitIsInvincible(checkInvincible.isChecked()); break; case CheckBurrowed: cuwp.SetUnitIsBurrowed(checkBurrowed.isChecked()); break; case CheckLifted: cuwp.SetBuildingInTransit(checkLifted.isChecked()); break; case CheckHallucinated: cuwp.SetUnitIsHallucinated(checkHallucinated.isChecked()); break; case CheckCloaked: cuwp.SetUnitIsCloaked(checkCloaked.isChecked()); break; } CM->ReplaceCuwp(cuwp, selectedCuwp); CM->notifyChange(false); } }