// File: Doug0855[P]TigerZone/Board.cpp
// Function: Board::getStructures(int, int)
std::vector<Structure> Board::getStructures(int row, int col) {
	//debugging std::cout<<"IN GET STRUCTURES FOR "<<row<<' '<<col<<std::endl;
	std::vector<Structure> structures;
	Tile* tile = m_board[row][col];
	std::vector< std::vector<Block> > tileBlocks = tile->getInnerBlocks();
	for(int i = 0; i < 3; i++) {
		for(int j = 0; j < 3; j++) {
			if(!(tileBlocks[i][j].isVisited())) {
				// For each block within the tile we will check it's type and build the structure from there with a Breadth first search
				if(tileBlocks[i][j].getType() == "jungle" || tileBlocks[i][j].getType() == "mixed") {
					Structure struc = checkJungle(tile, tileBlocks, std::pair<int,int>(i,j));
					structures.push_back(struc);
				}
				else if(tileBlocks[i][j].getType() == "lake") {
					Structure struc = checkLake(tile, tileBlocks, std::pair<int,int>(i,j));
					structures.push_back(struc);
				}
				else if(tileBlocks[i][j].getType() == "trail") {
					Structure struc = checkTrail(tile, tileBlocks, std::pair<int,int>(i,j));
					structures.push_back(struc);
				}
			}
		}
	}
	for(int i = 0; i < structures.size(); i++) {
		for(int j = 0; j < structures[i].structureBlocks.size(); j++) {
			structures[i].structureBlocks[j].unVisit();
		}
	}
	//debugging for(int i = 0; i < structures.size(); i++) {
	//debugging 	std::cout<<"Structure is of type "<<structures[i].type<<" with "<<structures[i].structureBlocks.size()
	//debugging 	<<" blocks and starting block at "<<structures[i].startingBlock.first<<' '<<structures[i].startingBlock.second<<std::endl;
	//debugging 	std::cout<<" and how many buffalo? : "<<structures[i].buffaloCount<<std::endl;
	//debugging }
	//debugging std::cout<<"Structures size is "<<structures.size()<<std::endl;
	return structures;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x260, %rsp            # imm = 0x260
movq %rdi, -0x220(%rbp)
movq %rdi, %rax
movq %rax, -0x218(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x210(%rbp)
movb $0x0, -0x19(%rbp)
callq 0x20870
movq -0x210(%rbp), %rdi
movslq -0x14(%rbp), %rsi
callq 0x81d0
movq %rax, %rdi
movslq -0x18(%rbp), %rsi
callq 0x8230
movq (%rax), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x206d0
jmp 0x1c0f0
movl $0x0, -0x50(%rbp)
cmpl $0x3, -0x50(%rbp)
jge 0x1c55c
movl $0x0, -0x54(%rbp)
cmpl $0x3, -0x54(%rbp)
jge 0x1c54c
movslq -0x50(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x17390
movq %rax, %rdi
movslq -0x54(%rbp), %rsi
callq 0x173b0
movq %rax, %rdi
callq 0x20630
movb %al, -0x221(%rbp)
jmp 0x1c13b
movb -0x221(%rbp), %al
testb $0x1, %al
jne 0x1c53c
jmp 0x1c14b
movslq -0x50(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x17390
movq %rax, %rdi
movslq -0x54(%rbp), %rsi
callq 0x173b0
movq %rax, %rsi
movb $0x0, -0x99(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x15490
jmp 0x1c179
leaq 0xd527(%rip), %rsi      # 0x296a7
leaq -0x78(%rbp), %rdi
callq 0x85b0
movb %al, -0x222(%rbp)
jmp 0x1c191
movb -0x222(%rbp), %cl
movb $0x1, %al
testb $0x1, %cl
movb %al, -0x223(%rbp)
jne 0x1c200
jmp 0x1c1a6
movslq -0x50(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x17390
movq %rax, %rdi
movslq -0x54(%rbp), %rsi
callq 0x173b0
movq %rax, %rsi
leaq -0x98(%rbp), %rdi
callq 0x15490
jmp 0x1c1d0
movb $0x1, -0x99(%rbp)
leaq 0xd5b2(%rip), %rsi      # 0x29790
leaq -0x98(%rbp), %rdi
callq 0x85b0
movb %al, -0x224(%rbp)
jmp 0x1c1f2
movb -0x224(%rbp), %al
movb %al, -0x223(%rbp)
jmp 0x1c200
movb -0x223(%rbp), %al
movb %al, -0x225(%rbp)
testb $0x1, -0x99(%rbp)
jne 0x1c217
jmp 0x1c223
leaq -0x98(%rbp), %rdi
callq 0x3210
leaq -0x78(%rbp), %rdi
callq 0x3210
movb -0x225(%rbp), %al
testb $0x1, %al
jne 0x1c23b
jmp 0x1c329
movq -0x28(%rbp), %rax
movq %rax, -0x230(%rbp)
leaq -0x100(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x54(%rbp), %rdx
callq 0x119c0
jmp 0x1c25c
movq -0x230(%rbp), %rdx
movq -0x210(%rbp), %rsi
movq -0x100(%rbp), %r8
leaq -0xf8(%rbp), %rdi
leaq -0x40(%rbp), %rcx
callq 0x1c6e0
jmp 0x1c283
movq -0x220(%rbp), %rdi
leaq -0xf8(%rbp), %rsi
callq 0x20890
jmp 0x1c298
leaq -0xf8(%rbp), %rdi
callq 0x28730
jmp 0x1c53a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1c66e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1c647
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x1c2fe
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
testb $0x1, -0x99(%rbp)
jne 0x1c2f0
jmp 0x1c2fc
leaq -0x98(%rbp), %rdi
callq 0x3210
jmp 0x1c2fe
leaq -0x78(%rbp), %rdi
callq 0x3210
jmp 0x1c647
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x28730
jmp 0x1c647
movslq -0x50(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x17390
movq %rax, %rdi
movslq -0x54(%rbp), %rsi
callq 0x173b0
movq %rax, %rsi
leaq -0x120(%rbp), %rdi
callq 0x15490
jmp 0x1c353
leaq 0xd354(%rip), %rsi      # 0x296ae
leaq -0x120(%rbp), %rdi
callq 0x85b0
movb %al, -0x231(%rbp)
jmp 0x1c36e
leaq -0x120(%rbp), %rdi
callq 0x3210
movb -0x231(%rbp), %al
testb $0x1, %al
jne 0x1c389
jmp 0x1c431
movq -0x28(%rbp), %rax
movq %rax, -0x240(%rbp)
leaq -0x180(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x54(%rbp), %rdx
callq 0x119c0
jmp 0x1c3aa
movq -0x240(%rbp), %rdx
movq -0x210(%rbp), %rsi
movq -0x180(%rbp), %r8
leaq -0x178(%rbp), %rdi
leaq -0x40(%rbp), %rcx
callq 0x1e020
jmp 0x1c3d1
movq -0x220(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x20890
jmp 0x1c3e6
leaq -0x178(%rbp), %rdi
callq 0x28730
jmp 0x1c538
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x3210
jmp 0x1c647
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x178(%rbp), %rdi
callq 0x28730
jmp 0x1c647
movslq -0x50(%rbp), %rsi
leaq -0x40(%rbp), %rdi
callq 0x17390
movq %rax, %rdi
movslq -0x54(%rbp), %rsi
callq 0x173b0
movq %rax, %rsi
leaq -0x1a0(%rbp), %rdi
callq 0x15490
jmp 0x1c45b
leaq 0xd251(%rip), %rsi      # 0x296b3
leaq -0x1a0(%rbp), %rdi
callq 0x85b0
movb %al, -0x241(%rbp)
jmp 0x1c476
leaq -0x1a0(%rbp), %rdi
callq 0x3210
movb -0x241(%rbp), %al
testb $0x1, %al
jne 0x1c491
jmp 0x1c536
movq -0x28(%rbp), %rax
movq %rax, -0x250(%rbp)
leaq -0x200(%rbp), %rdi
leaq -0x50(%rbp), %rsi
leaq -0x54(%rbp), %rdx
callq 0x119c0
jmp 0x1c4b2
movq -0x250(%rbp), %rdx
movq -0x210(%rbp), %rsi
movq -0x200(%rbp), %r8
leaq -0x1f8(%rbp), %rdi
leaq -0x40(%rbp), %rcx
callq 0x1ef60
jmp 0x1c4d9
movq -0x220(%rbp), %rdi
leaq -0x1f8(%rbp), %rsi
callq 0x20890
jmp 0x1c4ee
leaq -0x1f8(%rbp), %rdi
callq 0x28730
jmp 0x1c536
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x3210
jmp 0x1c647
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1f8(%rbp), %rdi
callq 0x28730
jmp 0x1c647
jmp 0x1c538
jmp 0x1c53a
jmp 0x1c53c
jmp 0x1c53e
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x1c108
jmp 0x1c54e
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x1c0f7
movl $0x0, -0x204(%rbp)
movq -0x220(%rbp), %rdi
movslq -0x204(%rbp), %rax
movq %rax, -0x258(%rbp)
callq 0x154c0
movq %rax, %rcx
movq -0x258(%rbp), %rax
cmpq %rcx, %rax
jae 0x1c632
movl $0x0, -0x208(%rbp)
movq -0x220(%rbp), %rdi
movslq -0x208(%rbp), %rax
movq %rax, -0x260(%rbp)
movslq -0x204(%rbp), %rsi
callq 0x154f0
movq %rax, %rdi
addq $0x28, %rdi
callq 0x96e0
movq %rax, %rcx
movq -0x260(%rbp), %rax
cmpq %rcx, %rax
jae 0x1c61c
movq -0x220(%rbp), %rdi
movslq -0x204(%rbp), %rsi
callq 0x154f0
movq %rax, %rdi
addq $0x28, %rdi
movslq -0x208(%rbp), %rsi
callq 0x173b0
movq %rax, %rdi
callq 0x20900
jmp 0x1c609
jmp 0x1c60b
movl -0x208(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x208(%rbp)
jmp 0x1c59d
jmp 0x1c61e
movl -0x204(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x204(%rbp)
jmp 0x1c566
movb $0x1, -0x19(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x20710
testb $0x1, -0x19(%rbp)
jne 0x1c65e
jmp 0x1c652
leaq -0x40(%rbp), %rdi
callq 0x20710
jmp 0x1c66e
movq -0x220(%rbp), %rdi
callq 0x155a0
movq -0x218(%rbp), %rax
addq $0x260, %rsp            # imm = 0x260
popq %rbp
retq
movq -0x220(%rbp), %rdi
callq 0x155a0
movq -0x48(%rbp), %rdi
callq 0x34f0
nopw %cs:(%rax,%rax)