Diff of /GameGeneral.cpp [e757e7] .. [be9162] Maximize Restore

  Switch to side-by-side view

--- a/GameGeneral.cpp
+++ b/GameGeneral.cpp
@@ -27,32 +27,66 @@
 void CGameGeneral::DoDataExchange(CDataExchange* pDX)
 {
   CButton *cb;
+	CWnd *cw;
   CString tmpstr;
   int tmp;
   int i,j;
 
 	CDialog::DoDataExchange(pDX);
+	//{{AFX_DATA_MAP(CGameGeneral)
+	DDX_Control(pDX, IDC_SLIDER, m_slider_control);
+	//}}AFX_DATA_MAP
 
   DDX_Text(pDX, IDC_GAMETIME, the_game.header.gametime);
   DDX_Text(pDX, IDC_GOLD, the_game.header.gold);
-
-  RetrieveResref(tmpstr,the_game.header.mainarea);
-  DDX_Text(pDX, IDC_STARTAREA, tmpstr);
-  StoreResref(tmpstr,the_game.header.mainarea);
+	if (the_game.revision==12)
+	{
+		DDX_Text(pDX, IDC_REPUTATION, the_game.pstheader.reputation);
+		RetrieveResref(tmpstr,the_game.pstheader.mainarea);
+		DDX_Text(pDX, IDC_STARTAREA, tmpstr);
+		StoreResref(tmpstr,the_game.pstheader.mainarea);
+		cw = GetDlgItem(IDC_SCREEN);
+		cw->EnableWindow(false);
+		DDX_Text(pDX, IDC_UNKNOWN48, the_game.pstheader.unknown48);
+		cw = GetDlgItem(IDC_SLIDER);
+		cw->ShowWindow(false);
+		DDX_Text(pDX, IDC_U1, the_game.header.formation);
+		DDV_MinMaxShort(pDX, the_game.header.formation, 0, 11);
+		for(i=1;i<5;i++)
+		{
+			cw = GetDlgItem(IDC_U1+i);
+			cw->ShowWindow(false);
+		}
+	}
+	else
+	{
+		DDX_Text(pDX, IDC_REPUTATION, the_game.header.reputation);
+		RetrieveResref(tmpstr,the_game.header.mainarea);
+		DDX_Text(pDX, IDC_STARTAREA, tmpstr);
+		StoreResref(tmpstr,the_game.header.mainarea);
+		DDX_Text(pDX, IDC_SCREEN, the_game.header.controls);
+    DDX_Text(pDX, IDC_UNKNOWN48, the_game.header.unknown48);
+		i = the_game.header.formation;
+		DDX_Slider(pDX, IDC_SLIDER,i);
+		the_game.header.formation = (short) i;
+		for(i=0;i<5;i++)
+		{
+			DDX_Text(pDX, IDC_U1+i, the_game.header.formations[i]);
+			DDV_MinMaxShort(pDX, the_game.header.formations[i], 0, 11);
+		}
+	}
 
   DDX_Text(pDX, IDC_UNKNOWN1C, the_game.header.weather1);
-
   DDX_Text(pDX, IDC_WEATHER, the_game.header.weather2);
-
-  DDX_Text(pDX, IDC_UNKNOWN48, the_game.header.unknown48);
 
   tmp=the_game.header.weather2;
   j=1;
-  for(i=0;i<8;i++) {
-      cb=(CButton *) GetDlgItem(IDC_FLAG1+i);
-      if(cb) cb->SetCheck(!!(tmp&j) );
-      j<<=1;
-  }
+  for(i=0;i<8;i++)
+	{
+		cb=(CButton *) GetDlgItem(IDC_FLAG1+i);
+		if(cb) cb->SetCheck(!!(tmp&j) );
+		j<<=1;
+  }	
 }
 
 
@@ -67,23 +101,55 @@
 	ON_BN_CLICKED(IDC_FLAG6, OnFlag6)
 	ON_BN_CLICKED(IDC_FLAG7, OnFlag7)
 	ON_BN_CLICKED(IDC_FLAG8, OnFlag8)
+	ON_BN_CLICKED(IDC_BROWSE, OnBrowse)
 	ON_EN_KILLFOCUS(IDC_GAMETIME, OnDefaultKillfocus)
 	ON_EN_KILLFOCUS(IDC_GOLD, OnDefaultKillfocus)
 	ON_EN_KILLFOCUS(IDC_WEATHER, OnDefaultKillfocus)
 	ON_EN_KILLFOCUS(IDC_UNKNOWN1C, OnDefaultKillfocus)
 	ON_EN_KILLFOCUS(IDC_UNKNOWN48, OnDefaultKillfocus)
+	ON_EN_KILLFOCUS(IDC_SCREEN, OnDefaultKillfocus)
+	ON_EN_KILLFOCUS(IDC_REPUTATION, OnDefaultKillfocus)
+	ON_EN_KILLFOCUS(IDC_U1, OnDefaultKillfocus)
+	ON_EN_KILLFOCUS(IDC_U2, OnDefaultKillfocus)
+	ON_EN_KILLFOCUS(IDC_U3, OnDefaultKillfocus)
+	ON_EN_KILLFOCUS(IDC_U4, OnDefaultKillfocus)
+	ON_EN_KILLFOCUS(IDC_U5, OnDefaultKillfocus)
 	//}}AFX_MSG_MAP
+	ON_NOTIFY(NM_RELEASEDCAPTURE, IDC_SLIDER, OnDefaultKillfocusX)
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
 // CGameGeneral message handlers
 
+BOOL CGameGeneral::OnInitDialog() 
+{
+	CDialog::OnInitDialog();
+
+	m_slider_control.SetRange(0, 4, TRUE);
+  //tooltips
+  {
+    m_tooltip.Create(this,TTS_NOPREFIX);
+    m_tooltip.SetMaxTipWidth(200);
+    m_tooltip.SetTipBkColor(RGB(240,224,160));
+    
+    m_tooltip.AddTool(GetDlgItem(IDCANCEL), IDS_CANCEL);
+	}
+	
+	return TRUE;
+}
+
 void CGameGeneral::OnDefaultKillfocus() 
 {
 	UpdateData(UD_RETRIEVE);
 	UpdateData(UD_DISPLAY);
 }
 
+void CGameGeneral::OnDefaultKillfocusX(NMHDR * /*header*/, LRESULT * /*result*/) 
+{
+	UpdateData(UD_RETRIEVE);
+	UpdateData(UD_DISPLAY);
+}
+
 void CGameGeneral::OnFlag1() 
 {
 	the_game.header.weather2^=1;
@@ -131,3 +197,17 @@
 	the_game.header.weather2^=0x80;	
 	UpdateData(UD_DISPLAY);
 }
+
+void CGameGeneral::OnBrowse() 
+{
+  CString tmpstr;
+  
+  pickerdlg.m_restype=REF_ARE;
+  RetrieveResref(pickerdlg.m_picked,the_game.header.mainarea);
+  if(pickerdlg.DoModal()==IDOK)
+  {
+    StoreResref(pickerdlg.m_picked,the_game.header.mainarea);
+  }
+	UpdateData(UD_DISPLAY);
+}
+