// File: nickgammon[P]tinymudserver/load.cpp
// Function: LoadRooms()
void LoadRooms ()
{
  // load rooms file
  ifstream fRooms (ROOMS_FILE, ios::in);
  if (!fRooms)
    {
    cerr << "Could not open rooms file: " << ROOMS_FILE << endl;
    return;
    }

  while (!(fRooms.eof ()))
    {
    int vnum;
    fRooms >> vnum;
    fRooms.ignore (numeric_limits<int>::max(), '\n'); // skip rest of this line
    string description;
    getline (fRooms, description);

    // give up if no vnum or description
    if (vnum == 0 || description.empty ())
      break;

    // get exits
    string sLine;
    getline (fRooms, sLine);

    // don't have duplicate rooms
    if (roommap [vnum] != 0)
      {
      cerr << "Room " << vnum << " appears more than once in room file" << endl;
      continue;
      }

    tRoom * room = new tRoom (FindAndReplace (description, "%r", "\n") + "\n");
    roommap [vnum] = room;

    // read exits from line (format is: <dir> <vnum> ...  eg. n 1234 s 5678)
    istringstream is (sLine);
    while (is.good ())
      {
      string dir;
      int dir_vnum;

      is >> dir;  // direction, eg. n
      is >> dir_vnum; // vnum, eg. 1234

      if (is.fail ())
        {
        is.clear ();
        string dummy;
        is >> dummy;
        cerr << "Bad vnum '" << dummy << "' for exit " << dir << " for room " << vnum << endl;
        continue;
        }

      // direction must be valid (eg. n, s, e, w) or it won't be recognised
      set<string>::const_iterator direction_iter = directionset.find (dir);
      if (direction_iter == directionset.end ())
        {
        cerr << "Direction " << dir << " for room " << vnum
             << " not in list of directions in control file" << endl;
        continue;
        }

      // stop if nonsense
      if (dir.empty () || dir_vnum == 0)
        break;

      room->exits [dir] = dir_vnum;   // add exit

      } // end of getting each direction
    } // end of read loop

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5e0, %rsp            # imm = 0x5E0
movq 0x1d9ae(%rip), %rsi     # 0x29410
leaq -0x208(%rbp), %rdi
movl $0x8, %edx
callq 0x4730
movq -0x208(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x208(%rbp,%rax), %rdi
callq 0x4230
movb %al, -0x4d1(%rbp)
jmp 0xba93
movb -0x4d1(%rbp), %al
testb $0x1, %al
jne 0xba9f
jmp 0xbb12
movq 0x1d542(%rip), %rdi     # 0x28fe8
leaq 0x107e4(%rip), %rsi     # 0x1c291
callq 0x4410
movq %rax, -0x4e0(%rbp)
jmp 0xbabb
movq -0x4e0(%rbp), %rdi
movq 0x1d947(%rip), %rsi     # 0x29410
callq 0x4410
movq %rax, -0x4e8(%rbp)
jmp 0xbad7
movq -0x4e8(%rbp), %rdi
movq 0x1d4b3(%rip), %rsi     # 0x28f98
callq 0x4480
jmp 0xbaec
movl $0x1, -0x218(%rbp)
jmp 0xc351
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
jmp 0xc366
jmp 0xbb14
movq -0x208(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x208(%rbp,%rax), %rdi
callq 0x4740
movb %al, -0x4e9(%rbp)
jmp 0xbb34
movb -0x4e9(%rbp), %al
xorb $-0x1, %al
testb $0x1, %al
jne 0xbb45
jmp 0xc347
leaq -0x208(%rbp), %rdi
leaq -0x21c(%rbp), %rsi
callq 0x42d0
jmp 0xbb5a
callq 0x8d10
movslq %eax, %rsi
leaq -0x208(%rbp), %rdi
movl $0xa, %edx
callq 0x42f0
jmp 0xbb75
leaq -0x240(%rbp), %rdi
movq %rdi, -0x4f8(%rbp)
callq 0x45b0
movq -0x4f8(%rbp), %rsi
leaq -0x208(%rbp), %rdi
callq 0x40e0
jmp 0xbb9d
cmpl $0x0, -0x21c(%rbp)
je 0xbbb8
leaq -0x240(%rbp), %rdi
callq 0x4660
testb $0x1, %al
jne 0xbbb8
jmp 0xbbde
movl $0x3, -0x218(%rbp)
jmp 0xc2eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
jmp 0xc339
leaq -0x260(%rbp), %rdi
movq %rdi, -0x500(%rbp)
callq 0x45b0
movq -0x500(%rbp), %rsi
leaq -0x208(%rbp), %rdi
callq 0x40e0
jmp 0xbc06
leaq 0x1dd3b(%rip), %rdi     # 0x29948
leaq -0x21c(%rbp), %rsi
callq 0xc5e0
movq %rax, -0x508(%rbp)
jmp 0xbc22
movq -0x508(%rbp), %rax
cmpq $0x0, (%rax)
je 0xbcc1
movq 0x1d3ae(%rip), %rdi     # 0x28fe8
leaq 0x1066c(%rip), %rsi     # 0x1c2ad
callq 0x4410
movq %rax, -0x510(%rbp)
jmp 0xbc4f
movq -0x510(%rbp), %rdi
movl -0x21c(%rbp), %esi
callq 0x46c0
movq %rax, -0x518(%rbp)
jmp 0xbc6a
movq -0x518(%rbp), %rdi
leaq 0x1063b(%rip), %rsi     # 0x1c2b3
callq 0x4410
movq %rax, -0x520(%rbp)
jmp 0xbc86
movq -0x520(%rbp), %rdi
movq 0x1d304(%rip), %rsi     # 0x28f98
callq 0x4480
jmp 0xbc9b
movl $0x2, -0x218(%rbp)
jmp 0xc2df
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
jmp 0xc32d
movl $0x50, %edi
callq 0x4420
movq %rax, -0x528(%rbp)
jmp 0xbcd4
movb $0x1, -0x2f2(%rbp)
leaq -0x2c9(%rbp), %rdi
movq %rdi, -0x530(%rbp)
callq 0x46e0
movq -0x530(%rbp), %rdx
leaq 0x10592(%rip), %rsi     # 0x1c28e
leaq -0x2c8(%rbp), %rdi
callq 0x67d0
jmp 0xbd0a
leaq -0x2f1(%rbp), %rdi
movq %rdi, -0x538(%rbp)
callq 0x46e0
movq -0x538(%rbp), %rdx
leaq 0x103a9(%rip), %rsi     # 0x1c0d4
leaq -0x2f0(%rbp), %rdi
callq 0x67d0
jmp 0xbd39
leaq -0x2a8(%rbp), %rdi
leaq -0x240(%rbp), %rsi
leaq -0x2c8(%rbp), %rdx
leaq -0x2f0(%rbp), %rcx
callq 0x6b20
jmp 0xbd5c
leaq 0x10371(%rip), %rdx     # 0x1c0d4
leaq -0x288(%rbp), %rdi
leaq -0x2a8(%rbp), %rsi
callq 0xc6c0
jmp 0xbd78
movq -0x528(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0xc710
jmp 0xbd8d
movb $0x0, -0x2f2(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x47d8
leaq -0x2a8(%rbp), %rdi
callq 0x47d8
leaq -0x2f0(%rbp), %rdi
callq 0x47d8
leaq -0x2f1(%rbp), %rdi
callq 0x44a0
leaq -0x2c8(%rbp), %rdi
callq 0x47d8
leaq -0x2c9(%rbp), %rdi
callq 0x44a0
movq -0x528(%rbp), %rax
movq %rax, -0x268(%rbp)
movq -0x268(%rbp), %rax
movq %rax, -0x548(%rbp)
leaq 0x1db49(%rip), %rdi     # 0x29948
leaq -0x21c(%rbp), %rsi
callq 0xc5e0
movq %rax, -0x540(%rbp)
jmp 0xbe14
movq -0x540(%rbp), %rax
movq -0x548(%rbp), %rcx
movq %rcx, (%rax)
leaq -0x478(%rbp), %rdi
leaq -0x260(%rbp), %rsi
movl $0x8, %edx
callq 0x4670
jmp 0xbe3f
jmp 0xbe41
movq -0x478(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x478(%rbp,%rax), %rdi
callq 0x4690
movb %al, -0x549(%rbp)
jmp 0xbe61
movb -0x549(%rbp), %al
testb $0x1, %al
jne 0xbe70
jmp 0xc2c9
leaq -0x498(%rbp), %rdi
movq %rdi, -0x558(%rbp)
callq 0x45b0
movq -0x558(%rbp), %rsi
leaq -0x478(%rbp), %rdi
callq 0x4550
jmp 0xbe98
leaq -0x478(%rbp), %rdi
leaq -0x49c(%rbp), %rsi
callq 0x42d0
jmp 0xbead
movq -0x478(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x478(%rbp,%rax), %rdi
callq 0x4030
movb %al, -0x559(%rbp)
jmp 0xbecd
movb -0x559(%rbp), %al
testb $0x1, %al
jne 0xbedc
jmp 0xc116
movq -0x478(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x478(%rbp,%rax), %rdi
xorl %esi, %esi
callq 0x4680
jmp 0xbef8
leaq -0x4c0(%rbp), %rdi
movq %rdi, -0x568(%rbp)
callq 0x45b0
movq -0x568(%rbp), %rsi
leaq -0x478(%rbp), %rdi
callq 0x4550
jmp 0xbf20
movq 0x1d0c1(%rip), %rdi     # 0x28fe8
leaq 0x103aa(%rip), %rsi     # 0x1c2d8
callq 0x4410
movq %rax, -0x570(%rbp)
jmp 0xbf3c
movq -0x570(%rbp), %rdi
leaq -0x4c0(%rbp), %rsi
callq 0x43d0
movq %rax, -0x578(%rbp)
jmp 0xbf58
movq -0x578(%rbp), %rdi
leaq 0x1037d(%rip), %rsi     # 0x1c2e3
callq 0x4410
movq %rax, -0x580(%rbp)
jmp 0xbf74
movq -0x580(%rbp), %rdi
leaq -0x498(%rbp), %rsi
callq 0x43d0
movq %rax, -0x588(%rbp)
jmp 0xbf90
movq -0x588(%rbp), %rdi
leaq 0x10351(%rip), %rsi     # 0x1c2ef
callq 0x4410
movq %rax, -0x590(%rbp)
jmp 0xbfac
movq -0x590(%rbp), %rdi
movl -0x21c(%rbp), %esi
callq 0x46c0
movq %rax, -0x598(%rbp)
jmp 0xbfc7
movq -0x598(%rbp), %rdi
movq 0x1cfc3(%rip), %rsi     # 0x28f98
callq 0x4480
jmp 0xbfdc
movl $0x4, -0x218(%rbp)
leaq -0x4c0(%rbp), %rdi
callq 0x47d8
jmp 0xc285
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
jmp 0xc098
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
jmp 0xc080
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
jmp 0xc074
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
jmp 0xc068
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x47d8
leaq -0x2a8(%rbp), %rdi
callq 0x47d8
leaq -0x2f0(%rbp), %rdi
callq 0x47d8
leaq -0x2f1(%rbp), %rdi
callq 0x44a0
leaq -0x2c8(%rbp), %rdi
callq 0x47d8
leaq -0x2c9(%rbp), %rdi
callq 0x44a0
testb $0x1, -0x2f2(%rbp)
jne 0xc0af
jmp 0xc0c0
movq -0x528(%rbp), %rdi
movl $0x50, %esi
callq 0x4430
jmp 0xc32d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
jmp 0xc321
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
jmp 0xc2bb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x210(%rbp)
movl %eax, -0x214(%rbp)
leaq -0x4c0(%rbp), %rdi
callq 0x47d8
jmp 0xc2bb
leaq 0x1d8eb(%rip), %rdi     # 0x29a08
leaq -0x498(%rbp), %rsi
callq 0x8fc0
movq %rax, -0x5a0(%rbp)
jmp 0xc132
movq -0x5a0(%rbp), %rax
movq %rax, -0x4c8(%rbp)
leaq 0x1d8c1(%rip), %rdi     # 0x29a08
callq 0x8f30
movq %rax, -0x4d0(%rbp)
leaq -0x4c8(%rbp), %rdi
leaq -0x4d0(%rbp), %rsi
callq 0xc750
testb $0x1, %al
jne 0xc16f
jmp 0xc21b
movq 0x1ce72(%rip), %rdi     # 0x28fe8
leaq 0x1017d(%rip), %rsi     # 0x1c2fa
callq 0x4410
movq %rax, -0x5a8(%rbp)
jmp 0xc18b
movq -0x5a8(%rbp), %rdi
leaq -0x498(%rbp), %rsi
callq 0x43d0
movq %rax, -0x5b0(%rbp)
jmp 0xc1a7
movq -0x5b0(%rbp), %rdi
leaq 0x1013a(%rip), %rsi     # 0x1c2ef
callq 0x4410
movq %rax, -0x5b8(%rbp)
jmp 0xc1c3
movq -0x5b8(%rbp), %rdi
movl -0x21c(%rbp), %esi
callq 0x46c0
movq %rax, -0x5c0(%rbp)
jmp 0xc1de
movq -0x5c0(%rbp), %rdi
leaq 0x10119(%rip), %rsi     # 0x1c305
callq 0x4410
movq %rax, -0x5c8(%rbp)
jmp 0xc1fa
movq -0x5c8(%rbp), %rdi
movq 0x1cd90(%rip), %rsi     # 0x28f98
callq 0x4480
jmp 0xc20f
movl $0x4, -0x218(%rbp)
jmp 0xc285
leaq -0x498(%rbp), %rdi
callq 0x4660
testb $0x1, %al
jne 0xc234
cmpl $0x0, -0x49c(%rbp)
jne 0xc240
movl $0x5, -0x218(%rbp)
jmp 0xc285
movl -0x49c(%rbp), %eax
movl %eax, -0x5d4(%rbp)
movq -0x268(%rbp), %rdi
addq $0x20, %rdi
leaq -0x498(%rbp), %rsi
callq 0xc780
movq %rax, -0x5d0(%rbp)
jmp 0xc26c
movq -0x5d0(%rbp), %rax
movl -0x5d4(%rbp), %ecx
movl %ecx, (%rax)
movl $0x0, -0x218(%rbp)
leaq -0x498(%rbp), %rdi
callq 0x47d8
movl -0x218(%rbp), %eax
movl %eax, -0x5d8(%rbp)
testl %eax, %eax
je 0xc2b6
jmp 0xc2a3
movl -0x5d8(%rbp), %eax
subl $0x4, %eax
je 0xbe41
jmp 0xc2b4
jmp 0xc2c9
jmp 0xbe41
leaq -0x498(%rbp), %rdi
callq 0x47d8
jmp 0xc321
leaq -0x478(%rbp), %rdi
callq 0x4240
movl $0x0, -0x218(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x47d8
leaq -0x240(%rbp), %rdi
callq 0x47d8
movl -0x218(%rbp), %eax
movl %eax, -0x5dc(%rbp)
testl %eax, %eax
je 0xc31c
jmp 0xc309
movl -0x5dc(%rbp), %eax
subl $0x2, %eax
je 0xbb14
jmp 0xc31a
jmp 0xc347
jmp 0xbb14
leaq -0x478(%rbp), %rdi
callq 0x4240
leaq -0x260(%rbp), %rdi
callq 0x47d8
leaq -0x240(%rbp), %rdi
callq 0x47d8
jmp 0xc366
movl $0x0, -0x218(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x4120
addq $0x5e0, %rsp            # imm = 0x5E0
popq %rbp
retq
leaq -0x208(%rbp), %rdi
callq 0x4120
movq -0x210(%rbp), %rdi
callq 0x46d0
nop