30.06.2013 Aufrufe

Softwareentwicklung in C++ - ASC

Softwareentwicklung in C++ - ASC

Softwareentwicklung in C++ - ASC

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

18 ∗ card or both cards have already been s e t .<br />

19 ∗/<br />

20 const static u<strong>in</strong>t8 CARD ONE SET = 0x01 ;<br />

21 const static u<strong>in</strong>t8 CARD TWO SET = 0x02 ;<br />

22<br />

23 protected :<br />

24<br />

25 /∗ I n t e r n a l s t a t u s f l a g s to f i n d out whether e i t h e r o f the<br />

26 ∗ cards has been turned .<br />

27 ∗/<br />

28 const static u<strong>in</strong>t8 CARD ONE TURNED = 0 x40 ;<br />

29 const static u<strong>in</strong>t8 CARD TWO TURNED = 0 x80 ;<br />

30<br />

31 /∗ Bitmasks f o r the card−s e t and the card−turned b i t s . Both<br />

32 ∗ s t a t u s f l a g s are s e t <strong>in</strong> the same v a r i a b l e ( see below )<br />

33 ∗/<br />

34 const static u<strong>in</strong>t8 CARD SET BITS = 0x03 ;<br />

35 const static u<strong>in</strong>t8 CARD TURN BITS = 0xc0 ;<br />

36<br />

37 /∗ I n t e r n a l v a r i a b l e to s t o r e the s t a t u s f l a g s . Only the<br />

38 ∗ constants above may be s e t .<br />

39 ∗/<br />

40 u<strong>in</strong>t8 c a r d s e t s t a t u s ;<br />

41<br />

42 /∗ Status v a r i a b l e s f o r rows and columns o f the two cards<br />

43 ∗/<br />

44 u<strong>in</strong>t32 card1 row ;<br />

45 u<strong>in</strong>t32 c a r d 1 c o l ;<br />

46 u<strong>in</strong>t32 card2 row ;<br />

47 u<strong>in</strong>t32 c a r d 2 c o l ;<br />

48 public :<br />

49<br />

50 /∗ Default constructor<br />

51 ∗ Sets a l l s t a t u s v a r i a b l e s to t h e i r 0 s t a t e<br />

52 ∗/<br />

53 MemoryCardpair ( ) :<br />

54 c a r d s e t s t a t u s ( 0 ) ,<br />

55 card1 row ( 0 ) , c a r d 1 c o l ( 0 ) ,<br />

56 card2 row ( 0 ) , c a r d 2 c o l ( 0) { }<br />

57<br />

58 /∗ Destructor<br />

59 ∗ Just to make sure that a v i r t u a l d e s t r u c t o r e x i s t s<br />

60 ∗/<br />

61 virtual ˜ MemoryCardpair ( ) { }<br />

62<br />

10.2 Das DDD 303<br />

63 /∗ Called a f t e r the f i r s t card was chosen . This method s t o r e s<br />

64 ∗ the coord<strong>in</strong>ates of the card and turns i t f r o n t s i d e up , i f<br />

65 ∗ i t i s not already v i s i b l e . I t f u r t h e r s t o r e s , whether the<br />

66 ∗ card was i n i t i a l l y f r o n t or back s i d e up to be able to<br />

67 ∗ to perform an undo i f the pair does not match .<br />

68 ∗ @param row The row of the card to turn .<br />

69 ∗ @param c o l The column of the card to turn .<br />

70 ∗ @param gameboard The gameboard to work on .<br />

71 ∗/<br />

72 virtual void turnCardOneFrontSideUp (<br />

73 u<strong>in</strong>t32 row , u<strong>in</strong>t32 c o l , MemoryGameboard &gameboard ) ;<br />

74<br />

75 /∗ Analogous to the method above , j u s t f o r the second card<br />

76 ∗ o f the pair .<br />

77 ∗/<br />

78 virtual void turnCardTwoFrontSideUp (<br />

79 u<strong>in</strong>t32 row , u<strong>in</strong>t32 c o l , MemoryGameboard &gameboard ) ;<br />

80<br />

81 /∗ Returns the s t a t u s f l a g s that correspond to the b i t s that<br />

82 ∗ determ<strong>in</strong>e which cards were s e t .<br />

83 ∗ @return A b i t−comb<strong>in</strong>ation of the two bitmask constants that

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!