From 4ec3dee3e1f4bb3a0573f03c2db6d5bd828cded7 Mon Sep 17 00:00:00 2001
From: Allanis <allanis@saracraft.net>
Date: Fri, 13 Dec 2013 23:53:06 +0000
Subject: [PATCH] [Add] More table usage for mission static stuff so it doesn't
 get saved.

---
 dat/missions/cargo.lua    | 65 ++++++++++++++++++++-------------------
 dat/missions/es_cargo.lua | 38 +++++++++++++----------
 2 files changed, 55 insertions(+), 48 deletions(-)

diff --git a/dat/missions/cargo.lua b/dat/missions/cargo.lua
index 388763c..a71fa05 100644
--- a/dat/missions/cargo.lua
+++ b/dat/missions/cargo.lua
@@ -6,32 +6,35 @@ lang = lephisto.lang()
 if lang == "es" then
    -- Not translated atm.
 else -- Default english.
-  misn_desc      = {}
-  misn_desc[1]   = "%s in the %s system needs a delivery of %d tons of %s."
-  misn_desc[11]  = "%s in the %s system needs a rush delivery of %d tons of %s before %s (%s left)."
-  misn_desc[21]  = "A group of %s needs to travel to %s in the %s system."
-  misn_reward    = "%d credits"
-  title          = {}
-  title[1]       = "Cargo delivery to %s"
-  title[2]       = "Freight delivery to %s"
-  title[3]       = "Transport to %s"
-  title[4]       = "Delivery to %s"
-  title[11]      = "Rush Delivery to %s"
-  title[21]      = "Transport %s to %s"
-  title[22]      = "Ferry %s to %s"
-  full_title     = "Ship is full"
-  full_msg       = "Your ship is too full.  You need to make room for %d more tons if you want to be able to accept the mission."
-  accept_title   = "Mission Accepted"
-  accept_msg     = {}
-  accept_msg[1]  = "The Workers load the %d tons of %s onto your ship."
-  accept_msg[2]  = "The %s board your ship."
-  toomany_title  = "Too many missions"
-  toomany_msg    = "You have too many active missions."
-  finish_title   = "Succesful Delivery"
-  finish_msg     = "The workers unload the %s at the docks."
-  miss_title     = "Cargo Missing"
-  miss_msg       = "You are missing the %d tons of %s!."
-  misn_time_msg  = "MISSION FAILED: You have failed to delivery the goods on time!"
+  misn_desc       = {}
+  misn_desc[1]    = "%s in the %s system needs a delivery of %d tons of %s."
+  misn_desc[11]   = "%s in the %s system needs a rush delivery of %d tons of %s before %s (%s left)."
+  misn_desc[21]   = "A group of %s needs to travel to %s in the %s system."
+  misn_reward     = "%d credits"
+  title           = {}
+  title[1]        = "Cargo delivery to %s"
+  title[2]        = "Freight delivery to %s"
+  title[3]        = "Transport to %s"
+  title[4]        = "Delivery to %s"
+  title[11]       = "Rush Delivery to %s"
+  title[21]       = "Transport %s to %s"
+  title[22]       = "Ferry %s to %s"
+  full            = {}
+  full[1]         = "Ship is full"
+  full[2]         = "Your ship is too full.  You need to make room for %d more tons if you want to be able to accept the mission."
+  accept_title    = "Mission Accepted"
+  accept_msg      = {}
+  accept_msg[1]   = "The Workers load the %d tons of %s onto your ship."
+  accept_msg[2]   = "The %s board your ship."
+  msg_title       = {}
+  msg_msg         = {}
+  msg_title[1]    = "Too many missions"
+  msg_msg[1]      = "You have too many active missions."
+  msg_title[2]    = "Succesful Delivery"
+  msg__msg[2]     = "The workers unload the %s at the docks."
+  msg_title[3]    = "Cargo Missing"
+  msg__msg[3]     = "You are missing the %d tons of %s!."
+  msg_msg[4]      = "MISSION FAILED: You have failed to delivery the goods on time!"
 end
 
 -- Create the mission.
@@ -119,7 +122,7 @@ end
 -- Mission is accepted.
 function accept()
   if player.freeCargo() < carg_mass then
-    tk.msg(full_title, string.format(full_msg, carg_mass-player.freeCargo()))
+    tk.msg(full[1], string.format(full[2], carg_mass-player.freeCargo()))
     misn.finish()
 
   elseif misn.accept() then -- Able to accept the mission, hooks BREAK after accepting.
@@ -137,7 +140,7 @@ function accept()
        hook.time("timeup")
     end
   else
-    tk.msg(toomany_title, toomany_msg)
+    tk.msg(msg_title[1], msg_msg[1])
     misn.finish()
   end
 end
@@ -148,7 +151,7 @@ function land()
   if landed == planet then
     if player.rmCargo(carg_id) then
       player.pay( reward )
-      tk.msg(finish_title, string.format( finish_msg, carg_type))
+      tk.msg(msg_title[2], string.format(msg_msg[2], carg_type))
 
       -- Modify the faction standing.
       if player.getFaction("Merchant") < 70 then
@@ -163,7 +166,7 @@ function land()
 
       misn.finish(true)
     else
-      tk.msg(miss_title, string.format( miss_msg, carg_mass, carg_type))
+      tk.msg(msg_title[3], string.format(msg_msg[3], carg_mass, carg_type))
     end
   end
 end
@@ -171,7 +174,7 @@ end
 -- Time hook.
 function timeup()
   if time.get() > misn_time then
-    player.msg(misn_time_msg)
+    player.msg(msg_msg[4])
     misn.finish(false)
   end
   misn.setDesc(string.format( misn_desc[21], planet:name(), system:name(),
diff --git a/dat/missions/es_cargo.lua b/dat/missions/es_cargo.lua
index 1c704c1..0e3ac97 100644
--- a/dat/missions/es_cargo.lua
+++ b/dat/missions/es_cargo.lua
@@ -11,17 +11,21 @@ else -- Default english.
   title = {}
   title[1]      = "ES: Ship to %s"
   title[2]      = "ES: Delivery to %s"
-  full_title    = "Ship is full"
-  full_msg      = "Your ship is too full.  You need to make room for %d more tons if you want to be able to accept the mission."
-  accept_title  = "Mission Accepted"
-  accept_msg    = "The Empire workers load the %d tons of %s onto your ship."
-  toomany_title = "Too many missions"
-  toomany_msg   = "You have too many active missions."
-  finish_title  = "Succesful Delivery"
-  finish_msg    = "The Empire workers unload the %s at the docks."
-  miss_title    = "Cargo Missing"
-  miss_msg      = "You are missing the %d tons of %s!."
-  miss_timeup   = "MISSION FAILED: You have failed to deliver the goods to the Empire on time!"
+  full          = {}
+  full[1]       = "Ship is full"
+  full[2]       = "Your ship is too full.  You need to make room for %d more tons if you want to be able to accept the mission."
+  msg_title     = {}
+  msg_title[1]  = "Mission Accepted"
+  msg_title[2]  = "Too many missions"
+  msg_title[3]  = "Succesful Delivery"
+  msg_msg       = {}
+  msg_msg[1]    = "The Empire workers load the %d tons of %s onto your ship."
+  msg_msg[2]    = "You have too many active missions."
+  msg_msg[3]    = "The Empire workers unload the %s at the docks."
+  miss          = {}
+  miss[1]       = "Cargo Missing"
+  miss[2]       = "You are missing the %d tons of %s!."
+  miss[3]       = "MISSION FAILED: You have failed to deliver the goods to the Empire on time!"
 end
 
 --    Empire shipping missions are always timed, but quite lax on the schedules.
@@ -77,15 +81,15 @@ end
 -- Mission is accepted.
 function accept()
   if player.freeCargo() < carg_mass then
-    tk.msg(full_title, string.format(full_msg, carg_mass-player.freeCargo()))
+    tk.msg(full[1], string.format(full[2], carg_mass-player.freeCargo()))
     misn.finish()
   elseif misn.accept() then -- Able to accept the mission, hooks BREAK after accepting.
     carg_id = player.addCargo(carg_type, carg_mass)
-    tk.msg(accept_title, string.format( accept_msg, carg_mass, carg_type))
+    tk.msg(msg_title[1], string.format(msg_msg[1], carg_mass, carg_type))
     hook.land("land") -- Only hook after accepting.
     hook.time("timeup")
   else
-    tk.msg(toomany_title, toomany_msg)
+    tk.msg(msg_title[2], msg_title[2])
     misn.finish()
   end
 end
@@ -96,7 +100,7 @@ function land()
   if landed == planet then
     if player.rmCargo(carg_id) then
       player.pay(reward)
-      tk.msg(finish_title, string.format(finish_msg, carg_type))
+      tk.msg(msg_title[3], string.format(msg_msg[3], carg_type))
 
       -- Increase empire shipping mission counter.
       n = var.peek("es_misn")
@@ -113,7 +117,7 @@ function land()
 
       misn.finish(true)
     else
-      tk.msg(miss_title, string.format( miss_msg, carg_mass, carg_type))
+      tk.msg(miss[1], string.format(miss[2], carg_mass, carg_type))
     end
   end
 end
@@ -121,7 +125,7 @@ end
 -- Time hook.
 function timeup()
   if time.get() > misn_time then
-    player.msg(miss_timeup)
+    player.msg(miss[3])
     misn.finish(false)
   end
   misn.setDesc(string.format( misn_desc, carg_mass, carg_type,