mud++0.35/etc/
mud++0.35/etc/guilds/
mud++0.35/help/propert/
mud++0.35/mudC/
mud++0.35/player/
mud++0.35/src/interface/
mud++0.35/src/os/cygwin32/
mud++0.35/src/os/win32/
mud++0.35/src/os/win32/bcppbuilder/
mud++0.35/src/osaddon/
mud++0.35/src/util/
# switch testing (and later references testing)

!funstart ils_test
!A PC pc
!A string str
	pushl @str
	sisnumber lg NOT_NUMBER
	pushl @str
	stoint
	ilookupswitch 3 DEFAULT_S
		1	FIND_1
		4	FIND_4
		-1	FIND_M1
:FIND_1 pushc string You typed 'one'~
	jmp COMMON
:FIND_4 pushc string You typed 'four'~
	jmp COMMON
:FIND_M1 pushc string You typed 'minus one'~
	jmp COMMON
:DEFAULT_S pushc string You typed other number than 1,4,-1~
:COMMON
	pushl @pc
	icall out_string_P_pPC_s
	ret
:NOT_NUMBER
	pushc string This is not number !!!~
	pushl @pc
	icall out_string_P_pPC_s
	ret
!funend


!funstart sls_test
!A PC pc
!A string str
	pushl @str
	slookupswitch 3 DEFAULT_S
		alfa~	FIND_A
		beta~	FIND_B
		gamma~	FIND_C
:FIND_A pushc string You typed first letter of greek alphabet~
	jmp COMMON
:FIND_B pushc string You typed second letter of greek alphabet~
	jmp COMMON
:FIND_C pushc string You typed third letter of greek alphabet~
	jmp COMMON
:DEFAULT_S pushc string You typed other word than "alfa", "beta" or "gamma"~
:COMMON
	pushl @pc
	icall out_string_P_pPC_s
	ret
!funend


!funstart its_test
!A PC pc
!A string str
	pushl @str
	sisnumber lg NOT_NUMBER
	pushl @str
	stoint
	itableswitch DEFAULT_S 1 4
		1	FIND_1
		2	FIND_2
		4	FIND_4
:FIND_1 pushc string You typed 'one'~
	jmp COMMON
:FIND_2 pushc string You typed 'two'~
	jmp COMMON
:FIND_4 pushc string You typed 'four'~
	jmp COMMON
:DEFAULT_S pushc string You typed other number than 1,2,4~
:COMMON
	pushl @pc
	icall out_string_P_pPC_s
	ret
:NOT_NUMBER
	pushc string This is not number !!!~
	pushl @pc
	icall out_string_P_pPC_s
	ret
!funend


#pseudo LangX
#
#	void npc_rename( PC pc, string str )
#	{
#		Char ch;
#		str.startArgs();
#		ch = pc.inRoom().getChar( str.getArg() );
#		if ( ch == NULL )
#		{
#			pc.out_string("There is nobody here with that name");
#			return;
#		}
#		ch.longdesc = str.getArgRest();
#		pc.out_string("You have changed name of person");
#		return;
#	}


!funstart npc_rename
!A PC pc
!A string str
!L Char ch
	pushl @str
	sstartargs
	sgetarg
	pushl @pc
	icall inRoom_P_pThing
	icall getChar_P_pRoom_s
	popl @ch
	pushl @ch
	isnull e NO_SUCH_PERSON
	sgetargrest
	pushl @ch
	setfield Char longdesc
	pushc string You have changed name of person~
	pushl @pc
	icall out_string_P_pPC_s
	ret
:NO_SUCH_PERSON
	pushc string There is nobody here with that name~
	pushl @pc
	icall out_string_P_pPC_s
	ret
!funend

!end