// File: /workspace/github_cpp_makefile_star2_O2/rcolomina[P]the_charmed_house/src/manager.cpp
// Function: Manager::Manager()
Manager::Manager():dt(freq),
                   tiempo(0),
                   continuar_loop(true),
                   contador_mal_comportamiento(0),
		   fac("gamesInfo.xml")
{
    string gameId="";
    //scene using id
    escena_actual = fac.buildGameById(gameId);
    cout<<"manager() escena_actual address: "<<escena_actual<<endl;
     
    //CommandBuilder *commandBuilder    = new CommandBuilder();
    //map<string,ICommand*> mapComandos = commandBuilder->buildCommands(continuar_loop,
    //                                                                  escena_actual,
    //                                                                  inventario,
    //                                                                  parametro1,
    //                                                                  parametro2,
    //                                                                  primera_entrada,
    //                                                                  eventsQueue);
     
    //Construir los comandos y conectarlos al invocador
    string comandos_disponibles="Comandos disponibles: ";
    vector<string> v_comandos;
    for(int i=0;i<NUMBER_COMMANDS;++i)
        v_comandos.push_back(comandos[i]);

    list<ICommand*> mycommands;
    
    mycommands.push_back(new Exit(continuar_loop));
    mycommands.push_back(new Ayuda(v_comandos));
    mycommands.push_back(new Ver(&escena_actual));
    mycommands.push_back(new Examinar(&escena_actual,inventario,parametro1));
    mycommands.push_back(new CommandInventario(inventario));
    mycommands.push_back(new Cardinal(&escena_actual,s_norte,primera_entrada));
    mycommands.push_back(new Cardinal(&escena_actual,s_sur,primera_entrada));
    mycommands.push_back(new Cardinal(&escena_actual,s_oeste,primera_entrada));
    mycommands.push_back(new Cardinal(&escena_actual,s_este,primera_entrada));
    mycommands.push_back(new Tirar(&escena_actual,inventario,parametro1,parametro2));
    mycommands.push_back(new Coger(&escena_actual,inventario,parametro1));
    mycommands.push_back(new Dejar(&escena_actual,inventario,parametro1));
    mycommands.push_back(new Alcanzar(&escena_actual,inventario,parametro1));
    mycommands.push_back(new Colocar(&escena_actual,inventario,eventsQueue,parametro1,parametro2));    
    
    map<string,ICommand*> mapComandos; // = new map<string,ICommand*>;

    for(auto it=mycommands.begin();
        it!=mycommands.end();
        ++it){
        string key=(*it)->get_command_id();
        mapComandos[key]=*it;
        //cout<<"Added key "<<key<<endl;
    }
    
    // Build command trigger
    this->invocador_comandos = Invocador(mapComandos);
	 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rdi, %rbx
movsd 0x9a10(%rip), %xmm0     # 0x21bb8
movups %xmm0, (%rdi)
leaq 0x20(%rdi), %rax
movq %rax, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
xorl %eax, %eax
movb %al, 0x20(%rdi)
movb $0x1, 0x30(%rdi)
leaq 0x48(%rdi), %rcx
movq %rcx, 0x38(%rdi)
andq $0x0, 0x40(%rdi)
movb %al, 0x48(%rdi)
leaq 0x68(%rdi), %rcx
movq %rcx, 0x58(%rdi)
andq $0x0, 0x60(%rdi)
movb %al, 0x68(%rdi)
leaq 0x88(%rdi), %rcx
movq %rcx, 0x78(%rdi)
andq $0x0, 0x80(%rdi)
movb %al, 0x88(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%rdi)
andq $0x0, 0xa8(%rdi)
leaq 0xb8(%rdi), %rax
andl $0x0, 0xb8(%rdi)
andq $0x0, 0xc0(%rdi)
movq %rax, 0xc8(%rdi)
movq %rax, 0xd0(%rdi)
andq $0x0, 0xd8(%rdi)
andl $0x0, 0xe8(%rdi)
leaq 0x58(%rdi), %r14
andq $0x0, 0xf0(%rdi)
leaq 0x78(%rdi), %rax
movq %rax, 0x48(%rsp)
leaq 0xe8(%rdi), %rax
movq %rax, 0xf8(%rdi)
movq %rax, 0x100(%rdi)
andq $0x0, 0x108(%rdi)
addq $0x110, %rdi            # imm = 0x110
callq 0x17a18
leaq 0x118(%rbx), %rdi
movq %rdi, 0x8(%rsp)
callq 0x16abc
andl $0x0, 0x148(%rbx)
leaq 0x158(%rbx), %r12
movq %r12, %rdi
callq 0x190c4
andl $0x0, 0x2d0(%rbx)
andq $0x0, 0x2d8(%rbx)
leaq 0x2c8(%rbx), %r13
leaq 0x2d0(%rbx), %rax
movq %rax, 0x2e0(%rbx)
movq %rax, 0x2e8(%rbx)
andq $0x0, 0x2f0(%rbx)
leaq 0x2f8(%rbx), %rbp
movq %rbp, %rdi
callq 0x169d8
leaq 0x3c8(%rbx), %rdi
movq %rdi, 0x80(%rsp)
callq 0x196f2
leaq 0x98c7(%rip), %rsi      # 0x21bc8
leaq 0xe8(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x12230
leaq 0x418(%rbx), %rdi
leaq 0xe8(%rsp), %rsi
movq %rdi, 0x88(%rsp)
callq 0x14f00
leaq 0xe8(%rsp), %rdi
callq 0x5638
leaq 0x92f8(%rip), %rsi      # 0x2163b
leaq 0xc8(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x12230
leaq 0xa8(%rsp), %rdi
leaq 0xc8(%rsp), %rsi
callq 0x5430
leaq 0xa8(%rsp), %rsi
movq 0x88(%rsp), %rdi
callq 0x14f72
movq %rax, 0x150(%rbx)
leaq 0xa8(%rsp), %rdi
callq 0x5638
movq 0x16c1e(%rip), %rdi     # 0x2efb8
leaq 0x9835(%rip), %rsi      # 0x21bd6
callq 0x5310
leaq 0x150(%rbx), %r15
movq (%r15), %rsi
movq %rax, %rdi
callq 0x5290
movq %rax, %rdi
callq 0x51a0
movq %rbp, 0x38(%rsp)
movq %r13, 0x30(%rsp)
movq %r12, 0x40(%rsp)
movq %r14, 0x10(%rsp)
leaq 0x981d(%rip), %rsi      # 0x21bf8
leaq 0x108(%rsp), %rdi
leaq 0x50(%rsp), %rdx
callq 0x12230
leaq 0x30(%rbx), %rbp
leaq 0x90(%rsp), %r13
andq $0x0, 0x10(%r13)
xorps %xmm0, %xmm0
movaps %xmm0, (%r13)
xorl %r14d, %r14d
leaq 0x1ce70(%rip), %r12     # 0x35280
cmpq $0x1c0, %r14            # imm = 0x1C0
je 0x1842b
leaq (%r12,%r14), %rsi
movq %r13, %rdi
callq 0x121bc
addq $0x20, %r14
jmp 0x18410
leaq 0x18(%rsp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
andq $0x0, 0x10(%rax)
pushq $0x30
popq %rdi
movq 0x10(%rsp), %r14
callq 0x5330
movq %rax, %r13
movq %rax, %rdi
movq %rbp, %rsi
callq 0x191ba
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x40
popq %rdi
callq 0x5330
movq %rax, %r13
leaq 0x90(%rsp), %rsi
movq %rax, %rdi
callq 0x1921e
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x30
popq %rdi
callq 0x5330
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
callq 0x19296
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x40
popq %rdi
callq 0x5330
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rdx
movq %r14, %rcx
callq 0x192fa
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x30
popq %rdi
callq 0x5330
movq %rax, %r13
movq %rax, %rdi
movq 0x8(%rsp), %rsi
callq 0x19374
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x40
popq %rdi
callq 0x5330
movq %rax, %r13
leaq 0x2c0(%rbx), %rbp
leaq 0x1ca6f(%rip), %rdx     # 0x34fa0
movq %rax, %rdi
movq %r15, %rsi
movq %rbp, %rcx
callq 0x193d8
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x40
popq %rdi
callq 0x5330
movq %rax, %r13
leaq 0x1ca5d(%rip), %rdx     # 0x34fc0
movq %rax, %rdi
movq %r15, %rsi
movq %rbp, %rcx
callq 0x193d8
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x40
popq %rdi
callq 0x5330
movq %rax, %r13
leaq 0x1ca6b(%rip), %rdx     # 0x35000
movq %rax, %rdi
movq %r15, %rsi
movq %rbp, %rcx
callq 0x193d8
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x40
popq %rdi
callq 0x5330
movq %rax, %r13
leaq 0x1ca19(%rip), %rdx     # 0x34fe0
movq %rax, %rdi
movq %r15, %rsi
movq %rbp, %rcx
callq 0x193d8
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x48
popq %rdi
callq 0x5330
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rdx
movq %r14, %rcx
movq 0x48(%rsp), %r8
callq 0x1944e
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x40
popq %rdi
callq 0x5330
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rdx
movq %r14, %rcx
callq 0x194d6
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x40
popq %rdi
callq 0x5330
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rdx
movq %r14, %rcx
callq 0x19550
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x40
popq %rdi
callq 0x5330
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rdx
movq %r14, %rcx
callq 0x195ca
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %rdi
callq 0x191ae
pushq $0x50
popq %rdi
callq 0x5330
movq %rax, %r13
movq %rax, %rdi
movq %r15, %rsi
movq 0x8(%rsp), %rdx
movq 0x80(%rsp), %rcx
movq 0x10(%rsp), %r8
movq 0x48(%rsp), %r9
callq 0x19644
leaq 0x50(%rsp), %rsi
movq %r13, (%rsi)
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x191ae
leaq 0x58(%rsp), %rax
andl $0x0, (%rax)
andq $0x0, 0x8(%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x18(%rax)
andq $0x0, 0x20(%rax)
leaq 0x158(%rsp), %rbp
leaq 0x50(%rsp), %r13
movq %r14, %r15
movq (%r15), %r15
cmpq %r14, %r15
je 0x1874c
movq 0x10(%r15), %rsi
addq $0x8, %rsi
movq %rbp, %rdi
callq 0x5430
movq 0x10(%r15), %r12
movq %r13, %rdi
movq %rbp, %rsi
callq 0x16f88
movq %r12, (%rax)
movq %rbp, %rdi
callq 0x5638
jmp 0x18718
leaq 0x128(%rsp), %rdi
leaq 0x50(%rsp), %rsi
callq 0x1989e
leaq 0x158(%rsp), %rdi
leaq 0x128(%rsp), %rsi
movq 0x30(%rsp), %r14
callq 0x1989e
leaq 0x158(%rsp), %rbx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x19aae
movq %rbx, %rdi
callq 0x17f00
leaq 0x128(%rsp), %rdi
callq 0x17f00
leaq 0x50(%rsp), %rdi
callq 0x17f00
leaq 0x18(%rsp), %rdi
callq 0x19b5e
leaq 0x90(%rsp), %rdi
callq 0x121e8
leaq 0x108(%rsp), %rdi
callq 0x5638
leaq 0xc8(%rsp), %rdi
callq 0x5638
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
leaq 0x128(%rsp), %rdi
callq 0x17f00
jmp 0x188fc
jmp 0x188e7
movq %rax, %r15
pushq $0x50
popq %rsi
movq %r13, %rdi
callq 0x5340
jmp 0x18906
jmp 0x18835
jmp 0x18835
jmp 0x18835
movq %rax, %r15
pushq $0x48
jmp 0x18841
jmp 0x18835
jmp 0x18835
jmp 0x18835
jmp 0x18835
jmp 0x1883c
jmp 0x18835
jmp 0x1883c
movq %rax, %r15
pushq $0x40
jmp 0x18841
movq %rax, %r15
pushq $0x30
popq %rsi
movq %r13, %rdi
callq 0x5340
jmp 0x1890b
movq %rax, %r15
movq 0x10(%rsp), %r14
movq 0x40(%rsp), %r12
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %rbp
jmp 0x18948
movq %rax, %r15
leaq 0xa8(%rsp), %rdi
jmp 0x18943
movq %rax, %r15
jmp 0x18955
movq %rax, %r15
leaq 0xe8(%rsp), %rdi
callq 0x5638
jmp 0x18962
movq %rax, %r15
jmp 0x18962
movq %rax, %r15
jmp 0x1896f
movq %rax, %r15
jmp 0x18977
movq %rax, %r15
jmp 0x18987
movq %rax, %r15
jmp 0x18906
jmp 0x188d5
jmp 0x188d5
jmp 0x188d5
jmp 0x188d5
jmp 0x188d5
jmp 0x188d5
jmp 0x188d5
jmp 0x188d5
jmp 0x188d5
jmp 0x188d5
jmp 0x188d5
jmp 0x188d5
movq %rax, %r15
jmp 0x1890b
movq %rax, %r15
jmp 0x18991
movq %rax, %r15
jmp 0x18948
movq %rax, %r15
jmp 0x188fc
movq %rax, %r15
leaq 0x158(%rsp), %rdi
callq 0x5638
leaq 0x50(%rsp), %rdi
callq 0x17f00
movq 0x10(%rsp), %r14
leaq 0x18(%rsp), %rdi
callq 0x19b5e
jmp 0x1891f
movq %rax, %r15
movq 0x10(%rsp), %r14
movq 0x40(%rsp), %r12
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %rbp
leaq 0x90(%rsp), %rdi
callq 0x121e8
leaq 0x108(%rsp), %rdi
callq 0x5638
leaq 0xc8(%rsp), %rdi
callq 0x5638
movq 0x88(%rsp), %rdi
callq 0x17e1e
movq 0x80(%rsp), %rdi
callq 0x17ea8
movq %rbp, %rdi
callq 0x17e34
movq %r13, %rdi
callq 0x17f00
movq %r12, %rdi
callq 0x17e56
movq 0x8(%rsp), %rdi
callq 0x1382a
leaq 0x10(%rbx), %r12
leaq 0x38(%rbx), %r13
leaq 0x98(%rbx), %rbp
leaq 0xe0(%rbx), %rdi
addq $0xb0, %rbx
callq 0x17fa2
movq %rbx, %rdi
callq 0x138f2
movq %rbp, %rdi
callq 0x121e8
movq 0x48(%rsp), %rdi
callq 0x5638
movq %r14, %rdi
callq 0x5638
movq %r13, %rdi
callq 0x5638
movq %r12, %rdi
callq 0x5638
movq %r15, %rdi
callq 0x55a0
nop