Browse Source

test state

Bastien Sevajol 5 years ago
parent
commit
70a29ca649
3 changed files with 9 additions and 0 deletions
  1. 4 0
      opencombat/state.py
  2. 1 0
      run.py
  3. 4 0
      tests/fixtures/main.py

+ 4 - 0
opencombat/state.py View File

@@ -132,6 +132,10 @@ class StateDumper(object):
132 132
 
133 133
     def _fill_state_root(self) -> None:
134 134
         subjects_element = self._state_root.find('subjects')
135
+        map_element = self._state_root.find('map')
136
+
137
+        map_name_element =  etree.SubElement(map_element, 'name')
138
+        map_name_element.text = self._config.resolve('_runtime.map_dir_path')
135 139
 
136 140
         for subject in self._simulation.subjects:
137 141
             subject_element = etree.SubElement(subjects_element, 'subject')

+ 1 - 0
run.py View File

@@ -33,6 +33,7 @@ def main(
33 33
     config['_runtime'] = {}
34 34
     config['_runtime']['state_save_dir'] = state_save_dir
35 35
     config['_runtime']['placement_mode'] = placement_mode
36
+    config['_runtime']['map_dir_path'] = map_dir_path
36 37
 
37 38
     level = logging.getLevelName(config.resolve('global.logging_level', 'ERROR'))
38 39
     logger = get_default_logger(level=level)

+ 4 - 0
tests/fixtures/main.py View File

@@ -8,6 +8,10 @@ from opencombat.simulation.base import TileStrategySimulation
8 8
 def config() -> Config:
9 9
     config_ = Config()
10 10
     config_.load_yaml('test_config.yaml')
11
+
12
+    config_['_runtime'] = {}
13
+    config_['_runtime']['map_dir_path'] = 'tests/fixtures/map_a/map_a.tmx'
14
+
11 15
     return config_
12 16
 
13 17