projects
/
python-bulletml.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
069c6c9
)
Direction, Speed: Better call return data.
author
Joe Wreschnig
<joe.wreschnig@gmail.com>
Tue, 16 Mar 2010 05:44:39 +0000
(22:44 -0700)
committer
Joe Wreschnig
<joe.wreschnig@gmail.com>
Tue, 16 Mar 2010 05:44:39 +0000
(22:44 -0700)
bulletml/parser.py
patch
|
blob
|
history
diff --git
a/bulletml/parser.py
b/bulletml/parser.py
index
10459cc
..
0af6694
100644
(file)
--- a/
bulletml/parser.py
+++ b/
bulletml/parser.py
@@
-52,7
+52,7
@@
class Direction(object):
self.value = NumberDef(element.text)
def __call__(self, params, rank):
self.value = NumberDef(element.text)
def __call__(self, params, rank):
- return
self.value(params, rank
)
+ return
(self.value(params, rank), self.type
)
def __repr__(self):
return "%s(%r, type=%r)" % (
def __repr__(self):
return "%s(%r, type=%r)" % (
@@
-88,11
+88,10
@@
class Speed(object):
self.value = NumberDef(element.text)
def __call__(self, params, rank):
self.value = NumberDef(element.text)
def __call__(self, params, rank):
- return
self.value(params, rank
)
+ return
(self.value(params, rank), self.type
)
def __repr__(self):
def __repr__(self):
- return "%s(%r, type=%r)" % (
- type(self).__name__, self.value, self.type)
+ return "%s(%r, type=%r)" % (type(self).__name__, self.value, self.type)
class ChangeSpeed(object):
"""Speed change over time."""
class ChangeSpeed(object):
"""Speed change over time."""
@@
-182,8
+181,10
@@
class Accel(object):
def __call__(self, params, rank):
frames = self.term(params, rank)
def __call__(self, params, rank):
frames = self.term(params, rank)
- horizontal = self.horizontal and self.horizontal(params, rank)
- vertical = self.vertical and self.vertical(params, rank)
+ horizontal = self.horizontal and (
+ self.horizontal(params, rank), self.horizontal.type)
+ vertical = self.vertical and (
+ self.vertical(params, rank), self.vertical.type)
return frames, horizontal, vertical
def __repr__(self):
return frames, horizontal, vertical
def __repr__(self):
@@
-213,13
+214,11
@@
class BulletDef(object):
def __call__(self, params, rank):
actions = []
for action in self.actions:
def __call__(self, params, rank):
actions = []
for action in self.actions:
- try:
- actions.append((action.params(params), action.action))
- except AttributeError:
- actions.append((params, action))
- return (self.direction and self.direction(params, rank),
- self.speed and self.speed(params, rank),
- actions)
+ actions.append(action(params, rank))
+ return (
+ self.direction and self.direction(params, rank),
+ self.speed and self.speed(params, rank),
+ actions)
def __repr__(self):
return "%s(direction=%r, speed=%r, actions=%r)" % (
def __repr__(self):
return "%s(direction=%r, speed=%r, actions=%r)" % (