Esempio n. 1
0
def read_exit(version, infileobj):
	new_exit = Exit()
	if version >= 041:
		new_exit.exitFlags = exitflags.bits_to_flag_set(read_uint16(infileobj))
	else:
		new_exit.exitFlags = exitflags.bits_to_flag_set(read_uint8(infileobj))
	if version >= 040:
		new_exit.doorFlags = doorflags.bits_to_flag_set(read_uint16(infileobj))
	else:
		new_exit.doorFlags = doorflags.bits_to_flag_set(read_uint8(infileobj))
	new_exit.door = read_qstring(infileobj)
	if "door" in new_exit.exitFlags:
		new_exit.exitFlags.add("exit")
		if not new_exit.door:
			new_exit.door = "exit"
	# Inbound connections are unneeded.
	connection = read_uint32(infileobj)
	while connection != UINT32_MAX:
		connection = read_uint32(infileobj)
	outConnections = []
	connection = read_uint32(infileobj)
	while connection != UINT32_MAX:
		outConnections.append(str(connection))
		connection = read_uint32(infileobj)
	if not outConnections:
		new_exit.to = "undefined"
	else:
		# We want the last outbound connection.
		new_exit.to = outConnections[-1]
	return new_exit
Esempio n. 2
0
def read_exit(infileobj):
	new_exit = Exit()
	new_exit.exitFlags = exitflags.bits_to_flag_set(read_uint8(infileobj))
	new_exit.doorFlags = doorflags.bits_to_flag_set(read_uint8(infileobj))
	new_exit.door = read_qstring(infileobj)
	if "door" in new_exit.exitFlags:
		new_exit.exitFlags.add("exit")
		if not new_exit.door:
			new_exit.door = "exit"
	# Inbound connections are unneeded.
	connection = read_uint32(infileobj)
	while connection != UINT_MAX:
		connection = read_uint32(infileobj)
	outConnections = []
	connection = read_uint32(infileobj)
	while connection != UINT_MAX:
		outConnections.append(str(connection))
		connection = read_uint32(infileobj)
	if not outConnections:
		new_exit.to = "UNDEFINED"
	else:
		# We want the last outbound connection.
		new_exit.to = outConnections[-1]
	return new_exit