Author: bernhard
Date: Wed May 16 15:07:39 2007
New Revision: 18576
Modified:
trunk/examples/sdl/tetris/app.pir
trunk/examples/sdl/tetris/board.pir
Log:
[tetris]
Replace the obsolete 'argcI' checks with ':opt_flag' params.
Modified: trunk/examples/sdl/tetris/app.pir
==============================================================================
--- trunk/examples/sdl/tetris/app.pir (original)
+++ trunk/examples/sdl/tetris/app.pir Wed May 16 15:07:39 2007
@@ -587,7 +587,8 @@
.sub nextBlock :method
.param int boardID
- .param int id
+ .param int id :optional
+ .param int got_id :opt_flag
.local pmc temp
print "nextBlock: ("
@@ -596,11 +597,10 @@
print id
print "\n"
- # check the number of INT args
- if argcI >= 2 goto SKIP_ID
+ if got_id goto SKIP_SET_ID
# no INT arg => use a random next block
- set id, -1
-SKIP_ID:
+ id = -1
+SKIP_SET_ID:
temp = self."board"( boardID )
if_null temp, APP_NEXTBLOCK_END
@@ -1001,7 +1001,9 @@
.sub flag :method
.param string name
- .param int value
+ .param int value :optional
+ .param int got_value :opt_flag
+
.local pmc flag
.local int ret
@@ -1011,7 +1013,7 @@
getattribute flag, self, $I0
# check the number of INT args
- if argcI <= 1 goto FLAG_GET
+ unless got_value goto FLAG_GET
# set a new value
set flag[name], value
@@ -1038,7 +1040,8 @@
=cut
.sub newGame :method
- .param int players
+ .param int players :optional
+ .param int got_players :opt_flag
.local pmc temp
.local int xpos
@@ -1047,7 +1050,7 @@
set xpos, 10
# check the number of INT args
- if argcI >= 1 goto SET
+ if got_players goto SET
classoffset $I0, self, "Tetris::App"
add $I0, tPlayers
Modified: trunk/examples/sdl/tetris/board.pir
==============================================================================
--- trunk/examples/sdl/tetris/board.pir (original)
+++ trunk/examples/sdl/tetris/board.pir Wed May 16 15:07:39 2007
@@ -237,15 +237,16 @@
=cut
.sub nextBlock :method
- .param int id
+ .param int id :optional
+ .param int got_id :opt_flag
+
.local pmc block
.local pmc temp
- # check the number of INT args
- if argcI >= 1 goto SKIP_ID
+ if got_id goto SKIP_SET_ID
# no INT arg => use a random next block
- set id, -1
-SKIP_ID:
+ id = -1
+SKIP_SET_ID:
# get the 'next block' and store it as the current one
getprop block, "nextblock", self