Ejemplo n.º 1
0
def build_fov_map(t):
    """Build Thing's FOV map."""
    from server.config.world_data import world_db, symbols_hide
    from server.utils import libpr, c_pointer_to_bytearray, c_pointer_to_string
    t["fovmap"] = bytearray(b'v' * (world_db["MAP_LENGTH"]**2))
    fovmap = c_pointer_to_bytearray(t["fovmap"])
    m = c_pointer_to_bytearray(world_db["MAP"])
    hide_string = c_pointer_to_string(symbols_hide)
    if libpr.build_fov_map(t["T_POSY"], t["T_POSX"], fovmap, m, hide_string):
        raise RuntimeError("Malloc error in build_fov_Map().")
Ejemplo n.º 2
0
def build_fov_map(t):
    """Build Thing's FOV map."""
    from server.config.world_data import world_db, symbols_hide
    from server.utils import libpr, c_pointer_to_bytearray, c_pointer_to_string
    t["fovmap"] = bytearray(b'v' * (world_db["MAP_LENGTH"] ** 2))
    fovmap = c_pointer_to_bytearray(t["fovmap"])
    m = c_pointer_to_bytearray(world_db["MAP"])
    hide_string = c_pointer_to_string(symbols_hide)
    if libpr.build_fov_map(t["T_POSY"], t["T_POSX"], fovmap, m, hide_string):
        raise RuntimeError("Malloc error in build_fov_Map().")
Ejemplo n.º 3
0
 def set_cells_passable_on_memmap_to_65534_on_scoremap():
     # OUTSOURCED FOR PERFORMANCE REASONS TO libplomrogue.so:
     # memmap = t["T_MEMMAP"]
     # for i in [i for i in range(world_db["MAP_LENGTH"] ** 2)
     #            if memmap[i] in symbols_passable]:
     #     set_map_score(i, 65534) # i.e. 65535-1
     scoremap = c_pointer_to_bytearray(t["T_MEMMAP"])
     passable_string = c_pointer_to_string(symbols_passable)
     if libpr.set_cells_passable_on_memmap_to_65534_on_scoremap(
             scoremap, passable_string):
         raise RuntimeError("No score map allocated for set_cells_passable"
                            "_on_memmap_to_65534_on_scoremap().")
Ejemplo n.º 4
0
 def set_cells_passable_on_memmap_to_65534_on_scoremap():
     # OUTSOURCED FOR PERFORMANCE REASONS TO libplomrogue.so:
     # memmap = t["T_MEMMAP"]
     # for i in [i for i in range(world_db["MAP_LENGTH"] ** 2)
     #            if memmap[i] in symbols_passable]:
     #     set_map_score(i, 65534) # i.e. 65535-1
     scoremap = c_pointer_to_bytearray(t["T_MEMMAP"])
     passable_string = c_pointer_to_string(symbols_passable)
     if libpr.set_cells_passable_on_memmap_to_65534_on_scoremap(scoremap,
                 passable_string):
         raise RuntimeError("No score map allocated for set_cells_passable"
                            "_on_memmap_to_65534_on_scoremap().")