add embedded license information to all official maps

also add script to generate a summary map license file

new (undocumented) debug commands:
  loadmap <mapname>
    loads a map directly, easy to use from scripts

  debugline <filename> <text>
    writes text to file (no path names allowed)
This commit is contained in:
ac-stef
2016-07-30 01:47:30 +02:00
parent 0083c51b3b
commit 59d4f4d847
39 changed files with 56 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,34 @@
// - batch-update map license information
// - generate maps_readme.txt (map license summary file)
// (requires debug binary of game client, because of loadmap and debugline)
tempalias maplist [dev_aqueous dev_arabian dev_arctic dev_arid dev_avenue dev_cavern dev_complex dev_depot dev_desert dev_desert2 dev_desert3 dev_douze dev_edifice dev_elevation
dev_gothic dev_iceroad dev_industrial dev_ingress dev_keller dev_lainio dev_mines dev_outpost dev_power dev_rattrap dev_scaffold dev_shine dev_snow dev_stellar dev_sunset
dev_swamp dev_terros dev_toxic dev_urban dev_venison dev_wasteland dev_werk]
tempalias lfn maps_license.txt
debugline $lfn "TO ENSURE YOU HAVE NO ERRORS WITH ASSAULTCUBE:\n\t* Don't edit, rename or delete ANY files in this directory.\n\t* Don't add files to this directory.\n"
debugline $lfn "This folder contains all builtin (a.k.a. \"official\") maps.\nEach map contains embedded information about author and license, accessible from within the game.\nHere's a summary:\n"
if 0 [ looplist [
new_content cc-by-nc-sa-3.0 "by foo, email: [email protected]"
] [ m l cc ] [
loadmap $m
if (strlen $l) [ mapinfo_license $l ]
if (strlen $cc) [ mapinfo_comment $cc ]
if (+ (strlen $l) (strlen $cc)) [ savemap $m ]
] ]
looplist $maplist m [
loadmap $m
debugline $lfn (concatword $mapmsg " (" $m ".cgz, size " (mapsize) ", revision " $curmaprevision ")")
if (< (findlist $__maplicense_list $mapinfo_license) 0) [
debugline $lfn (concatword "map license tag: \"" $mapinfo_license "\"")
] [
debugline $lfn (getalias (concatword __maplicense_fullname_ $mapinfo_license))
]
if (strlen $mapinfo_comment) [
debugline $lfn $mapinfo_comment
]
debugline $lfn ""
]
+15
View File
@@ -1875,3 +1875,18 @@ void debugargs(char **args, int numargs)
}
COMMAND(debugargs, "v");
#ifndef STANDALONE
#ifdef _DEBUG
void debugline(char *fname, char *line) // print one line to a logfile
{
if(!multiplayer())
{
stream *f = openfile(behindpath(fname), "a");
if(f) f->printf("%s\n", line);
if(f) delete f;
}
}
COMMAND(debugline, "ss");
#endif
#endif
+7
View File
@@ -938,6 +938,13 @@ bool load_world(char *mname) // still supports all map formats that have
return true;
}
#ifdef _DEBUG
COMMANDF(loadmap, "s", (char *mapname)
{
if(!multiplayer()) load_world(mapname);
});
#endif
// support reading and writing binary data in config files
static bool hexbinenabled = false;