// File: lotuskip[P]yuxtapa/server/settings.cpp
// Function: Config::read_config()
void Config::read_config()
{
	// first, initialize with defaults:
	int i;
	for(i = 0; i < MAX_INT_SETTING; ++i)
		int_settings[i] = default_sets[i];

	string s = get_config_dir() + "server.conf";
	ifstream file(s.c_str());
	if(!file)
		to_log("Warning: config file does not exist or is not readable!");
	while(file)
	{
		// This is very crude parsing; if the file is not right it probably is read all wrong
		getline(file, s);
		if(s.empty() || s[0] == '#')
			continue;
		if(parse_config(s, true))
		{
			to_log("Warning: could not parse the following line in config file:");
			to_log("\t\"" + s + "\"");
		}
	}
	
	// everything extracted (or failed altogether), check:
	for(i = 0; i < MAX_INT_SETTING; ++i)
		if(validate_int_set(i))
		{
			int_settings[i] = default_sets[i];
			to_log("Warning: config gave invalid value for \'" + keywords[i] + "\'.");
		}
	if(validate_classlim())
		to_log("Config error: classlimit is too small "
			"with respect to the number of players allowed!");
	if(validate_minp())
		to_log("Config error: minplayers forced to 0!");
	// Check modes:
	if(poss_modes.empty())
	{
		poss_modes.push_back(GM_DOM);
		poss_modes.push_back(GM_CONQ);
		poss_modes.push_back(GM_STEAL);
		poss_modes.push_back(GM_DESTR);
		poss_modes.push_back(GM_TDM);
	}
	// Similarly check map types:
	if(poss_mtypes.empty())
	{
		poss_mtypes.push_back(MT_DUNGEON);
		poss_mtypes.push_back(MT_OUTDOOR);
		poss_mtypes.push_back(MT_COMPLEX);
	}
	// Force at least one bot name:
	if(botnames.empty())
		botnames.push_back("Mr. Brown");
	botname_iter = botnames.begin();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x400, %rsp            # imm = 0x400
movl $0x0, -0x4(%rbp)
cmpl $0xc, -0x4(%rbp)
jge 0x1e78f
movslq -0x4(%rbp), %rcx
leaq 0x42fbd(%rip), %rax     # 0x61730
movl (%rax,%rcx,4), %edx
movslq -0x4(%rbp), %rcx
leaq 0x7128f(%rip), %rax     # 0x8fa10
movl %edx, (%rax,%rcx,4)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x1e762
callq 0x1ef50
movq %rax, %rsi
leaq 0x42dde(%rip), %rdx     # 0x6157c
leaq -0x28(%rbp), %rdi
movq %rdi, -0x3a8(%rbp)
callq 0x1b080
movq -0x3a8(%rbp), %rdi
callq 0x5200
movq %rax, %rsi
leaq -0x230(%rbp), %rdi
movl $0x8, %edx
callq 0x5970
jmp 0x1e7d0
movq -0x230(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x230(%rbp,%rax), %rdi
callq 0x5250
movb %al, -0x3a9(%rbp)
jmp 0x1e7f0
movb -0x3a9(%rbp), %al
testb $0x1, %al
jne 0x1e7ff
jmp 0x1e8c7
leaq -0x261(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
callq 0x5930
movq -0x3b8(%rbp), %rdx
leaq 0x42d68(%rip), %rsi     # 0x61588
leaq -0x260(%rbp), %rdi
callq 0x18880
jmp 0x1e82e
leaq -0x260(%rbp), %rdi
callq 0x28d70
jmp 0x1e83c
leaq -0x260(%rbp), %rdi
callq 0x5a48
leaq -0x261(%rbp), %rdi
callq 0x5590
jmp 0x1e8c7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x1ef31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x1ef25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x1e8b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x5a48
leaq -0x261(%rbp), %rdi
callq 0x5590
jmp 0x1ef25
jmp 0x1e8c9
movq -0x230(%rbp), %rax
movq -0x18(%rax), %rax
leaq -0x230(%rbp,%rax), %rdi
callq 0x56b0
movb %al, -0x3b9(%rbp)
jmp 0x1e8e9
movb -0x3b9(%rbp), %al
testb $0x1, %al
jne 0x1e8f8
jmp 0x1eaa3
leaq -0x230(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x50f0
jmp 0x1e90a
leaq -0x28(%rbp), %rdi
callq 0x58d0
testb $0x1, %al
jne 0x1e93c
xorl %eax, %eax
movl %eax, %esi
leaq -0x28(%rbp), %rdi
callq 0x5a10
movq %rax, -0x3c8(%rbp)
jmp 0x1e92d
movq -0x3c8(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x23, %eax
jne 0x1e93e
jmp 0x1e8c9
leaq -0x28(%rbp), %rdi
movl $0x1, %esi
callq 0x1d1d0
movb %al, -0x3c9(%rbp)
jmp 0x1e954
movb -0x3c9(%rbp), %al
testb $0x1, %al
jne 0x1e963
jmp 0x1ea9e
leaq -0x289(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x5930
movq -0x3d8(%rbp), %rdx
leaq 0x42c3c(%rip), %rsi     # 0x615c0
leaq -0x288(%rbp), %rdi
callq 0x18880
jmp 0x1e992
leaq -0x288(%rbp), %rdi
callq 0x28d70
jmp 0x1e9a0
leaq -0x288(%rbp), %rdi
callq 0x5a48
leaq -0x289(%rbp), %rdi
callq 0x5590
leaq 0x42c3d(%rip), %rsi     # 0x615fc
leaq -0x2d0(%rbp), %rdi
leaq -0x28(%rbp), %rdx
callq 0x1f390
jmp 0x1e9d1
leaq 0x42c25(%rip), %rdx     # 0x615fd
leaq -0x2b0(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x18a40
jmp 0x1e9ed
leaq -0x2b0(%rbp), %rdi
callq 0x28d70
jmp 0x1e9fb
leaq -0x2b0(%rbp), %rdi
callq 0x5a48
leaq -0x2d0(%rbp), %rdi
callq 0x5a48
jmp 0x1ea9e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x1ea4a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x5a48
leaq -0x289(%rbp), %rdi
callq 0x5590
jmp 0x1ef25
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x1ea8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0x5a48
leaq -0x2d0(%rbp), %rdi
callq 0x5a48
jmp 0x1ef25
jmp 0x1e8c9
movl $0x0, -0x4(%rbp)
cmpl $0xc, -0x4(%rbp)
jge 0x1eba9
movl -0x4(%rbp), %edi
callq 0x1e320
movb %al, -0x3d9(%rbp)
jmp 0x1eac4
movb -0x3d9(%rbp), %al
testb $0x1, %al
jne 0x1ead3
jmp 0x1eb99
movslq -0x4(%rbp), %rcx
leaq 0x42c52(%rip), %rax     # 0x61730
movl (%rax,%rcx,4), %edx
leaq 0x70f28(%rip), %rax     # 0x8fa10
movl %edx, (%rax,%rcx,4)
movslq -0x4(%rbp), %rax
shlq $0x5, %rax
leaq 0x70ca6(%rip), %rdx     # 0x8f7a0
addq %rax, %rdx
leaq 0x42afb(%rip), %rsi     # 0x615ff
leaq -0x310(%rbp), %rdi
callq 0x1f390
jmp 0x1eb12
leaq 0x42b0f(%rip), %rdx     # 0x61628
leaq -0x2f0(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0x18a40
jmp 0x1eb2e
leaq -0x2f0(%rbp), %rdi
callq 0x28d70
jmp 0x1eb3c
leaq -0x2f0(%rbp), %rdi
callq 0x5a48
leaq -0x310(%rbp), %rdi
callq 0x5a48
jmp 0x1eb99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x1eb88
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x2f0(%rbp), %rdi
callq 0x5a48
leaq -0x310(%rbp), %rdi
callq 0x5a48
jmp 0x1ef25
jmp 0x1eb9b
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x1eaaa
callq 0x1e3c0
movb %al, -0x3da(%rbp)
jmp 0x1ebb6
movb -0x3da(%rbp), %al
testb $0x1, %al
jne 0x1ebc5
jmp 0x1ec5f
leaq -0x331(%rbp), %rdi
movq %rdi, -0x3e8(%rbp)
callq 0x5930
movq -0x3e8(%rbp), %rdx
leaq 0x42a45(%rip), %rsi     # 0x6162b
leaq -0x330(%rbp), %rdi
callq 0x18880
jmp 0x1ebf4
leaq -0x330(%rbp), %rdi
callq 0x28d70
jmp 0x1ec02
leaq -0x330(%rbp), %rdi
callq 0x5a48
leaq -0x331(%rbp), %rdi
callq 0x5590
jmp 0x1ec5f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x1ec4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x330(%rbp), %rdi
callq 0x5a48
leaq -0x331(%rbp), %rdi
callq 0x5590
jmp 0x1ef25
callq 0x1e400
movb %al, -0x3e9(%rbp)
jmp 0x1ec6c
movb -0x3e9(%rbp), %al
testb $0x1, %al
jne 0x1ec7b
jmp 0x1ed15
leaq -0x359(%rbp), %rdi
movq %rdi, -0x3f8(%rbp)
callq 0x5930
movq -0x3f8(%rbp), %rdx
leaq 0x429e4(%rip), %rsi     # 0x61680
leaq -0x358(%rbp), %rdi
callq 0x18880
jmp 0x1ecaa
leaq -0x358(%rbp), %rdi
callq 0x28d70
jmp 0x1ecb8
leaq -0x358(%rbp), %rdi
callq 0x5a48
leaq -0x359(%rbp), %rdi
callq 0x5590
jmp 0x1ed15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x1ed04
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x358(%rbp), %rdi
callq 0x5a48
leaq -0x359(%rbp), %rdi
callq 0x5590
jmp 0x1ef25
leaq 0x70ca4(%rip), %rdi     # 0x8f9c0
callq 0x1f9d0
testb $0x1, %al
jne 0x1ed2a
jmp 0x1edb8
movb $0x0, -0x35a(%rbp)
leaq 0x70c88(%rip), %rdi     # 0x8f9c0
leaq -0x35a(%rbp), %rsi
callq 0x1f9a0
jmp 0x1ed46
movb $0x1, -0x35b(%rbp)
leaq 0x70c6c(%rip), %rdi     # 0x8f9c0
leaq -0x35b(%rbp), %rsi
callq 0x1f9a0
jmp 0x1ed62
movb $0x2, -0x35c(%rbp)
leaq 0x70c50(%rip), %rdi     # 0x8f9c0
leaq -0x35c(%rbp), %rsi
callq 0x1f9a0
jmp 0x1ed7e
movb $0x3, -0x35d(%rbp)
leaq 0x70c34(%rip), %rdi     # 0x8f9c0
leaq -0x35d(%rbp), %rsi
callq 0x1f9a0
jmp 0x1ed9a
movb $0x4, -0x35e(%rbp)
leaq 0x70c18(%rip), %rdi     # 0x8f9c0
leaq -0x35e(%rbp), %rsi
callq 0x1f9a0
jmp 0x1edb6
jmp 0x1edb8
leaq 0x70c19(%rip), %rdi     # 0x8f9d8
callq 0x1f9d0
testb $0x1, %al
jne 0x1edca
jmp 0x1ee20
movb $0x0, -0x35f(%rbp)
leaq 0x70c00(%rip), %rdi     # 0x8f9d8
leaq -0x35f(%rbp), %rsi
callq 0x1f9a0
jmp 0x1ede6
movb $0x1, -0x360(%rbp)
leaq 0x70be4(%rip), %rdi     # 0x8f9d8
leaq -0x360(%rbp), %rsi
callq 0x1f9a0
jmp 0x1ee02
movb $0x2, -0x361(%rbp)
leaq 0x70bc8(%rip), %rdi     # 0x8f9d8
leaq -0x361(%rbp), %rsi
callq 0x1f9a0
jmp 0x1ee1e
jmp 0x1ee20
leaq 0x70bc9(%rip), %rdi     # 0x8f9f0
callq 0x1f710
testb $0x1, %al
jne 0x1ee35
jmp 0x1eed3
leaq -0x389(%rbp), %rdi
movq %rdi, -0x400(%rbp)
callq 0x5930
movq -0x400(%rbp), %rdx
leaq 0x42850(%rip), %rsi     # 0x616a6
leaq -0x388(%rbp), %rdi
callq 0x18880
jmp 0x1ee64
leaq 0x70b85(%rip), %rdi     # 0x8f9f0
leaq -0x388(%rbp), %rsi
callq 0x1b400
jmp 0x1ee79
leaq -0x388(%rbp), %rdi
callq 0x5a48
leaq -0x389(%rbp), %rdi
callq 0x5590
jmp 0x1eed3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
jmp 0x1eec5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x238(%rbp)
movl %eax, -0x23c(%rbp)
leaq -0x388(%rbp), %rdi
callq 0x5a48
leaq -0x389(%rbp), %rdi
callq 0x5590
jmp 0x1ef25
leaq 0x70b16(%rip), %rdi     # 0x8f9f0
callq 0x1ca40
movq %rax, -0x3a0(%rbp)
leaq -0x398(%rbp), %rdi
leaq -0x3a0(%rbp), %rsi
callq 0x1fa10
movq -0x398(%rbp), %rax
movq %rax, 0x70b39(%rip)     # 0x8fa40
leaq -0x230(%rbp), %rdi
callq 0x5170
leaq -0x28(%rbp), %rdi
callq 0x5a48
addq $0x400, %rsp            # imm = 0x400
popq %rbp
retq
leaq -0x230(%rbp), %rdi
callq 0x5170
leaq -0x28(%rbp), %rdi
callq 0x5a48
movq -0x238(%rbp), %rdi
callq 0x5920
nopw %cs:(%rax,%rax)