Infantry.cpp 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. /*
  2. FinalSun/FinalAlert 2 Mission Editor
  3. Copyright (C) 1999-2024 Electronic Arts, Inc.
  4. Authored by Matthias Wagner
  5. This program is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. */
  16. // Infantrie.cpp: Implementierungsdatei
  17. //
  18. #include "stdafx.h"
  19. #include "FinalSun.h"
  20. #include "Infantry.h"
  21. #include "functions.h"
  22. #include "mapdata.h"
  23. #include "variables.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // Dialogfeld CInfantrie
  31. CInfantrie::CInfantrie(CWnd* pParent /*=NULL*/)
  32. : CDialog(CInfantrie::IDD, pParent)
  33. {
  34. //{{AFX_DATA_INIT(CInfantrie)
  35. m_direction = _T("");
  36. m_house = _T("");
  37. m_flag1 = _T("");
  38. m_flag2 = _T("");
  39. m_flag3 = _T("");
  40. m_flag4 = _T("");
  41. m_action = _T("");
  42. m_tag = _T("");
  43. m_flag5 = _T("");
  44. //}}AFX_DATA_INIT
  45. Init();
  46. }
  47. void CInfantrie::DoDataExchange(CDataExchange* pDX)
  48. {
  49. CDialog::DoDataExchange(pDX);
  50. //{{AFX_DATA_MAP(CInfantrie)
  51. DDX_Control(pDX, IDC_STRENGTH, m_strength_ctrl);
  52. DDX_CBString(pDX, IDC_DIRECTION, m_direction);
  53. DDX_CBString(pDX, IDC_HOUSE, m_house);
  54. DDX_Text(pDX, IDC_P1, m_flag1);
  55. DDX_Text(pDX, IDC_P2, m_flag2);
  56. DDX_Text(pDX, IDC_P3, m_flag3);
  57. DDX_Text(pDX, IDC_P4, m_flag4);
  58. DDX_CBString(pDX, IDC_STATE, m_action);
  59. DDX_CBString(pDX, IDC_TAG, m_tag);
  60. DDX_Text(pDX, IDC_P5, m_flag5);
  61. //}}AFX_DATA_MAP
  62. }
  63. BEGIN_MESSAGE_MAP(CInfantrie, CDialog)
  64. //{{AFX_MSG_MAP(CInfantrie)
  65. //}}AFX_MSG_MAP
  66. END_MESSAGE_MAP()
  67. /////////////////////////////////////////////////////////////////////////////
  68. // Behandlungsroutinen für Nachrichten CInfantrie
  69. BOOL CInfantrie::OnInitDialog()
  70. {
  71. CDialog::OnInitDialog();
  72. // init the common (!) dialog things
  73. int i;
  74. CComboBox* house, *tag;
  75. house=(CComboBox*)GetDlgItem(IDC_HOUSE);
  76. tag=(CComboBox*)GetDlgItem(IDC_TAG);
  77. ListHouses(*house, FALSE);
  78. ListTags(*tag, TRUE);
  79. UpdateData(FALSE);
  80. m_strength_ctrl.SetRange(0,256);
  81. m_strength_ctrl.SetPos(atoi(m_strength));
  82. UpdateStrings();
  83. return TRUE;
  84. }
  85. void CInfantrie::OnOK()
  86. {
  87. CDialog::OnOK();
  88. m_strength=GetText(&m_strength_ctrl);
  89. UpdateData();
  90. TruncSpace(m_tag);
  91. m_house=TranslateHouse(m_house);
  92. }
  93. void CInfantrie::Init(CString house, CString strength, CString action, CString direction, CString tag, CString flag1, CString flag2, CString flag3, CString flag4, CString flag5)
  94. {
  95. CIniFile& ini=Map->GetIniFile();
  96. if(house=="")
  97. {
  98. /*m_house=*rules.sections[HOUSES].GetValue(0);
  99. if(ini.sections.find(HOUSES)!=ini.sections.end())
  100. if(ini.sections[HOUSES].values.size()>0)
  101. m_house=*ini.sections[HOUSES].GetValue(0);*/
  102. m_house=TranslateHouse(Map->GetHouseID(0), TRUE);
  103. }
  104. else
  105. m_house=TranslateHouse(house, TRUE);
  106. m_flag1=flag1;
  107. m_flag2=flag2;
  108. m_flag3=flag3;
  109. m_flag4=flag4;
  110. m_flag5=flag5;
  111. // m_pos=pos;
  112. m_action=action;
  113. m_strength=strength;
  114. m_tag=tag;
  115. m_direction=direction;
  116. }
  117. void CInfantrie::UpdateStrings()
  118. {
  119. SetWindowText(GetLanguageStringACP("InfCap"));
  120. GetDlgItem(IDC_LHOUSE)->SetWindowText(GetLanguageStringACP("InfHouse"));
  121. GetDlgItem(IDC_LDESC)->SetWindowText(GetLanguageStringACP("InfDesc"));
  122. GetDlgItem(IDC_LSTRENGTH)->SetWindowText(GetLanguageStringACP("InfStrength"));
  123. // GetDlgItem(IDC_LPOS)->SetWindowText(GetLanguageStringACP("InfPos"));
  124. GetDlgItem(IDC_LSTATE)->SetWindowText(GetLanguageStringACP("InfState"));
  125. GetDlgItem(IDC_LDIRECTION)->SetWindowText(GetLanguageStringACP("InfDirection"));
  126. GetDlgItem(IDC_LTAG)->SetWindowText(GetLanguageStringACP("InfTag"));
  127. GetDlgItem(IDC_LP1)->SetWindowText(GetLanguageStringACP("InfP1"));
  128. GetDlgItem(IDC_LP2)->SetWindowText(GetLanguageStringACP("InfP2"));
  129. GetDlgItem(IDC_LP3)->SetWindowText(GetLanguageStringACP("InfP3"));
  130. GetDlgItem(IDC_LP4)->SetWindowText(GetLanguageStringACP("InfP4"));
  131. GetDlgItem(IDC_LP5)->SetWindowText(GetLanguageStringACP("InfP5"));
  132. SetDlgItemText(IDOK, GetLanguageStringACP("OK"));
  133. SetDlgItemText(IDCANCEL, GetLanguageStringACP("Cancel"));
  134. }