03.01.2013 Views

Chapter 1

Chapter 1

Chapter 1

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

TEventCode aType)<br />

{<br />

if (aType!=EEventKey)<br />

return EKeyWasNotConsumed;<br />

if (aKeyEvent.iCode==EQuartzKeyFourWayLeft ||<br />

aKeyEvent.iCode==EQuartzKeyFourWayRight ||<br />

aKeyEvent.iCode==EQuartzKeyFourWayUp ||<br />

aKeyEvent.iCode==EQuartzKeyFourWayDown)<br />

{<br />

// move cursor<br />

if (aKeyEvent.iCode==EQuartzKeyFourWayLeft)<br />

MoveCursor(-1,0);<br />

else if (aKeyEvent.iCode==EQuartzKeyFourWayRight)<br />

MoveCursor(1,0);<br />

else if (aKeyEvent.iCode==EQuartzKeyFourWayUp)<br />

MoveCursor(0,-1);<br />

else if (aKeyEvent.iCode==EQuartzKeyFourWayDown)<br />

MoveCursor(0,1);<br />

// redraw board<br />

DrawTilesNow();<br />

return EKeyWasConsumed;<br />

}<br />

else if (aKeyEvent.iCode==EQuartzKeyConfirm)<br />

{<br />

if (iFleet.IsKnown(iCursorX, iCursorY))<br />

else<br />

iEikonEnv->InfoMsg(R_GAME_ALREADY_KNOWN);<br />

iData.iCmdHandler.ViewCmdHitFleet(iCursorX,<br />

iCursorY);<br />

return EKeyWasConsumed;<br />

}<br />

return EKeyWasNotConsumed;<br />

}<br />

16.5.4 Hit Processing: the Full Story<br />

We saw how the view command handler initiated hit request processing, in<br />

CGameController::ViewCmdHitFleet(). The request now proceeds in four stages:<br />

� I send a request using RGCP in my game<br />

� the opponent receives the request using RGCP in their game<br />

� the opponent sends a response using RGCP in their game<br />

� I receive the response using RGCP in my game.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!