Esempio n. 1
0
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();
}