SpecialFlags.cpp 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  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. // SpecialFlags.cpp: Implementierungsdatei
  17. //
  18. #include "stdafx.h"
  19. #include "FinalSun.h"
  20. #include "SpecialFlags.h"
  21. #include "mapdata.h"
  22. #include "variables.h"
  23. #include "functions.h"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // Dialogfeld CSpecialFlags
  31. CSpecialFlags::CSpecialFlags(CWnd* pParent /*=NULL*/)
  32. : CDialog(CSpecialFlags::IDD, 0)
  33. {
  34. //{{AFX_DATA_INIT(CSpecialFlags)
  35. // HINWEIS: Der Klassen-Assistent fügt hier Elementinitialisierung ein
  36. //}}AFX_DATA_INIT
  37. }
  38. void CSpecialFlags::DoDataExchange(CDataExchange* pDX)
  39. {
  40. CDialog::DoDataExchange(pDX);
  41. //{{AFX_DATA_MAP(CSpecialFlags)
  42. DDX_Control(pDX, IDC_VISCEROIDS, m_Visceroids);
  43. DDX_Control(pDX, IDC_TIBERIUMSPREADS, m_TiberiumSpreads);
  44. DDX_Control(pDX, IDC_TIBERIUMGROWS, m_TiberiumGrows);
  45. DDX_Control(pDX, IDC_TIBERIUMEXPLOSIVE, m_TiberiumExplosive);
  46. DDX_Control(pDX, IDC_METEORITES, m_Meteorites);
  47. DDX_Control(pDX, IDC_MCVDEPLOY, m_MCVDeploy);
  48. DDX_Control(pDX, IDC_IONSTORMS, m_IonStorms);
  49. DDX_Control(pDX, IDC_INITIALVETERAN, m_InitialVeteran);
  50. DDX_Control(pDX, IDC_INERT, m_Inert);
  51. DDX_Control(pDX, IDC_HARVESTERIMMUNE, m_HarvesterImmune);
  52. DDX_Control(pDX, IDC_FOGOFWAR, m_FogOfWar);
  53. DDX_Control(pDX, IDC_FIXEDALLIANCE, m_FixedAlliance);
  54. DDX_Control(pDX, IDC_DESTROYABLEBRIDGES, m_DestroyableBridges);
  55. //}}AFX_DATA_MAP
  56. }
  57. BEGIN_MESSAGE_MAP(CSpecialFlags, CDialog)
  58. //{{AFX_MSG_MAP(CSpecialFlags)
  59. ON_CBN_EDITCHANGE(IDC_TIBERIUMGROWS, OnEditchangeTiberiumgrows)
  60. ON_CBN_EDITCHANGE(IDC_TIBERIUMSPREADS, OnEditchangeTiberiumspreads)
  61. ON_CBN_EDITCHANGE(IDC_TIBERIUMEXPLOSIVE, OnEditchangeTiberiumexplosive)
  62. ON_CBN_EDITCHANGE(IDC_DESTROYABLEBRIDGES, OnEditchangeDestroyablebridges)
  63. ON_CBN_EDITCHANGE(IDC_MCVDEPLOY, OnEditchangeMcvdeploy)
  64. ON_CBN_EDITCHANGE(IDC_INITIALVETERAN, OnEditchangeInitialveteran)
  65. ON_CBN_EDITCHANGE(IDC_FIXEDALLIANCE, OnEditchangeFixedalliance)
  66. ON_CBN_EDITCHANGE(IDC_HARVESTERIMMUNE, OnEditchangeHarvesterimmune)
  67. ON_CBN_EDITCHANGE(IDC_FOGOFWAR, OnEditchangeFogofwar)
  68. ON_CBN_EDITCHANGE(IDC_INERT, OnEditchangeInert)
  69. ON_CBN_EDITCHANGE(IDC_IONSTORMS, OnEditchangeIonstorms)
  70. ON_CBN_EDITCHANGE(IDC_METEORITES, OnEditchangeMeteorites)
  71. ON_CBN_EDITCHANGE(IDC_VISCEROIDS, OnEditchangeVisceroids)
  72. ON_CBN_SELCHANGE(IDC_TIBERIUMGROWS, OnEditchangeTiberiumgrows)
  73. ON_CBN_SELCHANGE(IDC_TIBERIUMSPREADS, OnEditchangeTiberiumspreads)
  74. ON_CBN_SELCHANGE(IDC_TIBERIUMEXPLOSIVE, OnEditchangeTiberiumexplosive)
  75. ON_CBN_SELCHANGE(IDC_DESTROYABLEBRIDGES, OnEditchangeDestroyablebridges)
  76. ON_CBN_SELCHANGE(IDC_MCVDEPLOY, OnEditchangeMcvdeploy)
  77. ON_CBN_SELCHANGE(IDC_INITIALVETERAN, OnEditchangeInitialveteran)
  78. ON_CBN_SELCHANGE(IDC_FIXEDALLIANCE, OnEditchangeFixedalliance)
  79. ON_CBN_SELCHANGE(IDC_HARVESTERIMMUNE, OnEditchangeHarvesterimmune)
  80. ON_CBN_SELCHANGE(IDC_FOGOFWAR, OnEditchangeFogofwar)
  81. ON_CBN_SELCHANGE(IDC_INERT, OnEditchangeInert)
  82. ON_CBN_SELCHANGE(IDC_IONSTORMS, OnEditchangeIonstorms)
  83. ON_CBN_SELCHANGE(IDC_METEORITES, OnEditchangeMeteorites)
  84. ON_CBN_SELCHANGE(IDC_VISCEROIDS, OnEditchangeVisceroids)
  85. //}}AFX_MSG_MAP
  86. END_MESSAGE_MAP()
  87. void CSpecialFlags::UpdateDialog()
  88. {
  89. CIniFile& ini=Map->GetIniFile();
  90. CIniFileSection *sec;
  91. sec=&ini.sections["SpecialFlags"];
  92. m_DestroyableBridges.SetWindowText(sec->values["DestroyableBridges"]);
  93. m_FixedAlliance.SetWindowText(sec->values["FixedAlliance"]);
  94. m_FogOfWar.SetWindowText(sec->values["FogOfWar"]);
  95. m_HarvesterImmune.SetWindowText(sec->values["HarvesterImmune"]);
  96. m_Inert.SetWindowText(sec->values["Inert"]);
  97. m_InitialVeteran.SetWindowText(sec->values["InitialVeteran"]);
  98. m_IonStorms.SetWindowText(sec->values["IonStorms"]);
  99. m_MCVDeploy.SetWindowText(sec->values["MCVDeploy"]);
  100. m_Meteorites.SetWindowText(sec->values["Meteorites"]);
  101. m_TiberiumExplosive.SetWindowText(sec->values["TiberiumExplosive"]);
  102. m_TiberiumGrows.SetWindowText(sec->values["TiberiumGrows"]);
  103. m_TiberiumSpreads.SetWindowText(sec->values["TiberiumSpreads"]);
  104. m_Visceroids.SetWindowText(sec->values["Visceroids"]);
  105. #ifdef RA2_MODE
  106. SetDlgItemText(IDC_LTIBERIUMGROWS,"Ore grows:");
  107. SetDlgItemText(IDC_LTIBERIUMSPREADS,"Ore spreads:");
  108. GetDlgItem(IDC_LTIBERIUMEXPLOSIVE)->ShowWindow(SW_HIDE);
  109. GetDlgItem(IDC_TIBERIUMEXPLOSIVE)->ShowWindow(SW_HIDE);
  110. GetDlgItem(IDC_HARVESTERIMMUNE)->ShowWindow(SW_HIDE);
  111. GetDlgItem(IDC_LHARVESTERIMMUNE)->ShowWindow(SW_HIDE);
  112. GetDlgItem(IDC_METEORITES)->ShowWindow(SW_HIDE);
  113. GetDlgItem(IDC_LMETEORITES)->ShowWindow(SW_HIDE);
  114. GetDlgItem(IDC_VISCEROIDS)->ShowWindow(SW_HIDE);
  115. GetDlgItem(IDC_LVISCEROIDS)->ShowWindow(SW_HIDE);
  116. SetDlgItemText(IDC_LFOGOFWAR, "Shroud:");
  117. SetDlgItemText(IDC_LIONSTORMS, "Weather Storms:");
  118. #endif
  119. };
  120. /////////////////////////////////////////////////////////////////////////////
  121. // Behandlungsroutinen für Nachrichten CSpecialFlags
  122. void CSpecialFlags::OnEditchangeTiberiumgrows()
  123. {
  124. CIniFile& ini=Map->GetIniFile();
  125. CIniFileSection *sec;
  126. sec=&ini.sections["SpecialFlags"];
  127. CString str;
  128. str=GetText(&m_TiberiumGrows);
  129. sec->values["TiberiumGrows"]=(LPCTSTR)str;
  130. }
  131. void CSpecialFlags::OnEditchangeTiberiumspreads()
  132. {
  133. CIniFile& ini=Map->GetIniFile();
  134. CIniFileSection *sec;
  135. sec=&ini.sections["SpecialFlags"];
  136. CString str;
  137. str=GetText(&m_TiberiumSpreads);
  138. sec->values["TiberiumSpreads"]=(LPCTSTR)str;
  139. }
  140. void CSpecialFlags::OnEditchangeTiberiumexplosive()
  141. {
  142. CIniFile& ini=Map->GetIniFile();
  143. CIniFileSection *sec;
  144. sec=&ini.sections["SpecialFlags"];
  145. CString str;
  146. str=GetText(&m_TiberiumExplosive);
  147. sec->values["TiberiumExplosive"]=(LPCTSTR)str;
  148. }
  149. void CSpecialFlags::OnEditchangeDestroyablebridges()
  150. {
  151. CIniFile& ini=Map->GetIniFile();
  152. CIniFileSection *sec;
  153. sec=&ini.sections["SpecialFlags"];
  154. CString str;
  155. str=GetText(&m_DestroyableBridges);
  156. sec->values["DestroyableBridges"]=(LPCTSTR)str;
  157. }
  158. void CSpecialFlags::OnEditchangeMcvdeploy()
  159. {
  160. CIniFile& ini=Map->GetIniFile();
  161. CIniFileSection *sec;
  162. sec=&ini.sections["SpecialFlags"];
  163. CString str;
  164. str=GetText(&m_MCVDeploy);
  165. sec->values["MCVDeploy"]=(LPCTSTR)str;
  166. }
  167. void CSpecialFlags::OnEditchangeInitialveteran()
  168. {
  169. CIniFile& ini=Map->GetIniFile();
  170. CIniFileSection *sec;
  171. sec=&ini.sections["SpecialFlags"];
  172. CString str;
  173. str=GetText(&m_InitialVeteran);
  174. sec->values["InitialVeteran"]=(LPCTSTR)str;
  175. }
  176. void CSpecialFlags::OnEditchangeFixedalliance()
  177. {
  178. CIniFile& ini=Map->GetIniFile();
  179. CIniFileSection *sec;
  180. sec=&ini.sections["SpecialFlags"];
  181. CString str;
  182. str=GetText(&m_FixedAlliance);
  183. sec->values["FixedAlliance"]=(LPCTSTR)str;
  184. }
  185. void CSpecialFlags::OnEditchangeHarvesterimmune()
  186. {
  187. CIniFile& ini=Map->GetIniFile();
  188. CIniFileSection *sec;
  189. sec=&ini.sections["SpecialFlags"];
  190. CString str;
  191. str=GetText(&m_HarvesterImmune);
  192. sec->values["HarvesterImmune"]=(LPCTSTR)str;
  193. }
  194. void CSpecialFlags::OnEditchangeFogofwar()
  195. {
  196. CIniFile& ini=Map->GetIniFile();
  197. CIniFileSection *sec;
  198. sec=&ini.sections["SpecialFlags"];
  199. CString str;
  200. str=GetText(&m_FogOfWar);
  201. sec->values["FogOfWar"]=(LPCTSTR)str;
  202. }
  203. void CSpecialFlags::OnEditchangeInert()
  204. {
  205. CIniFile& ini=Map->GetIniFile();
  206. CIniFileSection *sec;
  207. sec=&ini.sections["SpecialFlags"];
  208. CString str;
  209. str=GetText(&m_Inert);
  210. sec->values["Inert"]=(LPCTSTR)str;
  211. }
  212. void CSpecialFlags::OnEditchangeIonstorms()
  213. {
  214. CIniFile& ini=Map->GetIniFile();
  215. CIniFileSection *sec;
  216. sec=&ini.sections["SpecialFlags"];
  217. CString str;
  218. str=GetText(&m_IonStorms);
  219. sec->values["IonStorms"]=(LPCTSTR)str;
  220. }
  221. void CSpecialFlags::OnEditchangeMeteorites()
  222. {
  223. CIniFile& ini=Map->GetIniFile();
  224. CIniFileSection *sec;
  225. sec=&ini.sections["SpecialFlags"];
  226. CString str;
  227. str=GetText(&m_Meteorites);
  228. sec->values["Meteorites"]=(LPCTSTR)str;
  229. }
  230. void CSpecialFlags::OnEditchangeVisceroids()
  231. {
  232. CIniFile& ini=Map->GetIniFile();
  233. CIniFileSection *sec;
  234. sec=&ini.sections["SpecialFlags"];
  235. CString str;
  236. str=GetText(&m_Visceroids);
  237. sec->values["Visceroids"]=(LPCTSTR)str;
  238. }