From 2a76ee4d42743b45cbe5444c5279fba405d5314f Mon Sep 17 00:00:00 2001 From: Allanis Date: Thu, 2 May 2013 20:24:53 +0100 Subject: [PATCH] [Change] Improved ltime_pretty and increased time to do rush deliveries. --- dat/missions/cargo.lua | 13 +++++++++---- src/ltime.c | 11 +++++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/dat/missions/cargo.lua b/dat/missions/cargo.lua index 0239551..388d584 100644 --- a/dat/missions/cargo.lua +++ b/dat/missions/cargo.lua @@ -4,7 +4,7 @@ if lang == "es" then else -- Default English. misn_desc = {} misn_desc[1] = "%s in the %s system needs a delivery of %d tons of %s." - misn_desc[2] = "%s in the %s system needs a rush delivery of %d tons of %s before %s." + misn_desc[2] = "%s in the %s system needs a rush delivery of %d tons of %s before %s (%s left)." misn_reward = "%d Scred." title = {} title[1] = "Cargo delivery to %s" @@ -41,7 +41,7 @@ function create() -- Missions generic. i = rnd.int(4) - if i < 4 then -- Cargo delivery. + if i < 3 then -- Cargo delivery. misn_type = "Cargo" i = rnd.int(3) misn.setTitle(string.format(title[i+1], planet)) @@ -71,9 +71,11 @@ function create() carg_mass * (150+rnd.int(75)) + rnd.int(1500) elseif misn_type == "Rush" then - misn_time = time.get() + rnd.int(time.units(2), time.units(4)) * misn_dist + misn_time = time.get() + time.units(2) + + rnd.int(time.units(2), time.units(4)) * misn_dest misn.setDesc(string.format(misn_desc[2], planet, system, - carg_mass, carg_type, time.str(misn_time))) + carg_mass, carg_type, time.str(misn_time), + time.str(misn_time), time.str(misn_time-time.get()))) reward = misn_dist * carg_mass * (450+rnd.int(250)) + rnd.int(3500) end @@ -112,6 +114,9 @@ end -- Time hook. function timeup() + misn.setDesc(string.format(misn_desc[2], planet, system, + carg_mass, carg_type, + time.str(misn_time), time.str(misn_time-time.get()))) if time.get() > misn_time then player.msg("You have failed to deliver the goods on time!") misn.finish(false) diff --git a/src/ltime.c b/src/ltime.c index 84aaccc..28d8d1a 100644 --- a/src/ltime.c +++ b/src/ltime.c @@ -15,16 +15,19 @@ unsigned int ltime_get(void) { // Return the time in pretty text. char* ltime_pretty(unsigned int t) { unsigned int lt; + int maj, stu; char str[128], *ret; if(t == 0) lt = lephisto_time; else lt = t; // UST (Universal Synchronized Time) - unit is STU (Syncronized Time Unit). - snprintf(str, 128, "UST %d.%03d", - lt / (1000*LTIME_UNIT_LENGTH), - (lt / (LTIME_UNIT_LENGTH)) % 1000); - + maj = lt / (1000*LTIME_UNIT_LENGTH); + stu = (lt / (LTIME_UNIT_LENGTH)) % 1000; + if(maj == 0) // Only STU. + snprintf(str, 128, "%03d STU", stu); + else // Full format. + snprintf(str, 128, "UST %d.%03d", maj, stu); ret = strdup(str); return ret;