-+-+-+-+-+-+-+-+ START OF PART 7 -+-+-+-+-+-+-+-+
X
X     ! main landing_loop - iterate until ground is reached
X     if debug% = 1 then print "rpos: ";pr::rpos;" on_gnd ";pr::on_ground &
X        ;" jump: ";jump_flag end if
X     while (pr::rpos>0 and pr::on_ground=0 and jump_flag=0)
X       if g_option$(4)="OFF" then
X         a$="MANUAL landing mode active."
X         call display(23,a$)
X         call display(15,"OFF")
X         gosub 3200
X         iterate
X       end if
X       gosub 3300`09`09! update surrounding ships
X       ! check for comlink messages
X       get #2%, key #0% eq pr::username, wait 60\free #2%
X       if mid$(op::message,1,1)<>" " then
X         gosub 1200
X       end if
X       gosub 1700               ! display status
X       ! switch off landing comp if near something of significance
X       if near_important=1 then gosub 2450 end if
X       get #3%, key #0 eq name$(pr::planet), wait 60
X       pr::rpos=pr::rpos-pr::speed
X       if pr::rpos<0 then pr::rpos=0 end if
X       update #3%\free #3%
X     next
X     ! check if player aborted landing sequnce by doing a combat jump
X     if jump_flag=1 then
X       return
X     end if
X     ! make sure player is on ground
X     get #3%, key #0 eq name$(pr::planet), wait 60
X     t(pr::shipnum)::spos = 0
X     update #3%\free #3%
X     call display(4,)\call display(12,)\scanner_on=0
X     a$="===== Landing completed successfully ====="
X     call display(24,a$)
X     if (pr::cargo(2)+pr::cargo(7))<>0 and rnd>.7 and pr::legal=1 then
X         pr::legal=2
X     end if
X     ! update trading computer, if installed
X     if pr::equip(23)=1 then
X       for i=1 to ntcargo
X`09 tracomp%(pr::planet,i)=tracomp%(pr::planet,i)*tracomp%(pr::planet, &
X`09   ntcargo+3)+c(i)::pprice
X`09 if tracomp%(pr::planet,ntcargo+3)<>0 then
X           tracomp%(pr::planet,i)=int(tracomp%(pr::planet,i)/ &
X`09     (tracomp%(pr::planet,ntcargo+3)+1))
X`09 end if
X       next i
X       tracomp%(pr::planet,ntcargo+3)=tracomp%(pr::planet,ntcargo+3)+1
X     end if
X     pr::time_owned = pr::time_owned + 1
X     a=(pr::maxfuel-pr::fuel)*fuelprice+10\melt=0\ecm_status%=0
X     select int((pt::tech+pt::population)/2)
X        case 1,2
X          a$= "You land in a blackened, muddy clearing with wooden huts "+&
X            "surrounding it."
X        case 3,4
X         a$= "You land at a small pre-fab spaceport with minimal facilities.
V"
X        case 5,6
X          a$= "You arrive at a modest, but well-maintained spaceport."
X        case 7,8
X          a$= "You land at an extensive, up-to-date spacecenter."
X        case 9,10
X          a$="You land in a gleaming modern spaceport/trading center on "+ &
X            edit$(pt::pname,128%)+"."
X     end select
X     call display(24,a$)
X     if pt::tech<3 and pr::energy<pr::maxenergy and rnd>.4 then
X        a$= "The energy recharging unit is out of service - Energy not "+ &
X           "recharged."
X        call display(24,a$)
X     else
X        if pr::energy<pr::maxenergy then
X          a$="You recharge your energy unit to maximum capacity."
X          call display(24,a$)
X          pr::energy=pr::maxenergy
X        end if
X     end if
X     if g_option$(5)="ON" and a<=pr::credits then
X       a$="Refueling performed. Cost: "
X       pr::fuel=pr::maxfuel
X       pr::credits=pr::credits-a
X       a$= a$+str$(a)+" Credits."
X       call display(24,a$)
X     end if
X     if g_option$(6)="ON" then
X        a=(pr::maxmissile-pr::equip(13))*50+10
X        if a>pr::credits or a=10 then`20
X`09  a$="No missiles purchased."
X          call display(24,a$)
X        else
X          pr::credits=pr::credits-a
X          a$= str$((a-10)/50)+" Missiles purchased. "+&
X          "Cost:"+str$(a)+" credits."
X           call display(24,a$)\pr::equip(13)=pr::maxmissile
X        end if
X     end if
X     pr::on_ground=1\condition$="GRE"\call display(16,condition$)
X     gosub 1700        !display status
X     return
X    `20
X2450 !  Switch off landing computer - something interesting nearby
X     a$="===== Ship detected nearby - Switching to manual ====="
X     call display(23,a$)
X     condition$="YEL"
X     call display(16,condition$)
X     call display(15,"OFF")
X     gosub 3200
X     ecm_status%=0
X     pr::direction=1
X     if jump_flag=1 then return end if`09`09! combat jump
X     if pr::rpos<>0 then
X       call display(15,"ON ")
X       condition$="GRE"\call display(16,condition$)
X       a$="===== No ships in immediate vicinity - Reactivating landing" &
X         +" computer ====="
X       call display(23,a$)
X     else
X       a$="===== Surface reached - activating landing computer ====="
X       call display(23,a$)
X     end if
X     return
X`20
X2500 ! ------------------------ Trade --------------------------
X     if pr::on_ground<>1 then
X         call display(33,"You have to be on the surface to trade.")
X         return
X     end if
X     call display(4,)
X     call display(5,)\call display(6,a$)
X2510 a$="TRADE> "\call display(1,a$)
X     menumode$="trade"
X     select a$
X`09case "q",""
X`09  return
X`09case "?","help"
X`09  gosub help
X`09case "x"
X`09  gosub 6000
X`09case "f"
X`09  gosub 2550
X`09case "e"
X`09  gosub 2570
X`09case "p"
X`09  gosub 2600
X`09case "b"
X`09  gosub 2650
X`09case "s"
X`09  gosub 2680
X`09case "c"
X`09  gosub 2200
X        case "u"
X`09  if pr::equip(23)<>1 then`20
X`09    call display(33,"Trading computer not fitted.")
X`09  else gosub 2530 end if
X`09case else
X          call display(33,"Invalid Command - Enter '?' for help")
X`09  goto 2510
X      end select
X      goto 2510
X
X2530 ! ---------------------- Use Trading Computer -------------------
X     call display(5,)\call display(6,a$)\menumode$="comp"
X2535 a$="QUERY COMPUTER> "\call display(1,a$)
X     select a$
X`09case "?","help"
X`09  gosub help
X`09case "pl"
X`09  call display(4,)
X`09  a$= "Trade data is available on the following planets."
X          call display(24,a$)`09 `20
X`09  for i=1 to 100
X`09    if tracomp%(i,1)<>0 then`20
X`09      a$= name$(i)
X              call display(24,a$)
X`09    end if
X`09  next i
X`09case "p"
X`09  a$="PLANET> "\call display(1,a$)
X`09  a$=edit$(a$,32%)
X`09  for i=1 to numplanets
X`09    if name$(i)=a$ and tracomp%(i,1)<>0 then goto 2540 end if
X          next i
X`09  call display(33,"No data available on "+a$+".")
X`09  goto 2535
X2540`09  call display(4,)
X`09  a$= "Trading Data on "+edit$(name$(i),32%)+":"
X          call display(24,a$)
X`09  a$= "Item                estimated Price     Samples"
X          call display(24,a$)
X`09  for j=1 to ntcargo
X            a1$=str$(tracomp%(i,j))
X`09    a2$=str$(tracomp%(i,ntcargo+3))
X`09    a$=c(j)::trade+ a1$+space$(20-len(a1$))+ &
X`09`09a2$
X`09    call display(24,a$)
X`09  next j
X`09case "i"
X`09  a$= "Enter Number of item on which you want trading information."
X          call display(23,a$)
X2542`09  a$="ITEM> "\call display(1,a$)
X`09  a=val(a$)\if a=0 then return end if
X`09  if a<1 or a>ntcargo then`20
X`09    call display(33,"Invalid item number.")
X`09    goto 2542
X`09  end if
X`09  call display(4,)
X`09  pmax=0
X`09  pmin=10000
X`09  a$= "Planet              "+edit$(c(a)::trade,128%)+" price."
X`09  call display(24,a$)
X`09  for i=1 to 100
X`09    if tracomp%(i,a)<>0 then`20
X              a$= name$(i)+space$(20-len(name$(i)))+str$(tracomp%(i,a))
X`09      call display(24,a$)
X`09      if tracomp%(i,a)>pmax then
X`09        pmax=tracomp%(i,a)
X`09        psell$=name$(i)
X`09      end if
X`09      if tracomp%(i,a)<pmin then
X`09        pmin=tracomp%(i,a)
X`09        pbuy$=name$(i)
X`09      end if
X`09    end if
X`09  next i
X
X`09  a$= "The best place to buy "+edit$(c(a)::trade,128%)+" is "+pbuy$+&
X`09`09" (price = "+str$(pmin)+")"
X`09  call display(24,a$)
X`09  a$="and the best place to sell is "+psell$+" (price = "+str$(pmax)+")"
X`09  call display(24,a$)
X`09case "","q"
X`09  return
X`09case else
X`09  call display(33,"Invalid command - Enter '?' for help.")
X     end select
X     goto 2535
X    `20
X2550 ! buy fuel
X     call display(4,)
X     a$="Fuel is selling at "+str$(fuelprice)+" credits/lightyear."
X     call display(24,a$)
X     a$="How much do you want to purchase (max "+str$(pr::maxfuel-pr::fuel)+
V")"
X     call display(24,a$)
X2552 a$="FUEL> "\call display(1,a$)\a=val(a$)
X     if a<0 then goto 2550 end if
X     if a=0 then return end if
X     if a+pr::fuel>pr::maxfuel then
X         call display(33,"Your tanks won't hold that much.")
X         goto 2552
X     end if
X     if (pr::credits-fuelprice*a)<0 then
X         call display(33,"You don't have enough money for that!")
X         goto 2552
X     end if
X     pr::credits=pr::credits-fuelprice*a\gosub 1700
X     pr::fuel=pr::fuel+a
X     gosub 1700`09`09`09! update status
X     a$= "You buy "+str$(a)+" lightyears of fuel."
X     call display(24,a$)
X     return
X
X2570 ! equip ship
X     call display(4,)
X     a$="Item                     Price     Item                     Price"
X     call display(24,a$)
X     col_pos=36
X     row_pos=2
X     for i=1 to ntequip
X         if e(i)::eprice<>-1 or super_user_mode% = 1 then
X`09    a1$=str$(e(i)::eprice)
X            a$= str$(i)+space$(3-len(str$(i)))+e(i)::ename+"  "+a1$
X`09    if i>12 then`20
X`09      call display(27,a$)
X`09      row_pos=row_pos+1`09     `20
X            else
X              call display(24,a$)
X`09    end if
X         end if
X     next i
X     call display(24,"")
X     col_pos=1
X     row_pos=14
X     a$="Note: The purchase of an escape capsule includes ship destructi" &
X`09`09+"on insurance."
X     call display(27,a$)
X2583 a$= "Item to purchase> "
X     call display(1,a$)
X     if a$="" then return end if
X     a=val(a$)
X     if a=0 then return end if
X     if a<0 or a>ntequip or a<>int(a) then
X`09call display(33,"Invalid item - re-enter")
X`09goto 2583
X     end if
X     if super_user_mode%=1 then goto 2590 end if
X     if (pr::credits-e(a)::eprice)<0 then`20
X`09call display(33,"You can't afford that!")
X`09goto 2583
X     end if
X     if ((a=1 or a=3 or a=5) and ((a+1)/2>s(pr::shiptype)::mlaser)) or &
X`09(a=14 and s(pr::shiptype)::mlaser<4) or (a=17 and &
X`09s(pr::shiptype)::mlaser<5) then
X       a$="You can't fit that laser on a "+edit$(s(pr::shiptype)::sname,128%
V)
X       call display(23,a$)
X       goto 2583
X     end if
X     if ((a=2 or a=4 or a=6) and (a/2>s(pr::shiptype)::mlaser)) then
X        a$="You can't fit that laser on a "+edit$(s(pr::shiptype)::sname,128
V)
X        call display(23,a$)    `20
X        goto 2583
X     end if
X     if e(a)::eprice=-1 then
X`09call display(33,"That is not sold on this world.")
X`09goto 2583`20
X     end if
X     if a<>13 and pr::equip(a)=1 then
X         call display(33,"You already have one of those!")
X    `09 goto 2583
X     end if
X     if a=13 and pr::equip(a)=pr::maxmissile then
X         call display(23,"Your missile rack is full.")
X         goto 2583
X     end if
X2590 if a=12 then pr::maxmissile=pr::maxmissile+3 end if
X     if a<>13 then
X        a$="You buy a "+edit$(e(a)::ename,128%)+ &
X`09`09" and install it in your ship."
X        call display(23,a$)
X        pr::credits=pr::credits-e(a)::eprice
X        if a=16 then pr::scanrange=4.5 end if
X        gosub 1700
X     end if
X     if a=1 or a=3 or a=5 or a=14 or a=17 then
X         b=(pr::equip(1)+4*pr::equip(3)+8*pr::equip(5)+pr::equip(14)*16 &
X`09`09+ pr::equip(17)*40)*300
X         a$="You get "+str$(b)+" Credits rebate for trading in your old lase
Vr."
X         call display(23,a$)
X         pr::credits=pr::credits+b
X         gosub 1700
X         pr::equip(1)=0
X         pr::equip(3)=0
X         pr::equip(5)=0
X         pr::equip(14)=0
X         pr::equip(17)=0
X     end if
X     if a=2 or a=4 or a=6 or a=10 then
X         b=int(pr::equip(2)+4*pr::equip(4)+8*pr::equip(6)+pr::equip(10)/2)*3
V00
X         a$="You get "+str$(b)+" credits rebate for turning in your old lase
Vr."
X         call display(23,a$)
X         pr::credits=pr::credits+b\gosub 1700
X         pr::equip(2)=0
X         pr::equip(4)=0
X         pr::equip(6)=0
X         pr::equip(10)=0
X     end if
X     if a=13 then
X        gosub 2900
X     else
X        pr::equip(a)=pr::equip(a)+1
X        if a=8 then pr::maxcargo=pr::maxcargo*2 end if
X        if a=11 then pr::maxenergy=pr::maxenergy+100 end if
X     end if
X     goto 2583
X
X2600 ! see rates
X     call smg$begin_display_update(trade_id)
X     call display(4,)
X     a$="The official trade rates on "+edit$(pt::pname,128%)+ &
X`09" are listed above."
X     call display(23,a$)
X     a$="Item                Price          Quantity"
X     call display(24,a$)
X     when error in`20
X       get #3%, key #0% eq name$(pr::planet), wait 60%\free #3%
X     use
X     end when
X     for i=1 to ntcargo
X       a1$=str$(c(i)::pprice)
X       if c(i)::qtrade=-1 then a2$="Not available"
X       else`20
X         a2$=str$(c(i)::qtrade)
X`09 a2$=a2$+space$(5-len(a2$))+edit$(c(i)::unit,128%)+"s"
X       end if
X       a$=str$(i)+space$(3-len(str$(i)))+c(i)::trade+a1$+space$(15-len(a1$))
V+a2$
X       call display(24,a$)
X     next i
X     call display(24,"")
X     a$="Note - the items marked (*) are classified as illegal by the" &
X`09 +" galactic police"
X     call display(24,a$)    `20
X     call smg$end_display_update(trade_id)
X     return
X
X2650 ! buy cargo
X     if revived$="OK" then`20
X`09a$= "The trading center is closed by government order."
X        call display(23,a$)
X        return
X     end if
X2657 gosub 2600    ! view prices
X
X2667 a$="Item to purchase> "
X     call display(1,a$)
X     a=val(a$)
X     if a=0 then return end if
X     if a<0 or a>10 or a<>int(a) then`20
X`09call display(33,"Re-enter")
X        goto 2667
X     end if
X     if a=2 then`20
X`09a$="Note that the slave trade is looked down upon by the" &
X`09`09+" Galactic Police"
X        call display(23,a$)
X      end if
X     a$="<Can afford : "+str$(int(pr::credits/c(a)::pprice))+" "+ &
X`09edit$(c(a)::unit,128%)+ &
X     "s of "+edit$(c(a)::trade,128%)+"  Can carry : "
X     a$=a$+str$( pr::maxcargo-pr::totcargo)+" "+edit$(c(a)::unit,128%)+"s.>"
X     call display(23,a$)
X     if a=7 then
X        a$="Narcotics are a risky business. Beware..."
X`09call display(23,a$)
X     end if
X     if (c(a)::qtrade = -1) then
X        call display(33,"That item isn't available.")
+-+-+-+-+-+-+-+-  END  OF PART 7 +-+-+-+-+-+-+-+-
