SuperSpaceInvaderTurboApoca.../doc/SAE102-SpaceInvaders/latex/d9/d15/god_manager_8cpp_source.tex

146 lines
24 KiB
TeX

\hypertarget{god_manager_8cpp_source}{}\doxysection{god\+Manager.\+cpp}
\label{god_manager_8cpp_source}\index{src/game/godManager.cpp@{src/game/godManager.cpp}}
\mbox{\hyperlink{god_manager_8cpp}{Go to the documentation of this file.}}
\begin{DoxyCode}{0}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00001}00001 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00011}00011 \textcolor{preprocessor}{\#include "{}\mbox{\hyperlink{game_8h}{game.h}}"{}}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00012}00012 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00013}00013 \textcolor{keywordtype}{void} Game::tryAwakeGod() \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00014}00014 \textcolor{keywordflow}{if} (basePos.\mbox{\hyperlink{classns_graphics_1_1_vec2_d_ae70fbda9cca27b9dc0fe068a38ae5e5e}{getY}}() > 100 \textcolor{comment}{/*lambda value*/} \&\& god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}}==\mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355ab50339a10e1de285ac99d4c3990b8693}{GodState::NONE}}) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00015}00015 god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} = 0;}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00016}00016 god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}} = \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355afca549f3541c801906abc34b45e8953e}{GodState::AWAKE}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00017}00017 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00018}00018 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00019}00019 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00024}00024 \textcolor{comment}{/* This is a really long function, but I feel like it's still readable because of the switch, and...}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00025}00025 \textcolor{comment}{ * Honestly I think splitting it into multiple small functions would be ugly*/}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00026}00026 \textcolor{keywordtype}{bool} Game::manageGod() \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00027}00027 \textcolor{keywordflow}{switch} (god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}}) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00028}00028 \textcolor{keywordflow}{case} \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355ab50339a10e1de285ac99d4c3990b8693}{GodState::NONE}}: \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00029}00029 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00030}00030 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00031}00031 \textcolor{keywordflow}{case} \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355afca549f3541c801906abc34b45e8953e}{GodState::AWAKE}}: \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00032}00032 \textcolor{keywordflow}{if} (god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} == \mbox{\hyperlink{god_8h_a321d9614200c924cf991c5b08808be80}{GOD\_BENCH\_SIZE}}) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00033}00033 god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} = 0;}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00034}00034 god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}} = \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355ad5cc6a0064b5c25ba37826aa3fda910c}{GodState::WAIT}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00035}00035 \} \textcolor{keywordflow}{else} ++god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00036}00036 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00037}00037 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00038}00038 \textcolor{keywordflow}{case} \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355ad5cc6a0064b5c25ba37826aa3fda910c}{GodState::WAIT}}: \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00039}00039 \textcolor{keywordflow}{if} (god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} < 100) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00040}00040 ++god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00041}00041 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00042}00042 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00043}00043 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00044}00044 \textcolor{comment}{// init throw}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00045}00045 god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} = 0;}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00046}00046 god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}} = \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355a478d22fab8e360f3af57895f113f1f0f}{GodState::RETRIEVE1}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00047}00047 god.\mbox{\hyperlink{class_god_ae7ed525f130083f511728c791c35a95d}{thrownInvPosX}} = grid.\mbox{\hyperlink{class_invaders_grid_ac184c30c8a60fdbe8abed9b9455d35d2}{randomValidCol}}();}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00048}00048 god.\mbox{\hyperlink{class_god_a26fbb775dff480eaa6a19d4a3ef9731c}{thrownInvPosY}} = grid[god.\mbox{\hyperlink{class_god_ae7ed525f130083f511728c791c35a95d}{thrownInvPosX}}].randomValidInv();}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00049}00049 god.\mbox{\hyperlink{class_god_ad41071cd3e9f51419411e4fd1a0c63c5}{thrownInvType}} = \mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018ab50339a10e1de285ac99d4c3990b8693}{InvaderType::NONE}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00050}00050 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00051}00051 god.\mbox{\hyperlink{class_god_a41b9ceec78e403a54cf8afaf6e50519a}{thrownTransition}}.\mbox{\hyperlink{classns_graphics_1_1_vec2_d_ae9d371fdd3817c6e9a3a1ae6ed3fd17d}{setX}}(pm-\/>getScreenWidth() -\/ \mbox{\hyperlink{god_8h_a0b3ad1c15e80936f3ee35f4ff91f243c}{GOD\_HAND\_DISTANCE}} -\/ \mbox{\hyperlink{god_8h_a59e44f12d6c2f40c10bb249db0a3b3d6}{GOD\_HAND\_SIZE}});}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00052}00052 god.\mbox{\hyperlink{class_god_a41b9ceec78e403a54cf8afaf6e50519a}{thrownTransition}}.\mbox{\hyperlink{classns_graphics_1_1_vec2_d_ac0e752e399ab2f727fe2644540b1208f}{setY}}(basePos.\mbox{\hyperlink{classns_graphics_1_1_vec2_d_ae70fbda9cca27b9dc0fe068a38ae5e5e}{getY}}() + \mbox{\hyperlink{utils_8h_a815cc3532f834befd1c85e0e8d3bc9f7}{INV\_GET\_POS}}(god.\mbox{\hyperlink{class_god_a26fbb775dff480eaa6a19d4a3ef9731c}{thrownInvPosY}}));}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00053}00053 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00054}00054 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00055}00055 \textcolor{keywordflow}{case} \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355a478d22fab8e360f3af57895f113f1f0f}{GodState::RETRIEVE1}}: \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00056}00056 \textcolor{keywordflow}{if} (god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} < 100) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00057}00057 god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} += 2;}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00058}00058 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00059}00059 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00060}00060 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00061}00061 \textcolor{keywordflow}{if} (grid[god.\mbox{\hyperlink{class_god_ae7ed525f130083f511728c791c35a95d}{thrownInvPosX}}].size() > god.\mbox{\hyperlink{class_god_a26fbb775dff480eaa6a19d4a3ef9731c}{thrownInvPosY}} \&\&}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00062}00062 grid[god.\mbox{\hyperlink{class_god_ae7ed525f130083f511728c791c35a95d}{thrownInvPosX}}][god.\mbox{\hyperlink{class_god_a26fbb775dff480eaa6a19d4a3ef9731c}{thrownInvPosY}}] != \mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018ab50339a10e1de285ac99d4c3990b8693}{InvaderType::NONE}}) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00063}00063 god.\mbox{\hyperlink{class_god_ad41071cd3e9f51419411e4fd1a0c63c5}{thrownInvType}} = grid[god.\mbox{\hyperlink{class_god_ae7ed525f130083f511728c791c35a95d}{thrownInvPosX}}][god.\mbox{\hyperlink{class_god_a26fbb775dff480eaa6a19d4a3ef9731c}{thrownInvPosY}}];}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00064}00064 grid[god.\mbox{\hyperlink{class_god_ae7ed525f130083f511728c791c35a95d}{thrownInvPosX}}][god.\mbox{\hyperlink{class_god_a26fbb775dff480eaa6a19d4a3ef9731c}{thrownInvPosY}}] = \mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018ab50339a10e1de285ac99d4c3990b8693}{InvaderType::NONE}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00065}00065 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00066}00066 god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}} = \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355a047051c1710157600a077e72054333e1}{GodState::RETRIEVE2}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00067}00067 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00068}00068 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00069}00069 \textcolor{keywordflow}{case} \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355a047051c1710157600a077e72054333e1}{GodState::RETRIEVE2}}: \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00070}00070 \textcolor{keywordflow}{if} (god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} > 0) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00071}00071 god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} -\/= 2;}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00072}00072 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00073}00073 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00074}00074 \textcolor{keywordflow}{if} (god.\mbox{\hyperlink{class_god_ad41071cd3e9f51419411e4fd1a0c63c5}{thrownInvType}} == \mbox{\hyperlink{invaders_grid_8h_a28be5c0c3bae3518d94b2ede3633e018ab50339a10e1de285ac99d4c3990b8693}{InvaderType::NONE}}) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00075}00075 god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}} = \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355ad5cc6a0064b5c25ba37826aa3fda910c}{GodState::WAIT}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00076}00076 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00077}00077 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00078}00078 god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}} = \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355a655474de4674aba7a436a73cd8d9a906}{GodState::THROW}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00079}00079 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00080}00080 \textcolor{comment}{// compute the launch vector}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00081}00081 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00082}00082 \mbox{\hyperlink{classns_graphics_1_1_vec2_d}{Position}} invaderMiddlePos(pm-\/>getScreenWidth() -\/ \mbox{\hyperlink{god_8h_a0b3ad1c15e80936f3ee35f4ff91f243c}{GOD\_HAND\_DISTANCE}} -\/ \mbox{\hyperlink{god_8h_a59e44f12d6c2f40c10bb249db0a3b3d6}{GOD\_HAND\_SIZE}} / 2,}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00083}00083 \mbox{\hyperlink{god_8h_a59e44f12d6c2f40c10bb249db0a3b3d6}{GOD\_HAND\_SIZE}} / 2);}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00084}00084 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00085}00085 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00086}00086 \mbox{\hyperlink{utils_8h_a19f2f2312637b6ed67b6d24598b6f470}{playerID}} target;}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00087}00087 \textcolor{keywordflow}{if} (players.size() == 1)target = \mbox{\hyperlink{utils_8h_aff32b2add5186520b5ae86864ebaf51a}{PLAYER1}}; \textcolor{comment}{// don't want to use random if not needed}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00088}00088 \textcolor{keywordflow}{else} target = rand() \% players.size();}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00089}00089 \textcolor{comment}{/* Let's just pretend god is drunk and can fire at a player that have a death animation, because}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00090}00090 \textcolor{comment}{ * honestly at this point I want to re-\/code the whole game engine to allow a better handling of cases like this...*/}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00091}00091 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00092}00092 \mbox{\hyperlink{classns_graphics_1_1_vec2_d}{Position}} playerMiddlePos(players[target].x + confData.\mbox{\hyperlink{struct_config_data_ad8c5d2876699ea9e451e6b3a15618707}{playersWidth}} / 2,}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00093}00093 pm-\/>getScreenHeight() -\/ \mbox{\hyperlink{utils_8h_a2712b06fd52f25adca031d05c3e0c09b}{PLAYER\_HEIGHT}} / 2);}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00094}00094 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00095}00095 god.\mbox{\hyperlink{class_god_a87f1d2986cfd375910aa7908c8976451}{thrownVector}} = playerMiddlePos -\/ invaderMiddlePos;}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00096}00096 god.\mbox{\hyperlink{class_god_a87f1d2986cfd375910aa7908c8976451}{thrownVector}} = god.\mbox{\hyperlink{class_god_a87f1d2986cfd375910aa7908c8976451}{thrownVector}} / (god.\mbox{\hyperlink{class_god_a87f1d2986cfd375910aa7908c8976451}{thrownVector}}.\mbox{\hyperlink{classns_graphics_1_1_vec2_d_adf603dcb6f44ff82f3d48df141e11fe7}{computeMagnitude}}() / 1000.0);}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00097}00097 \textcolor{comment}{// let's normalize it, but keep it's length big so x and y and non-\/zero}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00098}00098 \textcolor{comment}{// We will divide it in displayAll}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00099}00099 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00100}00100 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00101}00101 \textcolor{keywordflow}{case} \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355a655474de4674aba7a436a73cd8d9a906}{GodState::THROW}}: \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00102}00102 ++god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00103}00103 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00104}00104 \mbox{\hyperlink{classns_graphics_1_1_vec2_d}{Position}} invaderPos = god.\mbox{\hyperlink{class_god_a64e48ec11bf4039c9204ead815809ec1}{getRightHandPos}}(pm-\/>getScreenWidth());}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00105}00105 \mbox{\hyperlink{utils_8h_a984f84273044b866085f08117f942b8f}{applyTransformation}}(invaderPos, \mbox{\hyperlink{god_8h_a59e44f12d6c2f40c10bb249db0a3b3d6}{GOD\_HAND\_SIZE}}, confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}});}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00106}00106 \mbox{\hyperlink{classns_graphics_1_1_vec2_d}{Position}} a = god.\mbox{\hyperlink{class_god_a87f1d2986cfd375910aa7908c8976451}{thrownVector}} * (god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} / 100.0);}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00107}00107 invaderPos = invaderPos + a;}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00108}00108 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00109}00109 \textcolor{keywordtype}{bool} touched = \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00110}00110 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00111}00111 \textcolor{comment}{// check if OOB (Out Of Bounds)}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00112}00112 \textcolor{keywordflow}{if} (invaderPos.\mbox{\hyperlink{classns_graphics_1_1_vec2_d_ae70fbda9cca27b9dc0fe068a38ae5e5e}{getY}}() + confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} >= pm-\/>getScreenWidth() ||}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00113}00113 (invaderPos.\mbox{\hyperlink{classns_graphics_1_1_vec2_d_abcf3d729b05b3cd93e9eff21c74b89a1}{getX}}() < 0 || invaderPos.\mbox{\hyperlink{classns_graphics_1_1_vec2_d_abcf3d729b05b3cd93e9eff21c74b89a1}{getX}}() + confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} >= pm-\/>getScreenWidth())) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00114}00114 touched = \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00115}00115 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00116}00116 \textcolor{comment}{/* there are no invaders in the grid anymore, and the one thrown just went out of bound}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00117}00117 \textcolor{comment}{ * So... return true, the player wins*/}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00118}00118 \textcolor{keywordflow}{if}(!areThereInvadersLeft())\textcolor{keywordflow}{return} \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00119}00119 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00120}00120 \textcolor{comment}{// check player collision}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00121}00121 \} \textcolor{keywordflow}{else} \textcolor{keywordflow}{if} (invaderPos.\mbox{\hyperlink{classns_graphics_1_1_vec2_d_ae70fbda9cca27b9dc0fe068a38ae5e5e}{getY}}() + confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}} >= pm-\/>getScreenHeight() -\/ \mbox{\hyperlink{utils_8h_a2712b06fd52f25adca031d05c3e0c09b}{PLAYER\_HEIGHT}}) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00122}00122 \textcolor{keywordflow}{for} (\mbox{\hyperlink{struct_player}{Player}} \&p: players) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00123}00123 \textcolor{keywordflow}{if}(p.isPlaying())\{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00124}00124 \textcolor{keywordflow}{if} (\mbox{\hyperlink{utils_8h_a8d01e61a45fe7072e45f22044013e358}{areLinesColliding}}(}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00125}00125 p.x, p.x + confData.\mbox{\hyperlink{struct_config_data_ad8c5d2876699ea9e451e6b3a15618707}{playersWidth}},}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00126}00126 invaderPos.\mbox{\hyperlink{classns_graphics_1_1_vec2_d_abcf3d729b05b3cd93e9eff21c74b89a1}{getX}}(), invaderPos.\mbox{\hyperlink{classns_graphics_1_1_vec2_d_abcf3d729b05b3cd93e9eff21c74b89a1}{getX}}() + confData.\mbox{\hyperlink{struct_config_data_ada929ea4a462c0bde376adf9fa3f4810}{invadersSize}}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00127}00127 )) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00128}00128 p.damage();}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00129}00129 touched = \textcolor{keyword}{true};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00130}00130 \textcolor{comment}{// do not break, the other player also deserves to be hit}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00131}00131 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00132}00132 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00133}00133 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00134}00134 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00135}00135 \textcolor{keywordflow}{if} (touched) \{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00136}00136 god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}} = \mbox{\hyperlink{god_8h_af1459ba6e17d6a2aef2bf5f4f56f6355ad5cc6a0064b5c25ba37826aa3fda910c}{GodState::WAIT}};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00137}00137 god.\mbox{\hyperlink{class_god_a1000165e05f6719539b7702ab3f09a66}{counter}} = 0;}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00138}00138 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00139}00139 \textcolor{comment}{/* we do not need to reset other members, they'll be treated as non-\/initialized}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00140}00140 \textcolor{comment}{ * When we cycle back between states*/}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00141}00141 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00142}00142 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00143}00143 \textcolor{keywordflow}{return} \textcolor{keyword}{false};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00144}00144 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00145}00145 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00146}00146 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00147}00147 \textcolor{keywordflow}{throw} runtime\_error(\textcolor{stringliteral}{"{}SHOULD NOT HAPPEN : invalid action for god : ID="{}}+ to\_string(\textcolor{keyword}{static\_cast<}\textcolor{keywordtype}{int}\textcolor{keyword}{>}(god.\mbox{\hyperlink{class_god_aa509fa274d956215aa439de1c8e2e290}{state}})));}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00148}00148 \}}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00149}00149 }
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00150}\mbox{\hyperlink{class_god_a64e48ec11bf4039c9204ead815809ec1}{00150}} \mbox{\hyperlink{classns_graphics_1_1_vec2_d}{Position}} \mbox{\hyperlink{class_god_a64e48ec11bf4039c9204ead815809ec1}{God::getRightHandPos}}(\textcolor{keywordtype}{unsigned} screenWidth)\textcolor{keyword}{ const }\{}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00151}00151 \textcolor{keywordflow}{return} \{screenWidth -\/ \mbox{\hyperlink{god_8h_a0b3ad1c15e80936f3ee35f4ff91f243c}{GOD\_HAND\_DISTANCE}} -\/ \mbox{\hyperlink{god_8h_a59e44f12d6c2f40c10bb249db0a3b3d6}{GOD\_HAND\_SIZE}}, 0\};}
\DoxyCodeLine{\Hypertarget{god_manager_8cpp_source_l00152}00152 \}}
\end{DoxyCode}