Stefan Schuermans commited on 2019-07-07 17:08:39
Showing 1 changed files, with 19 additions and 0 deletions.
... | ... |
@@ -180,6 +180,25 @@ void Pong::newOpConn(const std::string &name, OpConn *pConn) |
180 | 180 |
*/ |
181 | 181 |
void Pong::opConnRecvKey(OpConn *pConn, char key) |
182 | 182 |
{ |
183 |
+ // hash -> hang up |
|
184 |
+ if (key == '#') { |
|
185 |
+ opConnClose(pConn); |
|
186 |
+ pConn->close(); |
|
187 |
+ return; |
|
188 |
+ } |
|
189 |
+ |
|
190 |
+ // star -> inform player about it side |
|
191 |
+ if (key == '*') { |
|
192 |
+ if (pConn == m_pConnLeft) { |
|
193 |
+ playOpConnSound(pConn, m_fileLeftPlayerSound); |
|
194 |
+ } else if (pConn == m_pConnRight) { |
|
195 |
+ playOpConnSound(pConn, m_fileRightPlayerSound); |
|
196 |
+ } |
|
197 |
+ return; |
|
198 |
+ } |
|
199 |
+ |
|
200 |
+ // normal keys for controlling game |
|
201 |
+ |
|
183 | 202 |
// left player |
184 | 203 |
if (pConn == m_pConnLeft) { |
185 | 204 |
processKey(key, m_leftPosY); |
186 | 205 |