Add **kwargs to `place_element()`

Better than using temp variable, but nore than that it prepares the next commit: using this method to put on the map collectables items (and maybe more in the future).
This commit is contained in:
Fred Z 2018-03-24 00:38:02 +01:00
parent 9ded9786a3
commit 463e7864d7
1 changed files with 11 additions and 3 deletions

14
map.py
View File

@ -157,7 +157,7 @@ class Map:
# Debug
self.status_message += "|"+str(self._player_position)+"|"+str(self._MAXIM)
def place_element(self, element):
def place_element(self, element, **kwargs):
"""
Place l'element sur la carte.
@ -168,8 +168,16 @@ class Map:
:param str element: element a placer sur la carte
"""
pos = self._player_position
txt = self._map_in_a_string
if 'pos' in kwargs:
pos = kwargs['pos']
else:
pos = self._player_position
if 'txt' in kwargs:
txt = kwargs['txt']
else:
txt = self._map_in_a_string
self._map_in_a_string = txt[:pos] + element + txt[pos + 1:]
@staticmethod