Skip to content

Dead loader code: SmaugAreaFile.load_room calls nonexistent read_room_data; jump_to_section mispositions on missing section #10

Description

@ctoth

A few loader methods are dead and one is broken if ever revived.

1. SmaugAreaFile.load_room calls a method that doesn't exist.

https://github.com/ctoth/area_reader/blob/3297b88/area_reader/__init__.py#L2017-L2030

def load_room(self, vnum):
    ...
    line = self.read_line()
    #room.sector_type, room.tele_delay, ... = map(int, line.split())
    self.read_room_data(room)
    return room

read_room_data is not defined anywhere in the package (grep finds only this call site), so calling load_room raises AttributeError. Nothing calls it — the live path is SmaugRoom.read — so this is leftover from an earlier design. read_line (line 2029) exists only to serve it.

2. AreaFile.jump_to_section silently mispositions when the section is missing.

https://github.com/ctoth/area_reader/blob/3297b88/area_reader/__init__.py#L391-L392

def jump_to_section(self, section_name):
    self.index = self.data.find('#'+section_name.upper()) + len(section_name) + 1

When find returns -1 the index becomes len(section_name), a meaningless offset near the start of the file, with no error. Verified:

>>> f.data = "#AREA\nstuff"; f.jump_to_section("NOSUCH"); f.index
6

No callers in the package or tests.

3. Triplicated helper. native_reset_arg2_suffix, native_merc_reset_arg2_suffix, and native_swr_reset_arg2_suffix (lines 590, 1705, 557) are byte-identical single-expression functions.

Suggest deleting 1 and 2 (or fixing jump_to_section to raise on a missing section if it's meant as public API) and collapsing 3 to one helper.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions