// File: /workspace/github_cpp_makefile_star2_O1/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 $0x38, %rsp
movq %rdi, %r14
addq $0x38, %rdi
xorl %eax, %eax
leaq -0x60(%rbp), %rsi
movl %eax, (%rsi)
leaq -0x30(%rbp), %rdx
movl %eax, (%rdx)
callq 0x3804
leaq -0x50(%rbp), %rbx
movq %rbx, -0x10(%rbx)
leaq 0x45d1(%rip), %rdx      # 0x93ab
leaq -0x60(%rbp), %rdi
movq %rdx, %rsi
callq 0x376a
leaq 0x50(%r14), %rdi
leaq -0x60(%rbp), %rsi
callq 0x35f8
movq -0x60(%rbp), %rdi
cmpq %rbx, %rdi
je 0x4e08
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x3280
movabsq $0x6400000024, %rax     # imm = 0x6400000024
movq %rax, (%r14)
movq $0x0, 0x1c(%r14)
movl $0x0, 0x40(%r14)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%r14)
movl $0x10, %edi
movq %r14, -0x40(%rbp)
callq 0x3030
movq %rax, 0x30(%r14)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x48(%r14)
movb $0x1, 0x18(%r14)
xorl %edi, %edi
callq 0x3230
movl %eax, %edi
callq 0x3240
callq 0x3390
movq 0x8164(%rip), %rbx      # 0xcfd0
movq (%rbx), %rdi
movl $0x1, %esi
callq 0x3190
leaq 0x4396(%rip), %rdi      # 0x9216
callq 0x3310
testq %rax, %rax
jne 0x4e97
movq 0x812f(%rip), %rax      # 0xcfc0
movl $0x19, (%rax)
movq (%rbx), %rdi
movl $0x1, %esi
callq 0x3120
callq 0x32f0
xorl %edi, %edi
callq 0x31f0
callq 0x3080
movl $0x1, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x3060
movl $0x2, %edi
movl $0x3, %esi
movl $0x3, %edx
callq 0x3060
movl $0x3, %edi
movl $0x7, %esi
xorl %edx, %edx
callq 0x3060
movl $0x4, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x3060
movl $0x5, %edi
movl $0x4, %esi
xorl %edx, %edx
callq 0x3060
movl $0x6, %edi
movl $0x1, %esi
movl $0x7, %edx
callq 0x3060
movl $0x1e0, %edi            # imm = 0x1E0
callq 0x3030
movq %rax, %r15
xorl %r14d, %r14d
leaq -0x34(%rbp), %r13
leaq -0x29(%rbp), %rbx
xorl %r12d, %r12d
leaq (%r15,%r12), %rdi
movl %r14d, -0x60(%rbp)
movl %r14d, -0x30(%rbp)
movl %r14d, -0x34(%rbp)
movb $0x48, -0x29(%rbp)
leaq -0x60(%rbp), %rsi
leaq -0x30(%rbp), %rdx
movq %r13, %rcx
movq %rbx, %r8
callq 0x38e4
addq $0x18, %r12
cmpq $0x1e0, %r12            # imm = 0x1E0
jne 0x4f39
movq -0x40(%rbp), %r12
movq %r15, 0x28(%r12)
xorl %r15d, %r15d
leaq -0x60(%rbp), %rbx
leaq -0x30(%rbp), %r14
movq 0x28(%r12), %rdi
addq %r15, %rdi
movl $0x2, -0x60(%rbp)
movl $0x1, -0x30(%rbp)
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3962
addq $0x18, %r15
cmpq $0x1e0, %r15            # imm = 0x1E0
jne 0x4f81
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq -0x60(%rbp), %rdi
cmpq %rbx, %rdi
je 0x5008
movq -0x50(%rbp), %rsi
jmp 0x5000
movq %rax, %r14
jmp 0x5008
jmp 0x4fd7
movq %rax, %r14
jmp 0x4fec
movq %rax, %r14
movl $0x1e0, %esi            # imm = 0x1E0
movq %r15, %rdi
callq 0x3420
movq -0x40(%rbp), %rcx
movq 0x50(%rcx), %rdi
addq $0x60, %rcx
cmpq %rcx, %rdi
je 0x5008
movq (%rcx), %rsi
incq %rsi
callq 0x3280
movq %r14, %rdi
callq 0x3400