aboutsummaryrefslogtreecommitdiff
path: root/diplomacy/engine
diff options
context:
space:
mode:
Diffstat (limited to 'diplomacy/engine')
-rw-r--r--diplomacy/engine/message.py3
-rw-r--r--diplomacy/engine/renderer.py22
2 files changed, 15 insertions, 10 deletions
diff --git a/diplomacy/engine/message.py b/diplomacy/engine/message.py
index 2d6d644..150efd4 100644
--- a/diplomacy/engine/message.py
+++ b/diplomacy/engine/message.py
@@ -76,8 +76,7 @@ class Message(Jsonable):
super(Message, self).__init__(**kwargs)
def __str__(self):
- return '[%d/%s/%s->%s](%s)' % (
- self.time_sent, self.phase, self.sender, self.recipient, self.message)
+ return '[%d/%s/%s->%s](%s)' % (self.time_sent or 0, self.phase, self.sender, self.recipient, self.message)
def __hash__(self):
return hash(self.time_sent)
diff --git a/diplomacy/engine/renderer.py b/diplomacy/engine/renderer.py
index 8b5e10c..c6369c4 100644
--- a/diplomacy/engine/renderer.py
+++ b/diplomacy/engine/renderer.py
@@ -573,19 +573,25 @@ class Renderer():
path_with_shadow = xml_map.createElement('path')
path_with_shadow.setAttribute('class', 'shadowdash')
- path_with_shadow.setAttribute('d', 'M {},{} C {},{} {},{} {},{}'.format(loc_x, loc_y,
- src_loc_x, src_loc_y,
- src_loc_x, src_loc_y,
- dest_loc_x, dest_loc_y))
+ path_with_shadow.setAttribute('d', 'M {x},{y} C {src_x},{src_y} {src_x},{src_y} {dest_x},{dest_y}'
+ .format(x=loc_x,
+ y=loc_y,
+ src_x=src_loc_x,
+ src_y=src_loc_y,
+ dest_x=dest_loc_x,
+ dest_y=dest_loc_y))
path_with_arrow = xml_map.createElement('path')
path_with_arrow.setAttribute('class', 'supportorder')
path_with_arrow.setAttribute('stroke', self.metadata['color'][power_name])
path_with_arrow.setAttribute('marker-end', 'url(#arrow)')
- path_with_arrow.setAttribute('d', 'M {},{} C {},{} {},{} {},{}'.format(loc_x, loc_y,
- src_loc_x, src_loc_y,
- src_loc_x, src_loc_y,
- dest_loc_x, dest_loc_y))
+ path_with_arrow.setAttribute('d', 'M {x},{y} C {src_x},{src_y} {src_x},{src_y} {dest_x},{dest_y}'
+ .format(x=loc_x,
+ y=loc_y,
+ src_x=src_loc_x,
+ src_y=src_loc_y,
+ dest_x=dest_loc_x,
+ dest_y=dest_loc_y))
# Inserting
g_node.appendChild(path_with_shadow)