[83272e]: GameGeneral.cpp Maximize Restore History

Download this file

GameGeneral.cpp    128 lines (103 with data), 2.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
// GameGeneral.cpp : implementation file
//
#include "stdafx.h"
#include "chitem.h"
#include "GameGeneral.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CGameGeneral dialog
CGameGeneral::CGameGeneral(CWnd* pParent /*=NULL*/)
: CDialog(CGameGeneral::IDD, pParent)
{
//{{AFX_DATA_INIT(CGameGeneral)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
void CGameGeneral::DoDataExchange(CDataExchange* pDX)
{
CButton *cb;
CString tmpstr;
int tmp;
int i,j;
CDialog::DoDataExchange(pDX);
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);
DDX_Text(pDX, IDC_WEATHER, the_game.header.weather2);
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;
}
}
BEGIN_MESSAGE_MAP(CGameGeneral, CDialog)
//{{AFX_MSG_MAP(CGameGeneral)
ON_EN_KILLFOCUS(IDC_STARTAREA, OnDefaultKillfocus)
ON_BN_CLICKED(IDC_FLAG1, OnFlag1)
ON_BN_CLICKED(IDC_FLAG2, OnFlag2)
ON_BN_CLICKED(IDC_FLAG3, OnFlag3)
ON_BN_CLICKED(IDC_FLAG4, OnFlag4)
ON_BN_CLICKED(IDC_FLAG5, OnFlag5)
ON_BN_CLICKED(IDC_FLAG6, OnFlag6)
ON_BN_CLICKED(IDC_FLAG7, OnFlag7)
ON_BN_CLICKED(IDC_FLAG8, OnFlag8)
ON_EN_KILLFOCUS(IDC_GAMETIME, OnDefaultKillfocus)
ON_EN_KILLFOCUS(IDC_GOLD, OnDefaultKillfocus)
ON_EN_KILLFOCUS(IDC_WEATHER, OnDefaultKillfocus)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CGameGeneral message handlers
void CGameGeneral::OnDefaultKillfocus()
{
UpdateData(UD_RETRIEVE);
UpdateData(UD_DISPLAY);
}
void CGameGeneral::OnFlag1()
{
the_game.header.weather2^=1;
UpdateData(UD_DISPLAY);
}
void CGameGeneral::OnFlag2()
{
the_game.header.weather2^=2;
UpdateData(UD_DISPLAY);
}
void CGameGeneral::OnFlag3()
{
the_game.header.weather2^=4;
UpdateData(UD_DISPLAY);
}
void CGameGeneral::OnFlag4()
{
the_game.header.weather2^=8;
UpdateData(UD_DISPLAY);
}
void CGameGeneral::OnFlag5()
{
the_game.header.weather2^=0x10;
UpdateData(UD_DISPLAY);
}
void CGameGeneral::OnFlag6()
{
the_game.header.weather2^=0x20;
UpdateData(UD_DISPLAY);
}
void CGameGeneral::OnFlag7()
{
the_game.header.weather2^=0x40;
UpdateData(UD_DISPLAY);
}
void CGameGeneral::OnFlag8()
{
the_game.header.weather2^=0x80;
UpdateData(UD_DISPLAY);
}