void CShellBrowser::SortFolder(UINT SortMode) { m_SortMode = SortMode; if(m_bShowInGroups) { ListView_EnableGroupView(m_hListView,FALSE); ListView_RemoveAllGroups(m_hListView); ListView_EnableGroupView(m_hListView,TRUE); SetGrouping(TRUE); } SendMessage(m_hListView,LVM_SORTITEMS,reinterpret_cast<WPARAM>(this),reinterpret_cast<LPARAM>(SortStub)); /* If in details view, the column sort arrow will need to be changed to reflect the new sorting mode. */ if(m_ViewMode == VM_DETAILS) { ApplyHeaderSortArrow(); } }
void UnitGroup::Update () { if (state == ugroup_Building || units.empty ()) return; int2 sector, dif; float2 pmin, pmax; if (!CalcPositioning (pmin,pmax,mid,sector)) return; if (current.x < 0) current = globals->map->GetGameInfoCoords (float3 (mid.x,0.0f,mid.y)); // change current? if (sector.x >= 0) { dif.x=sector.x-current.x; dif.y=sector.y-current.y; if (dif.x*dif.x+dif.y*dif.y > 2) current = sector; } GameInfo *b = globals->map->GetGameInfo (goal); // calc spreading float difx=pmax.x-pmin.x, dify=pmax.y-pmin.y; float spread = sqrtf (difx*difx+dify*dify); GameInfo *cur = 0; cur = globals->map->GetGameInfo (current); switch (state) { case ugroup_Grouping: if (spread < group->groupdist) SetMoving (); break; case ugroup_Pruning: { // is current target still in sector? if (find (cur->enemies.begin(),cur->enemies.end(), curTarget) == cur->enemies.end ()) { // no, so find a new target if (cur->enemies.empty ()) // move on { SetNewGoal(); SetMoving (); } else if (lastCmdFrame < globals->cb->GetCurrentFrame () - 30) SetPruning (); } break;} case ugroup_Moving: if (!cur->enemies.empty ()) SetPruning (); else { if (goal.x < 0 || IsGoalReached (mid,spread)) SetNewGoal (); if (spread > group->maxspread) SetGrouping (); } break; case ugroup_WaitingForGoal: SetNewGoal (); break; } }