show map timestamp in map info menu

also: more stuff in the map settings menu

getmaptimestamp fmt

  Returns the "last written" timestamp of the current map in the requested
  format. If fmt starts with "U", the time is given as UTC, otherwise
  as local time. If fmt is empty, or not given or just the "U", the format
  defaults to "YYYYMMDD_hh.mm.ss". Use "%c" to get something nicer.

DOCREF getmaptimestamp
This commit is contained in:
ac-stef
2016-09-04 15:00:00 +02:00
parent c7c02521ad
commit bc2a091f95
4 changed files with 22 additions and 6 deletions
+18 -4
View File
@@ -154,10 +154,6 @@ newmenu [Map operations]
menuitem "Newmap (128x128 cubes - recommended)" [ newmap 7 ]
menuitem "Newmap (256x256 cubes)" [ newmap 8 ]
menuitem "Increase mapsize (2x)" [ mapenlarge; echo The map size has been increased by 2. However, the new space is solid. To utilize it, you will need to turn it into non-solid space, by selecting it and pressing G. ]
menuitem "Edit map message" editmapmsg
menuitem "Select map license" [ showmenu "Select map license" ]
menuitem "Edit map license comment" [ editsvar mapinfo_comment ]
menuitem "Show map info" [ showmenu "Show map info" ] // FIXME: move to more appropriate menu
menuitem "Print entity stats" entstats
menuitem "Select the next closest entity" nextclosestent
menuitem "Copy the current closest entity" copyent
@@ -189,9 +185,27 @@ menuinit [
if (! (strlen $n)) [n = <default>]
menuitem (concatword "Notexture:\t\t\t\t" (pop n)) [showmenu "Set notexture"]
menuitem (concatword "Skymap:\t\t\t\t\t" $loadsky) [showmenu skymaps]
menuitem "" -1
if (strlen $mapmsg) [
menuitem (concat "Map message:" $mapmsg) editmapmsg
] [
menuitem "Edit map message..." editmapmsg
]
if (strlen $mapinfo_license) [
menuitem (concatword "Map license tag: \"" $mapinfo_license "\"") [ showmenu "Select map license" ]
if (strlen $mapinfo_comment) [
menuitem (concat "Map license comment:" $mapinfo_comment) [ editsvar mapinfo_comment ]
] [
menuitem "Edit map license comment..." [ editsvar mapinfo_comment ]
]
] [
menuitem "Select map license..." [ showmenu "Select map license" ]
]
] [
menuitem "menu only available in edit mode" -1
]
menuitem "" -1
menuitem "Show map info..." [ showmenu "Show map info" ]
]
newmenu [Water colour]
+2 -1
View File
@@ -126,8 +126,9 @@ newmenu "Show map info"
menuinit [
resetcurmenu
menuitem (concatword "Current map: \fs\f1" (curmap) "\fr rev " $curmaprevision) -1
menuitem (concat "Last saved:" (getmaptimestamp %c) "(local time)") -1
if (strlen $mapmsg) [
menuitem $mapmsg -1
menuitem (concat "Map message:" $mapmsg) -1
]
if (< (findlist $__maplicense_list $mapinfo_license) 0) [
menuitem (concatword "map license tag: \"" $mapinfo_license "\"") -1
+1 -1
View File
@@ -26,7 +26,7 @@ const char *timestring(time_t t, bool local, const char *fmt, char *buf)
struct tm *timeinfo, b;
timeinfo = local ? localtime_r(&t, &b) : gmtime_r(&t, &b);
#endif
strftime(buf, sizeof(string) - 1, fmt ? fmt : "%Y%m%d_%H.%M.%S", timeinfo); // sortable time for filenames
strftime(buf, sizeof(string) - 1, fmt && *fmt ? fmt : "%Y%m%d_%H.%M.%S", timeinfo); // sortable time for filenames
return buf;
}
+1
View File
@@ -773,6 +773,7 @@ COMMAND(showmapdims, "");
extern void preparectf(bool cleanonly = false);
int maploaded = 0;
VAR(curmaprevision, 1, 0, 0);
COMMANDF(getmaptimestamp, "s", (char *fmt) { result(hdr.timestamp ? timestring((time_t)hdr.timestamp, *fmt != 'U', *fmt == 'U' ? fmt + 1 : fmt) : "no timestamp stored"); });
extern char *mlayout;
extern int Mv, Ma, Hhits;