Skip to content

Commit cd9cb37

Browse files
committed
datamap and server class dumps are now showing base classes
1 parent 01ebc7b commit cd9cb37

File tree

1 file changed

+24
-3
lines changed
  • addons/source-python/packages/source-python/core

1 file changed

+24
-3
lines changed

addons/source-python/packages/source-python/core/dumps.py

+24-3
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,9 @@ def _get_datamap(classname):
181181

182182
def _dump_datamap(open_file, class_name, datamap):
183183
"""Dump a DataMap object to the given file object."""
184-
open_file.write('{0}\n'.format(class_name))
184+
base = datamap.base
185+
open_file.write('{} -> {}\n'.format(
186+
class_name, base and base.class_name))
185187
for desc in datamap:
186188
_dump_type_description(open_file, desc)
187189

@@ -216,11 +218,14 @@ def dump_server_classes(filename):
216218
# Loop through all server classes
217219
for server_class in ServerClassGenerator():
218220

221+
table = server_class.table
222+
219223
# Print the server class' name to file
220-
open_file.write('{0}\n'.format(server_class.name))
224+
open_file.write('{} -> {}\n'.format(
225+
server_class.name, _find_base_server_class_name(table)))
221226

222227
# Get all items in the server class' table
223-
_dump_server_class_table(server_class.table, open_file)
228+
_dump_server_class_table(table, open_file)
224229

225230
# Move to the next server class
226231
server_class = server_class.next
@@ -232,6 +237,22 @@ def dump_server_classes(filename):
232237
open_file.write('\n')
233238

234239

240+
def _find_base_server_class_name(table):
241+
"""Return the name of table's base server class."""
242+
for prop in table:
243+
if prop.name != 'baseclass':
244+
continue
245+
246+
base_name = prop.data_table.name
247+
for server_class in ServerClassGenerator():
248+
if server_class.table.name == base_name:
249+
return server_class.name
250+
251+
return None
252+
253+
return None
254+
255+
235256
def _dump_server_class_table(table, open_file, level=1, offset=0):
236257
"""Dump all items in the given table to the given file."""
237258
# Loop through the send props in the table

0 commit comments

Comments
 (0)