// - 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: foo@bar.org"
] [ 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 ""
]
