[FUNCTION pushp]
TAG0.MAXP ++
TRY TAG.P<eval <TAG.MAXP>> <P>
SYSMESSAGE Position <EVAL <TAG.MAXP>> saved.

[FUNCTION popp]
IF !(<TAG0.MAXP>)
SYSMESSAGE No positions saved.
RETURN 1
ENDIF

GO <TAG0.P<EVAL <TAG0.MAXP>>>
SYSMESSAGE You went to Position <EVAL <TAG0.MAXP>>.
TRY TAG.P<EVAL <TAG.MAXP>>

IF (<TAG0.MAXP> > 1)
TAG0.MAXP --
ELSE
TAG.MAXP
ENDIF

[PLEVEL 4]
pushp
popp

///////////////////////////

[FUNCTION shipfix]
LOCAL.LEFTOK=0
LOCAL.TMP=<OBJ>
OBJ=<UID>
FORITEMS 18
IF (<TYPE>==t_ship_plank) && (<REGION.UID>==<OBJ>)
DCLICK
ENDIF
ENDFOR
IF (<OBJ.BASEID>==i_multi_ship_small_n) || (<OBJ.BASEID>==i_multi_ship_dragon_small_n)
LOCAL.HATCH 0 -4 0
LOCAL.TILLERMAN 1 4 0
LOCAL.LEFTSIDE -2 0 0
LOCAL.RIGHTSIDE 2 0 0
ELIF (<OBJ.BASEID>==i_multi_ship_small_w) || (<OBJ.BASEID>==i_multi_ship_dragon_small_w)
LOCAL.HATCH -4 0 0
LOCAL.TILLERMAN 4 0 0
LOCAL.LEFTSIDE 0 2 0
LOCAL.RIGHTSIDE 0 -2 0
ELIF (<OBJ.BASEID>==i_multi_ship_small_s) || (<OBJ.BASEID>==i_multi_ship_dragon_small_s)
LOCAL.HATCH 0 4 0
LOCAL.TILLERMAN 0 -4 0
LOCAL.LEFTSIDE 2 0 0
LOCAL.RIGHTSIDE -2 0 0
ELIF (<OBJ.BASEID>==i_multi_ship_small_e) || (<OBJ.BASEID>==i_multi_ship_dragon_small_e)
LOCAL.HATCH 4 0 0
LOCAL.TILLERMAN -4 0 0
LOCAL.LEFTSIDE 0 -2 0
LOCAL.RIGHTSIDE 0 2 0
ELIF (<OBJ.BASEID>==i_multi_ship_medium_n) || (<OBJ.BASEID>==i_multi_ship_dragon_medium_n)
LOCAL.HATCH 0 -4 0
LOCAL.TILLERMAN 1 5 0
LOCAL.LEFTSIDE -2 0 0
LOCAL.RIGHTSIDE 2 0 0
ELIF (<OBJ.BASEID>==i_multi_ship_medium_w) || (<OBJ.BASEID>==i_multi_ship_dragon_medium_w)
LOCAL.HATCH -4 0 0
LOCAL.TILLERMAN 5 0 0
LOCAL.LEFTSIDE 0 2 0
LOCAL.RIGHTSIDE 0 -2 0
ELIF (<OBJ.BASEID>==i_multi_ship_medium_s) || (<OBJ.BASEID>==i_multi_ship_dragon_medium_s)
LOCAL.HATCH 0 4 0
LOCAL.TILLERMAN 0 -5 0
LOCAL.LEFTSIDE 2 0 0
LOCAL.RIGHTSIDE -2 0 0
ELIF (<OBJ.BASEID>==i_multi_ship_medium_e) || (<OBJ.BASEID>==i_multi_ship_dragon_medium_e)
LOCAL.HATCH 4 0 0
LOCAL.TILLERMAN -5 0 0
LOCAL.LEFTSIDE 0 -2 0
LOCAL.RIGHTSIDE 0 2 0
// Long Ships
ELIF (<OBJ.BASEID>==i_multi_ship_long_n) || (<OBJ.BASEID>==i_multi_ship_dragon_long_n)
LOCAL.HATCH 0 -5 0
LOCAL.TILLERMAN 1 5 0
LOCAL.LEFTSIDE -2 -1 0
LOCAL.RIGHTSIDE 2 -1 0
ELIF (<OBJ.BASEID>==i_multi_ship_long_w) || (<OBJ.BASEID>==i_multi_ship_dragon_long_w)
LOCAL.HATCH -5 0 0
LOCAL.TILLERMAN 5 0 0
LOCAL.LEFTSIDE -1 2 0
LOCAL.RIGHTSIDE -1 -2 0
ELIF (<OBJ.BASEID>==i_multi_ship_long_s) || (<OBJ.BASEID>==i_multi_ship_dragon_long_s)
LOCAL.HATCH 0 5 0
LOCAL.TILLERMAN 0 -5 0
LOCAL.LEFTSIDE 2 1 0
LOCAL.RIGHTSIDE -2 1 0
ELIF (<OBJ.BASEID>==i_multi_ship_long_e) || (<OBJ.BASEID>==i_multi_ship_dragon_long_e)
LOCAL.HATCH 5 0 0
LOCAL.TILLERMAN -5 0 0
LOCAL.LEFTSIDE 1 -2 0
LOCAL.RIGHTSIDE 1 2 0
ENDIF
FORITEMS 18
IF (<BASEID>==i_ship_hatch_e) && (<REGION.UID>==<OBJ>)
IF !(<LINK.MORE2>) || (<LINK.MORE2>==01) || (<LINK.MORE2>==02) //N
DISPID 03eae
ELIF (<LINK.MORE2>==02020000) || (<LINK.MORE2>==02020001) || (<LINK.MORE2>==02020002) // E
DISPID i_ship_hatch_e
ELIF (<LINK.MORE2>==04040000) || (<LINK.MORE2>==04040001) || (<LINK.MORE2>==04040002) // S
DISPID 03eb9
ELIF (<LINK.MORE2>==06060000) || (<LINK.MORE2>==06060001) || (<LINK.MORE2>==06060002) // W
DISPID 03e93
ENDIF
P=<LINK.P>
MOVE=<LOCAL.HATCH>
ENDIF
IF (<REGION.UID>==<OBJ>) && (<TYPE>==t_ship_tiller)
IF !(<LINK.MORE2>) || (<LINK.MORE2>==01) || (<LINK.MORE2>==02) // N
DISPID 03e4e
ELIF (<LINK.MORE2>==02020000) || (<LINK.MORE2>==02020001) || (<LINK.MORE2>==02020002) // E
DISPID 03e55
ELIF (<LINK.MORE2>==04040000) || (<LINK.MORE2>==04040001) || (<LINK.MORE2>==04040002) // S
DISPID 03e4b
ELIF (<LINK.MORE2>==06060000) || (<LINK.MORE2>==06060001) || (<LINK.MORE2>==06060002) // W
DISPID 03e50
ENDIF
P=<LINK.P>
MOVE <LOCAL.TILLERMAN>
ENDIF
IF (<REGION.UID>==<OBJ>) && (<UID>!=<LOCAL.LEFTSIDEUID>) && (<id>==03eb2) || (<ID>==03e85) || (<ID>==03ed4)
IF (<TYPE>==t_ship_plank) && (<REGION.UID>==<OBJ>)
DCLICK
ENDIF
IF !(<LINK.MORE2>) || (<LINK.MORE2>==01) || (<LINK.MORE2>==02) // N
ID=03eb2
ELIF (<LINK.MORE2>==02020000) || (<LINK.MORE2>==02020001) || (<LINK.MORE2>==02020002) // E
ID=03e85
ELIF (<LINK.MORE2>==04040000) || (<LINK.MORE2>==04040001) || (<LINK.MORE2>==04040002) // S
ID=03eb2
ELIF (<LINK.MORE2>==06060000) || (<LINK.MORE2>==06060001) || (<LINK.MORE2>==06060002) // W
ID=03e85
ENDIF
P=<LINK.P>
MOVE <LOCAL.RIGHTSIDE>
LOCAL.RIGHTSIDEUID=<UID>
TIMER -1
UPDATE
ENDIF
IF (<REGION.UID>==<OBJ>) && (<UID>!=<LOCAL.RIGHTSIDEUID>) && (<ID>==03eb1) || (<ID>==03e8a) || (<ID>==03ed4)
IF (<TYPE>==t_ship_plank) && (<REGION.UID>==<OBJ>)
DCLICK
ENDIF
IF !(<LINK.MORE2>) || (<LINK.MORE2>==01) || (<LINK.MORE2>==02) // N
ID=03eb1
ELIF (<LINK.MORE2>==02020000) || (<LINK.MORE2>==02020001) || (<LINK.MORE2>==02020002) // E
ID=03e8a
ELIF (<LINK.MORE2>==04040000) || (<LINK.MORE2>==04040001) || (<LINK.MORE2>==04040002) // S
ID=03eb1
ELIF (<LINK.MORE2>==06060000) || (<LINK.MORE2>==06060001) || (<LINK.MORE2>==06060002) // W
ID=03e8a
ENDIF
P=<LINK.P>
MOVE <LOCAL.LEFTSIDE>
LOCAL.LEFTSIDEUID=<UID>
TIMER -1
UPDATE
ENDIF
ENDFOR
obj=<local.tmp>

///////////////////////////////

[FUNCTION WRITEFILE]
IF !(<FILE.INUSE>)
FILE.MODE.APPEND=1
	IF (<FILE.OPEN <STRARG <ARGS>>>)
	FILE.WRITELINE <STREAT <ARGS>>
	ENDIF
FILE.CLOSE
ENDIF

///////////////////////////

[FUNCTION EHNUM]
IF (STRMATCH(0*,<ARGV[0]>))
RETURN 1
ELSE
RETURN 0
ENDIF

[EOF]