import string
from module_info import *
from module_map_icons import *

def save_map_icons():
  ofile = open(export_dir + "map_icons.txt","w")
  ofile.write("map_icons_file version 1\n")
  ofile.write("%d\n"%len(map_icons))
  for map_icon in map_icons:
    if (len(map_icon) == 8):
      ofile.write("%s %d %s %f %d %f %f %f\n"%(map_icon[0],map_icon[1],map_icon[2],map_icon[3],map_icon[4],map_icon[5],map_icon[6],map_icon[7]))
    else:
      ofile.write("%s %d %s %f %d 0 0 0\n"%(map_icon[0],map_icon[1],map_icon[2],map_icon[3],map_icon[4]))
  ofile.close()

def save_python_header():
  ofile = open("./ID_map_icons.py","w")
  for i_map_icon in xrange(len(map_icons)):
    ofile.write("icon_%s = %d\n"%(map_icons[i_map_icon][0],i_map_icon))
  ofile.close()

print "Exporting map icons..."
save_map_icons()
save_python_header()
