38static Int thePrevCurTeam = 0;
40static const char* NEUTRAL_NAME_STR =
"(neutral)";
57 CDialog::DoDataExchange(pDX);
83 return sides.isPlayerDefaultTeam(sides.getTeamInfo(i));
101 ostr = NEUTRAL_NAME_STR;
103 n.
format(
"(default team)");
115 if (playerNameForUI(sides, i) == n)
147 DEBUG_ASSERTLOG(!modified,(
"had to clean up sides in CTeamsDialog::updateUI! (caller should do this)"));
163 Bool isDefault =
true;
171 del->EnableWindow(!isDefault);
173 copyteam->EnableWindow(!isDefault);
177 moveup->EnableWindow(!isDefault);
179 movedown->EnableWindow(!isDefault);
182 Int whichPlayer = players->GetCurSel();
184 CButton *newteam = (CButton*)GetDlgItem(
IDC_NEWTEAM);
185 newteam->EnableWindow(whichPlayer>0);
195 CDialog::OnInitDialog();
203 pList->InsertColumn(0,
"Team Name", LVCFMT_LEFT, 150, 0);
204 pList->InsertColumn(1,
"Origin", LVCFMT_LEFT, 150, 1);
205 pList->InsertColumn(2,
"Priority", LVCFMT_LEFT, 50, 2);
206 pList->InsertColumn(3,
"Script", LVCFMT_LEFT, 150, 3);
207 pList->InsertColumn(4,
"Trigger", LVCFMT_LEFT, 150, 4);
211 players->ResetContent();
212 for (
int i = 0; i <
m_sides.getNumSides(); i++)
214 players->AddString(playerNameForUI(
m_sides, i).str());
227 DEBUG_ASSERTLOG(!modified,(
"had to clean up sides in CTeamsDialog::OnOK"));
250 tname.
format(
"team%04d",num++);
252 while (
m_sides.findTeamInfo(tname));
259 d.
setBool(TheKey_teamIsSingleton,
false);
263 if (
m_sides.findTeamInfo(tname, &i)) {
288 if (::AfxMessageBox(
msg, MB_YESNO) == IDNO)
298 CPropertySheet editDialog;
299 editDialog.Construct(
"Edit Team Template.");
313 editDialog.AddPage(&identity);
314 editDialog.AddPage(&reinforcements);
315 editDialog.AddPage(&behavior);
316 editDialog.AddPage(&generic);
317 editDialog.AddPage(&
object);
319 if (IDOK == editDialog.DoModal()) {
324void CTeamsDialog::UpdateTeamsList()
327 pList->DeleteAllItems();
330 Int which = players->GetCurSel();
335 Bool selected =
false;
337 for (
Int i=0, inserted = 0; i<numTeams; i++)
347 pri.Format(TEXT(
"%d"), ti->
getDict()->
getInt(TheKey_teamProductionPriority, &exists));
350 pList->InsertItem(LVIF_TEXT, inserted, teamName.
str(), 0, 0, 0, 0);
351 pList->SetItemText(inserted, 1, waypoint.
str());
352 pList->SetItemText(inserted, 2, pri);
353 pList->SetItemText(inserted, 3, script.
str());
354 pList->SetItemText(inserted, 4, trigger.
str());
356 pList->SetItemData(inserted, i);
359 pList->SetItemState(inserted, LVIS_SELECTED, LVIS_SELECTED);
360 pList->EnsureVisible(inserted,
false);
369 pList->SetItemState(0, LVIS_SELECTED, LVIS_SELECTED);
370 pList->EnsureVisible(0,
false);
384 int nItem = pList->GetNextItem(-1, LVNI_SELECTED);
388 pList->SetItemState(nItem, LVIS_SELECTED, LVIS_SELECTED);
399 int nItem = pList->GetNextItem(-1, LVNI_SELECTED);
420 tname.
format(
"%s.%2d",origName.
str(), num++);
422 while (
m_sides.findTeamInfo(tname));
440 if (teamName==objectsTeam) {
457 ::AfxMessageBox(info, MB_OK);
469 int totalTeams =
m_sides.getNumTeams();
472 for (
int i=
m_curTeam-1; i<totalTeams; i++)
478 temp = *
m_sides.getTeamInfo(i)->getDict();
487 current = *
m_sides.getTeamInfo(startRemove)->getDict();
488 m_sides.removeTeam(startRemove);
496 current = *
m_sides.getTeamInfo(startRemove)->getDict();
497 m_sides.removeTeam(startRemove);
528 int totalTeams =
m_sides.getNumTeams();
537 temp = *
m_sides.getTeamInfo(i)->getDict();
546 current = *
m_sides.getTeamInfo(startRemove)->getDict();
547 m_sides.removeTeam(startRemove);
555 current = *
m_sides.getTeamInfo(startRemove)->getDict();
556 m_sides.removeTeam(startRemove);
580 for (
Int i = 0; i < numTeams; ++i) {
603 for (
Int i = 0; i < numOwners; ++i) {
616 if (ownerName == sideOwnerName) {
621 sideOwnerName = NEUTRAL_NAME_STR;
624 if (ownerName == sideOwnerName) {
635 if (fix.DoModal() == IDOK) {
#define DEBUG_ASSERTLOG(c, m)
SidesList * TheSidesList
singleton instance of SidesList
static AsciiString TheEmptyString
void format(AsciiString format,...)
AsciiString getSelectedOwner()
CTeamsDialog(CWnd *pParent=NULL)
Bool isValidTeamOwner(AsciiString ownerName)
afx_msg void OnCopyteam()
void doCorrectTeamOwnerDialog(TeamsInfo *ti)
afx_msg void OnClickTeamsList(NMHDR *pNMHDR, LRESULT *pResult)
afx_msg void OnDblclkTeamsList(NMHDR *pNMHDR, LRESULT *pResult)
virtual void DoDataExchange(CDataExchange *pDX)
afx_msg void OnDeleteteam()
virtual BOOL OnInitDialog()
afx_msg void OnEditTemplate()
void updateUI(Int whatToRebuild)
afx_msg void OnSelectTeamMembers()
void validateTeamOwners(void)
afx_msg void OnMoveDownTeam()
This function moves a team down the list in the teams list dialog.
afx_msg void OnSelchangePlayerList()
afx_msg void OnMoveUpTeam()
static CWorldBuilderDoc * GetActiveDoc()
void AddAndDoUndoable(Undoable *pUndo)
static WbView3d * GetActive3DView()
Int getInt(NameKeyType key, Bool *exists=NULL) const
void setAsciiString(NameKeyType key, const AsciiString &value)
void setBool(NameKeyType key, Bool value)
AsciiString getAsciiString(NameKeyType key, Bool *exists=NULL) const
const Coord3D * getLocation(void) const
Get the center point.
void setSelected(Bool sel)
Dict * getProperties()
return the object's property sheet.
static MapObject * getFirstMapObject(void)
MapObject * getNext(void) const
Next map object in the list. Not a copy, don't delete it.
static Int countMapObjectsWithOwner(const AsciiString &n)
Bool isPlayerDefaultTeam(TeamsInfo *t)
SidesInfo * getSideInfo(Int side)
TeamsInfo * getTeamInfo(Int team)
void setTeamDict(Dict *pDict)
void setTeamDict(Dict *dict)
void setSidesList(SidesList *pSides)
void setTeamDict(Dict *pDict)
void setTeamDict(Dict *pDict)
virtual void setCenterInView(Real x, Real y)
Set the center for display.
#define REF_PTR_RELEASE(x)