// File: nickgammon[P]tinymudserver/commands.cpp
// Function: DoLook(tPlayer*, std::istream&)
void DoLook (tPlayer * p, istream & sArgs)
{
 
  // TODO: add: look (thing)

  string whichObject;
  sArgs >> ws >> whichObject;

  if (!whichObject.empty ())
    {
    lookObject (p, whichObject);
    return;
    }
    
  
  // find our current room, throws exception if not there
  tRoom * r = FindRoom (p->room);
  
  // show room description
  *p << r->description;
  
  // show available exits
  if (!r->exits.empty ())
    {
    *p << "Exits: ";
    for (tExitMap::const_iterator exititer = r->exits.begin ();
         exititer != r->exits.end (); ++exititer)
      *p << exititer->first << " ";
    *p << "\n";        
    }
  
  /* list other players in the same room */
  
  int iOthers = 0;
  for (tPlayerListIterator listiter = playerlist.begin (); 
      listiter != playerlist.end (); 
      listiter++)
    {
    tPlayer *otherp = *listiter;
    if (otherp != p && /* we don't see ourselves */
        otherp->IsPlaying () &&
        otherp->room == p->room)  // need to be in same room
      {
      if (iOthers++ == 0)
        *p << "You also see ";
      else
        *p << ", ";
      *p << otherp->playername;
      }
    }   /* end of looping through all players */

  /* If we listed anyone, finish up the line with a period, newline */
  if (iOthers)
    *p << ".\n";

  
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x45b0
movq -0x10(%rbp), %rdi
movq 0x18189(%rip), %rsi     # 0x28fb0
callq 0x4170
movq %rax, -0x98(%rbp)
jmp 0x10e35
movq -0x98(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x4550
jmp 0x10e47
leaq -0x30(%rbp), %rdi
callq 0x4660
testb $0x1, %al
jne 0x10e89
movq -0x8(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x10db0
jmp 0x10e63
movl $0x1, -0x40(%rbp)
jmp 0x110bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x47d8
jmp 0x110cd
movq -0x8(%rbp), %rdi
addq $0xd4, %rdi
callq 0x1bbb0
movq %rax, -0xa0(%rbp)
jmp 0x10ea2
movq -0xa0(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xb450
jmp 0x10ebc
movq -0x48(%rbp), %rdi
addq $0x20, %rdi
callq 0x13c80
testb $0x1, %al
jne 0x10f94
movq -0x8(%rbp), %rdi
leaq 0xb52c(%rip), %rsi      # 0x1c408
callq 0x13ca0
jmp 0x10ee3
movq -0x48(%rbp), %rdi
addq $0x20, %rdi
callq 0x13da0
movq %rax, -0x58(%rbp)
leaq -0x50(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0xf640
movq -0x48(%rbp), %rdi
addq $0x20, %rdi
callq 0xf490
movq %rax, -0x68(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
callq 0xf640
leaq -0x50(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x13dd0
testb $0x1, %al
jne 0x10f32
jmp 0x10f80
movq -0x8(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x138c0
movq -0xb0(%rbp), %rdi
movq %rax, %rsi
callq 0xb450
movq %rax, -0xa8(%rbp)
jmp 0x10f5e
movq -0xa8(%rbp), %rdi
leaq 0xba02(%rip), %rsi      # 0x1c96e
callq 0x13b80
jmp 0x10f73
jmp 0x10f75
leaq -0x50(%rbp), %rdi
callq 0x13e00
jmp 0x10f01
movq -0x8(%rbp), %rdi
leaq 0xb149(%rip), %rsi      # 0x1c0d4
callq 0x13b80
jmp 0x10f92
jmp 0x10f94
movl $0x0, -0x6c(%rbp)
leaq 0x1898e(%rip), %rdi     # 0x29930
callq 0x8a40
movq %rax, -0x78(%rbp)
leaq 0x1897e(%rip), %rdi     # 0x29930
callq 0x8a70
movq %rax, -0x80(%rbp)
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x94f0
testb $0x1, %al
jne 0x10fd1
jmp 0x1109a
leaq -0x78(%rbp), %rdi
callq 0x8b20
movq (%rax), %rax
movq %rax, -0x88(%rbp)
movq -0x88(%rbp), %rax
cmpq -0x8(%rbp), %rax
je 0x11081
movq -0x88(%rbp), %rdi
callq 0x95e0
movb %al, -0xb1(%rbp)
jmp 0x11009
movb -0xb1(%rbp), %al
testb $0x1, %al
jne 0x11015
jmp 0x11081
movq -0x88(%rbp), %rax
movl 0xd4(%rax), %eax
movq -0x8(%rbp), %rcx
cmpl 0xd4(%rcx), %eax
jne 0x11081
movl -0x6c(%rbp), %eax
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, -0x6c(%rbp)
cmpl $0x0, %eax
jne 0x11052
movq -0x8(%rbp), %rdi
leaq 0xb3c7(%rip), %rsi      # 0x1c410
callq 0x13e30
jmp 0x11050
jmp 0x11066
movq -0x8(%rbp), %rdi
leaq 0xb68d(%rip), %rsi      # 0x1c6ea
callq 0x13f30
jmp 0x11064
jmp 0x11066
movq -0x8(%rbp), %rdi
movq -0x88(%rbp), %rsi
addq $0x90, %rsi
callq 0xb450
jmp 0x1107f
jmp 0x11081
jmp 0x11083
leaq -0x78(%rbp), %rdi
xorl %esi, %esi
callq 0x14030
movq %rax, -0x90(%rbp)
jmp 0x10fab
cmpl $0x0, -0x6c(%rbp)
je 0x110b4
movq -0x8(%rbp), %rdi
leaq 0xafd4(%rip), %rsi      # 0x1c07f
callq 0x13f30
jmp 0x110b2
jmp 0x110b4
movl $0x0, -0x40(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x47d8
addq $0xc0, %rsp
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x46d0
nopw %cs:(%rax,%rax)