Browse Source

test state

Bastien Sevajol 6 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
 
132
 
133
     def _fill_state_root(self) -> None:
133
     def _fill_state_root(self) -> None:
134
         subjects_element = self._state_root.find('subjects')
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
         for subject in self._simulation.subjects:
140
         for subject in self._simulation.subjects:
137
             subject_element = etree.SubElement(subjects_element, 'subject')
141
             subject_element = etree.SubElement(subjects_element, 'subject')

+ 1 - 0
run.py View File

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

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

8
 def config() -> Config:
8
 def config() -> Config:
9
     config_ = Config()
9
     config_ = Config()
10
     config_.load_yaml('test_config.yaml')
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
     return config_
15
     return config_
12
 
16
 
13
 
17