// File: /workspace/github_cpp_makefile_star2_O2/matallui[P]nibble-curses/src/CNibbles.cpp
// Function: CNibbles::CNibbles()
CNibbles::CNibbles ( void )
	: m_exception ( "" )
{
  m_maxLines = 36;
  m_maxCols = 100;
  m_level = 0;
  m_num_obstacles = 0;
  m_nplayers = 0;
  m_mode = 0;				// 1-Single Player , 2-Multi-player on PC, 3-Multi-player over Network
  m_speed = 0;				// game speed
  m_nfood = 0;				// food number
  m_score = 0;				// global score ( sum of all player scores )
  m_snakes = new CSnake* [2];		// pointer array to control game players
  m_snakes[0] = m_snakes[1] = NULL;
  m_socket = NULL;			// pointer to socket
  m_master = true;			// determines who is the server / player 1 ( = true )
  
  srand(time(NULL));	// initialize seed
  
  // initialize ncurses
  initscr ();
  nodelay ( stdscr, true );
  if ( getenv("ESCDELAY") == NULL ) ESCDELAY = 25;
  keypad ( stdscr, true );
  noecho ();
  curs_set (0);
  start_color();
  init_pair ( 1, COLOR_BLACK, COLOR_BLACK );	// for erasing
  init_pair ( 2, COLOR_YELLOW, COLOR_YELLOW );	// for obstacles
  init_pair ( 3, COLOR_WHITE, COLOR_BLACK );	// for scores
  init_pair ( 4, COLOR_GREEN, COLOR_BLACK );	// for player 1
  init_pair ( 5, COLOR_BLUE, COLOR_BLACK );	// for player 2
  init_pair ( 6, COLOR_RED, COLOR_WHITE );	// for pop-up windows
  
  // allocate memory for obstacles and set their colors
  m_obstacles = new CObstacle [20];
  for ( int i = 0; i < 20; i++ )
    m_obstacles[i].SetColors( 2, 1 );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %r12
addq $0x38, %rdi
leaq -0x58(%rbp), %rsi
andl $0x0, (%rsi)
leaq -0x30(%rbp), %rdx
andl $0x0, (%rdx)
callq 0x3778
leaq 0x3809(%rip), %rsi      # 0x83ab
leaq -0x58(%rbp), %rdi
leaq -0x30(%rbp), %rdx
callq 0x369c
leaq 0x50(%r12), %r14
leaq -0x58(%rbp), %rsi
movq %r14, %rdi
callq 0x361a
leaq -0x58(%rbp), %rdi
callq 0x3150
movabsq $0x6400000024, %rax     # imm = 0x6400000024
movq %rax, (%r12)
andq $0x0, 0x1c(%r12)
andl $0x0, 0x40(%r12)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r12)
pushq $0x10
popq %rdi
movq %r14, -0x60(%rbp)
callq 0x3030
movq %rax, 0x30(%r12)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x48(%r12)
movb $0x1, 0x18(%r12)
xorl %edi, %edi
callq 0x3250
movl %eax, %edi
callq 0x3260
callq 0x33b0
movq 0x73a7(%rip), %rbx      # 0xbfd0
movq (%rbx), %rdi
pushq $0x1
popq %rsi
callq 0x31b0
leaq 0x35db(%rip), %rdi      # 0x8216
callq 0x3320
testq %rax, %rax
jne 0x4c52
movq 0x7374(%rip), %rax      # 0xbfc0
movl $0x19, (%rax)
movq (%rbx), %rdi
pushq $0x1
popq %rsi
callq 0x3110
callq 0x3300
xorl %edi, %edi
callq 0x3200
callq 0x3070
pushq $0x1
popq %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3050
pushq $0x2
popq %rdi
pushq $0x3
popq %rdx
movl %edx, %esi
callq 0x3050
pushq $0x3
popq %rdi
pushq $0x7
popq %rsi
xorl %edx, %edx
callq 0x3050
pushq $0x4
popq %rdi
pushq $0x2
popq %rsi
xorl %edx, %edx
callq 0x3050
pushq $0x5
popq %rdi
pushq $0x4
popq %rsi
xorl %edx, %edx
callq 0x3050
pushq $0x6
popq %rdi
pushq $0x1
popq %rsi
pushq $0x7
popq %rdx
callq 0x3050
movl $0x1e0, %edi            # imm = 0x1E0
callq 0x3030
movq %rax, %r15
movq %r12, -0x68(%rbp)
xorl %r12d, %r12d
leaq -0x30(%rbp), %r13
leaq -0x34(%rbp), %rbx
leaq -0x29(%rbp), %r14
andl $0x0, -0x58(%rbp)
leaq (%r15,%r12), %rdi
andl $0x0, -0x30(%rbp)
andl $0x0, -0x34(%rbp)
movb $0x48, -0x29(%rbp)
leaq -0x58(%rbp), %rsi
movq %r13, %rdx
movq %rbx, %rcx
movq %r14, %r8
callq 0x3858
addq $0x18, %r12
cmpq $0x1e0, %r12            # imm = 0x1E0
jne 0x4cdc
movq -0x68(%rbp), %r12
movq %r15, 0x28(%r12)
xorl %r15d, %r15d
leaq -0x58(%rbp), %rbx
leaq -0x30(%rbp), %r14
cmpq $0x1e0, %r15            # imm = 0x1E0
je 0x4d53
movq 0x28(%r12), %rdi
addq %r15, %rdi
movl $0x2, -0x58(%rbp)
movl $0x1, -0x30(%rbp)
movq %rbx, %rsi
movq %r14, %rdx
callq 0x38d6
addq $0x18, %r15
jmp 0x4d23
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq -0x58(%rbp), %rdi
jmp 0x4d8b
movq %rax, %r14
jmp 0x4d90
jmp 0x4d72
movq %rax, %r14
jmp 0x4d87
movq %rax, %r14
movl $0x1e0, %esi            # imm = 0x1E0
movq %r15, %rdi
callq 0x3440
movq -0x60(%rbp), %rdi
callq 0x3150
movq %r14, %rdi
callq 0x3420