Express Hilfe benötigt

Diese Seite verwendet Cookies. Durch die Nutzung unserer Seite erklären Sie sich damit einverstanden, dass wir Cookies setzen. Weitere Informationen

  • Express Hilfe benötigt

    Moinmoin

    Da ich jetzt auch noch von meinem Betreuer gezwungen wurde für meine Maturarbeit so schnell mal ein bisschen C++ zu schreiben, was ich absolut nicht kann bitte ich euch um Hilfe.

    Wer könnte mir diesen Code:

    Quellcode

    1. #include "stdafx.h"
    2. #include "resource.h"
    3. #define MAX_LOADSTRING 100
    4. #define ROWS 50
    5. #define COLS 50
    6. #define ROW_SIZE 10
    7. #define COL_SIZE 10
    8. #define CLIP_SIZE 50
    9. #define OTHER_SIZE 150
    10. #define TABLE_WIDTH (ROWS*ROW_SIZE)
    11. #define TABLE_HEIGHT (COLS*COL_SIZE)
    12. #define TABLE_X (CLIP_SIZE)
    13. #define TABLE_Y (CLIP_SIZE)
    14. #define WINDOW_WIDTH (CLIP_SIZE + TABLE_WIDTH + OTHER_SIZE + CLIP_SIZE)
    15. #define WINDOW_HEIGHT (CLIP_SIZE + TABLE_HEIGHT + CLIP_SIZE)
    16. HANDLE hBitBuffer, hBitBack, hBitAlive, hBitDead;
    17. HANDLE hBitButClear, hBitButNext, hBitButStart[2], hBitButStop,
    18. hBitButSlow[2], hBitButNormal[2], hBitButFast[2],
    19. hBitButClose;
    20. HMENU menu;
    21. unsigned char table[ROWS][COLS], dtable[ROWS][COLS];
    22. #define CAP_MOVE 1
    23. #define CAP_TABLE 2
    24. int captured = 0, cap_button;
    25. POINT cap_point, table_point;
    26. #define TD_SLOW 1000
    27. #define TD_NORMAL 400
    28. #define TD_FAST 100
    29. unsigned int timer_delay = TD_NORMAL;
    30. bool timer_working = FALSE;
    31. HWND hWndButtonClear,
    32. hWndButtonNext,
    33. hWndButtonStart,
    34. hWndButtonStop,
    35. hWndButtonSlow,
    36. hWndButtonNormal,
    37. hWndButtonFast,
    38. hWndButtonClose;
    39. // Global Variables:
    40. HINSTANCE hInst; // current instance
    41. TCHAR szTitle[MAX_LOADSTRING]; // The title bar text
    42. TCHAR szWindowClass[MAX_LOADSTRING]; // The title bar text
    43. // Foward declarations of functions included in this code module:
    44. ATOM MyRegisterClass(HINSTANCE hInstance);
    45. BOOL InitInstance(HINSTANCE, int);
    46. LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
    47. LRESULT CALLBACK About(HWND, UINT, WPARAM, LPARAM);
    48. /*****************************************************************************/
    49. void table_clear(void)
    50. {
    51. int x, y;
    52. for(y=0; y<ROWS; y++)
    53. for(x=0; x<COLS; x++)
    54. table[y][x] = 0;
    55. }
    56. void table_set(int row, int col, unsigned char val)
    57. {
    58. table[row][col] = val;
    59. }
    60. int table_neighbors(int y, int x)
    61. {
    62. int n=0;
    63. if (table[y-1][x-1])
    64. n++;
    65. if (table[y-1][x])
    66. n++;
    67. if (table[y-1][x+1])
    68. n++;
    69. if (table[y][x-1])
    70. n++;
    71. if (table[y][x+1])
    72. n++;
    73. if (table[y+1][x-1])
    74. n++;
    75. if (table[y+1][x])
    76. n++;
    77. if (table[y+1][x+1])
    78. n++;
    79. return(n);
    80. }
    81. void table_next(void)
    82. {
    83. int x, y, n;
    84. for(y=1; y<ROWS-1; y++)
    85. {
    86. for(x=1; x<COLS-1; x++)
    87. {
    88. n = table_neighbors(y, x);
    89. if (table[y][x])
    90. {
    91. if (n == 2 || n == 3)
    92. dtable[y][x] = 0;
    93. else
    94. dtable[y][x] = 1;
    95. }
    96. else
    97. {
    98. if (n == 3)
    99. dtable[y][x] = 1;
    100. else
    101. dtable[y][x] = 0;
    102. }
    103. }
    104. }
    105. for(y=0; y<ROWS; y++)
    106. for(x=0; x<COLS; x++)
    107. table[y][x] = dtable[y][x];
    108. }
    109. /*****************************************************************************/
    110. int APIENTRY WinMain(HINSTANCE hInstance,
    111. HINSTANCE hPrevInstance,
    112. LPSTR lpCmdLine,
    113. int nCmdShow)
    114. {
    115. // TODO: Place code here.
    116. MSG msg;
    117. HACCEL hAccelTable;
    118. // Initialize global strings
    119. LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING);
    120. LoadString(hInstance, IDC_LIFE, szWindowClass, MAX_LOADSTRING);
    121. MyRegisterClass(hInstance);
    122. hBitAlive = LoadImage(hInstance, MAKEINTRESOURCE(IDB_ALIVE), IMAGE_BITMAP, 0, 0, 0);
    123. if (!hBitAlive)
    124. return FALSE;
    125. hBitDead = LoadImage(hInstance, MAKEINTRESOURCE(IDB_DEAD), IMAGE_BITMAP, 0, 0, 0);
    126. if (!hBitDead)
    127. return FALSE;
    128. hBitDead = LoadImage(hInstance, MAKEINTRESOURCE(IDB_SICK), IMAGE_BITMAP, 0, 0, 0);
    129. if (!hBitSick)
    130. return FALSE;
    131. hBitDead = LoadImage(hInstance, MAKEINTRESOURCE(IDB_INFECTED), IMAGE_BITMAP, 0, 0, 0);
    132. if (!hBitInfected)
    133. return FALSE;
    134. hBitDead = LoadImage(hInstance, MAKEINTRESOURCE(IDB_INFECTIOUS), IMAGE_BITMAP, 0, 0, 0);
    135. if (!hBitInfectious)
    136. return FALSE;
    137. hBitDead = LoadImage(hInstance, MAKEINTRESOURCE(IDB_IMMUNE), IMAGE_BITMAP, 0, 0, 0);
    138. if (!hBitImmune)
    139. return FALSE;
    140. // Perform application initialization:
    141. if (!InitInstance (hInstance, nCmdShow))
    142. return FALSE;
    143. table_clear();
    144. hAccelTable = LoadAccelerators(hInstance, (LPCTSTR)IDC_LIFE);
    145. // Main message loop:
    146. while (GetMessage(&msg, NULL, 0, 0))
    147. {
    148. if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg))
    149. {
    150. TranslateMessage(&msg);
    151. DispatchMessage(&msg);
    152. }
    153. }
    154. return msg.wParam;
    155. }
    156. //
    157. // FUNCTION: MyRegisterClass()
    158. //
    159. // PURPOSE: Registers the window class.
    160. //
    161. // COMMENTS:
    162. //
    163. // This function and its usage is only necessary if you want this code
    164. // to be compatible with Win32 systems prior to the 'RegisterClassEx'
    165. // function that was added to Windows 95. It is important to call this function
    166. // so that the application will get 'well formed' small icons associated
    167. // with it.
    168. //
    169. ATOM MyRegisterClass(HINSTANCE hInstance)
    170. {
    171. WNDCLASSEX wcex;
    172. wcex.cbSize = sizeof(WNDCLASSEX);
    173. wcex.style = CS_HREDRAW | CS_VREDRAW;
    174. wcex.lpfnWndProc = (WNDPROC)WndProc;
    175. wcex.cbClsExtra = 0;
    176. wcex.cbWndExtra = 0;
    177. wcex.hInstance = hInstance;
    178. wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_LIFE);
    179. wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
    180. wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
    181. wcex.lpszMenuName = NULL;//(LPCSTR)IDC_LIFE;
    182. wcex.lpszClassName = szWindowClass;
    183. wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_LIFE);
    184. return RegisterClassEx(&wcex);
    185. }
    186. //
    187. // FUNCTION: InitInstance(HANDLE, int)
    188. //
    189. // PURPOSE: Saves instance handle and creates main window
    190. //
    191. // COMMENTS:
    192. //
    193. // In this function, we save the instance handle in a global variable and
    194. // create and display the main program window.
    195. //
    196. BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
    197. {
    198. HWND hWnd;
    199. RECT rect;
    200. DWORD style;
    201. HRGN region;
    202. hInst = hInstance; // Store instance handle in our global variable
    203. rect.left = 100; //x
    204. rect.top = 100; //y
    205. rect.right = rect.left + WINDOW_WIDTH; //width
    206. rect.bottom = rect.top + WINDOW_HEIGHT; //height
    207. style = WS_CLIPSIBLINGS | WS_OVERLAPPED | WS_SYSMENU |
    208. WS_MINIMIZEBOX | WS_CLIPCHILDREN;
    209. if (!AdjustWindowRect(&rect, style, false))
    210. return FALSE;
    211. region = CreateRectRgn(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
    212. if (!region)
    213. return FALSE;
    214. hWnd = CreateWindow(szWindowClass, szTitle, style,
    215. rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top,
    216. NULL, NULL, hInstance, NULL);
    217. if (!hWnd)
    218. return FALSE;
    219. if (!SetWindowRgn(hWnd, region, FALSE))
    220. return FALSE;
    221. menu = LoadMenu(hInstance, MAKEINTRESOURCE(IDR_MENU_CLPOPUP));
    222. if (!menu)
    223. return FALSE;
    224. int x, y;
    225. x = TABLE_X + TABLE_WIDTH + 30;
    226. y = TABLE_Y;
    227. hWndButtonClear = CreateWindow("Button","Clear",
    228. WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON | BS_BITMAP,
    229. x, y, 120, 40, hWnd, NULL, hInstance, NULL);
    230. y+=40;
    231. hWndButtonNext = CreateWindow("Button", "Next",
    232. WS_VISIBLE | WS_CHILD | BS_BITMAP,
    233. x, y, 120, 40, hWnd, NULL, hInstance, NULL);
    234. y+=50;
    235. hWndButtonStart = CreateWindow("Button", "Start",
    236. WS_VISIBLE | WS_CHILD | BS_BITMAP,
    237. x, y, 120, 40, hWnd, NULL, hInstance, NULL);
    238. y+=40;
    239. hWndButtonStop = CreateWindow("Button", "Stop",
    240. WS_VISIBLE | WS_CHILD | BS_BITMAP,
    241. x, y, 120, 40, hWnd, NULL, hInstance, NULL);
    242. y+=50;
    243. hWndButtonSlow = CreateWindow("Button", "Slow",
    244. WS_VISIBLE | WS_CHILD | BS_BITMAP,
    245. x, y, 120, 40, hWnd, NULL, hInstance, NULL);
    246. y+=40;
    247. hWndButtonNormal = CreateWindow("Button", "Normal",
    248. WS_VISIBLE | WS_CHILD | BS_BITMAP,
    249. x, y, 120, 40, hWnd, NULL, hInstance, NULL);
    250. y+=40;
    251. hWndButtonFast = CreateWindow("Button", "Fast",
    252. WS_VISIBLE | WS_CHILD | BS_BITMAP,
    253. x, y, 120, 40, hWnd, NULL, hInstance, NULL);
    254. y+=40;
    255. hBitButClear = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTCLEAR));
    256. SendMessage(hWndButtonClear, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    257. (LPARAM)(HANDLE)hBitButClear);
    258. hBitButNext = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTNEXT));
    259. SendMessage(hWndButtonNext, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    260. (LPARAM)(HANDLE)hBitButNext);
    261. hBitButStart[0] = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTSTART));
    262. hBitButStart[1] = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTSTART_ON));
    263. SendMessage(hWndButtonStart, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    264. (LPARAM)(HANDLE)hBitButStart[0]);
    265. hBitButStop = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTSTOP));
    266. SendMessage(hWndButtonStop, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    267. (LPARAM)(HANDLE)hBitButStop);
    268. hBitButSlow[0] = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTSLOW));
    269. hBitButSlow[1] = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTSLOW_ON));
    270. SendMessage(hWndButtonSlow, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    271. (LPARAM)(HANDLE)hBitButSlow[0]);
    272. hBitButNormal[0] = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTNORMAL));
    273. hBitButNormal[1] = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTNORMAL_ON));
    274. SendMessage(hWndButtonNormal, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    275. (LPARAM)(HANDLE)hBitButNormal[1]);
    276. hBitButFast[0] = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTFAST));
    277. hBitButFast[1] = LoadBitmap(hInstance, MAKEINTRESOURCE(IDB_BUTFAST_ON));
    278. SendMessage(hWndButtonFast, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    279. (LPARAM)(HANDLE)hBitButFast[0]);
    280. ShowWindow(hWnd, nCmdShow);
    281. UpdateWindow(hWnd);
    282. return TRUE;
    283. }
    284. //
    285. // FUNCTION: WndProc(HWND, unsigned, WORD, LONG)
    286. //
    287. // PURPOSE: Processes messages for the main window.
    288. //
    289. // WM_COMMAND - process the application menu
    290. // WM_PAINT - Paint the main window
    291. // WM_DESTROY - post a quit message and return
    292. //
    293. //
    294. LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
    295. {
    296. //int wmId, wmEvent;
    297. int x, y;
    298. POINT point;
    299. int id = LOWORD(wParam);
    300. HWND handle = (HWND)lParam;
    301. PAINTSTRUCT ps;
    302. HDC hdc;
    303. TCHAR szHello[MAX_LOADSTRING];
    304. LoadString(hInst, IDS_HELLO, szHello, MAX_LOADSTRING);
    305. switch (message)
    306. {
    307. case WM_TIMER:
    308. if (wParam == 1)
    309. {
    310. table_next();
    311. InvalidateRect(hWnd, NULL, FALSE);
    312. }
    313. break;
    314. case WM_COMMAND:
    315. switch(HIWORD(wParam))
    316. {
    317. case BN_CLICKED:
    318. if (handle == hWndButtonClear)
    319. {
    320. table_clear();
    321. InvalidateRect(hWnd, NULL, FALSE);
    322. }
    323. else if (handle == hWndButtonNext)
    324. {
    325. table_next();
    326. InvalidateRect(hWnd, NULL, FALSE);
    327. }
    328. else if (handle == hWndButtonStart)
    329. {
    330. SetTimer(hWnd, 1, timer_delay, NULL);
    331. timer_working = TRUE;
    332. SendMessage(hWndButtonStart, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    333. (LPARAM)(HANDLE)hBitButStart[1]);
    334. }
    335. else if (handle == hWndButtonStop)
    336. {
    337. if (timer_working)
    338. KillTimer(hWnd, 1);
    339. timer_working = FALSE;
    340. SendMessage(hWndButtonStart, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    341. (LPARAM)(HANDLE)hBitButStart[0]);
    342. }
    343. else if (handle == hWndButtonSlow)
    344. {
    345. timer_delay = TD_SLOW;
    346. if (timer_working)
    347. SetTimer(hWnd, 1, timer_delay, NULL);
    348. SendMessage(hWndButtonSlow, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    349. (LPARAM)(HANDLE)hBitButSlow[1]);
    350. SendMessage(hWndButtonNormal, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    351. (LPARAM)(HANDLE)hBitButNormal[0]);
    352. SendMessage(hWndButtonFast, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    353. (LPARAM)(HANDLE)hBitButFast[0]);
    354. }
    355. else if (handle == hWndButtonNormal)
    356. {
    357. timer_delay = TD_NORMAL;
    358. if (timer_working)
    359. SetTimer(hWnd, 1, timer_delay, NULL);
    360. SendMessage(hWndButtonSlow, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    361. (LPARAM)(HANDLE)hBitButSlow[0]);
    362. SendMessage(hWndButtonNormal, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    363. (LPARAM)(HANDLE)hBitButNormal[1]);
    364. SendMessage(hWndButtonFast, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    365. (LPARAM)(HANDLE)hBitButFast[0]);
    366. }
    367. else if (handle == hWndButtonFast)
    368. {
    369. timer_delay = TD_FAST;
    370. if (timer_working)
    371. SetTimer(hWnd, 1, timer_delay, NULL);
    372. SendMessage(hWndButtonSlow, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    373. (LPARAM)(HANDLE)hBitButSlow[0]);
    374. SendMessage(hWndButtonNormal, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    375. (LPARAM)(HANDLE)hBitButNormal[0]);
    376. SendMessage(hWndButtonFast, BM_SETIMAGE, (WPARAM)IMAGE_BITMAP,
    377. (LPARAM)(HANDLE)hBitButFast[1]);
    378. }
    379. else if (handle == hWndButtonClose)
    380. {
    381. DestroyWindow(hWnd);
    382. }
    383. break;
    384. }
    385. switch (LOWORD(wParam))
    386. {
    387. case IDM_CL_CLOSE:
    388. DestroyWindow(hWnd);
    389. break;
    390. case IDM_CL_MINIMIZE:
    391. break;
    392. }
    393. break;
    394. case WM_PAINT:
    395. HDC hdc_buf, hdc_temp;
    396. HGDIOBJ temp;
    397. hdc = BeginPaint(hWnd, &ps);
    398. // Run once
    399. if (!hBitBuffer)
    400. hBitBuffer = CreateCompatibleBitmap(hdc, WINDOW_WIDTH, WINDOW_HEIGHT);
    401. // Double-Buffer DC
    402. hdc_buf = CreateCompatibleDC(hdc);
    403. SelectObject(hdc_buf, hBitBuffer);
    404. // Background DC
    405. hdc_temp = CreateCompatibleDC(hdc_buf);
    406. temp = SelectObject(hdc_temp, hBitBack);
    407. // Copy background onto back-buffer
    408. BitBlt(hdc_buf, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, hdc_temp, 0, 0, SRCCOPY);
    409. SelectObject(hdc_temp, temp);
    410. // Copy table
    411. for(y=0; y<ROWS; y++)
    412. {
    413. for(x=0; x<COLS; x++)
    414. {
    415. temp = SelectObject(hdc_temp, (table[y][x])?hBitAlive:hBitDead:hBitSick:hBitInfected:hBitInfectious:hBitImmune);
    416. BitBlt(hdc_buf, TABLE_X + x*COL_SIZE, TABLE_Y + y*ROW_SIZE, COL_SIZE, ROW_SIZE,
    417. hdc_temp, 0, 0, SRCCOPY);
    418. SelectObject(hdc_temp, temp);
    419. }
    420. }
    421. DeleteDC(hdc_temp);
    422. BitBlt(hdc, 0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, hdc_buf, 0, 0, SRCCOPY);
    423. DeleteDC(hdc_buf);
    424. EndPaint(hWnd, &ps);
    425. break;
    426. case WM_ERASEBKGND:
    427. break;
    428. case WM_DESTROY:
    429. PostQuitMessage(0);
    430. break;
    431. case WM_LBUTTONDOWN:
    432. x = (LOWORD(lParam) - TABLE_X);
    433. y = (HIWORD(lParam) - TABLE_Y);
    434. if ((x>=0) && (y>=0) && (x<COLS*COL_SIZE) && (y<ROWS*ROW_SIZE))
    435. {
    436. captured = CAP_TABLE;
    437. cap_button = 1;
    438. SetCapture(hWnd);
    439. SetCursor(LoadCursor(NULL, IDC_CROSS));
    440. x /= COL_SIZE;
    441. y /= ROW_SIZE;
    442. table_set(y, x, 1);
    443. table_point.x = x;
    444. table_point.y = y;
    445. InvalidateRect(hWnd, NULL, FALSE);
    446. }
    447. else
    448. {
    449. captured = CAP_MOVE;
    450. SetCapture(hWnd);
    451. cap_point.x = LOWORD(lParam);
    452. cap_point.y = HIWORD(lParam);
    453. SetCursor(LoadCursor(NULL, IDC_SIZEALL));
    454. }
    455. break;
    456. case WM_RBUTTONDOWN:
    457. x = (LOWORD(lParam) - TABLE_X);
    458. y = (HIWORD(lParam) - TABLE_Y);
    459. if ((x>=0) && (y>=0) && (x<COLS*COL_SIZE) && (y<ROWS*ROW_SIZE))
    460. {
    461. captured = CAP_TABLE;
    462. cap_button = 2;
    463. SetCapture(hWnd);
    464. SetCursor(LoadCursor(NULL, IDC_CROSS));
    465. x /= COL_SIZE;
    466. y /= ROW_SIZE;
    467. table_set(y, x, 0);
    468. table_point.x = x;
    469. table_point.y = y;
    470. InvalidateRect(hWnd, NULL, FALSE);
    471. }
    472. break;
    473. case WM_MOUSEMOVE:
    474. if (captured == CAP_MOVE)
    475. {
    476. point.x = LOWORD(lParam);
    477. point.y = HIWORD(lParam);
    478. ClientToScreen(hWnd, &point);
    479. point.x -= cap_point.x;
    480. point.y -= cap_point.y;
    481. SetWindowPos(hWnd, NULL, point.x, point.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
    482. }
    483. else if (captured == CAP_TABLE)
    484. {
    485. x = (LOWORD(lParam) - TABLE_X);
    486. y = (HIWORD(lParam) - TABLE_Y);
    487. if ((x>=0) && (y>=0) && (x<COLS*COL_SIZE) && (y<ROWS*ROW_SIZE))
    488. {
    489. x /= COL_SIZE;
    490. y /= ROW_SIZE;
    491. if (x != table_point.x || y != table_point.y)
    492. {
    493. table_point.x = x;
    494. table_point.y = y;
    495. table_set(y, x, (cap_button==1)?1:0);
    496. InvalidateRect(hWnd, NULL, FALSE);
    497. }
    498. }
    499. }
    500. break;
    501. case WM_LBUTTONUP:
    502. if (captured == CAP_MOVE)
    503. {
    504. captured = 0;
    505. ReleaseCapture();
    506. SetCursor(LoadCursor(NULL, IDC_ARROW));
    507. }
    508. else if (captured == CAP_TABLE)
    509. {
    510. captured = 0;
    511. ReleaseCapture();
    512. }
    513. break;
    514. case WM_RBUTTONUP:
    515. if (captured == CAP_TABLE)
    516. {
    517. if (cap_button == 2)
    518. {
    519. captured = 0;
    520. ReleaseCapture();
    521. }
    522. }
    523. default:
    524. return DefWindowProc(hWnd, message, wParam, lParam);
    525. }
    526. return 0;
    527. }
    528. // Mesage handler for about box.
    529. LRESULT CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
    530. {
    531. switch (message)
    532. {
    533. case WM_INITDIALOG:
    534. return TRUE;
    535. case WM_COMMAND:
    536. if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL)
    537. {
    538. EndDialog(hDlg, LOWORD(wParam));
    539. return TRUE;
    540. }
    541. break;
    542. }
    543. return FALSE;
    544. }
    Alles anzeigen


    so ändern, dass alle Zustände (Alive, Dead, Sick, Infected, Infectious, Immune) dargestellt werden können und nicht wie bisher nur Dead oder Alive.

    Der Zustand hängt immer vom vorherigen ab:

    Alive wird bei genügend Kontakt mit infizierten Nachbarn auch infiziert und damit INFEcted und Infectious.Dann entscheidet eine Wahrscheinlichkeit darüber, ob der Agent erkrankt und Sick und Infectious oder Immune und nicht mehr Infectious wird. Falls er Sick wurde, entscheidet noch die Wahrscheinlichkeit darüber , ob die Person Dead oder Immune wird.


    Ich hoffe ich habe mich klar ausgedrückt.

    Ich wäre euch sehr sehr dankbar für schnelle Hilfe, da ich sonst ein ernsthaftes Problem habe.

    MfG
    Florian Eichenberger