Returns a fully rendered map of the area
(centerRoomId int, c Config)
| 797 | |
| 798 | // Returns a fully rendered map of the area |
| 799 | func (r *mapper) GetFullMap(centerRoomId int, c Config) mapRender { |
| 800 | |
| 801 | if c.ZoomLevel < 0 { |
| 802 | c.ZoomLevel = 0 |
| 803 | } |
| 804 | c.ZoomLevel++ |
| 805 | if c.ZoomLevel < 2 { |
| 806 | c.ZoomLevel = 2 |
| 807 | } |
| 808 | |
| 809 | out := newMapRender(c.Width, c.Height) |
| 810 | |
| 811 | node := r.crawledRooms[centerRoomId] |
| 812 | |
| 813 | if node == nil { |
| 814 | return out |
| 815 | } |
| 816 | |
| 817 | srcPos := positionDelta{ |
| 818 | x: node.Pos.x + r.roomGrid.roomOffset.x - int(math.Ceil(float64(c.Width)/float64(c.ZoomLevel)))>>1, |
| 819 | y: node.Pos.y + r.roomGrid.roomOffset.y - int(math.Ceil(float64(c.Height)/float64(c.ZoomLevel)))>>1, |
| 820 | z: node.Pos.z + r.roomGrid.roomOffset.z, |
| 821 | } |
| 822 | |
| 823 | dstPos := positionDelta{ |
| 824 | x: 0, |
| 825 | y: 0, |
| 826 | z: 0, |
| 827 | } |
| 828 | |
| 829 | srcEndX := srcPos.x + int(math.Ceil(float64(c.Width)/float64(c.ZoomLevel))) |
| 830 | srcEndY := srcPos.y + int(math.Ceil(float64(c.Height)/float64(c.ZoomLevel))) |
| 831 | |
| 832 | // Make sure we don't try and draw from beyond the grid |
| 833 | if srcPos.x < 0 { |
| 834 | dstPos.x = (srcPos.x * -1) * c.ZoomLevel |
| 835 | srcPos.x = 0 |
| 836 | } |
| 837 | |
| 838 | if srcPos.y < 0 { |
| 839 | dstPos.y = srcPos.y * -1 * c.ZoomLevel |
| 840 | srcPos.y = 0 |
| 841 | } |
| 842 | |
| 843 | if srcEndX > r.roomGrid.size.x-1 { |
| 844 | srcEndX = r.roomGrid.size.x - 1 |
| 845 | } |
| 846 | |
| 847 | if srcEndY > r.roomGrid.size.y-1 { |
| 848 | srcEndY = r.roomGrid.size.y - 1 |
| 849 | } |
| 850 | |
| 851 | drawX, drawY := 0, 0 |
| 852 | z := srcPos.z |
| 853 | |
| 854 | var symbol rune |
| 855 | var legend string |
| 856 |
nothing calls this directly
no test coverage detected