Example #1
0
    def parse_ship_design(self, offset):
        MAX_WEAPONS = 8
        weapons = []
        for i in range(MAX_WEAPONS):
            offset2 = offset + 0x1C + (8 * i)
            weapon = lbx.read_byte(self.__data, offset2)
            if (weapon > 0):
                weapons.append({
                    'weapon':		weapon,
                    'count':		lbx.read_byte(self.__data, offset2 + 0x02),
                    'current_count':	lbx.read_byte(self.__data, offset2 + 0x03),
                    'arc':		lbx.read_byte(self.__data, offset2 + 0x04),
                    'beam_mods':	lbx.read_byte(self.__data, offset2 + 0x05),
                    'missile_mods':	lbx.read_byte(self.__data, offset2 + 0x06),
                    'ammo':		lbx.read_byte(self.__data, offset2 + 0x07)
                })
        return {
                'name':                 lbx.read_string(self.__data, offset, 16),
                'size':         	lbx.read_byte(self.__data, offset + 0x10),
                'type':                 lbx.read_byte(self.__data, offset + 0x11),      # 0 = combat ship, 1 = colony ship, 2 = transport ship, 3 = guardian, 4 = outpost ship
                'shield':		lbx.read_byte(self.__data, offset + 0x12),
                'drive':		lbx.read_byte(self.__data, offset + 0x13),
                'speed':		lbx.read_byte(self.__data, offset + 0x14),
                'computer':		lbx.read_byte(self.__data, offset + 0x15),
                'armor':		lbx.read_byte(self.__data, offset + 0x16),
#                'special_devices':	self.__data[offset + 0x17:offset + 0x1C],	# char  special_device_flags[(MAX_SPECIALS+7)/8];
                'special_devices':	bitarray(bytearray(self.__data[offset + 0x17:offset + 0x1C])),	# char  special_device_flags[(MAX_SPECIALS+7)/8];
                'weapons':		weapons,
                'picture':		lbx.read_byte(self.__data, offset + 0x5C),
                'builder':		lbx.read_byte(self.__data, offset + 0x5D),		# or previous owner?
                'cost':                 lbx.read_short_int(self.__data, offset + 0x5E),
                'combat_speed':         lbx.read_byte(self.__data, offset + 0x60),
                'build_date':           lbx.read_short_int(self.__data, offset + 0x61)
        }
Example #2
0
 def parse_ship_design(self, offset):
     MAX_WEAPONS = 8
     weapons = []
     for i in range(MAX_WEAPONS):
         offset2 = offset + 0x1C + (8 * i)
         weapon = lbx.read_byte(self.__data, offset2)
         if (weapon > 0):
             weapons.append({
                 'weapon':
                 weapon,
                 'count':
                 lbx.read_byte(self.__data, offset2 + 0x02),
                 'current_count':
                 lbx.read_byte(self.__data, offset2 + 0x03),
                 'arc':
                 lbx.read_byte(self.__data, offset2 + 0x04),
                 'beam_mods':
                 lbx.read_byte(self.__data, offset2 + 0x05),
                 'missile_mods':
                 lbx.read_byte(self.__data, offset2 + 0x06),
                 'ammo':
                 lbx.read_byte(self.__data, offset2 + 0x07)
             })
     return {
         'name':
         lbx.read_string(self.__data, offset, 16),
         'size':
         lbx.read_byte(self.__data, offset + 0x10),
         'type':
         lbx.read_byte(
             self.__data, offset + 0x11
         ),  # 0 = combat ship, 1 = colony ship, 2 = transport ship, 3 = guardian, 4 = outpost ship
         'shield':
         lbx.read_byte(self.__data, offset + 0x12),
         'drive':
         lbx.read_byte(self.__data, offset + 0x13),
         'speed':
         lbx.read_byte(self.__data, offset + 0x14),
         'computer':
         lbx.read_byte(self.__data, offset + 0x15),
         'armor':
         lbx.read_byte(self.__data, offset + 0x16),
         #                'special_devices':	self.__data[offset + 0x17:offset + 0x1C],	# char  special_device_flags[(MAX_SPECIALS+7)/8];
         'special_devices':
         bitarray(bytearray(self.__data[offset + 0x17:offset + 0x1C])
                  ),  # char  special_device_flags[(MAX_SPECIALS+7)/8];
         'weapons':
         weapons,
         'picture':
         lbx.read_byte(self.__data, offset + 0x5C),
         'builder':
         lbx.read_byte(self.__data, offset + 0x5D),  # or previous owner?
         'cost':
         lbx.read_short_int(self.__data, offset + 0x5E),
         'combat_speed':
         lbx.read_byte(self.__data, offset + 0x60),
         'build_date':
         lbx.read_short_int(self.__data, offset + 0x61)
     }
Example #3
0
    def parse_heroes(self):
        HEROES_DATA_OFFSET	= 0x19a9b
        HERO_RECORD_SIZE	= 0x3b 		# = 59
        heroes = {}
        for i in range(67):
            hero_id = i
            offset = HEROES_DATA_OFFSET + (HERO_RECORD_SIZE * i)

#            print "hero @ %x" % offset

            type            = lbx.read_byte(self.__data, offset + 0x23)
            common_skills   = lbx.read_long_int(self.__data, offset + 0x26)
            special_skills  = lbx.read_long_int(self.__data, offset + 0x2a)

            heroes[hero_id] = {
                'id':               i,
#                'name':             data[offset:offset + 0x0f].rstrip(chr(0)).split(chr(0))[0],
                'name':             lbx.read_string(self.__data, offset, 15),
#                'title':            data[offset + 0x0f:offset + 0x23].rstrip(chr(0)).split(chr(0))[0],
                'title':            lbx.read_string(self.__data, offset, 35),
                'type':             type,
                'experience':       lbx.read_short_int(self.__data, offset + 0x24),
                'tech1':            lbx.read_byte(self.__data, offset + 0x2e),
                'tech2':            lbx.read_byte(self.__data, offset + 0x2f),
                'tech3':            lbx.read_byte(self.__data, offset + 0x30),
                'picture':          lbx.read_byte(self.__data, offset + 0x31),
                'skill_value':      lbx.read_short_int(self.__data, offset + 0x32),
                'level':            lbx.read_byte(self.__data, offset + 0x34),
                'location':         lbx.read_short_int(self.__data, offset + 0x35),
                'eta':              lbx.read_byte(self.__data, offset + 0x37),
                'level_up':         lbx.read_byte(self.__data, offset + 0x38),
                'status':           lbx.read_byte(self.__data, offset + 0x39),
                'player':           lbx.read_byte(self.__data, offset + 0x3a),
                'skills':           self.parse_hero_skills(type, common_skills, special_skills),
                'common_skills':    common_skills,
                'special_skills':   special_skills,
            }
#            if heroes[hero_id]['player'] == 0:
#                print "Moo2Savegame::parse_heroes ... hero_id = %i, name = %s" % (hero_id, heroes[hero_id]['name'])
#                print " * level = %i" % heroes[hero_id]['level']
#                print " * skill_value = %i" % heroes[hero_id]['skill_value']
#                print " * experience = %i" % heroes[hero_id]['experience']
#                print " * status = %i" % heroes[hero_id]['status']
            
#        i += 1
#        offset = 0x19a9b + (59 * i)
#        print "STOP hero @ %x" % offset
        return heroes
Example #4
0
 def parse_galaxy(self):
     return {
         'size_factor':	lbx.read_byte(self.__data, 0x31be4),
         'width':            compose_int(ord(self.__data[0x31be9]), ord(self.__data[0x31bea])),
         'height':           compose_int(ord(self.__data[0x31beb]), ord(self.__data[0x31bec])),
         'stardate':		lbx.read_short_int(self.__data, 0x29),
     }
Example #5
0
    def parse_one_ship(self, ship_id):
        SAVE_SHIPS_OFFSET = 0x21f58
        SAVE_SHIP_RECORD_SIZE = 0x81  # = 129
        offset = SAVE_SHIPS_OFFSET + (SAVE_SHIP_RECORD_SIZE * ship_id)
        data = self.__data[offset:offset + SAVE_SHIP_RECORD_SIZE]

        ship = universe.Starship(ship_id)

        ship_design = self.parse_ship_design(offset)
        ship.set_name(ship_design['name'])
        ship.set_design(ship_design)
        ship.set_owner(lbx.read_byte(data, 0x63))
        ship.set_status(lbx.read_byte(
            data, 0x64))  # 0 = orbitting, 2 = traveling, 5 = destroyed?
        ship.set_destination(lbx.read_short_int(data, 0x65) %
                             500)  # destination star
        ship.set_x(lbx.read_short_int(data, 0x67))
        ship.set_y(lbx.read_short_int(data, 0x69))
        ship.set_group_has_navigator(lbx.read_byte(data, 0x6B))
        ship.set_travelling_speed(lbx.read_byte(
            data, 0x6C))  # possibly less than ftl_type
        ship.set_turns_left(lbx.read_byte(data, 0x6D))  # until arrival
        ship.set_shield_damage_percent(lbx.read_byte(data, 0x6E))
        ship.set_drive_damage_percent(lbx.read_byte(data, 0x6F))
        ship.set_computer_damage(lbx.read_byte(data, 0x70))
        ship.set_crew_quality(lbx.read_byte(data, 0x71))
        ship.set_crew_experience(lbx.read_short_int(data, 0x72))
        ship.set_officer_id(lbx.read_short_int(data, 0x74))
        ship.set_special_device_damage(data[0x76:0x7B])  # bit flag array
        ship.set_armor_damage(lbx.read_short_int(data, 0x7B))
        ship.set_structural_damage(lbx.read_short_int(data, 0x7D))
        ship.set_mission(lbx.read_byte(data, 0x7F))  # used for AI
        ship.set_just_built(lbx.read_byte(data, 0x80))

        return ship
Example #6
0
    def parse_one_ship(self, ship_id):
        SAVE_SHIPS_OFFSET         = 0x21f58
        SAVE_SHIP_RECORD_SIZE     = 0x81        # = 129
        offset          = SAVE_SHIPS_OFFSET + (SAVE_SHIP_RECORD_SIZE * ship_id)
        data = self.__data[offset:offset + SAVE_SHIP_RECORD_SIZE]

        ship = universe.Starship(ship_id)

        ship_design = self.parse_ship_design(offset)
        ship.set_name(ship_design['name'])
        ship.set_design(ship_design)
        ship.set_owner(lbx.read_byte(data, 0x63))
        ship.set_status(lbx.read_byte(data, 0x64))                               # 0 = orbitting, 2 = traveling, 5 = destroyed?
        ship.set_destination(lbx.read_short_int(data, 0x65) % 500)                             # destination star
        ship.set_x(lbx.read_short_int(data, 0x67))
        ship.set_y(lbx.read_short_int(data, 0x69))
        ship.set_group_has_navigator(lbx.read_byte(data, 0x6B))
        ship.set_travelling_speed(lbx.read_byte(data, 0x6C))     # possibly less than ftl_type
        ship.set_turns_left(lbx.read_byte(data, 0x6D))           # until arrival
        ship.set_shield_damage_percent(lbx.read_byte(data, 0x6E))
        ship.set_drive_damage_percent(lbx.read_byte(data, 0x6F))
        ship.set_computer_damage(lbx.read_byte(data, 0x70))
        ship.set_crew_quality(lbx.read_byte(data, 0x71))
        ship.set_crew_experience(lbx.read_short_int(data, 0x72))
        ship.set_officer_id(lbx.read_short_int(data, 0x74))
        ship.set_special_device_damage(data[0x76:0x7B]) # bit flag array
        ship.set_armor_damage(lbx.read_short_int(data, 0x7B))
        ship.set_structural_damage(lbx.read_short_int(data, 0x7D))
        ship.set_mission(lbx.read_byte(data, 0x7F))              # used for AI
        ship.set_just_built(lbx.read_byte(data, 0x80))

        return ship
Example #7
0
 def parse_galaxy(self):
     return {
         'size_factor':
         lbx.read_byte(self.__data, 0x31be4),
         'width':
         compose_int(ord(self.__data[0x31be9]), ord(self.__data[0x31bea])),
         'height':
         compose_int(ord(self.__data[0x31beb]), ord(self.__data[0x31bec])),
         'stardate':
         lbx.read_short_int(self.__data, 0x29),
     }
Example #8
0
    def import_from_moo2(self, data):

        self.__moo2data = data

        self.set_name(lbx.read_string(data, 0, 15))
        self.set_x(lbx.read_short_int(data, 0x0f))
        self.set_y(lbx.read_short_int(data, 0x11))
        self.set_size(lbx.read_byte(data, 0x13))
        self.__owner = lbx.read_byte(data, 0x14)		# primary owner
        self.set_pict_type(lbx.read_byte(data, 0x15))
        self.set_class(lbx.read_byte(data, 0x16))
        self.__last_planet_selected = [
            lbx.read_byte(data, 0x17),
            lbx.read_byte(data, 0x18),
            lbx.read_byte(data, 0x19),
            lbx.read_byte(data, 0x1A),
            lbx.read_byte(data, 0x1B),
            lbx.read_byte(data, 0x1C),
            lbx.read_byte(data, 0x1D),
            lbx.read_byte(data, 0x1E)
        ]

        self.__special = lbx.read_byte(data, 0x28)
        self.__wormhole = lbx.read_byte(data, 0x29)
        self.__blockaded_players = bitmask_to_player_id_list(ord(data[0x2a]))
        self.__blockaded_by_bitmask = [ord(data[0x2b]), ord(data[0x2c]), ord(data[0x2d]), ord(data[0x2e]), ord(data[0x2f]), ord(data[0x30]), ord(data[0x31]), ord(data[0x32])]
        self.__visited = ord(data[0x33])                # bitmask as boleans for each player
        self.__just_visited_bitmask = ord(data[0x34])           # players bitmask to track first visit of this star -> user should get report
        self.__ignore_colony_ship_bitmask = ord(data[0x35])     # players bitmask to track if player chose to not use a colony ship, cleared on every new colony ship here?
        self.__ignore_combat_bitmask = ord(data[0x36])  # players bitmask to track if player chose to ignore combat ships = perform blockade only do not fight here?
        self.__colonize_player = ord(data[0x37])        # 0..7 or -1
        self.__colonies_bitmask = ord(data[0x38])       # has colony / players bitmask / redundant info?
        self.__interdictors_bitmask = ord(data[0x39])   # has warp interdictor / players bitmask
        self.__next_wfi_in_list = ord(data[0x3a])       # bookeeping ???
        self.__tachyon_com_bitmask = ord(data[0x3b])    # has tachyon communicator / players bitmask
        self.__subspace_com_bitmask = ord(data[0x3c])   # has subspace communicator / players bitmask
        self.__stargates_bitmask = ord(data[0x3d])      # has stargate / players bitmask
        self.__jumpgates_bitmask = ord(data[0x3e])      # has jumpgate / players bitmask
        self.__artemis_bitmask = ord(data[0x3f])        # has artemis net players bitmask
        self.__portals_bitmask = ord(data[0x40])	# has dimension portal / players bitmask
        self.__stagepoint_bitmask = ord(data[0x41])	# bitvector tells whether star is stagepoint for each AI
        self.__players_officers = [ord(data[0x42]), ord(data[0x43]), ord(data[0x44]), ord(data[0x45]), ord(data[0x46]), ord(data[0x47]), ord(data[0x48]), ord(data[0x49])]
        self.set_objects([
                         lbx.read_short_int(data, 0x4a),
                         lbx.read_short_int(data, 0x4c),
                         lbx.read_short_int(data, 0x4e),
                         lbx.read_short_int(data, 0x50),
                         lbx.read_short_int(data, 0x52)
                         ])
        self.__surrender_to = [ord(data[0x67]), ord(data[0x68]), ord(data[0x69]), ord(data[0x6a]), ord(data[0x6b]), ord(data[0x6c]), ord(data[0x6d]), ord(data[0x6e])]
        self.__is_in_nebula = (ord(data[0x6f]) == 1)
Example #9
0
    def import_from_moo2(self, data):
        self.set_colony_id(lbx.read_short_int(data, 0x00))	# 0xffff = no colony here
        self.set_star(lbx.read_byte(data, 0x02))
        self.set_position(lbx.read_byte(data, 0x03))
        self.set_type(lbx.read_byte(data, 0x04))
        self.set_size(lbx.read_byte(data, 0x05))
        self.set_gravity(lbx.read_byte(data, 0x06))
#        self.set_group(lbx.read_byte(data, 0x07))   # not used ?
        self.set_terrain(lbx.read_byte(data, 0x08))
        self.set_picture(lbx.read_byte(data, 0x09))   # Background image on colony screen (0-5=image in planets.lbx)
        self.set_minerals(lbx.read_byte(data, 0x0a))
        self.set_foodbase(lbx.read_byte(data, 0x0b))
        self.set_terraformations(lbx.read_byte(data, 0x0c))
        self.set_max_farms(lbx.read_byte(data, 0x0d))   # unknown (Initial value is based on Planet Size but changes if colonized), 2=tiny, 4=small, 5=med, 7=large, A=huge
        self.set_max_population(lbx.read_byte(data, 0x0e))
        self.set_special(lbx.read_byte(data, 0x0f))
        self.set_flags(lbx.read_byte(data, 0x10))    # (bit 2 = Soil Enrichment)
Example #10
0
    def __old__parse_stars(self):

        for i in range(c):
            offset = SOLAR_SYSTEMS_DATA_OFFSET + (SOLAR_SYSTEM_RECORD_SIZE * i)
            systems = {}
            #            print "system @ %x" % offset
            star_id = i
            #            systems.append({
            systems[star_id] = {
                'id':
                i,
                'name':
                lbx.read_string(self.__data, offset, 15),
                'x':
                lbx.read_short_int(self.__data, offset + 0x0f),
                'y':
                lbx.read_short_int(self.__data, offset + 0x11),
                'size':
                lbx.read_byte(self.__data, offset + 0x13),
                'owner':
                lbx.read_byte(self.__data, offset + 0x14),  # primary owner
                'pict_type':
                lbx.read_byte(self.__data, offset + 0x15),
                'class':
                lbx.read_byte(self.__data, offset + 0x16),
                'last_planet_selected': [
                    lbx.read_byte(self.__data, offset + 0x17),
                    lbx.read_byte(self.__data, offset + 0x18),
                    lbx.read_byte(self.__data, offset + 0x19),
                    lbx.read_byte(self.__data, offset + 0x1A),
                    lbx.read_byte(self.__data, offset + 0x1B),
                    lbx.read_byte(self.__data, offset + 0x1C),
                    lbx.read_byte(self.__data, offset + 0x1D),
                    lbx.read_byte(self.__data, offset + 0x1E)
                ],
                'black_hole_blocks': [],
                '0x1f':
                ord(self.__data[offset + 0x1f]),
                '0x20':
                ord(self.__data[offset + 0x20]),
                '0x21':
                ord(self.__data[offset + 0x21]),
                '0x22':
                ord(self.__data[offset + 0x22]),
                '0x23':
                ord(self.__data[offset + 0x23]),
                '0x24':
                ord(self.__data[offset + 0x24]),
                '0x25':
                ord(self.__data[offset + 0x25]),
                '0x26':
                ord(self.__data[offset + 0x26]),
                '0x27':
                ord(self.__data[offset + 0x27]),
                'special':
                ord(self.__data[offset + 0x28]),
                'wormhole':
                ord(self.__data[offset + 0x29]),
                '0x2a':
                ord(self.__data[offset + 0x2a]),  # blockaded? ( 0 | 1 )
                '0x2b':
                ord(self.__data[offset + 0x2b]),
                '0x2c':
                ord(self.__data[offset + 0x2c]),
                '0x2d':
                ord(self.__data[offset + 0x2d]),
                '0x2e':
                ord(self.__data[offset + 0x2e]),
                '0x2f':
                ord(self.__data[offset + 0x2f]),
                '0x30':
                ord(self.__data[offset + 0x30]),
                '0x31':
                ord(self.__data[offset + 0x31]),
                '0x32':
                ord(self.__data[offset + 0x32]),
                'visited':
                ord(self.__data[offset +
                                0x33]),  # bitmask as boleans for each player
                '0x34':
                ord(self.__data[offset + 0x34]),
                '0x35':
                ord(self.__data[offset + 0x35]),
                '0x36':
                ord(self.__data[offset + 0x36]),
                '0x37':
                ord(self.__data[offset + 0x37]),
                '0x38':
                ord(self.__data[offset + 0x38]),
                'indictor':
                ord(
                    self.__data[offset + 0x39]
                ),  # 0 = none, 1-8 = owner player 0-7  ( http://code.google.com/p/moo2x/wiki/star )
                '0x3a':
                ord(self.__data[offset + 0x3a]),
                '0x3b':
                ord(self.__data[offset + 0x3b]),
                '0x3c':
                ord(self.__data[offset + 0x3c]),
                '0x3d':
                ord(self.__data[offset + 0x3d]),
                '0x3e':
                ord(self.__data[offset + 0x3e]),
                'artemis':
                ord(
                    self.__data[offset + 0x3f]
                ),  # 0 = none, 1-8=owner player 0-7 ( http://code.google.com/p/moo2x/wiki/star )
                '0x40':
                ord(self.__data[offset +
                                0x40]),  # Star has dimensional portal ?
                '0x41':
                ord(self.__data[offset + 0x41]),
                '0x42':
                ord(self.__data[offset + 0x42]),
                '0x43':
                ord(self.__data[offset + 0x43]),
                '0x44':
                ord(self.__data[offset + 0x44]),
                '0x45':
                ord(self.__data[offset + 0x45]),
                '0x46':
                ord(self.__data[offset + 0x46]),
                '0x47':
                ord(self.__data[offset + 0x47]),
                '0x48':
                ord(self.__data[offset + 0x48]),
                '0x49':
                ord(self.__data[offset + 0x49]),
                'objects': [
                    compose_int(ord(self.__data[offset + 0x4a]),
                                ord(self.__data[offset + 0x4b])),
                    compose_int(ord(self.__data[offset + 0x4c]),
                                ord(self.__data[offset + 0x4d])),
                    compose_int(ord(self.__data[offset + 0x4e]),
                                ord(self.__data[offset + 0x4f])),
                    compose_int(ord(self.__data[offset + 0x50]),
                                ord(self.__data[offset + 0x51])),
                    compose_int(ord(self.__data[offset + 0x52]),
                                ord(self.__data[offset + 0x53]))
                ],
                #		??? Relocation star id (0-7 player #, not sure about size of array. )
                '0x54':
                ord(self.__data[offset + 0x54]),
                '0x55':
                ord(self.__data[offset + 0x55]),
                '0x56':
                ord(self.__data[offset + 0x56]),
                '0x57':
                ord(self.__data[offset + 0x57]),
                '0x58':
                ord(self.__data[offset + 0x58]),
                '0x59':
                ord(self.__data[offset + 0x59]),
                '0x5a':
                ord(self.__data[offset + 0x5a]),
                '0x5b':
                ord(self.__data[offset + 0x5b]),
                '0x5c':
                ord(self.__data[offset + 0x5c]),
                '0x5d':
                ord(self.__data[offset + 0x5d]),
                '0x5e':
                ord(self.__data[offset + 0x5e]),
                '0x5f':
                ord(self.__data[offset + 0x5f]),
                '0x60':
                ord(self.__data[offset + 0x60]),
                '0x61':
                ord(self.__data[offset + 0x61]),
                '0x62':
                ord(self.__data[offset + 0x62]),
                '0x63':
                ord(self.__data[offset + 0x63]),
                #		unknown:
                '0x64':
                ord(self.__data[offset + 0x64]),
                '0x65':
                ord(self.__data[offset + 0x65]),
                '0x66':
                ord(self.__data[offset + 0x66]),
                '0x67':
                ord(self.__data[offset + 0x67]),
                '0x68':
                ord(self.__data[offset + 0x68]),
                '0x69':
                ord(self.__data[offset + 0x69]),
                '0x6a':
                ord(self.__data[offset + 0x6a]),
                '0x6b':
                ord(self.__data[offset + 0x6b]),
                '0x6c':
                ord(self.__data[offset + 0x6c]),
                '0x6d':
                ord(self.__data[offset + 0x6d]),
                '0x6e':
                ord(self.__data[offset + 0x6e]),
                '0x6f':
                ord(self.__data[offset + 0x6f]),
                '0x70':
                ord(self.__data[offset + 0x70])
            }
#        i += 1
#        offset = 0x17ad3 + (SOLAR_SYSTEM_RECORD_SIZE * i)
#        print "STOP system @ %x" % offset
#    blah
        return systems
Example #11
0
    def parse_heroes(self):
        HEROES_DATA_OFFSET = 0x19a9b
        HERO_RECORD_SIZE = 0x3b  # = 59
        heroes = {}
        for i in range(67):
            hero_id = i
            offset = HEROES_DATA_OFFSET + (HERO_RECORD_SIZE * i)

            #            print "hero @ %x" % offset

            type = lbx.read_byte(self.__data, offset + 0x23)
            common_skills = lbx.read_long_int(self.__data, offset + 0x26)
            special_skills = lbx.read_long_int(self.__data, offset + 0x2a)

            heroes[hero_id] = {
                'id':
                i,
                #                'name':             data[offset:offset + 0x0f].rstrip(chr(0)).split(chr(0))[0],
                'name':
                lbx.read_string(self.__data, offset, 15),
                #                'title':            data[offset + 0x0f:offset + 0x23].rstrip(chr(0)).split(chr(0))[0],
                'title':
                lbx.read_string(self.__data, offset, 35),
                'type':
                type,
                'experience':
                lbx.read_short_int(self.__data, offset + 0x24),
                'tech1':
                lbx.read_byte(self.__data, offset + 0x2e),
                'tech2':
                lbx.read_byte(self.__data, offset + 0x2f),
                'tech3':
                lbx.read_byte(self.__data, offset + 0x30),
                'picture':
                lbx.read_byte(self.__data, offset + 0x31),
                'skill_value':
                lbx.read_short_int(self.__data, offset + 0x32),
                'level':
                lbx.read_byte(self.__data, offset + 0x34),
                'location':
                lbx.read_short_int(self.__data, offset + 0x35),
                'eta':
                lbx.read_byte(self.__data, offset + 0x37),
                'level_up':
                lbx.read_byte(self.__data, offset + 0x38),
                'status':
                lbx.read_byte(self.__data, offset + 0x39),
                'player':
                lbx.read_byte(self.__data, offset + 0x3a),
                'skills':
                self.parse_hero_skills(type, common_skills, special_skills),
                'common_skills':
                common_skills,
                'special_skills':
                special_skills,
            }
#            if heroes[hero_id]['player'] == 0:
#                print "Moo2Savegame::parse_heroes ... hero_id = %i, name = %s" % (hero_id, heroes[hero_id]['name'])
#                print " * level = %i" % heroes[hero_id]['level']
#                print " * skill_value = %i" % heroes[hero_id]['skill_value']
#                print " * experience = %i" % heroes[hero_id]['experience']
#                print " * status = %i" % heroes[hero_id]['status']

#        i += 1
#        offset = 0x19a9b + (59 * i)
#        print "STOP hero @ %x" % offset
        return heroes
Example #12
0
    def __old__parse_stars(self):

        for i in range(c):
            offset = SOLAR_SYSTEMS_DATA_OFFSET + (SOLAR_SYSTEM_RECORD_SIZE * i)
            systems = {}
#            print "system @ %x" % offset
            star_id = i
#            systems.append({
            systems[star_id] = {
                'id':			i,
                'name':     		lbx.read_string(self.__data, offset, 15),
                'x':        		lbx.read_short_int(self.__data, offset + 0x0f),
                'y':        		lbx.read_short_int(self.__data, offset + 0x11),
                'size':     		lbx.read_byte(self.__data, offset + 0x13),
                'owner':			lbx.read_byte(self.__data, offset + 0x14),		# primary owner
                'pict_type':		lbx.read_byte(self.__data, offset + 0x15),
                'class':    		lbx.read_byte(self.__data, offset + 0x16),
                'last_planet_selected':	[
                                                lbx.read_byte(self.__data, offset + 0x17),
                                                lbx.read_byte(self.__data, offset + 0x18),
                                                lbx.read_byte(self.__data, offset + 0x19),
                                                lbx.read_byte(self.__data, offset + 0x1A),
                                                lbx.read_byte(self.__data, offset + 0x1B),
                                                lbx.read_byte(self.__data, offset + 0x1C),
                                                lbx.read_byte(self.__data, offset + 0x1D),
                                                lbx.read_byte(self.__data, offset + 0x1E)
                                            ],
                'black_hole_blocks':	[
                                            ],
                '0x1f':		ord(self.__data[offset + 0x1f]),
                '0x20':		ord(self.__data[offset + 0x20]),
                '0x21':		ord(self.__data[offset + 0x21]),
                '0x22':		ord(self.__data[offset + 0x22]),
                '0x23':		ord(self.__data[offset + 0x23]),
                '0x24':		ord(self.__data[offset + 0x24]),
                '0x25':		ord(self.__data[offset + 0x25]),
                '0x26':		ord(self.__data[offset + 0x26]),
                '0x27':		ord(self.__data[offset + 0x27]),
                'special':  	ord(self.__data[offset + 0x28]),
                'wormhole': 	ord(self.__data[offset + 0x29]),
                '0x2a':		ord(self.__data[offset + 0x2a]),	# blockaded? ( 0 | 1 )
                '0x2b':		ord(self.__data[offset + 0x2b]),
                '0x2c':		ord(self.__data[offset + 0x2c]),
                '0x2d':		ord(self.__data[offset + 0x2d]),
                '0x2e':		ord(self.__data[offset + 0x2e]),
                '0x2f':		ord(self.__data[offset + 0x2f]),
                '0x30':		ord(self.__data[offset + 0x30]),
                '0x31':		ord(self.__data[offset + 0x31]),
                '0x32':		ord(self.__data[offset + 0x32]),
                'visited':		ord(self.__data[offset + 0x33]),	# bitmask as boleans for each player
                '0x34':		ord(self.__data[offset + 0x34]),
                '0x35':		ord(self.__data[offset + 0x35]),
                '0x36':		ord(self.__data[offset + 0x36]),
                '0x37':		ord(self.__data[offset + 0x37]),
                '0x38':		ord(self.__data[offset + 0x38]),
                'indictor': 	ord(self.__data[offset + 0x39]),	# 0 = none, 1-8 = owner player 0-7  ( http://code.google.com/p/moo2x/wiki/star )
                '0x3a':		ord(self.__data[offset + 0x3a]),
                '0x3b':		ord(self.__data[offset + 0x3b]),
                '0x3c':		ord(self.__data[offset + 0x3c]),
                '0x3d':		ord(self.__data[offset + 0x3d]),
                '0x3e':		ord(self.__data[offset + 0x3e]),
                'artemis':  	ord(self.__data[offset + 0x3f]),	# 0 = none, 1-8=owner player 0-7 ( http://code.google.com/p/moo2x/wiki/star )
                '0x40':		ord(self.__data[offset + 0x40]),	# Star has dimensional portal ?
                '0x41':		ord(self.__data[offset + 0x41]),
                '0x42':		ord(self.__data[offset + 0x42]),
                '0x43':		ord(self.__data[offset + 0x43]),
                '0x44':		ord(self.__data[offset + 0x44]),
                '0x45':		ord(self.__data[offset + 0x45]),
                '0x46':		ord(self.__data[offset + 0x46]),
                '0x47':		ord(self.__data[offset + 0x47]),
                '0x48':		ord(self.__data[offset + 0x48]),
                '0x49':		ord(self.__data[offset + 0x49]),
                'objects':   	[
                                        compose_int(ord(self.__data[offset + 0x4a]), ord(self.__data[offset + 0x4b])),
                                        compose_int(ord(self.__data[offset + 0x4c]), ord(self.__data[offset + 0x4d])),
                                        compose_int(ord(self.__data[offset + 0x4e]), ord(self.__data[offset + 0x4f])),
                                        compose_int(ord(self.__data[offset + 0x50]), ord(self.__data[offset + 0x51])),
                                        compose_int(ord(self.__data[offset + 0x52]), ord(self.__data[offset + 0x53]))
                                    ],
    #		??? Relocation star id (0-7 player #, not sure about size of array. )
                '0x54':		ord(self.__data[offset + 0x54]),
                '0x55':		ord(self.__data[offset + 0x55]),
                '0x56':		ord(self.__data[offset + 0x56]),
                '0x57':		ord(self.__data[offset + 0x57]),
                '0x58':		ord(self.__data[offset + 0x58]),
                '0x59':		ord(self.__data[offset + 0x59]),
                '0x5a':		ord(self.__data[offset + 0x5a]),
                '0x5b':		ord(self.__data[offset + 0x5b]),
                '0x5c':		ord(self.__data[offset + 0x5c]),
                '0x5d':		ord(self.__data[offset + 0x5d]),
                '0x5e':		ord(self.__data[offset + 0x5e]),
                '0x5f':		ord(self.__data[offset + 0x5f]),
                '0x60':		ord(self.__data[offset + 0x60]),
                '0x61':		ord(self.__data[offset + 0x61]),
                '0x62':		ord(self.__data[offset + 0x62]),
                '0x63':		ord(self.__data[offset + 0x63]),
    #		unknown:
                '0x64':		ord(self.__data[offset + 0x64]),
                '0x65':		ord(self.__data[offset + 0x65]),
                '0x66':		ord(self.__data[offset + 0x66]),
                '0x67':		ord(self.__data[offset + 0x67]),
                '0x68':		ord(self.__data[offset + 0x68]),
                '0x69':		ord(self.__data[offset + 0x69]),
                '0x6a':		ord(self.__data[offset + 0x6a]),
                '0x6b':		ord(self.__data[offset + 0x6b]),
                '0x6c':		ord(self.__data[offset + 0x6c]),
                '0x6d':		ord(self.__data[offset + 0x6d]),
                '0x6e':		ord(self.__data[offset + 0x6e]),
                '0x6f':		ord(self.__data[offset + 0x6f]),
                '0x70':		ord(self.__data[offset + 0x70])
                }
#        i += 1
#        offset = 0x17ad3 + (SOLAR_SYSTEM_RECORD_SIZE * i)
#        print "STOP system @ %x" % offset
    #    blah
        return systems
Example #13
0
    def import_from_moo2(self, data):
        def read_population(data, population):
            colonists = {0x02: [], 0x03: [], 0x82: []}
            for i in range(population):
                offset = 0x0C + (4 * i)
                t = (lbx.read_char(data, offset)
                     & 0x80) + (lbx.read_char(data, offset + 1) & 3)
                colonists[t].append({
                    'a':
                    lbx.read_char(data, offset),
                    'b':
                    lbx.read_char(data, offset + 1),
                    'c':
                    lbx.read_char(data, offset + 2),
                    'd':
                    lbx.read_char(data, offset + 3),
                    'r1': (lbx.read_char(data, offset) & 0x70) >> 4,
                    'race': (lbx.read_char(data, offset) & 0x07)
                })
            return colonists

        # end func read_population

#	print "Colony::load_from_moo2()"
#	print "	data length: %i" % len(data)
#	self.colony_id			= colony_id
        self.set_owner(lbx.read_char(data, 0x000))
        #        print("     Colony::import_from_moo2() ... self.__owner = %i" % self.__owner)
        self.allocated_to = lbx.read_char(data, 0x001)
        self.set_planet_id(lbx.read_char(data, 0x002))
        #        print("     Colony::import_from_moo2() ... self.planet_id = %i" % self.planet_id)
        self.__officer = lbx.read_short_int(data, 0x004),  # not used ?
        self.__is_outpost = lbx.read_char(data, 0x006)
        #        print("     Colony::import_from_moo2() ... self.__is_outpost = %i" % self.__is_outpost)
        self.__morale = lbx.read_char(
            data, 0x007) * 5  # Morale value is stored as divided by 5
        self.__pollution = lbx.read_short_int(data, 0x008)
        self.set_population(lbx.read_char(data, 0x00a))
        print("     Colony::import_from_moo2() ... self.__population = %i" %
              self.get_population())
        self.assignment = lbx.read_char(data, 0x00b)
        #			0x00 = Agricultural Colony
        #			0x01 = Industrial Colony
        #			0x02 = Research Colony
        #			0xff = (balanced?) Colony
        #		0x00c ~ 0x0b3		colonists
        self.colonists = read_population(data, self.get_population())
        self.__pop_raised = [
            lbx.read_short_int(data, 0x0B4),  # race 0
            lbx.read_short_int(data, 0x0B6),  # race 1
            lbx.read_short_int(data, 0x0B8),  # race 2
            lbx.read_short_int(data, 0x0BA),  # race 3
            lbx.read_short_int(data, 0x0BC),  # race 4
            lbx.read_short_int(data, 0x0BE),  # race 5
            lbx.read_short_int(data, 0x0C0),  # race 6
            lbx.read_short_int(data, 0x0C2),  # race 7
            lbx.read_short_int(data, 0x0C4),  # androids
            lbx.read_short_int(data, 0x0C6)  # natives
        ]
        self.__pop_grow = [
            lbx.read_short_int(data, 0x0C8),  # race 0
            lbx.read_short_int(data, 0x0CA),  # race 1
            lbx.read_short_int(data, 0x0CC),  # race 2
            lbx.read_short_int(data, 0x0CE),  # race 3
            lbx.read_short_int(data, 0x0D0),  # race 4
            lbx.read_short_int(data, 0x0D2),  # race 5
            lbx.read_short_int(data, 0x0D4),  # race 6
            lbx.read_short_int(data, 0x0D6),  # race 7
            lbx.read_short_int(data, 0x0D8),  # androids
            lbx.read_short_int(data, 0x0DA)  # natives
        ]
        self.n_turns_existed = ord(data[0x0DC])  # bookeeping
        self.food2_per_farmer = ord(
            data[0x0DD])  # Food per farmer in half-units of food
        self.industry_per_worker = ord(data[0x0DE])
        self.research_per_scientist = ord(data[0x0DF])
        self.max_farms = ord(data[0x0E0])
        self.__max_population = ord(data[0x0E1])
        self.climate = ord(data[0x0E2])
        self.ground_strength = lbx.read_short_int(data,
                                                  0x0E3)  # calculated for ai
        self.space_strength = lbx.read_short_int(data,
                                                 0x0E5)  # calculated for ai
        self.set_food(lbx.read_short_int(
            data, 0x0E7))  # total food = food - population
        self.set_industry(lbx.read_short_int(data, 0x0E9))
        self.set_research(lbx.read_short_int(data, 0x0EB))
        #		0x0ed		?

        self.__build_queue = []
        for i in range(0, 14, 2):
            production_id = ord(data[0x115 + i])
            if production_id < 0xFF:
                self.__build_queue.append({
                    'production_id': production_id,
                    'flags': ord(data[0x115 + i + 1])
                })

#		0x115		building item #0				# 0x0b = colony base??? 0xf9 = spy? 0xfd = housing 0xfe = trade goods
#			0x0b = colony base
#			0xf9 = spy
#			0xfd = housing
#			0xfe = trade goods
#			0xff = nothing
#		0x116		?
#		0x117		building item #1				# 0x0b = colony base??? 0xf9 = spy?
#		0x118		?
#		0x119		building item #2				# 0x0b = colony base??? 0xf9 = spy?
#		0x11a		?
#		0x11b		building item #3				# 0x0b = colony base??? 0xf9 = spy?
#		0x11c		?
#		0x11d		building item #4				# 0x0b = colony base??? 0xf9 = spy?
#		0x11e		?
#		0x11f		building item #5				# 0x0b = colony base??? 0xf9 = spy?
#		0x120		?
#		0x121		building item #6				# 0x0b = colony base??? 0xf9 = spy?
#		0x122		?
        self.marines = lbx.read_char(data, 0x130)
        self.armors = lbx.read_char(data, 0x132)
        self.__buildings = []
        for b_id in range(1, 49):
            offset = 0x136 + b_id
            #            self.buildings.append(ord(data[offset]))
            if ord(data[offset]):
                self.__buildings.append(b_id)
Example #14
0
    def import_from_moo2(self, data):

        self.__moo2data = data

        self.set_name(lbx.read_string(data, 0, 15))
        self.set_x(lbx.read_short_int(data, 0x0f))
        self.set_y(lbx.read_short_int(data, 0x11))
        self.set_size(lbx.read_byte(data, 0x13))
        self.__owner = lbx.read_byte(data, 0x14)  # primary owner
        self.set_pict_type(lbx.read_byte(data, 0x15))
        self.set_class(lbx.read_byte(data, 0x16))
        self.__last_planet_selected = [
            lbx.read_byte(data, 0x17),
            lbx.read_byte(data, 0x18),
            lbx.read_byte(data, 0x19),
            lbx.read_byte(data, 0x1A),
            lbx.read_byte(data, 0x1B),
            lbx.read_byte(data, 0x1C),
            lbx.read_byte(data, 0x1D),
            lbx.read_byte(data, 0x1E)
        ]

        self.__special = lbx.read_byte(data, 0x28)
        self.__wormhole = lbx.read_byte(data, 0x29)
        self.__blockaded_players = bitmask_to_player_id_list(ord(data[0x2a]))
        self.__blockaded_by_bitmask = [
            ord(data[0x2b]),
            ord(data[0x2c]),
            ord(data[0x2d]),
            ord(data[0x2e]),
            ord(data[0x2f]),
            ord(data[0x30]),
            ord(data[0x31]),
            ord(data[0x32])
        ]
        self.__visited = ord(data[0x33])  # bitmask as boleans for each player
        self.__just_visited_bitmask = ord(
            data[0x34]
        )  # players bitmask to track first visit of this star -> user should get report
        self.__ignore_colony_ship_bitmask = ord(
            data[0x35]
        )  # players bitmask to track if player chose to not use a colony ship, cleared on every new colony ship here?
        self.__ignore_combat_bitmask = ord(
            data[0x36]
        )  # players bitmask to track if player chose to ignore combat ships = perform blockade only do not fight here?
        self.__colonize_player = ord(data[0x37])  # 0..7 or -1
        self.__colonies_bitmask = ord(
            data[0x38])  # has colony / players bitmask / redundant info?
        self.__interdictors_bitmask = ord(
            data[0x39])  # has warp interdictor / players bitmask
        self.__next_wfi_in_list = ord(data[0x3a])  # bookeeping ???
        self.__tachyon_com_bitmask = ord(
            data[0x3b])  # has tachyon communicator / players bitmask
        self.__subspace_com_bitmask = ord(
            data[0x3c])  # has subspace communicator / players bitmask
        self.__stargates_bitmask = ord(
            data[0x3d])  # has stargate / players bitmask
        self.__jumpgates_bitmask = ord(
            data[0x3e])  # has jumpgate / players bitmask
        self.__artemis_bitmask = ord(
            data[0x3f])  # has artemis net players bitmask
        self.__portals_bitmask = ord(
            data[0x40])  # has dimension portal / players bitmask
        self.__stagepoint_bitmask = ord(
            data[0x41]
        )  # bitvector tells whether star is stagepoint for each AI
        self.__players_officers = [
            ord(data[0x42]),
            ord(data[0x43]),
            ord(data[0x44]),
            ord(data[0x45]),
            ord(data[0x46]),
            ord(data[0x47]),
            ord(data[0x48]),
            ord(data[0x49])
        ]
        self.set_objects([
            lbx.read_short_int(data, 0x4a),
            lbx.read_short_int(data, 0x4c),
            lbx.read_short_int(data, 0x4e),
            lbx.read_short_int(data, 0x50),
            lbx.read_short_int(data, 0x52)
        ])
        self.__surrender_to = [
            ord(data[0x67]),
            ord(data[0x68]),
            ord(data[0x69]),
            ord(data[0x6a]),
            ord(data[0x6b]),
            ord(data[0x6c]),
            ord(data[0x6d]),
            ord(data[0x6e])
        ]
        self.__is_in_nebula = (ord(data[0x6f]) == 1)
Example #15
0
    def import_from_moo2(self, data):

        def read_population(data, population):
            colonists = {0x02: [], 0x03: [], 0x82: []}
            for i in range(population):
                offset = 0x0C + (4 * i)
                t = (lbx.read_char(data, offset) & 0x80) + (lbx.read_char(data, offset + 1) & 3)
    		colonists[t].append({
                    'a':	lbx.read_char(data, offset),
                    'b':	lbx.read_char(data, offset + 1),
                    'c':	lbx.read_char(data, offset + 2),
                    'd':	lbx.read_char(data, offset + 3),
                    'r1':	(lbx.read_char(data, offset) & 0x70) >> 4,
                    'race':	(lbx.read_char(data, offset) & 0x07)
                })
            return colonists
        # end func read_population

#	print "Colony::load_from_moo2()"
#	print "	data length: %i" % len(data)
#	self.colony_id			= colony_id
        self.set_owner(lbx.read_char(data,  0x000))
#        print("     Colony::import_from_moo2() ... self.__owner = %i" % self.__owner)
        self.allocated_to	= lbx.read_char(data,  0x001)
        self.set_planet_id(lbx.read_char(data,  0x002))
#        print("     Colony::import_from_moo2() ... self.planet_id = %i" % self.planet_id)
        self.__officer		= lbx.read_short_int(data, 0x004),   # not used ?
        self.__is_outpost	= lbx.read_char(data,  0x006)
#        print("     Colony::import_from_moo2() ... self.__is_outpost = %i" % self.__is_outpost)
        self.__morale		= lbx.read_char(data,  0x007) * 5 # Morale value is stored as divided by 5
        self.__pollution	= lbx.read_short_int(data, 0x008)
        self.set_population(lbx.read_char(data,  0x00a))
        print("     Colony::import_from_moo2() ... self.__population = %i" % self.get_population())
        self.assignment		= lbx.read_char(data,  0x00b)
#			0x00 = Agricultural Colony
#			0x01 = Industrial Colony
#			0x02 = Research Colony
#			0xff = (balanced?) Colony
#		0x00c ~ 0x0b3		colonists
        self.colonists		= read_population(data, self.get_population())
        self.__pop_raised		= [
                                    lbx.read_short_int(data, 0x0B4),	# race 0
                                    lbx.read_short_int(data, 0x0B6),	# race 1
                                    lbx.read_short_int(data, 0x0B8),	# race 2
                                    lbx.read_short_int(data, 0x0BA),	# race 3
                                    lbx.read_short_int(data, 0x0BC),	# race 4
                                    lbx.read_short_int(data, 0x0BE),	# race 5
                                    lbx.read_short_int(data, 0x0C0),	# race 6
                                    lbx.read_short_int(data, 0x0C2),	# race 7
                                    lbx.read_short_int(data, 0x0C4),	# androids
                                    lbx.read_short_int(data, 0x0C6)	# natives
                                ]
        self.__pop_grow		= [
                                    lbx.read_short_int(data, 0x0C8),	# race 0
                                    lbx.read_short_int(data, 0x0CA),	# race 1
                                    lbx.read_short_int(data, 0x0CC),	# race 2
                                    lbx.read_short_int(data, 0x0CE),	# race 3
                                    lbx.read_short_int(data, 0x0D0),	# race 4
                                    lbx.read_short_int(data, 0x0D2),	# race 5
                                    lbx.read_short_int(data, 0x0D4),	# race 6
                                    lbx.read_short_int(data, 0x0D6),	# race 7
                                    lbx.read_short_int(data, 0x0D8),	# androids
                                    lbx.read_short_int(data, 0x0DA)	# natives
                                ]
        self.n_turns_existed		= ord(data[0x0DC])	# bookeeping
        self.food2_per_farmer		= ord(data[0x0DD])	# Food per farmer in half-units of food
        self.industry_per_worker	= ord(data[0x0DE])
        self.research_per_scientist	= ord(data[0x0DF])
        self.max_farms			= ord(data[0x0E0])
        self.__max_population		= ord(data[0x0E1])
        self.climate			= ord(data[0x0E2])
        self.ground_strength		= lbx.read_short_int(data, 0x0E3)	# calculated for ai
        self.space_strength		= lbx.read_short_int(data, 0x0E5)	# calculated for ai
        self.set_food(lbx.read_short_int(data, 0x0E7))	# total food = food - population
        self.set_industry(lbx.read_short_int(data, 0x0E9))
        self.set_research(lbx.read_short_int(data, 0x0EB))
#		0x0ed		?

        self.__build_queue = []
        for i in range(0, 14, 2):
            production_id = ord(data[0x115 + i])
            if production_id < 0xFF:
                self.__build_queue.append({'production_id': production_id, 'flags': ord(data[0x115 + i + 1])})
        
#		0x115		building item #0				# 0x0b = colony base??? 0xf9 = spy? 0xfd = housing 0xfe = trade goods
#			0x0b = colony base
#			0xf9 = spy
#			0xfd = housing
#			0xfe = trade goods
#			0xff = nothing
#		0x116		?
#		0x117		building item #1				# 0x0b = colony base??? 0xf9 = spy?
#		0x118		?
#		0x119		building item #2				# 0x0b = colony base??? 0xf9 = spy?
#		0x11a		?
#		0x11b		building item #3				# 0x0b = colony base??? 0xf9 = spy?
#		0x11c		?
#		0x11d		building item #4				# 0x0b = colony base??? 0xf9 = spy?
#		0x11e		?
#		0x11f		building item #5				# 0x0b = colony base??? 0xf9 = spy?
#		0x120		?
#		0x121		building item #6				# 0x0b = colony base??? 0xf9 = spy?
#		0x122		?
        self.marines			= lbx.read_char(data, 0x130)
        self.armors			= lbx.read_char(data, 0x132)
        self.__buildings			= []
        for b_id in range(1, 49):
    	    offset = 0x136 + b_id
#            self.buildings.append(ord(data[offset]))
            if ord(data[offset]):
                self.__buildings.append(b_id)