misc/libfreetype/builds/mac/ascii2mpw.py
author unc0rr
Wed, 25 Jul 2012 16:24:30 +0400
changeset 7433 c7fff3e61d49
parent 5172 88f2e05288ba
permissions -rw-r--r--
- Implement AI land marks which only used to tracks visited areas on the map for now. Significantly reduces wasting of cpu time by AI checking same place several times (10x or even more in rare cases) - More branching in walk algorythm which allows for better coverage of reachable places. Sometimes makes AI perform ridiculous jumping just to make a tiny step. - Small fixes/adjustments
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
5172
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     1
#!/usr/bin/env python
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     2
import sys
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     3
import string
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     4
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     5
if len( sys.argv ) == 1 :
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     6
  for asc_line in sys.stdin.readlines():
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     7
    mpw_line = string.replace(asc_line, "\\xA5", "\245")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     8
    mpw_line = string.replace(mpw_line, "\\xB6", "\266")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
     9
    mpw_line = string.replace(mpw_line, "\\xC4", "\304")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    10
    mpw_line = string.replace(mpw_line, "\\xC5", "\305")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    11
    mpw_line = string.replace(mpw_line, "\\xFF", "\377")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    12
    mpw_line = string.replace(mpw_line, "\n",   "\r")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    13
    mpw_line = string.replace(mpw_line, "\\n",   "\n")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    14
    sys.stdout.write(mpw_line)
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    15
elif sys.argv[1] == "-r" :
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    16
  for mpw_line in sys.stdin.readlines():
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    17
    asc_line = string.replace(mpw_line, "\n",   "\\n")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    18
    asc_line = string.replace(asc_line, "\r",   "\n")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    19
    asc_line = string.replace(asc_line, "\245", "\\xA5")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    20
    asc_line = string.replace(asc_line, "\266", "\\xB6")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    21
    asc_line = string.replace(asc_line, "\304", "\\xC4")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    22
    asc_line = string.replace(asc_line, "\305", "\\xC5")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    23
    asc_line = string.replace(asc_line, "\377", "\\xFF")
88f2e05288ba aaand let's add freetype as well while we are at it
koda
parents:
diff changeset
    24
    sys.stdout.write(asc_line)