-+-+-+-+-+-+-+-+ START OF PART 6 -+-+-+-+-+-+-+-+
X        else
X           if pt::zone=4 then pt::government=4
X             else
X                pt::government=int(4*rnd+1)
X             end if
X        end if
X        pt::law=int(10*rnd+1)
X        pt::trade=int(12*rnd+1)
X        select pt::zone
X`09  case 1
X`09    pt::tech=int(5*rnd+3)
X          case 2
X`09    pt::tech=int(4*rnd+7)
X          case 3
X            pt::tech=int(5*rnd+1)
X          case 4
X`09    pt::tech=int(2*rnd+9)
X`09  case else
X            pt::tech=int(9*rnd+1)
X `09end select
X        pt::yp=int(60*rnd+1)+int(20*rnd+1)-40
X`09put #1%
X      next i
X     free #1%
X     goto 550   ! read in local galaxy data
X`20
X2070 ! --------------- Generate Random Name -------------------
X     letter=int(2*rnd)
X     n$=''
X     v$="AEIOU"
X     c$="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
X     for j=1 to int(rnd*3+4)
X        if letter=1 then
X           a=int(5*rnd+1)\n$=n$+mid$(v$,a,1)\letter=0
X        else
X           a=int(26*rnd+1)\n$=n$+mid$(c$,a,1)\letter=1
X        end if
X     next j
X     return
X`20
X2100 ! ----------------- Describe Planet ---------------------
X     call smg$begin_pasteboard_update(new_pid)
X     if scanner_on=1 then call display(12,) end if
X     call display(32,)
X     call display(29,)
X     call smg$end_pasteboard_update(new_pid)
X     a$="Data on:         "+edit$(pt::pname,128%)
X     call display(30,a$)
X     r=sqr(pt::xp`5E2+pt::yp`5E2)
X     ra=atan(pt::xp,pt::yp)
X     a$=""
X     call display(30,a$)
X     a$="Classification:  "+s0$(pt::zone)
X     call display(30,a$)
X     a$="Galactic Coords. Ring:"+str$(int(r))+" Ray:"+ &
X     str$(int(ra))
X     call display(30,a$)
X     a$="Population:      "+str$(pt::population)+" Billion"
X     call display(30,a$)
X     a$="Government:"
X     call display(30,a$)
X     a$="  "+s1$(pt::government)
X     call display(30,a$)
X     a$="Law Level:"
X     call display(30,a$)
X     a$="  "+s2$(pt::law)
X     call display(30,a$)
X     a$="Trade Class:"
X     call display(30,a$)
X     a$="  "+s3$(pt::trade)
X     call display(30,a$)
X     a$="Technical Level: "
X     call display(30,a$)
X     a$="  "+s4$(pt::tech)
X     call display(30,a$)
X     if scanner_on=1 then
X       new_smg=1\gosub 3000
X       call display(31,)
X     end if
X     return
X
Xupdate_prices:
X     ! check whether prices on a planet are to be changed
X     when error in
X       get #3%, key#0% eq name$(pr::planet), wait 60%
X       tp=75*(3+pt::population)
X       for i=1 to ntcargo
X         if c(i)::qtrade>tp then`20
X           c(i)::pprice=int(c(i)::bprice/2+EXP(-(c(i)::qtrade-tp)/(2*tp))* &
X                 c(i)::bprice/2)
X         else
X           c(i)::pprice=c(i)::bprice
X         end if
X       next i
X       update #3%\free #3%
X     use
X     end when
X     return
X`20
X2200 ! ----------------------- Status -------------------------
X     call display(4,)
X     if scanner_on=1 then call display(12,) end if
X     a$="----- Commander "+edit$(pr::personalname,128%)+" ------"
X     call display(24,a$)
X     a$=""
X     call display(24,a$) `20
X     a$="Rank:               "+rank$(pr::rank)
X     call display(24,a$) `20
X     a$="Kills:              "+str$(pr::kills)
X     call display(24,a$)
X     a$="Legal Status:       "+legal$(pr::legal)
X     call display(24,a$) `20
X     call display(24,"")
X     call display(24,"------- Ship Status -------")
X     a$="Type:               "+ edit$(s(pr::shiptype)::sname,128%)
X     call display(24,a$)
X     a$="Empty Cargo Space:  "+ str$(pr::maxcargo)+" units"
X     call display(24,a$)
X     a$="Jump Range:         "+ str$(pr::maxfuel)+" light years"
X     call display(24,a$)
X     a$="Maneuver Speed:    "+ str$((pr::speed)*2000)+" km/s"
X     call display(24,a$)
X     a$="Comlink1, Comlink2: "+str$(pr::chan1)+", "+str$(pr::chan2)
X     call display(24,a$)
X     call display(24,"")
X     if pr::totcargo<>0 then
X`09col_pos=48
X`09row_pos=1
X        a$="Cargo carried  Amount"
X        call display(27,a$)
X        n = 0
X        for i=1 to ntcargo
X          if pr::cargo(i)<>0 then
X            n = n + 1
X            a$=left$(c(i)::trade,13)+"  "+str$(pr::cargo(i))
X            a$=a$+ " "+edit$(c(i)::unit,128%)+"s"`20
X`09    row_pos=n + 2
X            call display(27,a$)
X          end if
X       next i
X     end if   `20
X     call display(17,)
X     call display(4,)
X     a$="Equipment mounted"
X     call display(24,a$)
X     call display(24,"")
X     for i=1 to ntequip
X       if i<>13 and pr::equip(i)=1 then`20
X         a$=" - "+edit$(e(i)::ename,128%)
X         call display(24,a$)
X       end if
X     next i
X     if scanner_on=1 then
X        new_smg=1
X        gosub 3000
X     end if
X     return
X`20
X2300 ! ------------------- Interplanetary Jump ----------------------
X     if pr::on_ground=1 then melt=0 end if
X     if melt=3 then
X       a$="Your ionization reactor is shut down - No jump is possible."
X       call display(23,a$)
X       return
X     end if
X     if scanner_on=1 then call display(12,) end if
X     call display(4,)
X     call display(21,)
X     a$="Worlds within jump range from "+edit$(pt::pname,128%)+ &
X      " are listed above."
X     call display(23,a$)
X     a$="World          Distance    Ring   Ray      Zone"
X     call display(24,a$)
X     p_count=1
X     for i=1 to numplanets
X       ra=atan(xp(i),yp(i))
X       r=sqr(xp(i)`5E2+yp(i)`5E2)
X       d=sqr((xp(i)-pt::xp)`5E2+(yp(i)-pt::yp)`5E2)
X       if d<=pr::fuel and pt::pname<>name$(i) then
X         if p_count/14=int(p_count/14) then`20
X`09   call display(17,)
X           call display(4,)
X         end if
X         a1$=str$(int(d))
X`09 a2$=str$(int(r))
X`09 a3$=str$(int(ra))
X         a$= name$(i)+a1$+space$(12-len(a1$))+a2$+space$(8-len(a2$))+ &
X           a3$+space$(8-len(a3$))+s0$(zone(i))    `20
X        p_count=p_count+1
X`09call display(24,a$)    `20
X       end if
X     next i
X     call display(23,"")
X2320 while 1=1
X       b$=""
X       a$="World to jump to> "\call display(1,a$)
X       if a$="" then
X         if scanner_on=1 then
X           new_smg=1
X           gosub 3000
X         end if
X         return
X       end if
X       b$=edit$(a$,32%)
X       for i=1 to numplanets
X         if b$=name$(i) then`20
X`09   goto 2330`20
X         end if
X       next i
X       call display(33,"Planet name not found.")
X     next
X2330 newplanet=i\d=sqr((xp(newplanet)-pt::xp)`5E2+(yp(newplanet)-pt::yp)`5E2
V)
X     if int(d)>pr::fuel and super_user_mode%=0 then
X       call display(33,"That world is out of jump range.")
X       goto 2320
X     end if
X     if pr::planet=newplanet then melt=2 end if
X     call display(4,)
X     pr::fuel=pr::fuel-int(d)
X     oldplanet=pr::planet
X     pr::planet=newplanet
X     pr::moves=pr::moves+1
X     a$="===== ENGAGING HYPERSPACE DRIVE ====="
X     call display(24,a$)    `20
X     if numevents>0 then gosub 5200 end if
X     row_pos=3
X     col_pos=1
X     for i=3 to 1 step -1
X       a$="HYPERDRIVE ACTIVATION INITIATING: "+str$(i)
X       call display(27, a$)
X       sleep 1
X       if rnd*100>(s(pr::shiptype)::reliability) and melt=2 and &
X`09`09`09`09`09`09`09pr::on_ground=0 then
X`09 call display(24,"")
X         a$="IONIZATION REACTOR OVERLOAD - EMERGENCY ABORT SEQUENCE ACTIVATE
VD"
X         call display(24,a$)
X         melt=1
X       end if
X     next i
X     if melt=1 and rnd>.5 then
X       a$="ABORT PROCESS COMPLETE - REACTOR STABILIZED"
X       call display(24,a$)
X       pr::planet=oldplanet
X       melt=3
X     end if
X     if melt=1 then
X       a$="REACTOR SHUT DOWN FAILED"`20
X       call display(24,a$)
X       condition$="RED"\call display(16,condition$)
X     end if
X     row_pos=5
X     col_pos=1
X     a$="===== HYPERSPACE DRIVE ENGAGED ====="
X     call display(27,a$)
X     call display(24,"")
X     call display(24,"")
X     pr::ban=0\pr::on_ground=0
X     temp = 100 - pr::time_owned/50*s(pr::shiptype)::reliability
X     if temp< s(pr::shiptype)::reliability then`20
X`09temp = s(pr::shiptype)::reliability`20
X     end if
X     if ((rnd*100>temp or melt=1) &
X`09and melt<>3 and super_user_mode%=0) then
X       a$="MISJUMP - Your ship shakes and jerks wildly before stablizing !!!
V!"
X       call display(24,a$)
X       condition$="YEL"\call display(16,condition$)
X       pr::planet=int(numplanets*rnd)+1
X     end if
X     ! update names to be displayed on scanner.
X     pname=name$(pr::planet)
X     ray=atan(xp(pr::planet),yp(pr::planet))
X     ring=sqr(xp(pr::planet)`5E2+yp(pr::planet)`5E2)
X     get #1%, key #0% eq name$(pr::planet), wait 60\free #1%
X     a$="Jump completed - You are orbiting "+edit$(pt::pname,128%)+"."
X     call display(24,a$)
X     revived$=""
X     gosub 4900\gosub 4800`09! tharg messages, zone messages
X     gosub 2100`09`09`09! describe planet
X     loan_reject=0`09`09! free to apply again
X     pr::debt=pr::debt+int(pr::debt*(pr::interest/100))
X     if pr::due-pr::moves=0 and pr::debt>0 then
X`09m$= "Complete Loan repayment of "+str$(pr::debt)+" is due on landing."
X`09sender$="GBNK"
X`09u$=pr::username
X`09gosub send_message
X     end if
X     if pr::due-pr::moves<0 and pr::debt>0 then
X`09m$="You are OVERDUE on your loan repayment.  Your account has been@"+ &
X`09`09"turned over to the police for collection."
X`09sender$="GBNK"
X`09u$=pr::username
X`09gosub send_message
X`09pr::legal=2
X     end if
X     if pr::due-pr::moves<-10 and pr::debt>0 then pr::legal=3 end if
X     pr::rpos=int(12*rnd+5)\pr::direction=1
X     gosub delete_player_from_action`09! delete from last planet
Xadd_to_action:
X     gosub add_player_to_action`09`09! add to new planet action file
X
X     if new_action = 0 then`09! stuff already there - free up action file
X       update #3%\free #3%
X       gosub init_equipment
X       gosub update_prices
X       new_smg=1\gosub 3000
X       return
X     end if
X
X     ! first player to arrive here - initialize everything....
X     ! regenerate quantities available
X     gosub 1900
X     ! determine ships present on completing jump
X     if (pt::zone=2 and rnd>.5) or (pt::zone=3 and rnd>.2) or (pt::zone=4) t
Vhen
X       goto 2381
X     end if
X     if pt::zone>4 and pt::population>3 and pt::tech>3 then
X       ! starbase
X       noship=noship+1
X       t(noship)::ship=20
X       t(noship)::senergy=s(20)::menergy
X       t(noship)::spos=pt::population
X       t(noship)::sintent=0
X       t(noship)::smissile=130
X       t(noship)::username="SB-1"
X     end if
X     for i=1 to pt::law
X       a=rnd
X       if a>.6 then
X`09  ! police ships
X          noship=noship+1
X          t(noship)::ship=1
X          t(noship)::senergy=s(1)::menergy
X          t(noship)::spos=int(15*rnd+1)
X          t(noship)::sintent=0
X          t(noship)::smissile=s(1)::mmissile
X          t(noship)::username="GP"+STR$(noship)
X       end if
X     next i
X2381 for i=1 to pt::government
X       a=rnd
X       if a>.7 then
X`09  ! arbitrary ships other than police
X          noship=noship+1
X          t(noship)::ship=int(9*rnd+2)
X          if t(noship)::ship=10 then t(noship)::ship=19 end if
X          t(noship)::spos=int(15*rnd+1)
X          shipno=noship
X          gosub 3100
X          t(noship)::senergy=s(t(noship)::ship)::menergy
X          if rnd>.97 and pr::moves>10 then`20
X`09    t(noship)::senergy=t(noship)::senergy+100`20
X`09  end if
X          t(noship)::smissile=s(1)::mmissile
X          t(noship)::username="S"+str$(noship)+str$(int(10*rnd))
X       end if
X       if a>.5 then
X`09  ! asteroids
X          noship=noship+1
X          t(noship)::ship=10
X          t(noship)::spos=int(15*rnd+1)
X          shipno=noship
X          gosub 3100
X          t(noship)::senergy=s(10)::menergy
X          t(noship)::smissile=s(10)::mmissile
X          t(noship)::username="-"
X       end if
X       if a>.7 then t(noship)::sintent=0
X       end if
X     next i
X     a=rnd\where=5
X     if (a>.9 and pt::zone>4) or (a>.3 and pt::zone=1) or (pt::zone=4) then
X       b=int((pr::thargoid/1.5)*rnd+1)
X     else b=0
X     end if
X     if b>3 and rnd>.78 then
X       ! thargoid mothership
X       noship=noship+1
X       t(noship)::ship=21
X       t(noship)::spos=int(10*rnd)
X       shipno=noship
X       gosub 3100
X       t(noship)::senergy=s(21)::menergy
X       t(noship)::smissile=s(21)::mmissile
X       t(noship)::username="TMS1"
X     else
X       ! thargoid raid
X       for i=1 to b
X         noship=noship+1
X         t(noship)::ship=9
X         t(noship)::spos=int(5*rnd+where)
X         shipno=noship
X         gosub 3100
X         t(noship)::senergy=s(9)::menergy
X         t(noship)::smissile=s(9)::mmissile
X         t(noship)::username="TH"+str$(int(noship))
X       next i
X     end if
X     if pr::moves>25 or debug%=1 then
X       if rnd>.965 or debug%=1 then
X`09 ! exotic ship encounter
X         noship=noship+1
X         t(noship)::ship=int(4*rnd+15)
X         !t(noship)::ship = 15
X`09 t(noship)::spos = int(7*rnd + 5)
X         shipno=noship
X         gosub 3100
X         t(noship)::senergy=s(t(noship)::ship)::menergy
X         t(noship)::smissile=s(t(noship)::ship)::mmissile
X         t(noship)::username="S"+str$(noship)+str$(int(10*rnd))
X       end if
X     end if
X     if pt::zone=1 then gosub 4500 end if
X     gosub galactic_fleet
X     if pr::rank>3 and pr::legal>2 then gosub 4030 end if
X     if pr::rank>1 and pr::legal>2 then gosub 4000 end if
X     when error in
X       put #3%\free #3%
X     use
X       if err=134 then`09`09! retry adding record if duplicate key
X         continue add_to_action
X       end if
X     end when
X     new_smg=1\gosub 3000
X     return
X`20
X2400 ! ------------------- land on planet -----------------------
X     ! check if already on the ground.
X     jump_flag=0
X     if pr::on_ground=1 then
X        call display(33,"You're already on the planetary surface.")
X        return
X     end if
X     ! display computer activated if in computer mode
X     get #3%, key #0 eq name$(pr::planet), wait 60
X     t(pr::shipnum)::player = 1
X     update #3%\free #3%
X     if g_option$(4)="ON" then
X       a$="===== Landing Computer activated ====="
X       call display(23,a$)
X       call display(15,"ON ")
X     end if
X     ! 50% chance of you having the initiative if landing in manual.
X     if g_option$(4)="OFF" and rnd>.5 then gosub 3300 end if
+-+-+-+-+-+-+-+-  END  OF PART 6 +-+-+-+-+-+-+-+-
