func (self *mapBuilder) addRoom(room types.Room, x int, y int, z int) { x = x * 2 y = y * 2 addIfExists := func(dir types.Direction, x int, y int) { if x < 0 || y < 0 { return } if room.HasExit(dir) { self.data[z][y][x].addExit(dir) } } if self.userRoom.GetId() == room.GetId() { self.data[z][y][x].char = '*' self.data[z][y][x].color = types.ColorRed } else { self.data[z][y][x].color = types.ColorMagenta if room.HasExit(types.DirectionUp) && room.HasExit(types.DirectionDown) { self.data[z][y][x].char = '+' } else if room.HasExit(types.DirectionUp) { self.data[z][y][x].char = '^' } else if room.HasExit(types.DirectionDown) { self.data[z][y][x].char = 'v' } else { char := '#' /* count := len(model.CharactersIn(room.GetId())) if count < 10 { char = rune(strconv.Itoa(count)[0]) } */ self.data[z][y][x].char = char self.data[z][y][x].color = types.ColorWhite } } addIfExists(types.DirectionNorth, x, y-1) addIfExists(types.DirectionNorthEast, x+1, y-1) addIfExists(types.DirectionEast, x+1, y) addIfExists(types.DirectionSouthEast, x+1, y+1) addIfExists(types.DirectionSouth, x, y+1) addIfExists(types.DirectionSouthWest, x-1, y+1) addIfExists(types.DirectionWest, x-1, y) addIfExists(types.DirectionNorthWest, x-1, y-1) }