crimson-0.5.2.orig/0000700000175000017500000000000010730256757012313 5ustar uweuwecrimson-0.5.2.orig/config/0000700000175000017500000000000010730256755013556 5ustar uweuwecrimson-0.5.2.orig/config/depcomp0000700000175000017500000004224610546522473015141 0ustar uweuwe#! /bin/sh # depcomp - compile a program generating dependencies as side-effects scriptversion=2006-10-15.18 # Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006 Free Software # Foundation, Inc. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. # Originally written by Alexandre Oliva . case $1 in '') echo "$0: No command. Try \`$0 --help' for more information." 1>&2 exit 1; ;; -h | --h*) cat <<\EOF Usage: depcomp [--help] [--version] PROGRAM [ARGS] Run PROGRAMS ARGS to compile a file, generating dependencies as side-effects. Environment variables: depmode Dependency tracking mode. source Source file read by `PROGRAMS ARGS'. object Object file output by `PROGRAMS ARGS'. DEPDIR directory where to store dependencies. depfile Dependency file to output. tmpdepfile Temporary file to use when outputing dependencies. libtool Whether libtool is used (yes/no). Report bugs to . EOF exit $? ;; -v | --v*) echo "depcomp $scriptversion" exit $? ;; esac if test -z "$depmode" || test -z "$source" || test -z "$object"; then echo "depcomp: Variables source, object and depmode must be set" 1>&2 exit 1 fi # Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. depfile=${depfile-`echo "$object" | sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} rm -f "$tmpdepfile" # Some modes work just like other modes, but use different flags. We # parameterize here, but still list the modes in the big case below, # to make depend.m4 easier to write. Note that we *cannot* use a case # here, because this file can only contain one case statement. if test "$depmode" = hp; then # HP compiler uses -M and no extra arg. gccflag=-M depmode=gcc fi if test "$depmode" = dashXmstdout; then # This is just like dashmstdout with a different argument. dashmflag=-xM depmode=dashmstdout fi case "$depmode" in gcc3) ## gcc 3 implements dependency tracking that does exactly what ## we want. Yay! Note: for some reason libtool 1.4 doesn't like ## it if -MD -MP comes after the -MF stuff. Hmm. ## Unfortunately, FreeBSD c89 acceptance of flags depends upon ## the command line argument order; so add the flags where they ## appear in depend2.am. Note that the slowdown incurred here ## affects only configure: in makefiles, %FASTDEP% shortcuts this. for arg do case $arg in -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; *) set fnord "$@" "$arg" ;; esac shift # fnord shift # $arg done "$@" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi mv "$tmpdepfile" "$depfile" ;; gcc) ## There are various ways to get dependency output from gcc. Here's ## why we pick this rather obscure method: ## - Don't want to use -MD because we'd like the dependencies to end ## up in a subdir. Having to rename by hand is ugly. ## (We might end up doing this anyway to support other compilers.) ## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like ## -MM, not -M (despite what the docs say). ## - Using -M directly means running the compiler twice (even worse ## than renaming). if test -z "$gccflag"; then gccflag=-MD, fi "$@" -Wp,"$gccflag$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" echo "$object : \\" > "$depfile" alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ## The second -e expression handles DOS-style file names with drive letters. sed -e 's/^[^:]*: / /' \ -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" ## This next piece of magic avoids the `deleted header file' problem. ## The problem is that when a header file which appears in a .P file ## is deleted, the dependency causes make to die (because there is ## typically no way to rebuild the header). We avoid this by adding ## dummy dependencies for each header file. Too bad gcc doesn't do ## this for us directly. tr ' ' ' ' < "$tmpdepfile" | ## Some versions of gcc put a space before the `:'. On the theory ## that the space means something, we add a space to the output as ## well. ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp) # This case exists only to let depend.m4 do its work. It works by # looking at the text of this script. This case will never be run, # since it is checked for above. exit 1 ;; sgi) if test "$libtool" = yes; then "$@" "-Wp,-MDupdate,$tmpdepfile" else "$@" -MDupdate "$tmpdepfile" fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files echo "$object : \\" > "$depfile" # Clip off the initial element (the dependent). Don't try to be # clever and replace this with sed code, as IRIX sed won't handle # lines with more than a fixed number of characters (4096 in # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; # the IRIX cc adds comments like `#:fec' to the end of the # dependency line. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ tr ' ' ' ' >> $depfile echo >> $depfile # The second pass generates a dummy entry for each header file. tr ' ' ' ' < "$tmpdepfile" \ | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ >> $depfile else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; aix) # The C for AIX Compiler uses -M and outputs the dependencies # in a .u file. In older versions, this file always lives in the # current directory. Also, the AIX compiler puts `$object:' at the # start of each line; $object doesn't have directory information. # Version 6 uses the directory in both cases. stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'` tmpdepfile="$stripped.u" if test "$libtool" = yes; then "$@" -Wc,-M else "$@" -M fi stat=$? if test -f "$tmpdepfile"; then : else stripped=`echo "$stripped" | sed 's,^.*/,,'` tmpdepfile="$stripped.u" fi if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi if test -f "$tmpdepfile"; then outname="$stripped.o" # Each line is of the form `foo.o: dependent.h'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile" sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile" else # The sourcefile does not contain any dependencies, so just # store a dummy comment line, to avoid errors with the Makefile # "include basename.Plo" scheme. echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; icc) # Intel's C compiler understands `-MD -MF file'. However on # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c # ICC 7.0 will fill foo.d with something like # foo.o: sub/foo.c # foo.o: sub/foo.h # which is wrong. We want: # sub/foo.o: sub/foo.c # sub/foo.o: sub/foo.h # sub/foo.c: # sub/foo.h: # ICC 7.1 will output # foo.o: sub/foo.c sub/foo.h # and will wrap long lines using \ : # foo.o: sub/foo.c ... \ # sub/foo.h ... \ # ... "$@" -MD -MF "$tmpdepfile" stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile" exit $stat fi rm -f "$depfile" # Each line is of the form `foo.o: dependent.h', # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. # Do two passes, one to just change these to # `$object: dependent.h' and one to simply `dependent.h:'. sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" # Some versions of the HPUX 10.20 sed can't process this invocation # correctly. Breaking it into two sed invocations is a workaround. sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; hp2) # The "hp" stanza above does not work with aCC (C++) and HP's ia64 # compilers, which have integrated preprocessors. The correct option # to use with these is +Maked; it writes dependencies to a file named # 'foo.d', which lands next to the object file, wherever that # happens to be. # Much of this is similar to the tru64 case; see comments there. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then tmpdepfile1=$dir$base.d tmpdepfile2=$dir.libs/$base.d "$@" -Wc,+Maked else tmpdepfile1=$dir$base.d tmpdepfile2=$dir$base.d "$@" +Maked fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" # Add `dependent.h:' lines. sed -ne '2,${; s/^ *//; s/ \\*$//; s/$/:/; p;}' "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" "$tmpdepfile2" ;; tru64) # The Tru64 compiler uses -MD to generate dependencies as a side # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put # dependencies in `foo.d' instead, so we check for that too. # Subdirectories are respected. dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` test "x$dir" = "x$object" && dir= base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` if test "$libtool" = yes; then # With Tru64 cc, shared objects can also be used to make a # static library. This mechanism is used in libtool 1.4 series to # handle both shared and static libraries in a single compilation. # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. # # With libtool 1.5 this exception was removed, and libtool now # generates 2 separate objects for the 2 libraries. These two # compilations output dependencies in $dir.libs/$base.o.d and # in $dir$base.o.d. We have to check for both files, because # one of the two compilations can be disabled. We should prefer # $dir$base.o.d over $dir.libs/$base.o.d because the latter is # automatically cleaned when .libs/ is deleted, while ignoring # the former would cause a distcleancheck panic. tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 tmpdepfile2=$dir$base.o.d # libtool 1.5 tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 "$@" -Wc,-MD else tmpdepfile1=$dir$base.o.d tmpdepfile2=$dir$base.d tmpdepfile3=$dir$base.d tmpdepfile4=$dir$base.d "$@" -MD fi stat=$? if test $stat -eq 0; then : else rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" exit $stat fi for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" do test -f "$tmpdepfile" && break done if test -f "$tmpdepfile"; then sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" # That's a tab and a space in the []. sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" else echo "#dummy" > "$depfile" fi rm -f "$tmpdepfile" ;; #nosideeffect) # This comment above is used by automake to tell side-effect # dependency tracking mechanisms from slower ones. dashmstdout) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done test -z "$dashmflag" && dashmflag=-M # Require at least two characters before searching for `:' # in the target name. This is to cope with DOS-style filenames: # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. "$@" $dashmflag | sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" tr ' ' ' ' < "$tmpdepfile" | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; dashXmstdout) # This case only exists to satisfy depend.m4. It is never actually # run, as this mode is specially recognized in the preamble. exit 1 ;; makedepend) "$@" || exit $? # Remove any Libtool call if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # X makedepend shift cleared=no for arg in "$@"; do case $cleared in no) set ""; shift cleared=yes ;; esac case "$arg" in -D*|-I*) set fnord "$@" "$arg"; shift ;; # Strip any option that makedepend may not understand. Remove # the object too, otherwise makedepend will parse it as a source file. -*|$object) ;; *) set fnord "$@" "$arg"; shift ;; esac done obj_suffix="`echo $object | sed 's/^.*\././'`" touch "$tmpdepfile" ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" rm -f "$depfile" cat < "$tmpdepfile" > "$depfile" sed '1,2d' "$tmpdepfile" | tr ' ' ' ' | \ ## Some versions of the HPUX 10.20 sed can't process this invocation ## correctly. Breaking it into two sed invocations is a workaround. sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" rm -f "$tmpdepfile" "$tmpdepfile".bak ;; cpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout. "$@" || exit $? # Remove the call to Libtool. if test "$libtool" = yes; then while test $1 != '--mode=compile'; do shift done shift fi # Remove `-o $object'. IFS=" " for arg do case $arg in -o) shift ;; $object) shift ;; *) set fnord "$@" "$arg" shift # fnord shift # $arg ;; esac done "$@" -E | sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | sed '$ s: \\$::' > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" cat < "$tmpdepfile" >> "$depfile" sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" rm -f "$tmpdepfile" ;; msvisualcpp) # Important note: in order to support this mode, a compiler *must* # always write the preprocessed file to stdout, regardless of -o, # because we must use -o when running libtool. "$@" || exit $? IFS=" " for arg do case "$arg" in "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") set fnord "$@" shift shift ;; *) set fnord "$@" "$arg" shift shift ;; esac done "$@" -E | sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile" rm -f "$depfile" echo "$object : \\" > "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" echo " " >> "$depfile" . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile" rm -f "$tmpdepfile" ;; none) exec "$@" ;; *) echo "Unknown depmode $depmode" 1>&2 exit 1 ;; esac exit 0 # Local Variables: # mode: shell-script # sh-indentation: 2 # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: crimson-0.5.2.orig/config/install-sh0000700000175000017500000003160010546522473015560 0ustar uweuwe#!/bin/sh # install - install a program, script, or datafile scriptversion=2006-10-14.15 # This originates from X11R5 (mit/util/scripts/install.sh), which was # later released in X11R6 (xc/config/util/install.sh) with the # following copyright and license. # # Copyright (C) 1994 X Consortium # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN # AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- # TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. # # Except as contained in this notice, the name of the X Consortium shall not # be used in advertising or otherwise to promote the sale, use or other deal- # ings in this Software without prior written authorization from the X Consor- # tium. # # # FSF changes to this file are in the public domain. # # Calling this script install-sh is preferred over install.sh, to prevent # `make' implicit rules from creating a file called install from it # when there is no Makefile. # # This script is compatible with the BSD install script, but was written # from scratch. nl=' ' IFS=" "" $nl" # set DOITPROG to echo to test this script # Don't use :- since 4.3BSD and earlier shells don't like it. doit="${DOITPROG-}" if test -z "$doit"; then doit_exec=exec else doit_exec=$doit fi # Put in absolute file names if you don't have them in your path; # or use environment vars. mvprog="${MVPROG-mv}" cpprog="${CPPROG-cp}" chmodprog="${CHMODPROG-chmod}" chownprog="${CHOWNPROG-chown}" chgrpprog="${CHGRPPROG-chgrp}" stripprog="${STRIPPROG-strip}" rmprog="${RMPROG-rm}" mkdirprog="${MKDIRPROG-mkdir}" posix_glob= posix_mkdir= # Desired mode of installed file. mode=0755 chmodcmd=$chmodprog chowncmd= chgrpcmd= stripcmd= rmcmd="$rmprog -f" mvcmd="$mvprog" src= dst= dir_arg= dstarg= no_target_directory= usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE or: $0 [OPTION]... SRCFILES... DIRECTORY or: $0 [OPTION]... -t DIRECTORY SRCFILES... or: $0 [OPTION]... -d DIRECTORIES... In the 1st form, copy SRCFILE to DSTFILE. In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. In the 4th, create DIRECTORIES. Options: -c (ignored) -d create directories instead of installing files. -g GROUP $chgrpprog installed files to GROUP. -m MODE $chmodprog installed files to MODE. -o USER $chownprog installed files to USER. -s $stripprog installed files. -t DIRECTORY install into DIRECTORY. -T report an error if DSTFILE is a directory. --help display this help and exit. --version display version info and exit. Environment variables override the default commands: CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG " while test $# -ne 0; do case $1 in -c) shift continue;; -d) dir_arg=true shift continue;; -g) chgrpcmd="$chgrpprog $2" shift shift continue;; --help) echo "$usage"; exit $?;; -m) mode=$2 shift shift case $mode in *' '* | *' '* | *' '* | *'*'* | *'?'* | *'['*) echo "$0: invalid mode: $mode" >&2 exit 1;; esac continue;; -o) chowncmd="$chownprog $2" shift shift continue;; -s) stripcmd=$stripprog shift continue;; -t) dstarg=$2 shift shift continue;; -T) no_target_directory=true shift continue;; --version) echo "$0 $scriptversion"; exit $?;; --) shift break;; -*) echo "$0: invalid option: $1" >&2 exit 1;; *) break;; esac done if test $# -ne 0 && test -z "$dir_arg$dstarg"; then # When -d is used, all remaining arguments are directories to create. # When -t is used, the destination is already specified. # Otherwise, the last argument is the destination. Remove it from $@. for arg do if test -n "$dstarg"; then # $@ is not empty: it contains at least $arg. set fnord "$@" "$dstarg" shift # fnord fi shift # arg dstarg=$arg done fi if test $# -eq 0; then if test -z "$dir_arg"; then echo "$0: no input file specified." >&2 exit 1 fi # It's OK to call `install-sh -d' without argument. # This can happen when creating conditional directories. exit 0 fi if test -z "$dir_arg"; then trap '(exit $?); exit' 1 2 13 15 # Set umask so as not to create temps with too-generous modes. # However, 'strip' requires both read and write access to temps. case $mode in # Optimize common cases. *644) cp_umask=133;; *755) cp_umask=22;; *[0-7]) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw='% 200' fi cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; *) if test -z "$stripcmd"; then u_plus_rw= else u_plus_rw=,u+rw fi cp_umask=$mode$u_plus_rw;; esac fi for src do # Protect names starting with `-'. case $src in -*) src=./$src ;; esac if test -n "$dir_arg"; then dst=$src dstdir=$dst test -d "$dstdir" dstdir_status=$? else # Waiting for this to be detected by the "$cpprog $src $dsttmp" command # might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if test ! -f "$src" && test ! -d "$src"; then echo "$0: $src does not exist." >&2 exit 1 fi if test -z "$dstarg"; then echo "$0: no destination specified." >&2 exit 1 fi dst=$dstarg # Protect names starting with `-'. case $dst in -*) dst=./$dst ;; esac # If destination is a directory, append the input filename; won't work # if double slashes aren't ignored. if test -d "$dst"; then if test -n "$no_target_directory"; then echo "$0: $dstarg: Is a directory" >&2 exit 1 fi dstdir=$dst dst=$dstdir/`basename "$src"` dstdir_status=0 else # Prefer dirname, but fall back on a substitute if dirname fails. dstdir=` (dirname "$dst") 2>/dev/null || expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$dst" : 'X\(//\)[^/]' \| \ X"$dst" : 'X\(//\)$' \| \ X"$dst" : 'X\(/\)' \| . 2>/dev/null || echo X"$dst" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q' ` test -d "$dstdir" dstdir_status=$? fi fi obsolete_mkdir_used=false if test $dstdir_status != 0; then case $posix_mkdir in '') # Create intermediate dirs using mode 755 as modified by the umask. # This is like FreeBSD 'install' as of 1997-10-28. umask=`umask` case $stripcmd.$umask in # Optimize common cases. *[2367][2367]) mkdir_umask=$umask;; .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; *[0-7]) mkdir_umask=`expr $umask + 22 \ - $umask % 100 % 40 + $umask % 20 \ - $umask % 10 % 4 + $umask % 2 `;; *) mkdir_umask=$umask,go-w;; esac # With -d, create the new directory with the user-specified mode. # Otherwise, rely on $mkdir_umask. if test -n "$dir_arg"; then mkdir_mode=-m$mode else mkdir_mode= fi posix_mkdir=false case $umask in *[123567][0-7][0-7]) # POSIX mkdir -p sets u+wx bits regardless of umask, which # is incompatible with FreeBSD 'install' when (umask & 300) != 0. ;; *) tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 if (umask $mkdir_umask && exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 then if test -z "$dir_arg" || { # Check for POSIX incompatibilities with -m. # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or # other-writeable bit of parent directory when it shouldn't. # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. ls_ld_tmpdir=`ls -ld "$tmpdir"` case $ls_ld_tmpdir in d????-?r-*) different_mode=700;; d????-?--*) different_mode=755;; *) false;; esac && $mkdirprog -m$different_mode -p -- "$tmpdir" && { ls_ld_tmpdir_1=`ls -ld "$tmpdir"` test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" } } then posix_mkdir=: fi rmdir "$tmpdir/d" "$tmpdir" else # Remove any dirs left behind by ancient mkdir implementations. rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null fi trap '' 0;; esac;; esac if $posix_mkdir && ( umask $mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" ) then : else # The umask is ridiculous, or mkdir does not conform to POSIX, # or it failed possibly due to a race condition. Create the # directory the slow way, step by step, checking for races as we go. case $dstdir in /*) prefix=/ ;; -*) prefix=./ ;; *) prefix= ;; esac case $posix_glob in '') if (set -f) 2>/dev/null; then posix_glob=true else posix_glob=false fi ;; esac oIFS=$IFS IFS=/ $posix_glob && set -f set fnord $dstdir shift $posix_glob && set +f IFS=$oIFS prefixes= for d do test -z "$d" && continue prefix=$prefix$d if test -d "$prefix"; then prefixes= else if $posix_mkdir; then (umask=$mkdir_umask && $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break # Don't fail if two instances are running concurrently. test -d "$prefix" || exit 1 else case $prefix in *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; *) qprefix=$prefix;; esac prefixes="$prefixes '$qprefix'" fi fi prefix=$prefix/ done if test -n "$prefixes"; then # Don't fail if two instances are running concurrently. (umask $mkdir_umask && eval "\$doit_exec \$mkdirprog $prefixes") || test -d "$dstdir" || exit 1 obsolete_mkdir_used=true fi fi fi if test -n "$dir_arg"; then { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 else # Make a couple of temp file names in the proper directory. dsttmp=$dstdir/_inst.$$_ rmtmp=$dstdir/_rm.$$_ # Trap to clean up those temp files at exit. trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 # Copy the file name to the temp name. (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && # and set any options; do chmod last to preserve setuid bits. # # If any of these fail, we abort the whole thing. If we want to # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $cpprog $src $dsttmp" command. # { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \ && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \ && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \ && { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && # Now rename the file to the real destination. { $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null \ || { # The rename failed, perhaps because mv can't rename something else # to itself, or perhaps because mv is so ancient that it does not # support -f. # Now remove or move aside any old file at destination location. # We try this two ways since rm can't unlink itself on some # systems and the destination file might be busy for other # reasons. In this case, the final cleanup might fail but the new # file should still install successfully. { if test -f "$dst"; then $doit $rmcmd -f "$dst" 2>/dev/null \ || { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null \ && { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }; }\ || { echo "$0: cannot unlink or rename $dst" >&2 (exit 1); exit 1 } else : fi } && # Now rename the file to the real destination. $doit $mvcmd "$dsttmp" "$dst" } } || exit 1 trap '' 0 fi done # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: crimson-0.5.2.orig/config/missing0000700000175000017500000002557710546522473015173 0ustar uweuwe#! /bin/sh # Common stub for a few missing GNU programs while installing. scriptversion=2006-05-10.23 # Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # Originally by Fran,cois Pinard , 1996. # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2, or (at your option) # any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. if test $# -eq 0; then echo 1>&2 "Try \`$0 --help' for more information" exit 1 fi run=: sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' sed_minuso='s/.* -o \([^ ]*\).*/\1/p' # In the cases where this matters, `missing' is being run in the # srcdir already. if test -f configure.ac; then configure_ac=configure.ac else configure_ac=configure.in fi msg="missing on your system" case $1 in --run) # Try to run requested program, and just exit if it succeeds. run= shift "$@" && exit 0 # Exit code 63 means version mismatch. This often happens # when the user try to use an ancient version of a tool on # a file that requires a minimum version. In this case we # we should proceed has if the program had been absent, or # if --run hadn't been passed. if test $? = 63; then run=: msg="probably too old" fi ;; -h|--h|--he|--hel|--help) echo "\ $0 [OPTION]... PROGRAM [ARGUMENT]... Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an error status if there is no known handling for PROGRAM. Options: -h, --help display this help and exit -v, --version output version information and exit --run try to run the given command, and emulate it if it fails Supported PROGRAM values: aclocal touch file \`aclocal.m4' autoconf touch file \`configure' autoheader touch file \`config.h.in' autom4te touch the output file, or create a stub one automake touch all \`Makefile.in' files bison create \`y.tab.[ch]', if possible, from existing .[ch] flex create \`lex.yy.c', if possible, from existing .c help2man touch the output file lex create \`lex.yy.c', if possible, from existing .c makeinfo touch the output file tar try tar, gnutar, gtar, then tar without non-portable flags yacc create \`y.tab.[ch]', if possible, from existing .[ch] Send bug reports to ." exit $? ;; -v|--v|--ve|--ver|--vers|--versi|--versio|--version) echo "missing $scriptversion (GNU Automake)" exit $? ;; -*) echo 1>&2 "$0: Unknown \`$1' option" echo 1>&2 "Try \`$0 --help' for more information" exit 1 ;; esac # Now exit if we have it, but it failed. Also exit now if we # don't have it and --version was passed (most likely to detect # the program). case $1 in lex|yacc) # Not GNU programs, they don't have --version. ;; tar) if test -n "$run"; then echo 1>&2 "ERROR: \`tar' requires --run" exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then exit 1 fi ;; *) if test -z "$run" && ($1 --version) > /dev/null 2>&1; then # We have it, but it failed. exit 1 elif test "x$2" = "x--version" || test "x$2" = "x--help"; then # Could not run --version or --help. This is probably someone # running `$TOOL --version' or `$TOOL --help' to check whether # $TOOL exists and not knowing $TOOL uses missing. exit 1 fi ;; esac # If it does not exist, or fails to run (possibly an outdated version), # try to emulate it. case $1 in aclocal*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." touch aclocal.m4 ;; autoconf) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." touch configure ;; autoheader) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`acconfig.h' or \`${configure_ac}'. You might want to install the \`Autoconf' and \`GNU m4' packages. Grab them from any GNU archive site." files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` test -z "$files" && files="config.h" touch_files= for f in $files; do case $f in *:*) touch_files="$touch_files "`echo "$f" | sed -e 's/^[^:]*://' -e 's/:.*//'`;; *) touch_files="$touch_files $f.in";; esac done touch $touch_files ;; automake*) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. You might want to install the \`Automake' and \`Perl' packages. Grab them from any GNU archive site." find . -type f -name Makefile.am -print | sed 's/\.am$/.in/' | while read f; do touch "$f"; done ;; autom4te) echo 1>&2 "\ WARNING: \`$1' is needed, but is $msg. You might have modified some files without having the proper tools for further handling them. You can get \`$1' as part of \`Autoconf' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo "#! /bin/sh" echo "# Created by GNU Automake missing as a replacement of" echo "# $ $@" echo "exit 0" chmod +x $file exit 1 fi ;; bison|yacc) echo 1>&2 "\ WARNING: \`$1' $msg. You should only need it if you modified a \`.y' file. You may need the \`Bison' package in order for those modifications to take effect. You can get \`Bison' from any GNU archive site." rm -f y.tab.c y.tab.h if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.y) SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.c fi SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` if test -f "$SRCFILE"; then cp "$SRCFILE" y.tab.h fi ;; esac fi if test ! -f y.tab.h; then echo >y.tab.h fi if test ! -f y.tab.c; then echo 'main() { return 0; }' >y.tab.c fi ;; lex|flex) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.l' file. You may need the \`Flex' package in order for those modifications to take effect. You can get \`Flex' from any GNU archive site." rm -f lex.yy.c if test $# -ne 1; then eval LASTARG="\${$#}" case $LASTARG in *.l) SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` if test -f "$SRCFILE"; then cp "$SRCFILE" lex.yy.c fi ;; esac fi if test ! -f lex.yy.c; then echo 'main() { return 0; }' >lex.yy.c fi ;; help2man) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a dependency of a manual page. You may need the \`Help2man' package in order for those modifications to take effect. You can get \`Help2man' from any GNU archive site." file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -f "$file"; then touch $file else test -z "$file" || exec >$file echo ".ab help2man is required to generate this page" exit 1 fi ;; makeinfo) echo 1>&2 "\ WARNING: \`$1' is $msg. You should only need it if you modified a \`.texi' or \`.texinfo' file, or any other file indirectly affecting the aspect of the manual. The spurious call might also be the consequence of using a buggy \`make' (AIX, DU, IRIX). You might want to install the \`Texinfo' package or the \`GNU make' package. Grab either from any GNU archive site." # The file to touch is that specified with -o ... file=`echo "$*" | sed -n "$sed_output"` test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` if test -z "$file"; then # ... or it is the one specified with @setfilename ... infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` file=`sed -n ' /^@setfilename/{ s/.* \([^ ]*\) *$/\1/ p q }' $infile` # ... or it is derived from the source name (dir/f.texi becomes f.info) test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info fi # If the file does not exist, the user really needs makeinfo; # let's fail without touching anything. test -f $file || exit 1 touch $file ;; tar) shift # We have already tried tar in the generic part. # Look for gnutar/gtar before invocation to avoid ugly error # messages. if (gnutar --version > /dev/null 2>&1); then gnutar "$@" && exit 0 fi if (gtar --version > /dev/null 2>&1); then gtar "$@" && exit 0 fi firstarg="$1" if shift; then case $firstarg in *o*) firstarg=`echo "$firstarg" | sed s/o//` tar "$firstarg" "$@" && exit 0 ;; esac case $firstarg in *h*) firstarg=`echo "$firstarg" | sed s/h//` tar "$firstarg" "$@" && exit 0 ;; esac fi echo 1>&2 "\ WARNING: I can't seem to be able to run \`tar' with the given arguments. You may want to install GNU tar or Free paxutils, or check the command line arguments." exit 1 ;; *) echo 1>&2 "\ WARNING: \`$1' is needed, and is $msg. You might have modified some files without having the proper tools for further handling them. Check the \`README' file, it often tells you about the needed prerequisites for installing this package. You may also peek at any GNU archive site, in case some other package would contain this missing \`$1' program." exit 1 ;; esac exit 0 # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) # time-stamp-start: "scriptversion=" # time-stamp-format: "%:y-%02m-%02d.%02H" # time-stamp-end: "$" # End: crimson-0.5.2.orig/README0000600000175000017500000000264410540035106013161 0ustar uweuweCrimson Fields is a tactical war game in the tradition of Battle Isle. The outcome of the war lies in your hands. You decide which units are sent to the front lines, and when to unleash the reserves. Your mission objectives range from defending strategically vital locations to simply destroying all enemy forces in the area. Protect supply convoys or raid enemy facilities to uncover technological secrets or fill your storage bays so you can repair damaged units or build new ones in your own factories. Lead your troops to victory! Tools are available to create custom maps and campaigns. You can also play the original Battle Isle maps if you have a copy of the game. You can pit yourself against another human player either in hot-seat mode in front of the same machine, over a network, or via e-mail, or against the computer. Crimson Fields is distributed under the terms of the GNU General Public License (GPL). It has been developed and tested on Intel architecture with Linux, but it shouldn't be too hard to make it compile and run on other operating systems as well. It works with Linux, various flavours of BSD, Sun Solaris, MacOS X, BeOS, and MS Windows, among others. For installation instructions and system requirements see the INSTALL file. The latest release can be found at: http://crimson.seul.org Feel free to send any kind of constructive (or encouraging) feedback. Have fun! Jens Granseuer crimson-0.5.2.orig/configure.ac0000600000175000017500000000774610727755473014626 0ustar uweuwednl Process this file with autoconf to produce a configure script. AC_PREREQ([2.52]) AC_INIT([Crimson Fields], [0.5.2], [jensgr@gmx.net], [crimson]) AC_COPYRIGHT([Copyright (C) 2000-2007 Jens Granseuer]) AC_CONFIG_SRCDIR([src/common/globals.h]) AC_CONFIG_AUX_DIR([config]) AM_INIT_AUTOMAKE([foreign dist-bzip2 nostdinc]) dnl build time options ZLIB_HOME= AC_ARG_WITH([zlib], AC_HELP_STRING([--with-zlib=DIR], [use zlib in DIR]), [if test "x$withval" != xno; then use_zlib=yes if test "x$withval" != xyes; then ZLIB_HOME="$withval" fi else use_zlib=no fi], [use_zlib=yes]) AC_ARG_ENABLE([sound], AC_HELP_STRING([--disable-sound], [compile without sound support]),, [enable_sound=yes]) AC_ARG_ENABLE([network], AC_HELP_STRING([--disable-network], [compile without networking support]),, [enable_network=yes]) AC_ARG_ENABLE([cfed], AC_HELP_STRING([--enable-cfed], [build and install the level compiler]),, [enable_cfed=no]) AM_CONDITIONAL([BUILD_CFED], [test x$enable_cfed = xyes]) AC_ARG_ENABLE([comet], AC_HELP_STRING([--enable-comet], [build and install the graphical level editor]),, [enable_comet=no]) AM_CONDITIONAL([BUILD_COMET], [test x$enable_comet = xyes]) AC_ARG_ENABLE([bi2cf], AC_HELP_STRING([--enable-bi2cf], [build and install the Battle Isle map converter]),, [enable_bi2cf=no]) AM_CONDITIONAL([BUILD_BI2CF], [test x$enable_bi2cf = xyes]) AC_ARG_ENABLE([cf2bmp], AC_HELP_STRING([--enable-cf2bmp], [build and install the map to image converter]),, [enable_cf2bmp=no]) AM_CONDITIONAL([BUILD_CF2BMP], [test x$enable_cf2bmp = xyes]) dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PATH_PROG([XSLTPROC], [xsltproc]) AC_PATH_PROG([XMLLINT], [xmllint]) dnl Checks for libraries. SDL_VERSION=1.1.5 AM_PATH_SDL([$SDL_VERSION],:, [AC_MSG_ERROR([*** SDL version $SDL_VERSION not found!])]) CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" AC_CHECK_LIB(SDL_ttf, TTF_OpenFont, [AC_CHECK_HEADER(SDL_ttf.h, [CF_LIBS="-lSDL_ttf"], [AC_MSG_ERROR([*** SDL_ttf.h not found!])])], [AC_MSG_ERROR([*** SDL_ttf not found!])]) if test x$enable_sound = xyes; then AC_CHECK_LIB(SDL_mixer, Mix_OpenAudio, [AC_CHECK_HEADER(SDL_mixer.h, [CF_LIBS="$CF_LIBS -lSDL_mixer"], [AC_MSG_WARN([*** SDL_mixer.h not found - disabling audio support!]) enable_sound=no])], [AC_MSG_WARN([*** SDL_mixer not found - disabling audio support!]) enable_sound=no]) fi if test x$enable_sound != xyes; then AC_DEFINE(DISABLE_SOUND) fi if test x$enable_network = xyes; then AC_CHECK_LIB(SDL_net, SDLNet_Init, [AC_CHECK_HEADER(SDL_net.h, [CF_LIBS="$CF_LIBS -lSDL_net"], [AC_MSG_WARN([*** SDL_net.h not found - disabling network support!]) enable_network=no])], [AC_MSG_WARN([*** SDL_net not found - disabling network support!]) enable_network=no]) fi if test x$enable_network != xyes; then AC_DEFINE(DISABLE_NETWORK) fi if test x$use_zlib = xyes; then ac_save_cppflags="$CPPFLAGS" ac_save_ldflags="$LDFLAGS" if test -n "$ZLIB_HOME"; then CPPFLAGS="-I${ZLIB_HOME}/include $CPPFLAGS" LDFLAGS="-L${ZLIB_HOME}/lib $LDFLAGS" fi AC_CHECK_LIB(z, compress, [AC_CHECK_HEADER(zlib.h, [AC_DEFINE(HAVE_LIBZ) LIBS="-lz $LIBS"] )] ) if test "x$ac_cv_header_zlib_h" = xno; then CPPFLAGS="$ac_save_cppflags" LDFLAGS="$ac_save_ldflags" fi fi dnl Checks for header files and functions. AC_HEADER_DIRENT AC_CHECK_FUNCS(strcasecmp strncasecmp) dnl Checks for typedefs, structures, and compiler characteristics. AC_C_CONST AC_SUBST(CF_LIBS) AC_CONFIG_FILES([doc/Makefile gfx/Makefile levels/Makefile \ locale/Makefile music/Makefile sfx/Makefile \ src/Makefile src/cf/Makefile src/comet/Makefile \ tools/Makefile Makefile crimson.spec]) AC_OUTPUT crimson-0.5.2.orig/aclocal.m40000600000175000017500000011255510730255122014147 0ustar uweuwe# generated automatically by aclocal 1.10 -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. m4_if(m4_PACKAGE_VERSION, [2.61],, [m4_fatal([this file was generated for autoconf 2.61. You have another version of autoconf. If you want to use that, you should regenerate the build system entirely.], [63])]) # Copyright (C) 2002, 2003, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_AUTOMAKE_VERSION(VERSION) # ---------------------------- # Automake X.Y traces this macro to ensure aclocal.m4 has been # generated from the m4 files accompanying Automake X.Y. # (This private macro should not be called outside this file.) AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version='1.10' dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to dnl require some minimum version. Point them to the right macro. m4_if([$1], [1.10], [], [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl ]) # _AM_AUTOCONF_VERSION(VERSION) # ----------------------------- # aclocal traces this macro to find the Autoconf version. # This is a private macro too. Using m4_define simplifies # the logic in aclocal, which can simply ignore this definition. m4_define([_AM_AUTOCONF_VERSION], []) # AM_SET_CURRENT_AUTOMAKE_VERSION # ------------------------------- # Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. # This function is AC_REQUIREd by AC_INIT_AUTOMAKE. AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], [AM_AUTOMAKE_VERSION([1.10])dnl _AM_AUTOCONF_VERSION(m4_PACKAGE_VERSION)]) # AM_AUX_DIR_EXPAND -*- Autoconf -*- # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets # $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to # `$srcdir', `$srcdir/..', or `$srcdir/../..'. # # Of course, Automake must honor this variable whenever it calls a # tool from the auxiliary directory. The problem is that $srcdir (and # therefore $ac_aux_dir as well) can be either absolute or relative, # depending on how configure is run. This is pretty annoying, since # it makes $ac_aux_dir quite unusable in subdirectories: in the top # source directory, any form will work fine, but in subdirectories a # relative path needs to be adjusted first. # # $ac_aux_dir/missing # fails when called from a subdirectory if $ac_aux_dir is relative # $top_srcdir/$ac_aux_dir/missing # fails if $ac_aux_dir is absolute, # fails when called from a subdirectory in a VPATH build with # a relative $ac_aux_dir # # The reason of the latter failure is that $top_srcdir and $ac_aux_dir # are both prefixed by $srcdir. In an in-source build this is usually # harmless because $srcdir is `.', but things will broke when you # start a VPATH build or use an absolute $srcdir. # # So we could use something similar to $top_srcdir/$ac_aux_dir/missing, # iff we strip the leading $srcdir from $ac_aux_dir. That would be: # am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` # and then we would define $MISSING as # MISSING="\${SHELL} $am_aux_dir/missing" # This will work as long as MISSING is not called from configure, because # unfortunately $(top_srcdir) has no meaning in configure. # However there are other variables, like CC, which are often used in # configure, and could therefore not use this "fixed" $ac_aux_dir. # # Another solution, used here, is to always expand $ac_aux_dir to an # absolute PATH. The drawback is that using absolute paths prevent a # configured tree to be moved without reconfiguration. AC_DEFUN([AM_AUX_DIR_EXPAND], [dnl Rely on autoconf to set up CDPATH properly. AC_PREREQ([2.50])dnl # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` ]) # AM_CONDITIONAL -*- Autoconf -*- # Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 8 # AM_CONDITIONAL(NAME, SHELL-CONDITION) # ------------------------------------- # Define a conditional. AC_DEFUN([AM_CONDITIONAL], [AC_PREREQ(2.52)dnl ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl AC_SUBST([$1_TRUE])dnl AC_SUBST([$1_FALSE])dnl _AM_SUBST_NOTMAKE([$1_TRUE])dnl _AM_SUBST_NOTMAKE([$1_FALSE])dnl if $2; then $1_TRUE= $1_FALSE='#' else $1_TRUE='#' $1_FALSE= fi AC_CONFIG_COMMANDS_PRE( [if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then AC_MSG_ERROR([[conditional "$1" was never defined. Usually this means the macro was only invoked conditionally.]]) fi])]) # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 9 # There are a few dirty hacks below to avoid letting `AC_PROG_CC' be # written in clear, in which case automake, when reading aclocal.m4, # will think it sees a *use*, and therefore will trigger all it's # C support machinery. Also note that it means that autoscan, seeing # CC etc. in the Makefile, will ask for an AC_PROG_CC use... # _AM_DEPENDENCIES(NAME) # ---------------------- # See how the compiler implements dependency checking. # NAME is "CC", "CXX", "GCJ", or "OBJC". # We try a few techniques and use that to set a single cache variable. # # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was # modified to invoke _AM_DEPENDENCIES(CC); we would have a circular # dependency, and given that the user is not expected to run this macro, # just rely on AC_PROG_CC. AC_DEFUN([_AM_DEPENDENCIES], [AC_REQUIRE([AM_SET_DEPDIR])dnl AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl AC_REQUIRE([AM_MAKE_INCLUDE])dnl AC_REQUIRE([AM_DEP_TRACK])dnl ifelse([$1], CC, [depcc="$CC" am_compiler_list=], [$1], CXX, [depcc="$CXX" am_compiler_list=], [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], [$1], UPC, [depcc="$UPC" am_compiler_list=], [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], [depcc="$$1" am_compiler_list=]) AC_CACHE_CHECK([dependency style of $depcc], [am_cv_$1_dependencies_compiler_type], [if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_$1_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_$1_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_$1_dependencies_compiler_type=none fi ]) AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) AM_CONDITIONAL([am__fastdep$1], [ test "x$enable_dependency_tracking" != xno \ && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) ]) # AM_SET_DEPDIR # ------------- # Choose a directory name for dependency files. # This macro is AC_REQUIREd in _AM_DEPENDENCIES AC_DEFUN([AM_SET_DEPDIR], [AC_REQUIRE([AM_SET_LEADING_DOT])dnl AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl ]) # AM_DEP_TRACK # ------------ AC_DEFUN([AM_DEP_TRACK], [AC_ARG_ENABLE(dependency-tracking, [ --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors]) if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) AC_SUBST([AMDEPBACKSLASH])dnl _AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl ]) # Generate code to set up dependency tracking. -*- Autoconf -*- # Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. #serial 3 # _AM_OUTPUT_DEPENDENCY_COMMANDS # ------------------------------ AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], [for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`AS_DIRNAME("$mf")` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`AS_DIRNAME(["$file"])` AS_MKDIR_P([$dirpart/$fdir]) # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ])# _AM_OUTPUT_DEPENDENCY_COMMANDS # AM_OUTPUT_DEPENDENCY_COMMANDS # ----------------------------- # This macro should only be invoked once -- use via AC_REQUIRE. # # This code is only required when automatic dependency tracking # is enabled. FIXME. This creates each `.P' file that we will # need in order to bootstrap the dependency handling code. AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], [AC_CONFIG_COMMANDS([depfiles], [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) ]) # Do all the work for Automake. -*- Autoconf -*- # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, # 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 12 # This macro actually does too much. Some checks are only needed if # your package does certain things. But this isn't really a big deal. # AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) # AM_INIT_AUTOMAKE([OPTIONS]) # ----------------------------------------------- # The call with PACKAGE and VERSION arguments is the old style # call (pre autoconf-2.50), which is being phased out. PACKAGE # and VERSION should now be passed to AC_INIT and removed from # the call to AM_INIT_AUTOMAKE. # We support both call styles for the transition. After # the next Automake release, Autoconf can make the AC_INIT # arguments mandatory, and then we can depend on a new Autoconf # release and drop the old call support. AC_DEFUN([AM_INIT_AUTOMAKE], [AC_PREREQ([2.60])dnl dnl Autoconf wants to disallow AM_ names. We explicitly allow dnl the ones we care about. m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl AC_REQUIRE([AC_PROG_INSTALL])dnl if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl # test to see if srcdir already configured if test -f $srcdir/config.status; then AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi AC_SUBST([CYGPATH_W]) # Define the identity of the package. dnl Distinguish between old-style and new-style calls. m4_ifval([$2], [m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl AC_SUBST([PACKAGE], [$1])dnl AC_SUBST([VERSION], [$2])], [_AM_SET_OPTIONS([$1])dnl dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, [m4_fatal([AC_INIT should be called with package and version arguments])])dnl AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl _AM_IF_OPTION([no-define],, [AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl # Some tools Automake needs. AC_REQUIRE([AM_SANITY_CHECK])dnl AC_REQUIRE([AC_ARG_PROGRAM])dnl AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) AM_MISSING_PROG(AUTOCONF, autoconf) AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) AM_MISSING_PROG(AUTOHEADER, autoheader) AM_MISSING_PROG(MAKEINFO, makeinfo) AM_PROG_INSTALL_SH AM_PROG_INSTALL_STRIP AC_REQUIRE([AM_PROG_MKDIR_P])dnl # We need awk for the "check" target. The system "awk" is bad on # some platforms. AC_REQUIRE([AC_PROG_AWK])dnl AC_REQUIRE([AC_PROG_MAKE_SET])dnl AC_REQUIRE([AM_SET_LEADING_DOT])dnl _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], [_AM_PROG_TAR([v7])])]) _AM_IF_OPTION([no-dependencies],, [AC_PROVIDE_IFELSE([AC_PROG_CC], [_AM_DEPENDENCIES(CC)], [define([AC_PROG_CC], defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl AC_PROVIDE_IFELSE([AC_PROG_CXX], [_AM_DEPENDENCIES(CXX)], [define([AC_PROG_CXX], defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl AC_PROVIDE_IFELSE([AC_PROG_OBJC], [_AM_DEPENDENCIES(OBJC)], [define([AC_PROG_OBJC], defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl ]) ]) # When config.status generates a header, we must update the stamp-h file. # This file resides in the same directory as the config header # that is generated. The stamp files are numbered to have different names. # Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the # loop where config.status creates the headers, so we can generate # our stamp files there. AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], [# Compute $1's index in $config_headers. _am_stamp_count=1 for _am_header in $config_headers :; do case $_am_header in $1 | $1:* ) break ;; * ) _am_stamp_count=`expr $_am_stamp_count + 1` ;; esac done echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_SH # ------------------ # Define $install_sh. AC_DEFUN([AM_PROG_INSTALL_SH], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} AC_SUBST(install_sh)]) # Copyright (C) 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # Check whether the underlying file-system supports filenames # with a leading dot. For instance MS-DOS doesn't. AC_DEFUN([AM_SET_LEADING_DOT], [rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null AC_SUBST([am__leading_dot])]) # Check to see how 'make' treats includes. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # AM_MAKE_INCLUDE() # ----------------- # Check to see how make treats includes. AC_DEFUN([AM_MAKE_INCLUDE], [am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. AC_MSG_CHECKING([for style of include used by $am_make]) am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi AC_SUBST([am__include]) AC_SUBST([am__quote]) AC_MSG_RESULT([$_am_result]) rm -f confinc confmf ]) # Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- # Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 5 # AM_MISSING_PROG(NAME, PROGRAM) # ------------------------------ AC_DEFUN([AM_MISSING_PROG], [AC_REQUIRE([AM_MISSING_HAS_RUN]) $1=${$1-"${am_missing_run}$2"} AC_SUBST($1)]) # AM_MISSING_HAS_RUN # ------------------ # Define MISSING if not defined so far and test if it supports --run. # If it does, set am_missing_run to use it, otherwise, to nothing. AC_DEFUN([AM_MISSING_HAS_RUN], [AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl AC_REQUIRE_AUX_FILE([missing])dnl test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= AC_MSG_WARN([`missing' script is too old or missing]) fi ]) # Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_MKDIR_P # --------------- # Check for `mkdir -p'. AC_DEFUN([AM_PROG_MKDIR_P], [AC_PREREQ([2.60])dnl AC_REQUIRE([AC_PROG_MKDIR_P])dnl dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, dnl while keeping a definition of mkdir_p for backward compatibility. dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of dnl Makefile.ins that do not define MKDIR_P, so we do our own dnl adjustment using top_builddir (which is defined more often than dnl MKDIR_P). AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl case $mkdir_p in [[\\/$]]* | ?:[[\\/]]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac ]) # Helper functions for option handling. -*- Autoconf -*- # Copyright (C) 2001, 2002, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 3 # _AM_MANGLE_OPTION(NAME) # ----------------------- AC_DEFUN([_AM_MANGLE_OPTION], [[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) # _AM_SET_OPTION(NAME) # ------------------------------ # Set option NAME. Presently that only means defining a flag for this option. AC_DEFUN([_AM_SET_OPTION], [m4_define(_AM_MANGLE_OPTION([$1]), 1)]) # _AM_SET_OPTIONS(OPTIONS) # ---------------------------------- # OPTIONS is a space-separated list of Automake options. AC_DEFUN([_AM_SET_OPTIONS], [AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) # _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) # ------------------------------------------- # Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. AC_DEFUN([_AM_IF_OPTION], [m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) # Check to make sure that the build environment is sane. -*- Autoconf -*- # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005 # Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 4 # AM_SANITY_CHECK # --------------- AC_DEFUN([AM_SANITY_CHECK], [AC_MSG_CHECKING([whether build environment is sane]) # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$[*]" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$[*]" != "X $srcdir/configure conftest.file" \ && test "$[*]" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken alias in your environment]) fi test "$[2]" = conftest.file ) then # Ok. : else AC_MSG_ERROR([newly created file is older than distributed files! Check your system clock]) fi AC_MSG_RESULT(yes)]) # Configure paths for SDL # Sam Lantinga 9/21/99 # stolen from Manish Singh # stolen back from Frank Belew # stolen from Manish Singh # Shamelessly stolen from Owen Taylor dnl AM_PATH_SDL([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]]]) dnl Test for SDL, and define SDL_CFLAGS and SDL_LIBS dnl AC_DEFUN([AM_PATH_SDL], [dnl dnl Get the cflags and libraries from the sdl-config script dnl AC_ARG_WITH(sdl-prefix,[ --with-sdl-prefix=PFX Prefix where SDL is installed (optional)], sdl_prefix="$withval", sdl_prefix="") AC_ARG_WITH(sdl-exec-prefix,[ --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional)], sdl_exec_prefix="$withval", sdl_exec_prefix="") AC_ARG_ENABLE(sdltest, [ --disable-sdltest Do not try to compile and run a test SDL program], , enable_sdltest=yes) if test x$sdl_exec_prefix != x ; then sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config fi fi if test x$sdl_prefix != x ; then sdl_args="$sdl_args --prefix=$sdl_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_prefix/bin/sdl-config fi fi if test "x$prefix" != xNONE; then PATH="$prefix/bin:$prefix/usr/bin:$PATH" fi AC_PATH_PROG(SDL_CONFIG, sdl-config, no, [$PATH]) min_sdl_version=ifelse([$1], ,0.11.0,$1) AC_MSG_CHECKING(for SDL - version >= $min_sdl_version) no_sdl="" if test "$SDL_CONFIG" = "no" ; then no_sdl=yes else SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'` sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'` sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" dnl dnl Now check if the installed SDL is sufficiently new. (Also sanity dnl checks the results of sdl-config to some extent dnl rm -f conf.sdltest AC_TRY_RUN([ #include #include #include #include "SDL.h" char* my_strdup (char *str) { char *new_str; if (str) { new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main (int argc, char *argv[]) { int major, minor, micro; char *tmp_version; /* This hangs on some systems (?) system ("touch conf.sdltest"); */ { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_sdl_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_sdl_version"); exit(1); } if (($sdl_major_version > major) || (($sdl_major_version == major) && ($sdl_minor_version > minor)) || (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) { return 0; } else { printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); printf("*** to point to the correct copy of sdl-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } ],, no_sdl=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"]) CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_sdl" = x ; then AC_MSG_RESULT(yes) ifelse([$2], , :, [$2]) else AC_MSG_RESULT(no) if test "$SDL_CONFIG" = "no" ; then echo "*** The sdl-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the SDL_CONFIG environment variable to the" echo "*** full path to sdl-config." else if test -f conf.sdltest ; then : else echo "*** Could not run SDL test program, checking why..." CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" AC_TRY_LINK([ #include #include "SDL.h" int main(int argc, char *argv[]) { return 0; } #undef main #define main K_and_R_C_main ], [ return 0; ], [ echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SDL or finding the wrong" echo "*** version of SDL. If it is not finding SDL, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH"], [ echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** may want to edit the sdl-config script: $SDL_CONFIG" ]) CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" fi fi SDL_CFLAGS="" SDL_LIBS="" ifelse([$3], , :, [$3]) fi AC_SUBST(SDL_CFLAGS) AC_SUBST(SDL_LIBS) rm -f conf.sdltest ]) # Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # AM_PROG_INSTALL_STRIP # --------------------- # One issue with vendor `install' (even GNU) is that you can't # specify the program used to strip binaries. This is especially # annoying in cross-compiling environments, where the build's strip # is unlikely to handle the host's binaries. # Fortunately install-sh will honor a STRIPPROG variable, so we # always use install-sh in `make install-strip', and initialize # STRIPPROG with the value of the STRIP variable (set by the user). AC_DEFUN([AM_PROG_INSTALL_STRIP], [AC_REQUIRE([AM_PROG_INSTALL_SH])dnl # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. dnl Don't test for $cross_compiling = yes, because it might be `maybe'. if test "$cross_compiling" != no; then AC_CHECK_TOOL([STRIP], [strip], :) fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" AC_SUBST([INSTALL_STRIP_PROGRAM])]) # Copyright (C) 2006 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # _AM_SUBST_NOTMAKE(VARIABLE) # --------------------------- # Prevent Automake from outputing VARIABLE = @VARIABLE@ in Makefile.in. # This macro is traced by Automake. AC_DEFUN([_AM_SUBST_NOTMAKE]) # Check how to create a tarball. -*- Autoconf -*- # Copyright (C) 2004, 2005 Free Software Foundation, Inc. # # This file is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # serial 2 # _AM_PROG_TAR(FORMAT) # -------------------- # Check how to create a tarball in format FORMAT. # FORMAT should be one of `v7', `ustar', or `pax'. # # Substitute a variable $(am__tar) that is a command # writing to stdout a FORMAT-tarball containing the directory # $tardir. # tardir=directory && $(am__tar) > result.tar # # Substitute a variable $(am__untar) that extract such # a tarball read from stdin. # $(am__untar) < result.tar AC_DEFUN([_AM_PROG_TAR], [# Always define AMTAR for backward compatibility. AM_MISSING_PROG([AMTAR], [tar]) m4_if([$1], [v7], [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], [m4_case([$1], [ustar],, [pax],, [m4_fatal([Unknown tar format])]) AC_MSG_CHECKING([how to create a $1 tar archive]) # Loop over all known methods to create a tar archive until one works. _am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' _am_tools=${am_cv_prog_tar_$1-$_am_tools} # Do not fold the above two line into one, because Tru64 sh and # Solaris sh will not grok spaces in the rhs of `-'. for _am_tool in $_am_tools do case $_am_tool in gnutar) for _am_tar in tar gnutar gtar; do AM_RUN_LOG([$_am_tar --version]) && break done am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' am__untar="$_am_tar -xf -" ;; plaintar) # Must skip GNU tar: if it does not support --format= it doesn't create # ustar tarball either. (tar --version) >/dev/null 2>&1 && continue am__tar='tar chf - "$$tardir"' am__tar_='tar chf - "$tardir"' am__untar='tar xf -' ;; pax) am__tar='pax -L -x $1 -w "$$tardir"' am__tar_='pax -L -x $1 -w "$tardir"' am__untar='pax -r' ;; cpio) am__tar='find "$$tardir" -print | cpio -o -H $1 -L' am__tar_='find "$tardir" -print | cpio -o -H $1 -L' am__untar='cpio -i -H $1 -d' ;; none) am__tar=false am__tar_=false am__untar=false ;; esac # If the value was cached, stop now. We just wanted to have am__tar # and am__untar set. test -n "${am_cv_prog_tar_$1}" && break # tar/untar a dummy directory, and stop if the command works rm -rf conftest.dir mkdir conftest.dir echo GrepMe > conftest.dir/file AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) rm -rf conftest.dir if test -s conftest.tar; then AM_RUN_LOG([$am__untar /dev/null 2>&1 && break fi done rm -rf conftest.dir AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) AC_MSG_RESULT([$am_cv_prog_tar_$1])]) AC_SUBST([am__tar]) AC_SUBST([am__untar]) ]) # _AM_PROG_TAR crimson-0.5.2.orig/Makefile.am0000600000175000017500000000044610504555640014345 0ustar uweuweEXTRA_DIST = crimson.desktop crimson.spec.in README.bi2cf README.CoMET VisualC++.zip SUBDIRS = doc src tools gfx levels locale music sfx DISTCHECK_CONFIGURE_FLAGS = --enable-bi2cf --enable-cf2bmp --enable-cfed --enable-comet desktopdir = $(datadir)/applications desktop_DATA = crimson.desktop crimson-0.5.2.orig/Makefile.in0000600000175000017500000004673310730255130014357 0ustar uweuwe# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = . DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(srcdir)/crimson.spec.in \ $(top_srcdir)/configure COPYING ChangeLog INSTALL NEWS THANKS \ TODO config/depcomp config/install-sh config/missing ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ configure.lineno config.status.lineno mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = crimson.spec SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; am__installdirs = "$(DESTDIR)$(desktopdir)" desktopDATA_INSTALL = $(INSTALL_DATA) DATA = $(desktop_DATA) RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) distdir = $(PACKAGE)-$(VERSION) top_distdir = $(distdir) am__remove_distdir = \ { test ! -d $(distdir) \ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \ && rm -fr $(distdir); }; } DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2 GZIP_ENV = --best distuninstallcheck_listfiles = find . -type f -print distcleancheck_listfiles = find . -type f -print ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CF_LIBS = @CF_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ EXTRA_DIST = crimson.desktop crimson.spec.in README.bi2cf README.CoMET VisualC++.zip SUBDIRS = doc src tools gfx levels locale music sfx DISTCHECK_CONFIGURE_FLAGS = --enable-bi2cf --enable-cf2bmp --enable-cfed --enable-comet desktopdir = $(datadir)/applications desktop_DATA = crimson.desktop all: all-recursive .SUFFIXES: am--refresh: @: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \ cd $(srcdir) && $(AUTOMAKE) --foreign \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ echo ' $(SHELL) ./config.status'; \ $(SHELL) ./config.status;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) $(SHELL) ./config.status --recheck $(top_srcdir)/configure: $(am__configure_deps) cd $(srcdir) && $(AUTOCONF) $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) crimson.spec: $(top_builddir)/config.status $(srcdir)/crimson.spec.in cd $(top_builddir) && $(SHELL) ./config.status $@ install-desktopDATA: $(desktop_DATA) @$(NORMAL_INSTALL) test -z "$(desktopdir)" || $(MKDIR_P) "$(DESTDIR)$(desktopdir)" @list='$(desktop_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(desktopDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(desktopdir)/$$f'"; \ $(desktopDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(desktopdir)/$$f"; \ done uninstall-desktopDATA: @$(NORMAL_UNINSTALL) @list='$(desktop_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(desktopdir)/$$f'"; \ rm -f "$(DESTDIR)$(desktopdir)/$$f"; \ done # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) $(am__remove_distdir) test -d $(distdir) || mkdir $(distdir) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ am__remove_distdir=: \ am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ done -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \ ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ || chmod -R a+r $(distdir) dist-gzip: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz $(am__remove_distdir) dist-bzip2: distdir tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) dist-tarZ: distdir tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z $(am__remove_distdir) dist-shar: distdir shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz $(am__remove_distdir) dist-zip: distdir -rm -f $(distdir).zip zip -rq $(distdir).zip $(distdir) $(am__remove_distdir) dist dist-all: distdir tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 $(am__remove_distdir) # This target untars the dist file and tries a VPATH configuration. Then # it guarantees that the distribution is self-contained by making another # tarfile. distcheck: dist case '$(DIST_ARCHIVES)' in \ *.tar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\ *.tar.bz2*) \ bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\ *.tar.Z*) \ uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ *.shar.gz*) \ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\ *.zip*) \ unzip $(distdir).zip ;;\ esac chmod -R a-w $(distdir); chmod a+w $(distdir) mkdir $(distdir)/_build mkdir $(distdir)/_inst chmod a-w $(distdir) dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ && cd $(distdir)/_build \ && ../configure --srcdir=.. --prefix="$$dc_install_base" \ $(DISTCHECK_CONFIGURE_FLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) \ && $(MAKE) $(AM_MAKEFLAGS) dvi \ && $(MAKE) $(AM_MAKEFLAGS) check \ && $(MAKE) $(AM_MAKEFLAGS) install \ && $(MAKE) $(AM_MAKEFLAGS) installcheck \ && $(MAKE) $(AM_MAKEFLAGS) uninstall \ && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ distuninstallcheck \ && chmod -R a-w "$$dc_install_base" \ && ({ \ (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ } || { rm -rf "$$dc_destdir"; exit 1; }) \ && rm -rf "$$dc_destdir" \ && $(MAKE) $(AM_MAKEFLAGS) dist \ && rm -rf $(DIST_ARCHIVES) \ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck $(am__remove_distdir) @(echo "$(distdir) archives ready for distribution: "; \ list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' distuninstallcheck: @cd $(distuninstallcheck_dir) \ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ || { echo "ERROR: files left after uninstall:" ; \ if test -n "$(DESTDIR)"; then \ echo " (check DESTDIR support)"; \ fi ; \ $(distuninstallcheck_listfiles) ; \ exit 1; } >&2 distcleancheck: distclean @if test '$(srcdir)' = . ; then \ echo "ERROR: distcleancheck can only run from a VPATH build" ; \ exit 1 ; \ fi @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ || { echo "ERROR: files left in build directory after distclean:" ; \ $(distcleancheck_listfiles) ; \ exit 1; } >&2 check-am: all-am check: check-recursive all-am: Makefile $(DATA) installdirs: installdirs-recursive installdirs-am: for dir in "$(DESTDIR)$(desktopdir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-desktopDATA install-dvi: install-dvi-recursive install-exec-am: install-html: install-html-recursive install-info: install-info-recursive install-man: install-pdf: install-pdf-recursive install-ps: install-ps-recursive installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f $(am__CONFIG_DISTCLEAN_FILES) -rm -rf $(top_srcdir)/autom4te.cache -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: uninstall-desktopDATA .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ install-strip .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am am--refresh check check-am clean clean-generic \ ctags ctags-recursive dist dist-all dist-bzip2 dist-gzip \ dist-shar dist-tarZ dist-zip distcheck distclean \ distclean-generic distclean-tags distcleancheck distdir \ distuninstallcheck dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am \ install-desktopDATA install-dvi install-dvi-am install-exec \ install-exec-am install-html install-html-am install-info \ install-info-am install-man install-pdf install-pdf-am \ install-ps install-ps-am install-strip installcheck \ installcheck-am installdirs installdirs-am maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-generic pdf \ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \ uninstall-desktopDATA # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: crimson-0.5.2.orig/crimson.spec.in0000600000175000017500000000513410365736110015241 0ustar uweuwe# this is not a relocatable package. Name : @PACKAGE@ Version : @VERSION@ Release : 1 License : GPL Group : Games/Strategy URL : http://crimson.seul.org Source : http://crimson.seul.org/files/%{name}-%{version}.tar.bz2 Summary : A hex-based tactical war game Packager : Jens Granseuer Buildroot : %{_tmppath}/%{name}-%{version}-root BuildRequires : SDL-devel >= 1.1.5, SDL_ttf-devel Requires : SDL >= 1.1.5, SDL_ttf %description Crimson Fields is a tactical war game in the tradition of Battle Isle for one or two players. The outcome of the war lies in your hands. You decide which units are sent to the front lines, and when to unleash the reserves. Your mission objectives range from defending strategically vital locations to simply destroying all enemy forces in the area. Protect supply convoys or raid enemy facilities to uncover technological secrets or fill your storage bays so you can repair damaged units or build new ones in your own factories. Lead your troops to victory! Tools are available to create custom maps and campaigns. You can also play the original Battle Isle maps if you have a copy of the game. %prep %setup %build %configure --enable-cfed --enable-bi2cf make %install rm -rf "$RPM_BUILD_ROOT" make DESTDIR="$RPM_BUILD_ROOT" install %clean rm -rf "$RPM_BUILD_ROOT" %files %defattr(-,root,root) %doc COPYING NEWS README README.bi2cf THANKS TODO music/COPYING.MUSIC %{_bindir}/* %{_datadir}/applications/*.desktop %{_datadir}/crimson %{_datadir}/pixmaps/* %doc %{_mandir}/man6/* %changelog * Thu Mar 10 2005 Jens Granseuer - remove unused prefix definition - add desktop file * Tue Apr 20 2004 Jens Granseuer - include COPYING.MUSIC * Sun Feb 22 2004 Jens Granseuer - require SDL_ttf * Sat Sep 20 2003 Jens Granseuer - distribute icon - use system directories * Fri Aug 22 2003 Jens Granseuer - updated URLs * Sat Dec 7 2002 Jens Granseuer - update for 0.3.0 - build and install the new bi2cf tool by default * Fri Jun 28 2002 Jens Granseuer - renamed ChangeLog to NEWS * Wed Apr 24 2002 Jens Granseuer - added THANKS and TODO files to docs * Sun Jul 22 2001 Jens Granseuer - use CXXFLAGS instead of CFLAGS * Thu May 17 2001 Jens Granseuer - include manual pages * Sun Apr 22 2001 Jens Granseuer - require SDL 1.1.5 * Wed Mar 7 2001 Jens Granseuer - updated to 0.1.1 - set Group to Amusements/Games * Thu Mar 1 2001 Jens Granseuer - initial public release crimson-0.5.2.orig/configure0000700000175000017500000065154210730255131014220 0ustar uweuwe#! /bin/sh # Guess values for system-dependent variables and create Makefiles. # Generated by GNU Autoconf 2.61 for Crimson Fields 0.5.2. # # Report bugs to . # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This configure script is free software; the Free Software Foundation # gives unlimited permission to copy, distribute and modify it. # # Copyright (C) 2000-2007 Jens Granseuer ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH if test "x$CONFIG_SHELL" = x; then if (eval ":") 2>/dev/null; then as_have_required=yes else as_have_required=no fi if test $as_have_required = yes && (eval ": (as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=\$LINENO as_lineno_2=\$LINENO test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" && test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; } ") 2> /dev/null; then : else as_candidate_shells= as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. case $as_dir in /*) for as_base in sh bash ksh sh5; do as_candidate_shells="$as_candidate_shells $as_dir/$as_base" done;; esac done IFS=$as_save_IFS for as_shell in $as_candidate_shells $SHELL; do # Try only shells that exist, to save several forks. if { test -f "$as_shell" || test -f "$as_shell.exe"; } && { ("$as_shell") 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : _ASEOF }; then CONFIG_SHELL=$as_shell as_have_required=yes if { "$as_shell" 2> /dev/null <<\_ASEOF if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi : (as_func_return () { (exit $1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = "$1" ); then : else exitcode=1 echo positional parameters were not saved. fi test $exitcode = 0) || { (exit 1); exit 1; } ( as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; } _ASEOF }; then break fi fi done if test "x$CONFIG_SHELL" != x; then for as_var in BASH_ENV ENV do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done export CONFIG_SHELL exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"} fi if test $as_have_required = no; then echo This script requires a shell more modern than all the echo shells that I found on your system. Please install a echo modern shell, or manually run the script under such a echo shell if you do have one. { (exit 1); exit 1; } fi fi fi (eval "as_func_return () { (exit \$1) } as_func_success () { as_func_return 0 } as_func_failure () { as_func_return 1 } as_func_ret_success () { return 0 } as_func_ret_failure () { return 1 } exitcode=0 if as_func_success; then : else exitcode=1 echo as_func_success failed. fi if as_func_failure; then exitcode=1 echo as_func_failure succeeded. fi if as_func_ret_success; then : else exitcode=1 echo as_func_ret_success failed. fi if as_func_ret_failure; then exitcode=1 echo as_func_ret_failure succeeded. fi if ( set x; as_func_ret_success y && test x = \"\$1\" ); then : else exitcode=1 echo positional parameters were not saved. fi test \$exitcode = 0") || { echo No shell found that supports shell functions. echo Please tell autoconf@gnu.org about your system, echo including any error possibly output before this echo message } as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 7<&0 &1 # Name of the host. # hostname on some systems (SVR3.2, Linux) returns a bogus exit status, # so uname gets run too. ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` # # Initializations. # ac_default_prefix=/usr/local ac_clean_files= ac_config_libobj_dir=. LIBOBJS= cross_compiling=no subdirs= MFLAGS= MAKEFLAGS= SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='Crimson Fields' PACKAGE_TARNAME='crimson' PACKAGE_VERSION='0.5.2' PACKAGE_STRING='Crimson Fields 0.5.2' PACKAGE_BUGREPORT='jensgr@gmx.net' ac_unique_file="src/common/globals.h" # Factoring default headers for most tests. ac_includes_default="\ #include #ifdef HAVE_SYS_TYPES_H # include #endif #ifdef HAVE_SYS_STAT_H # include #endif #ifdef STDC_HEADERS # include # include #else # ifdef HAVE_STDLIB_H # include # endif #endif #ifdef HAVE_STRING_H # if !defined STDC_HEADERS && defined HAVE_MEMORY_H # include # endif # include #endif #ifdef HAVE_STRINGS_H # include #endif #ifdef HAVE_INTTYPES_H # include #endif #ifdef HAVE_STDINT_H # include #endif #ifdef HAVE_UNISTD_H # include #endif" ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datarootdir datadir sysconfdir sharedstatedir localstatedir includedir oldincludedir docdir infodir htmldir dvidir pdfdir psdir libdir localedir mandir DEFS ECHO_C ECHO_N ECHO_T LIBS build_alias host_alias target_alias INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA am__isrc CYGPATH_W PACKAGE VERSION ACLOCAL AUTOCONF AUTOMAKE AUTOHEADER MAKEINFO install_sh STRIP INSTALL_STRIP_PROGRAM mkdir_p AWK SET_MAKE am__leading_dot AMTAR am__tar am__untar BUILD_CFED_TRUE BUILD_CFED_FALSE BUILD_COMET_TRUE BUILD_COMET_FALSE BUILD_BI2CF_TRUE BUILD_BI2CF_FALSE BUILD_CF2BMP_TRUE BUILD_CF2BMP_FALSE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT DEPDIR am__include am__quote AMDEP_TRUE AMDEP_FALSE AMDEPBACKSLASH CCDEPMODE am__fastdepCC_TRUE am__fastdepCC_FALSE CXX CXXFLAGS ac_ct_CXX CXXDEPMODE am__fastdepCXX_TRUE am__fastdepCXX_FALSE XSLTPROC XMLLINT SDL_CONFIG SDL_CFLAGS SDL_LIBS CPP GREP EGREP CF_LIBS LIBOBJS LTLIBOBJS' ac_subst_files='' ac_precious_vars='build_alias host_alias target_alias CC CFLAGS LDFLAGS LIBS CPPFLAGS CXX CXXFLAGS CCC CPP' # Initialize some variables set by options. ac_init_help= ac_init_version=false # The variables have the same names as the options, with # dashes changed to underlines. cache_file=/dev/null exec_prefix=NONE no_create= no_recursion= prefix=NONE program_prefix=NONE program_suffix=NONE program_transform_name=s,x,x, silent= site= srcdir= verbose= x_includes=NONE x_libraries=NONE # Installation directory options. # These are left unexpanded so users can "make install exec_prefix=/foo" # and all the variables that are supposed to be based on exec_prefix # by default will actually change. # Use braces instead of parens because sh, perl, etc. also accept them. # (The list follows the same order as the GNU Coding Standards.) bindir='${exec_prefix}/bin' sbindir='${exec_prefix}/sbin' libexecdir='${exec_prefix}/libexec' datarootdir='${prefix}/share' datadir='${datarootdir}' sysconfdir='${prefix}/etc' sharedstatedir='${prefix}/com' localstatedir='${prefix}/var' includedir='${prefix}/include' oldincludedir='/usr/include' docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' infodir='${datarootdir}/info' htmldir='${docdir}' dvidir='${docdir}' pdfdir='${docdir}' psdir='${docdir}' libdir='${exec_prefix}/lib' localedir='${datarootdir}/locale' mandir='${datarootdir}/man' ac_prev= ac_dashdash= for ac_option do # If the previous option needs an argument, assign it. if test -n "$ac_prev"; then eval $ac_prev=\$ac_option ac_prev= continue fi case $ac_option in *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; *) ac_optarg=yes ;; esac # Accept the important Cygnus configure options, so we can diagnose typos. case $ac_dashdash$ac_option in --) ac_dashdash=yes ;; -bindir | --bindir | --bindi | --bind | --bin | --bi) ac_prev=bindir ;; -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) bindir=$ac_optarg ;; -build | --build | --buil | --bui | --bu) ac_prev=build_alias ;; -build=* | --build=* | --buil=* | --bui=* | --bu=*) build_alias=$ac_optarg ;; -cache-file | --cache-file | --cache-fil | --cache-fi \ | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) ac_prev=cache_file ;; -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) cache_file=$ac_optarg ;; --config-cache | -C) cache_file=config.cache ;; -datadir | --datadir | --datadi | --datad) ac_prev=datadir ;; -datadir=* | --datadir=* | --datadi=* | --datad=*) datadir=$ac_optarg ;; -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ | --dataroo | --dataro | --datar) ac_prev=datarootdir ;; -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) datarootdir=$ac_optarg ;; -disable-* | --disable-*) ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=no ;; -docdir | --docdir | --docdi | --doc | --do) ac_prev=docdir ;; -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) docdir=$ac_optarg ;; -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) ac_prev=dvidir ;; -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) dvidir=$ac_optarg ;; -enable-* | --enable-*) ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid feature name: $ac_feature" >&2 { (exit 1); exit 1; }; } ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'` eval enable_$ac_feature=\$ac_optarg ;; -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ | --exec | --exe | --ex) ac_prev=exec_prefix ;; -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ | --exec=* | --exe=* | --ex=*) exec_prefix=$ac_optarg ;; -gas | --gas | --ga | --g) # Obsolete; use --with-gas. with_gas=yes ;; -help | --help | --hel | --he | -h) ac_init_help=long ;; -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) ac_init_help=recursive ;; -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) ac_init_help=short ;; -host | --host | --hos | --ho) ac_prev=host_alias ;; -host=* | --host=* | --hos=* | --ho=*) host_alias=$ac_optarg ;; -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) ac_prev=htmldir ;; -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ | --ht=*) htmldir=$ac_optarg ;; -includedir | --includedir | --includedi | --included | --include \ | --includ | --inclu | --incl | --inc) ac_prev=includedir ;; -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ | --includ=* | --inclu=* | --incl=* | --inc=*) includedir=$ac_optarg ;; -infodir | --infodir | --infodi | --infod | --info | --inf) ac_prev=infodir ;; -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) infodir=$ac_optarg ;; -libdir | --libdir | --libdi | --libd) ac_prev=libdir ;; -libdir=* | --libdir=* | --libdi=* | --libd=*) libdir=$ac_optarg ;; -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ | --libexe | --libex | --libe) ac_prev=libexecdir ;; -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ | --libexe=* | --libex=* | --libe=*) libexecdir=$ac_optarg ;; -localedir | --localedir | --localedi | --localed | --locale) ac_prev=localedir ;; -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) localedir=$ac_optarg ;; -localstatedir | --localstatedir | --localstatedi | --localstated \ | --localstate | --localstat | --localsta | --localst | --locals) ac_prev=localstatedir ;; -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) localstatedir=$ac_optarg ;; -mandir | --mandir | --mandi | --mand | --man | --ma | --m) ac_prev=mandir ;; -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) mandir=$ac_optarg ;; -nfp | --nfp | --nf) # Obsolete; use --without-fp. with_fp=no ;; -no-create | --no-create | --no-creat | --no-crea | --no-cre \ | --no-cr | --no-c | -n) no_create=yes ;; -no-recursion | --no-recursion | --no-recursio | --no-recursi \ | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) no_recursion=yes ;; -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ | --oldin | --oldi | --old | --ol | --o) ac_prev=oldincludedir ;; -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) oldincludedir=$ac_optarg ;; -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) ac_prev=prefix ;; -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) prefix=$ac_optarg ;; -program-prefix | --program-prefix | --program-prefi | --program-pref \ | --program-pre | --program-pr | --program-p) ac_prev=program_prefix ;; -program-prefix=* | --program-prefix=* | --program-prefi=* \ | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) program_prefix=$ac_optarg ;; -program-suffix | --program-suffix | --program-suffi | --program-suff \ | --program-suf | --program-su | --program-s) ac_prev=program_suffix ;; -program-suffix=* | --program-suffix=* | --program-suffi=* \ | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) program_suffix=$ac_optarg ;; -program-transform-name | --program-transform-name \ | --program-transform-nam | --program-transform-na \ | --program-transform-n | --program-transform- \ | --program-transform | --program-transfor \ | --program-transfo | --program-transf \ | --program-trans | --program-tran \ | --progr-tra | --program-tr | --program-t) ac_prev=program_transform_name ;; -program-transform-name=* | --program-transform-name=* \ | --program-transform-nam=* | --program-transform-na=* \ | --program-transform-n=* | --program-transform-=* \ | --program-transform=* | --program-transfor=* \ | --program-transfo=* | --program-transf=* \ | --program-trans=* | --program-tran=* \ | --progr-tra=* | --program-tr=* | --program-t=*) program_transform_name=$ac_optarg ;; -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) ac_prev=pdfdir ;; -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) pdfdir=$ac_optarg ;; -psdir | --psdir | --psdi | --psd | --ps) ac_prev=psdir ;; -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) psdir=$ac_optarg ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) silent=yes ;; -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) ac_prev=sbindir ;; -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ | --sbi=* | --sb=*) sbindir=$ac_optarg ;; -sharedstatedir | --sharedstatedir | --sharedstatedi \ | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ | --sharedst | --shareds | --shared | --share | --shar \ | --sha | --sh) ac_prev=sharedstatedir ;; -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ | --sha=* | --sh=*) sharedstatedir=$ac_optarg ;; -site | --site | --sit) ac_prev=site ;; -site=* | --site=* | --sit=*) site=$ac_optarg ;; -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) ac_prev=srcdir ;; -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) srcdir=$ac_optarg ;; -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ | --syscon | --sysco | --sysc | --sys | --sy) ac_prev=sysconfdir ;; -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) sysconfdir=$ac_optarg ;; -target | --target | --targe | --targ | --tar | --ta | --t) ac_prev=target_alias ;; -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) target_alias=$ac_optarg ;; -v | -verbose | --verbose | --verbos | --verbo | --verb) verbose=yes ;; -version | --version | --versio | --versi | --vers | -V) ac_init_version=: ;; -with-* | --with-*) ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=\$ac_optarg ;; -without-* | --without-*) ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'` # Reject names that are not valid shell variable names. expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid package name: $ac_package" >&2 { (exit 1); exit 1; }; } ac_package=`echo $ac_package | sed 's/[-.]/_/g'` eval with_$ac_package=no ;; --x) # Obsolete; use --with-x. with_x=yes ;; -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ | --x-incl | --x-inc | --x-in | --x-i) ac_prev=x_includes ;; -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) x_includes=$ac_optarg ;; -x-libraries | --x-libraries | --x-librarie | --x-librari \ | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) ac_prev=x_libraries ;; -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) x_libraries=$ac_optarg ;; -*) { echo "$as_me: error: unrecognized option: $ac_option Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *=*) ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` # Reject names that are not valid shell variable names. expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null && { echo "$as_me: error: invalid variable name: $ac_envvar" >&2 { (exit 1); exit 1; }; } eval $ac_envvar=\$ac_optarg export $ac_envvar ;; *) # FIXME: should be removed in autoconf 3.0. echo "$as_me: WARNING: you should use --build, --host, --target" >&2 expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && echo "$as_me: WARNING: invalid host type: $ac_option" >&2 : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option} ;; esac done if test -n "$ac_prev"; then ac_option=--`echo $ac_prev | sed 's/_/-/g'` { echo "$as_me: error: missing argument to $ac_option" >&2 { (exit 1); exit 1; }; } fi # Be sure to have absolute directory names. for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ datadir sysconfdir sharedstatedir localstatedir includedir \ oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ libdir localedir mandir do eval ac_val=\$$ac_var case $ac_val in [\\/$]* | ?:[\\/]* ) continue;; NONE | '' ) case $ac_var in *prefix ) continue;; esac;; esac { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2 { (exit 1); exit 1; }; } done # There might be people who depend on the old broken behavior: `$host' # used to hold the argument of --host etc. # FIXME: To remove some day. build=$build_alias host=$host_alias target=$target_alias # FIXME: To remove some day. if test "x$host_alias" != x; then if test "x$build_alias" = x; then cross_compiling=maybe echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host. If a cross compiler is detected then cross compile mode will be used." >&2 elif test "x$build_alias" != "x$host_alias"; then cross_compiling=yes fi fi ac_tool_prefix= test -n "$host_alias" && ac_tool_prefix=$host_alias- test "$silent" = yes && exec 6>/dev/null ac_pwd=`pwd` && test -n "$ac_pwd" && ac_ls_di=`ls -di .` && ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || { echo "$as_me: error: Working directory cannot be determined" >&2 { (exit 1); exit 1; }; } test "X$ac_ls_di" = "X$ac_pwd_ls_di" || { echo "$as_me: error: pwd does not report name of working directory" >&2 { (exit 1); exit 1; }; } # Find the source files, if location was not specified. if test -z "$srcdir"; then ac_srcdir_defaulted=yes # Try the directory containing this script, then the parent directory. ac_confdir=`$as_dirname -- "$0" || $as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$0" : 'X\(//\)[^/]' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X"$0" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` srcdir=$ac_confdir if test ! -r "$srcdir/$ac_unique_file"; then srcdir=.. fi else ac_srcdir_defaulted=no fi if test ! -r "$srcdir/$ac_unique_file"; then test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2 { (exit 1); exit 1; }; } fi ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" ac_abs_confdir=`( cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2 { (exit 1); exit 1; }; } pwd)` # When building in place, set srcdir=. if test "$ac_abs_confdir" = "$ac_pwd"; then srcdir=. fi # Remove unnecessary trailing slashes from srcdir. # Double slashes in file names in object file debugging info # mess up M-x gdb in Emacs. case $srcdir in */) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; esac for ac_var in $ac_precious_vars; do eval ac_env_${ac_var}_set=\${${ac_var}+set} eval ac_env_${ac_var}_value=\$${ac_var} eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} eval ac_cv_env_${ac_var}_value=\$${ac_var} done # # Report the --help message. # if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF \`configure' configures Crimson Fields 0.5.2 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. Defaults for the options are specified in brackets. Configuration: -h, --help display this help and exit --help=short display options specific to this package --help=recursive display the short help of all the included packages -V, --version display version information and exit -q, --quiet, --silent do not print \`checking...' messages --cache-file=FILE cache test results in FILE [disabled] -C, --config-cache alias for \`--cache-file=config.cache' -n, --no-create do not create output files --srcdir=DIR find the sources in DIR [configure dir or \`..'] Installation directories: --prefix=PREFIX install architecture-independent files in PREFIX [$ac_default_prefix] --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX [PREFIX] By default, \`make install' will install all the files in \`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify an installation prefix other than \`$ac_default_prefix' using \`--prefix', for instance \`--prefix=\$HOME'. For better control, use the options below. Fine tuning of the installation directories: --bindir=DIR user executables [EPREFIX/bin] --sbindir=DIR system admin executables [EPREFIX/sbin] --libexecdir=DIR program executables [EPREFIX/libexec] --sysconfdir=DIR read-only single-machine data [PREFIX/etc] --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] --localstatedir=DIR modifiable single-machine data [PREFIX/var] --libdir=DIR object code libraries [EPREFIX/lib] --includedir=DIR C header files [PREFIX/include] --oldincludedir=DIR C header files for non-gcc [/usr/include] --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] --datadir=DIR read-only architecture-independent data [DATAROOTDIR] --infodir=DIR info documentation [DATAROOTDIR/info] --localedir=DIR locale-dependent data [DATAROOTDIR/locale] --mandir=DIR man documentation [DATAROOTDIR/man] --docdir=DIR documentation root [DATAROOTDIR/doc/crimson] --htmldir=DIR html documentation [DOCDIR] --dvidir=DIR dvi documentation [DOCDIR] --pdfdir=DIR pdf documentation [DOCDIR] --psdir=DIR ps documentation [DOCDIR] _ACEOF cat <<\_ACEOF Program names: --program-prefix=PREFIX prepend PREFIX to installed program names --program-suffix=SUFFIX append SUFFIX to installed program names --program-transform-name=PROGRAM run sed PROGRAM on installed program names _ACEOF fi if test -n "$ac_init_help"; then case $ac_init_help in short | recursive ) echo "Configuration of Crimson Fields 0.5.2:";; esac cat <<\_ACEOF Optional Features: --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-sound compile without sound support --disable-network compile without networking support --enable-cfed build and install the level compiler --enable-comet build and install the graphical level editor --enable-bi2cf build and install the Battle Isle map converter --enable-cf2bmp build and install the map to image converter --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-sdltest Do not try to compile and run a test SDL program Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) --with-zlib=DIR use zlib in DIR --with-sdl-prefix=PFX Prefix where SDL is installed (optional) --with-sdl-exec-prefix=PFX Exec prefix where SDL is installed (optional) Some influential environment variables: CC C compiler command CFLAGS C compiler flags LDFLAGS linker flags, e.g. -L if you have libraries in a nonstandard directory LIBS libraries to pass to the linker, e.g. -l CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I if you have headers in a nonstandard directory CXX C++ compiler command CXXFLAGS C++ compiler flags CPP C preprocessor Use these variables to override the choices made by `configure' or to help it to find libraries and programs with nonstandard names/locations. Report bugs to . _ACEOF ac_status=$? fi if test "$ac_init_help" = "recursive"; then # If there are subdirs, report their specific --help. for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue test -d "$ac_dir" || continue ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix cd "$ac_dir" || { ac_status=$?; continue; } # Check for guested configure. if test -f "$ac_srcdir/configure.gnu"; then echo && $SHELL "$ac_srcdir/configure.gnu" --help=recursive elif test -f "$ac_srcdir/configure"; then echo && $SHELL "$ac_srcdir/configure" --help=recursive else echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 fi || ac_status=$? cd "$ac_pwd" || { ac_status=$?; break; } done fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF Crimson Fields configure 0.5.2 generated by GNU Autoconf 2.61 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This configure script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it. Copyright (C) 2000-2007 Jens Granseuer _ACEOF exit fi cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. It was created by Crimson Fields $as_me 0.5.2, which was generated by GNU Autoconf 2.61. Invocation command line was $ $0 $@ _ACEOF exec 5>>config.log { cat <<_ASUNAME ## --------- ## ## Platform. ## ## --------- ## hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` uname -s = `(uname -s) 2>/dev/null || echo unknown` uname -v = `(uname -v) 2>/dev/null || echo unknown` /usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` /bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` /bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` /usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` /usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` /usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` /bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` /usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` /bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` _ASUNAME as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. echo "PATH: $as_dir" done IFS=$as_save_IFS } >&5 cat >&5 <<_ACEOF ## ----------- ## ## Core tests. ## ## ----------- ## _ACEOF # Keep a trace of the command line. # Strip out --no-create and --no-recursion so they do not pile up. # Strip out --silent because we don't want to record it for future runs. # Also quote any args containing shell meta-characters. # Make two passes to allow for proper duplicate-argument suppression. ac_configure_args= ac_configure_args0= ac_configure_args1= ac_must_keep_next=false for ac_pass in 1 2 do for ac_arg do case $ac_arg in -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil) continue ;; *\'*) ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; esac case $ac_pass in 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;; 2) ac_configure_args1="$ac_configure_args1 '$ac_arg'" if test $ac_must_keep_next = true; then ac_must_keep_next=false # Got value, back to normal. else case $ac_arg in *=* | --config-cache | -C | -disable-* | --disable-* \ | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ | -with-* | --with-* | -without-* | --without-* | --x) case "$ac_configure_args0 " in "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; esac ;; -* ) ac_must_keep_next=true ;; esac fi ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac done done $as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; } $as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; } # When interrupted or exit'd, cleanup temporary files, and complete # config.log. We remove comments because anyway the quotes in there # would cause problems or look ugly. # WARNING: Use '\'' to represent an apostrophe within the trap. # WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. trap 'exit_status=$? # Save into config.log some information that might help in debugging. { echo cat <<\_ASBOX ## ---------------- ## ## Cache variables. ## ## ---------------- ## _ASBOX echo # The following way of writing the cache mishandles newlines in values, ( for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( *${as_nl}ac_space=\ *) sed -n \ "s/'\''/'\''\\\\'\'''\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" ;; #( *) sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) echo cat <<\_ASBOX ## ----------------- ## ## Output variables. ## ## ----------------- ## _ASBOX echo for ac_var in $ac_subst_vars do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo if test -n "$ac_subst_files"; then cat <<\_ASBOX ## ------------------- ## ## File substitutions. ## ## ------------------- ## _ASBOX echo for ac_var in $ac_subst_files do eval ac_val=\$$ac_var case $ac_val in *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; esac echo "$ac_var='\''$ac_val'\''" done | sort echo fi if test -s confdefs.h; then cat <<\_ASBOX ## ----------- ## ## confdefs.h. ## ## ----------- ## _ASBOX echo cat confdefs.h echo fi test "$ac_signal" != 0 && echo "$as_me: caught signal $ac_signal" echo "$as_me: exit $exit_status" } >&5 rm -f core *.core core.conftest.* && rm -f -r conftest* confdefs* conf$$* $ac_clean_files && exit $exit_status ' 0 for ac_signal in 1 2 13 15; do trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal done ac_signal=0 # confdefs.h avoids OS command line length limits that DEFS can exceed. rm -f -r conftest* confdefs.h # Predefined preprocessor variables. cat >>confdefs.h <<_ACEOF #define PACKAGE_NAME "$PACKAGE_NAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_TARNAME "$PACKAGE_TARNAME" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_VERSION "$PACKAGE_VERSION" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_STRING "$PACKAGE_STRING" _ACEOF cat >>confdefs.h <<_ACEOF #define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" _ACEOF # Let the site file select an alternate cache file if it wants to. # Prefer explicitly selected file to automatically selected ones. if test -n "$CONFIG_SITE"; then set x "$CONFIG_SITE" elif test "x$prefix" != xNONE; then set x "$prefix/share/config.site" "$prefix/etc/config.site" else set x "$ac_default_prefix/share/config.site" \ "$ac_default_prefix/etc/config.site" fi shift for ac_site_file do if test -r "$ac_site_file"; then { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} sed 's/^/| /' "$ac_site_file" >&5 . "$ac_site_file" fi done if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then { echo "$as_me:$LINENO: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . "$cache_file";; *) . "./$cache_file";; esac fi else { echo "$as_me:$LINENO: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false for ac_var in $ac_precious_vars; do eval ac_old_set=\$ac_cv_env_${ac_var}_set eval ac_new_set=\$ac_env_${ac_var}_set eval ac_old_val=\$ac_cv_env_${ac_var}_value eval ac_new_val=\$ac_env_${ac_var}_value case $ac_old_set,$ac_new_set in set,) { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} { echo "$as_me:$LINENO: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} { echo "$as_me:$LINENO: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; esac # Pass precious variables to config.status. if test "$ac_new_set" = set; then case $ac_new_val in *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; *) ac_arg=$ac_var=$ac_new_val ;; esac case " $ac_configure_args " in *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. *) ac_configure_args="$ac_configure_args '$ac_arg'" ;; esac fi done if $ac_cache_corrupted; then { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu ac_aux_dir= for ac_dir in config "$srcdir"/config; do if test -f "$ac_dir/install-sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install-sh -c" break elif test -f "$ac_dir/install.sh"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/install.sh -c" break elif test -f "$ac_dir/shtool"; then ac_aux_dir=$ac_dir ac_install_sh="$ac_aux_dir/shtool install -c" break fi done if test -z "$ac_aux_dir"; then { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&5 echo "$as_me: error: cannot find install-sh or install.sh in config \"$srcdir\"/config" >&2;} { (exit 1); exit 1; }; } fi # These three variables are undocumented and unsupported, # and are intended to be withdrawn in a future Autoconf release. # They can cause serious problems if a builder's source tree is in a directory # whose full name contains unusual characters. ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. am__api_version='1.10' # Find a good install program. We prefer a C program (faster), # so one script is as good as another. But avoid the broken or # incompatible versions: # SysV /etc/install, /usr/sbin/install # SunOS /usr/etc/install # IRIX /sbin/install # AIX /bin/install # AmigaOS /C/install, which installs bootblocks on floppy discs # AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # OS/2's system install, which has a completely different semantic # ./install, which can be erroneously created by make from ./install.sh. { echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5 echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; } if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. # Account for people who put trailing slashes in PATH elements. case $as_dir/ in ./ | .// | /cC/* | \ /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \ /usr/ucb/* ) ;; *) # OSF1 and SCO ODT 3.0 have their own names for install. # Don't use installbsd from OSF since it installs stuff as root # by default. for ac_prog in ginstall scoinst install; do for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then if test $ac_prog = install && grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # AIX install. It has an incompatible calling convention. : elif test $ac_prog = install && grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then # program-specific install script used by HP pwplus--don't use. : else ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" break 3 fi fi done done ;; esac done IFS=$as_save_IFS fi if test "${ac_cv_path_install+set}" = set; then INSTALL=$ac_cv_path_install else # As a last resort, use the slow shell script. Don't cache a # value for INSTALL within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. INSTALL=$ac_install_sh fi fi { echo "$as_me:$LINENO: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6; } # Use test -z because SunOS4 sh mishandles braces in ${var-val}. # It thinks the first close brace ends the variable substitution. test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' { echo "$as_me:$LINENO: checking whether build environment is sane" >&5 echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; } # Just in case sleep 1 echo timestamp > conftest.file # Do `set' in a subshell so we don't clobber the current shell's # arguments. Must try -L first in case configure is actually a # symlink; some systems play weird games with the mod time of symlinks # (eg FreeBSD returns the mod time of the symlink's containing # directory). if ( set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null` if test "$*" = "X"; then # -L didn't work. set X `ls -t $srcdir/configure conftest.file` fi rm -f conftest.file if test "$*" != "X $srcdir/configure conftest.file" \ && test "$*" != "X conftest.file $srcdir/configure"; then # If neither matched, then we have a broken ls. This can happen # if, for instance, CONFIG_SHELL is bash and it inherits a # broken ls alias from the environment. This has actually # happened. Such a system could not be considered "sane". { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&5 echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken alias in your environment" >&2;} { (exit 1); exit 1; }; } fi test "$2" = conftest.file ) then # Ok. : else { { echo "$as_me:$LINENO: error: newly created file is older than distributed files! Check your system clock" >&5 echo "$as_me: error: newly created file is older than distributed files! Check your system clock" >&2;} { (exit 1); exit 1; }; } fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } test "$program_prefix" != NONE && program_transform_name="s&^&$program_prefix&;$program_transform_name" # Use a double $ so make ignores it. test "$program_suffix" != NONE && program_transform_name="s&\$&$program_suffix&;$program_transform_name" # Double any \ or $. echo might interpret backslashes. # By default was `s,x,x', remove it if useless. cat <<\_ACEOF >conftest.sed s/[\\$]/&&/g;s/;s,x,x,$// _ACEOF program_transform_name=`echo $program_transform_name | sed -f conftest.sed` rm -f conftest.sed # expand $ac_aux_dir to an absolute path am_aux_dir=`cd $ac_aux_dir && pwd` test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing" # Use eval to expand $SHELL if eval "$MISSING --run true"; then am_missing_run="$MISSING --run " else am_missing_run= { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5 echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} fi { echo "$as_me:$LINENO: checking for a thread-safe mkdir -p" >&5 echo $ECHO_N "checking for a thread-safe mkdir -p... $ECHO_C" >&6; } if test -z "$MKDIR_P"; then if test "${ac_cv_path_mkdir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in mkdir gmkdir; do for ac_exec_ext in '' $ac_executable_extensions; do { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( 'mkdir (GNU coreutils) '* | \ 'mkdir (coreutils) '* | \ 'mkdir (fileutils) '4.1*) ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext break 3;; esac done done done IFS=$as_save_IFS fi if test "${ac_cv_path_mkdir+set}" = set; then MKDIR_P="$ac_cv_path_mkdir -p" else # As a last resort, use the slow shell script. Don't cache a # value for MKDIR_P within a source directory, because that will # break other packages using the cache if that directory is # removed, or if the value is a relative name. test -d ./--version && rmdir ./--version MKDIR_P="$ac_install_sh -d" fi fi { echo "$as_me:$LINENO: result: $MKDIR_P" >&5 echo "${ECHO_T}$MKDIR_P" >&6; } mkdir_p="$MKDIR_P" case $mkdir_p in [\\/$]* | ?:[\\/]*) ;; */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; esac for ac_prog in gawk mawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$AWK"; then ac_cv_prog_AWK="$AWK" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_AWK="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then { echo "$as_me:$LINENO: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$AWK" && break done { echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; } set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.make <<\_ACEOF SHELL = /bin/sh all: @echo '@@@%%%=$(MAKE)=@@@%%%' _ACEOF # GNU make sometimes prints "make[1]: Entering...", which would confuse us. case `${MAKE-make} -f conftest.make 2>/dev/null` in *@@@%%%=?*=@@@%%%*) eval ac_cv_prog_make_${ac_make}_set=yes;; *) eval ac_cv_prog_make_${ac_make}_set=no;; esac rm -f conftest.make fi if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } SET_MAKE= else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } SET_MAKE="MAKE=${MAKE-make}" fi rm -rf .tst 2>/dev/null mkdir .tst 2>/dev/null if test -d .tst; then am__leading_dot=. else am__leading_dot=_ fi rmdir .tst 2>/dev/null if test "`cd $srcdir && pwd`" != "`pwd`"; then # Use -I$(srcdir) only when $(srcdir) != ., so that make's output # is not polluted with repeated "-I." am__isrc=' -I$(srcdir)' # test to see if srcdir already configured if test -f $srcdir/config.status; then { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5 echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;} { (exit 1); exit 1; }; } fi fi # test whether we have cygpath if test -z "$CYGPATH_W"; then if (cygpath --version) >/dev/null 2>/dev/null; then CYGPATH_W='cygpath -w' else CYGPATH_W=echo fi fi # Define the identity of the package. PACKAGE='crimson' VERSION='0.5.2' cat >>confdefs.h <<_ACEOF #define PACKAGE "$PACKAGE" _ACEOF cat >>confdefs.h <<_ACEOF #define VERSION "$VERSION" _ACEOF # Some tools Automake needs. ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} install_sh=${install_sh-"\$(SHELL) $am_aux_dir/install-sh"} # Installed binaries are usually stripped using `strip' when the user # run `make install-strip'. However `strip' might not be the right # tool to use in cross-compilation environments, therefore Automake # will honor the `STRIP' environment variable to overrule this program. if test "$cross_compiling" != no; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. set dummy ${ac_tool_prefix}strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$STRIP"; then ac_cv_prog_STRIP="$STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_STRIP="${ac_tool_prefix}strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi STRIP=$ac_cv_prog_STRIP if test -n "$STRIP"; then { echo "$as_me:$LINENO: result: $STRIP" >&5 echo "${ECHO_T}$STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_STRIP"; then ac_ct_STRIP=$STRIP # Extract the first word of "strip", so it can be a program name with args. set dummy strip; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_STRIP"; then ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_STRIP="strip" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP if test -n "$ac_ct_STRIP"; then { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5 echo "${ECHO_T}$ac_ct_STRIP" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_STRIP" = x; then STRIP=":" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac STRIP=$ac_ct_STRIP fi else STRIP="$ac_cv_prog_STRIP" fi fi INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" # We need awk for the "check" target. The system "awk" is bad on # some platforms. # Always define AMTAR for backward compatibility. AMTAR=${AMTAR-"${am_missing_run}tar"} am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' ZLIB_HOME= # Check whether --with-zlib was given. if test "${with_zlib+set}" = set; then withval=$with_zlib; if test "x$withval" != xno; then use_zlib=yes if test "x$withval" != xyes; then ZLIB_HOME="$withval" fi else use_zlib=no fi else use_zlib=yes fi # Check whether --enable-sound was given. if test "${enable_sound+set}" = set; then enableval=$enable_sound; else enable_sound=yes fi # Check whether --enable-network was given. if test "${enable_network+set}" = set; then enableval=$enable_network; else enable_network=yes fi # Check whether --enable-cfed was given. if test "${enable_cfed+set}" = set; then enableval=$enable_cfed; else enable_cfed=no fi if test x$enable_cfed = xyes; then BUILD_CFED_TRUE= BUILD_CFED_FALSE='#' else BUILD_CFED_TRUE='#' BUILD_CFED_FALSE= fi # Check whether --enable-comet was given. if test "${enable_comet+set}" = set; then enableval=$enable_comet; else enable_comet=no fi if test x$enable_comet = xyes; then BUILD_COMET_TRUE= BUILD_COMET_FALSE='#' else BUILD_COMET_TRUE='#' BUILD_COMET_FALSE= fi # Check whether --enable-bi2cf was given. if test "${enable_bi2cf+set}" = set; then enableval=$enable_bi2cf; else enable_bi2cf=no fi if test x$enable_bi2cf = xyes; then BUILD_BI2CF_TRUE= BUILD_BI2CF_FALSE='#' else BUILD_BI2CF_TRUE='#' BUILD_BI2CF_FALSE= fi # Check whether --enable-cf2bmp was given. if test "${enable_cf2bmp+set}" = set; then enableval=$enable_cf2bmp; else enable_cf2bmp=no fi if test x$enable_cf2bmp = xyes; then BUILD_CF2BMP_TRUE= BUILD_CF2BMP_FALSE='#' else BUILD_CF2BMP_TRUE='#' BUILD_CF2BMP_FALSE= fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="gcc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi else CC="$ac_cv_prog_CC" fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="${ac_tool_prefix}cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else ac_prog_rejected=no as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then ac_prog_rejected=yes continue fi ac_cv_prog_CC="cc" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS if test $ac_prog_rejected = yes; then # We found a bogon in the path, so make sure we never use it. set dummy $ac_cv_prog_CC shift if test $# != 0; then # We chose a different compiler from the bogus one. # However, it has the same basename, so the bogon will be chosen # first if we set CC to just the basename; use the full file name. shift ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" fi fi fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi fi if test -z "$CC"; then if test -n "$ac_tool_prefix"; then for ac_prog in cl.exe do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CC"; then ac_cv_prog_CC="$CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CC="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then { echo "$as_me:$LINENO: result: $CC" >&5 echo "${ECHO_T}$CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CC" && break done fi if test -z "$CC"; then ac_ct_CC=$CC for ac_prog in cl.exe do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CC"; then ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CC="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CC" && break done if test "x$ac_ct_CC" = x; then CC="" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CC=$ac_ct_CC fi fi fi test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&5 echo "$as_me: error: no acceptable C compiler found in \$PATH See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files a.out a.exe b.out" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. { echo "$as_me:$LINENO: checking for C compiler default output file name" >&5 echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; } ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` # # List of possible output files, starting from the most likely. # The algorithm is not robust to junk in `.', hence go to wildcards (a.*) # only as a last resort. b.out is created by i960 compilers. ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out' # # The IRIX 6 linker writes into existing files which may not be # executable, retaining their permissions. Remove them first so a # subsequent execution test works. ac_rmfiles= for ac_file in $ac_files do case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; * ) ac_rmfiles="$ac_rmfiles $ac_file";; esac done rm -f $ac_rmfiles if { (ac_try="$ac_link_default" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link_default") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. # So ignore a value of `no', otherwise this would lead to `EXEEXT = no' # in a Makefile. We should not override ac_cv_exeext if it was cached, # so that the user can short-circuit this test for compilers unknown to # Autoconf. for ac_file in $ac_files '' do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; [ab].out ) # We found the default executable, but exeext='' is most # certainly right. break;; *.* ) if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; then :; else ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` fi # We set ac_cv_exeext here because the later test for it is not # safe: cross compilers may not add the suffix if given an `-o' # argument, so we may need to know it at that point already. # Even if this section looks crufty: it has the advantage of # actually working. break;; * ) break;; esac done test "$ac_cv_exeext" = no && ac_cv_exeext= else ac_file='' fi { echo "$as_me:$LINENO: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6; } if test -z "$ac_file"; then echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: C compiler cannot create executables See \`config.log' for more details." >&5 echo "$as_me: error: C compiler cannot create executables See \`config.log' for more details." >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; } # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else { { echo "$as_me:$LINENO: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'. See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi fi fi { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } rm -f a.out a.exe conftest$ac_cv_exeext b.out ac_clean_files=$ac_clean_files_save # Check that the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. { echo "$as_me:$LINENO: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; } { echo "$as_me:$LINENO: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6; } { echo "$as_me:$LINENO: checking for suffix of executables" >&5 echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; } if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will # work properly (i.e., refer to `conftest.exe'), while it won't with # `rm'. for ac_file in conftest.exe conftest conftest.*; do test -f "$ac_file" || continue case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;; *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` break;; * ) break;; esac done else { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of executables: cannot compile and link See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext { echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6; } rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT { echo "$as_me:$LINENO: checking for suffix of object files" >&5 echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; } if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.o conftest.obj if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in conftest.o conftest.obj conftest.*; do test -f "$ac_file" || continue; case $ac_file in *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;; *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` break;; esac done else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 { { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&5 echo "$as_me: error: cannot compute suffix of object files: cannot compile See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6; } OBJEXT=$ac_cv_objext ac_objext=$OBJEXT { echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; } if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; } GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS { echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_c_werror_flag=$ac_c_werror_flag ac_c_werror_flag=yes ac_cv_prog_cc_g=no CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_c_werror_flag=$ac_save_c_werror_flag CFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_c_werror_flag=$ac_save_c_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; } if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS elif test $ac_cv_prog_cc_g = yes; then if test "$GCC" = yes; then CFLAGS="-g -O2" else CFLAGS="-g" fi else if test "$GCC" = yes; then CFLAGS="-O2" else CFLAGS= fi fi { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5 echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; } if test "${ac_cv_prog_cc_c89+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_prog_cc_c89=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include /* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ struct buf { int x; }; FILE * (*rcsopen) (struct buf *, struct stat *, int); static char *e (p, i) char **p; int i; { return p[i]; } static char *f (char * (*g) (char **, int), char **p, ...) { char *s; va_list v; va_start (v,p); s = g (p, va_arg (v,int)); va_end (v); return s; } /* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has function prototypes and stuff, but not '\xHH' hex character constants. These don't provoke an error unfortunately, instead are silently treated as 'x'. The following induces an error, until -std is added to get proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an array size at least. It's necessary to write '\x00'==0 to get something that's true only with -std. */ int osf4_cc_array ['\x00' == 0 ? 1 : -1]; /* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters inside strings and character constants. */ #define FOO(x) 'x' int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; int test (int i, double x); struct s1 {int (*f) (int a);}; struct s2 {int (*f) (double a);}; int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); int argc; char **argv; int main () { return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; ; return 0; } _ACEOF for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cc_c89=$ac_arg else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext test "x$ac_cv_prog_cc_c89" != "xno" && break done rm -f conftest.$ac_ext CC=$ac_save_CC fi # AC_CACHE_VAL case "x$ac_cv_prog_cc_c89" in x) { echo "$as_me:$LINENO: result: none needed" >&5 echo "${ECHO_T}none needed" >&6; } ;; xno) { echo "$as_me:$LINENO: result: unsupported" >&5 echo "${ECHO_T}unsupported" >&6; } ;; *) CC="$CC $ac_cv_prog_cc_c89" { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5 echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;; esac ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu DEPDIR="${am__leading_dot}deps" ac_config_commands="$ac_config_commands depfiles" am_make=${MAKE-make} cat > confinc << 'END' am__doit: @echo done .PHONY: am__doit END # If we don't find an include directive, just comment out the code. { echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5 echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; } am__include="#" am__quote= _am_result=none # First try GNU make style include. echo "include confinc" > confmf # We grep out `Entering directory' and `Leaving directory' # messages which can occur if `w' ends up in MAKEFLAGS. # In particular we don't look at `^make:' because GNU make might # be invoked under some other name (usually "gmake"), in which # case it prints its new name instead of `make'. if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then am__include=include am__quote= _am_result=GNU fi # Now try BSD make style include. if test "$am__include" = "#"; then echo '.include "confinc"' > confmf if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then am__include=.include am__quote="\"" _am_result=BSD fi fi { echo "$as_me:$LINENO: result: $_am_result" >&5 echo "${ECHO_T}$_am_result" >&6; } rm -f confinc confmf # Check whether --enable-dependency-tracking was given. if test "${enable_dependency_tracking+set}" = set; then enableval=$enable_dependency_tracking; fi if test "x$enable_dependency_tracking" != xno; then am_depcomp="$ac_aux_dir/depcomp" AMDEPBACKSLASH='\' fi if test "x$enable_dependency_tracking" != xno; then AMDEP_TRUE= AMDEP_FALSE='#' else AMDEP_TRUE='#' AMDEP_FALSE= fi depcc="$CC" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CC_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CC_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CC_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; } CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then am__fastdepCC_TRUE= am__fastdepCC_FALSE='#' else am__fastdepCC_TRUE='#' am__fastdepCC_FALSE= fi ac_ext=cpp ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu if test -z "$CXX"; then if test -n "$CCC"; then CXX=$CCC else if test -n "$ac_tool_prefix"; then for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$CXX"; then ac_cv_prog_CXX="$CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then { echo "$as_me:$LINENO: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$CXX" && break done fi if test -z "$CXX"; then ac_ct_CXX=$CXX for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -n "$ac_ct_CXX"; then ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test. else as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_prog_ac_ct_CXX="$ac_prog" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi test -n "$ac_ct_CXX" && break done if test "x$ac_ct_CXX" = x; then CXX="g++" else case $cross_compiling:$ac_tool_warned in yes:) { echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&5 echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools whose name does not start with the host triplet. If you think this configuration is useful to you, please write to autoconf@gnu.org." >&2;} ac_tool_warned=yes ;; esac CXX=$ac_ct_CXX fi fi fi fi # Provide some information about the compiler. echo "$as_me:$LINENO: checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` { (ac_try="$ac_compiler --version >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler --version >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -v >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -v >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { (ac_try="$ac_compiler -V >&5" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compiler -V >&5") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } { echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; } if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { #ifndef __GNUC__ choke me #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_compiler_gnu=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_compiler_gnu=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi { echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; } GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS { echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; } if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_save_cxx_werror_flag=$ac_cxx_werror_flag ac_cxx_werror_flag=yes ac_cv_prog_cxx_g=no CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 CXXFLAGS="" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cxx_werror_flag=$ac_save_cxx_werror_flag CXXFLAGS="-g" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_cxx_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_prog_cxx_g=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext ac_cxx_werror_flag=$ac_save_cxx_werror_flag fi { echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; } if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS elif test $ac_cv_prog_cxx_g = yes; then if test "$GXX" = yes; then CXXFLAGS="-g -O2" else CXXFLAGS="-g" fi else if test "$GXX" = yes; then CXXFLAGS="-O2" else CXXFLAGS= fi fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu depcc="$CXX" am_compiler_list= { echo "$as_me:$LINENO: checking dependency style of $depcc" >&5 echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; } if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then # We make a subdir and do the tests there. Otherwise we can end up # making bogus files that we don't know about and never remove. For # instance it was reported that on HP-UX the gcc test will end up # making a dummy file named `D' -- because `-MD' means `put the output # in D'. mkdir conftest.dir # Copy depcomp to subdir because otherwise we won't find it if we're # using a relative directory. cp "$am_depcomp" conftest.dir cd conftest.dir # We will build objects and dependencies in a subdirectory because # it helps to detect inapplicable dependency modes. For instance # both Tru64's cc and ICC support -MD to output dependencies as a # side effect of compilation, but ICC will put the dependencies in # the current directory while Tru64 will put them in the object # directory. mkdir sub am_cv_CXX_dependencies_compiler_type=none if test "$am_compiler_list" = ""; then am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` fi for depmode in $am_compiler_list; do # Setup a source with many dependencies, because some compilers # like to wrap large dependency lists on column 80 (with \), and # we should not choose a depcomp mode which is confused by this. # # We need to recreate these files for each test, as the compiler may # overwrite some of them when testing with obscure command lines. # This happens at least with the AIX C compiler. : > sub/conftest.c for i in 1 2 3 4 5 6; do echo '#include "conftst'$i'.h"' >> sub/conftest.c # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with # Solaris 8's {/usr,}/bin/sh. touch sub/conftst$i.h done echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf case $depmode in nosideeffect) # after this tag, mechanisms are not by side-effect, so they'll # only be used when explicitly requested if test "x$enable_dependency_tracking" = xyes; then continue else break fi ;; none) break ;; esac # We check with `-c' and `-o' for the sake of the "dashmstdout" # mode. It turns out that the SunPro C++ compiler does not properly # handle `-M -o', and we need to detect this. if depmode=$depmode \ source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \ depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \ >/dev/null 2>conftest.err && grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 && ${MAKE-make} -s -f confmf > /dev/null 2>&1; then # icc doesn't choke on unknown options, it will just issue warnings # or remarks (even with -Werror). So we grep stderr for any message # that says an option was ignored or not supported. # When given -MP, icc 7.0 and 7.1 complain thusly: # icc: Command line warning: ignoring option '-M'; no argument required # The diagnosis changed in icc 8.0: # icc: Command line remark: option '-MP' not supported if (grep 'ignoring option' conftest.err || grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else am_cv_CXX_dependencies_compiler_type=$depmode break fi fi done cd .. rm -rf conftest.dir else am_cv_CXX_dependencies_compiler_type=none fi fi { echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5 echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; } CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type if test "x$enable_dependency_tracking" != xno \ && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then am__fastdepCXX_TRUE= am__fastdepCXX_FALSE='#' else am__fastdepCXX_TRUE='#' am__fastdepCXX_FALSE= fi # Extract the first word of "xsltproc", so it can be a program name with args. set dummy xsltproc; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_XSLTPROC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $XSLTPROC in [\\/]* | ?:[\\/]*) ac_cv_path_XSLTPROC="$XSLTPROC" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_XSLTPROC="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi XSLTPROC=$ac_cv_path_XSLTPROC if test -n "$XSLTPROC"; then { echo "$as_me:$LINENO: result: $XSLTPROC" >&5 echo "${ECHO_T}$XSLTPROC" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi # Extract the first word of "xmllint", so it can be a program name with args. set dummy xmllint; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_XMLLINT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $XMLLINT in [\\/]* | ?:[\\/]*) ac_cv_path_XMLLINT="$XMLLINT" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_XMLLINT="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS ;; esac fi XMLLINT=$ac_cv_path_XMLLINT if test -n "$XMLLINT"; then { echo "$as_me:$LINENO: result: $XMLLINT" >&5 echo "${ECHO_T}$XMLLINT" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi SDL_VERSION=1.1.5 # Check whether --with-sdl-prefix was given. if test "${with_sdl_prefix+set}" = set; then withval=$with_sdl_prefix; sdl_prefix="$withval" else sdl_prefix="" fi # Check whether --with-sdl-exec-prefix was given. if test "${with_sdl_exec_prefix+set}" = set; then withval=$with_sdl_exec_prefix; sdl_exec_prefix="$withval" else sdl_exec_prefix="" fi # Check whether --enable-sdltest was given. if test "${enable_sdltest+set}" = set; then enableval=$enable_sdltest; else enable_sdltest=yes fi if test x$sdl_exec_prefix != x ; then sdl_args="$sdl_args --exec-prefix=$sdl_exec_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_exec_prefix/bin/sdl-config fi fi if test x$sdl_prefix != x ; then sdl_args="$sdl_args --prefix=$sdl_prefix" if test x${SDL_CONFIG+set} != xset ; then SDL_CONFIG=$sdl_prefix/bin/sdl-config fi fi if test "x$prefix" != xNONE; then PATH="$prefix/bin:$prefix/usr/bin:$PATH" fi # Extract the first word of "sdl-config", so it can be a program name with args. set dummy sdl-config; ac_word=$2 { echo "$as_me:$LINENO: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; } if test "${ac_cv_path_SDL_CONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else case $SDL_CONFIG in [\\/]* | ?:[\\/]*) ac_cv_path_SDL_CONFIG="$SDL_CONFIG" # Let the user override the test with a path. ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_exec_ext in '' $ac_executable_extensions; do if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then ac_cv_path_SDL_CONFIG="$as_dir/$ac_word$ac_exec_ext" echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5 break 2 fi done done IFS=$as_save_IFS test -z "$ac_cv_path_SDL_CONFIG" && ac_cv_path_SDL_CONFIG="no" ;; esac fi SDL_CONFIG=$ac_cv_path_SDL_CONFIG if test -n "$SDL_CONFIG"; then { echo "$as_me:$LINENO: result: $SDL_CONFIG" >&5 echo "${ECHO_T}$SDL_CONFIG" >&6; } else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } fi min_sdl_version=$SDL_VERSION { echo "$as_me:$LINENO: checking for SDL - version >= $min_sdl_version" >&5 echo $ECHO_N "checking for SDL - version >= $min_sdl_version... $ECHO_C" >&6; } no_sdl="" if test "$SDL_CONFIG" = "no" ; then no_sdl=yes else SDL_CFLAGS=`$SDL_CONFIG $sdlconf_args --cflags` SDL_LIBS=`$SDL_CONFIG $sdlconf_args --libs` sdl_major_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'` sdl_minor_version=`$SDL_CONFIG $sdl_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'` sdl_micro_version=`$SDL_CONFIG $sdl_config_args --version | \ sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'` if test "x$enable_sdltest" = "xyes" ; then ac_save_CFLAGS="$CFLAGS" ac_save_CXXFLAGS="$CXXFLAGS" ac_save_LIBS="$LIBS" CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" rm -f conf.sdltest if test "$cross_compiling" = yes; then echo $ac_n "cross compiling; assumed OK... $ac_c" else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include "SDL.h" char* my_strdup (char *str) { char *new_str; if (str) { new_str = (char *)malloc ((strlen (str) + 1) * sizeof(char)); strcpy (new_str, str); } else new_str = NULL; return new_str; } int main (int argc, char *argv[]) { int major, minor, micro; char *tmp_version; /* This hangs on some systems (?) system ("touch conf.sdltest"); */ { FILE *fp = fopen("conf.sdltest", "a"); if ( fp ) fclose(fp); } /* HP/UX 9 (%@#!) writes to sscanf strings */ tmp_version = my_strdup("$min_sdl_version"); if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) { printf("%s, bad version string\n", "$min_sdl_version"); exit(1); } if (($sdl_major_version > major) || (($sdl_major_version == major) && ($sdl_minor_version > minor)) || (($sdl_major_version == major) && ($sdl_minor_version == minor) && ($sdl_micro_version >= micro))) { return 0; } else { printf("\n*** 'sdl-config --version' returned %d.%d.%d, but the minimum version\n", $sdl_major_version, $sdl_minor_version, $sdl_micro_version); printf("*** of SDL required is %d.%d.%d. If sdl-config is correct, then it is\n", major, minor, micro); printf("*** best to upgrade to the required version.\n"); printf("*** If sdl-config was wrong, set the environment variable SDL_CONFIG\n"); printf("*** to point to the correct copy of sdl-config, and remove the file\n"); printf("*** config.cache before re-running configure\n"); return 1; } } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) no_sdl=yes fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" fi fi if test "x$no_sdl" = x ; then { echo "$as_me:$LINENO: result: yes" >&5 echo "${ECHO_T}yes" >&6; } : else { echo "$as_me:$LINENO: result: no" >&5 echo "${ECHO_T}no" >&6; } if test "$SDL_CONFIG" = "no" ; then echo "*** The sdl-config script installed by SDL could not be found" echo "*** If SDL was installed in PREFIX, make sure PREFIX/bin is in" echo "*** your path, or set the SDL_CONFIG environment variable to the" echo "*** full path to sdl-config." else if test -f conf.sdltest ; then : else echo "*** Could not run SDL test program, checking why..." CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include "SDL.h" int main(int argc, char *argv[]) { return 0; } #undef main #define main K_and_R_C_main int main () { return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then echo "*** The test program compiled, but did not run. This usually means" echo "*** that the run-time linker is not finding SDL or finding the wrong" echo "*** version of SDL. If it is not finding SDL, you'll need to set your" echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point" echo "*** to the installed location Also, make sure you have run ldconfig if that" echo "*** is required on your system" echo "***" echo "*** If you have an old version installed, it is best to remove it, although" echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 echo "*** The test program failed to compile or link. See the file config.log for the" echo "*** exact error that occured. This usually means SDL was incorrectly installed" echo "*** or that you have moved SDL since it was installed. In the latter case, you" echo "*** may want to edit the sdl-config script: $SDL_CONFIG" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext CFLAGS="$ac_save_CFLAGS" CXXFLAGS="$ac_save_CXXFLAGS" LIBS="$ac_save_LIBS" fi fi SDL_CFLAGS="" SDL_LIBS="" { { echo "$as_me:$LINENO: error: *** SDL version $SDL_VERSION not found!" >&5 echo "$as_me: error: *** SDL version $SDL_VERSION not found!" >&2;} { (exit 1); exit 1; }; } fi rm -f conf.sdltest CFLAGS="$CFLAGS $SDL_CFLAGS" CXXFLAGS="$CXXFLAGS $SDL_CFLAGS" CPPFLAGS="$CPPFLAGS $SDL_CFLAGS" LIBS="$LIBS $SDL_LIBS" ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; } # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= fi if test -z "$CPP"; then if test "${ac_cv_prog_CPP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Double quotes because CPP needs to be expanded for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" do ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then break fi done ac_cv_prog_CPP=$CPP fi CPP=$ac_cv_prog_CPP else ac_cv_prog_CPP=$CPP fi { echo "$as_me:$LINENO: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6; } ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes do # Use a header file that comes with gcc, so configuring glibc # with a fresh cross-compiler works. # Prefer to if __STDC__ is defined, since # exists even on freestanding compilers. # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #ifdef __STDC__ # include #else # include #endif Syntax error _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then : else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Broken: fails on valid input. continue fi rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether nonexistent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then # Broken: success on invalid input. continue else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 # Passes both tests. ac_preproc_ok=: break fi rm -f conftest.err conftest.$ac_ext done # Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check See \`config.log' for more details." >&2;} { (exit 1); exit 1; }; } fi ac_ext=c ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu { echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5 echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; } if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else # Extract the first word of "grep ggrep" to use in msg output if test -z "$GREP"; then set dummy grep ggrep; ac_prog_name=$2 if test "${ac_cv_path_GREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_GREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in grep ggrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue # Check for GNU ac_path_GREP and select it if it is found. # Check for GNU $ac_path_GREP case `"$ac_path_GREP" --version 2>&1` in *GNU*) ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'GREP' >> "conftest.nl" "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_GREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_GREP_found && break 3 done done done IFS=$as_save_IFS fi GREP="$ac_cv_path_GREP" if test -z "$GREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_GREP=$GREP fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5 echo "${ECHO_T}$ac_cv_path_GREP" >&6; } GREP="$ac_cv_path_GREP" { echo "$as_me:$LINENO: checking for egrep" >&5 echo $ECHO_N "checking for egrep... $ECHO_C" >&6; } if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 then ac_cv_path_EGREP="$GREP -E" else # Extract the first word of "egrep" to use in msg output if test -z "$EGREP"; then set dummy egrep; ac_prog_name=$2 if test "${ac_cv_path_EGREP+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_path_EGREP_found=false # Loop through the user's path and test for each of PROGNAME-LIST as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. for ac_prog in egrep; do for ac_exec_ext in '' $ac_executable_extensions; do ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue # Check for GNU ac_path_EGREP and select it if it is found. # Check for GNU $ac_path_EGREP case `"$ac_path_EGREP" --version 2>&1` in *GNU*) ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; *) ac_count=0 echo $ECHO_N "0123456789$ECHO_C" >"conftest.in" while : do cat "conftest.in" "conftest.in" >"conftest.tmp" mv "conftest.tmp" "conftest.in" cp "conftest.in" "conftest.nl" echo 'EGREP' >> "conftest.nl" "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break ac_count=`expr $ac_count + 1` if test $ac_count -gt ${ac_path_EGREP_max-0}; then # Best one so far, save it but keep looking for a better one ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_max=$ac_count fi # 10*(2^10) chars as input seems more than enough test $ac_count -gt 10 && break done rm -f conftest.in conftest.tmp conftest.nl conftest.out;; esac $ac_path_EGREP_found && break 3 done done done IFS=$as_save_IFS fi EGREP="$ac_cv_path_EGREP" if test -z "$EGREP"; then { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5 echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;} { (exit 1); exit 1; }; } fi else ac_cv_path_EGREP=$EGREP fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5 echo "${ECHO_T}$ac_cv_path_EGREP" >&6; } EGREP="$ac_cv_path_EGREP" { echo "$as_me:$LINENO: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; } if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #include #include int main () { ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_header_stdc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_header_stdc=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "memchr" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | $EGREP "free" >/dev/null 2>&1; then : else ac_cv_header_stdc=no fi rm -f conftest* fi if test $ac_cv_header_stdc = yes; then # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. if test "$cross_compiling" = yes; then : else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include #if ((' ' & 0x0FF) == 0x020) # define ISLOWER(c) ('a' <= (c) && (c) <= 'z') # define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) #else # define ISLOWER(c) \ (('a' <= (c) && (c) <= 'i') \ || ('j' <= (c) && (c) <= 'r') \ || ('s' <= (c) && (c) <= 'z')) # define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) #endif #define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) int main () { int i; for (i = 0; i < 256; i++) if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) return 2; return 0; } _ACEOF rm -f conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' { (case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_try") 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else echo "$as_me: program exited with status $ac_status" >&5 echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ( exit $ac_status ) ac_cv_header_stdc=no fi rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi { echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6; } if test $ac_cv_header_stdc = yes; then cat >>confdefs.h <<\_ACEOF #define STDC_HEADERS 1 _ACEOF fi # On IRIX 5.3, sys/types and inttypes.h are conflicting. for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ inttypes.h stdint.h unistd.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include <$ac_header> _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for TTF_OpenFont in -lSDL_ttf" >&5 echo $ECHO_N "checking for TTF_OpenFont in -lSDL_ttf... $ECHO_C" >&6; } if test "${ac_cv_lib_SDL_ttf_TTF_OpenFont+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_ttf $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char TTF_OpenFont (); int main () { return TTF_OpenFont (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_SDL_ttf_TTF_OpenFont=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_SDL_ttf_TTF_OpenFont=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_ttf_TTF_OpenFont" >&5 echo "${ECHO_T}$ac_cv_lib_SDL_ttf_TTF_OpenFont" >&6; } if test $ac_cv_lib_SDL_ttf_TTF_OpenFont = yes; then if test "${ac_cv_header_SDL_ttf_h+set}" = set; then { echo "$as_me:$LINENO: checking for SDL_ttf.h" >&5 echo $ECHO_N "checking for SDL_ttf.h... $ECHO_C" >&6; } if test "${ac_cv_header_SDL_ttf_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_SDL_ttf_h" >&5 echo "${ECHO_T}$ac_cv_header_SDL_ttf_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking SDL_ttf.h usability" >&5 echo $ECHO_N "checking SDL_ttf.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking SDL_ttf.h presence" >&5 echo $ECHO_N "checking SDL_ttf.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: SDL_ttf.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: SDL_ttf.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_ttf.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: SDL_ttf.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: SDL_ttf.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: SDL_ttf.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_ttf.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: SDL_ttf.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_ttf.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: SDL_ttf.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_ttf.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: SDL_ttf.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_ttf.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: SDL_ttf.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_ttf.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: SDL_ttf.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to jensgr@gmx.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for SDL_ttf.h" >&5 echo $ECHO_N "checking for SDL_ttf.h... $ECHO_C" >&6; } if test "${ac_cv_header_SDL_ttf_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_SDL_ttf_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_SDL_ttf_h" >&5 echo "${ECHO_T}$ac_cv_header_SDL_ttf_h" >&6; } fi if test $ac_cv_header_SDL_ttf_h = yes; then CF_LIBS="-lSDL_ttf" else { { echo "$as_me:$LINENO: error: *** SDL_ttf.h not found!" >&5 echo "$as_me: error: *** SDL_ttf.h not found!" >&2;} { (exit 1); exit 1; }; } fi else { { echo "$as_me:$LINENO: error: *** SDL_ttf not found!" >&5 echo "$as_me: error: *** SDL_ttf not found!" >&2;} { (exit 1); exit 1; }; } fi if test x$enable_sound = xyes; then { echo "$as_me:$LINENO: checking for Mix_OpenAudio in -lSDL_mixer" >&5 echo $ECHO_N "checking for Mix_OpenAudio in -lSDL_mixer... $ECHO_C" >&6; } if test "${ac_cv_lib_SDL_mixer_Mix_OpenAudio+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_mixer $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char Mix_OpenAudio (); int main () { return Mix_OpenAudio (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_SDL_mixer_Mix_OpenAudio=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_SDL_mixer_Mix_OpenAudio=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_mixer_Mix_OpenAudio" >&5 echo "${ECHO_T}$ac_cv_lib_SDL_mixer_Mix_OpenAudio" >&6; } if test $ac_cv_lib_SDL_mixer_Mix_OpenAudio = yes; then if test "${ac_cv_header_SDL_mixer_h+set}" = set; then { echo "$as_me:$LINENO: checking for SDL_mixer.h" >&5 echo $ECHO_N "checking for SDL_mixer.h... $ECHO_C" >&6; } if test "${ac_cv_header_SDL_mixer_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_SDL_mixer_h" >&5 echo "${ECHO_T}$ac_cv_header_SDL_mixer_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking SDL_mixer.h usability" >&5 echo $ECHO_N "checking SDL_mixer.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking SDL_mixer.h presence" >&5 echo $ECHO_N "checking SDL_mixer.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: SDL_mixer.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: SDL_mixer.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_mixer.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: SDL_mixer.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: SDL_mixer.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: SDL_mixer.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_mixer.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: SDL_mixer.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_mixer.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: SDL_mixer.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_mixer.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: SDL_mixer.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_mixer.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: SDL_mixer.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_mixer.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: SDL_mixer.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to jensgr@gmx.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for SDL_mixer.h" >&5 echo $ECHO_N "checking for SDL_mixer.h... $ECHO_C" >&6; } if test "${ac_cv_header_SDL_mixer_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_SDL_mixer_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_SDL_mixer_h" >&5 echo "${ECHO_T}$ac_cv_header_SDL_mixer_h" >&6; } fi if test $ac_cv_header_SDL_mixer_h = yes; then CF_LIBS="$CF_LIBS -lSDL_mixer" else { echo "$as_me:$LINENO: WARNING: *** SDL_mixer.h not found - disabling audio support!" >&5 echo "$as_me: WARNING: *** SDL_mixer.h not found - disabling audio support!" >&2;} enable_sound=no fi else { echo "$as_me:$LINENO: WARNING: *** SDL_mixer not found - disabling audio support!" >&5 echo "$as_me: WARNING: *** SDL_mixer not found - disabling audio support!" >&2;} enable_sound=no fi fi if test x$enable_sound != xyes; then cat >>confdefs.h <<\_ACEOF #define DISABLE_SOUND 1 _ACEOF fi if test x$enable_network = xyes; then { echo "$as_me:$LINENO: checking for SDLNet_Init in -lSDL_net" >&5 echo $ECHO_N "checking for SDLNet_Init in -lSDL_net... $ECHO_C" >&6; } if test "${ac_cv_lib_SDL_net_SDLNet_Init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lSDL_net $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char SDLNet_Init (); int main () { return SDLNet_Init (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_SDL_net_SDLNet_Init=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_SDL_net_SDLNet_Init=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_SDL_net_SDLNet_Init" >&5 echo "${ECHO_T}$ac_cv_lib_SDL_net_SDLNet_Init" >&6; } if test $ac_cv_lib_SDL_net_SDLNet_Init = yes; then if test "${ac_cv_header_SDL_net_h+set}" = set; then { echo "$as_me:$LINENO: checking for SDL_net.h" >&5 echo $ECHO_N "checking for SDL_net.h... $ECHO_C" >&6; } if test "${ac_cv_header_SDL_net_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_SDL_net_h" >&5 echo "${ECHO_T}$ac_cv_header_SDL_net_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking SDL_net.h usability" >&5 echo $ECHO_N "checking SDL_net.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking SDL_net.h presence" >&5 echo $ECHO_N "checking SDL_net.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: SDL_net.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: SDL_net.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_net.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: SDL_net.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: SDL_net.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: SDL_net.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_net.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: SDL_net.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_net.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: SDL_net.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_net.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: SDL_net.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_net.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: SDL_net.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: SDL_net.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: SDL_net.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to jensgr@gmx.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for SDL_net.h" >&5 echo $ECHO_N "checking for SDL_net.h... $ECHO_C" >&6; } if test "${ac_cv_header_SDL_net_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_SDL_net_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_SDL_net_h" >&5 echo "${ECHO_T}$ac_cv_header_SDL_net_h" >&6; } fi if test $ac_cv_header_SDL_net_h = yes; then CF_LIBS="$CF_LIBS -lSDL_net" else { echo "$as_me:$LINENO: WARNING: *** SDL_net.h not found - disabling network support!" >&5 echo "$as_me: WARNING: *** SDL_net.h not found - disabling network support!" >&2;} enable_network=no fi else { echo "$as_me:$LINENO: WARNING: *** SDL_net not found - disabling network support!" >&5 echo "$as_me: WARNING: *** SDL_net not found - disabling network support!" >&2;} enable_network=no fi fi if test x$enable_network != xyes; then cat >>confdefs.h <<\_ACEOF #define DISABLE_NETWORK 1 _ACEOF fi if test x$use_zlib = xyes; then ac_save_cppflags="$CPPFLAGS" ac_save_ldflags="$LDFLAGS" if test -n "$ZLIB_HOME"; then CPPFLAGS="-I${ZLIB_HOME}/include $CPPFLAGS" LDFLAGS="-L${ZLIB_HOME}/lib $LDFLAGS" fi { echo "$as_me:$LINENO: checking for compress in -lz" >&5 echo $ECHO_N "checking for compress in -lz... $ECHO_C" >&6; } if test "${ac_cv_lib_z_compress+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS LIBS="-lz $LIBS" cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char compress (); int main () { return compress (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_lib_z_compress=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_lib_z_compress=no fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_lib_z_compress" >&5 echo "${ECHO_T}$ac_cv_lib_z_compress" >&6; } if test $ac_cv_lib_z_compress = yes; then if test "${ac_cv_header_zlib_h+set}" = set; then { echo "$as_me:$LINENO: checking for zlib.h" >&5 echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; } if test "${ac_cv_header_zlib_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 fi { echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; } else # Is the header compilable? { echo "$as_me:$LINENO: checking zlib.h usability" >&5 echo $ECHO_N "checking zlib.h usability... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ $ac_includes_default #include _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_header_compiler=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_compiler=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 echo "${ECHO_T}$ac_header_compiler" >&6; } # Is the header present? { echo "$as_me:$LINENO: checking zlib.h presence" >&5 echo $ECHO_N "checking zlib.h presence... $ECHO_C" >&6; } cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include _ACEOF if { (ac_try="$ac_cpp conftest.$ac_ext" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null && { test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || test ! -s conftest.err }; then ac_header_preproc=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_header_preproc=no fi rm -f conftest.err conftest.$ac_ext { echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 echo "${ECHO_T}$ac_header_preproc" >&6; } # So? What about this header? case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in yes:no: ) { echo "$as_me:$LINENO: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&5 echo "$as_me: WARNING: zlib.h: accepted by the compiler, rejected by the preprocessor!" >&2;} { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the compiler's result" >&5 echo "$as_me: WARNING: zlib.h: proceeding with the compiler's result" >&2;} ac_header_preproc=yes ;; no:yes:* ) { echo "$as_me:$LINENO: WARNING: zlib.h: present but cannot be compiled" >&5 echo "$as_me: WARNING: zlib.h: present but cannot be compiled" >&2;} { echo "$as_me:$LINENO: WARNING: zlib.h: check for missing prerequisite headers?" >&5 echo "$as_me: WARNING: zlib.h: check for missing prerequisite headers?" >&2;} { echo "$as_me:$LINENO: WARNING: zlib.h: see the Autoconf documentation" >&5 echo "$as_me: WARNING: zlib.h: see the Autoconf documentation" >&2;} { echo "$as_me:$LINENO: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&5 echo "$as_me: WARNING: zlib.h: section \"Present But Cannot Be Compiled\"" >&2;} { echo "$as_me:$LINENO: WARNING: zlib.h: proceeding with the preprocessor's result" >&5 echo "$as_me: WARNING: zlib.h: proceeding with the preprocessor's result" >&2;} { echo "$as_me:$LINENO: WARNING: zlib.h: in the future, the compiler will take precedence" >&5 echo "$as_me: WARNING: zlib.h: in the future, the compiler will take precedence" >&2;} ( cat <<\_ASBOX ## ----------------------------- ## ## Report this to jensgr@gmx.net ## ## ----------------------------- ## _ASBOX ) | sed "s/^/$as_me: WARNING: /" >&2 ;; esac { echo "$as_me:$LINENO: checking for zlib.h" >&5 echo $ECHO_N "checking for zlib.h... $ECHO_C" >&6; } if test "${ac_cv_header_zlib_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_cv_header_zlib_h=$ac_header_preproc fi { echo "$as_me:$LINENO: result: $ac_cv_header_zlib_h" >&5 echo "${ECHO_T}$ac_cv_header_zlib_h" >&6; } fi if test $ac_cv_header_zlib_h = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_LIBZ 1 _ACEOF LIBS="-lz $LIBS" fi fi if test "x$ac_cv_header_zlib_h" = xno; then CPPFLAGS="$ac_save_cppflags" LDFLAGS="$ac_save_ldflags" fi fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_hdr that defines DIR" >&5 echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6; } if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ #include #include <$ac_hdr> int main () { if ((DIR *) 0) return 0; ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then eval "$as_ac_Header=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_Header=no" fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_Header'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_hdr" | $as_tr_cpp` 1 _ACEOF ac_header_dirent=$ac_hdr; break fi done # Two versions of opendir et al. are in -ldir and -lx on SCO Xenix. if test $ac_header_dirent = dirent.h; then { echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' dir; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_search_opendir=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi else { echo "$as_me:$LINENO: checking for library containing opendir" >&5 echo $ECHO_N "checking for library containing opendir... $ECHO_C" >&6; } if test "${ac_cv_search_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_func_search_save_LIBS=$LIBS cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char opendir (); int main () { return opendir (); ; return 0; } _ACEOF for ac_lib in '' x; do if test -z "$ac_lib"; then ac_res="none required" else ac_res=-l$ac_lib LIBS="-l$ac_lib $ac_func_search_save_LIBS" fi rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then ac_cv_search_opendir=$ac_res else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext if test "${ac_cv_search_opendir+set}" = set; then break fi done if test "${ac_cv_search_opendir+set}" = set; then : else ac_cv_search_opendir=no fi rm conftest.$ac_ext LIBS=$ac_func_search_save_LIBS fi { echo "$as_me:$LINENO: result: $ac_cv_search_opendir" >&5 echo "${ECHO_T}$ac_cv_search_opendir" >&6; } ac_res=$ac_cv_search_opendir if test "$ac_res" != no; then test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" fi fi for ac_func in strcasecmp strncasecmp do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` { echo "$as_me:$LINENO: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; } if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ /* Define $ac_func to an innocuous variant, in case declares $ac_func. For example, HP-UX 11i declares gettimeofday. */ #define $ac_func innocuous_$ac_func /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. Prefer to if __STDC__ is defined, since exists even on freestanding compilers. */ #ifdef __STDC__ # include #else # include #endif #undef $ac_func /* Override any GCC internal prototype to avoid an error. Use char because int might match the return type of a GCC builtin and then its argument prototype would still apply. */ #ifdef __cplusplus extern "C" #endif char $ac_func (); /* The GNU C library defines this for functions which it implements to always fail with ENOSYS. Some functions are actually named something starting with __ and the normal name is an alias. */ #if defined __stub_$ac_func || defined __stub___$ac_func choke me #endif int main () { return $ac_func (); ; return 0; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext if { (ac_try="$ac_link" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_link") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest$ac_exeext && $as_test_x conftest$ac_exeext; then eval "$as_ac_var=yes" else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 eval "$as_ac_var=no" fi rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ conftest$ac_exeext conftest.$ac_ext fi ac_res=`eval echo '${'$as_ac_var'}'` { echo "$as_me:$LINENO: result: $ac_res" >&5 echo "${ECHO_T}$ac_res" >&6; } if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <<_ACEOF #define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 _ACEOF fi done { echo "$as_me:$LINENO: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6; } if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF /* confdefs.h. */ _ACEOF cat confdefs.h >>conftest.$ac_ext cat >>conftest.$ac_ext <<_ACEOF /* end confdefs.h. */ int main () { /* FIXME: Include the comments suggested by Paul. */ #ifndef __cplusplus /* Ultrix mips cc rejects this. */ typedef int charset[2]; const charset cs; /* SunOS 4.1.1 cc rejects this. */ char const *const *pcpcc; char **ppc; /* NEC SVR4.0.2 mips cc rejects this. */ struct point {int x, y;}; static struct point const zero = {0,0}; /* AIX XL C 1.02.0.0 rejects this. It does not let you subtract one const X* pointer from another in an arm of an if-expression whose if-part is not a constant expression */ const char *g = "string"; pcpcc = &g + (g ? g-g : 0); /* HPUX 7.0 cc rejects these. */ ++pcpcc; ppc = (char**) pcpcc; pcpcc = (char const *const *) ppc; { /* SCO 3.2v4 cc rejects this. */ char *t; char const *s = 0 ? (char *) 0 : (char const *) 0; *t++ = 0; if (s) return 0; } { /* Someone thinks the Sun supposedly-ANSI compiler will reject this. */ int x[] = {25, 17}; const int *foo = &x[0]; ++foo; } { /* Sun SC1.0 ANSI compiler rejects this -- but not the above. */ typedef const int *iptr; iptr p = 0; ++p; } { /* AIX XL C 1.02.0.0 rejects this saying "k.c", line 2.27: 1506-025 (S) Operand must be a modifiable lvalue. */ struct s { int j; const int *ap[3]; }; struct s *b; b->j = 5; } { /* ULTRIX-32 V3.1 (Rev 9) vcc rejects this */ const int foo = 10; if (!foo) return 0; } return !cs[0] && !zero.x; #endif ; return 0; } _ACEOF rm -f conftest.$ac_objext if { (ac_try="$ac_compile" case "(($ac_try" in *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; *) ac_try_echo=$ac_try;; esac eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 (eval "$ac_compile") 2>conftest.er1 ac_status=$? grep -v '^ *+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); } && { test -z "$ac_c_werror_flag" || test ! -s conftest.err } && test -s conftest.$ac_objext; then ac_cv_c_const=yes else echo "$as_me: failed program was:" >&5 sed 's/^/| /' conftest.$ac_ext >&5 ac_cv_c_const=no fi rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi { echo "$as_me:$LINENO: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6; } if test $ac_cv_c_const = no; then cat >>confdefs.h <<\_ACEOF #define const _ACEOF fi ac_config_files="$ac_config_files doc/Makefile gfx/Makefile levels/Makefile locale/Makefile music/Makefile sfx/Makefile src/Makefile src/cf/Makefile src/comet/Makefile tools/Makefile Makefile crimson.spec" cat >confcache <<\_ACEOF # This file is a shell script that caches the results of configure # tests run on this system so they can be shared between configure # scripts and configure runs, see configure's option --config-cache. # It is not useful on other systems. If it contains results you don't # want to keep, you may remove or edit it. # # config.status only pays attention to the cache file if you give it # the --recheck option to rerun configure. # # `ac_cv_env_foo' variables (set or unset) will be overridden when # loading this file, other *unset* `ac_cv_foo' will be assigned the # following values. _ACEOF # The following way of writing the cache mishandles newlines in values, # but we know of no workaround that is simple, portable, and efficient. # So, we kill variables containing newlines. # Ultrix sh set writes to stderr and can't be redirected directly, # and sets the high bit in the cache file unless we assign to the vars. ( for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do eval ac_val=\$$ac_var case $ac_val in #( *${as_nl}*) case $ac_var in #( *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5 echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;; esac case $ac_var in #( _ | IFS | as_nl) ;; #( *) $as_unset $ac_var ;; esac ;; esac done (set) 2>&1 | case $as_nl`(ac_space=' '; set) 2>&1` in #( *${as_nl}ac_space=\ *) # `set' does not quote correctly, so add quotes (double-quote # substitution turns \\\\ into \\, and sed turns \\ into \). sed -n \ "s/'/'\\\\''/g; s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" ;; #( *) # `set' quotes correctly as required by POSIX, so do not add quotes. sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" ;; esac | sort ) | sed ' /^ac_cv_env_/b end t clear :clear s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ t end s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ :end' >>confcache if diff "$cache_file" confcache >/dev/null 2>&1; then :; else if test -w "$cache_file"; then test "x$cache_file" != "x/dev/null" && { echo "$as_me:$LINENO: updating cache $cache_file" >&5 echo "$as_me: updating cache $cache_file" >&6;} cat confcache >$cache_file else { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5 echo "$as_me: not updating unwritable cache $cache_file" >&6;} fi fi rm -f confcache test "x$prefix" = xNONE && prefix=$ac_default_prefix # Let make expand exec_prefix. test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' # Transform confdefs.h into DEFS. # Protect against shell expansion while executing Makefile rules. # Protect against Makefile macro expansion. # # If the first sed substitution is executed (which looks for macros that # take arguments), then branch to the quote section. Otherwise, # look for a macro that doesn't take arguments. ac_script=' t clear :clear s/^[ ]*#[ ]*define[ ][ ]*\([^ (][^ (]*([^)]*)\)[ ]*\(.*\)/-D\1=\2/g t quote s/^[ ]*#[ ]*define[ ][ ]*\([^ ][^ ]*\)[ ]*\(.*\)/-D\1=\2/g t quote b any :quote s/[ `~#$^&*(){}\\|;'\''"<>?]/\\&/g s/\[/\\&/g s/\]/\\&/g s/\$/$$/g H :any ${ g s/^\n// s/\n/ /g p } ' DEFS=`sed -n "$ac_script" confdefs.h` ac_libobjs= ac_ltlibobjs= for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue # 1. Remove the extension, and $U if already installed. ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' ac_i=`echo "$ac_i" | sed "$ac_script"` # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR # will be set to the directory where LIBOBJS objects are built. ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext" ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo' done LIBOBJS=$ac_libobjs LTLIBOBJS=$ac_ltlibobjs if test -z "${BUILD_CFED_TRUE}" && test -z "${BUILD_CFED_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"BUILD_CFED\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"BUILD_CFED\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${BUILD_COMET_TRUE}" && test -z "${BUILD_COMET_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"BUILD_COMET\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"BUILD_COMET\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${BUILD_BI2CF_TRUE}" && test -z "${BUILD_BI2CF_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"BUILD_BI2CF\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"BUILD_BI2CF\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${BUILD_CF2BMP_TRUE}" && test -z "${BUILD_CF2BMP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"BUILD_CF2BMP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"BUILD_CF2BMP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"AMDEP\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCC\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&5 echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined. Usually this means the macro was only invoked conditionally." >&2;} { (exit 1); exit 1; }; } fi : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" { echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL # Generated by $as_me. # Run this file to recreate the current configuration. # Compiler output produced by configure, useful for debugging # configure, is in config.log if it exists. debug=false ac_cs_recheck=false ac_cs_silent=false SHELL=\${CONFIG_SHELL-$SHELL} _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ## --------------------- ## ## M4sh Initialization. ## ## --------------------- ## # Be more Bourne compatible DUALCASE=1; export DUALCASE # for MKS sh if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then emulate sh NULLCMD=: # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which # is contrary to our usage. Disable this feature. alias -g '${1+"$@"}'='"$@"' setopt NO_GLOB_SUBST else case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac fi # PATH needs CR # Avoid depending upon Character Ranges. as_cr_letters='abcdefghijklmnopqrstuvwxyz' as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' as_cr_Letters=$as_cr_letters$as_cr_LETTERS as_cr_digits='0123456789' as_cr_alnum=$as_cr_Letters$as_cr_digits # The user is always right. if test "${PATH_SEPARATOR+set}" != set; then echo "#! /bin/sh" >conf$$.sh echo "exit 0" >>conf$$.sh chmod +x conf$$.sh if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then PATH_SEPARATOR=';' else PATH_SEPARATOR=: fi rm -f conf$$.sh fi # Support unset when possible. if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then as_unset=unset else as_unset=false fi # IFS # We need space, tab and new line, in precisely that order. Quoting is # there to prevent editors from complaining about space-tab. # (If _AS_PATH_WALK were called with IFS unset, it would disable word # splitting by setting IFS to empty value.) as_nl=' ' IFS=" "" $as_nl" # Find who we are. Look in the path if we contain no directory separator. case $0 in *[\\/]* ) as_myself=$0 ;; *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR for as_dir in $PATH do IFS=$as_save_IFS test -z "$as_dir" && as_dir=. test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break done IFS=$as_save_IFS ;; esac # We did not find ourselves, most probably we were run as `sh COMMAND' # in which case we are not to be found in the path. if test "x$as_myself" = x; then as_myself=$0 fi if test ! -f "$as_myself"; then echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 { (exit 1); exit 1; } fi # Work around bugs in pre-3.0 UWIN ksh. for as_var in ENV MAIL MAILPATH do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var done PS1='$ ' PS2='> ' PS4='+ ' # NLS nuisances. for as_var in \ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \ LC_TELEPHONE LC_TIME do if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then eval $as_var=C; export $as_var else ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var fi done # Required to use basename. if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then as_basename=basename else as_basename=false fi # Name of the executable. as_me=`$as_basename -- "$0" || $as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ X"$0" : 'X\(//\)$' \| \ X"$0" : 'X\(/\)' \| . 2>/dev/null || echo X/"$0" | sed '/^.*\/\([^/][^/]*\)\/*$/{ s//\1/ q } /^X\/\(\/\/\)$/{ s//\1/ q } /^X\/\(\/\).*/{ s//\1/ q } s/.*/./; q'` # CDPATH. $as_unset CDPATH as_lineno_1=$LINENO as_lineno_2=$LINENO test "x$as_lineno_1" != "x$as_lineno_2" && test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || { # Create $as_me.lineno as a copy of $as_myself, but with $LINENO # uniformly replaced by the line number. The first 'sed' inserts a # line-number line after each line using $LINENO; the second 'sed' # does the real work. The second script uses 'N' to pair each # line-number line with the line containing $LINENO, and appends # trailing '-' during substitution so that $LINENO is not a special # case at line end. # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the # scripts with optimization help from Paolo Bonzini. Blame Lee # E. McMahon (1931-1989) for sed's syntax. :-) sed -n ' p /[$]LINENO/= ' <$as_myself | sed ' s/[$]LINENO.*/&-/ t lineno b :lineno N :loop s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ t loop s/-\n.*// ' >$as_me.lineno && chmod +x "$as_me.lineno" || { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2 { (exit 1); exit 1; }; } # Don't try to exec as it changes $[0], causing all sort of problems # (the dirname of $[0] is not the place where we might find the # original and so on. Autoconf is especially sensitive to this). . "./$as_me.lineno" # Exit status is that of the last command. exit } if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then as_dirname=dirname else as_dirname=false fi ECHO_C= ECHO_N= ECHO_T= case `echo -n x` in -n*) case `echo 'x\c'` in *c*) ECHO_T=' ';; # ECHO_T is single tab character. *) ECHO_C='\c';; esac;; *) ECHO_N='-n';; esac if expr a : '\(a\)' >/dev/null 2>&1 && test "X`expr 00001 : '.*\(...\)'`" = X001; then as_expr=expr else as_expr=false fi rm -f conf$$ conf$$.exe conf$$.file if test -d conf$$.dir; then rm -f conf$$.dir/conf$$.file else rm -f conf$$.dir mkdir conf$$.dir fi echo >conf$$.file if ln -s conf$$.file conf$$ 2>/dev/null; then as_ln_s='ln -s' # ... but there are two gotchas: # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. # In both cases, we have to default to `cp -p'. ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || as_ln_s='cp -p' elif ln conf$$.file conf$$ 2>/dev/null; then as_ln_s=ln else as_ln_s='cp -p' fi rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file rmdir conf$$.dir 2>/dev/null if mkdir -p . 2>/dev/null; then as_mkdir_p=: else test -d ./-p && rmdir ./-p as_mkdir_p=false fi if test -x / >/dev/null 2>&1; then as_test_x='test -x' else if ls -dL / >/dev/null 2>&1; then as_ls_L_option=L else as_ls_L_option= fi as_test_x=' eval sh -c '\'' if test -d "$1"; then test -d "$1/."; else case $1 in -*)set "./$1";; esac; case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in ???[sx]*):;;*)false;;esac;fi '\'' sh ' fi as_executable_p=$as_test_x # Sed expression to map a string onto a valid CPP name. as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" # Sed expression to map a string onto a valid variable name. as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" exec 6>&1 # Save the log message, to keep $[0] and so on meaningful, and to # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" This file was extended by Crimson Fields $as_me 0.5.2, which was generated by GNU Autoconf 2.61. Invocation command line was CONFIG_FILES = $CONFIG_FILES CONFIG_HEADERS = $CONFIG_HEADERS CONFIG_LINKS = $CONFIG_LINKS CONFIG_COMMANDS = $CONFIG_COMMANDS $ $0 $@ on `(hostname || uname -n) 2>/dev/null | sed 1q` " _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # Files that config.status was made for. config_files="$ac_config_files" config_commands="$ac_config_commands" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF ac_cs_usage="\ \`$as_me' instantiates files from templates according to the current configuration. Usage: $0 [OPTIONS] [FILE]... -h, --help print this help, then exit -V, --version print version number and configuration settings, then exit -q, --quiet do not print progress messages -d, --debug don't remove temporary files --recheck update $as_me by reconfiguring in the same conditions --file=FILE[:TEMPLATE] instantiate the configuration file FILE Configuration files: $config_files Configuration commands: $config_commands Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ Crimson Fields config.status 0.5.2 configured by $0, generated by GNU Autoconf 2.61, with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" Copyright (C) 2006 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." ac_pwd='$ac_pwd' srcdir='$srcdir' INSTALL='$INSTALL' MKDIR_P='$MKDIR_P' _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If no file are specified by the user, then we need to provide default # value. By we need to know if files were specified by the user. ac_need_defaults=: while test $# != 0 do case $1 in --*=*) ac_option=`expr "X$1" : 'X\([^=]*\)='` ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` ac_shift=: ;; *) ac_option=$1 ac_optarg=$2 ac_shift=shift ;; esac case $ac_option in # Handling of the options. -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) ac_cs_recheck=: ;; --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) echo "$ac_cs_version"; exit ;; --debug | --debu | --deb | --de | --d | -d ) debug=: ;; --file | --fil | --fi | --f ) $ac_shift CONFIG_FILES="$CONFIG_FILES $ac_optarg" ac_need_defaults=false;; --he | --h | --help | --hel | -h ) echo "$ac_cs_usage"; exit ;; -q | -quiet | --quiet | --quie | --qui | --qu | --q \ | -silent | --silent | --silen | --sile | --sil | --si | --s) ac_cs_silent=: ;; # This is an error. -*) { echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2 { (exit 1); exit 1; }; } ;; *) ac_config_targets="$ac_config_targets $1" ac_need_defaults=false ;; esac shift done ac_configure_extra_args= if $ac_cs_silent; then exec 6>/dev/null ac_configure_extra_args="$ac_configure_extra_args --silent" fi _ACEOF cat >>$CONFIG_STATUS <<_ACEOF if \$ac_cs_recheck; then echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6 CONFIG_SHELL=$SHELL export CONFIG_SHELL exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion fi _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF exec 5>>config.log { echo sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX ## Running $as_me. ## _ASBOX echo "$ac_log" } >&5 _ACEOF cat >>$CONFIG_STATUS <<_ACEOF # # INIT-COMMANDS # AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # Handling of arguments. for ac_config_target in $ac_config_targets do case $ac_config_target in "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; "doc/Makefile") CONFIG_FILES="$CONFIG_FILES doc/Makefile" ;; "gfx/Makefile") CONFIG_FILES="$CONFIG_FILES gfx/Makefile" ;; "levels/Makefile") CONFIG_FILES="$CONFIG_FILES levels/Makefile" ;; "locale/Makefile") CONFIG_FILES="$CONFIG_FILES locale/Makefile" ;; "music/Makefile") CONFIG_FILES="$CONFIG_FILES music/Makefile" ;; "sfx/Makefile") CONFIG_FILES="$CONFIG_FILES sfx/Makefile" ;; "src/Makefile") CONFIG_FILES="$CONFIG_FILES src/Makefile" ;; "src/cf/Makefile") CONFIG_FILES="$CONFIG_FILES src/cf/Makefile" ;; "src/comet/Makefile") CONFIG_FILES="$CONFIG_FILES src/comet/Makefile" ;; "tools/Makefile") CONFIG_FILES="$CONFIG_FILES tools/Makefile" ;; "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; "crimson.spec") CONFIG_FILES="$CONFIG_FILES crimson.spec" ;; *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac done # If the user did not use the arguments to specify the items to instantiate, # then the envvar interface is used. Set only those that are not. # We use the long form for the default assignment because of an extremely # bizarre bug on SunOS 4.1.3. if $ac_need_defaults; then test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands fi # Have a temporary directory for convenience. Make it in the build tree # simply because there is no reason against having it here, and in addition, # creating and moving files from /tmp can sometimes cause problems. # Hook for its removal unless debugging. # Note that there is a small window in which the directory will not be cleaned: # after its creation but before its name has been assigned to `$tmp'. $debug || { tmp= trap 'exit_status=$? { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status ' 0 trap '{ (exit 1); exit 1; }' 1 2 13 15 } # Create a (secure) tmp directory for tmp files. { tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" } || { tmp=./conf$$-$RANDOM (umask 077 && mkdir "$tmp") } || { echo "$me: cannot create a temporary directory in ." >&2 { (exit 1); exit 1; } } # # Set up the sed scripts for CONFIG_FILES section. # # No need to generate the scripts if there are no CONFIG_FILES. # This happens for instance when ./config.status config.h if test -n "$CONFIG_FILES"; then _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF SHELL!$SHELL$ac_delim PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim PACKAGE_NAME!$PACKAGE_NAME$ac_delim PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim PACKAGE_STRING!$PACKAGE_STRING$ac_delim PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim exec_prefix!$exec_prefix$ac_delim prefix!$prefix$ac_delim program_transform_name!$program_transform_name$ac_delim bindir!$bindir$ac_delim sbindir!$sbindir$ac_delim libexecdir!$libexecdir$ac_delim datarootdir!$datarootdir$ac_delim datadir!$datadir$ac_delim sysconfdir!$sysconfdir$ac_delim sharedstatedir!$sharedstatedir$ac_delim localstatedir!$localstatedir$ac_delim includedir!$includedir$ac_delim oldincludedir!$oldincludedir$ac_delim docdir!$docdir$ac_delim infodir!$infodir$ac_delim htmldir!$htmldir$ac_delim dvidir!$dvidir$ac_delim pdfdir!$pdfdir$ac_delim psdir!$psdir$ac_delim libdir!$libdir$ac_delim localedir!$localedir$ac_delim mandir!$mandir$ac_delim DEFS!$DEFS$ac_delim ECHO_C!$ECHO_C$ac_delim ECHO_N!$ECHO_N$ac_delim ECHO_T!$ECHO_T$ac_delim LIBS!$LIBS$ac_delim build_alias!$build_alias$ac_delim host_alias!$host_alias$ac_delim target_alias!$target_alias$ac_delim INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim INSTALL_DATA!$INSTALL_DATA$ac_delim am__isrc!$am__isrc$ac_delim CYGPATH_W!$CYGPATH_W$ac_delim PACKAGE!$PACKAGE$ac_delim VERSION!$VERSION$ac_delim ACLOCAL!$ACLOCAL$ac_delim AUTOCONF!$AUTOCONF$ac_delim AUTOMAKE!$AUTOMAKE$ac_delim AUTOHEADER!$AUTOHEADER$ac_delim MAKEINFO!$MAKEINFO$ac_delim install_sh!$install_sh$ac_delim STRIP!$STRIP$ac_delim INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim mkdir_p!$mkdir_p$ac_delim AWK!$AWK$ac_delim SET_MAKE!$SET_MAKE$ac_delim am__leading_dot!$am__leading_dot$ac_delim AMTAR!$AMTAR$ac_delim am__tar!$am__tar$ac_delim am__untar!$am__untar$ac_delim BUILD_CFED_TRUE!$BUILD_CFED_TRUE$ac_delim BUILD_CFED_FALSE!$BUILD_CFED_FALSE$ac_delim BUILD_COMET_TRUE!$BUILD_COMET_TRUE$ac_delim BUILD_COMET_FALSE!$BUILD_COMET_FALSE$ac_delim BUILD_BI2CF_TRUE!$BUILD_BI2CF_TRUE$ac_delim BUILD_BI2CF_FALSE!$BUILD_BI2CF_FALSE$ac_delim BUILD_CF2BMP_TRUE!$BUILD_CF2BMP_TRUE$ac_delim BUILD_CF2BMP_FALSE!$BUILD_CF2BMP_FALSE$ac_delim CC!$CC$ac_delim CFLAGS!$CFLAGS$ac_delim LDFLAGS!$LDFLAGS$ac_delim CPPFLAGS!$CPPFLAGS$ac_delim ac_ct_CC!$ac_ct_CC$ac_delim EXEEXT!$EXEEXT$ac_delim OBJEXT!$OBJEXT$ac_delim DEPDIR!$DEPDIR$ac_delim am__include!$am__include$ac_delim am__quote!$am__quote$ac_delim AMDEP_TRUE!$AMDEP_TRUE$ac_delim AMDEP_FALSE!$AMDEP_FALSE$ac_delim AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim CCDEPMODE!$CCDEPMODE$ac_delim am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim CXX!$CXX$ac_delim CXXFLAGS!$CXXFLAGS$ac_delim ac_ct_CXX!$ac_ct_CXX$ac_delim CXXDEPMODE!$CXXDEPMODE$ac_delim am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim XSLTPROC!$XSLTPROC$ac_delim XMLLINT!$XMLLINT$ac_delim SDL_CONFIG!$SDL_CONFIG$ac_delim SDL_CFLAGS!$SDL_CFLAGS$ac_delim SDL_LIBS!$SDL_LIBS$ac_delim CPP!$CPP$ac_delim GREP!$GREP$ac_delim EGREP!$EGREP$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF CEOF$ac_eof _ACEOF ac_delim='%!_!# ' for ac_last_try in false false false false false :; do cat >conf$$subs.sed <<_ACEOF CF_LIBS!$CF_LIBS$ac_delim LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 3; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 echo "$as_me: error: could not make $CONFIG_STATUS" >&2;} { (exit 1); exit 1; }; } else ac_delim="$ac_delim!$ac_delim _$ac_delim!! " fi done ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed` if test -n "$ac_eof"; then ac_eof=`echo "$ac_eof" | sort -nru | sed 1q` ac_eof=`expr $ac_eof + 1` fi cat >>$CONFIG_STATUS <<_ACEOF cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof /@[a-zA-Z_][a-zA-Z_0-9]*@/!b end _ACEOF sed ' s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g s/^/s,@/; s/!/@,|#_!!_#|/ :n t n s/'"$ac_delim"'$/,g/; t s/$/\\/; p N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n ' >>$CONFIG_STATUS >$CONFIG_STATUS <<_ACEOF :end s/|#_!!_#|//g CEOF$ac_eof _ACEOF # VPATH may cause trouble with some makes, so we remove $(srcdir), # ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and # trailing colons and then remove the whole line if VPATH becomes empty # (actually we leave an empty line to preserve line numbers). if test "x$srcdir" = x.; then ac_vpsub='/^[ ]*VPATH[ ]*=/{ s/:*\$(srcdir):*/:/ s/:*\${srcdir}:*/:/ s/:*@srcdir@:*/:/ s/^\([^=]*=[ ]*\):*/\1/ s/:*$// s/^[^=]*=[ ]*$// }' fi cat >>$CONFIG_STATUS <<\_ACEOF fi # test -n "$CONFIG_FILES" for ac_tag in :F $CONFIG_FILES :C $CONFIG_COMMANDS do case $ac_tag in :[FHLC]) ac_mode=$ac_tag; continue;; esac case $ac_mode$ac_tag in :[FHL]*:*);; :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5 echo "$as_me: error: Invalid tag $ac_tag." >&2;} { (exit 1); exit 1; }; };; :[FH]-) ac_tag=-:-;; :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; esac ac_save_IFS=$IFS IFS=: set x $ac_tag IFS=$ac_save_IFS shift ac_file=$1 shift case $ac_mode in :L) ac_source=$1;; :[FH]) ac_file_inputs= for ac_f do case $ac_f in -) ac_f="$tmp/stdin";; *) # Look for the file first in the build tree, then in the source tree # (if the path is not absolute). The absolute path cannot be DOS-style, # because $ac_f cannot contain `:'. test -f "$ac_f" || case $ac_f in [\\/$]*) false;; *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; esac || { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5 echo "$as_me: error: cannot find input file: $ac_f" >&2;} { (exit 1); exit 1; }; };; esac ac_file_inputs="$ac_file_inputs $ac_f" done # Let's still pretend it is `configure' which instantiates (i.e., don't # use $as_me), people would be surprised to read: # /* config.h. Generated by config.status. */ configure_input="Generated from "`IFS=: echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure." if test x"$ac_file" != x-; then configure_input="$ac_file. $configure_input" { echo "$as_me:$LINENO: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} fi case $ac_tag in *:-:* | *:-) cat >"$tmp/stdin";; esac ;; esac ac_dir=`$as_dirname -- "$ac_file" || $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$ac_file" : 'X\(//\)[^/]' \| \ X"$ac_file" : 'X\(//\)$' \| \ X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || echo X"$ac_file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir="$ac_dir" case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } ac_builddir=. case "$ac_dir" in .) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'` # A ".." for each directory in $ac_dir_suffix. ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'` case $ac_top_builddir_sub in "") ac_top_builddir_sub=. ac_top_build_prefix= ;; *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; esac ;; esac ac_abs_top_builddir=$ac_pwd ac_abs_builddir=$ac_pwd$ac_dir_suffix # for backward compatibility: ac_top_builddir=$ac_top_build_prefix case $srcdir in .) # We are building in place. ac_srcdir=. ac_top_srcdir=$ac_top_builddir_sub ac_abs_top_srcdir=$ac_pwd ;; [\\/]* | ?:[\\/]* ) # Absolute name. ac_srcdir=$srcdir$ac_dir_suffix; ac_top_srcdir=$srcdir ac_abs_top_srcdir=$srcdir ;; *) # Relative name. ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix ac_top_srcdir=$ac_top_build_prefix$srcdir ac_abs_top_srcdir=$ac_pwd/$srcdir ;; esac ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix case $ac_mode in :F) # # CONFIG_FILE # case $INSTALL in [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; esac ac_MKDIR_P=$MKDIR_P case $MKDIR_P in [\\/$]* | ?:[\\/]* ) ;; */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; esac _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF # If the template does not know about datarootdir, expand it. # FIXME: This hack should be removed a few years after 2.60. ac_datarootdir_hack=; ac_datarootdir_seen= case `sed -n '/datarootdir/ { p q } /@datadir@/p /@docdir@/p /@infodir@/p /@localedir@/p /@mandir@/p ' $ac_file_inputs` in *datarootdir*) ac_datarootdir_seen=yes;; *@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} _ACEOF cat >>$CONFIG_STATUS <<_ACEOF ac_datarootdir_hack=' s&@datadir@&$datadir&g s&@docdir@&$docdir&g s&@infodir@&$infodir&g s&@localedir@&$localedir&g s&@mandir@&$mandir&g s&\\\${datarootdir}&$datarootdir&g' ;; esac _ACEOF # Neutralize VPATH when `$srcdir' = `.'. # Shell code in configure.ac might set extrasub. # FIXME: do we really want to maintain this feature? cat >>$CONFIG_STATUS <<_ACEOF sed "$ac_vpsub $extrasub _ACEOF cat >>$CONFIG_STATUS <<\_ACEOF :t /@[a-zA-Z_][a-zA-Z_0-9]*@/!b s&@configure_input@&$configure_input&;t t s&@top_builddir@&$ac_top_builddir_sub&;t t s&@srcdir@&$ac_srcdir&;t t s&@abs_srcdir@&$ac_abs_srcdir&;t t s&@top_srcdir@&$ac_top_srcdir&;t t s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t s&@builddir@&$ac_builddir&;t t s&@abs_builddir@&$ac_abs_builddir&;t t s&@abs_top_builddir@&$ac_abs_top_builddir&;t t s&@INSTALL@&$ac_INSTALL&;t t s&@MKDIR_P@&$ac_MKDIR_P&;t t $ac_datarootdir_hack " $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } && { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } && { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&5 echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' which seems to be undefined. Please make sure it is defined." >&2;} rm -f "$tmp/stdin" case $ac_file in -) cat "$tmp/out"; rm -f "$tmp/out";; *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;; esac ;; :C) { echo "$as_me:$LINENO: executing $ac_file commands" >&5 echo "$as_me: executing $ac_file commands" >&6;} ;; esac case $ac_file$ac_mode in "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do # Strip MF so we end up with the name of the file. mf=`echo "$mf" | sed -e 's/:.*$//'` # Check whether this is an Automake generated Makefile or not. # We used to match only the files named `Makefile.in', but # some people rename them; so instead we look at the file content. # Grep'ing the first line is not enough: some people post-process # each Makefile.in and add a new line on top of each file to say so. # Grep'ing the whole file is not good either: AIX grep has a line # limit of 2048, but all sed's we know have understand at least 4000. if sed 10q "$mf" | grep '^#.*generated by automake' > /dev/null 2>&1; then dirpart=`$as_dirname -- "$mf" || $as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$mf" : 'X\(//\)[^/]' \| \ X"$mf" : 'X\(//\)$' \| \ X"$mf" : 'X\(/\)' \| . 2>/dev/null || echo X"$mf" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` else continue fi # Extract the definition of DEPDIR, am__include, and am__quote # from the Makefile without running `make'. DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` test -z "$DEPDIR" && continue am__include=`sed -n 's/^am__include = //p' < "$mf"` test -z "am__include" && continue am__quote=`sed -n 's/^am__quote = //p' < "$mf"` # When using ansi2knr, U may be empty or an underscore; expand it U=`sed -n 's/^U = //p' < "$mf"` # Find all dependency output files, they are included files with # $(DEPDIR) in their names. We invoke sed twice because it is the # simplest approach to changing $(DEPDIR) to its actual value in the # expansion. for file in `sed -n " s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do # Make sure the directory exists. test -f "$dirpart/$file" && continue fdir=`$as_dirname -- "$file" || $as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$file" : 'X\(//\)[^/]' \| \ X"$file" : 'X\(//\)$' \| \ X"$file" : 'X\(/\)' \| . 2>/dev/null || echo X"$file" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` { as_dir=$dirpart/$fdir case $as_dir in #( -*) as_dir=./$as_dir;; esac test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || { as_dirs= while :; do case $as_dir in #( *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #( *) as_qdir=$as_dir;; esac as_dirs="'$as_qdir' $as_dirs" as_dir=`$as_dirname -- "$as_dir" || $as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ X"$as_dir" : 'X\(//\)[^/]' \| \ X"$as_dir" : 'X\(//\)$' \| \ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || echo X"$as_dir" | sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ s//\1/ q } /^X\(\/\/\)[^/].*/{ s//\1/ q } /^X\(\/\/\)$/{ s//\1/ q } /^X\(\/\).*/{ s//\1/ q } s/.*/./; q'` test -d "$as_dir" && break done test -z "$as_dirs" || eval "mkdir $as_dirs" } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5 echo "$as_me: error: cannot create directory $as_dir" >&2;} { (exit 1); exit 1; }; }; } # echo "creating $dirpart/$file" echo '# dummy' > "$dirpart/$file" done done ;; esac done # for ac_tag { (exit 0); exit 0; } _ACEOF chmod +x $CONFIG_STATUS ac_clean_files=$ac_clean_files_save # configure is writing to config.log, and then calls config.status. # config.status does its own redirection, appending to config.log. # Unfortunately, on DOS this fails, as config.log is still kept open # by configure, so config.status won't be able to write to it; its # output is simply discarded. So we exec the FD to /dev/null, # effectively closing config.log, so it can be properly (re)opened and # appended to by config.status. When coming back to configure, we # need to make the FD available again. if test "$no_create" != yes; then ac_cs_success=: ac_config_status_args= test "$silent" = yes && ac_config_status_args="$ac_config_status_args --quiet" exec 5>/dev/null $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false exec 5>>config.log # Use ||, not &&, to avoid exiting from the if with $? = 1, which # would make configure fail if this is the last instruction. $ac_cs_success || { (exit 1); exit 1; } fi crimson-0.5.2.orig/COPYING0000600000175000017500000003542407727124530013353 0ustar uweuwe GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS crimson-0.5.2.orig/ChangeLog0000600000175000017500000023423510730254763014073 0ustar uweuwe2007-12-13 Jens Granseuer *** release Crimson Fields 0.5.2 *** * NEWS: update * configure.ac * src/common/globals.h: bump version 2007-08-04 Waclaw Schiller * levels/Baptism.src: add Polish translation * levels/LakeYukarwa.src: add Polish translation and fix victory message definitions 2007-06-26 Benoit Peureux * levels/*.src * locale/fr.tmpl: update French translation 2007-06-24 Jens Granseuer Based on a patch by: haruspex * src/cf/mapwindow.{cpp,h} (FlashUnit): add * src/cf/game.cpp (SelectCommand) * src/cf/history.cpp (ReplayAttackEvent): make attack targets flash twice on selection 2007-05-29 Benoit Peureux * lev/Tutorial[1-3].src: add French translation * lev/*.src: update French translation 2007-05-19 Jens Granseuer By Benoit Peureux * lev/{Anthill,ArmsRace,Baptism,BeachRaid,ClippedWings,Foxhole, GreatBattle,HeavyMetal,IslandHoppers,LakeYukarwa,LankhValley, LostFactories,MountainDefense,OmyarGorge,Plowshares, RadioSilence,Revelation,Uprising}.src: add French translation * lev/General.src: update French translation 2007-05-18 haruspex * src/cf/game.{cpp,h} (MoveUnit) * src/cf/mapwindow.{cpp,h} (MoveHex): make cursor at destination hex blink when moving 2007-04-10 Jens Granseuer * levels/Uprising.src: fix typo in German translation (reported by Andreas Schwarz) 2007-02-02 Jens Granseuer * src/common/fileio.h: move WIN32 define to the top; fixes building with Cygwin (reported by Henk Jonas) * src/cf/path.cpp (StepsToDest): add cast for systems with unsigned enums (also courtesy of Henk) 2007-01-31 Silvio Iaccarino * VisualC++.zip: update VC++ project files 2007-01-24 Jens Granseuer * doc/Makefile.am (%.6, %.html, dist-hook): if xsltproc is not available, simply skip building docs; only error out on make dist 2007-01-23 Jens Granseuer *** release Crimson Fields 0.5.1 *** * NEWS: update * configure.ac * src/common/globals.h: bump version 2007-01-18 Jens Granseuer * doc/cfed.xml: update documentation for destroyunit event 2007-01-17 Jens Granseuer * src/cf/event.cpp (Execute) * src/comet/eventwindow.{cpp,h} (EdEventDestroyUnitWindow) * src/comet/mission.cpp (Event, Export, ValidateEvent) * tools/cfed.cpp (check_events, parse_section): support destroying units at a given location in EVENT_DESTROY_UNIT 2007-01-14 Waclaw Schiller * crimson.desktop: add Polish translation 2007-01-14 Jens Granseuer By Americo Iacovizzi * locale/it.tmpl: update Italian translation * tools/default.usrc: add Italian translation 2007-01-14 Jens Granseuer * crimson.desktop: drop file name suffix for the icon 2006-01-14 Nikola Smolenski * crimson.desktop: add Serbian translation 2007-01-12 Jens Granseuer * levels/Makefile.am (levels_DATA) * levels/Baptism.src * levels/ClippedWings.src: add fourth mission of the Yalwa campaign 2007-01-12 Jens Granseuer * levels/LakeYukarwa.src: use map name as title in briefings 2007-01-12 Jens Granseuer * levels/Plowshares.src (de): use formal language in the Kandelian objectives, for consistence with briefings etc. 2007-01-12 Jens Granseuer * levels/Makefile.am (levels_DATA) * levels/LakeYukarwa.src: add fifth mission of the Yalwa campaign by Nikola Smolenski 2007-01-06 Jens Granseuer * gfx/CFTiles.bmp: remove some of the placeholder markers since it doesn't look like we are going to get the replacements any time soon and some of them are already in use 2007-01-06 Jens Granseuer * src/comet/uiaux.cpp (BuildEventList): include event trigger in node label to make selection easier for the user * src/comet/uiaux.cpp (BuildShopList): use larger buffer since shop names can have up to 30 chars 2007-01-05 Jens Granseuer * src/common/slider.cpp (MouseDown): use smaller steps when scrolling via mouse buttons 2007-01-05 Jens Granseuer * src/comet/gfxwidget.cpp (MouseDown): reroute scroll events to the slider widget like the list widgets do * (Select): don't reset to top of list on deselection 2007-01-03 Jens Granseuer * src/cf/game.cpp (InitKeys): make non-ASCII shortcuts work as locale-defined key commands as well * src/cf/game.cpp (HandleEvent): make user-defined key commands work even if the corresponding locale-defined command does not exist 2007-01-02 Jens Granseuer * src/comet/extwindow2.cpp (NewMissionWindow::WidgetActivated): when creating a new map, also generate the most important messages in the default locale 2007-01-02 Jens Granseuer * src/common/listselect.cpp (SwitchList, Update): fix list updates after deleting nodes 2007-01-02 Jens Granseuer * src/cf/game.cpp (Load) * src/cf/initwindow.cpp (StartGame): fix resuming campaign games (reported by Uwe Koch) * src/cf/game.cpp (SwitchMap): carry over the handicap setting when switching maps in campaigns 2006-12-20 Jens Granseuer * src/comet/eventwindow.cpp (EdEventCreateUnitWindow, EdEventGenericWindow, EdEventSetTimerWindow) * src/comet/extwindow2.cpp (EdUnitWindow): use unique keyboard shortcuts 2006-12-19 Nikola Smolenski * locale/sr.tmpl: update for networking changes and others 2006-12-18 Waclaw Schiller * locale/pl.tmpl: update for networking changes 2006-12-18 Andrej Krivulcik * locale/sk.tmpl: update for networking changes 2006-12-18 Jens Granseuer * src/comet/edwindow.cpp (HandleEvent): do not start painting if we are currently scrolling the map view 2006-12-18 Jens Granseuer * src/cf/game.{cpp,h} (NetworkProgressWindow), (EndTurn, HandleNetworkError, StartTurn, WidgetActivated): improve handling of network errors. Now, when connection is lost, ask the user whether to save the game instead of just going back to the main menu. Also, don't pop up an error dialog if user explicitly disconnected * locale/{de,en}.tmpl (MSG_ASK_ABORT_NETWORK): modify the warning message accordingly * src/cf/game.cpp (GameMenu): remove restriction that only the server in a network game can save 2006-12-16 Jens Granseuer * src/cf/initwindow.cpp (NetworkSetupWindow) * src/cf/main.cpp (load_settings, save_settings) * src/cf/options.{cpp,h} ({Get,Set}LocalPort, {Get,Set}RemoteName, {Get,Set}RemotePort: remember network settings across sessions 2006-12-16 Jens Granseuer * src/common/widget.cpp (SetTitle): clear keypos when setting a new title (PrintTitle): only try to render the shortcut if we have a keypos; shortcuts do not have to be in the widget title, and we were groping random memory before if they weren't (Widget): clean up the constructor a bit * src/common/button.cpp (Draw) * src/common/widget.cpp (PrintTitle): fix some issues with operator precedence 2006-12-15 Jens Granseuer * src/common/widget.{cpp,h} (PrintTitle): replace the new WIDGET_ALIGN_WITHIN_{LEFT,RIGHT} flags by a single flag WIDGET_ALIGN_WITHIN that can be combined with WIDGET_ALIGN_{LEFT,RIGHT} to achieve the same result; this way we don't need to extend the flags member to avoid clashes * src/cf/unitwindow.cpp (ContainerWindow) * src/common/button.cpp (Draw): adapt 2006-12-15 Silvio Iaccarino * src/common/listselect.cpp (KeyDown): on WinCE, use the return key for selecting list items by default * src/cf/initwindow.cpp (GenericOptionsWindow::SetLayout) * src/cf/unitwindow.cpp (ContainerWindow): don't use WIDGET_DEFAULT where it interferes with ListWidget handling on those platforms * src/cf/platform.cpp (crimsonWndProc, platform_dispose, platform_setup): improve hiding of task bars on WinCE; add keyboard mapping for special keys 2006-12-15 Jens Granseuer Based on a patch by: Silvio Iaccarino * src/common/widget.{cpp,h} (PrintTitle): add WIDGET_ALIGN_WITHIN_{LEFT,RIGHT} defines to align the label within the widget boundaries * src/common/button.cpp (Draw): support composite buttons with WIDGET_STYLE_GFX and WIDGET_ALIGN_WITHIN_{LEFT,RIGHT} * src/cf/unitwindow.cpp (ContainerWindow): add a label and keyboard activator to the repair and production buttons 2006-12-15 Nikola Smolenski * tools/default.usrc: add Serbian unit names 2006-12-15 Jens Granseuer * src/common/widget.cpp (SetTitle): get rid of an unneccessary strlen call * autogen.sh: accept automake 1.10 * README, THANKS: update * music/COPYING.MUSIC: reword to avoid getting deep into politics 2006-12-14 Nikola Smolenski * src/common/strutil.{cpp,h} (utf8chartoascii): add function to translate UTF-8 characters to ASCII keystrokes; for now only knows about Cyrillic * src/common/widget.{cpp,h} (PrintTitle, SetTitle): add support for non-ASCII keyboard shortcuts to widgets * locale/Makefile.am (locale_DATA) * locale/sr.tmpl: add Serbian translation 2006-12-13 Jens Granseuer * locale/Makefile.am (locale_DATA) * locale/it.tmpl: add Italian translation by Americo Iacovizzi 2006-12-13 Silvio Iaccarino * src/common/fileio.cpp: fix Windows includes from last commit 2006-12-12 Silvio Iaccarino * src/common/fileio.cpp (get_home_dir): on Windows, use the "My Documents" folder as user's home dir * VisualC++.zip: update VC++ project files 2006-12-10 Jens Granseuer * doc/crimson.xml: mention networking in the main menu description and fix a typo 2006-12-08 Jens Granseuer *** release Crimson Fields 0.5.0 *** * NEWS, TODO: update * configure.ac * src/common/globals.h: bump version * VisualC++.zip: update VC++ project files 2006-12-07 Jens Granseuer * levels/ClippedWings.src: remove some Bunkers and tweak the map a little to make it harder for the FNA 2006-12-07 Jens Granseuer * src/cf/unitwindow.cpp (ContainerWindow::SwitchMode): reset the last_selected node pointer after switching modes, so we don't accidently select units we don't want 2006-12-04 Jens Granseuer * src/comet/edwindow.cpp (HandleEvent): use current terrain as a "paintbrush" when terraforming with the mouse button pressed; should make changing larger areas much less cumbersome 2006-11-30 Andrej Krivulcik * locale/sk.tmpl: update Slovak translation 2006-11-27 Waclaw Schiller * locale/pl.tmpl: yet another Polish translation update 2006-11-26 Jens Granseuer * gfx/CFTiles.bmp: new mountain tiles and various minor improvements by Laurent Chea * tools/default.tsrc: update definitions for new mountains * tools/bi_data.c (bi_rawtiles), tools/hl_data.c (hl_rawtiles): use new mountains when converting BI/HL maps * levels/{ArmsRace,ClippedWings,Foxhole,HeavyMetal, LostFactories,MountainDefense,OmyarGorge,RadioSilence, Tutorial[12],Uprising}.src: update to use new mountains 2006-11-26 Jens Granseuer * src/common/extwindow.h (ProgressWindow::Cancelled): mark virtual * src/common/window.h (WIN_PROG_DEFAULT): add new flag to control whether to set WIDGET_DEFAULT for the ProgressWindow button * src/common/extwindow.cpp (ProgressWindow): implement it * src/cf/history.cpp (Replay): use it 2006-11-25 Jens Granseuer * src/cf/initwindow.cpp (StartGame): ask the server which side to take 2006-11-24 Jens Granseuer * src/cf/initwindow.cpp (StartGame): send the player id the client is supposed to take in the sync buffer; this way we can lift the restriction that the client is always Player 2 2006-11-24 Jens Granseuer * src/cf/game.cpp (Undo) * src/cf/history.{cpp,h} (EraseMoveEvents): also erase all transportation events for the unit, and rename to UndoMove to better reflect this * INSTALL: recommend SDL_net 1.2.6 since earlier versions do not properly guard against SIGPIPEs 2006-11-22 Jens Granseuer * src/common/textbox.{cpp,h} (NumberWidget): extend number value to long, since we'll otherwise overflow for port numbers of up to 65536 (reported by Silvio Iaccarino) * src/common/initwindow.cpp (NetworkSetupWindow): set max port number to 65536 2006-11-22 Silvio Iaccarino * src/cf/initwindow.cpp (TitleWindow) * src/common/slider.{cpp,h} (ProgressWidget, SliderWidget): fix warnings with VC++ 2006-11-21 Jens Granseuer * src/cf/initwindow.{cpp,h} (AskForSide, StartGame): factor out asking for a side to play on * src/cf/game.cpp (NetworkProgressWindow::Cancelled): ask user for confirmation before disconnecting * src/cf/msgs.h (MSG_ASK_ABORT_NETWORK) * locale/*.tmpl: add new message * configure.ac: fix check for SDL_net to not disable sound 2006-11-21 Waclaw Schiller * locale/pl.tmpl: update Polish translation again 2006-11-20 Jens Granseuer * src/cf/initwindow.cpp (Rebuild): open window with map selection disabled if mode is Network Client (reported by Waclaw Schiller) * locale/*.tmpl * src/cf/initwindow.cpp (NetworkSetupWindow::Draw) * src/cf/msgs.h (MSG_NET_CONNECTING, MSG_NET_WAITING_CLIENT): add two more missing strings for translation (also reported by Waclaw) * src/comet/edwindow.{cpp,h} (WidgetActivated) * src/comet/extwindow2.{cpp,h} (NewMissionWindow): fix crash when creating a new map which was introduced by the recent switch to enums 2006-11-20 Waclaw Schiller * levels/ClippedWings.src: add Polish translation * levels/{ArmsRace,Foxhole,GreatBattle,HeavyMetal, IslandHoppers,MountainDefense}.src * locale/pl.tmpl: update Polish translation 2006-11-19 Jens Granseuer * src/common/textbox.cpp (TextListWidget::DrawNodes): make nodes look insensitive when widget is disabled * src/cf/game.cpp (Load): properly set flags for AI games; it's possible to play vs. computer again (reported by Dave Fancella) 2006-11-18 Jens Granseuer * levels/Makefile.am (levels_DATA) * levels/ClippedWings.src * levels/Plowshares.src: add third mission for the Yalwa campaign 2006-11-18 Jens Granseuer Add networking game mode. * src/cf/history.{cpp,h} (Save): add a special parameter for networking * src/cf/history.{cpp,h} (RecordTransportEvent, RecordUnitEvent, ReplayUnitEvent) * src/cf/ai.cpp (CommandUnitRepair) * src/cf/event.cpp (Execute) * src/cf/mission.cpp (CreateUnit) * src/cf/unitwindow.{cpp,h} (WidgetActivated): also record repairs and transportation events * src/cf/game.{cpp,h} (Load): add a way to load a game from an in-memory buffer (StartTurn): treat a remote player similar to the AI, as an opaque, non-interactive opponent (EndTurn): in network game, send history at end of turn (EndMovement, Execute): allow replaying events from a History for real (GameMenu): only allow the server to save * src/cf/initwindow.{cpp,h} (NetworkSetupWindow, StartGame, WidgetActivated): ask for networking parameters and synchronize mission with peer at the start of a match * src/cf/msgs.h: add message identifiers for network mode * locale/*.tmpl: add new messages for networking * README, doc/crimson.xml: add networking mode 2006-11-18 Jens Granseuer * src/cf/event.cpp (DisplayMessage) * src/cf/game.cpp (ShowDebriefing, StartTurn): only display messages and dialogs to interactive players 2006-11-18 Jens Granseuer * src/cf/game.{cpp,h} (ResolveBattle): add an optional argument to pass precalculated casualties * src/cf/history.cpp (RecordCombatEvent, ReplayCombatEvent): use (old and new) public API instead of private hacks * src/cf/combat.h: History no longer needs to be a friend class 2006-11-18 Jens Granseuer * src/common/gamedefs.h (GI_NETWORK): add * src/cf/options.{cpp,h} (GTYPE_*, IsNetwork): use symbolic names for game types and add networking types * src/cf/initwindow.cpp (WidgetActivated): adjust accordingly * src/cf/player.{cpp,h} (IsInteractive, IsRemote, SetRemote): add p_remote member variable and related methods * src/cf/combat.{cpp,h} (CalcResults): add a second variant that just takes a precalculated result and applies that 2006-11-17 Jens Granseuer * src/cf/Makefile.am (crimson_SOURCES) * src/cf/network.{cpp,h}: add TCP/IP networking infrastructure * INSTALL * configure.ac: check for SDL_net (optional dependency) * src/cf/main.cpp (do_exit, init): hook up the networking subsystem 2006-11-17 Jens Granseuer * src/common/fileio.{cpp,h}: un-constify Read/Write methods since we cannot assume these for other implementations (Write*): fix return value semantics (0 is success, -1 error) * src/{cf,comet}/map.cpp (Save): fix error check * src/cf/unit.h (XP): add * src/comet/edwidget.{cpp,h}: remove files * src/comet/Makefile.am (comet_SOURCES) * src/comet/eventwindow.h * src/comet/extwindow2.h: update accordingly * src/common/textbox.{cpp,h} (NumberWidget): move to common * src/common/widget.h (UserActionHook): add * src/common/extwindow.{cpp,h} (ProgressWindow): add a message property and implement UserActionHook * src/common/slider.{cpp,h} (ProgressWidget): actually make use of the title property * src/cf/ai.cpp (Play), src/cf/history.cpp (Replay): update accordingly 2006-10-10 Jens Granseuer * src/common/fileio.{cpp,h}: make MemBuffer a generic buffer abstraction instead of basing it on SDL_RWops * src/cf/game.cpp (Load), src/cf/mission.cpp (Load): adapt to changes in MemBuffer 2006-10-06 Jens Granseuer * src/common/fileio.{cpp,h}: factor out a generic MemBuffer abstraction from file which can e.g. be used to create a NetBuffer abstraction * src/cf/building.{cpp,h}, src/cf/combat.{cpp,h}, src/cf/container.{cpp,h}, src/cf/event.{cpp,h}, src/cf/history.{cpp,h}, src/cf/map.{cpp,h}, src/cf/mission.{cpp,h}, src/cf/player.{cpp,h}, src/cf/unit.{cpp,h}, src/comet/building.{cpp,h}, src/comet/map.{cpp,h}, src/comet/mission.{cpp,h}, src/comet/unit.{cpp,h}, src/common/lang.{cpp,h}, src/common/lset.{cpp,h}, src/common/surface.{cpp,h}, tools/mksurface.{cpp,h}: use MemBuffer instead of File where appropriate 2006-09-29 Jens Granseuer * src/comet/extwindow2.cpp (EdBuildingWindow::WidgetActivated): properly reflect changes to maximum amount of crystals * src/common/mapview.cpp (DrawMap, DrawUnitHealth): actually paint to the destination surface, not our private one 2006-09-24 Jens Granseuer * Makefile.am (EXTRA_DIST): distribute VC++ project files * src/comet/edwindow.{cpp,h} (WidgetActivated) * src/comet/extwindow2.{cpp,h} * src/common/sound.{cpp,h} * src/common/surface.{cpp,h}: replace static const class variables with enums 2006-09-21 Silvio Iaccarino * src/cf/platform.cpp (platform_setup): fix WinCE build * VisualC++.zip: add VC++ project files 2006-09-18 Jens Granseuer * src/cf/main.cpp (do_exit, main) * src/cf/platform.{cpp,h}: get rid of a few more platform- specific #ifdefs 2006-09-07 Waclaw Schiller * locale/pl.tmpl: update Polish translation 2006-08-25 Jens Granseuer * src/cf/game.cpp (HandleEvents) * src/cf/options.cpp (Options): get rid of some fixed key bindings in favour of the configurable ones 2006-08-18 Jens Granseuer * locale/de.tmpl (MSG_PRESS_KEY): update German translation * locale/{fr,hu,pl}.tmpl (MSG_PRESS_KEY): add default string * src/cf/game.cpp (GameMenu): make options submenus appear in the same order as in the start menu (thanks Andrej) * src/cf/initwindow.cpp (TitleWindow): try to support some sort of resolution-dependent title screen * src/common/globals.h (CF_TITLE_SCREEN): remove 2006-08-01 Andrej Krivulcik * locale/sk.tmpl: update Slovak translation 2006-08-01 Jens Granseuer * tools/parser.cpp (Parse): really fix BOM parsing... 2006-07-30 Jens Granseuer * locale/en.tmpl (MSG_PRESS_KEY): mention that BS/Del clears an assignment 2006-07-27 Jens Granseuer * locale/en.tmpl (MSG_PRESS_KEY) * src/cf/initwindow.{cpp,h} (KeyboardOptionsWindow) * src/cf/msgs.h (MSG_PRESS_KEY): rework the key binding options a little in an attempt to make its usage more obvious 2006-07-26 Waclaw Schiller * locale/pl.tmpl: update Polish translation 2006-07-23 Jens Granseuer * tools/parser.cpp (Parse): fix bug I introduced in skipping the UTF-8 BOM 2006-07-22 Jens Granseuer * src/cf/main.cpp (main, parse_options) * src/comet/main.cpp (main) * tools/cf2bmp.cpp, tools/cfed.cpp, tools/mkdatafile.cpp * tools/mklocale.cpp, tools/mktileset.cpp, tools/mkunitset.cpp: target some of the recent Win32 changes at VC++ only, to still allow building with Cygwin/MinGW 2006-07-21 Silvio Iaccarino * src/cf/game.cpp (GameMenu, WidgetActivated): add a minimize item to the game menu * src/cf/main.cpp (init): don't use "large" as a variable name since it's a reserved word in VC++ * src/cf/options.cpp: make "Play against AI" the default mode * src/comet/eventwindow.cpp (EdTrigHandicapWindow): make boolean expressions VC++ compatible * src/comet/main.cpp (main): support VC++ for Windows build * src/common/SDL_zlib.c: fix compilation without libz * src/tools/parser.cpp (Parse): skip UTF-8 BOM if present 2006-07-17 Jens Granseuer * src/cf/options.cpp: add default key bindings for V43 * src/cf/options.h: declare std namespace to fix build errors with newer gcc (reported by Stephan Beal) 2006-07-15 Jens Granseuer Based on a patch by Silvio Iaccarino (silvio@iaccarino.de): improve WindowsCE/PocketPC support * src/cf/Makefile.am (crimson_SOURCES) * src/cf/main.cpp (init, main, do_exit, init_wince) * src/cf/platform.{cpp,h}: move platform-specific functions out to a separate file; add PocketPC support * src/cf/initwindow.cpp (VideoOptionsWindow): add special modes for WindowsCE * src/common/globals.h (MIN_XRES, DEFAULT_RESOLUTION): set minimum width to 240 pixels; add resolution for WindowsCE (240x320) * (CF_FONT_LOWRES_*): add font sizes for small displays * tools/cf2bmp.cpp: only include unistd.h if available * tools/cfed.cpp * tools/mkdatafile.cpp * tools/mklocale.cpp * tools/mktileset.cpp * tools/mkunitset.cpp: undef main for Win32 * tools/parser.cpp (RemWhitespace): fix crash on some STL implementations 2006-07-14 Jens Granseuer Based on a patch by Silvio Iaccarino (silvio@iaccarino.de) * src/cf/Makefile.am (crimson_SOURCES) * src/cf/game.cpp (GameMenu, HandleEvent, WidgetActivated) * src/cf/initwindow.{cpp,h} (KeyboardOptionsWindow) * src/cf/main.cpp (event_filter, {load,save}_settings) * src/cf/msgs.h * src/cf/options.{cpp,h}: add configurable key bindings * locale/*.tmpl: add default messages for new keyboard options * src/cf/map.cpp (MoveCost): modify boolean expression to make VC++ happy * src/common/strutil.{cpp,h} (strprintf): add support for %c 2006-07-10 Jens Granseuer * src/cf/path.{cpp,h} (MoveShader::ETA, StopSearch): fix inlining to make VC++ happy * src/cf/initwindow.{cpp,h} ({Generic,Sound}OptionsWindow): use enums instead of static const class variables * src/common/textbox.{cpp,h} (TLWNode::user_flags): removed unused member 2006-05-31 Jens Granseuer * src/cf/history.cpp (RecordUnitEvent, ReplayUnitEvent): restore binary compatibility with older saved games 2006-04-26 Jens Granseuer * src/common/globals.h: add some defines for ports * src/cf/main.cpp (main): use DEFAULT_RESOLUTION instead of hardcoded 800x600 * src/common/extwindow.cpp (MessageWindow): use MIN_XRES and MIN_YRES instead of hardcoded 320x240 * src/cf/event.h (GetFocus): Point is really a struct; some compilers apparently complain about this * src/common/filewindow.cpp: include globals.h for platforms which don't provide strcasecmp 2006-04-23 Jens Granseuer * src/comet/mission.cpp (Event::Export): add missing type for EVENT_DESTROY_UNIT * src/comet/eventwindow.{cpp,h}: use enums instead of static const class variables * src/cf/mapwindow.{cpp,h} (FadeOutUnit): remove (FadeInHex): rename to FadeHex and also support fading out 2006-04-22 Jens Granseuer * src/common/SDL_zlib.c: only include unistd.h if available * doc/cfed.xml * src/cf/event.cpp (Execute) * src/cf/history.{cpp,h} (RecordUnitEvent, ReplayUnitEvent) * src/cf/mapwindow.{cpp,h} (FadeOutUnit) * src/cf/mission.cpp (CreateUnit) * src/comet/eventwindow.{cpp,h} (EdEventDestroyUnitWindow) * src/comet/mission.cpp (Event, ValidateEvent) * src/common/gamedefs.h (EVENT_DESTROY_UNIT) * tools/cfed.cpp (EventHandler): add EVENT_DESTROY_UNIT to remove units from the board * src/comet/eventwindow.cpp (EdTrigHaveUnitWindow): fix unit owner callback not being set 2006-01-25 Jens Granseuer * crimson.spec.in: recent versions of RPM expect License instead of Copyright (thanks to Matthew Gillen for the info) 2006-01-13 Waclaw Schiller * locale/pl.tmpl: update Polish translation 2005-10-30 Jens Granseuer * levels/Tutorial1.src * locale/Makefile.am (locale_DATA) * locale/hu.tmpl: add Hungarian translation by Erno Szabados 2005-10-19 Jens Granseuer * configure.ac: add check for xmllint * doc/Makefile.am (check-local): add validity check for the DocBook files 2005-10-13 Jens Granseuer *** release Crimson Fields 0.4.9 *** * NEWS: update * configure.ac * src/common/globals.h: bump version 2005-10-13 Michael Pfeiffer * src/common/fileio.cpp (get_home_dir): add support for BeOS * src/common/font.cpp (FitText): STL on BeOS R5 does not support push_back(); use += operator instead which should work for everyone 2005-10-13 Waclaw Schiller * levels/Tutorial3.src: add Polish translation * locale/pl.tmpl: update Polish translation 2005-10-11 Andrej Krivulcik * levels/Tutorial3.src: add Slovak translation 2005-09-29 Jens Granseuer * levels/Makefile.am (levels_DATA) * levels/Tutorial2.src * levels/Tutorial3.src: add third tutorial mission by Andrej Krivulcik 2005-09-17 Jens Granseuer * tools/cfed.cpp (EventHandler:ParseSection): fix parsing of HAVE_CRYSTALS events * (MapRawHandler:ParseSection): properly increment line counter (thanks to Andrej for the reports) 2005-09-17 Waclaw Schiller * levels/Tutorial1.src: update Polish translation 2005-09-17 Andrej Krivulcik * levels/Tutorial1.src: update Slovak translation 2005-09-01 Jens Granseuer * levels/Tutorial1.src: update German and English to recent changes in the unit information window 2005-08-04 Jens Granseuer * configure.ac: support passing non-standard paths to --with-zlib * src/{cf,comet}/unit.h (MapObject) * src/common/textbox.h (InputValidator) * src/common/widget.h (WidgetHook): fix virtual destructor warnings * tools/bi2cf.[ch] (tmapfiles, tmapinfo): fix some signedness warnings 2005-07-22 Jens Granseuer * doc/{crimson,cfed}.xml: small updates to improve the output with the latest Docbook XSL stylesheets (1.69.0). Also use xrefs instead of links now that the stylesheets support them 2005-07-12 Jens Granseuer * doc/{cfed,crimson}.xml * locale/*.tmpl * src/cf/container.{cpp,h} (Allow, InsertUnit, TotalCrystals) * src/cf/event.cpp (CheckTrigger) * src/cf/msgs.h (MSG_ERR_NO_TRANSPORTER, MSG_TRANSFER) * src/cf/unitwindow.{cpp,h} * src/comet/extwindow2.cpp (EdUnitWindow): remove transfer button from shop window. Crystals are now handled much like units as far as transports are concerned * src/cf/ai.cpp (AssignObjectives): always put stationary units in all-out attack mode since they aren't suited for anything else anyway 2005-07-08 Jens Granseuer * src/cf/initwindow.cpp (LocaleOptionsWindow): remove redundant border * src/common/gamewindow.cpp (UnitInfoWindow): mark forbidden tiles with the "not ready" dot instead of shading them 2005-06-29 Jens Granseuer * src/cf/initwindow.cpp (WidgetActivated): player selection should be accessible via keyboard * tools/cfed.cpp (check_events): fix HAVE_CRYSTALS validation 2005-06-27 Jens Granseuer * doc/cfed.xml: update the documentation, too 2005-06-26 Jens Granseuer * src/cf/event.cpp (CheckTrigger) * src/comet/eventwindow.{cpp,h} (EdTrigHaveCrystalsWindow) * src/comet/mission.cpp (ValidateEvent) * tools/cfed.cpp (check_events): add option to include all transports for ETRIGGER_HAVE_CRYSTALS 2005-06-25 Jens Granseuer * src/cf/unitwindow.cpp: make crystals sliders more consistent * src/common/slider.cpp (Adjust): cope with knob size 0 (MouseMove): smoother knob movement 2005-06-23 Jens Granseuer * src/cf/unitwindow.cpp (UnitLoadWindow::WidgetActivated): When moving units into transporter also set U_DONE flag so they don't appear to be ready (reported by Andrej) 2005-06-23 Andrej Krivulcik * tools/default.usrc: fix and update Slovak translation 2005-06-14 Jens Granseuer * src/cf/container.h (TotalCrystals) * src/common/gamedefs.h (ETRIGGER_HAVE_CRYSTALS): Eek! Forgot to commit these 2005-06-13 Jens Granseuer * doc/cfed.xml * src/cf/container.{cpp,h} (TotalCrystals) * src/cf/event.cpp (CheckTrigger, GetFocus) * src/comet/eventwindow.{cpp,h} (EdTrigHaveCrystalsWindow) * src/comet/mission.cpp (etrigger_labels, Event) * tools/cfed.cpp (EventHandler): add ETRIGGER_HAVE_CRYSTALS to check for available resources * src/cf/container.cpp (RemoveUnit): make sure we only subtract each unit once when we move it out of a container 2005-06-11 Jens Granseuer * src/cf/event.cpp (CheckTrigger): make ETRIGGER_UNIT_POSITION checks less expensive with many units on the map 2005-06-08 Jens Granseuer *** release Crimson Fields 0.4.8 *** * NEWS: update * configure.ac * src/common/globals.h: bump version 2005-06-06 Waclaw Schiller * levels/Tutorial2.src: add Polish translation 2005-06-05 Jens Granseuer * levels/Tutorial2.src: add German translation 2005-06-05 Andrej Krivulcik * levels/Tutorial2.src: add Slovak translation 2005-06-03 Jens Granseuer * doc/crimson.xml * src/cf/unit.cpp (Repair): make units being repaired lose one instead of 0.5 experience points per rookie * levels/Makefile.am * levels/Tutorial1.src: update * levels/Tutorial2.src: add Andrej's second tutorial mission 2005-05-29 Jens Granseuer * src/comet/mission.cpp (Event::Export): and export it, too * src/cf/event.cpp (CheckTrigger): fix combination of ETRIGGER_UNIT_POSITION and shops (reported by Andrej Krivulcik) * src/cf/initwindow.cpp: add missing iostream include (thanks Andrej) 2005-05-28 Jens Granseuer * doc/cfed.xml * src/cf/event.cpp (CheckTrigger) * src/comet/eventwindow.{cpp,h} (EdTrigUnitDestroyedWindow) * tools/cfed.cpp (EventHandler): add support for selecting unit classes for ETRIGGER_UNIT_DESTROYED 2005-05-23 Andrej Krivulcik * locale/sk.tmpl: update Slovak translation 2005-04-17 Jens Granseuer * src/cf/unitwindow.{cpp,h} (UnitLoadWindow): implement crystals transfers * src/cf/container.h (MaxCrystals): add * src/{cf,comet}/building.h (CrystalStore): rename * src/common/textbox.cpp (StringWidget::Draw): support WIDGET_STYLE_NOBORDER * src/common/button.cpp (CycleWidget::KeyUp): fix order when cycling by key * src/common/listselect.cpp (KeyDown): support activation via keyboard 2005-04-07 Jens Granseuer * src/cf/game.cpp (MoveUnit) * src/cf/unitwindow.cpp (UnitLoadWindow): add a cancel button to the window (UnitListWidget::DrawNodes): improve display of selected units 2005-04-04 Jens Granseuer * locale/en.tmpl: add CVS revision keyword to make synching easier for translation maintainers 2005-04-03 Waclaw Schiller * locale/pl.tmpl (MSG_TRANSFER_UNITS): add 2005-04-02 Jens Granseuer * src/comet/Makefile.am (comet_SOURCES) * src/comet/edwindow.cpp (ShowContextMenu, WidgetActivated): use the separated UnitInfoWindow * tools/default.usrc: disallow forest for hovercraft * locale/{de,en,fr}.tmpl (MSG_TRANSFER_UNITS) * src/cf/game.cpp (MoveUnit, Undo) * src/cf/msgs.h (MSG_TRANSFER_UNITS) * src/cf/unitwindow.{cpp,h} (UnitLoadWindow): it is now possible to take other units along when moving transports out of containers (the UI still needs work) * src/cf/initwindow.cpp (LocaleOptionsWindow): refuse to load incomplete translations 2005-03-27 Jens Granseuer * src/common/lset.{cpp,h} (TileSet::NumTiles): add (TerrainSet::NumTT, UnitSet::NumUT): remove * src/cf/unitwindow.{cpp,h} (UnitInfoWindow): move from here... * src/common/gamewindow.{cpp,h}: ... to here so we can use it for comet, too * src/cf/Makefile.am (crimson_SOURCES): add gamewindow.{cpp,h} * src/cf/game.h: move ICON defs from here... * src/common/gamedefs.h: ... to here 2005-03-25 Jens Granseuer * src/common/lset.{cpp,h} (DrawFog): move here... * src/common/mapview.{cpp,h} (DrawFog): ...from here * src/cf/mapwindow.{cpp,h} (DrawUnitInfo): statify, move to... * src/cf/unitwindow.cpp (UnitInfoWindow) 2005-03-20 Jens Granseuer * src/cf/mapwindow.{cpp,h} (DrawUnitInfo): make instance variables local * src/common/surface.{cpp,h} (SurfaceLock): add 2005-03-10 Jens Granseuer * src/common/mapview.cpp (DrawUnitHealth): scale health bar according to tile size * Makefile.am (EXTRA_DIST) * crimson.desktop: add desktop file * {doc,levels}/Makefile.am: replace suffix rules by pattern rules and other house-keeping 2005-03-06 Jens Granseuer * src/comet/gfxwidget.{cpp,h}: purge stuff obsoleted by TileSet * src/common/lset.{cpp,h} (TileSet::DrawTile): add * src/common/mapview.{cpp,h} (DrawHex): remove 2005-03-02 Jens Granseuer * src/common/lset.{cpp,h}: add generic TileSet class in preparation for variable tile sizes * src/cf/game.cpp (ScrollCommand, SetCursor) * src/cf/mapwindow.cpp (BoxAvoidHexes, DrawUnitInfo, FadeInHex, MoveHex, CombatWindow, Panel::Update) * src/cf/unitwindow.cpp (ContainerWindow, UnitInfoWindow, UnitListWidget::DrawNodes) * src/comet/edwindow.cpp (EdWindow, SetNewMission) * src/comet/eventwindow.cpp (EdEventSetHexWindow) * src/common/mapview.{cpp,h} * tools/cf2bmp.cpp (main): replace global constants GFX_WIDTH, GFX_HEIGHT, GFX_OVERLAP_X, and GFX_OVERLAP_Y by using tile set data; add DEFAULT_TILE_WIDTH and DEFAULT_TILE_HEIGHT 2005-03-01 Jens Granseuer * src/common/surface.{cpp,h} (GetPixel): add * src/common/mapview.cpp (Pixel2Hex): pixel-perfect hit testing 2005-02-26 Jens Granseuer * src/common/window.{cpp,h} (DrawBack): don't draw the entire bounding rect if we are only painting part of the surface 2005-02-20 Jens Granseuer *** release Crimson Fields 0.4.7 *** * NEWS: update * configure.ac * src/common/globals.h: bump version 2005-02-14 Jens Granseuer * src/{cf,comet}/mission.cpp (Load, Save): move player info and messages closer to the beginning of the file * src/cf/initwindow.{cpp,h} (CompleteFilesList, LoadMission) * src/cf/mission.{cpp,h} (QuickLoad): speed up application startup times by only loading the data required for the map selection screen * INSTALL * Makefile.am (DISTCHECK_CONFIGURE_FLAGS) * configure.ac * tools/Makefile.am * tools/cf2bmp.cpp: add cf2bmp utility for turning maps into images. Can be built and installed by passing --enable-cf2bmp to configure * src/common/surface.{cpp,h} (Colorize): unused, remove 2005-02-07 Jens Granseuer * src/{cf,comet}/unit.{cpp,h} (Moves, RefreshMoves, SetMoves): get rid of u_moves member variable and respective calls * src/cf/game.cpp (ClearMine, EndTurn, MoveUnit, Undo) * src/cf/history.cpp (RecordUnitEvent, StartRecording) * src/comet/mission.cpp (CreateUnit) * tools/cfed.cpp (check_units): update callers * src/comet/eventwindow.cpp (EdEventResearchWindow): add missing break in switch 2005-02-01 Jens Granseuer * doc/cfed.xml * src/cf/building.h (UnsetUnitProduction) * src/cf/event.cpp (Execute) * src/comet/eventwindow.{cpp,h} (EdEventResearchWindow) * src/comet/mission.cpp (Event) * tools/cfed.cpp (EventHandler::ParseSection): add new parameter to EVENT_RESEARCH to make it possible to disallow production of a specified unit class 2005-01-30 Andrej Krivulcik * locale/sk.tmpl: update Slovak translation 2005-01-30 Jens Granseuer * locale/en.tmpl: use caps consistently * src/comet/eventwindow.cpp (EdEventGenericWindow): clear string buffer for unset discard property (reported by Andrej Krivulcik) 2005-01-29 Jens Granseuer * doc/cfed.xml * src/cf/event.cpp (Execute) * src/comet/eventwindow.{cpp,h} (EdEventConfigureWindow) * src/comet/mission.{cpp,h} (Event, Load, Save) * src/common/lang.{cpp,h} (Find) * src/common/widget.h (SetFlags, UnsetFlags) * tools/cfed.cpp (EventHandler::ParseSection): reenable dynamically setting the next map in a campaign * src/cf/game.cpp (Undo) * src/cf/history.{cpp,h} (EraseMoveEvents): don't forget to erase recorded movement on undo (reported by Waclaw Schiller) 2005-01-26 Jens Granseuer * THANKS * levels/Makefile.am * levels/Tutorial1.src: add first tutorial mission by Andrej Krivulcik * src/common/gamedefs.h * tools/default.tsrc * tools/mktileset.cpp (TileHandler::ParseSection): remove TT_KEEP_OFF as it's not needed anywhere 2005-01-24 Jens Granseuer * locale/*.tmpl (MSG_B_UNIT_UNDO) * src/cf/game.{cpp,h} ([Re]MoveUnit, Undo, UnitMenu) * src/cf/msgs.h (MSG_B_UNIT_UNDO): add single-step undo * src/cf/unit.h (Facing): add * src/cf/options.h (IsAI, IsPBEM): campaign games can never be PBeM, but they are always against the computer (reported by Andrej Krivulcik) 2005-01-24 Waclaw Schiller * levels/Plowshares.src: add Polish translation 2005-01-23 Jens Granseuer * src/cf/event.cpp (Discard): make sure we don't loop endlessly on circular discard chains * tools/default.usrc: add missing terrain definition for rails (reported by Jonathan Koren) * src/common/extwindow.{cpp,h} (PasswordWindow): add parameter for whether dialog can be cancelled. Update callers * doc/crimson.xml (First Steps): minor correction 2005-01-22 Jens Granseuer * doc/cfed.xml * src/cf/game.cpp (Load) * src/cf/initwindow.cpp (CompleteFilesList) * src/comet/extwindow2.{cpp,h} (EdMissionSetupWindow) * src/comet/mission.{cpp,h} (Mission, Export, {Is,Set}Skirmish) * src/common/gamedefs.h (GI_SKIRMISH) * tools/cfed.cpp (MissionHandler): add a way to exclude campaign maps from the skirmish list * src/comet/eventwindow.cpp (EdEventCreateUnitWindow): fix off-by-one in unit size * tools/mkunitset.cpp (UnitHandler::ParseSection): handle missing translations more gracefully by using the English name * doc/cfed.xml * src/cf/event.{cpp,h} (Discard, Execute, Load, Save) * src/cf/game.cpp (CheckEvents) * src/comet/eventwindow.{cpp,h} (EdEventGenericWindow) * src/comet/mission.{cpp,h} (Event, ValidateEvent) * src/common/gamedefs.h (EFLAG_DISCARDED) * tools/cfed.cpp (EventHandler): it is now possible to group events so that all events in a group are discarded when one event in the group is triggered * src/common/globals.h (FILE_VERSION): bump * doc/cfed.xml * src/cf/event.cpp (Execute) * src/cf/player.h (SetBriefing) * src/comet/eventwindow.{cpp,h} (EdEventConfigureWindow) * src/comet/mission.cpp (Event) * src/common/gamedefs.h (EVENT_CONFIGURE) * tools/cfed.cpp (EventHandler): replace EVENT_NEXT_MAP with more generic EVENT_CONFIGURE (NEXT_MAP was broken anyway) 2005-01-21 Jens Granseuer * src/cf/game.cpp (SelectCommand): ignore shops without entrance tiles * src/cf/map.h (IsShop): add * doc/cfed.xml * src/cf/event.cpp (Execute) * src/cf/mission.{cpp,h} (CreateUnit) * src/cf/unit.h (SetGroupSize) * src/comet/eventwindow.{cpp,h} (EdEventCreateUnitWindow) * src/comet/extwindow2.cpp (size_labels, xp_labels) * src/comet/mission.cpp (Event) * tools/cfed.cpp (EventHandler): add support for setting group size and xp to EVENT_CREATE_UNIT 2005-01-19 Jens Granseuer * src/common/button.{cpp,h} (CycleWidget): only change the value when the widget is activated (Andrej Krivulcik again) * doc/cfed.xml * src/cf/event.cpp (CheckTrigger) * src/comet/eventwindow.{cpp,h} (EdTrigUnitPositionWindow) * src/comet/mission.cpp (Event) * tools/cfed.cpp: add controller info to ETRIGGER_UNIT_POSITION so it can be used if the controlling player is not the event owner * src/cf/map.cpp (MoveCost): don't let units enter shops when they cannot cross the entrance tile 2005-01-17 Jens Granseuer *** release Crimson Fields 0.4.6 *** * NEWS: update * configure.ac * src/common/globals.h: bump version * levels/Makefile.am * levels/Plowshares.src * levels/Uprising.src: add second campaign map * src/cf/game.cpp (Load, Save): set GI_SAVEFILE when saving instead of after loading so we can properly start new missions from the command line * src/cf/event.cpp (Execute) * src/cf/mapwindow.cpp (FadeInHex): make sure we don't obscure other units or the cursor when fading (both issues reported by Andrej Krivulcik) 2005-01-08 Jens Granseuer * src/cf/history.cpp (Load) * src/{cf,comet}/mission.cpp (Load, Save): fix turn replay sometimes being skipped when loading saved games and make sure we stay compatible with 0.4.5 saved games (reported by Andrej Krivulcik) 2005-01-07 Jens Granseuer * src/cf/game.cpp (ClearMine): deselect a sweeper when no more mines are within reach after a sweep and end its turn (also fixes a crash reported by Andrej Krivulcik) 2005-01-03 Jens Granseuer * src/cf/event.cpp (Execute): only execute score events when score is below 100. This way we only get one message when multiple victory conditions are met on a single turn * src/cf/path.{cpp,h} (GetStep): avoid linking issues due to inlining (original patch by Sascha Flohr) * src/comet/eventwindow.cpp (ScoreEventWindow): fix duplicate mnemonic * src/comet/edwindow.cpp (WidgetActivated): repaint panel after deletion of units or shops * src/common/fileio.{cpp,h} * src/{cf,comet}/mission.cpp (Load): try to load units and tiles from user directory first * tools/: overhaul the mk* tools to make them work with separate data files instead of hardcoded data. Creating new tile sets and unit sets is now possible without messing with the code * THANKS * levels/*.src * locale/sk.tmpl * tools/default.usrc: add Slovak translation by Andrej Krivulcik 2004-11-25 Waclaw Schiller * levels/*.src * locale/pl.tmpl: update Polish translation 2004-11-23 Jens Granseuer * src/common/view.cpp (FetchEvent): try to aggregate multiple mouse motion events before dispatching. This e.g. helps avoid excessive repainting when scrolling in CoMET * doc/crimson.xml (Getting Started): apply some improvements from the wiki * doc/crimson.css: add stylesheet for HTML documentation * doc/Makefile.am: add crimson.css to EXTRA_DIST and use it when creating the HTML documentation 2004-11-14 Jens Granseuer * src/comet/Makefile.am (comet_SOURCES) * src/comet/mapgen.{cpp,h}: add random map generator * src/comet/edwindow.{cpp,h} * src/comet/extwindow2.{cpp,h} (NewMissionWindow): use it * src/comet/main.cpp (main): init random number generator * src/common/slider.cpp (MouseDown): properly scroll when knob size is 1 * src/common/filewindow.{cpp,h} (WidgetActivated): the last selected file should be per window * src/common/listselect.cpp (ListWidget::MouseDown) * src/common/textbox.{cpp,h} (TextScrollWidget::MouseDown): make mouse wheel operations work even if the cursor is not hovering over the slider * src/comet/edwindow.cpp (LeftMouseButton): fix the check for whether a shop tile is being replaced by a non-shop tile 2004-10-30 Jens Granseuer * src/cf/path.{cpp,h}: rework to use a binary heap instead of a linked list for storage. Improves path finder speed by a factor of 5. Gain for MoveShader is still about 60% and could be made even faster by dropping the heap stuff from Find() * src/cf/map.cpp (MoveCost): small optimization which squeezes another 10% or so out of the path finder in most situations 2004-10-28 Jens Granseuer * levels/Makefile.am (levels_DATA) * levels/RadioSilence.src: new map by Chang Tang Yen and myself * src/common/widget.h (Hide, Unhide): add * src/common/window.cpp (RemoveAllWidgets): add * src/cf/initwindow.{cpp,h} (Rebuild, VideoModeChange): move out of constructor and call when changing resolution so that the window/widget sizes are recalculated * src/common/font.{cpp,h} (WriteEllipsis): add * src/cf/unitwindow.cpp (Draw) * src/comet/edwindow.cpp (PrintCursorPos): use it * src/comet/edwidget.cpp (NumberWidget::Release): simplify * src/comet/eventwindow.cpp (EdEventMiningWindow): fix setting the crystal limits 2004-10-14 Jens Granseuer *** release Crimson Fields 0.4.5 *** * NEWS: update * configure.ac * src/common/globals.h: bump version * src/comet/edwindow.cpp (PrintCursorPos): also display the names of units/shops 2004-10-11 Benjamin Power * levels/General.src * locale/fr.tmpl * tools/default_units.c: update French translation 2004-10-11 Waclaw Schiller * levels/General.src * levels/Uprising.src: update Polish translation 2004-10-09 Jens Granseuer * src/common/button.cpp (CycleWidget): use RMB to cycle backwards * src/cf/msgs.h * locale/*.tmpl: remove unused messages 2004-10-07 Jens Granseuer * levels/Uprising.src: update campaign name 2004-09-18 Jens Granseuer * levels/Uprising.src: replace by new map to kick off the Yalwa campaign * Makefile.am (DISTCHECK_CONFIGURE_FLAGS): build everything * src/comet/eventwindow.{cpp,h} (EdEventGenericWindow) * tools/cfed.cpp (parse) * doc/cfed.xml: add a way to disable events 2004-09-18 Marcus Schreiner * levels/General.src: add missing message event for Kand reinforcements. Translations need update 2004-09-12 Jens Granseuer * src/cf/ai.cpp (FindBestHex): don't consider TT_ENTRANCE hexes as attack positions and also check other hexes when the projected turn distance is 0. This makes sure the AI moves units out of shops to attack adjacent enemies * src/common/lang.{cpp,h} (AddLanguage, RemoveLanguage): adjust the default language when adding/removing languages if required * src/comet/edwindow.cpp (HandleEvent): fix crash when clicking on the tiles or units widget with prior to initialization * src/cf/event.cpp (Execute) * src/comet/eventwindow.{cpp,h} (EdEventSetTimerWindow) * src/comet/mission.cpp (ValidateEvent, Event, Event::Export) * src/common/gamedefs.h (EVENT_SET_TIMER) * tools/cfed.cpp (parse, check_events) * doc/cfed.xml: add new event type SET_TIMER 2004-09-07 Jens Granseuer * src/comet/eventwindow.{cpp,h} (EdEventMessageWindow): handle negative coordinates correctly * src/comet/extwindow2.cpp (EdMissionSetupWindow): fix crash when trying to set a player name with no messages available 2004-09-05 Jens Granseuer * tools/cfed.cpp (check_events): fix SET_HEX validation * src/cf/event.cpp (GetFocus) * src/comet/eventwindow.{cpp,h} (EdEventMessageWindow) * src/comet/mission.cpp (Event::Event, Event::Export) * tools/cfed.cpp (check_events, parse) * doc/cfed.xml: support setting a hex to focus on for MESSAGE * levels/*.src: update all maps to use it for the briefings 2004-09-02 Jens Granseuer * src/common/mapview.h (MV_DIRTY) * src/cf/event.{cpp,h} (DisplayMessage, GetFocus) * src/cf/game.cpp (StartTurn) * src/cf/history.{cpp.h} (RecordMsgEvent, ReplayMessageEvent) * src/cf/mapwindow.cpp (DisplayHex): Make start of turn events visible by initializing the display before CheckEvents(). When displaying a message for an event try to set the focus on some sensible spot on the map. Also lengthen the delay when showing the effects of SET_HEX and CREATE_UNIT events in replays 2004-08-30 Jens Granseuer * src/cf/event.cpp (Execute) * src/cf/mission.{cpp,h} (CreateUnit): add direction parameter so that it gets recorded correctly for replays * src/cf/game.{cpp,h} (ExecPreStartEvents, InitWindows): add new method to prevent handicap events on the first turn from showing up in replays 2004-08-27 Jens Granseuer *** release Crimson Fields 0.4.4 *** * NEWS: update * configure.ac * src/common/globals.h: bump version 2004-08-26 Jens Granseuer * tools/cfed.cpp (check_player): accept player names up to 30 characters like CoMET does * src/comet/extwindow2.cpp (EdBuildingWindow): fix crash when closing the window using the return key (reported by Chang Tang Yen) * src/comet/mission.cpp (ValidateEvent): don't warn about ETRIGGER_HANDICAP * levels/Makefile.am * levels/General.src: add new map by Marcus Schreiner 2004-08-24 Jens Granseuer * src/common/SDL_zlib.[ch]: new transparent SDL_RWops implementation for gzip-compressed files. All users have been updated and obsoleted code removed * gfx/crimson.ico: reduced file size by using png2ico instead of icotool * locale/Makefile.am * locale/fr.tmpl * tools/default_units.c * tools/mkunitset.cpp: add French translation by Benji 2004-08-20 Jens Granseuer * src/cf/event.cpp (CheckTrigger): fix timer checks and also search transporters for UNIT_POSITION * src/cf/initwindow.cpp (GenericOptionsWindow::SetLayout): limit maximum window height to screen size * src/common/textbox.cpp (StringWidget::CharInput): accept all printable characters as valid input 2004-08-17 Jens Granseuer * src/cf/event.cpp (Execute) * src/comet/eventwindow.{cpp,h} (EdEventCreateUnitWindow) * src/comet/extwindow2.cpp (dir_labels) * src/comet/mission.cpp (Event::Event, Event::Export) * tools/cfed.cpp (check_events, parse) * levels/*.src * doc/cfed.xml: add "face" parameter for EVENT_CREATE_UNIT 2004-08-17 Jens Granseuer * doc/cfed.xml * levels/*.src * src/cf/event.cpp (CheckTrigger, Execute) * src/comet/eventwindow.cpp * src/comet/extwindow2.cpp (NewMissionWindow) * tools/bi2cf.c * tools/cfed.cpp: use more compact hex representation. Also decrease maximum map size to 180x180 * src/common/globals.h (FILE_VERSION): bump due to incompatible changes 2004-08-15 Jens Granseuer * src/cf/event.cpp (CheckTrigger) * src/cf/mission.h (GetTime) * src/comet/mission.cpp * src/comet/eventwindow.{cpp,h} * src/common/gamedefs.h * tools/cfed.cpp * levels/*.src * doc/cfed.xml: rename ETRIGGER_TURN to ETRIGGER_TIMER and make it use time index counters instead of turn numbers. Also change "turn" to "timer" and "tturn" to "ttime" for cfed * tools/bi2cf.c: try to fix a compiler warning * autogen.sh: recognize automake 1.9 2004-08-13 Jens Granseuer * src/cf/game.cpp (CheckEvents) * src/cf/event.{cpp,h} (Check, CheckTrigger): clean up some leftover stuff from the change from 2004-08-07 2004-08-12 Jens Granseuer * src/common/misc.cpp (unpack): return -1 when trying to uncompress without zlib support to cause an error * src/common/lang.h (SetMsg, RemoveLanguage): add * src/comet/extwindow2.{cpp,h} (EdMsgWindow): add basic support for creating and modifying messages (no multiline and plain ASCII only for now) * src/comet/edwindow.{cpp,h}: use it * INSTALL, configure.ac: use --without-zlib instead of --disable-zlib. It doesn't make any difference technically but follows convention 2004-08-07 Jens Granseuer * src/cf/event.{cpp,h} (Execute, DisplayMessage) * src/cf/game.cpp (CheckEvents): open a new window each time we show a message. Keeping one window open can get in the way of events with graphical feedback * src/comet/extwindow2.cpp (NewMissionWindow::WidgetActivated): close the file requester on load 2004-08-04 Jens Granseuer * src/comet/mission.cpp (Event::Export): fix stupid typo * src/cf/main.cpp (load_settings) * src/common/strutil.cpp (strprintf) * tools/mklocale.cpp (Parse, RemWS): use size_t instead of unsigned int for string operations. This should fix a few compiler warnings on some systems 2004-07-31 Jens Granseuer * doc/cfed.xml * src/cf/event.cpp (Execute) * src/comet/eventwindow.{cpp,h} (EdTrigUnitPositionWindow) * tools/cfed.cpp (check_events, parse): add support to ETRIGGER_UNIT_POSITION for specifying a unit type instead of a single unit 2004-07-29 Jens Granseuer * doc/cfed.xml * src/cf/event.cpp (Execute) * src/comet/eventwindow.{cpp,h} (EdEventSetHexWindow) * src/comet/mission.cpp (Event, ValidateEvent) * src/common/gamedefs.h * tools/cfed.cpp (check_events, parse): add EVENT_SET_HEX * src/cf/history.cpp (ReplayTileEvent): make tile changes more obvious * src/cf/mapwindow.{cpp,h} (FadeInHex, FadeInTerrain, FadeInUnit): make FadeInHex work with both units and terrain and add specialized wrappers 2004-07-24 Jens Granseuer * src/cf/event.cpp (Execute): update display for CREATE_UNIT if necessary * src/cf/history.{cpp,h} (BeginReplay, RecordUnitEvent, Replay, ReplayUnitEvent, StartRecording) * src/cf/mission.cpp (CreateUnit): record and replay new units * src/cf/mapwin.{cpp,h} (FadeInHex): add * src/cf/unit.cpp: initialize movement points of newly created units with speed rather than 0 2004-07-22 Jens Granseuer * src/comet/extwindow2.cpp (EdBuildingWindow): don't crash if shop name selection returns no result. Reported by Chang Tang Yen 2004-07-21 Jens Granseuer * src/common/button.cpp (CycleWidget): make sure the default label placement from ButtonWidget is undone. This fixes artifacts when using antialiased fonts 2004-07-11 Jens Granseuer *** release Crimson Fields 0.4.3 *** * NEWS: update * configure.ac * src/common/globals.h: bump version 2004-07-10 Jens Granseuer * THANKS * levels/*.src * locale/Makefile.am * locale/pl.tmpl * tools/default_units.c * tools/mkunitset.cpp: add Polish translation by Sebastian Gabor and Waclaw Schiller * gfx/Makefile.am * gfx/crimson.ico: add Windows icon * configure.ac: also check for a few required header files to catch setups with the devel packages not installed 2004-07-03 Jens Granseuer * levels/Makefile.am * levels/OmyarGorge.src: add new map 2004-06-19 Jens Granseuer * gfx/Vera.ttf, gfx/Bepa-Roman.ttf, gfx/Makefile.am * src/common/globals.h (CF_FONT): replace the Bitstream Vera font by Bepa-Roman which is an extended version with support for some eastern european glyphs (needed for e.g. Polish and Slovak) * autogen.sh: allow passing options to aclocal using the ACLOCAL_FLAGS environment variable 2004-05-17 Jens Granseuer * src/common/surface.cpp (DisplayFormat): don't call SDL_DisplayFormat() if the video subsystem has not been initialized * tools/cfed.cpp (main): we don't need the video subsystem 2004-05-06 Jens Granseuer * src/cf/game.cpp (HandleEvent, ScrollCommand): with NumLock enabled, use the number pad to move the cursor "faster" (3/4 of the view width instead of a single hex) 2004-04-25 Jens Granseuer * src/common/extwindow.{cpp,h} (PasswordWindow): add button to abort password checking * src/cf/game.{cpp,h} (CheckPassword, SetPlayerPassword): make it possible to abort the password dialog 2004-04-20 Jens Granseuer *** release Crimson Fields 0.4.2 *** * NEWS: update * configure.ac * src/common/globals.h: bump version 2004-04-20 Jens Granseuer * src/cf/game.{cpp,h} (MinesweeperTargets, UnitMenu): only offer the 'sweep' menu item if there actually is a mine to be cleared * doc/cfed.xml: add handicap support to the example map * Makefile.am * configure.ac * music/*: add default symphony by David Fancella 2004-04-15 Jens Granseuer * src/cf/game.cpp (SelectCommand): deselecting a unit inside a transporter should work just as with shops, by clicking on the transporter * src/cf/game.cpp (HandleEvent, UnitMenu, WidgetActivated): improve handling of minesweepers * src/cf/unit.cpp (RefreshMoves) * src/comet/mission.cpp (CreateUnit) * tools/cfed.cpp (check_units): fix speed for mines * src/comet/extwindow2.cpp (EdMissionSetupWindow): the mission title could not be changed. Also refresh the message widget after changing the text 2004-04-12 Jens Granseuer * tools/default_units.c: make aircraft more expensive * src/comet/edwindow.cpp (LeftMouseButton): warn when removing a shop entrance without having deleted the shop itself * src/comet/mission.cpp (ValidateMap): complain about shops without an entrance * src/cf/initwindow.cpp (WidgetActivated): reinit map widget when changing game mode * src/cf/container.{cpp,h} (Allow) * src/cf/event.cpp (Execute): make 'createunit' events also work when trying to put units into transporters * levels/*.src: add support for difficulty levels * levels/GreatBattle.src: fix bogus victory messages for player 2 (reported by David Fancella) * doc/crimson.xml: update 2004-04-02 Jens Granseuer * src/common/gamedefs.h * src/cf/event.cpp * src/comet/mission.cpp * src/comet/eventwindow.{cpp,h} * tools/cfed.cpp * doc/cfed.xml: add new 'handicap' event trigger. Also modify 'createunit' event so that it is possible to place the units anywhere on the map * levels/Foxhole.src * levels/GreatBattle.src: adapt to 'createunit' changes 2004-03-25 Jens Granseuer * src/common/sound.cpp: include * src/comet/edwindow.cpp (ValidateMission) * src/comet/mission.{cpp,h} (Validate*): switch use of string to stringstream * src/comet/extwindow2.cpp (MissionSetupWindow): redraw textbox after changing text * src/cf/initwindow.cpp (WidgetActivated): don't change handicap for saved games 2004-03-22 Jens Granseuer * src/common/widget.cpp (PrintTitle): redraw window background before printing label * src/common/button.cpp (ButtonWidget): as a default use WIDGET_ALIGN_CENTER flag to not redraw the label background * src/common/widget.h (SetSize): make public * src/common/textbox.cpp (TextScrollWidget): only create slider if we need it * gfx/CFUnits.bmp: remove artifacts from blue fighter image * src/cf/initwindow.{cpp,h} * src/cf/mission.{cpp,h} * src/cf/msgs.h * src/common/gamedefs.h * locale/*.tmpl: add generic support for player handicaps (it doesn't have any effect yet) 2004-03-20 Jens Granseuer * src/{cf,comet}/* * tools/cfed.cpp * levels/*.src * doc/cfed.xml: switch to a new campaign system, add support for campaign names, remove support for map passwords 2004-03-18 Stephen Branley * src/common/textbox.cpp: add include. This fixes compilation with Slackware 9.1 2004-03-15 Jens Granseuer * src/cf/game.{cpp,h}: get rid of flags member variable * src/cf/main.cpp * src/cf/mission.cpp * src/common/sound.cpp: improve error diagnostics * src/common/gamedefs.h (GI_CAMPAIGN): add * src/cf/initwindow.{cpp,h} * src/cf/msgs.h * locale/*.tmpl: prepare for new campaign system * src/common/button.cpp (CycleWidget::Draw): also ghost the value when disabled 2004-03-13 Jens Granseuer * src/common/sound.{cpp,h} (StopMusic): add * src/common/globals.h: add CF_MUSIC_DEFAULT and CF_MUSIC_FADE_TIME definitions * src/cf/game.{cpp,h} * src/cf/initwindow.cpp: add support for scenario soundtracks * src/common/widget.{cpp,h} (CompositeWidget): add * src/common/listselect.{cpp,h} (ListWidget) * src/common/textbox.{cpp,h} (TextListWidget) * src/cf/unitwindow.cpp (UnitListWidget) * src/comet/gfxwidget.{cpp,h} (GfxWidget): use it * src/common/window.cpp (AddWidget): don't add component widgets to the internal widget list * src/common/button.{cpp,h} (DropWidget): add * src/cf/initwindow.{cpp,h}: rework options * src/cf/msgs.h * locale/*.tmpl: remove MSG_OPTIONS * src/common/extwindow.{cpp,h} (MenuWindow::SetMinWidth): add 2004-03-10 Jens Granseuer * src/comet/mission.cpp (Event): properly initialize 'score' events * src/{cf,comet}/mission.{cpp,h} (Load, Save, Export, Validate) * src/comet/extwindow2.{cpp,h} (EdMissionSetupWindow) * tools/cfed.cpp (parse, check_game) * doc/cfed.xml: add support for a campaign info message and mission soundtracks. Still need to write code actually using them, though. 2004-03-09 Jens Granseuer * src/comet/extwindow2.{cpp,h} (EdUnitWindow) * src/comet/unit.cpp (Export) * tools/cfed.cpp (parse, check_units) * doc/cfed.xml: add support for changing initial squad size and experience level for units 2004-03-07 Jens Granseuer * src/common/globals.h: bump FILE_VERSION * src/{cf,comet}/mission.cpp: add new internal_messages member which holds non-translatable strings such as passwords, next map names, and music track names * levels/ArmsRace.src * levels/BeachRaid.src * levels/Foxhole.src * levels/Uprising.src * doc/xml/cfed.xml * tools/cfed.cpp: "nextmap" and "password" are now in the internal catalog * src/common/lang.h: add Language::Size() * src/common/gamedefs.h: remove GI_PASSWORD 2004-03-07 Jens Granseuer * src/cf/initwindow.cpp (CompleteFilesList): don't crash if we read an (invalid) mission without a name * src/common/fileio.cpp (get_music_dir): add * src/common/sound.cpp: rework and enable music code * src/common/globals.h: add CF_MUSIC_THEME definition * src/cf/initwindow.cpp (InitWindow, SoundOptionsWindow): play music and enable music settings * src/comet/mission.cpp (Validate): check for mission name * src/comet/extwindow2.cpp (EdMissionSetupWindow): add mission name widget * tools/cfed.cpp (parse) * doc/cfed.xml: add support for changing player colors 2004-03-02 Jens Granseuer *** release Crimson Fields 0.4.1 *** * NEWS: update * configure.ac * src/common/globals.h: bump version * src/cf/game.cpp (CheckPassword): send the user back to the main menu when he doesn't know the password in PBeM games * src/cf/main.cpp (do_exit): plug a memory leak when leaving the program via the event_filter mechanism * src/cf/unitwindow.cpp (Draw): correct shop name box offset 2004-02-27 Jens Granseuer * src/cf/game.cpp (SwitchMap): fix a silly mistake which caused a segfault when changing maps * src/cf/game.cpp (ShowDebriefing): add missing window init which would have caused a crash if the bug above hadn't stopped the user before this point 2004-02-26 Jens Granseuer * src/cf/history.cpp (Replay): fix not being able to abort replay and progress bar not updating * src/cf/path.cpp (MoveShader::GetBestNode): iterate through the list of open nodes to find the best one. Don't always return the list head. In some cases this could abort the path finder too early because we don't update the open list if the node for current hex has already been closed, even if the active path is cheaper. * tools/cfed.cpp (load_tile_set, load_unit_set): check for both Unix and Windows path separator characters when extracting the set name. This otherwise breaks when building with MinGW. 2004-02-22 Jens Granseuer *** release Crimson Fields 0.4.0 *** * NEWS: update * configure.ac * src/common/globals.h: bump version * levels/HeavyMetal.src * levels/Makefile.am: add new map * levels/BeachRaid.src: make HeavyMetal next map * doc/Makefile.am: rename html target to html-local as recommended for automake 1.8 * autogen.sh: require automake 1.7.0 or later. Also check for automake-1.8 and automake-1.7 binaries (reported by Uwe Koch and Waclaw Schiller) * tools/cfed.cpp (main): add -o parameter to fix VPATH builds * levels/Makefile.am: use it * doc/cfed.xml: document it * crimson.spec.in: require SDL_ttf 2004-02-16 Jens Granseuer * doc/crimson.xml: update for changes in InitWindow * levels/Foxhole.src: convert to use the new othermsg and othertitle properties for score events * src/cf/container.h (Transport::Transport): init crystals * src/comet/eventwindow.{cpp,h} (EdEventScoreWindow): add support for othermsg and othertitle properties * src/comet/mission.cpp (Export): export messages in new format and for all available languages * tools/bi2cf.c (uncompress): fix possibly undefined increment operation * tools/default_units.c: rebalance aircraft and long-range weapons 2004-02-10 Jens Granseuer * src/cf/game.cpp (ResolveBattle): don't mix up casualties for attacker and defender in replays. Also don't try to access invalid members for destroyed units * src/cf/initwindow.cpp (InitWindow, TitleWindow) * src/cf/main.cpp (main): preload main window after showing the title image. This makes the main window seem to appear faster * src/cf/history.cpp (Replay, ReplayMoveEvent): speed up battle results-only replays * src/common/font.cpp (Load): SDL_ttf segfaults if the font file is not present so check before trying to open it * gfx/CFTiles.bmp: make the highlight cursor a bit thicker 2004-02-03 Jens Granseuer * INSTALL: include links to all external library locations * levels/Anthill.src * levels/ArmsRace.src * levels/GreatBattle.src * levels/IslandHoppers.src * levels/LankhValley.src * levels/LostFactories.src * levels/MoutainDefense.src * levels/Revelation.src: add german translation * src/cf/game.cpp * src/cf/main.cpp * src/cf/mission.cpp * src/comet/main.cpp * src/comet/mission.cpp * tools/cfed.cpp: add missing include * tools/mklocale.cpp: fix compile errors with gcc 3.x * src/common/mapwidget.cpp (MouseDown): ignore events if no map has been assigned 2004-01-25 Jens Granseuer * levels/ArmsRace.src: fix player and shop names * levels/BeachRaid.src * levels/Foxhole.src: add german translation * src/common/font.{cpp,h}: use SDL_ttf * gfx/Vera.ttf: add default font * gfx/CF*Font.bmp: remove obsolete font images * configure.ac: require SDL_ttf * src/cf/event.cpp * src/comet/mission.cpp * tools/cfed.cpp * doc/cfed.xml: add 'othermsg' and 'othertitle' parameters for 'score' event to show a message for the "loser" * src/cf/game.cpp (HandleLMB): use single-click selection only if no active unit 2004-01-23 Jens Granseuer * src/cf/game.cpp (Load): separate out window setup * src/cf/initwindow.cpp: use mission title in display, not file name. Display small map when selecting a mission * src/common/mapwidget.cpp: we need the map object itself only for initializing * src/common/textbox.cpp (TLWList::Sort): add 2004-01-22 Jens Granseuer * src/cf/game.cpp (ResolveBattle): don't free the Combat here; it may not have been dynamically allocated * src/cf/game.cpp (EndTurn): do it here instead * src/comet/edwidget.{cpp,h}: remove CycleWidget... * src/common/button.{cpp,h}: ...and add it here * src/cf/initwindow.{cpp,h}: revamp InitWindow * src/cf/options.h: make game type a single setting * src/cf/msgs.h * locale/*.tmpl: update * gfx/CFIcons.bmp: remove quit icon 2004-01-20 Jens Granseuer * doc/cfed.xml: note that messages need to be UTF-8 * levels/GreatBattle.src * levels/IslandHoppers.src: update maps with some new tiles * levels/Uprising.src: add german messages * src/cf/initwindow.{cpp,h} (LocaleOptionsWindow): add * src/cf/game.cpp (GameMenu, HandleEvent): use it 2004-01-18 Jens Granseuer * configure.ac * Makefile.am: add locale subdirectory * locale/*: add English and German language files * src/cf/player.{cpp,h} * src/comet/mission.{cpp,h} * tools/cfed.cpp: include mission name, player names, and shop names in the messages section to allow for translations * src/cf/mission.cpp (Load, Save) * src/comet/mission.cpp (Load, Save) * tools/cfed.cpp: support multiple messages sections (for different languages) * src/common/lang.h (Locale::GetLanguage): publicize * doc/cfed.xml * levels/*.src * tools/bi2cf.c: update accordingly 2004-01-16 Jens Granseuer * README: add a section about translations * src/cf/player.{cpp,h} * src/comet/mission.{cpp,h} * src/common/gamedefs.h: remove player difficulty setting. Add player colours instead. Make password variable length * src/common/globals.h (FILE_VERSION): bump * tools/cfed.cpp (satoi): complain if trying to convert non-numeric characters (may indicate mapping errors) 2004-01-15 Jens Granseuer * editor/*: move cfed over to tools/. Also convert it to C++ in order to more easily reuse code from crimson and comet * src/cf/*: major restructuring in preparation for i18n * src/comet/extwindow2.cpp (NewMissionWindow): selecting a different unit set always changed the tile set name instead * levels/GreatBattle.src: remove bogus newlines 2004-01-10 Jens Granseuer * src/cf/game.cpp (HandleLMB): allow pointing the cursor to enemy units even if there is an active unit. This was a bug in the single-click selection implemenation 2004-01-10 Jens Granseuer * src/common/widget.cpp (PrintTitle): when calculating the shortcut position, don't count individual character widths but use the entire substring * src/common/lset.{cpp,h}: support unit names in different languages * tools/mkunitset.cpp: renamed mkunitset.c. Now supports multiple languages as well * tools/default_units.c: added german unit names * src/cf/game.{cpp,h}: don't use hardcoded keys for actions accessible from the game menu. Extract them from the button labels instead. Use F1 for the game menu itself and F2 for Next Unit (should be customizable, too, really) * doc/crimson.xml: update the manual accordingly 2004-01-09 Jens Granseuer * src/common/lang.{cpp,h}: add localisation infrastructure * tools/mklocale.cpp: add tool to create language catalogs * src/cf/msgs.h * src/comet/msgs.h: add headers with string ids * src/cf/options.h: add a language option * src/cf/main.cpp (init, init_locale, load_settings, save_settings): add support for loading strings from an external file * src/common/fileio.cpp (get_locale_dir): new function * src/{cf,common}/*.{cpp,h}: use MSG() macro to obtain GUI strings 2004-01-08 Jens Granseuer * src/common/fileio.{cpp,h}: add a new file abstraction, and use it everywhere * src/common/strutil.{cpp,h}: create string utilities * src/common/fileio.{cpp,h} (create_files_list) * src/common/filewindow.{cpp,h}: move function over to static FileWindow::CreateFilesList() * src/cf/initwindow.cpp (constructor): update user 2004-01-07 Jens Granseuer *** release Crimson Fields 0.3.8 *** * NEWS: update * configure.ac * src/common/globals.h: bump version * editor/editor.c (check_events): for 'haveunit' and 'havebuilding' triggers only complain that trigger conditions are already met if there is no dependency on another event * src/cf/game.cpp (SelectCommand): add hex parameter * src/cf/game.cpp (HandleLMB): new method. Unit selection (with a few exceptions) now requires only a single click * doc/crimson.xml: update manual accordingly 2004-01-05 Jens Granseuer * editor/editor.c (parse) * src/cf/player.cpp (Player, Save) * src/comet/mission.cpp (Player::Load, Player::Save): fix an ancient (and obviously reproductive) bug in player persistency * levels/BeachRaid.src: don't use obsolete shop type 'mine' * src/common/widget.cpp: include an activation key designator in the widget title. This should make translations a bit easier. 2004-01-04 Jonathan Phnix * src/cf/initwindow.cpp * src/common/sound.cpp (PlayMusic): properly #ifdef sound bits so that building without SDL_mixer is again possible 2004-01-04 Jens Granseuer * src/comet/mission.cpp (Save, SetPassword): don't forget to save the password and set the proper flag 2003-12-09 Jens Granseuer * src/cf/history.cpp (Replay) * src/cf/initwindow.{cpp,h} (GeneralOptionsWindow) * src/cf/main.cpp ({load,save}_settings) * src/cf/options.h: add quick replay option, showing combat results only 2003-12-01 Jens Granseuer * levels/Anthill.src * levels/Makefile.am (EXTRA_DIST, levels_DATA): add new map "Operation: Anthill" by Chang Tang Yen, use variable substitution to generate the EXTRA_DIST listing * src/cf/history.{cpp,h}: clean up * src/comet/eventwindow.cpp (EdTrigHaveShopWindow): don't ignore events from the player widget * src/comet/mission.h (Player::SetName): fix length and terminate with NUL character * THANKS: update 2003-11-22 Jens Granseuer * src/comet/extwindow2.{cpp,h}: add widget for setting crystal output in shops * src/common/gamedefs.h (BLD_MINE): remove * doc/cfed.xml * editor/editor.c * src/cf/building.{cpp,h} * src/comet/building.{cpp,h} * tools/bi2cf.c: stop using it 2003-10-07 Jens Granseuer *** release Crimson Fields 0.3.7 *** * NEWS: update * configure.ac * src/common/globals.h: bump version * src/comet/mission.cpp (Validate*): eliminate use of deprecated ostrstream class 2003-10-03 Jens Granseuer * src/comet/edwindow.{cpp,h} * src/comet/eventwindow.{cpp,h} * src/comet/extwindow2.{cpp,h}: do not initialize static class variables in header files for improved portability 2003-10-02 Jens Granseuer * src/comet/extwindow2.{cpp,h} (EdMissionSetupWindow): add new window for general mission settings * src/comet/edwindow.cpp (ShowContextMenu): use it 2003-09-30 Jens Granseuer * src/comet/eventwindow.{cpp,h} * src/comet/extwindow2.cpp (SelectEventWindow): support event creation and editing for all event types * src/comet/mission.{cpp,h} (Validate, ValidateEvent, ValidateMap): add new methods to verify mission integrity * src/comet/edwindow.{cpp,h} (ShowContextMenu, ValidateMission, WidgetActivated): use them 2003-09-27 Jens Granseuer * src/common/button.{cpp,h} (MenuButtonWidget) * src/common/extwindow.{cpp,h} (MenuWindow): add keyboard navigation support * src/common/textbox.cpp (TextScrollWidget::SetText): fix for NULL string * src/common/textbox.cpp (StringWidget): if the widget gets deselected, always show the beginning. If the widget is selected via key, jump to the end * src/common/window.cpp (DrawBack): remove clip rect handling as it's already done in Surface::FillPattern * src/comet/edwidget.{cpp,h} (CycleWidget::SetValue): add * src/comet/Makefile.am (comet_SOURCES) * src/comet/eventwindow.{cpp,h} * src/comet/extwindow2.{cpp,h} * src/comet/mission.{cpp,h} * src/comet/uiaux.{cpp,h}: add initial (partial) support for event editing 2003-09-25 Jens Granseuer * doc/comet.xml * doc/Makefile.am: added basic CoMET manpage * src/cf/initwindow.cpp (InitWindow): correctly disable the AI and PBEM widgets if the other mode is set 2003-09-21 Jens Granseuer * crimson.spec.in * gfx/Makefile.am: install application icon * gfx/CFIcons.bmp: update unit info icons * src/cf/game.h * src/cf/main.cpp: remove some global icons * src/cf/mapwindow.{cpp,h} (Draw, DrawUnitInfo, MapWindow, Panel) * src/cf/unitwindow.{cpp,h} (ContainerWindow, Draw, SwitchMode, UnitListWidget): make them local here * editor/editor.h (MAX_MAP_{WIDTH,HEIGHT}) * src/comet/extwindow2.cpp (NewMissionWindow): increase maximum map size to 250 x 250 2003-09-13 Jens Granseuer * src/common/listselect.cpp (Select): fix item offset when scrolling 2003-09-12 Jens Granseuer * src/cf/ai.{cpp,h} (SameDirection): add * src/cf/ai.cpp (CommandUnitDefend): be a bit more aggressive and always try to get between the enemy and the objective to defend * src/cf/main.cpp (init): set icon caption to "Crimson Fields" * tools/default_tiles.c: make warehouse block movement 2003-09-08 Jens Granseuer * gfx/CFIcons.bmp * gfx/crimson.png * gfx/Makefile.am (EXTRA_DIST): add application icon * src/cf/main.cpp (main, init, set_icon): use application icon * src/common/surface.cpp (GetColorKey): return a Color instead of an Uint32 to make it work across different surface formats 2003-09-04 Jens Granseuer * src/cf/main.cpp (main): fix potential mem leak when the --level parameter was used and loading the map failed * src/cf/main.cpp (init_data): set default pen colors for pre-menu dialogs * src/common/view.cpp (Refresh): use white color for partial background fills. Fixes black border on title screen (reported by Tero Pelander) crimson-0.5.2.orig/INSTALL0000600000175000017500000002772710531352012013341 0ustar uweuweTo compile or run Crimson Fields you need to have the following dependencies installed: SDL (>= 1.1.5, http://www.libsdl.org) and its companion libraries SDL_ttf (http://www.libsdl.org/projects/SDL_ttf) SDL_mixer (optional, http://www.libsdl.org/projects/SDL_mixer) SDL_net (optional, >= 1.2.6 highly recommended, http://www.libsdl.org/org/SDL_net) To generate man or HTML documentation from the DocBook XML files you need xsltproc from the libxml2 package (www.xmlsoft.org) and the DocBook XML DTD and XSL stylesheets (or an internet connection). Further you just need make and a decent C++ compiler (like g++). If you meet the requirements, a simple ./configure make make install should do the trick if you have write access to the installation directories. Type 'crimson' to run the game. There are some configuration options apart from the generic ones (see below) which you can pass to the configure script: --without-zlib Some of the data files for the game will be compressed if zlib is available. If you insist on uncompressed files for some reason, you can use this option to disable the use of zlib. If you compile with zlib enabled you can of course also read uncompressed data files. Note: Maps and saved games are currently never compressed, so in most cases a non-standard decision won't harm your ability to exchange levels or play PBeM matches (tilesets ARE affected, though, in case you are using custom ones). --disable-network You can use this option to exclude TCP/IP networking functionality from the build. If you don't have SDL_net installed networking will be disabled automatically. --disable-sound Using this option causes all audio code to be skipped when compiling, i.e. you won't have sound (probably guessed it already). If you don't have SDL_mixer installed sound will be disabled automatically. --enable-cfed 'make install' by default does not install the editor or the other tools which you only need if you want to play around with the in-game graphics. If you want the editor to be installed as well, call the configure script with this option. If you also need the other internal development tools, you will have to copy them to your binaries directory yourself. --enable-comet CoMET is the Crimson Fields Map Editing Tool. It is a graphical level editor which is currently in alpha stage and therefore not enabled by default. CoMET will eventually replace cfed, but right now it is only useful if both tools are used together. --enable-bi2cf With the help of the bi2cf program you can convert maps from Battle Isle, both of the official data disks, and History Line 1914-1918 to the mission file format used by Crimson Fields. To do so you need the original level files. See the file README.bi2cf for more information about this tool. --enable-cf2bmp cf2bmp is a small utility to create BMP images from Crimson Fields map files. Generic installation instructions follow. ------------------------------------------------------------------------- Basic Installation ================== These are generic installation instructions. The `configure' shell script attempts to guess correct values for various system-dependent variables used during compilation. It uses those values to create a `Makefile' in each directory of the package. It may also create one or more `.h' files containing system-dependent definitions. Finally, it creates a shell script `config.status' that you can run in the future to recreate the current configuration, and a file `config.log' containing compiler output (useful mainly for debugging `configure'). It can also use an optional file (typically called `config.cache' and enabled with `--cache-file=config.cache' or simply `-C') that saves the results of its tests to speed up reconfiguring. (Caching is disabled by default to prevent problems with accidental use of stale cache files.) If you need to do unusual things to compile the package, please try to figure out how `configure' could check whether to do them, and mail diffs or instructions to the address given in the `README' so they can be considered for the next release. If you are using the cache, and at some point `config.cache' contains results you don't want to keep, you may remove or edit it. The file `configure.ac' (or `configure.in') is used to create `configure' by a program called `autoconf'. You only need `configure.ac' if you want to change it or regenerate `configure' using a newer version of `autoconf'. The simplest way to compile this package is: 1. `cd' to the directory containing the package's source code and type `./configure' to configure the package for your system. If you're using `csh' on an old version of System V, you might need to type `sh ./configure' instead to prevent `csh' from trying to execute `configure' itself. Running `configure' takes awhile. While running, it prints some messages telling which features it is checking for. 2. Type `make' to compile the package. 3. Optionally, type `make check' to run any self-tests that come with the package. 4. Type `make install' to install the programs and any data files and documentation. 5. You can remove the program binaries and object files from the source code directory by typing `make clean'. To also remove the files that `configure' created (so you can compile the package for a different kind of computer), type `make distclean'. There is also a `make maintainer-clean' target, but that is intended mainly for the package's developers. If you use it, you may have to get all sorts of other programs in order to regenerate files that came with the distribution. Compilers and Options ===================== Some systems require unusual options for compilation or linking that the `configure' script does not know about. Run `./configure --help' for details on some of the pertinent environment variables. You can give `configure' initial values for variables by setting them in the environment. You can do that on the command line like this: ./configure CC=c89 CFLAGS=-O2 LIBS=-lposix See "Environment Variables" for more details. Compiling For Multiple Architectures ==================================== You can compile the package for more than one kind of computer at the same time, by placing the object files for each architecture in their own directory. To do this, you must use a version of `make' that supports the `VPATH' variable, such as GNU `make'. `cd' to the directory where you want the object files and executables to go and run the `configure' script. `configure' automatically checks for the source code in the directory that `configure' is in and in `..'. If you have to use a `make' that does not support the `VPATH' variable, you have to compile the package for one architecture at a time in the source code directory. After you have installed the package for one architecture, use `make distclean' before reconfiguring for another architecture. Installation Names ================== By default, `make install' will install the package's files in `/usr/local/bin', `/usr/local/man', etc. You can specify an installation prefix other than `/usr/local' by giving `configure' the option `--prefix=PATH'. You can specify separate installation prefixes for architecture-specific files and architecture-independent files. If you give `configure' the option `--exec-prefix=PATH', the package will use PATH as the prefix for installing programs and libraries. Documentation and other data files will still use the regular prefix. In addition, if you use an unusual directory layout you can give options like `--bindir=PATH' to specify different values for particular kinds of files. Run `configure --help' for a list of the directories you can set and what kinds of files go in them. If the package supports it, you can cause programs to be installed with an extra prefix or suffix on their names by giving `configure' the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. Optional Features ================= Some packages pay attention to `--enable-FEATURE' options to `configure', where FEATURE indicates an optional part of the package. They may also pay attention to `--with-PACKAGE' options, where PACKAGE is something like `gnu-as' or `x' (for the X Window System). The `README' should mention any `--enable-' and `--with-' options that the package recognizes. For packages that use the X Window System, `configure' can usually find the X include and library files automatically, but if it doesn't, you can use the `configure' options `--x-includes=DIR' and `--x-libraries=DIR' to specify their locations. Specifying the System Type ========================== There may be some features `configure' cannot figure out automatically, but needs to determine by the type of host the package will run on. Usually `configure' can figure that out, but if it prints a message saying it cannot guess the host type, give it the `--build=TYPE' option. TYPE can either be a short name for the system type, such as `sun4', or a canonical name which has the form: CPU-COMPANY-SYSTEM where SYSTEM can have one of these forms: OS KERNEL-OS See the file `config.sub' for the possible values of each field. If `config.sub' isn't included in this package, then this package doesn't need to know the host type. If you are _building_ compiler tools for cross-compiling, you should use the `--target=TYPE' option to select the type of system they will produce code for. If you want to _use_ a cross compiler, that generates code for a platform different from the build platform, you should specify the host platform (i.e., that on which the generated programs will eventually be run) with `--host=TYPE'. In this case, you should also specify the build platform with `--build=TYPE', because, in this case, it may not be possible to guess the build platform (it sometimes involves compiling and running simple test programs, and this can't be done if the compiler is a cross compiler). Sharing Defaults ================ If you want to set default values for `configure' scripts to share, you can create a site shell script called `config.site' that gives default values for variables like `CC', `cache_file', and `prefix'. `configure' looks for `PREFIX/share/config.site' if it exists, then `PREFIX/etc/config.site' if it exists. Or, you can set the `CONFIG_SITE' environment variable to the location of the site script. A warning: not all `configure' scripts look for a site script. Environment Variables ===================== Variables not defined in a site shell script can be set in the environment passed to configure. However, some packages may run configure again during the build, and the customized values of these variables may be lost. In order to avoid this problem, you should set them in the `configure' command line, using `VAR=value'. For example: ./configure CC=/usr/local2/bin/gcc will cause the specified gcc to be used as the C compiler (unless it is overridden in the site shell script). `configure' Invocation ====================== `configure' recognizes the following options to control how it operates. `--help' `-h' Print a summary of the options to `configure', and exit. `--version' `-V' Print the version of Autoconf used to generate the `configure' script, and exit. `--cache-file=FILE' Enable the cache: use and save the results of the tests in FILE, traditionally `config.cache'. FILE defaults to `/dev/null' to disable caching. `--config-cache' `-C' Alias for `--cache-file=config.cache'. `--quiet' `--silent' `-q' Do not print messages saying which checks are being made. To suppress all normal output, redirect it to `/dev/null' (any error messages will still be shown). `--srcdir=DIR' Look for the package's source code in directory DIR. Usually `configure' can determine that directory automatically. `configure' also accepts some other, not widely useful, options. Run `configure --help' for more details. crimson-0.5.2.orig/NEWS0000600000175000017500000003455310730254744013020 0ustar uweuwe* 0.5.2 (13-12-2007) - added animation effects when moving and choosing targets - improved portability - updated translations: de, fr, pl * 0.5.1 (22-01-2007) - added two more maps, 'Baptism of Fire' and 'The Shores of Lake Yukarwa' (Yalwa campaign) - fixed campaign mode when resuming saved games - fixed handicap settings not being kept in campaign games - improved handling of connection problems in network games - improved i18n support for non-ASCII glyphs - extended destroyunit event to support location in addition to id - new partial translations: Italian and Serbian - updated translations: de, pl, sk * 0.5.0 (08-12-2006) - added TCP/IP networking (requires SDL_net) - added new map 'Clipped Wings' (Yalwa campaign) - added partial Hungarian translation - added new event 'destroyunit' - added new mountain tiles, and enhanced several others - improved portability * 0.4.9 (13-10-2005) - added third tutorial mission - fixed shops becoming inaccessible after moving a transporter out - fixed bogus line numbers being reported on parsing errors in cfed - added new event trigger 'havecrystals' - changed loading mechanism for crystals to be more like that for units * 0.4.8 (08-06-2005) - added second tutorial mission - transporters can now be loaded before leaving a shop/transporter - repairs now cost 1 instead of 0.5 xp per recruit - Hovercraft can no longer cross forest tiles - fixed unitposition trigger when used with shops - extended unitdestroyed trigger to support unit classes - hex hit testing is now pixel-perfect - added desktop file * 0.4.7 (21-02-2005) - fixed railroads being impassable - added single-step undo - added first mission of a tutorial campaign - triggering events can now obsolete other events - replaced broken 'nextmap' event with more versatile 'configure' - extended 'createunit' and 'research' events - added cf2bmp utility to create map images - updated Polish and Slovak translations * 0.4.6 (18-01-2005) - added new maps 'Radio Silence' and 'Swords and Plowshares' (Yalwa campaign) - fixed crash related to mine sweepers - improved path finder resulting in much faster computer turns - updated Polish and added Slovak translation - added random terrain generation in CoMET - improved map scrolling in CoMET - rewrote stuff in tools/ so that no source files have to be touched for new languages/units/tiles anymore - various minor bugfixes * 0.4.5 (14-10-2004) - replaced 'The Uprising' with a new implementation, marking the start of the Yalwa campaign - improved event handling - added new event 'settimer' and extended 'message' - slightly improved computer player - fixed two crashers in CoMET - updated French and Polish translations * 0.4.4 (27-08-2004) - added new map 'The General' - added first bits of a French translation - added new event 'sethex' and extended 'createunit' - replaced trigger 'turn' by 'timer' and extended 'unitposition' - newly created units now appear in turn replays - added basic message creation facilities to CoMET - renamed --enable-zlib configure parameter to --with-zlib - fixed a score of minor bugs and compiler warnings * 0.4.3 (11-07-2004) - added new map 'Across the Omyar Gorge' - improved localization support for ISO-8859-2 locales - added Polish translation - added quick scroll via number pad and NumLock - added a way to recover from the password dialog - fixed build issues in non-graphical environments * 0.4.2 (20-04-2004) - actually applied the map switching fixes (doh!) - fixed compilation for Mandrake 9.1 and Slackware 9.1 - revamped campaign system - added support for difficulty levels (handicaps) - added player selection when playing against the computer - added default mission soundtrack - 'createunit' events now work with arbitrary locations - added support for changing squad size and initial xp for units - added 'handicap' trigger - lots of minor fixes and featurelets * 0.4.1 (02-03-2004) - fixed crash when switching maps in campaign games - fixed progress bar updates in replays and respond to abort requests - fixed a long-standing bug with move-shading sometimes shading too much - return to main menu in PBeM games if given the wrong password three times in a row * 0.4.0 (22-02-2004) - now requires SDL_ttf - added support for i18n/l10n (see README) - added German translation - added new map 'Heavy Metal' - the start window now features a small map display - changed game window key from g to F1 - partly reverted the single-click changes - added 'othermsg' and 'othertitle' properties for score events - rebalanced some units * 0.3.8 (07-01-2004) - added new map 'Operation: Anthill' - added an option to show only battle results in replays - units can mostly be selected with single clicks - fixed building without SDL_mixer - fixed an obscure memory addressing bug - fixed several bugs in CoMET * 0.3.7 (07-10-2003) - fixed occasional black border of the title image - plugged potential memory leak - improved computer player defense - increased maximum map size to 250 x 250 - added keyboard navigation support to menus - added application icon - added event creation and editing to CoMET - added support for general map settings to CoMET - added a validation function to CoMET - added basic CoMET manpage * 0.3.6 (03-09-2003) - fixed password protection in campaigns - fixed unit export order in CoMET - added support for Windows CE (crimson only) - current resolution shows up in video options, duplicates do not - improved tactical map for small displays and large maps * 0.3.5 (07-08-2003) - added new map 'Revelation' - added support for event dependencies - fixed movement display of units at the edge of the map - fixed CoMET garbling messages when saving - solo missions saved with CoMET can be played against human opponents * 0.3.4 (29-06-2003) - added new map 'Mountain Defense' - you can no longer change the game mode of saved games - fixed building with non-GNU make - fixed event saving in CoMET - increased effect of roads - modified combat results display for clarity - added getting started section to crimson manpage * 0.3.3 (25-05-2003) - fixed bi2cf event generation - fixed sound problems on big-endian systems - added an option to skip turn replays - added crystals section to crimson manpage - added factory configuration support to CoMET - new title image - converted manpages to DocBook * 0.3.2 (06-05-2003) - fixed creation of saved games directory (fixes saving on Windows) - added new map 'Lankh Valley' - cfed and CoMET now support custom sets of units and tiles - added damage indicators and an option to disable them - added sound options menu - added some new and improved unit icons and images - toggle fullscreen mode with Alt-Enter instead of F12 - fixed some compiler warnings - more CoMET improvements * 0.3.1 (25-03-2003) - added unique event identifiers - added event 'manipulateevent' - changed production events to mining and research - bi2cf can now handle .FIN/.fin and .SHP/.shp - some more work on CoMET * 0.3.0 (02-01-2003) - changed map format for better compatibility with BattleIsle maps - added 'LostFactories' and 'BeachRaid' maps - added aircraft carriers, mine sweepers, and trains - added lots of new terrain images - crystals and units share the same space in transporters - added unit size limits to buildings - separated unit data and terrain data - use zlib for compression of image data if available - added mouse wheel support to scroller widgets (requires SDL 1.2.5+) - added support for 320x240 resolutions - fixed possible crash in overview window - added progress indicator for computer player - added raw map format support to cfed - added new tool 'bi2cf' to convert maps from BattleIsle to CF format - in campaign games only advance to the next map if human player won - included first bits of 'CoMET', a graphical map editor - fixed VPATH build - lots of minor and internal changes - removed outdated VisualC project files * 0.2.8 (29-10-2002) - fixed crash when trying to save maps with long names - fixed signed vs. unsigned char issues (Debian #159344) - show correct amount of crystals in transporters - improved slider behaviour * 0.2.7 (25-08-2002) - added new maps 'Island Hoppers' and 'Operation: Foxhole' - AI is now able to use transporters in many situations - AI tries to be smarter when determining the order of unit movement - maps can now be installed in $HOME/.crimson/levels/ - fixed handling of recursive transports in turn history - fixed crash when trying to load arbitrary files as maps - fixed program aborting when audio device could not be opened - don't drop messages for final score events - units created by the 'createunit' event are no longer disabled on their first turn - added support for images in unit info dialogs - 'unitdestroyed' trigger supports selection of player for tunit = -1 - plugged some more memory leaks - corrected some map tile definitions to actually match the docs - some build-related updates and corrections * 0.2.6 (02-07-2002) - fixed an index out of bounds bug turning arbitrary hexes into plains - computer didn't consume crystals when producing units - single player maps can also be played against a human opponent - reduced repair costs to 5 crystals - added title screen - several minor fixes * 0.2.5 (19-06-2002) - fixed occasional crashes during combat - fixed units not being able to move into transports in some situations - fixed ships sometimes not being able to target other ships - fixed turn history display for PBeM games - plugged a memory leak - computer player now utilizes factories - repairs now require a fixed amount of 10 crystals - replaced event 'switchmap' by similar event 'nextmap' - added new event trigger 'unitposition' - added support for campaigns and map passwords - added four more road tiles * 0.2.4 (07-06-2002) - fixed computer stomping on enemy units bug - fixed path finding bug for stationary units - players can now inspect neutral buildings - added new map 'The Great Battle' - added new event 'switchmap' - added editor error check for messages section - miscellaneous AI fixes and improvements - reduced penalty for ranged attacks - build fixes for OpenBSD - maps and saved games now listed in alphabetical order - continued internal reorganization * 0.2.3 (25-04-2002) - added unit cycling ('n') - removed dialog box at the beginning of AI's turn - made file parsing in editor a bit more robust - plugged a memory leak in the editor - added first sound effects (SDL_mixer required) - show names of buildings at cursor position - some internal changes - added THANKS and TODO * 0.2.2 (17-11-2001) - fixed crashes on Windows 9x/ME - video mode can be changed on the fly - plugged two small memory leaks - new bomber graphics - marginally improved computer player * 0.2.1 (21-10-2001) - fixed a nasty map loading bug * 0.2.0 (08-10-2001) - new combat system - added simple computer opponent - save game dialog couldn't be aborted - fixed turn history not being displayed after loading saved games - fixed fullscreen crash on Win32 - units are correctly marked unavailable after repairs - fixed replay order when conquering buildings - added a bit of eye candy to the GUI - mission set files now also define unit sounds - added --sound command line parameter - F11 toggles audio state * 0.1.6 (08-08-2001) - improved sound framework - minor changes to the user interface - support Win32 platforms - fixed a few compiler warnings * 0.1.5 (22-07-2001) - show enemy's last turn at the beginning of a turn - current settings are saved on exit - F12 toggles fullscreen mode - fullscreen command line parameter now takes an additional argument (0 or 1) - fixed a bug which caused blocking units to actually support the attacker as well as the defender - corrected some unit definitions - more than 12 units allowed in buildings - slightly tweaked unit movement - fixed a bug in the list class - fixed cfed bugs in haveunit and havebuilding triggers - if mission briefings are to be shown on the first turn they must be created manually as 'message' events - removed Assault Tanks - mission and save file format changed - upgraded to autoconf 2.50 - continued internal restructuring * 0.1.4 (30-05-2001) - fixed a bug causing random first-round wins - ask for confirmation before overwriting existing save files - disabled in-turn saving in PBeM games - unitdestroyed also triggers events when the unit was captured - added event createunit and trigger haveunit - trigger buildingtaken renamed to havebuilding and extended - made info panel more dynamic - units may start inside a transport - reintroduced --level command line parameter - added --help and --version command line parameters - fixed a few compilation problems and Makefile glitches - internal code clean-up - added man pages * 0.1.3 (30-04-2001) - display depth changed to 16bpp - fog is drawn using per-surface alpha blending - added Play-By-e-Mail support - added sound framework - fixed display not being updated correctly when the viewport changed in the overview map window - display doesn't jump at the start of a turn - fixed map tile definitions - fixed some configure bugs * 0.1.2 (19-04-2001) - levels are now selected using a GUI interface - improved usability of the building and transports window - middle mouse button brings up building or transport window - added keyboard control in a few places - when units are "moved" into a building or transporter they are already in, they are still available for movement on that turn - added overview map - added level information (file format changed again) * 0.1.1 (20-03-2001) - fixed units apparently taking an illegal path - units move from hex to hex instead of jumping - cursor positioned on player's unit instead of top left corner at the start of a new turn - mission briefings can be read from the game menu - missions contain default player settings (file format changed) - added mission briefings - fixed compilation problems on some systems - minor code clean-up * 0.1.0 (01-03-2001) - initial public release crimson-0.5.2.orig/THANKS0000600000175000017500000000230710623351147013220 0ustar uweuweI would like to thank everyone who made Crimson Fields possible, especially (in order of appearance): * Marcus Schreiner, for "The General" * Uwe Hermann, for various patches and the initial version of the man pages as well as maintaining the Debian package * Adam Gates, for the Win32 port * Nils Mller, for contributions to the combat system and additional gfx * Daniel da Rocha Hoppe, for the sound effects * Thorsten Jordan, for "The Great Battle" and "Island Hoppers" * Florian Dietrich, for lots of additional gfx and the bi2cf converter * Laurent Le Guillou, for "The Lost Factories" * Chang Tang Yen, for "Operation: Anthill", "Lankh Valley", and "Revelation" * Frank Fiedler, for additional gfx * Thomas Klausner, for "Mountain Defense" * Maik Stohn, for the Windows CE port * David Fancella, for the soundtracks * Andrej Krivulcik, for the tutorial campaign * Silvio Iaccarino, for maintaining the Windows and PocketPC ports Translators: * Sebastian Gabor, Waclaw Schiller (pl) * Benjamin Power, Benoit Peureux (fr) * Andrej Krivulcik (sk) * Erno Szabados (hu) * Americo Iacovizzi (it) * Nikola Smolenski (sr) and everyone else who sent in bug reports, suggestions, or comments. Thanks! crimson-0.5.2.orig/TODO0000600000175000017500000000073010530131305012760 0ustar uweuweThis is a list of major improvements in no particular order which are scheduled for some time in the future. * create a graphical mission editor [in progress] * more maps [when they are done (TM)] * graphical overhaul (contributions wanted; my design positively sucks) [0.5.x] * more sound effects and music [0.5.x] * improve computer player (better coordination, skill levels) [ongoing] * new tiles and unit sets (e.g. WW2, Winter, Desert) [volunteers welcome] crimson-0.5.2.orig/crimson.desktop0000600000175000017500000000110310553451576015354 0ustar uweuwe[Desktop Entry] Version=1.0 Encoding=UTF-8 Name=Crimson Fields Name[sr]=Црвена поља GenericName=Turn-Based Strategy Game GenericName[de]=Rundenbasiertes Strategiespiel GenericName[pl]=Strategiczna gra turowa GenericName[sr]=Потезна стратегија Comment=Lead your troops to victory Comment[de]=Führe deine Truppen zum Sieg Comment[pl]=Poprowadź swoje wojska do zwycięstwa Comment[sr]=Поведи своје трупе у победу! TryExec=crimson Exec=crimson Icon=crimson Terminal=false Type=Application Categories=Application;Game;StrategyGame; crimson-0.5.2.orig/README.bi2cf0000600000175000017500000000131007727124534014153 0ustar uweuwebi2cf is a map conversion tool for Crimson Fields. It takes the data files of a map from Battle Isle, Battle Isle Data Disk 1 or 2, or History Line 1914-1918 and converts them into map sources suitable for the cfed map compiler for Crimson Fields. Unfortunately, we didn't get permission to distribute the original maps or the modified versions, so you need a copy of one of those games to make use of this program. You can, of course, also convert custom maps which have been created using one of the map editors available for Battle Isle. See the bi2cf(6) man page for usage information. bi2cf was written by Florian Dietrich and is distributed under the GNU General Public License (GPL). crimson-0.5.2.orig/README.CoMET0000600000175000017500000000163110112672602014065 0ustar uweuweCoMET is the Crimson Fields Map Editing Tool. Please keep in mind that this is still a work in progress (and much more so than the game itself). Currently, the editor is considered to be in alpha state. Most basic features are implemented. You can, for example, create new maps, load, edit and save them, so it can already be a great help when designing missions. One of the major limitations is that you can only create single-line messages in plain ASCII. As a result, CoMET is for now only really useful when used together with cfed, which it will eventually replace. You can do the map layout with CoMET, export the result as a text file, and add the missing bits by hand (see the cfed documentation for details on how to do this). CoMET can read the binary level files created with cfed, and you can make modifications to them. Even settings not yet supported by CoMET should remain intact during this procedure. crimson-0.5.2.orig/VisualC++.zip0000600000175000017500000024051110560144725014530 0ustar uweuwePKl5Zj. crimson.sln͚n6 wM 肤ȶh30&t3Vu+t>R_kl<v1@HStP#8&eQ)ܹӬp|^gQYwTQޏxw/0.Ge{:/OXHN>C`DE3,bW{b6x ry>N4}aaJ1]Ƒq$BD^1%r6]F1/y1iZE^}^l趟7͈h8-F'bgûN~^~z 0JBm6v/ b3{ӻ[= ۦyȴc*n `Cϳ|6j! /ڗ[@֦@{,3G|iRTǴgGs3oikvo+DR^e/zfg3o:t8?iw RP0J.Ķ+e򲣻!xg,0 Ʋr3^.Im$gF?r8ˁ, .7Sr˻\Yq{.ON;r ˂{&a.6yV\nq!.ӎȲr3^.I `}or.,La&.Bls9g&3{7p9rˆˍ$aVCyvޱ|6wy?Ko1akIKՏҾۍ?n /0Lv$Y̽Z;/pSieYCZ֫S~̦br-M>U$4:*f 4z-C4G=p&O70G)hW!V*V=PKI]5= gfx/comet.ico?hGǟ2Icy*<58SI A`P&oi t乤`8O ]G"S]Ȝ丩jjY:'NYI﷞Gq;/sss2??/ $.kkk*oTNH08 C„`p08: (ppġyzZG)))IaIˀyxXҲp`1Kapx< 5-!uru(8{׼0 f IKvĩo[,C!m;Su#0DE"zik5pD`biaD "%20Q$ac=D[bv!0(  0CAaP" 0( @j:qAPG)=bjXnK!?lmm񱜜驜Ȼ?Tv?:z5 _lԴtןwFsP䷺$uS'vW:z8~e?l4t5VoAZ\_fϊ+(o̘f~iTlt\.PYz_W+kELf*bI|ʋ5T%}}⑍^^L3x:7Z濺W`~UC$Z{?F@5ߨ$W?GIz>[;}i6'~v'R^ߡO έ;uPK ]5b-K gfx/comet.pngQle~lˈΈ빅:~x;[Xڔ[=FQ7,t6pK9h-$-t3@QPS46Ԩ 3f 9Sl}{mny ŏ>ᛅu;sh@B4*b6Iee2siFpj֟j.#R$^Č("L'RdW&W &x"HdM0fMK#T^JPM(2i9,4t2EQUUt "F`"BM 1 i R C8FC䂈80QM!#8hȸ@"QH!(CIRCH?ȑhl+a-+YQ?hq}DZjzkydRhc#,7tTtx+K熽On$Z+k-TwG L2o=;e@lo J߶,.5XE<[;|AOuv^;~S3+8$ucM֕߫ƺS/ciPK]q5.+Vy>gfx/crimsonsync.icoc``B   @ q8H3b27fTgUc T`^Ƞ ", k/π Pi @U UK\V-``b*IbdXƶ%~YJJ@K#PTEDYC>PKGw5=91W gfx/setup.ico|wXUWS4o1c^b,A4Xb']5*DQTHtM*f=sy&[ΞZf~3kt0q"`7  }rd7-IϤ. yW;xb==@cc@3Sh22CʵVVdahk B7ܽtή]D_QTtrG]Ժunn`w4ony^^ vt)hTTHf7<6˃.(Ƃ݋HKK#o߆%s&'Q yyppNH " χ,zx[[a%PTX--P_qq`|?F \64@SX(4EEBMB<R7M t A5}}E4T$C9A1CEA>DBm'P2 |}JA>؝FBxp YE>Ly~{Po )x(R̠!.=CCxV r#whc$Xރ46UPG;%b]<+"=@hb-5h< ,.ÝʼT@X5!-5 W]?k\A+=t XoP02pLrU`sM΅щ0 ,qh)0N,SD&X dSeeePBv& rrr ++ ^| Lv* [#[ ?y5FkőƣG@__Μ9G={N[\iӦ?(]?5_*imܩ~hl| {C٦^ԧMfm|ɺ <^&imąC7Ou߾EitM6iG7֯y)f]^a CK^T^@sC\uu7a:dgC]M]&LWoסlC0ZBtd-cğu5nkGn;gsP^"{Į?vTʟ=qtJKK5߭2矎ʳg:0Dj/OiϞ={|]a:8%QLwGUן9j?!6b,i_=`@߮]ew߰J@EԔJ2+ӝѵFUi0jAƟgsw'ѪQᖁA tP%mJ50;M?-˻~6:ܗ ZFFFf}]ؼsu:ܺsNf?q|mv]Li3=|>?6w6ݻ`4ʭ{yA(..Mh7n>֡8;Q2+k?{'|vُ}=Y͎?xճfRn^"|vv{;?`F)s;vVx~M^[fpkt^:vh;q(C->c>:,U!XT!rpԬ]ø-OզBO//oogi\!Mqo[eYYE@g^XCnE흰yOGY):xnܘͽXKv~;Wl4sɑu( .vzy5I*6PsZ2}p 7m1o? mT^["Ço2jRjk;CJg߹s̘]&Lr aS]cu5sv|>AQQqeA.铧Yyx\-lLn]VWߪ(eW37'{Kk;W )r.\pI')ȳ`Sxfή3N:o/._7<0}cIٳ;~Um3vEVoe_Rct4zCKnܸv+Ëc-c/T%~@Te$p"T~ޱ ?lCVӍZ@*4ru᯽^v{W2y}ڇv㯀~E_vxeE߷7H9mn>x>4pjeMD9IP0LLF|^KVAh!mDNgςɓptjʧ<͞~"4A;$[[ajڞUc^ ޿-\ O0)ggøѣ++! (>['UU|)GI46B\L ,\6h5t?Ҁ 1z jB19cc1!yhmQAP- w"4z@U7$y8B5>PD`SRk{rPW)PURB;GzBb!]4wO}E9{ego&K7DyCu (NrQd! ҄{5[oD`.ph)MɳgMr _71h΄ϡ2ٞyn %NJ4>zАl f4&Wxjv@q ~ ԁ H y/!%! QA]}f(*BZe;@Dy|fp5c7zv>`8>&Ū0ؠ6l (2rH8((**(Cn5KtS ͭP3 %5 JPٹiYBiA,ZgHKKr[˲id @) ĐEn޼ ðeX|9̜9F*O]2=~ղu foS.hkyu{uWKZgÔiL%՚j^?f0f3[1|ͨoP>E##U#>hBCMCC%k@7Sihxy&PMFwJ-hw8- ,iM}nٍ~aaF!!n^NELmu7?8vr{nVi0}zkзǧ)_gݏ|gЖ#'kήkN<_Q\SpYddDԴAӷ Q~%S,gA|WӧO2h]}M{붃tZcO)'41M?_N2b)~a% ii)iߗջG1p`#{)%9ի4P?^XfXG+F}/};VW*ڟUiIW& K!EXO]x잌C#&<ؿQC? !Iۑᔾ ViX@q=ūh OlS" " 6O]/*jlQt?3 Єp fjbh\44z+aC|ttm޷%n:+~n D[XcǠM@c.;y2̞4IZ#'l Dſ E(ŭ[%h&L`iZp'Gp A.M@q^.9Y@1iS~QAap:1٭u mNq? ?6k`RAk i|bṽxB=h !cPhD8 B}P%`o4V{-PІW5Z2̡i HX[@mᇽC 0ziA}:#4!5. j^BQSa^TF@SM.T%;䉓aOp^ <&/55 UTp4Hn_Ս?S`A  YՊY# 7n܀ׯ?Չis U%%%VZ0k,2e P" ǏqqFKn[ߏ;nʴ^7nX1`_L~<_o~>jܙ֏W3bu gW}Ǟ.Ə_h}VSZÆ>y⌆_~;yzϝVٳuD&~EXt.l]{͒у}abS[^M=)[[ZCc*ck\o-'QjufՋ8VOЫGOEG)A4D*D/f Dݥ4Gk]z#}M)߶.3F̘16EhBiA?$AtyIDCW}}Şɧ[1a8_mg_ŋr\QGGɧYbܹC ݻ%azџD@Z`56ߢOXQfM"Fǖ//ZM3r@OOto׏_nݺ;wPAaab[s'JKMBgx7nYpaI_#/5cLu3g_WTy׮GPBcxu˖ ⨟?7 9{uv*rvvƸ8 >{IT\hkϪΝ;[V\Y2o3k֔Z>i# #FE!#"ff"#c]a!_f߳mzyd(ԄQ?LEC)Ř`n4FFF?^~)"# 9y袉>LrcD[[D'ӡ+Є.&m=l߾]ܜ^L vS]O@--od2B򁷷oo)/u;v(XXX`PPҐxzfi^:|Ǻ'kCk/83Yɧk4񡽑PD~xiLDNo;_,eeҜ5`SX(6EEbhIGߐ_EEE梢N:N% pp3boS0=wN9~anr]/^b{s8m0wqq!WI2&];y%:I| WtC;oM1/!3R_#FLݻ8Om4'N=3FpcQO !jڀ%NX*/|YAei,z_~MM)C?uTUUb5NMNX88b;w ln]!_蔃;vLF'{qV'O; ˽&\BALd~5bwʁ?2SqWnRW|G^ol^"l:4?`yq. gϞ8rk@ki}$WAԁ~>R&vٰ!Ĝ6mQp,+̢DŽHšh] DЎ|X`#t;v (*4hoZ#>y򤂿?W311cXŰG4v3ɧ-չlBW\3LD |ٵkx{⡚Wsy/Y .r=וC)k.Íff>t Ѵ?(ՓvHm6N[0sR+DHF 4QVFE,ד}x{)@fd[}s\v=-:jn}s1ᎊD&?Nj44g_bt|lFcmwh9_WZ1{>cdgM]]]~Xpcc#'oc~J|}a!}:sIYTaAv^u6HOHh1 jKϰJ~_ዏ ˖N&^L޲(4Vk?ҁ墙üP,Pfsrק-\i,x4Kar2,̖2{}>XHلioޑX90ۥ(7n{9m:4#Ds䇭Gۓ'9^gHxɴs_ou`9={ IQ?;>It hjSʇ{>|]ՂoQNDq=d~lliʕfרž߉6DŽdG%K /llN9>ێSLb+C]wVzƨ{71@[e00<&{,'cal3 hgm_~=GRZ+Ǚ5(tʎҽR^! (!DL@䌵vXkOX m01gfc!|}(|²e˒Iז?>NgsڑZt+Qj@C  | M.4^ K0LJr5V4&R$lmckʎt|dY'tߓߤuc)f'; [a7fLEb9RsMuOa۷o=_,׭[Y'9YFzqއߡ͛7/ݺu˝bkr;=!1zaGˎY.;𻩩i*]ү&U x [pʕW^@z^q]Ffv= g("Lܼ1Os玒?ae666<琖2>?1vު+k1 /n鈅IGygk>w:UWaU{{;N.]u9&w߯_qt.Gr:^-Ws~(OGbgV+g9˗|څ\Ս_?`ٳg8q|֭SN}kE{;ؚJ4?P_??㏎~G:{wv֢\Tb/18(omؽ{wE2GFxȮk׮?ӆ}prժL#GjC ,-%aSuSWs]$ ( euˊY!)&k0G+}M<}xWK*(?GVe{2qv6>V םy=wܱc,Ogq@IƟ/W&WTǸ."v<,հ2a Q+#̭R?}ug94~e{;{Y;jY̙mvٍߣTb5FOMyAw~&, iLaOOqAt8ZYSn"(yS ֫X%$a{d OєtIpBӪؚmy&##19q12=ĝ*+|a1VfbrK][p-iJ 9"+?ps"j(3ct9q3"Bä!/+cǎ)%&bye5cem)Ƈ=ß1#Fv&<[[# me\36g!􃱑O|==5p 8NTJIf(E:zKt E}DTw?uZ E|v[vQm$jw}FZJY!rI s:&;~/$5&cv]cksXD8M6_G|e)?yϸsJFXv0Z kriï=(&hf~,FEJo~KMmȑZ^yTy0^ rɦN})(PSƈ@cO9d>@1:%TYćC54Ip^u+y卵w/~R;MN 5*,󎲳2 b.j_eޣ_]R­?o`aC$ JF0x)5(܌aW7˕59(!-25^рV's9 )X_5Օ(ΏAq-#u{mf(K5ˍ&se?ݺ:$ӕ6eeʲe+L{ |Rj6X؂mPnI76bmC VֶH܊%54E(M,s(SƊ'KxƠ-Ǭc;bg5]֘pnEdӕ3h~55XY] ,caQ11+3 1%Sɩc[-=?WƟ]Yg~:>ع9ONB'MM~CiƑI#r_ed`/l*%5iܙYǏs|ˆYY/̨gpiQ?}U4ΠzVGžzI5LHDKhBO'M3W9r7^^^ebY%l >-`}0|a}L1w0llf Flή[n,YGw~giIu^/mw5h1^S|!_ "ݱ1k=:6FcUUa%˖|֚S2d$JG()Vr:>bKd >}dYǝw-ѣ9]{br+Y⡈$JdfzP&bIS"ODX ٲukPLPPYx%˳݄ռn޼9-]5=]];۶zm "Cpa;/Ex{}/?e4bcwwt8|8o9^ShÏ~9D [b*L2܊yo_VT:db6օra ٘%U(b{z(Kâħ륅9·mCN1#NMjN D7czA }tt0l1MՍWP**iW1W`k^#,Pٝbk߲4YvcK YPku-rcyӛēihIl&0 GfD,ۃM1Ġ 2f`Ju-L<%Qo1%1.5DG|ѵo{=~=mon#p??kc!'IN(O|Bصk.mFRc8xq?0b~O&wOM5bgGӘ0qēS_O'S$S&OO`L68a1)4cZDc4zor?僆WO0|Ǎ4~?|O7ὴF0_YS'2~7nM6r{gd,yBF(e)F[lq98cXO1gYcׯ5N38C eÿXRdlZشvi0|вYi𳧫CU~,8_7ZЙk\Cz87_#kM|\n|_5dtod4Vv0?=ac'߬o1z1t8#{v{1Ɨotߍ?qݸ׮;F}?7't?ȏ% ǒ?,Qx"h:"(D{9쑃F윌l@O1Ex @P䙟 l%1[xY!B $HQv,$1Cyt+hE&i ug1P/iʢqv%c|U?P$Eh]&Kh$VitEHFb6P0YHb.ᤋ3DK8D.hY bѢֳ41']1CʢVqu:o5X-Zt.#mBbLs1-9E=3c)-P-:"l']ڽ^Es0@s.H,z.EEsB*\{W>ǪEtNG[s"znEkR7QΦ 0t1mxԲ]ŸFزThb1R4unIBM:C%QEtlOWbEyn% .1. /NGH#mFtLmiiiN9wɘt St0l΢h]s Au)u+ȞQE xbBsSR,P3t1 R`bbZ.s׭E&4%εEKN6AN0B_o#~[v:(t1GGzEE?4GEY7 -ǭtsDGF i*Jְ筭]ctEvD{>ӱZtq *UWeV]x3|Tm,ʢiez|"?5M!"}d'ڋFXCQ.‘aFsݒs-l,ClT3bcڄ֚ =0/.Pv|wStAfE l-ڗMKl\l]0B ڢ6"hl-:컱PYJ_ٖrQ9=բBdҚvki5]%cs6}y҈ Vm릓]V_ؽ]MKQtiΘ0vch`lEqQ,O%VNnуч b.UmLZGgC "RTSog;cV1K-:W|{LƎyo#ٛ!_}N܅bB:F{SqJ1U$ bLNh|L g81ƔraPd:Γhb/!FƔja+SZ ГJ\7ы@2) H;ס.h \7t2n!rDgChġY/s2è/RAJ;Y'Mp hMa @`tWG%EQvZ+ {:9ڤuUG{c\yZ*mtpc;dAnd,'Cv:㨣IC SLɯlXdW^ɅP_i.R.>! !:E$1GX1KP]ͳn_sA9"K1sN3wɰ4fѩ͜ EplZ.9b.*Ri'k!"uNm#nfAeMyL"HYgdkcntfq(B%]̵,89΋y4uQVs<ʻ‭.vznߍlG6Hy/:x<@YJxL0jbrV7& ]DmI-. &nDFhVz>GBx|. vi$;9̣S=B.F#pܦtj%]̷5e.ytk啭.&3 dYTw\Wʺ=1 & A0׺`_ɖ6g5晎+sS Խ\Rvi]t+8BL&<;c]̵ B[~Mً7d.)d[z|1%<ڃQhcrՐjh[Gi5+N bA|CU 1]> HP<,z53@$eJ!zI ~1ft,zF͵W+("9TQ쓻ɘ_hW ً>}hN&mX4b`,`V2&Y4fx̵ 1a/e)L/ F}skaȃK*2HA|!+9EEjLsMy̵V_Қ)H. geۢ}іkz.o &:Zh^;xd]<.F̝1g4e{UZ4c/*_dg :Mם2 ex!|"ƐBt̼UtQ-H1گo8i32nj-BME#@yڭo/,]j@"lruXp(% IƼiTJ5Q\pVXЮSRޤEz[NӢrt񥢺#.hEZ*l7~4REn:cz"m1wqGKe4Po<1E N]F|Su8:cF 1`[^, 뉷3h"h HosjygZcDD͗Y-Im+]?MRFލs\@(mNw%rWeel8;cMmَ{vLH¸:cO!3}ۋnt'ed\7ΘlXJ"lS d:]Ea:Θj`-1DDc:ðW?waZ O#-"hc::lJ _tisȺQ-z"JNKGQhaEgZ%"FY/.wu4-Rӑ_DęcF{)1L㑋X_݄EcsI, ;hh;&i7 eԝ1Vu}\ 5w+@Y]h/K$Ks;䮛b̬nzr.퍛t1 ֪K0z(vi|MƼ Juֺ.-[0ڋnEb0`yYX֎b3E5-]lt`@ y@#8u\1q7w}D~Ee4Y;crߥu.fa s%Jjq+AsNtX$uo3`EqZG(@/nyin.Nkeʺ:B# &;cU8HĜNu;y:cd L!:>F^=E$c8f'`<ƨTkGg63:L!G0pࡹ/U{1]Tj1g,Xd.]1E_G[c.,r] 7M*kwݨhEqAfLHT7$^v^֢- \,]Hh|\ͅVi^Jd) X0v5UG zc蹪E|nXzUCݲҒ+﫬.^ Uƅ`.-GN|d`NЧwr[%꒟VV}5}ǯWVW(-Y1sс t ʯWg\d/ϱ`MUqEqw꽅L ؤSGK0Y0(6)>⭨9diBHlƣ ¯T׋*=0_ZrPЫU}@]%[QRt9;VU\\Wy6b#g0A{-[a[^TW_,(^Y~wIuMevmy#NkAoTC wO6 MtUi+jXUi'v\>iH#7_:pud"z=ϑ #N~07FՑ7FFn %Xa"s.-ryMWs<К}}; ~AY^IBիÃ9_!|W&\DS7&\cs{0X zd#À~AQJKjja 8V׮]ۋ VhL rzJq, Gda b~*ZI`?A$V VWVWwqdc@!VA h8!r^E:@"! @]o ~8A5 A,0T I)W+-.6xvȩċMh\> ĀaGu!dWYߏ\k]û ]kFa1yȩjk*w~{x$=A ʡ3a~@!'ȱkb3.z˫kj+J?~TiIM𩾓{#>yg]RB4Uvo8>zRbwY~ˠ% b%"L컯U{+>by 5*O{ @Kw&H%R~ş'@!5' QUM1êD'6bYbJͯobf).ҊU(2\=pz+cq]hw )$%x1n]yɪ1(_ 0TT+H{DjlZ\ DIĬ+^ygߢ߲:J巸JH_Iߊw/)"}ϸ}}U8BHx &Z 5ᳩ%Y9j+Yw|־cB(nmEA1 j1{OW廞bff~l4:c JA̫R_'hD#b{ݵc'ttv&*g571c>Bx0lX0 :OUC| φ:{zze?k`~gxbc T4l^!@ ,Mk6_|6T؀.]~$29qR="]euόy+"1ʊI8n5X+5{`/۰/-ґ=`C8}FkWhwH@7%@twA;#/.ie.{c" B q7&:w.Ģ7cU $1o@M]>g]@_^=ʫʟ7B!}Y>1sWɋ.:\0F4x&Bx~OfuF@v܅vﮫݪ;p.B ? ԿϷ&ڠ컧6 1T6n|\/ƈ.0h殛9 g"Ԟ=8@[X,\dGt!Yp{{vig͕BK/%Mcm>U*t.Bh" H/"-:P0lR. - (B3_±FhG'=g[bŢl$L#>2uq+&ٺK+|Q5{B&pDe8kVuNg3gqk!EӢ1&=}(}rtb @wѥ]/  Θ_ OQ[(f"ֆ-KӮ&_d4b[Dݥewn)0ÇBv[cGvVE-"`hviuT^d𣿧g|iz貎:1X zۼF45i+ 6HRU7,s]H1Zsl-cML17jyh`(՝!\=w]h(拄Fsc}kd?-tp+{0y{z&eBnrOoEGV Wϙ}k,yէy#²Ȥ;plr-Zx:vimm5Țh:B#`+@ӧW^yp<97 %E_^5˫VwSsՔ}Stw&?;W-C@`f}?'GW0貮::s,Y4t>̣O{@({F츶:y[YORٰu쌙5&M ػo5ӡWܹ󛞆'18=CuϏv1'aMs(u seG0lp?<"#Y!+'_viUb/nf(cnnMOUihΝ5tx8=3k^3* C.t1C1!EQ!J#|onuCxfziHh(k^ֵ;&c]3n5MF$^.iQ)X;c6Q_w+DFp6F][4/{e(HjiNWFގQڻ4Y>_dNgDQ- fxϚEv/ =o$%sB\MvN}V,5>Σg=/K:lMϋ3w( Jn_RG" ;4)#:ޛ#+b]ġҥl:rC!-G˿M(a%X.ȊLL*# DnBt!wd$jz~nFgg4 RyФ3GkTkV(+WZӈ[ҵ ~]41R^NT5wimq:EєF@0Q;Wl-M&E?]YuF gUtibi~fvB,g$i"krȹs,7} .@uүÇ_޲`S}m$$b`/ؿݔa&]I]] ^8]-EZ`Y{ܢ?gOLu!{&~ 7}6! ޗ~W_ta-а](*RX>@;B]E'Dڰ n6Z7-'[4"omA@삸 %ˁole}S}sK[TƭZ}7!Um=K;KХErQnB "[]celѭJM[4>Pt#yWgu6p]-Pn,Ѫ)Dģf5>[h" Lh#Jdx4?tZ_$Uz8kIҖ:Z(R-E yh}-"vA[7uCH̲څn()Ў{:_,icr[>*fĈ.,ﶤ*0"x`z+4"gNsH6`XkѤ/>>thL!.@Z01;&嶓9™}iEg"6iuMw @KEA:dj/A6>%rZ4ʤ meS#L@<ǨZ9x0X+ 0V N"S/k0֔n+>-ǵG_hYPK(Y5;O$>gfx/setupSmall.bmp_lSUǿ&&6RJ1Y] [u*)ihiuA.ww- Ų7 ,n${y2o3a~ϽcL뛑߽;=|s=x< %w8;/0ƲC֍Cl'.&1<#nHX2QIK,ݢi&&$@$JD'ɉv ç&i"iJOzA(;' z=AHOP OL*=q;LOQ,|8tw9h%z)P}^G^x'rȺ rLl&1z( S^>|>OT" r>HT"3UQW!ϨD$F8f:h4 =D2nCuI0tb r9r sE EHH_,T*a41KeeT*LLL`jj 333jqի׮nܸ7o֭[}6Ο?w߱%WwL=I7wyڲ˳՘^ه=:ή+wO1Aa |e~r5OLsO)* H-VԘ}N;[icb`nCM #n$bqJ.jhx?+,=cx<"#K '}\d{^y d o^qF%_t(V dꠙ6@a8֮KBŤB%,5B߮``;wPE}JӦsk*3;=jb0Ek.\S|֘CLvhDֹp>ujJ7[>*A gi2=fMShx0vjA CTRSVFa?iW =}{yVoTO&˙3̴jy-`_2zxw+Nu]>i8K~2[ L91K:Gz{6qܥ:pF| F:} ^Ƶ=j_j{{m}=P^GTΝԙ8`[KϽIݤ7t1d_ + 4hhpg/]⛣]!-B]PP4yp̉ʣ3}R){KW0䄌y>8syӼ i`6q~eU+&6 2ٗQynZ(.si!mH!Y-Jb}Qc`p[G0ԫRݝqc:l|cK01֥6|+5kS;z;"uP;::|>?|>I+?xDiT#z].|ɵ;H`'hڇO>}Í?~yt|x~Z7NSly}X N.XZiSX׸?y;Wud4؆ Nr V8l҂vhMlTfġ3ݓtPKH47^gfx/title176.bmp XS׶C\$m׶Tlk%J0@B8qEDm!bժ"}:jTۄB XC!sgJx g9kN a G706#ʿ0>oP!c=G1C`m<ޚx  4&xz1g&/6xg2SAޞ>A 8cD&3gC(żAc2s3av|$,i$'E< vDB'B+ 8&02 t̊Oւ f-LvbWk!1eL[ `IJ:Y2ƌ~9oH,>&@4(+\@Pgh=pfAl$¬ n&i[ "a+D@\V~xmYkwLXj36|VX Ӌa`/ʇ!!feY;`m&k- >5; ]nR BbArH%,($Rv,|X~ J wKnˆ"a>deƂW y†] Yv]{3+7[r';Nl %{ x/lܱ쬀 ; wWƲش :Ga#sQ<;8[D@Xs*C5At~8rj-н΋K=p)8}8\=[_= \|9(:v6ހ'ÑڳPs?yY+?AKpP~QWPM |rWv Jw[pF+?\9|[U%| ׮R5P %\ABkpA֠ xn)oB㭟*V@\P@v&Q{_E&ж4/ZР۷[7~?0tN=g̞3{fqf/?}U.5R9YM?Js^{e7fd 35/nՔ?amWJ%61}k6z)B:̎v{at''WTLK cUmg7,O:y|&&cp!%0Ȕi ia&{X-x}J+JZ9?qzf2:m܌#Ʈ/s:֤~mwb4Sk^v#3LDTsR~ʏ{!11tt`Ь@)s9yyXa !Z賚kﭭT7*$RZ-QrبiZA%QQ,V5.>DUVЩJVJZ[4 %gL6-p RĚ'\ʛs|RUU*}=5JSHL^aw(n+ 4Iچb%f *03z)imIfQ}҄*Q'i|#9a577{M]z+O,Z]&:,__: (6bmWCJRt"1H$F^O և4K$b '&D'6 J[RTO=w|-##//[sj 槕WTTtON?Oz#΋̈QcFWcby3zHRH@Lh佼v>z/}㺽_9R 22ss7.ZዴWGY(FZ~Jq^IfVf̬S z,V!FLR-vK5^^\_6(I|& ~~ȈDoxooufoXj#B:NRtP*4*^hq[Dfntj5bwԏݗ'xǔX4͊}g/^6?;>ȻtJcj6=bBGNțfʬ ^4fRLrv{Q&VTyE(mªU9&]Sy]w?\+$%J%9ihɤT*C%52T>A:L*eKK_pVe[,.Mo'/\v-QP9y߽?˷1lW&~*bZq9 G/X"Xt࡞ˬU^a ;.=IMr1򄊏26f,?f>?f.42̌ܜEZt!1]\.֝4tΊ=qK^.ã}ّ:cϒMDW?5:%xړ'nbTGr-..-8nb%W5*00uݕ>7ق6ߕB"\_TSCHvNR#TnPX ':}433\fyT$1ͦQ<'(kd٢Icct6pKÌbD3E:4E;hgOFFɺyULgfmw S9c lK>kR~}_0M! w=.VkOfp.2Z_[b-9pa9پE sa1J4zZs} ]1ܕm5SViUVؓl:= n}}Τ[W/D-{ +x<jǬQ$q QXrl)(jjԼf ]Zڻ:u$ +.DN" r5*5-8+f2bf҈la+`-FƋ.f[ŷ˥e dڎVmK֞F1()-r&Ξ ˍ4=Y *ֆ&EAZTXlr$TMsHKCVa?$b]Zmҩնv2&9o2)( <Pcv.0mkhEDgD-খfăDb!Xa8#oAd8Mxk0-؊:zyn}Fưt6ʹ6è@Х_E+oiŕ&4oAэ1P槺>@J%x%qqg&7 ѲdVos!Si2 R3x?DGQ2*64Ĉi;ta]k3]}\ˊC#_qq"%mj@KTr_TH`M;dGXۗM5H_ŪH *TH8"nctiՊ+rHd:E=q5$;FX#u:Lv 04B PYrl|*ĥnk=_ JϢr\cҸEjZ/RȢExMag  M!C}Ba Յp?Tw ʌH\WKE#G9(p ŔpL g s½Ξ8м\/hhjpv/1ڑp}U4poݪo7"X^v;z#{NrYJ^c]X) q~G;#_C| yBua hfQ ܣGi1<:p N/++(XPTx( u;GGY輎~S_:*(Gv "5- GUԉ,˄20hBI5SVPx0?Qc3Cd :KX\,Qm)5hu!}{GͳyK?cImN1;Jㆽ1gkWx !Ԁ b8ǤHbgALNnB&G7A\.v7h]ZtLed onQ$/$~;9I]u62RZq=ƼErvh~fow(<,]·*=/:>΀pPGb-icdJ#z/BɟcvZH kZwGvԢ3Up0]2?x$C8d*aK0?DOE-ZhmPKl4J3~gfx/title240.bmp TW," WDQ%вPB@(VE aiQ&E"b]")hUlVHm4Z1FM09f((&f~w}a^Z [r-`q^lt :H,CGq0 9Z=yL{k48ۂL0 ^w0 #gø1svt.s&a >@ =`al3f* `D:`# m7᭷iH3e!/wYQ3=%0;\0w x0gSY0f _xNo@$ލP"Xޅ ˘ AJ|H\#`m.Qd̏N%@ I UY 2bY9ɐ.`/6pPZ*VOӁ\_bWq < 17CLz>(䭰`6*5X[ ; *c,O΁nU!>k+]K2?h] ?73o9ڰX do)u5ՐT@fq}e{aY!H+(oBȮBʎv`^y`(d3lTmp"+?]˽X}TՔA;hC1T) yU- v=JwPTS;kؾKY *7B G5pge=pW#p]ԗJ8q;5?N<} 'aՂ )ml/N|r

 sg8߫p+p5"@r_5/p{iou]h~.k}޼ ~} n np]/Z堸?#o}#zxEz$fҵ5k>1ENf3jdZ,/ ;j4JcurM 6K%}^Zt'v3cvc&%SUd(+VVI1A?U;ٱNvcNhO.OSeS{H_NG<ӏ63"-KJw\ SzS_Iµ78m>P[YAm:PJg[}s}/Ja?d0OQ@+٩J"+$ }S {g\EEL5OOd/,E5dr";5$$c2=cs&Dy|_Ԣw|'F2B݆HLMQ䥹L)3a$:e)KFq-RPZW_"(oQwN4 +0s1DV!RFI5MTm-D=@a+*Y"hE-OZjD2VM)սR({Pr)t)'&2Ns37+q-%u|){6g9{CnmA_IS"Pىuߓj5HjT[th PiU d*4CvɜhB\ѣ\z9iL] s[؋i4WZӢ2 t=/Bk*=~BzW+Ä@ձ'L;=5LuweYf.%KUTVVW]v=_ߌ l*/sSa"]1[)yV퓫}ן&xt;v*ߜ2 dSTcNccS:yiمwV|Wև'9t6rW4 cRY\r*픔-nњ=;yտK슳6̢̜4B;3c9,K]v^@ӺW4_0dTHOOOE/H :Q>f79X=>[,:땴S&&Gf3orH,7ԌQO,^SkOqf:vR.4?W9)px7fg??. 3 b %ͤGOqvv&Qoeܤ_coLv2ͨ|#aDiMd]TU?:`PK$ ^,)Cʊ<~&`[j `K[Ia]Z!kl14d!}]I_PmL?N{5k,#cK7TEKa_XQLvNd3]UQE #kڿ􋦛=}Ja֬G:{JS^E}E<җ]Y\nVbBjj2Ï.mC"43y/{瞊8|^3C]|Ok2<>FbDr?8U`b[Gޭne`0Fyfؚ 6^Q7+fHHfL+3DV*%m>L32*2j&|˕vX9MI]})fehDǭ2E7k~.>fzp$E"EY;(S'Ff4nL;oE 2FEQaQs\e,hM{g84 E\tR-Í%i'뮡zb*j_ PGy0 uќ$hV 8d,]-0jykRwX"Piidde6'2*x.+X.XD2k/q{nۆc=аY[#+`ż#*m:#Y6}wX &JQ`iw50nfXX5(`%bI뼐gWXXp%X yǏyED06/z Dzd1̢iOx~gg ^F^yy^[<BUbyA)#E!nZ3(kU ,!:-c 7&s_!$e=uq'T|!pw \?Ȍ 4%ZtStKJtI>5B#So ^"~dr!-$ bV|fz>"?5 ύpKim AZ-q)[ LZedqE?6 ףblÈ2志Tkl3}[E2\&%lU*}ZiΤ-6KDjG%2,(x0Mg&1?TRH7B|O*mSw*i%oBnųy2;rEA`0§-A 瓪6B!]WV<*C'c7_XZ"yhfd">sN9DW~[=x7| yuu>X[޹$m-6r &SWI@/$G$!SO49R:3a Luk} y6/`O sK]Zuo||}^~ J:Y:bmskhyLLH~{{  >傷Ny+rZ *9Т.HWe;;; Pho ~ƪ-yi쪃EnfY\s@RBLnC^1+Oyd0Q"ƵG+AHrI$jNJ5?wT}飷^7x_߂q/h ض[ejq4"׬O<)N]Kw_^.P΄@'4-jdFkʨ00O ߗ֓0kmpS.2i*13~C/Q*ej |],J⿾3[Q)%U}L`~aD5֍waX `WqBB:iKrӜXmSa$+h3$UlϡVmvC:D<j Y>娻ݬQͱ9gMEͳ7Wgb2˧I;^>Vr+|?I&ɭ"&XH{*뢍„Z L&uIb /EG驒w7A+2B#Ͷ^&Js)A:)4+vZ0̤& Wp+Ix>͓1ZV:6D2+gųi= 2a`1XtW*aPiBd/vt';\}xK$i6'!.ǜdWWͫað \"fd8hfrwmNbJjĽYqk ^%eͅ7g6(;KRh `_&l_pX(9ڼh.9RvvD-Ish&4Xbøu s:KeWvxZ گW_pj-?1=^p-t68J=dtU^jaT:*ob5z ɣy8{A۫<.VrRR p\o.(Kp4N}H#ݎܩ׺5I5j*jqCO&o9S~oң7_IZa1  ]BSe\6۫y^n=F- tLVPRߣM/no]x4\ ' _lᜨx^#tj/ʷbU,t 7b 6:.Sf84bJN Zi/IR BQ9nUѭ[Nt_"޹ 6CQx|Ub԰/Xh\Ty._\T}<^Vn : ~mJH ]Q;wxq޺eq%uV@n64$7:%\Gv^^Zk0UFh6 R7pqGcjӮU;J~C?P,:Y\퐨z4ig׭XBܚ qܲ3*,wlU>?6O2`} /TVy fPNHƩS(֋͍΅`6WIS=SZO*- q"~={-<S<*d\rg 2ю[czɥU r,II jMR9zAy۟>Xgԫ6ǝA0/6#?GמO#SP;fkЀ}7 mSc4hxKA/DӶg4"{?4^*+)T$Z#s|{7 <=<531Ʉ9)-qR\>?]/_|`h.4sW+NMOF;ZEo؉[D'Ű7a%"";Ͳ-ko!I[Z hVh<2F?d9<=Hz7`K\ԑ^{踝k34O3eX~02y{jv1>Aن !npYk6 mtv>Gܱ VDFȺ m09o Jq%kh=} 9Ar 9ArhPKH4K6*60gfx/title320.bmp\ǿ鰍ss; lI6,Ԁus*b( & MIif?,Ѻ^)Uٽkb=o{ s %Ag2z (vx._:7{s7Nwh <=! ~Y"!1QzTB)O>0<930mbcB<)x?&?>> <xL="LuO@l<;ϐ ,Yc3o.Ae;0cʼn1Spk:qN_> _~y,z==V8zOW^xst8\ 68k}g=g\oKp+pU^ }}g767pYx"\ p_ :᧟~ + + + + + + &r~ݵoޮ$B7d& $Nm+E7grӼvSD<&Fe} ۴ Ìa+9uzJi}mñ;V&՜]FH#6!Y 6\gԕYz!Y&͡FPbťEqMVW |T^' BalRav߄ZOe^FDDqrZ̴qS~yuC~;Xz>V\W*$r_+v O]̦S 1*yZlrƽtĴcS*ͱY~euxf|jf"3!LfUyь744L;l폞Pdfr:xG=IЛwpo6:ɴ\bIMllڢ4Y?~:l31%Ơw'0\`mnRbz=~'띚tcD@]nwM6m~ѭ׽h%hT[P (6ͷM&8oG9rIW*II(Ϭ W2nET["=kIggk^۠,S\р-Cq#m( CuVnGFNrDĉ-,$8"Zy^JD0&GS -8ΎV.>|I4ʳxS4Y-ͻv-`(V45+W66vޠcfyDV ͅvxMP c@{;IX/\݃Y*Ng81%0"G{C*WE4)KJ1v [W"nmZ)2ףYT@Tgv]ር,݌(7B_=I̜>dG| ^+tb 17͗\Hyn.VJtEE ʌϯ\:%B1jk||ED ^-+R*Dmm3cT N:*,1hxż󅴱BdzԹKƳ6{|HcTڊ^ZF(S"/`D-scD{-/(\T{o,*P*$3jJu>5 bĉ--uȌ i<azʯr11 7^k[+SiqYY(5k)|?d ݡ' 2bct\­ikju"ujV*P"\4fgR]Ӵç7vNħʊDPrIJf[[%C.ը+)9L?,R0Dd0l1~rkwbӨ`U'&lLDAKX*QL M\3Nc084UQIebHd&<94Z$"Ό&U"L*Ol)(DYj%Qħ6 J [ t/=oZ 2"#,ď%y ](LW/O z}QBrdn:MUsk1'ـl|څWꝸ*!$69r+T+9"Y:;.:NPefTCe q׭,B4J]êˠG+VPGOҨdΨ .dG&*_{aG[\f!_*gSGS%h6 KWԈ B\5[4>w"4;kUN!"Drg,FfTԭ+O=~O,ኻq 5@X uDz!%uL(`Q"h IBB|f͖/gԵ4须Jd("zzQZ9Q8""xJGষo=8iSoh4`%5iTZ ѫ˘Nne&/ 7mp>~o{}4 ( NFitDoպ\A^FN]}Iyߗtt/gv2xƃZxЎ?q;3̈E}@U+ (B nrhKԇ}ၕV}EBHN /I\sș32 Ji Y8?w{[`<˭-sF0J:8{!z]G?wySKMg6wѬ˫}׾ſ}˿_f-BfT4L>ڏZ/o8x}o1*a|󩅾^yxKOܙs"&&2 "[(Kot|~?ʛ?o| Zȴbzf-1RQ_>^I<@ܹ(??h236`Y&P-O9+ ow>tgJhU] 'd}s]_z =t7Y@ꑃ3+2#%1 q#s/[o?KťtqLU x򺌔/6QTМΫ],D>4GҲQ5&s<mE5F~ίBˮZ CPeHUMҼD9ȮapDSI )U4M ZA  !)x| Mjx@K!ļbv 32C "3Hw:zO~$$zN[jݾe^9P2-{|hT#%报bT.ٵ;b̻k> ̇COR`X*Kb&W;mʼg<|($Ctؤ]׽ݕ,oץw?d~m d.T-;8km` yz$~ Fyᰌe:M@Oo͆P/1w$h9.N [LAvCzdnV-+>tS$!CAlsqy\[1ho{n,NL Ld/9HB沥6S./;7>8Cn'r I4C^Ԅy;6Bhk} Q M{r G=}zqzn`]'fk+2:kx]8egV4؉"E_rkΥF6Fw 7‹piUV MbUF"gR# .ڎ8i)ЩxOzvq޾l/ۗ,?UYW*֣TOW2%&Lgu5;g= Bwj;q=۹\ʸ}n?-%Ykp،+IL$KS,%JkώnVX„>y 4:DYC*ˊÆqxaϘB)zǽ6/"38GycW ^0Z-xyhiBk6!Av&U8]eR=%^c.z rkMdE< iBhJ9 ɸOQ/L#- 7^$k_=q:^-z8G/.-d*XDf(rTs#Bta~. Y7Uhvk:HHjV#\dܧ%q5n 9O|=9y zjiI\p}uaMNiT]ZH&gشׁHI*@|kx/F~z'(B0slSᇥI) KWRKz3P!?(+' Q~WxJq֨|HJsH5 jO)vr7$$J f}aux e \X@zLL{f蝝ې.;G7=@z`|ǧ h8Fƭ,qͰLƮꅿv-VQYB,LLDz*`vUYۨvc/]Ct=np6̫ZZ Y1W'T7|܌,]M'^a|m_|p`"XIMKhZuXsH$ΈpjqcN/re׹pۗl#SӲD!1r㺙efE|^y&O|wB~N'{⯶anOMf`A̴vE1Ww]įٹU@KM`)$ۤ@nꮧ>_e'^:nC'G+Fu4/9@nvzJoDpB5dycmEu5B|&3!Ͻ 7U4 rݴQyA*xi#z˯+2#Qkڐx ?;۴bD=_H$̚8ćQ>BahhuM,,3bFMV z+Y# C"e,>>EUIٵ?%s~k g4H58tk\~*|h OE@k띟O-1-ڨO4CPW1U{i>3|RetUV|r]ײҀ{{qrpy/Lv B cWXa)e4Q:J!3 {YBPV+GG$eDF>%Ae` ~e,{uS(ڰ 幬xOY9upA,ogBeQrQ\Uٚ-i\0LބqC{Dy]}2uEU9ڨJ(0ʱyzsR j^iP2y9Ź}l>Eң̵g".ldT$W w,AZDT*#dBxP~ל,{E(*Ta5+"8x_X| ,yTX:|L"ßy `VJ`tCOytm4hYCr`VT Y0g f;$R܆;j $4. LSEy%tA->CH( Y>ؖ 6 W5¬6nޒ\䏡ma[ުk}1:\Ckh{ۄ"<. 7wpn!F/`W鼠G$rs-bIc4hpjݨ'4a̢cgz߮ZMHwFj2=T PYԧ1tgQj௦@k9M 1<>Fh 62HnNǗBN*E֪ i|DIg=[D]c hus"^8ghrKZ$[ͤ+]Vl&{θ<95S8; gP^SqMUbͷ[BD8K"&eVRK$]*0Eд[pd1` 5p M$? Dٹ2i/᤻w>5qpL j:"·+9xfi.P"#k'ɷ[ݢdMrۤo lks R>nrUvz۱vW{d)P_U:-p$7+G1kŵ}KaӨMg=AxB*-]P1T nm>g폏s ލm{+N ~Ї>^'t6UZ{8z bKX=|׋2eAjL(Ã}9I\T9B7*<;.Ws'6;4;*UKd,7et#lg#OqG m_)si*qӻh>zhtcLZQzè)!h݈q.[MVwgݲ'Gq 'Z0 y& bwaݮd={ =AfB1tlIgaTk.ݾw'Otc@|%%RK JNowmdo&NX} [qf܁}mT O#e\I:Wsio\ ɂbffDAY}Bw$$,Kִ>cArηe_gfΜr0*-cR]i^'f~&6U`u=d:nki+["~<D3P.Ojsu/WuБ;/ 3g73 .&Ƕ3f PvRy_\R l,5T-A(]ixEv/`gkNǮXu*E&^`݀6|J Lhkh.ш1PEhVUrVWY e%R)|QesrEq`I2RDe&Ⱥ,n^Ey!: t@.kgqIqaU#}࿇]WˁL5s~[` BefEg7*]'[k)%E*tWO->`Y ]KD¶?PK n?6 src/comet/PKn?6 3src/comet/comet.rcTmo08_6)JTf͒IH6!-j)s;n>p "lܠfk*1&b\ie X5GUJαp)+(Y0!4@<*1v˂˱}tKr9ʎ h숻Co&"ukpt :8Ms%U4ޠQ9cWzc2lGm~H 3R[:kkkYV"X"a]k\};@d8x_%,s`vMKiog8/ ́;߆ʥ{>9Q8=ic&/qI5װ*Vй2Fw7Oc5C7`o>Z % ZVmը4}F 9+ )VEkv֥Ǿq`9!.\ 0L0K5H /U ʕPW1U4NIoEYW;9˅ ,f@&Kmy˄ ]p y4G4ŔfvY=rK ݳ rZ\#Ͽ4v _N;jan_-/u,W#G=G3M>ͥFTA#vPK]56N!src/comet.vcprojZmo6-:%WMY0g}PId**I9N%%uK"wC/WId R1F p_G[qfYGoHqJ$$a!l.*}& 3fD`W̤gO+]yf,{n;?b[fa3Ij"]M.QVeYc OCިzΨ;PqNSPsm7MQn<%\M;JqqeFuDpZp 4bwD1n d|Ġ[=! 0QH% ז*"kD`kOLA̔B!WUD0 a![FA l3>aʷt)i-| 3<[ZtH5mQ2,Q4XIHf Dҕ L%e[Dk #+<=H(rԥh2tJ[Q5p.N7:fN Vh5܋V¼h%ڳ.Z 碶V÷hlr-j˴h5eiir%2"X ]xlr6a4OBӌvԎ5&2/2 &Lޮi=WNEz΄irdFPDQ}'a6gJ!cTGP u$K\};8|oI#3VIݸV B*ReR*H4 d:5@epYkE4 (e%ƒAyM/PKl5Csrc/crimson.vcproj\mo۶o1tؕ#˯;H,ir42El$Q=DuY ԉE<|;0s|9wZ_~6ғrQu;$] 'ss9#<O0( Fa'u>f~cspIyW rGu/v _5PeSOqrTCS_ #sQU ?c>I(o!$(6xn[Ⱦ7$}:<2 $0iz̥6&Nk3#[=#{lNrNRsW@g(&D!'[Hj:OTTORX(B(g3WF$ *@ 팹[eODM5%BC !eQd ( &xh-Ju%A+7 jZRݼBw:RF! (R]UmBԔ Q%&:z虉 OQMÑI3QM_ M&͟=t{յ6Fz_=Kli4-ћMq/W_yh%=Ge++>yvY#PKk?6-Ksrc/CrimsonFieldsPPC.vddproj[oH`x1ؙu4ut ;Ic FmuE%fv&iI%pziCWR,}9nNas?}ߝ+E5!I" {RB(B800-\#,Vp=ʑZLru5Y̦*ǣɉk岸,_Uˆfv|L8i7 8 I\},?u7I>T9|QuQn7|Mu}_ʛ(a$Yyrer_}/ ӟUDh0RI\ĂycEҨh iC,37bbA@>h6`V0,YM ;pDꍢ#b'"PzTGFIDTS*@+0YQ8zbOq0+a 2^E D1O%@kA\Y98Z3oDǭWԹpyģ210Q*qTP Li[T=#T@IM9AFQ$KGc-8*@~Iiz9Oo qhv@#X'zc6"U(ZR0 ʵ ui5D}6D3E(w^J*%\h QαBx%1Tz鑢A1OЍub(ލ#ꏢЙ_aȚ}O$#31wLj52P5Aߣ _A5/ :9*H1aT)D$2  1E քT > Q ;rr6(尌6ʠơj'VJ;(j!gurMCY咳4䞌8U܀ ètBPi#r@h=LbP"z؂: $÷\ #8h6ȉ$(깦Bu:UiޖyS:"\0 à8 =RԴEBm'Zj" ޟgD"(H {lg#aȟlk&ʀ\QƆȔEVB]B!lzR qpaZ!Gji\D:: ӈ=v/e-9aiN F@*.HjpbDt-HhF)T$V!HE=hp%AA 9=r!@^ZaA8Tae6D(7 C]!} NGm%b9}Π*U,:aː`y1Ƞd1DZK9wL3gBL /ÿ9tEuML8-e(܎qq2ɤ+rsˊRoN~|j\N]|vԙa~',3Uù`&+Mء?}|;eސ+릺ES(WOxSMʳ)64L|[znwqE(h+:( h /;My2ge=,WS5hT4Nq/iJ. ߑZRI*wBb `T5_zuj ;H1ڄѨn9Y4dIYOi9m6誨qyY 7+uZ^Vppp4/Gs}{^N\b6f lԬ݁]̖ŇnMrs Z 2ب=d~X۝q;~i]'.(@"k9NL[P  fpn/ϏE8m[ *r;,VEXz6\`(eSOŰLxp8C܁x߻CT͸R̷»Y8Wq._.tb6" '}qƹopX&A w@͢Au"e3.=@<)ˤyp8e75=k:JPzMV8t.鯦;Y6*8){"qjx]R9w<^_+&I3]<ĢN-N,ϖ>nדy&mg ?'Ekմt3.kB,!LdXվsH~V6?>oO&<[4a$NI8"?d;8=ߝKq.5M6Ok7c_㯅YSErF:{ojQM/f3wr^ Ng`󣦹>gxGN^LjF3]ӿ:9e1:-QڬqoLyT&=S^')gpr|^~,0w`;{e^'ppkʺUڌMyJeoVMӌ5y-w`? bTO&~h9 0waNPs,SW湕Th?Y=dY=$ތq21"Kq g$3sK9=gx;FJ4x+90;YFϪ&ilX=v"-)*PE/dp 9 ~60!ec(Ɓ (ru}ٹzx8 +y9]c_yx+TI=usR+Z\s6ݔR! c~ ~yq]=ℷlN6!yemĊ!Yɍ B >zwdg?Gdm&Pr";v6)BDP aH˖1 J8KsLr1TmO[?5>#3&Jr/e3_6jJ T,!PK)h?6fq'2$ src/res.vcprojYmoHLNz!4MOBZ)iǰZkoypx<]ʟ殓yP̢޸Qbt^>UyHE@ ,ʺ}S~K *Z,߽0GN8p_6OEjgqX_|_RUzɐMܦD]sC͸+j5pgP>w!N6 cN:È(Jg%rR &`^NBJAR֙gq˼wcnM;?VZ:iPb|Q@|Fbݿ9 )$MOwDU'N6бkOS8`|rџH2$ YRE 3\lܭn|fB81Q>Ȋ,3Kl)1PrԱ3d: BMJ{㼕../$LpHuijZCZj=&0B C"N͋ez,ށ8O1/q08G"n z"O0D }Oq\B> _z $s#|[{mw*lIl|&m3OZ\Ņ1!2ΨypD#fICŇv@k_Sѡ~>5|4ZY/e5 3;tx/w7aN͘ ǥIv0ŤUxcDdYǝN^&xGl z**FlͶ{}\o﫞P),)$f=*O`2 s#R%`a9\ 6*M=vv5"F@f6Huku\-(_)DʛNq`LiAiHB=, eGvW ;YU<ƨ/G\G1O=QUesJ?LT`{'zĊ\eJqY;StB䈻#c{~7&q%,7X/a-ekQAnˇ-{{]m8;]v8Xy*eE`2KȞMS8sƕX(P5SDã"gˣ.z4 ZF*2ȥOA{%XRmR.UReV] {hA~;ݯ͛͛jU]WFd*:k 7[ctMkWb4<[` ]YSzT,只۴xX`5xrqY?PȘoQB1ZM,_MXk~ g<6a#$7A߰q?PKR5"src/windows.vspropsS]k0}nA<4 c%ʰ&%y پiɒv,]`sJFh tu9] ̬+^!{oPاC q*YrsxnuL1 W$KPTF+? Kaǝ&jM^ܩWI2OtU &E* %d5b'5G%Գp<>^,BRԮF =ѲWdkbS^Oj,jJ%ֳpWXg+;!8!8z,zǒPO=g 5Tq22d<;ö6kntJ97S gVķ~eEtQi|>A9}kR`,ToƎ= cwZ-Nh7Rhaޫ^vpQwu"d:v?ÈPKq4Pgsrc/wm2003.vspropsuOO@ϐ&L[у!TBZ=%sَat]e&y3/XZߨ )(a˧xQq(kHmP۾< ZG^Dn})6!NYUVQk( ;:X= YC0 *%^I~pj>EIMo,!%5?} /U3 V/%eWץ.o4 |߭j'd"ezεR$h"PKq4Pj:src/wm5.vspropsuAk@ a`$(%HO"&S&vf{4} /ZR*Je6*EN]̧5=ZoDty? r)®z| Z2Tט3FHa_i&k1:P7*U6״k( R0);@y̯1qb(v(`Q$6_?PK n?6src/PKx4?ktools/cf2bmp.vcprojo6]C!EX(^aYVm2i`T"5rnwȇ= [ɻ3$~!)gu`hπ\7w*2xR#% }t.X0 ?}sN c2Itj4U4ehFՋ) %.,(Ea%ccUɾфS1L@S"j!ӌ0 jP_^% ![.`Ȋ );+^ZzJ0K! TFЙ}7%S<=UO(wq[+w@@H|UQlm-,g ٟSUȽ'Gԑz}i!X%u!&sθTs䷩>/"\ lӫ#+.f3 "7 ~ Kx1Sbs)SMsu),@e~}sr/^iwH[q"g)rR/ijvalS|Lg]3{'!Q 8moԳz^KmvushncMjG Έ\`ԼKêX+f}S%ˋԃT$(EybڡRbG£%<:2T~:̝|S x%aaa.I<+b* @ K[fWޕ_^dKi%6e;kۡuxر?t\m;zxθcy ߢՂ(E )HQ]8jQT @. EuA(A4/7ɟ}B"i 6N0^"0QO-^҅}. 6Ri)[WdZݞ; CoF_;޷eChݥx0Sq}pݷWsпPKx4Jntools/cfed.vcproj_o6]ߡТSl+,΂If7M tJFRݭ}GII,nDV ݑw ]cXBtg ;' dM?ċ`O/dVFL@T6} ?ũVT N/ F$~lzӵTCP{U(atrx>Quh5>$wߺD|\\9nqT@D!4%%SriAoN" ;_{<|DoeȔXst{0_{@>9oO+2m俥ErˇU$oZmD6'Ll(X?S8 0,]xiFgT7~l6:m_kM߰N[-p>BpNT3fR3ܶfn]z3,0jʱQvQ&l6G-'JU O /T=!B(#9TR;%ށTOJhrER\bN|(aS< |MAЅHralScN6[n:jM:fja:#)\ KBRX Rp%(|:R e(, ?a >{?·m?'v-l[(ۣ i/ܾJ@a +y4v5YU}mk]tf8uﻵ&6ϑGOPKx4M_tools/mkdatafile.vcprojX[o6~vBCN-_+$΂If7Mul1H[.4nVs9'Wql R1Fsa<NEb`3ke6e铃wL$4`TKZyv(T _2pݍ/F&8&1*Wd"06gGr:噮3m7]4 [Cws>gfS!tN%~wX_ I,B&js!c6lP./kܢerVhqQ}{8|$.ClOmNRc!z`<1Q//(˕x-繰u5F4ly<#Z[E7!H!x HZ_ӅuJP]C" e@2Ǽ$EܔEh \gӅ~}0UZĹMo&"8`BV9r(`VdțTJc2qvhOy[Fb҃9,G"iR $"ư@C)(F)0 ^V9W'̗$ˍLa + ~,H1%DG<9y"f`o"~(3Z:Ŵn%, e w>0~UVG3b@P+AղYJC|?wvPJ8{կhUj(*NQUI$qv wA}'S(y(%IՉLB'8ȋܖo75Ho{;ͼɇOz{9>A!#m+~k7m6kvu;v _ú4{f`$6MljD [R /mrۗ/ȿl jecCٗ}M;yNqhm}6x݆ͧHHX/ěAiP7PKx4ʛtools/mklocale.vcprojX[o6~vBCN,_@ ˲`nMӇE[L$R#)K.M0l,[<<\>~|z&ϖ |`,p*"H\)ewmOg*'L'R\O4w FlꕁS]B𖤨^&[#`a;̎~w䘁vkGcsa6BTF=JȨLm )88I bt;,uhMh wB$K57#lK1z ٝu|ş5sg!z`<1I^/ΟUx 祰u5"F4lx<.W6cLCe zhu?s '{KDa@:Dz$U˻G'%x \ӕ~s(WZ.L|!pt %UX͑?)HqY>mV-ay)(%sY2D;=t??MI2Ea9SQNsK(z\-P/S%ZE$ybKHnmJ|b甉\3EfP6gvt%, n7} &?argp-GJHInCܯFfy8[+ ܾXj'v烏ꗰ讪j$]Yvݷ>dX;D(}D^|moFs(9?ϭs-'q=[@/{| sBs~o|^"arHyT2?Q2 vJkUr{GQ _r:i;A9îi;=shz=l۾ӵv| "z%s%9nT9j1X7yJ_Wi|-;5~1B scE#*8uW* ~ݷmNhu~=x=;? G^X݋ػiq b$u.ͥ% WR/톌r/(\ jbCŗ{E[sao̠oYfZ}9C}uwҬ0!vp?4( PKx4B&Atools/mktileset.vcprojX[o6~v@CN|xdٙ1C-&cg%gu&zQ" >9|%I9k}CE_;,WR7 ͯϟ~2%L'_?o BeoSn\F&xGbT/@̏Nn_L4m3V65aF/ٔsy W\y F bÓ9FwlP..k{ΣQ8E*¬{q\_wjǩJRRb^(P{/^\\X3"ֆuU`ZB%\aLP]C"˘keyI"oe-> N8)ʦ T*6|;q"Gb3f jCod4&'@֎EczoK_3J)냔\0]4tNOR-$ba)Sԟ C =4˹R< YO%bo@w ;#!cL` ѝMc!'Od<ċ`O/bZN%, 5nL~B͙)oh&3_@HtZTZZ*o=کC s;EKEՑՀ'(I_.$_;n j;lY}  7^? yBx?w%3z ym'w%I$a 0?׷RomȔXpl{r򿀓 Jss\0=i(@ЅJ_-V++ŃȢɅegϪ0;es ˅hmvGu}еz plg¾.9;WKTX^XAGYeXHkAE_u엕uE[Qvv:4 n:][7Som5Qy?"@pqʅnpx}bPKx4w8Atools/mkunitset.vcprojXmo6-:+$ʌMf7M?((l1H;[N/yqVnVݑw78[7=`>([ 3~%F*STP~"ZzN`*{ׯ5padw$F2eTIPڝh-j Wo-C?08vFlʹʼɄ]+.Sti7聯0` ‡pcl0 e;g`|1z -jeQlml,fk l*0:S<T]Tmꮆᔩ:8*'?)A{rϛi(@ '>~V+3ɃȤɅegϪ0;es Ӆ;znCnetzj5^i5]qf+- xK8!*hRۘ9jQ ,kg?)"lQ=O/e*x{D? DU9OzBeAKx|U4w?o"6@x}!61Cr!odNo۞wu#۵ݰ6ӡV2, daU  iv.m I}n081ha 2=L͋d_2uL¼"˭k]޷{ovٰ,hGx0Q=<+a+}bPKXy4Q-|tools/windows.vspropsS]k0}nA<4 c%ʰ&%y Yi\I[+Ne,st?{)@õJxqTU\/Q׀PXruyoӡ4j$: @eȥъOCrQ'|6BOZ ԫ,gZ\ tsCKE 8[ST\=4Cd[_3ń kx?S ovvنi d#z4K5c4nj h8_Xg%P:.4!Yl Ȝnj3T4(x6E>a[e:HeN--/6Ҩ_8NznBq]<];{ZPe8 9?֋•Xx2mBZ_JPg~Ѩ==L5ݟMڢ$Hu~< PK Ux5tools/PKj?61 setup.issWmo6IWk 4JBo& UӨ& Ni/_I syyl:M#+OH-r#*KKE`59}r=8YoGh0"ۙܡ?u`}th y;;tofO'4%q DB-L1 "jbǂ2nds;vJjeU(* CkC4BzVT8Mp3/P\ 8Si$VfϓT))gK͆cT7 .SD0;C@nZiB^:Y=zU6,+&P=Ό<='Asj}D&ѵLS  0 H<ྜC7N1>N0_ 12G])^|5|Xqz]~h~uvi_:gW8Bd%=ܞ6 /La_0?S$?fL7/c4O8?/E1\CZ6 ǹm{E#s/'`f=B㒌; :}VJFEZT:@hfC KJ(gl}XFD$ՠ^`XTbRAwV2xY`JUȜ a) rx [EiD9FAFT &7q$(RI1/zM=ñu~;h49mdsB$]zFrC $IPhτg)GEQ=K4jCHϦ\wRx?Z#`-RHP"O ݩY1j%ZՋ&Y&yI&pZAG"Q YlC8QtoꜦY$O21A' fh;rZi0mm :T<-KC{rŒh秃 Y, m:tnޚ-ucV+2<8n?p 7[kâ2:;d38D!1ssYzSG[PlhSގ@:<%t4c/Z=qc>_:e|TEő\ҔR;S&ڔ3omLP0 "mxO~;jE2r2eҳVhKuPRPKk?6QJJ setupPPC.issW[oF~4/$RɮTN]nŤiUh3=c͌CjPcz0,٦}A}̹%K4SI4 `r.:MJ-{"2xFݛ3Sw4zvcw5)ӛ1x݉;•wzLş$CvWX WFfǿR<.n#TX'F|Hƅ]ͤ^j4WU+=0q$ba-u4Izd= i{,wG_> CIHY;!kT'EЏq7Qq"RLvs+I扈C-St5DI>Ш]p0(Z;gKHV=452d,{aRﰦQӞ% כw3 %ኦTf7ӡ !3%(zz_Ͱ>z^3Yw, R)H$6I(ˢz}|?:?^;o_s^zk;:/{pyû7 rڻ~2rk/Tׄ HӮ7qIJ"v}}Y~˲ws0ϲǙ2a5Ũ,{M1:!",&͐] ) hYOR^HhGTސsXR|ЛxV(aT$qVQv"keǔ&}t9UUDaNDy]QͼQ ݄ Ѷ`5GG6d11ʀU*6P3`Ly"[/e3`"@_@2`ʰ@^vi7GdU7UZ% ;l(=el_ ޚP$R[#\pK]ʀrE&wd*bâS\@!D 6 sE}fx7v6( 2kwEW]@Ȯ8Z5'lda>*:#{-T' dTµ!e215jp4u!UJCir1(86"pj lxbu*}L!o1Zb4!-$O|_VKؒLG,"a rc)NfloRuR >uщ #%lB~|M܊[Y|: oj!pyh'׳Y^1|~/ q[$ t`{`8>>~Fx҂[!QY^S3C`yRl83 NYҪGd*b~yyfPK ar5CrimsonFields.iniPKl5Zj.  crimson.slnPKI]5= gfx/comet.icoPK ]5b-K V gfx/comet.pngPK]q5.+Vy>  gfx/crimsonsync.icoPKGw5=91W gfx/setup.icoPKZ5|Kެ5^ E?gfx/setupBig.bmpPK(Y5;O$> tgfx/setupSmall.bmpPKH47^ zgfx/title176.bmpPKl4J3~ gfx/title240.bmpPKH4K6*60 gfx/title320.bmpPK 6x5gfx/PK n?6src/cf/PKn?6{/ -src/cf/crimson.rcPK n?6 src/comet/PKn?6 3 src/comet/comet.rcPK]56N! src/comet.vcprojPKv4I$.6 src/crimson.rulesPKl5C ksrc/crimson.vcprojPKk?6-K src/CrimsonFieldsPPC.vddprojPKR51A`~ src/pocketpc.vspropsPK)h?6fq'2$  src/res.vcprojPKR5" src/windows.vspropsPKq4Pg  src/wm2003.vspropsPKq4Pj: W src/wm5.vspropsPK n?6e src/PKx4?k tools/cf2bmp.vcprojPKx4Jn tools/cfed.vcprojPKx4M_ tools/mkdatafile.vcprojPKx4ʛ tools/mklocale.vcprojPKx4B&A  tools/mktileset.vcprojPKx4w8A %tools/mkunitset.vcprojPKXy4Q-| *tools/windows.vspropsPK Ux5,tools/PKj?61  ,setup.issPKk?6QJJ  1setupPPC.issPK ar5 W8CrimsonFields.iniPK$$8crimson-0.5.2.orig/doc/0000700000175000017500000000000010730256755013056 5ustar uweuwecrimson-0.5.2.orig/doc/Makefile.am0000600000175000017500000000173210555733646015123 0ustar uweuweif BUILD_BI2CF BI2CF_MAN = bi2cf.6 endif if BUILD_CFED CFED_MAN = cfed.6 endif if BUILD_COMET COMET_MAN = comet.6 endif man_MANS = $(BI2CF_MAN) $(CFED_MAN) $(COMET_MAN) crimson.6 xml_DOCS = bi2cf.xml cfed.xml comet.xml crimson.xml EXTRA_DIST = bi2cf.6 cfed.6 comet.6 crimson.6 $(xml_DOCS) crimson.css XSLT_DB2MAN = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl XSLT_DB2HTML = http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl %.6: %.xml $(if $(XSLTPROC), \ $(XSLTPROC) -o "$@" $(XSLT_DB2MAN) "$<") %.html: %.xml $(if $(XSLTPROC), \ $(XSLTPROC) --stringparam html.stylesheet crimson.css \ -o "$@" $(XSLT_DB2HTML) "$<") html-local: bi2cf.html cfed.html comet.html crimson.html check-local: $(xml_DOCS) $(if $(XMLLINT), \ cd $(top_srcdir)/doc; $(XMLLINT) --noout --valid $(xml_DOCS)) # require xsltproc on make dist dist-hook: $(if $(XSLTPROC),, \ $(error xsltproc must be available in order to make dist)) crimson-0.5.2.orig/doc/Makefile.in0000600000175000017500000002544610730255125015126 0ustar uweuwe# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = doc DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = man6dir = $(mandir)/man6 am__installdirs = "$(DESTDIR)$(man6dir)" NROFF = nroff MANS = $(man_MANS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CF_LIBS = @CF_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @BUILD_BI2CF_TRUE@BI2CF_MAN = bi2cf.6 @BUILD_CFED_TRUE@CFED_MAN = cfed.6 @BUILD_COMET_TRUE@COMET_MAN = comet.6 man_MANS = $(BI2CF_MAN) $(CFED_MAN) $(COMET_MAN) crimson.6 xml_DOCS = bi2cf.xml cfed.xml comet.xml crimson.xml EXTRA_DIST = bi2cf.6 cfed.6 comet.6 crimson.6 $(xml_DOCS) crimson.css XSLT_DB2MAN = http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl XSLT_DB2HTML = http://docbook.sourceforge.net/release/xsl/current/html/docbook.xsl all: all-am .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign doc/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign doc/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-man6: $(man6_MANS) $(man_MANS) @$(NORMAL_INSTALL) test -z "$(man6dir)" || $(MKDIR_P) "$(DESTDIR)$(man6dir)" @list='$(man6_MANS) $(dist_man6_MANS) $(nodist_man6_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.6*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 6*) ;; \ *) ext='6' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man6dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man6dir)/$$inst"; \ done uninstall-man6: @$(NORMAL_UNINSTALL) @list='$(man6_MANS) $(dist_man6_MANS) $(nodist_man6_MANS)'; \ l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \ for i in $$l2; do \ case "$$i" in \ *.6*) list="$$list $$i" ;; \ esac; \ done; \ for i in $$list; do \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ case "$$ext" in \ 6*) ;; \ *) ext='6' ;; \ esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ echo " rm -f '$(DESTDIR)$(man6dir)/$$inst'"; \ rm -f "$(DESTDIR)$(man6dir)/$$inst"; \ done tags: TAGS TAGS: ctags: CTAGS CTAGS: distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$(top_distdir)" distdir="$(distdir)" \ dist-hook check-am: all-am $(MAKE) $(AM_MAKEFLAGS) check-local check: check-am all-am: Makefile $(MANS) installdirs: for dir in "$(DESTDIR)$(man6dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic mostlyclean-am distclean: distclean-am -rm -f Makefile distclean-am: clean-am distclean-generic dvi: dvi-am dvi-am: html: html-am html-am: html-local info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-exec-am: install-html: install-html-am install-info: install-info-am install-man: install-man6 install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-man: uninstall-man6 .MAKE: install-am install-strip .PHONY: all all-am check check-am check-local clean clean-generic \ dist-hook distclean distclean-generic distdir dvi dvi-am html \ html-am html-local info info-am install install-am \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-man6 \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-generic pdf pdf-am ps ps-am uninstall uninstall-am \ uninstall-man uninstall-man6 %.6: %.xml $(if $(XSLTPROC), \ $(XSLTPROC) -o "$@" $(XSLT_DB2MAN) "$<") %.html: %.xml $(if $(XSLTPROC), \ $(XSLTPROC) --stringparam html.stylesheet crimson.css \ -o "$@" $(XSLT_DB2HTML) "$<") html-local: bi2cf.html cfed.html comet.html crimson.html check-local: $(xml_DOCS) $(if $(XMLLINT), \ cd $(top_srcdir)/doc; $(XMLLINT) --noout --valid $(xml_DOCS)) # require xsltproc on make dist dist-hook: $(if $(XSLTPROC),, \ $(error xsltproc must be available in order to make dist)) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: crimson-0.5.2.orig/doc/bi2cf.60000600000175000017500000000571610506255420014132 0ustar uweuwe.\" Title: bi2cf .\" Author: Florian Dietrich .\" Generator: DocBook XSL Stylesheets v1.71.0 .\" Date: Jan 30 2003 .\" Manual: .\" Source: .\" .TH "BI2CF" "6" "Jan 30 2003" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" bi2cf \- a map conversion tool for Crimson Fields .SH "SYNOPSIS" .HP 6 \fBbi2cf\fR \fImapname\fR [\-p\ 1|2] [\-f\ b|1|2|h] [\-l] [\-t\ \fImapname\fR] [\-i\ \fImapinfo\fR] [\-o\ \fIoutfile\fR] [\-d\ \fImapdir\fR] [\-O\ \fIdestdir\fR] [\-q] .HP 6 \fBbi2cf\fR {\-h | \-v} .SH "DESCRIPTION" .PP \fBbi2cf\fR is a map conversion tool for Crimson Fields. It takes the data files of maps from Battle Isle, Battle Isle Data Disk 1 or 2, or History Line 1914\-1918 and converts them into map sources usable with the \fBcfed\fR(6) map compiler for Crimson Fields. \fBbi2cf\fR can handle both uncompressed maps and levels crunched with TPWM. .PP For some units and tiles there are no corresponding counterparts in Crimson Fields. These cases are mapped to similar ones if available. As a result some maps will not be as balanced as the originals, others may be unwinnable, and still others may even fail to compile. If this happens the map in question needs to be adjusted manually. .SH "OPTIONS" .PP \fB\-d\fR \fImapdir\fR .RS 3n Set the location of the Battle Isle map files. .RE .PP \fB\-f\fR b|1|2|h .RS 3n Force map type to Battle Isle / BI Data Disk 1 / BI Data Disk 2 / History Line, respectively. Use this option when map format autodetection does not work correctly. Maps from BI Data Disk 1 will always be detected as standard Battle Isle maps, so you have to use \fB\-f 1\fR in that case. .RE .PP \fB\-h\fR .RS 3n Print a usage message on standard output and exit. .RE .PP \fB\-i\fR \fImapinfo\fR .RS 3n Set map info message. .RE .PP \fB\-l\fR .RS 3n Skip last row and column of the map. This is necessary for maps from the PC version of Battle Isle. .RE .PP \fB\-o\fR \fIoutfile\fR .RS 3n Write map to file \fIoutfile\fR. Default file name is \fImapname.src\fR. .RE .PP \fB\-O\fR \fIdestdir\fR .RS 3n Set target directory for the converted map. This setting is ignored if a map name was given using the \fB\-t\fR option. .RE .PP \fB\-p\fR 1|2 .RS 3n Set default number of players for this map. .RE .PP \fB\-q\fR .RS 3n Run quietly. Don't print processing information on standard output. .RE .PP \fB\-t\fR \fImapname\fR .RS 3n Set title and file name for the converted map. Default is \fImaptype\-mapname\fR. .RE .PP \fB\-v\fR .RS 3n Print version information on standard output and exit. .RE .SH "SEE ALSO" .PP \fBcfed\fR(6), \fBcrimson\fR(6) .SH "COPYRIGHT" .PP Copyright \(co 2002 Florian Dietrich .PP This software is distributed under the terms of the [1]\&\fIGNU General Public License\fR (GPL). .SH "AUTHOR" .PP Florian Dietrich <\&n8flo@yahoo.de\&> .sp -1n .IP "" 3n Author. .SH "REFERENCES" .TP 3 1.\ GNU General Public License \%http://www.gnu.org/copyleft/gpl.html crimson-0.5.2.orig/doc/cfed.60000600000175000017500000006672510553735770014072 0ustar uweuwe.\" Title: cfed .\" Author: Jens Granseuer .\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: January 18 2007 .\" Manual: .\" Source: .\" .TH "CFED" "6" "January 18 2007" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" cfed \- a level compiler for Crimson Fields .SH "SYNOPSIS" .HP 5 \fBcfed\fR \fImapsource\fR \-\-tiles\ \fItileset\fR \-\-units\ \fIunitset\fR [\-o\ \fIoutfile\fR] .HP 5 \fBcfed\fR {\-\-help | \-\-version} .SH "DESCRIPTION" .PP \fBcfed\fR is the Crimson Fields level compiler. .PP It creates a \fI*.lev\fR file out of a source file \fI*.src\fR. You can use any standard text editor to create the level source files (for the syntax of those files, see the section called \(lqFILE FORMAT\(rq below). \fBcfed\fR reads the input file and creates the level file. If the name of the ouput file is not given on the command line, it is created in the same location as the source file with the .src suffix substituted by .lev. .SH "OPTIONS" .PP \fB\-\-help\fR .RS 4 Print a usage message on standard output and exit. .RE .PP \fB\-\-tiles\fR \fItileset\fR .RS 4 Use the tile definitions from \fItileset\fR when compiling the map. .RE .PP \fB\-\-units\fR \fIunitset\fR .RS 4 Use the unit definitions from \fIunitset\fR when compiling the map. .RE .PP \fB\-\-version\fR .RS 4 Print version information on standard output and exit. .RE .PP \fB\-o\fR .RS 4 Set the name and path of the converted level file. .RE .SH "FILE FORMAT" .PP A level source file consists of sections. A section is started by the section name in square brackets, i.e. the line .PP [unit] .PP starts a unit section. Lines in a section are usually composed like this: .PP qualifier = value .PP The only exceptions to this are the \fImap\fR and \fImessages\fR sections. Lines starting with # are considered comments. The following sections exist: .SS "mission" .PP This section defines some global mission parameters like map size or the graphics set to use. The mission section is mandatory and must appear before the map section in the file. Valid qualifiers are .PP name .RS 4 index of a message containing the mission title. This name will be used when presenting the list of available maps to the player. (maximum length 30 characters, mandatory) .RE .PP mapwidth .RS 4 [10\-200] (mandatory) .RE .PP mapheight .RS 4 [10\-200] (mandatory) .RE .PP nextmap .RS 4 the name of another map (without path and file ending). After the current map has been completed, this new map will be loaded automatically. This tag is only valid for \fIcampaign\fR maps. .RE .PP info .RS 4 index of the information message that is to be shown when a player requests level information. This message can contain the level name, author, revision, etc. .RE .PP campaign .RS 4 indicates whether the map is part of a campaign [0|1]. Default is 0 (not part of a campaign). See also \fIcampaignname\fR and \fIcampaigninfo\fR. .RE .PP campaignname .RS 4 index of the campaign name. It should be set only when the map actually is the first of a campaign. See also \fIcampaign\fR and \fIcampaigninfo\fR. (mandatory and valid only for the introductory map of a campaign) .RE .PP campaigninfo .RS 4 index of the information message for the campaign. This info is displayed when starting a new campaign and should contain a short outline of the background story. It is useful only when the map actually is the first of a campaign. See also \fIcampaign\fR and \fIcampaignname\fR. .RE .PP skirmish .RS 4 indicates whether the map can be played in skirmish mode [0|1]. Default is 1 (true). .RE .PP players .RS 4 selects whether the map is intended for play against another human being (2) or against the computer (1). This is for informational purposes only and defaults to 2. .RE .PP music .RS 4 name of a soundtrack (either MIDI or Ogg Vorbis) excluding the file type suffix to be played during this map. If the setting is missing, the default track for Crimson Fields will be played. .RE .PP tileset .RS 4 tileset file to be used. A tileset contains the map graphics and terrain definitions. The filename must be given without the \fI.tiles\fR suffix. If omitted, the tile set defaults to 'default'. .RE .PP unitset .RS 4 unit set file to be used. A unit set contains the unit graphics and definitions. The filename must be given without the \fI.units\fR suffix. If omitted, the unit set defaults to 'default'. .RE .SS "map" .PP The map section defines the actual map layout. It is a rectangle of the size specified in the \fImission\fR section, consisting of various symbols which describe a certain map tile type. The map section is mandatory and may not contain comments. The following symbols exist. .PP \:. .RS 4 plains .RE .PP * .RS 4 forest .RE .PP % .RS 4 mountains .RE .PP = .RS 4 shallow water .RE .PP ~ .RS 4 water .RE .PP \- .RS 4 deep water .RE .PP # .RS 4 swamp .RE .PP " .RS 4 cliff .RE .PP 0 .RS 4 headquarters, neutral entrance, east .RE .PP 1 .RS 4 headquarters, yellow entrance, east .RE .PP 2 .RS 4 headquarters, blue entrance, east .RE .PP 3 .RS 4 depot, neutral entrance, north .RE .PP 4 .RS 4 depot, yellow entrance, north .RE .PP 5 .RS 4 depot, blue entrance, north .RE .PP 6 .RS 4 factory, neutral entrance, north .RE .PP 7 .RS 4 factory, yellow entrance, north .RE .PP 8 .RS 4 factory, blue entrance, north .RE .PP 9 .RS 4 factory, neutral entrance, east .RE .PP J .RS 4 factory, yellow entrance, east .RE .PP L .RS 4 factory, blue entrance, east .RE .PP A .RS 4 city, yellow .RE .PP B .RS 4 city, blue .RE .PP C .RS 4 city, neutral .RE .PP D .RS 4 headquarters, yellow entrance, west .RE .PP E .RS 4 headquarters, blue entrance, west .RE .PP F .RS 4 headquarters, neutral entrance, west .RE .PP G .RS 4 headquarters, yellow entrance, north .RE .PP H .RS 4 headquarters, blue entrance, north .RE .PP I .RS 4 headquarters, neutral entrance, north .RE .PP > .RS 4 headquarters, east .RE .PP < .RS 4 headquarters, west .RE .PP ^ .RS 4 headquarters, north .RE .PP v .RS 4 headquarters, south .RE .PP \\ .RS 4 road, se\-nw .RE .PP | .RS 4 road, s\-n .RE .PP / .RS 4 road, sw\-ne .RE .PP y .RS 4 road, sw\-n\-ne .RE .PP Y .RS 4 road, se\-n\-nw .RE .PP X .RS 4 road, s\-se\-nw\-n .RE .PP x .RS 4 road, s\-sw\-n\-ne .RE .PP o .RS 4 road, sw\-nw\-ne\-se .RE .PP k .RS 4 road, sw\-s\-ne .RE .PP K .RS 4 road, s\-se\-nw .RE .PP ( .RS 4 road, n\-se .RE .PP ) .RS 4 road, n\-sw .RE .PP ] .RS 4 road, nw\-s .RE .PP [ .RS 4 road, ne\-s .RE .PP n .RS 4 road, sw\-se .RE .PP u .RS 4 road, nw\-ne .RE .PP T .RS 4 road, n\-s\-se .RE .PP U .RS 4 road, n\-s\-sw .RE .PP V .RS 4 road, n\-s\-ne .RE .PP W .RS 4 road, n\-s\-nw .RE .PP ! .RS 4 bridge, n\-s .RE .PP ` .RS 4 bridge, sw\-ne .RE .PP \' .RS 4 bridge, se\-nw .RE .PP a .RS 4 fence, se\-nw end .RE .PP b .RS 4 fence, nw\-se end .RE .PP c .RS 4 fence, ne\-sw end .RE .PP d .RS 4 fence, sw\-ne end .RE .PP e .RS 4 fence, n\-s .RE .PP f .RS 4 fence, sw\-ne .RE .PP g .RS 4 fence, nw\-se .RE .PP h .RS 4 fence, nw\-s .RE .PP i .RS 4 fence, ne\-s .RE .PP j .RS 4 fence, sw\-n .RE .PP l .RS 4 fence, se\-n .RE .PP m .RS 4 fence, nw\-ne .RE .PP p .RS 4 fence, sw\-se .RE .PP There is also an alternative format. If the section is called \fImap\-raw\fR instead, the map is defined by giving the hexagon identifiers directly, using the comma as a tile separator. This approach requires intimate knowledge of the tileset used and may break the map if the tileset changes. The format has been created because there are now more tiles than can be represented with single ASCII characters. .SS "player" .PP This can be used to set some player definitions. There may be a maximum of two player sections in a file. The first section encountered corresponds to the first player, the next to the second. Valid qualifiers are .PP name .RS 4 index of a message containing the player name (mandatory, maximum length 20 characters) .RE .PP briefing .RS 4 index of the player's briefing message. The briefing can be reviewed during the game by choosing the Briefing item from the Game Menu. It is also recommended to create a \fImessage\fR event to tell the players about their objectives on the first turn (see \fIevent\fR and \fImessages\fR sections below). If omitted defaults to \-1, meaning that no briefing is available. .RE .PP fcolor .RS 4 foreground color to use for this player in the format \fIr,g,b\fR, e.g. 255,0,0 for red. The default player colors match the default unit set, but different sets may use different color schemes (also see \fIbcolor\fR). .RE .PP bcolor .RS 4 background color to use for this player in the format \fIr,g,b\fR, e.g. 0,0,255 for blue. The default player colors match the default unit set, but different sets may use different color schemes (also see \fIfcolor\fR). .RE .SS "unit" .PP Each of these sections creates a unit on the map. Loaded transporter units must be specified before any units they carry. Valid qualifiers for units are .PP pos .RS 4 location of the unit on the map. If there is a building at the given location, the unit will be put in. It is also possible to let units begin inside a transport. In that case you have to make sure, however, that in the level file the transport is declared before the carried unit [x/y]. (mandatory) .RE .PP id .RS 4 unique unit identifier [0\-10000]. (mandatory) .RE .PP type .RS 4 unit type definition to use for this unit. Known definitions for the default unit set are \fIInfantry\fR, \fIMedium Tanks\fR, \fIHeavy Tanks\fR, \fIAnti\-Aircraft Tanks\fR, \fIAnti\-Aircraft Guns\fR, \fIArtillery\fR, \fIMines\fR, \fIPatrol Boats\fR, \fIFighter Squadron\fR, \fIPersonnel Carriers\fR, \fITroopships\fR, \fITransport Planes\fR, \fIScouts\fR, \fIInterceptors\fR, \fIBunkers\fR, \fITorpedo Boats\fR, \fIBomber Wing\fR, \fIHovercraft\fR, \fIGunships\fR, \fITroop Train\fR, \fIRail Guns\fR, \fIArmoured Train\fR, \fISubmarines\fR, and \fIAircraft Carriers\fR. (mandatory) .RE .PP player .RS 4 unit controller [1|2]. (mandatory) .RE .PP size .RS 4 number of vehicles for this unit [1\-6]. Defaults to 6 (undamaged). .RE .PP xp .RS 4 experience level this unit starts at [0\-6]. Defaults to 0 (Rookie, no experience). .RE .PP face .RS 4 direction the unit is heading [0\-5]. Directions are numbered clockwise from North (0) to Northwest (5). Defaults are North (0) for units controlled by player 1, and South (3) for the second player. .RE .PP crystals .RS 4 amount of crystals the unit carries. This may only be given for transports and defaults to 0. .RE .SS "building" .PP A building section is required to actually create a building (sometimes also called a shop) on the map that units can enter. This is not automatically done by placing the symbol for a building entrance in the map section. .PP pos .RS 4 location of the building entrance on the map [x/y]. (mandatory) .RE .PP id .RS 4 unique building identifier [0\-10000]. (mandatory) .RE .PP player .RS 4 building controller [1|2|0]. Units starting in unaligned buildings are automatically tagged unaligned as well. (mandatory) .RE .PP type .RS 4 type of building. Units can be repaired in buildings of type \fIWorkshop\fR. New units can be produced in buildings of type \fIFactory\fR. A building may have multiple types. Defaults to \fIDepot\fR, meaning no special attributes. In addition to these attributes, a shop which produces crystals is (automatically) called a \fIMine\fR. .RE .PP name .RS 4 index of a message containing the shop name (mandatory, maximum length 30 characters) .RE .PP mining .RS 4 amount of crystals produced each turn [0\-1000]. Defaults to 0. If given, implies type \fIMine\fR. .RE .PP capacity .RS 4 maximum amount of crystals [0\-10000]. Defaults to 1000. .RE .PP crystals .RS 4 amount of crystals in stock [0\-capacity]. Defaults to 0. .RE .PP factory .RS 4 name of a unit type definition that can be built here. If given, implies type = factory. Multiple \fIfactory\fR lines may be given for a shop. .RE .PP minweight .RS 4 weight of the smallest unit allowed to enter the building [0\-99]. Defaults to 0. .RE .PP maxweight .RS 4 weight of the heaviest unit allowed to enter the building [0\-99]. Defaults to 99. .RE .SS "event" .PP Events provide a way to interact with players during a game. They can cause actions like points being awarded or messages being displayed under certain conditions. The event type defines what happens, the event trigger controls when (or if) the event is executed. .PP .PP \fBEvent Types\fR .PP configure .RS 4 dynamically change the setting for various internal strings during the course of a game, e.g. the players' mission briefings. .RE .PP createunit .RS 4 create a unit somewhere on the map. .RE .PP destroyunit .RS 4 destroy a unit and remove it from the map. .RE .PP manipulateevent .RS 4 modify event internals. Currently this can be used to dynamically enable or disable an event. .RE .PP message .RS 4 display a message. .RE .PP mining .RS 4 set the amount of crystals for a building. .RE .PP research .RS 4 make a new unit type available for production in a factory, or remove it from the list of available units. .RE .PP score .RS 4 award points to a player. .RE .PP sethex .RS 4 change a tile on the map. .RE .PP settimer .RS 4 dynamically adjust the \fItimer\fR trigger of another event. .RE .PP .PP \fBEvent Triggers\fR .PP handicap .RS 4 the event is executed if the set handicap matches the current game settings. Usually such an event is triggered immediately on the first turn or not at all. You can, however, combine multiple events (e.g. a \fIhandicap\fR and a \fItimer\fR trigger) to change the default behaviour. .RE .PP havebuilding .RS 4 the event is executed when the player controls a certain building at a specified time. .RE .PP havecrystals .RS 4 the event is executed when the player owns a certain amount of crystals. .RE .PP haveunit .RS 4 the event is executed when the player controls a certain unit at a specified time. .RE .PP timer .RS 4 the event is unconditionally executed at the specified time. .RE .PP unitdestroyed .RS 4 the event is executed when a specified unit is destroyed or captured by the enemy. .RE .PP unitposition .RS 4 the event is executed when a specified unit ends its move on a certain target hex. .RE .PP The following list contains generic qualifiers which are valid for all event types. .PP .PP \fBQualifiers\fR .PP id .RS 4 unique event identifier [0\-200]. (mandatory) .RE .PP type .RS 4 event type (mandatory, see below). .RE .PP trigger .RS 4 event trigger (mandatory). This describes the circumstances under which the event is executed (see below). .RE .PP message .RS 4 index of a message to be displayed when the event occurs. .RE .PP title .RS 4 title of the message window. Only useful when a message is shown. .RE .PP depend .RS 4 identifier of another event. This makes the current event depend on the given event. Prior to event execution, the trigger conditions for both events are checked, and the event is activated only if both checks are successful. Mutual, circular, and transitive dependencies are supported. .RE .PP discard .RS 4 identifier of another event. When the current event is executed, the given event is discarded from the event stack and removed from the mission. .RE .PP flags .RS 4 event flags. Currently, the only available flag is 1 (disable). A disabled event will never execute, regardless of the trigger conditions. .RE .PP In addition there are special qualifiers which can only be used with certain event types or triggers. All of these are mandatory if nothing else is stated. .PP action (manipulateevent, mining, research) .RS 4 For \fImanipulateevent\fR this defines how to handle the specified flags. A value of 0 will set, 1 will clear, and 2 will toggle the flags. .sp For \fImining\fR 0 will set the crystal storage to an absolute amount, 1 will modify the current amount by the given number, 2 will set the mining rate, i.e. the amount mined each turn, and 3 will change the current mining rate by the given value. Minimum mining rate is 0, maximum is 200. .sp For \fIresearch\fR 0 allows and 1 disallows producing the specified unit type. Default is 0. .RE .PP building (mining, research) .RS 4 Identifier of the building referenced in the event. .RE .PP crystals (mining) .RS 4 Amount of crystals. The \fIaction\fR flag controls how this number is actually interpreted. .RE .PP eflags (manipulateevent) .RS 4 Event flags to be modified. Currently the only legal value for this is 1, the disable flag, which can be used to deactivate an event. Disabled events won't be triggered even if their trigger conditions are met. .RE .PP event (manipulateevent, settimer) .RS 4 Identifier of the event to be modified. .RE .PP face (createunit) .RS 4 Direction the created unit faces [0\-5]. Directions are numbered clockwise from North (0) to Northwest (5). Optional, defaults to 0. .RE .PP offset (settimer) .RS 4 Offset to use when adjusting the timer. 0 means absolute, i.e. set the trigger \fIttime\fR to the value of \fItime\fR. 1 means execution time, i.e. set it to the value of \fItime\fR plus the current time index when executing the event. 2 means current trigger configuration, i.e. add the \fItime\fR to the trigger \fIttime\fR. Note that if the target event is disabled, \fIsettimer\fR will automatically enable it. .RE .PP othermsg (score) .RS 4 For score events, one often wants to show a message not only to the player who benefits from the event but also to his opponent. Instead of creating a separate \fImessage\fR event with inverted trigger conditions you can use this qualifier and \fIothertitle\fR to do just that (optional). .RE .PP othertitle (score) .RS 4 Index of the message title for the other player (optional, see \fIothermsg\fR) .RE .PP owner (destroyunit) .RS 4 Only destroy the unit if it is controlled by this player [1,2,\-1]. Optional, default is any player (\-1). .RE .PP pos (createunit) .RS 4 hex to create the unit on. The unit will only be created if the target hex is empty at creation time or there is a shop or a valid transporter which is controlled by the player for whom the event is set up [x/y]. .RE .PP pos (destroyunit) .RS 4 hex to destroy the unit on [x/y]. The \fIpos\fR parameter can only be used if \fIunit\fR is \-1. .RE .PP pos (message) .RS 4 hex to focus the display on when showing the message [x/y] (optional). If this parameter is absent the game will try to guess a suitable hex from the trigger data, e.g. a \fIhavebuilding\fR trigger will cause it to use the shop location. .RE .PP pos (sethex) .RS 4 hex to change. If the hex is occupied by a unit at the time the event is executed it may end up on terrain it would not normally be able to enter [x/y]. .RE .PP setting (configure) .RS 4 Name of the setting you wish to change. Valid names are \fIbriefing1\fR for the briefing for the first player, \fIbriefing2\fR for the objectives for the second player, and \fInextmap\fR for the next mission in a campaign. .RE .PP size (createunit) .RS 4 Unit group size [1\-6]. Optional, defaults to 6. .RE .PP success (score) .RS 4 Amount of success points the player receives when the event occurs. Any player with a success score of 100 or more wins the game. .RE .PP unit (createunit, research) .RS 4 Name of a unit type specification to build or make available, respectively. .RE .PP unit (destroyunit) .RS 4 Identifier of the unit to be destroyed. Set to \-1 and configure the \fIpos\fR parameter to destroy a unit in a specified location instead. .RE .PP tbuilding (havebuilding, havecrystals) .RS 4 Identifier of the building to be controlled. For \fIhavecrystals\fR this parameter may be set to \-1 to check all shops a player controls, or to \-2 to check all shops and all transporters anywhere on the map. .RE .PP tcrystals (havecrystals) .RS 4 Amount of crystals needed to trigger the event [\-5000\-5000]. If the amount given is greater than 0 the player needs at least that many crystals. If it is negative, the event occurs when the player's resources drop below the absolute number. .RE .PP thandicap (handicap) .RS 4 Handicap setting to trigger the event [1 (none)|2 (player 1 handicapped)|4 (player 2 handicapped)]. You can add up the numbers to trigger on more than one setting. .RE .PP tile (sethex) .RS 4 Identifier of the terrain the target hex will be changed to. .RE .PP time (settimer) .RS 4 Time index. The \fIoffset\fR flag controls in what way this number is used to adjust the targetted trigger. .RE .PP towner (havebuilding, havecrystals, haveunit, unitdestroyed, unitposition) .RS 4 The event will only occur if the owner of the building or unit is the same as the player specified here [1|2]. For the \fIunitdestroyed\fR trigger it is only required if \fItunit\fR is \-1. In this case you can select the player whose units have to be destroyed to activate the event. This setting may be omitted and defaults to the player not owning the event, while for \fIhavecrystals\fR and \fIunitposition\fR the default is the player owning the event. You must supply this key for the other two trigger types. .RE .PP ttime (havebuilding, haveunit, timer) .RS 4 Time at which the event conditions should be checked. For \fItimer\fR the event will always be executed at this time. Time calculation starts with 0 at the start of a mission and increases by 1 each time the players change. The movement phase of player 2 on turn 10 is at time index 19 ((turn \- 1) * 2 + (player \- 1)), for example. (mandatory only for \fItimer\fR. If omitted for the other triggers, the condition will be checked each turn.) .RE .PP tunit (haveunit, unitdestroyed, unitposition) .RS 4 Identifier of the unit to be targeted. For \fIunitdestroyed\fR and \fIunitposition\fR this may take a value of \-1 which will activate the event when all enemy units have been destroyed or any unit controlled by this player has reached the destination hex, respectively. For these two triggers you can also use a unit type, e.g. \fIInfantry\fR to target an entire unit class. .RE .PP tpos (unitposition) .RS 4 Coordinates of the target hex [x/y] .RE .PP value (configure) .RS 4 Index of the message to use as the new briefing when changing a briefing, file name of the next mission (excluding the suffix) when setting the next map. .RE .PP xp (createunit) .RS 4 Initial experience level [0\-6]. Optional, defaults to 0. .RE .SS "messages" .PP The \fImessages\fR section contains all text messages that may possibly be displayed in the course of a mission. The format of this section differs from that of the other sections. Here is an excerpt from an imaginary level file. .sp .RS 4 .nf [messages(en)] This is a message. % this line separates messages This is the second message. % separator lines can be used for comments This is the third message, containing a line break. [/messages] this marks the end of the messages section .fi .RE .PP The two characters in brackets identify the language messages in this section are written in. There is one messages section for each language the mission supports. The \fI(en)\fR in the section title shows that this section contains English messages. All messages must be encoded in UTF\-8. .SH "EXAMPLE" .sp .RS 4 .nf ### This is a simple example mission file [mission] # mission title is "The Great Example" name = 5 mapwidth = 11 mapheight = 10 # the first message in the [messages] section # will be used as level information info = 0 # we use the default tileset and unit set so we could # omit the next two lines tileset = default unitset = default [map] ***...***.. **...****.= *<^1n]*..== **v..(..==~ ***...].=~~ #=#.==!==== ======(]... %*.=...E^>. %%..%...v.. %%%%.%...** ### first player \- The Good [player] name = 6 # second message is briefing for this player briefing = 1 ### second player \- The Bad [player] name = 7 # third message is briefing for this player briefing = 2 ### units for player 1 [unit] # this unit will start in the building pos = 3/2 player = 1 id = 0 type = Infantry [unit] pos = 5/4 player = 1 id = 1 type = Medium Tanks [unit] pos = 6/3 player = 1 id = 2 type = Medium Tanks [unit] pos = 3/2 player = 1 id = 3 type = Scouts ### units for player 2 [unit] pos = 7/7 player = 2 id = 10 type = Anti\-Aircraft Tanks [unit] pos = 6/6 player = 2 id = 11 type = Personnel Carriers [unit] pos = 7/6 player = 2 id = 12 type = Infantry [unit] pos = 7/7 player = 2 id = 13 type = Heavy Tanks ### buildings # HQ of the Good [building] name = 8 pos = 3/2 id = 0 player = 1 # can repair units here type = workshop crystals = 25 # HQ of the Bad [building] name = 9 pos = 7/7 id = 1 player = 2 # can repair and build units type = workshop type = factory # the following units can be built factory = personnel carriers factory = anti\-aircraft guns factory = bomber wing crystals = 25 ### events # player 1 wins if he conquers # the enemy building at any time... [event] type = score id = 0 player = 1 trigger = havebuilding tbuilding = 1 towner = 1 # the next line could be left out ttime = \-1 success = 100 message = 3 title = 4 # ...or destroys all enemy units [event] type = score id = 1 player = 1 trigger = unitdestroyed tunit = \-1 success = 100 # player 2 wins if he conquers # the enemy building at any time... [event] type = score id = 2 player = 2 trigger = havebuilding tbuilding = 0 towner = 2 success = 100 message = 3 title = 4 # ...or destroys all enemy units as well [event] type = score id = 3 player = 2 trigger = unitdestroyed tunit = \-1 success = 100 # display briefings on first turn # [event] type = message id = 4 player = 1 trigger = timer ttime = 0 title = 5 message = 1 # Even though time index 0 is during player 1's phase # we want to trigger the message for player 2 as well. # This way it gets queued for display during the turn # replay. Otherwise player 2 would only see the briefing # after his replay. [event] type = message id = 5 player = 2 trigger = timer ttime = 0 title = 5 message = 2 # we want to support difficulty levels (handicaps) # # if player 1 is handicapped we allocate some more # crystals to players 2's factory [event] type = mining id = 6 player = 2 trigger = handicap # 1 is no handicap, 2 is player 1, 4 is player 2 thandicap = 2 building = 1 action = 1 crystals = 35 # if player 2 is handicapped player 1 gets another tank [event] type = createunit id = 7 player = 1 trigger = handicap thandicap = 4 unit = Medium Tanks pos = 3/2 ### english messages [messages(en)] The Great Example Revision 6 (16\-08\-2004) by Jens Granseuer % This is a nice introductory message, so that player 1 knows what he is expected to do. Word wraps are done automatically, so don't include line breaks if you don't want them. So, Player 1, let's take them apart: Either conquer the enemy headquarters or destroy all their troops. % This should present the situation to player 2. You are being attacked. Defend yourself. The attack is considered repelled if you gain control of the enemy headquarters or the entire attacking army is no more. % This is the success message for conquering the enemy headquarters. Congratulations! % Hip! Hip! Hurrah! % The Great Example % The Good % The Bad % HQ of the Good % HQ of the Bad [/messages] .fi .RE .SH "NOTES" .PP The file format of level files (source and data) is subject to change without notice. If you get an error "File not of the required type", it mostly should be sufficient to feed the appropriate source file to \fBcfed\fR again to create a valid level file. However, no promises are being made. You have been warned! .PP \fBcfed\fR will eventually be phased out in favour of \fBCoMET\fR, the graphical map editor for \fBcrimson\fR. .SH "SEE ALSO" .PP \fBcrimson\fR(6), \fBbi2cf\fR(6) .SH "COPYRIGHT" .PP Copyright \(co 2000\-2007 Jens Granseuer .PP This software is distributed under the terms of the \fIGNU General Public License\fR\&[1] (GPL). .SH "AUTHOR" .PP \fBJens Granseuer\fR <\&jensgr@gmx.net\&> .sp -1n .IP "" 4 Author. .SH "REFERENCES" .IP " 1." 4 GNU General Public License .RS 4 \%http://www.gnu.org/copyleft/gpl.html .RE crimson-0.5.2.orig/doc/comet.60000600000175000017500000000336510555214431014253 0ustar uweuwe.\" Title: comet .\" Author: Jens Granseuer .\" Generator: DocBook XSL Stylesheets v1.71.1 .\" Date: January 20 2007 .\" Manual: .\" Source: .\" .TH "COMET" "6" "January 20 2007" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" comet \- a mission editor for Crimson Fields .SH "SYNOPSIS" .HP 6 \fBcomet\fR [\-\-level\ \fIlevel\fR] [\-\-width\ \fIwidth\fR] [\-\-height\ \fIwidth\fR] [\-\-fullscreen\ 1|0] [\-\-sound\ 1|0] .HP 6 \fBcomet\fR {\-\-help | \-\-version} .SH "DESCRIPTION" .PP \fBcomet\fR (the Crimson Fields Map Editing Tool) is a mission editor for Crimson Fields. .SH "OPTIONS" .PP \fB\-\-level\fR \fIlevel\fR .RS 4 Start the editor with the \fIlevel\fR loaded. .RE .PP \fB\-\-width\fR \fIw\fR .RS 4 Set screen width to \fIw\fR. Minimum screen width is 320. Default is 800. .RE .PP \fB\-\-height\fR \fIh\fR .RS 4 Set screen height to \fIh\fR. Minimum screen height is 240. Default is 600. .RE .PP \fB\-\-fullscreen\fR 1|0 .RS 4 Turn fullscreen mode on/off. The default is to start in windowed mode. .RE .PP \fB\-\-sound\fR 1|0 .RS 4 Turn sound on/off. The default is on. .RE .PP \fB\-\-help\fR .RS 4 Print a usage message on standard output and exit. .RE .PP \fB\-\-version\fR .RS 4 Print version information on standard output and exit. .RE .SH "SEE ALSO" .PP \fBcfed\fR(6), \fBcrimson\fR(6) .SH "COPYRIGHT" .PP Copyright \(co 2002\-2007 Jens Granseuer .PP This software is distributed under the terms of the \fIGNU General Public License\fR\&[1] (GPL). .SH "AUTHOR" .PP \fBJens Granseuer\fR <\&jensgr@gmx.net\&> .sp -1n .IP "" 4 Author. .SH "REFERENCES" .IP " 1." 4 GNU General Public License .RS 4 \%http://www.gnu.org/copyleft/gpl.html .RE crimson-0.5.2.orig/doc/crimson.60000600000175000017500000003645310616431165014625 0ustar uweuwe.\" Title: crimson .\" Author: Jens Granseuer .\" Generator: DocBook XSL Stylesheets v1.72.0 .\" Date: January 20 2007 .\" Manual: .\" Source: .\" .TH "CRIMSON" "6" "January 20 2007" "" "" .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .SH "NAME" crimson \- a hex\-based tactical combat game .SH "SYNOPSIS" .HP 8 \fBcrimson\fR [\-\-level\ \fIlevel\fR] [\-\-width\ \fIw\fR] [\-\-height\ \fIh\fR] [\-\-fullscreen\ 1|0] [\-\-sound\ 1|0] .HP 8 \fBcrimson\fR {\-\-help | \-\-version} .SH "DESCRIPTION" .PP Crimson Fields is a tactical war game in the tradition of the popular Battle Isle. Two players command a number of units on a map of hexagons, trying to accomplish mission objectives ranging from defending important locations to simply destroying all enemy forces. Damaged units may be repaired or replaced by new recruits, while victorious squadrons will improve their abilities so they will be even more difficult to beat next time. .PP The game can be played against a human adversary in hot\-seat mode, over a network, or via e\-mail, or against a computer player. .PP The level editor \fBcfed\fR(6) can be used to create your own levels. .SH "OPTIONS" .PP If called without options \fBcrimson\fR will open its main window using the settings from the last session or the defaults if no previous settings exist. .PP \fB\-\-level\fR \fIlevel\fR .RS 4 Skip the level selection window and load the mission file \fIlevel\fR. The file may be either a standard level file or a saved game. When starting a new game this way you will be playing a single map against the computer without any handicaps. .RE .PP \fB\-\-width\fR \fIw\fR .RS 4 Set screen width to \fIw\fR. Minimum screen width is 320. Default is 800. .RE .PP \fB\-\-height\fR \fIh\fR .RS 4 Set screen height to \fIh\fR. Minimum screen height is 240. Default is 600. .RE .PP \fB\-\-fullscreen\fR 1|0 .RS 4 Turn fullscreen mode on/off. The default is to start in windowed mode. .RE .PP \fB\-\-sound\fR 1|0 .RS 4 Turn sound on/off. The default is on. .RE .PP \fB\-\-help\fR .RS 4 Print a usage message on standard output and exit. .RE .PP \fB\-\-version\fR .RS 4 Print version information on standard output and exit. .RE .PP The display and sound options given to \fBcrimson\fR on startup will be saved to file and restored on the next program start. .SH "GETTING STARTED" .SS "Introduction" .PP The once peaceful planet Nexus has been invaded by beings calling themselves the Empire of Kand who are determined to conquer Nexus or destroy it completely. The public unrest has become violent as the people attempt revolution against the invasion, but the Empire of Kand are quick to silence opposition. Nexus is on the verge of war and its people have formed factions to battle the Empire. As a member of one of the major rebel factions, the Free Nexus Army, your goals are obvious: to drive the intruders back to whichever part of the galaxy they came from and restore peace on planet Nexus... .PP (This is the background story for most of the included missions and the default campaign. There may be maps with entirely different settings.) .SS "Main Menu" .PP The main screen presents a number of widgets to configure the game. The most important decision is whether you want to play a skirmish match, a campaign, or load a saved game. Skirmishes are stand\-alone maps while campaigns consist of a number of maps which must be played (and won) in sequence. Each map that you advance to during a campaign will also be unlocked for skirmish matches. While campaigns can only be played against the computer, skirmishes can additionally be played as hot\-seat matches (two players on one computer taking turns), e\-mail matches (see the section called \(lqPLAY\-BY\-E\-MAIL\(rq), or over a network, and when playing against the computer you get to choose which side you want to play on. For both game types you can optionally define a handicap, to make the game a bit easier or harder. What this means exactly depends on the map being played but in most cases a handicapped player will have fewer units or resources at his disposal than his opponent. .PP The large box on the left lists all available skirmishes, campaigns, or saved games, while the box on the right displays a small image of the selected map or, for campaigns, the story. For skirmishes, the number in brackets shows the recommended number of players. Missions designed for one player are often rather unbalanced if played against another human since the computer plays so different from a human, although a handicap can sometimes fix this. .PP After you have selected a map hit Start to enter the game. .SS "First Steps" .PP After starting the match you will be presented with the mission briefing. Here you are given your orders and objectives to win the map. As both players usually have different and conflicting goals, each player gets his own briefing session at the beginning of his first turn. .PP After the briefing you will be presented with the map. This is your command center. From here you can issue most of the orders that will determine the outcome of the mission. The first player commands the yellow units while the second player or computer takes control of the blue units. .PP The map consists of small regions of land (or water) each known as a \fIhex\fR (sometimes also called \fIfield\fR or \fIsquare\fR). Left\-clicking on a hex selects that hex and moves the cursor to it. If there is a unit on the selected hex then a small bar will appear in the lower left of the screen showing the rank of the unit, its type, and the squad size (see the section called \(lqExperience\(rq for more information about ranks). If there is instead a building or shop on the selected hex, the information bar displays the name of the shop and possibly some icons representing special attributes (see the section called \(lqCRYSTALS\(rq for details). Shops may occupy several fields, but they only have a single entrance, which is marked by the colour of the respective owner. Buildings with a white entrance are neutral and not controlled by any player. .PP A right\-click on one of your units generally brings up a context menu for that unit (this does not apply to enemy units). Here you can view the unit stats, or inspect its contents (transporters only). Other units like mine\-sweepers may have special skills which also show up here. If the unit is not a transporter and does not offer any special skills, the menu is skipped and you are directly taken to the stats display. .PP The stats window is basically divided in two parts. The top part shows the unit name and its values for speed, armour, and effectiveness against ground troops, aircraft, and ships in that order, from the top left to the bottom right. Most units have a weapon range of 1, meaning they can shoot at units one hex away (i.e. directly next to it). For units with different settings, the actual range is given in brackets after the weapon power. The second part of the window lists the most important terrain types. Shaded terrain indicates that the unit cannot cross that ground. .PP Right\-clicking anywhere but on a unit or pressing F1 pops up the Game menu where you can review your mission objectives, take a look at an overview map, or save your game, for example. .PP You select one of your units by simply clicking on it. Large parts of the map will now be shaded to indicate that the unit cannot move there. Unshaded enemy units are potential targets. To move to an accessible field or attack a foe, simply double\-click the respective hex. If you accidentally sent your unit to a hex you did not want it to go to, right\-clicking on the unit gives you the option of reverting the last move, as long as it did not trigger any special events. .PP If you click twice on one of your shops or a neutral one, you enter that building. Of course, you can also move units into shops, although only some units (\fIInfantry\fR in the default set) can move into shops not owned by you, and some buildings may not allow all unit types. Quite often buildings are important mission objectives. Taking the enemy headquarters, e.g., is a very common goal. But even if you do not specifically need to control a certain shop for victory, it can still be very helpful as it may be possible to repair or build units (see the section called \(lqCRYSTALS\(rq). .PP When you have issued all orders, select End Turn from the Game menu. Your commands are then executed, fights are resolved, and your opponent gets his chance to strike back... .SH "MOVEMENT" .PP Each unit may only move once each turn, and only if it did not initiate combat on the same turn. \fIArtillery\fR and \fIAnti\-Aircraft Guns\fR cannot attack if they have already been moved on the same turn. To move around on the map, a unit needs movement points. The number in the upper left corner of the unit information dialog (which can be brought up for one of your units by right\-clicking it) indicates how many hexes the unit can move under optimal circumstances. The actual range is determined by several factors. .PP For ordinary ground units the terrain can greatly reduce the range of action. The maximum can only ever be reached on roads, everything else will slow the unit down, and mountains more so than forest. For airborne units or ships, terrain is of no importance. .PP Enemy units can be trapped in order to prevent them from using superior speed or to deny them access to certain areas of the map. A unit which attempts to cross a hex between two hostile units or one hostile unit and inaccessible terrain will be stopped immediately after passing through. .PP A unit cannot leave a transport or building and enter another one on the same turn. Enemy buildings can only be conquered by infantry units. .SH "COMBAT" .SS "Results" .PP Basically the probability to hit an enemy unit in combat is the same for all unit types, although the attacker always gets a slight advantage. This hit probability is then modified by effects such as experience, distance to the target, terrain, or wedging (see below). Similarly, each unit gets assigned a probability for evading an attack which is then modified by experience, terrain effects and blocking. If a unit scores a hit it will increase its attack pool by an amount equal to its strength. A unit which successfully evades an attack will have its defence pool grow by an amount equal to its defence or armour value. Finally, each attack pool is compared to the enemy's defence pool, and the resulting ratio determines the casualties on both sides. .SS "Terrain" .PP Terrain is an important factor in combat as it can heavily influence a unit's effectiveness. For example, fighting on a road or open plains will greatly increase attacking strength but offers relatively poor defensive capabilities, whereas a unit in the mountains will profit from the higher position in both attack and defence. Terrain modifiers do not apply for aircraft. .SS "Wedging" .PP Friendly units can help increase the combat strength of an attacking unit without attacking themselves. For each friendly unit which is adjacent to and capable of shooting at the defender, the attacker will get a 10 per cent bonus. If the unit is adjacent to the defender, but cannot attack it the bonus is reduced to 5 per cent. A friendly unit in the back of the defender will earn another 5 per cent bonus, or 10 if it could also attack. It does not matter whether a wedging unit actually attacks the defender. Wedging does not work for long\-range attacks. .SS "Blocking" .PP In a manner similar to wedging, defending units may improve their position in combat. For each friendly unit adjacent to the attacker and the defender, the defending unit will have its combat strength increased by 10 per cent. Just like wedging, blocking does not help against long\-range attacks. .SS "Experience" .PP Veteran units are usually much stronger than newly assembled ones. If you manage to wipe out an enemy unit your unit will receive three experience points. If the enemy is only damaged you will still get one point. Every three experience points a unit advances to a new rank which improves its combat skills. Still, a seasoned infantry unit will have a very hard time against a group of recently recruited heavy tanks. Destroying mines does not earn any experience points. .SH "CRYSTALS" .PP Crystals represent the resources required to maintain and enlarge your army. You need them to repair damaged units or build new ones. .SS "Repairs" .PP Units which have been damaged in combat can be repaired in any building equipped for this purpose (a workshop). To check whether a building is a workshop, click on it. For workshops a wrench icon will be displayed in the small info bar that appears in the lower left of the screen, and a repair button is available in the icon bar inside. Repairing will restore a unit to its full strength and requires an amount of 5 crystals, no matter what kind of unit it is or how badly is was damaged. Apart from the crystal cost the unit loses one experience point for each rookie that fills up an empty slot. .PP The ability to repair damaged units is not necessarily limited to shops. Some unit types may offer the same service (from the standard unit set, for example, the \fIAircraft Carriers\fR can bring aircraft back into shape). Repairs in units works exactly the same way as in workshops, and you also need to supply the crystals to do so. .SS "Production" .PP To build new units you need some crystals and a factory (hammer icon). The amount of crystals required depends on the type of unit you want to build: A squad of light reconnaissance vehicles is cheaper than a group of heavy attack choppers. Most factories can not produce all unit types, even if you could afford it. If you click on the production button inside a factory, you are shown the list of units which can be built in this particular factory. Next to each unit type is the amount of crystals that will be consumed. Newly built units can only move on your next turn. .SS "Mines" .PP To replenish your supply of crystals you need mines. Mines are buildings which 'produce' a certain amount of crystals each turn. They can not be identified from the outside. Many maps do not have any mines at all, so it is always a good idea to consider carefully what you spend your resources on. Crystals can be transferred from one building to another (e.g. from a mine to a factory) using any transporter unit. .SH "PLAY\-BY\-E\-MAIL" .PP If Crimson Fields is played in play\-by\-e\-mail mode, the game will automatically be saved whenever a player ends her turn. The resulting save file can then be sent to your opponent using your favourite mail client program. .PP On your first turn you will be asked for a password. You will be prompted for this password at the beginning of each of your turns to prevent your opponent from spying. Note, however, that the password only offers very mild protection if you are playing against deliberate cheaters. Choose your enemies carefully! .SH "FILES" .PP Unix .IP "" 4 \fI~/.crimson/crimsonrc\fR .IP "" 4 \fI~/.crimson/levels/\fR .SH "SEE ALSO" .PP \fBcfed\fR(6), \fBbi2cf\fR(6) .SH "COPYRIGHT" .PP Copyright \(co 2000\-2007 Jens Granseuer .PP This software is distributed under the terms of the \fIGNU General Public License\fR\&[1] (GPL). .SH "AUTHOR" .PP \fBJens Granseuer\fR <\&jensgr@gmx.net\&> .sp -1n .IP "" 4 Author. .SH "REFERENCES" .IP " 1." 4 GNU General Public License .RS 4 \%http://www.gnu.org/copyleft/gpl.html .RE crimson-0.5.2.orig/doc/bi2cf.xml0000600000175000017500000001302307727124534014567 0ustar uweuwe Jan 30 2003 Florian Dietrich

n8flo@yahoo.de
bi2cf 6 bi2cf a map conversion tool for Crimson Fields bi2cf mapname -p 1|2 -f b|1|2|h -l -t mapname -i mapinfo -o outfile -d mapdir -O destdir -q bi2cf -h -v Description bi2cf is a map conversion tool for Crimson Fields. It takes the data files of maps from Battle Isle, Battle Isle Data Disk 1 or 2, or History Line 1914-1918 and converts them into map sources usable with the cfed6 map compiler for Crimson Fields. bi2cf can handle both uncompressed maps and levels crunched with TPWM. For some units and tiles there are no corresponding counterparts in Crimson Fields. These cases are mapped to similar ones if available. As a result some maps will not be as balanced as the originals, others may be unwinnable, and still others may even fail to compile. If this happens the map in question needs to be adjusted manually. Options mapdir Set the location of the Battle Isle map files. b|1|2|h Force map type to Battle Isle / BI Data Disk 1 / BI Data Disk 2 / History Line, respectively. Use this option when map format autodetection does not work correctly. Maps from BI Data Disk 1 will always be detected as standard Battle Isle maps, so you have to use in that case. Print a usage message on standard output and exit. mapinfo Set map info message. Skip last row and column of the map. This is necessary for maps from the PC version of Battle Isle. outfile Write map to file outfile. Default file name is mapname.src. destdir Set target directory for the converted map. This setting is ignored if a map name was given using the option. 1|2 Set default number of players for this map. Run quietly. Don't print processing information on standard output. mapname Set title and file name for the converted map. Default is maptype-mapname. Print version information on standard output and exit. See Also cfed6, crimson6 Copyright Copyright © 2002 Florian Dietrich This software is distributed under the terms of the GNU General Public License (GPL). crimson-0.5.2.orig/doc/cfed.xml0000600000175000017500000013014410553735705014506 0ustar uweuwe January 18 2007 Jens Granseuer
jensgr@gmx.net
cfed 6 cfed a level compiler for Crimson Fields cfed mapsource --tiles tileset --units unitset -o outfile cfed --help --version Description cfed is the Crimson Fields level compiler. It creates a *.lev file out of a source file *.src. You can use any standard text editor to create the level source files (for the syntax of those files, see below). cfed reads the input file and creates the level file. If the name of the ouput file is not given on the command line, it is created in the same location as the source file with the .src suffix substituted by .lev. Options Print a usage message on standard output and exit. tileset Use the tile definitions from tileset when compiling the map. unitset Use the unit definitions from unitset when compiling the map. Print version information on standard output and exit. Set the name and path of the converted level file. File Format A level source file consists of sections. A section is started by the section name in square brackets, i.e. the line [unit] starts a unit section. Lines in a section are usually composed like this: qualifier = value The only exceptions to this are the map and messages sections. Lines starting with # are considered comments. The following sections exist: mission This section defines some global mission parameters like map size or the graphics set to use. The mission section is mandatory and must appear before the map section in the file. Valid qualifiers are name index of a message containing the mission title. This name will be used when presenting the list of available maps to the player. (maximum length 30 characters, mandatory) mapwidth [10-200] (mandatory) mapheight [10-200] (mandatory) nextmap the name of another map (without path and file ending). After the current map has been completed, this new map will be loaded automatically. This tag is only valid for campaign maps. info index of the information message that is to be shown when a player requests level information. This message can contain the level name, author, revision, etc. campaign indicates whether the map is part of a campaign [0|1]. Default is 0 (not part of a campaign). See also campaignname and campaigninfo. campaignname index of the campaign name. It should be set only when the map actually is the first of a campaign. See also campaign and campaigninfo. (mandatory and valid only for the introductory map of a campaign) campaigninfo index of the information message for the campaign. This info is displayed when starting a new campaign and should contain a short outline of the background story. It is useful only when the map actually is the first of a campaign. See also campaign and campaignname. skirmish indicates whether the map can be played in skirmish mode [0|1]. Default is 1 (true). players selects whether the map is intended for play against another human being (2) or against the computer (1). This is for informational purposes only and defaults to 2. music name of a soundtrack (either MIDI or Ogg Vorbis) excluding the file type suffix to be played during this map. If the setting is missing, the default track for Crimson Fields will be played. tileset tileset file to be used. A tileset contains the map graphics and terrain definitions. The filename must be given without the .tiles suffix. If omitted, the tile set defaults to 'default'. unitset unit set file to be used. A unit set contains the unit graphics and definitions. The filename must be given without the .units suffix. If omitted, the unit set defaults to 'default'. map The map section defines the actual map layout. It is a rectangle of the size specified in the mission section, consisting of various symbols which describe a certain map tile type. The map section is mandatory and may not contain comments. The following symbols exist. ​.plains *forest %mountains =shallow water ~water -deep water #swamp "cliff 0headquarters, neutral entrance, east 1headquarters, yellow entrance, east 2headquarters, blue entrance, east 3depot, neutral entrance, north 4depot, yellow entrance, north 5depot, blue entrance, north 6factory, neutral entrance, north 7factory, yellow entrance, north 8factory, blue entrance, north 9factory, neutral entrance, east Jfactory, yellow entrance, east Lfactory, blue entrance, east Acity, yellow Bcity, blue Ccity, neutral Dheadquarters, yellow entrance, west Eheadquarters, blue entrance, west Fheadquarters, neutral entrance, west Gheadquarters, yellow entrance, north Hheadquarters, blue entrance, north Iheadquarters, neutral entrance, north >headquarters, east <headquarters, west ^headquarters, north vheadquarters, south \road, se-nw |road, s-n /road, sw-ne yroad, sw-n-ne Yroad, se-n-nw Xroad, s-se-nw-n xroad, s-sw-n-ne oroad, sw-nw-ne-se kroad, sw-s-ne Kroad, s-se-nw (road, n-se )road, n-sw ]road, nw-s [road, ne-s nroad, sw-se uroad, nw-ne Troad, n-s-se Uroad, n-s-sw Vroad, n-s-ne Wroad, n-s-nw !bridge, n-s `bridge, sw-ne 'bridge, se-nw afence, se-nw end bfence, nw-se end cfence, ne-sw end dfence, sw-ne end efence, n-s ffence, sw-ne gfence, nw-se hfence, nw-s ifence, ne-s jfence, sw-n lfence, se-n mfence, nw-ne pfence, sw-se There is also an alternative format. If the section is called map-raw instead, the map is defined by giving the hexagon identifiers directly, using the comma as a tile separator. This approach requires intimate knowledge of the tileset used and may break the map if the tileset changes. The format has been created because there are now more tiles than can be represented with single ASCII characters. player This can be used to set some player definitions. There may be a maximum of two player sections in a file. The first section encountered corresponds to the first player, the next to the second. Valid qualifiers are name index of a message containing the player name (mandatory, maximum length 20 characters) briefing index of the player's briefing message. The briefing can be reviewed during the game by choosing the Briefing item from the Game Menu. It is also recommended to create a message event to tell the players about their objectives on the first turn (see event and messages sections below). If omitted defaults to -1, meaning that no briefing is available. fcolor foreground color to use for this player in the format r,g,b, e.g. 255,0,0 for red. The default player colors match the default unit set, but different sets may use different color schemes (also see bcolor). bcolor background color to use for this player in the format r,g,b, e.g. 0,0,255 for blue. The default player colors match the default unit set, but different sets may use different color schemes (also see fcolor). unit Each of these sections creates a unit on the map. Loaded transporter units must be specified before any units they carry. Valid qualifiers for units are pos location of the unit on the map. If there is a building at the given location, the unit will be put in. It is also possible to let units begin inside a transport. In that case you have to make sure, however, that in the level file the transport is declared before the carried unit [x/y]. (mandatory) id unique unit identifier [0-10000]. (mandatory) type unit type definition to use for this unit. Known definitions for the default unit set are Infantry, Medium Tanks, Heavy Tanks, Anti-Aircraft Tanks, Anti-Aircraft Guns, Artillery, Mines, Patrol Boats, Fighter Squadron, Personnel Carriers, Troopships, Transport Planes, Scouts, Interceptors, Bunkers, Torpedo Boats, Bomber Wing, Hovercraft, Gunships, Troop Train, Rail Guns, Armoured Train, Submarines, and Aircraft Carriers. (mandatory) player unit controller [1|2]. (mandatory) size number of vehicles for this unit [1-6]. Defaults to 6 (undamaged). xp experience level this unit starts at [0-6]. Defaults to 0 (Rookie, no experience). face direction the unit is heading [0-5]. Directions are numbered clockwise from North (0) to Northwest (5). Defaults are North (0) for units controlled by player 1, and South (3) for the second player. crystals amount of crystals the unit carries. This may only be given for transports and defaults to 0. building A building section is required to actually create a building (sometimes also called a shop) on the map that units can enter. This is not automatically done by placing the symbol for a building entrance in the map section. pos location of the building entrance on the map [x/y]. (mandatory) id unique building identifier [0-10000]. (mandatory) player building controller [1|2|0]. Units starting in unaligned buildings are automatically tagged unaligned as well. (mandatory) type type of building. Units can be repaired in buildings of type Workshop. New units can be produced in buildings of type Factory. A building may have multiple types. Defaults to Depot, meaning no special attributes. In addition to these attributes, a shop which produces crystals is (automatically) called a Mine. name index of a message containing the shop name (mandatory, maximum length 30 characters) mining amount of crystals produced each turn [0-1000]. Defaults to 0. If given, implies type Mine. capacity maximum amount of crystals [0-10000]. Defaults to 1000. crystals amount of crystals in stock [0-capacity]. Defaults to 0. factory name of a unit type definition that can be built here. If given, implies type = factory. Multiple factory lines may be given for a shop. minweight weight of the smallest unit allowed to enter the building [0-99]. Defaults to 0. maxweight weight of the heaviest unit allowed to enter the building [0-99]. Defaults to 99. event Events provide a way to interact with players during a game. They can cause actions like points being awarded or messages being displayed under certain conditions. The event type defines what happens, the event trigger controls when (or if) the event is executed. Event Types configure dynamically change the setting for various internal strings during the course of a game, e.g. the players' mission briefings. createunit create a unit somewhere on the map. destroyunit destroy a unit and remove it from the map. manipulateevent modify event internals. Currently this can be used to dynamically enable or disable an event. message display a message. mining set the amount of crystals for a building. research make a new unit type available for production in a factory, or remove it from the list of available units. score award points to a player. sethex change a tile on the map. settimer dynamically adjust the timer trigger of another event. Event Triggers handicap the event is executed if the set handicap matches the current game settings. Usually such an event is triggered immediately on the first turn or not at all. You can, however, combine multiple events (e.g. a handicap and a timer trigger) to change the default behaviour. havebuilding the event is executed when the player controls a certain building at a specified time. havecrystals the event is executed when the player owns a certain amount of crystals. haveunit the event is executed when the player controls a certain unit at a specified time. timer the event is unconditionally executed at the specified time. unitdestroyed the event is executed when a specified unit is destroyed or captured by the enemy. unitposition the event is executed when a specified unit ends its move on a certain target hex. The following list contains generic qualifiers which are valid for all event types. Qualifiers id unique event identifier [0-200]. (mandatory) type event type (mandatory, see below). trigger event trigger (mandatory). This describes the circumstances under which the event is executed (see below). message index of a message to be displayed when the event occurs. title title of the message window. Only useful when a message is shown. depend identifier of another event. This makes the current event depend on the given event. Prior to event execution, the trigger conditions for both events are checked, and the event is activated only if both checks are successful. Mutual, circular, and transitive dependencies are supported. discard identifier of another event. When the current event is executed, the given event is discarded from the event stack and removed from the mission. flags event flags. Currently, the only available flag is 1 (disable). A disabled event will never execute, regardless of the trigger conditions. In addition there are special qualifiers which can only be used with certain event types or triggers. All of these are mandatory if nothing else is stated. action (manipulateevent, mining, research) For manipulateevent this defines how to handle the specified flags. A value of 0 will set, 1 will clear, and 2 will toggle the flags. For mining 0 will set the crystal storage to an absolute amount, 1 will modify the current amount by the given number, 2 will set the mining rate, i.e. the amount mined each turn, and 3 will change the current mining rate by the given value. Minimum mining rate is 0, maximum is 200. For research 0 allows and 1 disallows producing the specified unit type. Default is 0. building (mining, research) Identifier of the building referenced in the event. crystals (mining) Amount of crystals. The action flag controls how this number is actually interpreted. eflags (manipulateevent) Event flags to be modified. Currently the only legal value for this is 1, the disable flag, which can be used to deactivate an event. Disabled events won't be triggered even if their trigger conditions are met. event (manipulateevent, settimer) Identifier of the event to be modified. face (createunit) Direction the created unit faces [0-5]. Directions are numbered clockwise from North (0) to Northwest (5). Optional, defaults to 0. offset (settimer) Offset to use when adjusting the timer. 0 means absolute, i.e. set the trigger ttime to the value of time. 1 means execution time, i.e. set it to the value of time plus the current time index when executing the event. 2 means current trigger configuration, i.e. add the time to the trigger ttime. Note that if the target event is disabled, settimer will automatically enable it. othermsg (score) For score events, one often wants to show a message not only to the player who benefits from the event but also to his opponent. Instead of creating a separate message event with inverted trigger conditions you can use this qualifier and othertitle to do just that (optional). othertitle (score) Index of the message title for the other player (optional, see othermsg) owner (destroyunit) Only destroy the unit if it is controlled by this player [1,2,-1]. Optional, default is any player (-1). pos (createunit) hex to create the unit on. The unit will only be created if the target hex is empty at creation time or there is a shop or a valid transporter which is controlled by the player for whom the event is set up [x/y]. pos (destroyunit) hex to destroy the unit on [x/y]. The pos parameter can only be used if unit is -1. pos (message) hex to focus the display on when showing the message [x/y] (optional). If this parameter is absent the game will try to guess a suitable hex from the trigger data, e.g. a havebuilding trigger will cause it to use the shop location. pos (sethex) hex to change. If the hex is occupied by a unit at the time the event is executed it may end up on terrain it would not normally be able to enter [x/y]. setting (configure) Name of the setting you wish to change. Valid names are briefing1 for the briefing for the first player, briefing2 for the objectives for the second player, and nextmap for the next mission in a campaign. size (createunit) Unit group size [1-6]. Optional, defaults to 6. success (score) Amount of success points the player receives when the event occurs. Any player with a success score of 100 or more wins the game. unit (createunit, research) Name of a unit type specification to build or make available, respectively. unit (destroyunit) Identifier of the unit to be destroyed. Set to -1 and configure the pos parameter to destroy a unit in a specified location instead. tbuilding (havebuilding, havecrystals) Identifier of the building to be controlled. For havecrystals this parameter may be set to -1 to check all shops a player controls, or to -2 to check all shops and all transporters anywhere on the map. tcrystals (havecrystals) Amount of crystals needed to trigger the event [-5000-5000]. If the amount given is greater than 0 the player needs at least that many crystals. If it is negative, the event occurs when the player's resources drop below the absolute number. thandicap (handicap) Handicap setting to trigger the event [1 (none)|2 (player 1 handicapped)|4 (player 2 handicapped)]. You can add up the numbers to trigger on more than one setting. tile (sethex) Identifier of the terrain the target hex will be changed to. time (settimer) Time index. The offset flag controls in what way this number is used to adjust the targetted trigger. towner (havebuilding, havecrystals, haveunit, unitdestroyed, unitposition) The event will only occur if the owner of the building or unit is the same as the player specified here [1|2]. For the unitdestroyed trigger it is only required if tunit is -1. In this case you can select the player whose units have to be destroyed to activate the event. This setting may be omitted and defaults to the player not owning the event, while for havecrystals and unitposition the default is the player owning the event. You must supply this key for the other two trigger types. ttime (havebuilding, haveunit, timer) Time at which the event conditions should be checked. For timer the event will always be executed at this time. Time calculation starts with 0 at the start of a mission and increases by 1 each time the players change. The movement phase of player 2 on turn 10 is at time index 19 ((turn - 1) * 2 + (player - 1)), for example. (mandatory only for timer. If omitted for the other triggers, the condition will be checked each turn.) tunit (haveunit, unitdestroyed, unitposition) Identifier of the unit to be targeted. For unitdestroyed and unitposition this may take a value of -1 which will activate the event when all enemy units have been destroyed or any unit controlled by this player has reached the destination hex, respectively. For these two triggers you can also use a unit type, e.g. Infantry to target an entire unit class. tpos (unitposition) Coordinates of the target hex [x/y] value (configure) Index of the message to use as the new briefing when changing a briefing, file name of the next mission (excluding the suffix) when setting the next map. xp (createunit) Initial experience level [0-6]. Optional, defaults to 0. messages The messages section contains all text messages that may possibly be displayed in the course of a mission. The format of this section differs from that of the other sections. Here is an excerpt from an imaginary level file. [messages(en)] This is a message. % this line separates messages This is the second message. % separator lines can be used for comments This is the third message, containing a line break. [/messages] this marks the end of the messages section The two characters in brackets identify the language messages in this section are written in. There is one messages section for each language the mission supports. The (en) in the section title shows that this section contains English messages. All messages must be encoded in UTF-8. Example ### This is a simple example mission file [mission] # mission title is "The Great Example" name = 5 mapwidth = 11 mapheight = 10 # the first message in the [messages] section # will be used as level information info = 0 # we use the default tileset and unit set so we could # omit the next two lines tileset = default unitset = default [map] ***...***.. **...****.= *<^1n]*..== **v..(..==~ ***...].=~~ #=#.==!==== ======(]... %*.=...E^>. %%..%...v.. %%%%.%...** ### first player - The Good [player] name = 6 # second message is briefing for this player briefing = 1 ### second player - The Bad [player] name = 7 # third message is briefing for this player briefing = 2 ### units for player 1 [unit] # this unit will start in the building pos = 3/2 player = 1 id = 0 type = Infantry [unit] pos = 5/4 player = 1 id = 1 type = Medium Tanks [unit] pos = 6/3 player = 1 id = 2 type = Medium Tanks [unit] pos = 3/2 player = 1 id = 3 type = Scouts ### units for player 2 [unit] pos = 7/7 player = 2 id = 10 type = Anti-Aircraft Tanks [unit] pos = 6/6 player = 2 id = 11 type = Personnel Carriers [unit] pos = 7/6 player = 2 id = 12 type = Infantry [unit] pos = 7/7 player = 2 id = 13 type = Heavy Tanks ### buildings # HQ of the Good [building] name = 8 pos = 3/2 id = 0 player = 1 # can repair units here type = workshop crystals = 25 # HQ of the Bad [building] name = 9 pos = 7/7 id = 1 player = 2 # can repair and build units type = workshop type = factory # the following units can be built factory = personnel carriers factory = anti-aircraft guns factory = bomber wing crystals = 25 ### events # player 1 wins if he conquers # the enemy building at any time... [event] type = score id = 0 player = 1 trigger = havebuilding tbuilding = 1 towner = 1 # the next line could be left out ttime = -1 success = 100 message = 3 title = 4 # ...or destroys all enemy units [event] type = score id = 1 player = 1 trigger = unitdestroyed tunit = -1 success = 100 # player 2 wins if he conquers # the enemy building at any time... [event] type = score id = 2 player = 2 trigger = havebuilding tbuilding = 0 towner = 2 success = 100 message = 3 title = 4 # ...or destroys all enemy units as well [event] type = score id = 3 player = 2 trigger = unitdestroyed tunit = -1 success = 100 # display briefings on first turn # [event] type = message id = 4 player = 1 trigger = timer ttime = 0 title = 5 message = 1 # Even though time index 0 is during player 1's phase # we want to trigger the message for player 2 as well. # This way it gets queued for display during the turn # replay. Otherwise player 2 would only see the briefing # after his replay. [event] type = message id = 5 player = 2 trigger = timer ttime = 0 title = 5 message = 2 # we want to support difficulty levels (handicaps) # # if player 1 is handicapped we allocate some more # crystals to players 2's factory [event] type = mining id = 6 player = 2 trigger = handicap # 1 is no handicap, 2 is player 1, 4 is player 2 thandicap = 2 building = 1 action = 1 crystals = 35 # if player 2 is handicapped player 1 gets another tank [event] type = createunit id = 7 player = 1 trigger = handicap thandicap = 4 unit = Medium Tanks pos = 3/2 ### english messages [messages(en)] The Great Example Revision 6 (16-08-2004) by Jens Granseuer <jensgr@gmx.net> % This is a nice introductory message, so that player 1 knows what he is expected to do. Word wraps are done automatically, so don't include line breaks if you don't want them. So, Player 1, let's take them apart: Either conquer the enemy headquarters or destroy all their troops. % This should present the situation to player 2. You are being attacked. Defend yourself. The attack is considered repelled if you gain control of the enemy headquarters or the entire attacking army is no more. % This is the success message for conquering the enemy headquarters. Congratulations! % Hip! Hip! Hurrah! % The Great Example % The Good % The Bad % HQ of the Good % HQ of the Bad [/messages] Notes The file format of level files (source and data) is subject to change without notice. If you get an error "File not of the required type", it mostly should be sufficient to feed the appropriate source file to cfed again to create a valid level file. However, no promises are being made. You have been warned! cfed will eventually be phased out in favour of CoMET, the graphical map editor for crimson. See Also crimson6, bi2cf6 Copyright Copyright © 2000-2007 Jens Granseuer This software is distributed under the terms of the GNU General Public License (GPL).
crimson-0.5.2.orig/doc/comet.xml0000600000175000017500000000672110554366552014720 0ustar uweuwe January 20 2007 Jens Granseuer
jensgr@gmx.net
comet 6 comet a mission editor for Crimson Fields comet --level level --width width --height width --fullscreen 1|0 --sound 1|0 comet --help --version Description comet (the Crimson Fields Map Editing Tool) is a mission editor for Crimson Fields. Options level Start the editor with the level loaded. w Set screen width to w. Minimum screen width is 320. Default is 800. h Set screen height to h. Minimum screen height is 240. Default is 600. 1|0 Turn fullscreen mode on/off. The default is to start in windowed mode. 1|0 Turn sound on/off. The default is on. Print a usage message on standard output and exit. Print version information on standard output and exit. See Also cfed6, crimson6 Copyright Copyright © 2002-2007 Jens Granseuer This software is distributed under the terms of the GNU General Public License (GPL).
crimson-0.5.2.orig/doc/crimson.xml0000600000175000017500000004605010606747156015263 0ustar uweuwe January 20 2007 Jens Granseuer
jensgr@gmx.net
crimson 6 crimson a hex-based tactical combat game crimson --level level --width w --height h --fullscreen 1|0 --sound 1|0 crimson --help --version Description Crimson Fields is a tactical war game in the tradition of the popular Battle Isle. Two players command a number of units on a map of hexagons, trying to accomplish mission objectives ranging from defending important locations to simply destroying all enemy forces. Damaged units may be repaired or replaced by new recruits, while victorious squadrons will improve their abilities so they will be even more difficult to beat next time. The game can be played against a human adversary in hot-seat mode, over a network, or via e-mail, or against a computer player. The level editor cfed6 can be used to create your own levels. Options If called without options crimson will open its main window using the settings from the last session or the defaults if no previous settings exist. level Skip the level selection window and load the mission file level. The file may be either a standard level file or a saved game. When starting a new game this way you will be playing a single map against the computer without any handicaps. w Set screen width to w. Minimum screen width is 320. Default is 800. h Set screen height to h. Minimum screen height is 240. Default is 600. 1|0 Turn fullscreen mode on/off. The default is to start in windowed mode. 1|0 Turn sound on/off. The default is on. Print a usage message on standard output and exit. Print version information on standard output and exit. The display and sound options given to crimson on startup will be saved to file and restored on the next program start. Getting Started Introduction The once peaceful planet Nexus has been invaded by beings calling themselves the Empire of Kand who are determined to conquer Nexus or destroy it completely. The public unrest has become violent as the people attempt revolution against the invasion, but the Empire of Kand are quick to silence opposition. Nexus is on the verge of war and its people have formed factions to battle the Empire. As a member of one of the major rebel factions, the Free Nexus Army, your goals are obvious: to drive the intruders back to whichever part of the galaxy they came from and restore peace on planet Nexus... (This is the background story for most of the included missions and the default campaign. There may be maps with entirely different settings.) Main Menu The main screen presents a number of widgets to configure the game. The most important decision is whether you want to play a skirmish match, a campaign, or load a saved game. Skirmishes are stand-alone maps while campaigns consist of a number of maps which must be played (and won) in sequence. Each map that you advance to during a campaign will also be unlocked for skirmish matches. While campaigns can only be played against the computer, skirmishes can additionally be played as hot-seat matches (two players on one computer taking turns), e-mail matches (see ), or over a network, and when playing against the computer you get to choose which side you want to play on. For both game types you can optionally define a handicap, to make the game a bit easier or harder. What this means exactly depends on the map being played but in most cases a handicapped player will have fewer units or resources at his disposal than his opponent. The large box on the left lists all available skirmishes, campaigns, or saved games, while the box on the right displays a small image of the selected map or, for campaigns, the story. For skirmishes, the number in brackets shows the recommended number of players. Missions designed for one player are often rather unbalanced if played against another human since the computer plays so different from a human, although a handicap can sometimes fix this. After you have selected a map hit Start to enter the game. First Steps After starting the match you will be presented with the mission briefing. Here you are given your orders and objectives to win the map. As both players usually have different and conflicting goals, each player gets his own briefing session at the beginning of his first turn. After the briefing you will be presented with the map. This is your command center. From here you can issue most of the orders that will determine the outcome of the mission. The first player commands the yellow units while the second player or computer takes control of the blue units. The map consists of small regions of land (or water) each known as a hex (sometimes also called field or square). Left-clicking on a hex selects that hex and moves the cursor to it. If there is a unit on the selected hex then a small bar will appear in the lower left of the screen showing the rank of the unit, its type, and the squad size (see for more information about ranks). If there is instead a building or shop on the selected hex, the information bar displays the name of the shop and possibly some icons representing special attributes (see for details). Shops may occupy several fields, but they only have a single entrance, which is marked by the colour of the respective owner. Buildings with a white entrance are neutral and not controlled by any player. A right-click on one of your units generally brings up a context menu for that unit (this does not apply to enemy units). Here you can view the unit stats, or inspect its contents (transporters only). Other units like mine-sweepers may have special skills which also show up here. If the unit is not a transporter and does not offer any special skills, the menu is skipped and you are directly taken to the stats display. The stats window is basically divided in two parts. The top part shows the unit name and its values for speed, armour, and effectiveness against ground troops, aircraft, and ships in that order, from the top left to the bottom right. Most units have a weapon range of 1, meaning they can shoot at units one hex away (i.e. directly next to it). For units with different settings, the actual range is given in brackets after the weapon power. The second part of the window lists the most important terrain types. Shaded terrain indicates that the unit cannot cross that ground. Right-clicking anywhere but on a unit or pressing F1 pops up the Game menu where you can review your mission objectives, take a look at an overview map, or save your game, for example. You select one of your units by simply clicking on it. Large parts of the map will now be shaded to indicate that the unit cannot move there. Unshaded enemy units are potential targets. To move to an accessible field or attack a foe, simply double-click the respective hex. If you accidentally sent your unit to a hex you did not want it to go to, right-clicking on the unit gives you the option of reverting the last move, as long as it did not trigger any special events. If you click twice on one of your shops or a neutral one, you enter that building. Of course, you can also move units into shops, although only some units (Infantry in the default set) can move into shops not owned by you, and some buildings may not allow all unit types. Quite often buildings are important mission objectives. Taking the enemy headquarters, e.g., is a very common goal. But even if you do not specifically need to control a certain shop for victory, it can still be very helpful as it may be possible to repair or build units (see ). When you have issued all orders, select End Turn from the Game menu. Your commands are then executed, fights are resolved, and your opponent gets his chance to strike back... Movement Each unit may only move once each turn, and only if it did not initiate combat on the same turn. Artillery and Anti-Aircraft Guns cannot attack if they have already been moved on the same turn. To move around on the map, a unit needs movement points. The number in the upper left corner of the unit information dialog (which can be brought up for one of your units by right-clicking it) indicates how many hexes the unit can move under optimal circumstances. The actual range is determined by several factors. For ordinary ground units the terrain can greatly reduce the range of action. The maximum can only ever be reached on roads, everything else will slow the unit down, and mountains more so than forest. For airborne units or ships, terrain is of no importance. Enemy units can be trapped in order to prevent them from using superior speed or to deny them access to certain areas of the map. A unit which attempts to cross a hex between two hostile units or one hostile unit and inaccessible terrain will be stopped immediately after passing through. A unit cannot leave a transport or building and enter another one on the same turn. Enemy buildings can only be conquered by infantry units. Combat Results Basically the probability to hit an enemy unit in combat is the same for all unit types, although the attacker always gets a slight advantage. This hit probability is then modified by effects such as experience, distance to the target, terrain, or wedging (see below). Similarly, each unit gets assigned a probability for evading an attack which is then modified by experience, terrain effects and blocking. If a unit scores a hit it will increase its attack pool by an amount equal to its strength. A unit which successfully evades an attack will have its defence pool grow by an amount equal to its defence or armour value. Finally, each attack pool is compared to the enemy's defence pool, and the resulting ratio determines the casualties on both sides. Terrain Terrain is an important factor in combat as it can heavily influence a unit's effectiveness. For example, fighting on a road or open plains will greatly increase attacking strength but offers relatively poor defensive capabilities, whereas a unit in the mountains will profit from the higher position in both attack and defence. Terrain modifiers do not apply for aircraft. Wedging Friendly units can help increase the combat strength of an attacking unit without attacking themselves. For each friendly unit which is adjacent to and capable of shooting at the defender, the attacker will get a 10 per cent bonus. If the unit is adjacent to the defender, but cannot attack it the bonus is reduced to 5 per cent. A friendly unit in the back of the defender will earn another 5 per cent bonus, or 10 if it could also attack. It does not matter whether a wedging unit actually attacks the defender. Wedging does not work for long-range attacks. Blocking In a manner similar to wedging, defending units may improve their position in combat. For each friendly unit adjacent to the attacker and the defender, the defending unit will have its combat strength increased by 10 per cent. Just like wedging, blocking does not help against long-range attacks. Experience Veteran units are usually much stronger than newly assembled ones. If you manage to wipe out an enemy unit your unit will receive three experience points. If the enemy is only damaged you will still get one point. Every three experience points a unit advances to a new rank which improves its combat skills. Still, a seasoned infantry unit will have a very hard time against a group of recently recruited heavy tanks. Destroying mines does not earn any experience points. Crystals Crystals represent the resources required to maintain and enlarge your army. You need them to repair damaged units or build new ones. Repairs Units which have been damaged in combat can be repaired in any building equipped for this purpose (a workshop). To check whether a building is a workshop, click on it. For workshops a wrench icon will be displayed in the small info bar that appears in the lower left of the screen, and a repair button is available in the icon bar inside. Repairing will restore a unit to its full strength and requires an amount of 5 crystals, no matter what kind of unit it is or how badly is was damaged. Apart from the crystal cost the unit loses one experience point for each rookie that fills up an empty slot. The ability to repair damaged units is not necessarily limited to shops. Some unit types may offer the same service (from the standard unit set, for example, the Aircraft Carriers can bring aircraft back into shape). Repairs in units works exactly the same way as in workshops, and you also need to supply the crystals to do so. Production To build new units you need some crystals and a factory (hammer icon). The amount of crystals required depends on the type of unit you want to build: A squad of light reconnaissance vehicles is cheaper than a group of heavy attack choppers. Most factories can not produce all unit types, even if you could afford it. If you click on the production button inside a factory, you are shown the list of units which can be built in this particular factory. Next to each unit type is the amount of crystals that will be consumed. Newly built units can only move on your next turn. Mines To replenish your supply of crystals you need mines. Mines are buildings which 'produce' a certain amount of crystals each turn. They can not be identified from the outside. Many maps do not have any mines at all, so it is always a good idea to consider carefully what you spend your resources on. Crystals can be transferred from one building to another (e.g. from a mine to a factory) using any transporter unit. Play-By-E-Mail If Crimson Fields is played in play-by-e-mail mode, the game will automatically be saved whenever a player ends her turn. The resulting save file can then be sent to your opponent using your favourite mail client program. On your first turn you will be asked for a password. You will be prompted for this password at the beginning of each of your turns to prevent your opponent from spying. Note, however, that the password only offers very mild protection if you are playing against deliberate cheaters. Choose your enemies carefully! Files Unix ~/.crimson/crimsonrc ~/.crimson/levels/ See Also cfed6, bi2cf6 Copyright Copyright © 2000-2007 Jens Granseuer This software is distributed under the terms of the GNU General Public License (GPL).
crimson-0.5.2.orig/doc/crimson.css0000600000175000017500000000150510147621613015234 0ustar uweuwebody { margin-left: 5%; margin-right: 5%; font-size: smaller; background: #515151; } a:link { color: blue; } a:visited { color: green; } a:hover { color: red; } a:active { color: green; } div.refentry { background: #d0dad0; border: 1px inset; } div.refentry p { margin-left: 8%; margin-right: 8%; } div.refentry h1 { margin-left: 2.5%; font-size: 120%; } div.refentry h2 { margin-left: 4%; font-size: 110%; } div.refentry h3 { margin-left: 6%; font-size: 100%; } div.refentry dl { margin-left: 10%; margin-right: 10%; border: dotted 1px black; background: #eeeeef; } div.refentry table { margin-left: 8%; margin-right: 8%; } div.refentry code { color: #000055 } div.refentry pre.programlisting { margin-left: 10%; color: #000055 } crimson-0.5.2.orig/src/0000700000175000017500000000000010730256756013101 5ustar uweuwecrimson-0.5.2.orig/src/Makefile.am0000600000175000017500000000002407727124671015135 0ustar uweuweSUBDIRS = cf comet crimson-0.5.2.orig/src/Makefile.in0000600000175000017500000003260310730255126015142 0ustar uweuwe# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : subdir = src DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = SOURCES = DIST_SOURCES = RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ html-recursive info-recursive install-data-recursive \ install-dvi-recursive install-exec-recursive \ install-html-recursive install-info-recursive \ install-pdf-recursive install-ps-recursive install-recursive \ installcheck-recursive installdirs-recursive pdf-recursive \ ps-recursive uninstall-recursive RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ distclean-recursive maintainer-clean-recursive ETAGS = etags CTAGS = ctags DIST_SUBDIRS = $(SUBDIRS) DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CF_LIBS = @CF_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ SUBDIRS = cf comet all: all-recursive .SUFFIXES: $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh # This directory's subdirectories are mostly independent; you can cd # into them and run `make' without going through this Makefile. # To change the values of `make' variables: instead of editing Makefiles, # (1) if the variable is set in `config.status', edit `config.status' # (which will cause the Makefiles to be regenerated when you run `make'); # (2) otherwise, pass the desired values on the `make' command line. $(RECURSIVE_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ target=`echo $@ | sed s/-recursive//`; \ list='$(SUBDIRS)'; for subdir in $$list; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ dot_seen=yes; \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done; \ if test "$$dot_seen" = "no"; then \ $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ fi; test -z "$$fail" $(RECURSIVE_CLEAN_TARGETS): @failcom='exit 1'; \ for f in x $$MAKEFLAGS; do \ case $$f in \ *=* | --[!k]*);; \ *k*) failcom='fail=yes';; \ esac; \ done; \ dot_seen=no; \ case "$@" in \ distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ *) list='$(SUBDIRS)' ;; \ esac; \ rev=''; for subdir in $$list; do \ if test "$$subdir" = "."; then :; else \ rev="$$subdir $$rev"; \ fi; \ done; \ rev="$$rev ."; \ target=`echo $@ | sed s/-recursive//`; \ for subdir in $$rev; do \ echo "Making $$target in $$subdir"; \ if test "$$subdir" = "."; then \ local_target="$$target-am"; \ else \ local_target="$$target"; \ fi; \ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ || eval $$failcom; \ done && test -z "$$fail" tags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ done ctags-recursive: list='$(SUBDIRS)'; for subdir in $$list; do \ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ include_option=--etags-include; \ empty_fix=.; \ else \ include_option=--include; \ empty_fix=; \ fi; \ list='$(SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test ! -f $$subdir/TAGS || \ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ fi; \ done; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ if test "$$subdir" = .; then :; else \ test -d "$(distdir)/$$subdir" \ || $(MKDIR_P) "$(distdir)/$$subdir" \ || exit 1; \ distdir=`$(am__cd) $(distdir) && pwd`; \ top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ (cd $$subdir && \ $(MAKE) $(AM_MAKEFLAGS) \ top_distdir="$$top_distdir" \ distdir="$$distdir/$$subdir" \ am__remove_distdir=: \ am__skip_length_check=: \ distdir) \ || exit 1; \ fi; \ done check-am: all-am check: check-recursive all-am: Makefile installdirs: installdirs-recursive installdirs-am: install: install-recursive install-exec: install-exec-recursive install-data: install-data-recursive uninstall: uninstall-recursive install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-recursive install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-recursive clean-am: clean-generic mostlyclean-am distclean: distclean-recursive -rm -f Makefile distclean-am: clean-am distclean-generic distclean-tags dvi: dvi-recursive dvi-am: html: html-recursive info: info-recursive info-am: install-data-am: install-dvi: install-dvi-recursive install-exec-am: install-html: install-html-recursive install-info: install-info-recursive install-man: install-pdf: install-pdf-recursive install-ps: install-ps-recursive installcheck-am: maintainer-clean: maintainer-clean-recursive -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-recursive mostlyclean-am: mostlyclean-generic pdf: pdf-recursive pdf-am: ps: ps-recursive ps-am: uninstall-am: .MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ install-strip .PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ all all-am check check-am clean clean-generic ctags \ ctags-recursive distclean distclean-generic distclean-tags \ distdir dvi dvi-am html html-am info info-am install \ install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ installdirs-am maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-generic pdf pdf-am ps ps-am tags \ tags-recursive uninstall uninstall-am # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: crimson-0.5.2.orig/src/cf/0000700000175000017500000000000010730256756013471 5ustar uweuwecrimson-0.5.2.orig/src/cf/Makefile.am0000600000175000017500000000322710527625436015532 0ustar uweuwebin_PROGRAMS = crimson crimson_SOURCES = \ ai.cpp ai.h \ building.cpp building.h \ combat.cpp combat.h \ container.cpp container.h \ event.cpp event.h \ game.cpp game.h \ history.cpp history.h \ initwindow.cpp initwindow.h \ main.cpp \ map.cpp map.h \ mapwindow.cpp mapwindow.h \ mission.cpp mission.h \ msgs.h \ network.cpp network.h \ options.cpp options.h \ path.cpp path.h \ platform.cpp platform.h \ player.cpp player.h \ unit.cpp unit.h \ unitwindow.cpp unitwindow.h \ ../common/SDL_zlib.c ../common/SDL_zlib.h \ ../common/button.cpp ../common/button.h \ ../common/color.h \ ../common/extwindow.cpp ../common/extwindow.h \ ../common/fileio.cpp ../common/fileio.h \ ../common/filewindow.cpp ../common/filewindow.h \ ../common/font.cpp ../common/font.h \ ../common/gamedefs.h \ ../common/gamewindow.cpp ../common/gamewindow.h \ ../common/globals.h \ ../common/hexsup.cpp ../common/hexsup.h \ ../common/lang.cpp ../common/lang.h \ ../common/list.cpp ../common/list.h \ ../common/listselect.cpp ../common/listselect.h \ ../common/lset.cpp ../common/lset.h \ ../common/mapview.cpp ../common/mapview.h \ ../common/mapwidget.cpp ../common/mapwidget.h \ ../common/misc.cpp ../common/misc.h \ ../common/rect.cpp ../common/rect.h \ ../common/slider.cpp ../common/slider.h \ ../common/sound.cpp ../common/sound.h \ ../common/strutil.cpp ../common/strutil.h \ ../common/surface.cpp ../common/surface.h \ ../common/textbox.cpp ../common/textbox.h \ ../common/view.cpp ../common/view.h \ ../common/widget.cpp ../common/widget.h \ ../common/window.cpp ../common/window.h AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir)/src/common LIBS = @LIBS@ @CF_LIBS@ DEFS = @DEFS@ -DCF_DATADIR=\"$(pkgdatadir)/\" crimson-0.5.2.orig/src/cf/Makefile.in0000600000175000017500000016425610730255127015545 0ustar uweuwe# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = crimson$(EXEEXT) subdir = src/cf DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_crimson_OBJECTS = ai.$(OBJEXT) building.$(OBJEXT) combat.$(OBJEXT) \ container.$(OBJEXT) event.$(OBJEXT) game.$(OBJEXT) \ history.$(OBJEXT) initwindow.$(OBJEXT) main.$(OBJEXT) \ map.$(OBJEXT) mapwindow.$(OBJEXT) mission.$(OBJEXT) \ network.$(OBJEXT) options.$(OBJEXT) path.$(OBJEXT) \ platform.$(OBJEXT) player.$(OBJEXT) unit.$(OBJEXT) \ unitwindow.$(OBJEXT) SDL_zlib.$(OBJEXT) button.$(OBJEXT) \ extwindow.$(OBJEXT) fileio.$(OBJEXT) filewindow.$(OBJEXT) \ font.$(OBJEXT) gamewindow.$(OBJEXT) hexsup.$(OBJEXT) \ lang.$(OBJEXT) list.$(OBJEXT) listselect.$(OBJEXT) \ lset.$(OBJEXT) mapview.$(OBJEXT) mapwidget.$(OBJEXT) \ misc.$(OBJEXT) rect.$(OBJEXT) slider.$(OBJEXT) sound.$(OBJEXT) \ strutil.$(OBJEXT) surface.$(OBJEXT) textbox.$(OBJEXT) \ view.$(OBJEXT) widget.$(OBJEXT) window.$(OBJEXT) crimson_OBJECTS = $(am_crimson_OBJECTS) crimson_LDADD = $(LDADD) DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(crimson_SOURCES) DIST_SOURCES = $(crimson_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CF_LIBS = @CF_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ -DCF_DATADIR=\"$(pkgdatadir)/\" DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ @CF_LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ crimson_SOURCES = \ ai.cpp ai.h \ building.cpp building.h \ combat.cpp combat.h \ container.cpp container.h \ event.cpp event.h \ game.cpp game.h \ history.cpp history.h \ initwindow.cpp initwindow.h \ main.cpp \ map.cpp map.h \ mapwindow.cpp mapwindow.h \ mission.cpp mission.h \ msgs.h \ network.cpp network.h \ options.cpp options.h \ path.cpp path.h \ platform.cpp platform.h \ player.cpp player.h \ unit.cpp unit.h \ unitwindow.cpp unitwindow.h \ ../common/SDL_zlib.c ../common/SDL_zlib.h \ ../common/button.cpp ../common/button.h \ ../common/color.h \ ../common/extwindow.cpp ../common/extwindow.h \ ../common/fileio.cpp ../common/fileio.h \ ../common/filewindow.cpp ../common/filewindow.h \ ../common/font.cpp ../common/font.h \ ../common/gamedefs.h \ ../common/gamewindow.cpp ../common/gamewindow.h \ ../common/globals.h \ ../common/hexsup.cpp ../common/hexsup.h \ ../common/lang.cpp ../common/lang.h \ ../common/list.cpp ../common/list.h \ ../common/listselect.cpp ../common/listselect.h \ ../common/lset.cpp ../common/lset.h \ ../common/mapview.cpp ../common/mapview.h \ ../common/mapwidget.cpp ../common/mapwidget.h \ ../common/misc.cpp ../common/misc.h \ ../common/rect.cpp ../common/rect.h \ ../common/slider.cpp ../common/slider.h \ ../common/sound.cpp ../common/sound.h \ ../common/strutil.cpp ../common/strutil.h \ ../common/surface.cpp ../common/surface.h \ ../common/textbox.cpp ../common/textbox.h \ ../common/view.cpp ../common/view.h \ ../common/widget.cpp ../common/widget.h \ ../common/window.cpp ../common/window.h AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir)/src/common all: all-am .SUFFIXES: .SUFFIXES: .c .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/cf/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/cf/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) crimson$(EXEEXT): $(crimson_OBJECTS) $(crimson_DEPENDENCIES) @rm -f crimson$(EXEEXT) $(CXXLINK) $(crimson_OBJECTS) $(crimson_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SDL_zlib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ai.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/building.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/button.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/combat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/container.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/event.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extwindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filewindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/game.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gamewindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hexsup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/history.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/initwindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lang.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listselect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapview.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapwidget.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapwindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mission.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/network.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/options.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/path.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/platform.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/player.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slider.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strutil.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/textbox.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unitwindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/view.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widget.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` SDL_zlib.o: ../common/SDL_zlib.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT SDL_zlib.o -MD -MP -MF $(DEPDIR)/SDL_zlib.Tpo -c -o SDL_zlib.o `test -f '../common/SDL_zlib.c' || echo '$(srcdir)/'`../common/SDL_zlib.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/SDL_zlib.Tpo $(DEPDIR)/SDL_zlib.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/SDL_zlib.c' object='SDL_zlib.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o SDL_zlib.o `test -f '../common/SDL_zlib.c' || echo '$(srcdir)/'`../common/SDL_zlib.c SDL_zlib.obj: ../common/SDL_zlib.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT SDL_zlib.obj -MD -MP -MF $(DEPDIR)/SDL_zlib.Tpo -c -o SDL_zlib.obj `if test -f '../common/SDL_zlib.c'; then $(CYGPATH_W) '../common/SDL_zlib.c'; else $(CYGPATH_W) '$(srcdir)/../common/SDL_zlib.c'; fi` @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/SDL_zlib.Tpo $(DEPDIR)/SDL_zlib.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/SDL_zlib.c' object='SDL_zlib.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o SDL_zlib.obj `if test -f '../common/SDL_zlib.c'; then $(CYGPATH_W) '../common/SDL_zlib.c'; else $(CYGPATH_W) '$(srcdir)/../common/SDL_zlib.c'; fi` .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` button.o: ../common/button.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT button.o -MD -MP -MF $(DEPDIR)/button.Tpo -c -o button.o `test -f '../common/button.cpp' || echo '$(srcdir)/'`../common/button.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/button.Tpo $(DEPDIR)/button.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/button.cpp' object='button.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o button.o `test -f '../common/button.cpp' || echo '$(srcdir)/'`../common/button.cpp button.obj: ../common/button.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT button.obj -MD -MP -MF $(DEPDIR)/button.Tpo -c -o button.obj `if test -f '../common/button.cpp'; then $(CYGPATH_W) '../common/button.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/button.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/button.Tpo $(DEPDIR)/button.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/button.cpp' object='button.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o button.obj `if test -f '../common/button.cpp'; then $(CYGPATH_W) '../common/button.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/button.cpp'; fi` extwindow.o: ../common/extwindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT extwindow.o -MD -MP -MF $(DEPDIR)/extwindow.Tpo -c -o extwindow.o `test -f '../common/extwindow.cpp' || echo '$(srcdir)/'`../common/extwindow.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/extwindow.Tpo $(DEPDIR)/extwindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/extwindow.cpp' object='extwindow.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o extwindow.o `test -f '../common/extwindow.cpp' || echo '$(srcdir)/'`../common/extwindow.cpp extwindow.obj: ../common/extwindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT extwindow.obj -MD -MP -MF $(DEPDIR)/extwindow.Tpo -c -o extwindow.obj `if test -f '../common/extwindow.cpp'; then $(CYGPATH_W) '../common/extwindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/extwindow.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/extwindow.Tpo $(DEPDIR)/extwindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/extwindow.cpp' object='extwindow.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o extwindow.obj `if test -f '../common/extwindow.cpp'; then $(CYGPATH_W) '../common/extwindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/extwindow.cpp'; fi` fileio.o: ../common/fileio.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fileio.o -MD -MP -MF $(DEPDIR)/fileio.Tpo -c -o fileio.o `test -f '../common/fileio.cpp' || echo '$(srcdir)/'`../common/fileio.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/fileio.Tpo $(DEPDIR)/fileio.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/fileio.cpp' object='fileio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fileio.o `test -f '../common/fileio.cpp' || echo '$(srcdir)/'`../common/fileio.cpp fileio.obj: ../common/fileio.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fileio.obj -MD -MP -MF $(DEPDIR)/fileio.Tpo -c -o fileio.obj `if test -f '../common/fileio.cpp'; then $(CYGPATH_W) '../common/fileio.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/fileio.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/fileio.Tpo $(DEPDIR)/fileio.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/fileio.cpp' object='fileio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fileio.obj `if test -f '../common/fileio.cpp'; then $(CYGPATH_W) '../common/fileio.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/fileio.cpp'; fi` filewindow.o: ../common/filewindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT filewindow.o -MD -MP -MF $(DEPDIR)/filewindow.Tpo -c -o filewindow.o `test -f '../common/filewindow.cpp' || echo '$(srcdir)/'`../common/filewindow.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/filewindow.Tpo $(DEPDIR)/filewindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/filewindow.cpp' object='filewindow.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o filewindow.o `test -f '../common/filewindow.cpp' || echo '$(srcdir)/'`../common/filewindow.cpp filewindow.obj: ../common/filewindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT filewindow.obj -MD -MP -MF $(DEPDIR)/filewindow.Tpo -c -o filewindow.obj `if test -f '../common/filewindow.cpp'; then $(CYGPATH_W) '../common/filewindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/filewindow.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/filewindow.Tpo $(DEPDIR)/filewindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/filewindow.cpp' object='filewindow.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o filewindow.obj `if test -f '../common/filewindow.cpp'; then $(CYGPATH_W) '../common/filewindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/filewindow.cpp'; fi` font.o: ../common/font.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT font.o -MD -MP -MF $(DEPDIR)/font.Tpo -c -o font.o `test -f '../common/font.cpp' || echo '$(srcdir)/'`../common/font.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/font.Tpo $(DEPDIR)/font.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/font.cpp' object='font.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o font.o `test -f '../common/font.cpp' || echo '$(srcdir)/'`../common/font.cpp font.obj: ../common/font.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT font.obj -MD -MP -MF $(DEPDIR)/font.Tpo -c -o font.obj `if test -f '../common/font.cpp'; then $(CYGPATH_W) '../common/font.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/font.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/font.Tpo $(DEPDIR)/font.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/font.cpp' object='font.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o font.obj `if test -f '../common/font.cpp'; then $(CYGPATH_W) '../common/font.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/font.cpp'; fi` gamewindow.o: ../common/gamewindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gamewindow.o -MD -MP -MF $(DEPDIR)/gamewindow.Tpo -c -o gamewindow.o `test -f '../common/gamewindow.cpp' || echo '$(srcdir)/'`../common/gamewindow.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/gamewindow.Tpo $(DEPDIR)/gamewindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/gamewindow.cpp' object='gamewindow.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gamewindow.o `test -f '../common/gamewindow.cpp' || echo '$(srcdir)/'`../common/gamewindow.cpp gamewindow.obj: ../common/gamewindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gamewindow.obj -MD -MP -MF $(DEPDIR)/gamewindow.Tpo -c -o gamewindow.obj `if test -f '../common/gamewindow.cpp'; then $(CYGPATH_W) '../common/gamewindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/gamewindow.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/gamewindow.Tpo $(DEPDIR)/gamewindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/gamewindow.cpp' object='gamewindow.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gamewindow.obj `if test -f '../common/gamewindow.cpp'; then $(CYGPATH_W) '../common/gamewindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/gamewindow.cpp'; fi` hexsup.o: ../common/hexsup.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT hexsup.o -MD -MP -MF $(DEPDIR)/hexsup.Tpo -c -o hexsup.o `test -f '../common/hexsup.cpp' || echo '$(srcdir)/'`../common/hexsup.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/hexsup.Tpo $(DEPDIR)/hexsup.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/hexsup.cpp' object='hexsup.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o hexsup.o `test -f '../common/hexsup.cpp' || echo '$(srcdir)/'`../common/hexsup.cpp hexsup.obj: ../common/hexsup.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT hexsup.obj -MD -MP -MF $(DEPDIR)/hexsup.Tpo -c -o hexsup.obj `if test -f '../common/hexsup.cpp'; then $(CYGPATH_W) '../common/hexsup.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/hexsup.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/hexsup.Tpo $(DEPDIR)/hexsup.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/hexsup.cpp' object='hexsup.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o hexsup.obj `if test -f '../common/hexsup.cpp'; then $(CYGPATH_W) '../common/hexsup.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/hexsup.cpp'; fi` lang.o: ../common/lang.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lang.o -MD -MP -MF $(DEPDIR)/lang.Tpo -c -o lang.o `test -f '../common/lang.cpp' || echo '$(srcdir)/'`../common/lang.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lang.Tpo $(DEPDIR)/lang.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/lang.cpp' object='lang.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lang.o `test -f '../common/lang.cpp' || echo '$(srcdir)/'`../common/lang.cpp lang.obj: ../common/lang.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lang.obj -MD -MP -MF $(DEPDIR)/lang.Tpo -c -o lang.obj `if test -f '../common/lang.cpp'; then $(CYGPATH_W) '../common/lang.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/lang.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lang.Tpo $(DEPDIR)/lang.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/lang.cpp' object='lang.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lang.obj `if test -f '../common/lang.cpp'; then $(CYGPATH_W) '../common/lang.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/lang.cpp'; fi` list.o: ../common/list.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.o -MD -MP -MF $(DEPDIR)/list.Tpo -c -o list.o `test -f '../common/list.cpp' || echo '$(srcdir)/'`../common/list.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/list.Tpo $(DEPDIR)/list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/list.cpp' object='list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.o `test -f '../common/list.cpp' || echo '$(srcdir)/'`../common/list.cpp list.obj: ../common/list.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.obj -MD -MP -MF $(DEPDIR)/list.Tpo -c -o list.obj `if test -f '../common/list.cpp'; then $(CYGPATH_W) '../common/list.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/list.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/list.Tpo $(DEPDIR)/list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/list.cpp' object='list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.obj `if test -f '../common/list.cpp'; then $(CYGPATH_W) '../common/list.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/list.cpp'; fi` listselect.o: ../common/listselect.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT listselect.o -MD -MP -MF $(DEPDIR)/listselect.Tpo -c -o listselect.o `test -f '../common/listselect.cpp' || echo '$(srcdir)/'`../common/listselect.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/listselect.Tpo $(DEPDIR)/listselect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/listselect.cpp' object='listselect.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o listselect.o `test -f '../common/listselect.cpp' || echo '$(srcdir)/'`../common/listselect.cpp listselect.obj: ../common/listselect.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT listselect.obj -MD -MP -MF $(DEPDIR)/listselect.Tpo -c -o listselect.obj `if test -f '../common/listselect.cpp'; then $(CYGPATH_W) '../common/listselect.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/listselect.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/listselect.Tpo $(DEPDIR)/listselect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/listselect.cpp' object='listselect.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o listselect.obj `if test -f '../common/listselect.cpp'; then $(CYGPATH_W) '../common/listselect.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/listselect.cpp'; fi` lset.o: ../common/lset.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lset.o -MD -MP -MF $(DEPDIR)/lset.Tpo -c -o lset.o `test -f '../common/lset.cpp' || echo '$(srcdir)/'`../common/lset.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lset.Tpo $(DEPDIR)/lset.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/lset.cpp' object='lset.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lset.o `test -f '../common/lset.cpp' || echo '$(srcdir)/'`../common/lset.cpp lset.obj: ../common/lset.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lset.obj -MD -MP -MF $(DEPDIR)/lset.Tpo -c -o lset.obj `if test -f '../common/lset.cpp'; then $(CYGPATH_W) '../common/lset.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/lset.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lset.Tpo $(DEPDIR)/lset.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/lset.cpp' object='lset.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lset.obj `if test -f '../common/lset.cpp'; then $(CYGPATH_W) '../common/lset.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/lset.cpp'; fi` mapview.o: ../common/mapview.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mapview.o -MD -MP -MF $(DEPDIR)/mapview.Tpo -c -o mapview.o `test -f '../common/mapview.cpp' || echo '$(srcdir)/'`../common/mapview.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/mapview.Tpo $(DEPDIR)/mapview.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/mapview.cpp' object='mapview.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mapview.o `test -f '../common/mapview.cpp' || echo '$(srcdir)/'`../common/mapview.cpp mapview.obj: ../common/mapview.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mapview.obj -MD -MP -MF $(DEPDIR)/mapview.Tpo -c -o mapview.obj `if test -f '../common/mapview.cpp'; then $(CYGPATH_W) '../common/mapview.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/mapview.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/mapview.Tpo $(DEPDIR)/mapview.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/mapview.cpp' object='mapview.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mapview.obj `if test -f '../common/mapview.cpp'; then $(CYGPATH_W) '../common/mapview.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/mapview.cpp'; fi` mapwidget.o: ../common/mapwidget.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mapwidget.o -MD -MP -MF $(DEPDIR)/mapwidget.Tpo -c -o mapwidget.o `test -f '../common/mapwidget.cpp' || echo '$(srcdir)/'`../common/mapwidget.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/mapwidget.Tpo $(DEPDIR)/mapwidget.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/mapwidget.cpp' object='mapwidget.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mapwidget.o `test -f '../common/mapwidget.cpp' || echo '$(srcdir)/'`../common/mapwidget.cpp mapwidget.obj: ../common/mapwidget.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mapwidget.obj -MD -MP -MF $(DEPDIR)/mapwidget.Tpo -c -o mapwidget.obj `if test -f '../common/mapwidget.cpp'; then $(CYGPATH_W) '../common/mapwidget.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/mapwidget.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/mapwidget.Tpo $(DEPDIR)/mapwidget.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/mapwidget.cpp' object='mapwidget.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mapwidget.obj `if test -f '../common/mapwidget.cpp'; then $(CYGPATH_W) '../common/mapwidget.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/mapwidget.cpp'; fi` misc.o: ../common/misc.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT misc.o -MD -MP -MF $(DEPDIR)/misc.Tpo -c -o misc.o `test -f '../common/misc.cpp' || echo '$(srcdir)/'`../common/misc.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/misc.Tpo $(DEPDIR)/misc.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/misc.cpp' object='misc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o misc.o `test -f '../common/misc.cpp' || echo '$(srcdir)/'`../common/misc.cpp misc.obj: ../common/misc.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT misc.obj -MD -MP -MF $(DEPDIR)/misc.Tpo -c -o misc.obj `if test -f '../common/misc.cpp'; then $(CYGPATH_W) '../common/misc.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/misc.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/misc.Tpo $(DEPDIR)/misc.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/misc.cpp' object='misc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o misc.obj `if test -f '../common/misc.cpp'; then $(CYGPATH_W) '../common/misc.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/misc.cpp'; fi` rect.o: ../common/rect.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT rect.o -MD -MP -MF $(DEPDIR)/rect.Tpo -c -o rect.o `test -f '../common/rect.cpp' || echo '$(srcdir)/'`../common/rect.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/rect.Tpo $(DEPDIR)/rect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/rect.cpp' object='rect.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o rect.o `test -f '../common/rect.cpp' || echo '$(srcdir)/'`../common/rect.cpp rect.obj: ../common/rect.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT rect.obj -MD -MP -MF $(DEPDIR)/rect.Tpo -c -o rect.obj `if test -f '../common/rect.cpp'; then $(CYGPATH_W) '../common/rect.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/rect.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/rect.Tpo $(DEPDIR)/rect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/rect.cpp' object='rect.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o rect.obj `if test -f '../common/rect.cpp'; then $(CYGPATH_W) '../common/rect.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/rect.cpp'; fi` slider.o: ../common/slider.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT slider.o -MD -MP -MF $(DEPDIR)/slider.Tpo -c -o slider.o `test -f '../common/slider.cpp' || echo '$(srcdir)/'`../common/slider.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/slider.Tpo $(DEPDIR)/slider.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/slider.cpp' object='slider.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o slider.o `test -f '../common/slider.cpp' || echo '$(srcdir)/'`../common/slider.cpp slider.obj: ../common/slider.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT slider.obj -MD -MP -MF $(DEPDIR)/slider.Tpo -c -o slider.obj `if test -f '../common/slider.cpp'; then $(CYGPATH_W) '../common/slider.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/slider.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/slider.Tpo $(DEPDIR)/slider.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/slider.cpp' object='slider.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o slider.obj `if test -f '../common/slider.cpp'; then $(CYGPATH_W) '../common/slider.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/slider.cpp'; fi` sound.o: ../common/sound.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sound.o -MD -MP -MF $(DEPDIR)/sound.Tpo -c -o sound.o `test -f '../common/sound.cpp' || echo '$(srcdir)/'`../common/sound.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/sound.Tpo $(DEPDIR)/sound.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/sound.cpp' object='sound.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sound.o `test -f '../common/sound.cpp' || echo '$(srcdir)/'`../common/sound.cpp sound.obj: ../common/sound.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sound.obj -MD -MP -MF $(DEPDIR)/sound.Tpo -c -o sound.obj `if test -f '../common/sound.cpp'; then $(CYGPATH_W) '../common/sound.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/sound.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/sound.Tpo $(DEPDIR)/sound.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/sound.cpp' object='sound.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sound.obj `if test -f '../common/sound.cpp'; then $(CYGPATH_W) '../common/sound.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/sound.cpp'; fi` strutil.o: ../common/strutil.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT strutil.o -MD -MP -MF $(DEPDIR)/strutil.Tpo -c -o strutil.o `test -f '../common/strutil.cpp' || echo '$(srcdir)/'`../common/strutil.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/strutil.Tpo $(DEPDIR)/strutil.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/strutil.cpp' object='strutil.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o strutil.o `test -f '../common/strutil.cpp' || echo '$(srcdir)/'`../common/strutil.cpp strutil.obj: ../common/strutil.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT strutil.obj -MD -MP -MF $(DEPDIR)/strutil.Tpo -c -o strutil.obj `if test -f '../common/strutil.cpp'; then $(CYGPATH_W) '../common/strutil.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/strutil.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/strutil.Tpo $(DEPDIR)/strutil.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/strutil.cpp' object='strutil.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o strutil.obj `if test -f '../common/strutil.cpp'; then $(CYGPATH_W) '../common/strutil.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/strutil.cpp'; fi` surface.o: ../common/surface.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface.o -MD -MP -MF $(DEPDIR)/surface.Tpo -c -o surface.o `test -f '../common/surface.cpp' || echo '$(srcdir)/'`../common/surface.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/surface.Tpo $(DEPDIR)/surface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/surface.cpp' object='surface.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface.o `test -f '../common/surface.cpp' || echo '$(srcdir)/'`../common/surface.cpp surface.obj: ../common/surface.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface.obj -MD -MP -MF $(DEPDIR)/surface.Tpo -c -o surface.obj `if test -f '../common/surface.cpp'; then $(CYGPATH_W) '../common/surface.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/surface.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/surface.Tpo $(DEPDIR)/surface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/surface.cpp' object='surface.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface.obj `if test -f '../common/surface.cpp'; then $(CYGPATH_W) '../common/surface.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/surface.cpp'; fi` textbox.o: ../common/textbox.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT textbox.o -MD -MP -MF $(DEPDIR)/textbox.Tpo -c -o textbox.o `test -f '../common/textbox.cpp' || echo '$(srcdir)/'`../common/textbox.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/textbox.Tpo $(DEPDIR)/textbox.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/textbox.cpp' object='textbox.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o textbox.o `test -f '../common/textbox.cpp' || echo '$(srcdir)/'`../common/textbox.cpp textbox.obj: ../common/textbox.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT textbox.obj -MD -MP -MF $(DEPDIR)/textbox.Tpo -c -o textbox.obj `if test -f '../common/textbox.cpp'; then $(CYGPATH_W) '../common/textbox.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/textbox.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/textbox.Tpo $(DEPDIR)/textbox.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/textbox.cpp' object='textbox.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o textbox.obj `if test -f '../common/textbox.cpp'; then $(CYGPATH_W) '../common/textbox.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/textbox.cpp'; fi` view.o: ../common/view.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT view.o -MD -MP -MF $(DEPDIR)/view.Tpo -c -o view.o `test -f '../common/view.cpp' || echo '$(srcdir)/'`../common/view.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/view.Tpo $(DEPDIR)/view.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/view.cpp' object='view.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o view.o `test -f '../common/view.cpp' || echo '$(srcdir)/'`../common/view.cpp view.obj: ../common/view.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT view.obj -MD -MP -MF $(DEPDIR)/view.Tpo -c -o view.obj `if test -f '../common/view.cpp'; then $(CYGPATH_W) '../common/view.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/view.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/view.Tpo $(DEPDIR)/view.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/view.cpp' object='view.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o view.obj `if test -f '../common/view.cpp'; then $(CYGPATH_W) '../common/view.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/view.cpp'; fi` widget.o: ../common/widget.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT widget.o -MD -MP -MF $(DEPDIR)/widget.Tpo -c -o widget.o `test -f '../common/widget.cpp' || echo '$(srcdir)/'`../common/widget.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/widget.Tpo $(DEPDIR)/widget.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/widget.cpp' object='widget.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o widget.o `test -f '../common/widget.cpp' || echo '$(srcdir)/'`../common/widget.cpp widget.obj: ../common/widget.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT widget.obj -MD -MP -MF $(DEPDIR)/widget.Tpo -c -o widget.obj `if test -f '../common/widget.cpp'; then $(CYGPATH_W) '../common/widget.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/widget.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/widget.Tpo $(DEPDIR)/widget.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/widget.cpp' object='widget.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o widget.obj `if test -f '../common/widget.cpp'; then $(CYGPATH_W) '../common/widget.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/widget.cpp'; fi` window.o: ../common/window.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT window.o -MD -MP -MF $(DEPDIR)/window.Tpo -c -o window.o `test -f '../common/window.cpp' || echo '$(srcdir)/'`../common/window.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/window.Tpo $(DEPDIR)/window.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/window.cpp' object='window.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o window.o `test -f '../common/window.cpp' || echo '$(srcdir)/'`../common/window.cpp window.obj: ../common/window.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT window.obj -MD -MP -MF $(DEPDIR)/window.Tpo -c -o window.obj `if test -f '../common/window.cpp'; then $(CYGPATH_W) '../common/window.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/window.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/window.Tpo $(DEPDIR)/window.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/window.cpp' object='window.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o window.obj `if test -f '../common/window.cpp'; then $(CYGPATH_W) '../common/window.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/window.cpp'; fi` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-exec-am: install-binPROGRAMS install-html: install-html-am install-info: install-info-am install-man: install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: crimson-0.5.2.orig/src/cf/ai.cpp0000600000175000017500000012774010623572562014600 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // ai.cpp // // The model used for the computer player in Crimson Fields is a // variation of the widely used General/Sergeant scheme. At the // beginning of a turn, the "General" assesses the overall situation // on the battlefield, and identifies the major objectives for the // computer player (usually buildings). Units are assigned to those // objectives in order of priority, i.e. more important objectives // are served first, and less important ones may end up with less // firepower than required. // Now the "Sergeants" take over. Each of them gets one objective // and all the units assigned to it, and it's up to those division // commanders to decide on the actual moves. // Right now, the AI player is recreated each turn. This, of course, // does not allow for collecting and analyzing long-term intelligence // data, so maybe this should be changed in the future. //////////////////////////////////////////////////////////////////////// #include "ai.h" #include "game.h" #include "misc.h" //////////////////////////////////////////////////////////////////////// // NAME : AI::AI // DESCRIPTION: Initialize a computer controlled player. // PARAMETERS : mission - current mission object // RETURNS : - //////////////////////////////////////////////////////////////////////// AI::AI( Mission &mission ) : mission(mission) { player = &mission.GetPlayer(); map = &mission.GetMap(); } //////////////////////////////////////////////////////////////////////// // NAME : AI::Play // DESCRIPTION: Run the computer player. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::Play( void ) { View *view = Gam->GetMapWindow()->GetView(); // set up progress indicator; number of steps is unit count plus 3 // for objectives identification, objectives assignment, and production progress = new ProgressWindow( 0, 0, view->Width()/2, 30, 1, 3 + player->Units(0), NULL, WIN_CENTER, view ); IdentifyObjectives(); progress->Advance( 1 ); AssignObjectives(); for ( AIObj *obj = static_cast( objectives.Head() ); obj; obj = static_cast( obj->Next() ) ) ProcessObjective( *obj ); progress->Advance( 1 ); BuildReinforcements(); view->CloseWindow( progress ); } //////////////////////////////////////////////////////////////////////// // NAME : AI::IdentifyObjectives // DESCRIPTION: Examine the map for targets and put them into the list // of objectives. Generally, all buildings are considered // objectives. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::IdentifyObjectives( void ) { AIObj *obj; for ( Building *b = static_cast(mission.GetShops().Head()); b; b = static_cast(b->Next()) ) { unsigned char pri = AI_PRI_LOW; obj = new AIObj; obj->pos = b->Position(); obj->flags = 0; obj->needed_ground = obj->needed_ship = obj->needed_air = 0; if ( b->Owner() == player ) obj->type = AI_OBJ_DEFEND; else obj->type = AI_OBJ_CONQUER; // detect enemy unit presence in the vicinity UnitPresence( &mission.GetOtherPlayer(*player), obj ); if ( b->IsFactory() ) pri += 10; else if ( b->IsWorkshop() ) pri += 2; if ( b->IsMine() ) pri += 5; if ( obj->type == AI_OBJ_DEFEND ) { // check enemy presence; this also affects priority // locate closest enemy unit able to conquer buildings or transport Unit *u = ClosestUnit( &mission.GetOtherPlayer(*player), obj->pos, U_CONQUER|U_TRANSPORT, U_DESTROYED ); if ( u && (Distance( u->Position(), obj->pos ) <= AI_ATTENTION_RADIUS) ) pri = AI_PRI_CRITICAL; else pri = MIN( obj->needed_ground + obj->needed_air + obj->needed_ship, AI_PRI_MAX ); } else if ( obj->type == AI_OBJ_CONQUER ) { // the farther away we are the lower the priority pri += AI_PRI_MEDIUM; Unit *u = ClosestUnit( player, obj->pos, U_CONQUER, U_DESTROYED ); if ( u ) pri = MAX( AI_PRI_LOW, pri - Distance( obj->pos, u->Position() ) ); } obj->priority = pri; AddObjective( obj ); } // create an objective which simply says: "destroy all enemy units" // this will be used for all units we couldn't use otherwise obj = new AIObj; obj->type = AI_OBJ_ATTACK; obj->pos.x = -1; obj->pos.y = -1; obj->flags = 0; obj->needed_ground = obj->needed_ship = obj->needed_air = 0; obj->requested_ground = obj->requested_ship = obj->requested_air = 1; obj->priority = AI_OBJ_TRANSPORT + 1; AddObjective( obj ); } //////////////////////////////////////////////////////////////////////// // NAME : AI::AssignObjectives // DESCRIPTION: Go through the list of units available and assign them // to one of the objectives we identified earlier. // PARAMETERS : - // RETURNS : - // // NOTE : Transports are not assigned to standard objectives in // the first iteration. They are either pulled in by other // units requesting their service or simply added to more // or less random objectives at the end of the block. This // is ok as long as transports are only weak fighters but // will probably result in severely reduced effectiveness // otherwise. //////////////////////////////////////////////////////////////////////// void AI::AssignObjectives( void ) { AIObj *obj = static_cast(objectives.Head()), *attack_all = static_cast(objectives.Tail()); Unit *u, *last; while ( obj ) { if ( obj->type == AI_OBJ_CONQUER ) { // find ourselves a unit which can take over buildings bool done = false, found = true; last = NULL; do { u = ClosestUnit( player, obj->pos, U_CONQUER, U_BUSY|U_TRANSPORT, last ); if ( u ) { if ( !UnitCanReach( u, obj->pos, 0 ) ) last = u; else { obj->AssignUnit( u, UnitStrength(u) ); done = true; } } else { // we can't conquer the building, so remove the objective AIObj *next = static_cast(obj->Next()); obj->Remove(); delete obj; obj = next; done = true; found = false; } } while ( !done ); if ( !found ) continue; // go to next objective } // cycle through the units list // start with the unit closest to the target last = NULL; while ( (u = ClosestUnit( player, obj->pos, U_GROUND|U_AIR|U_SHIP, U_BUSY|U_TRANSPORT, last )) ) { if ( u->IsMine() ) u->SetFlags( U_BUSY|U_DONE ); else if ( u->Moves() == 0 ) { // stationary units may attack anything that moves... attack_all->AssignUnit( u, 0 ); } else if ( (!u->IsConquer() || (obj->type == AI_OBJ_CONQUER)) && // use infantry only UnitCanReach( u, obj->pos, AI_ATTENTION_RADIUS ) ) { // for taking buildings const UnitType *type = u->Type(); if ( ((obj->needed_air > 0) && (type->Firepower(U_AIR) > 0)) || ((obj->needed_ground > 0) && (type->Firepower(U_GROUND) > 0)) || ((obj->needed_ship > 0) && (type->Firepower(U_SHIP) > 0)) ) { // assign unit to target obj->AssignUnit( u, UnitStrength(u) ); if ( obj->needed_air + obj->needed_ground + obj->needed_ship == 0 ) break; // requested firepower allocated; next objective } } last = u; } obj = static_cast(obj->Next()); } // now check from the back of the list and remove any offensive objectives // which have not had any one unit assigned as well as those which have not // had the requested number of units assigned except the one with the // highest priority bool saved_hipri = false; obj = static_cast( objectives.Head() ); while ( obj ) { if ( (obj->type == AI_OBJ_CONQUER) && (obj->needed_ground + obj->needed_air + obj->needed_ship > 0) ) { if ( obj->alloc_units.IsEmpty() || saved_hipri ) { AIObj *next = static_cast(obj->Next()); obj->ReleaseUnits(); obj->Remove(); delete obj; obj = next; continue; } else saved_hipri = true; } obj = static_cast( obj->Next() ); } // lastly, assign all unassigned units to a task for ( u = static_cast( mission.GetUnits().Head() ); u; u = static_cast(u->Next()) ) { if ( (u->Owner() == player) && !u->IsBusy() ) { AIObj *best = NULL; unsigned short bestval = 0; for ( obj = static_cast(objectives.Head()); obj; obj = static_cast(obj->Next()) ) { const UnitType *type = u->Type(); if ( (obj->requested_ground && type->Firepower(U_GROUND)) || (obj->requested_air && type->Firepower(U_AIR)) || (obj->requested_ship && type->Firepower(U_SHIP)) ) { unsigned short val = 1000 + obj->priority; if ( obj->pos != Point(-1,-1) ) val -= Distance( obj->pos, u->Position() ); else val -= random( 1, 15 ); if ( val > bestval ) { bestval = val; best = obj; } } } // if we didn't find a suitable objective, assign the unit to // the general "attack-everything-that-moves" objective if ( best ) best->AssignUnit( u, UnitStrength(u) ); else attack_all->AssignUnit( u, 0 ); } } } //////////////////////////////////////////////////////////////////////// // NAME : AI::BuildReinforcements // DESCRIPTION: Build new units in our factories. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::BuildReinforcements( void ) const { const UnitType *type; unsigned short p1_air = 0, p1_ground = 0, p1_ship = 0, p2_aair = 1, p2_aground = 1, p2_aship = 1, // prevent div by 0 amul, gmul, smul; for ( Unit *u = static_cast(mission.GetUnits().Head()); u; u = static_cast(u->Next()) ) { if ( u->Owner() == player ) { unsigned short defxp = u->DefensiveStrength() + 3 * u->XPLevel(); type = u->Type(); if ( type->Firepower(U_AIR) > 0 ) p2_aair += (type->Firepower(U_AIR) + defxp) * u->GroupSize() / MAX_GROUP_SIZE; if ( type->Firepower(U_GROUND) > 0 ) p2_aground += (type->Firepower(U_GROUND) + defxp) * u->GroupSize() / MAX_GROUP_SIZE; if ( type->Firepower(U_SHIP) > 0 ) p2_aship += (type->Firepower(U_SHIP) + defxp) * u->GroupSize() / MAX_GROUP_SIZE; } else if ( u->Owner() ) { // controlled by enemy player unsigned short str = UnitStrength( u ) * 4; if ( u->IsAircraft() ) p1_air += str; else if ( u->IsShip() || u->IsFloating() ) p1_ship += str; else p1_ground += str; } } amul = p1_air / p2_aair; gmul = p1_ground / p2_aground; smul = p1_ship / p2_aship; for ( Building *b = static_cast(mission.GetShops().Head()); b; b = static_cast(b->Next()) ) { if ( (b->Owner() == player) && b->IsFactory() ) { const UnitType *best; unsigned short bestval, crystals; unsigned long blueprints = b->UnitProduction(); do { best = NULL; bestval = 0; crystals = b->Crystals(); for ( int i = 0; i < 32; ++i ) { if ( blueprints & (1 << i) ) { type = mission.GetUnitSet().GetUnitInfo( i ); if ( crystals >= type->Cost() ) { unsigned short val = type->Firepower(U_AIR) * amul + type->Firepower(U_GROUND) * gmul + type->Firepower(U_SHIP) * smul + type->Armour() / 2; if ( val > bestval ) { bestval = val; best = type; } } } } if ( best ) { mission.CreateUnit( best->ID(), *player, b->Position() ); b->SetCrystals( crystals - best->Cost() ); // recalculate unit type multipliers if ( best->Firepower(U_AIR) > 0 ) { p2_aair += best->Firepower(U_AIR) + best->Armour(); amul = p1_air / p2_aair; } if ( best->Firepower(U_GROUND) > 0 ) { p2_aground += best->Firepower(U_GROUND) + best->Armour(); gmul = p1_ground / p2_aground; } if ( best->Firepower(U_SHIP) > 0 ) { p2_aship += best->Firepower(U_SHIP) + best->Armour(); smul = p1_ship / p2_aship; } } } while ( best ); } } } //////////////////////////////////////////////////////////////////////// // NAME : AI::ProcessObjective // DESCRIPTION: This function implements the duties of the sergeant, // who decides on the actual moves a unit will make this // turn in order to accomplish the assigned objective. // PARAMETERS : obj - objective the sergeant is responsible for // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::ProcessObjective( AIObj &obj ) { for ( AIObj::AIAllocNode *n = static_cast( obj.alloc_units.Head() ); n; n = static_cast(n->Next()) ) { Unit *u = n->unit; if ( u->IsReady() ) { Gam->SelectUnit( u ); CommandUnit( u, obj ); } } } //////////////////////////////////////////////////////////////////////// // NAME : AI::AddObjective // DESCRIPTION: Add another target to the list of objectives. // PARAMETERS : obj - new objective // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::AddObjective( AIObj *obj ) { // insert the objective into the list according to its priority AIObj *aio, *prev = NULL; for ( aio = static_cast(objectives.Head()); aio && (aio->priority > obj->priority); aio = static_cast(aio->Next()) ) prev = aio; objectives.InsertNode( obj, prev ); } //////////////////////////////////////////////////////////////////////// // NAME : AI::GetObjectiveForUnit // DESCRIPTION: Find the objective the unit is assigned to. // PARAMETERS : u - unit to find objective for // RETURNS : pointer to objective or NULL if not found //////////////////////////////////////////////////////////////////////// AI::AIObj *AI::GetObjectiveForUnit( const Unit *u ) const { for ( AIObj *o = static_cast(objectives.Head()); o; o = static_cast(o->Next()) ) { if ( o->UnitAssigned( u ) ) return o; } return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : AI::CommandUnit // DESCRIPTION: This function does the Sergeant's dirty work. It // inspects the given unit and decides on what this unit // should do - where it should go, whom it should attack, // and so on. // PARAMETERS : u - the unit to be decided on // obj - objective the unit was assigned to // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::CommandUnit( Unit *u, AIObj &obj ) { progress->Advance( 1 ); // maybe we need an overhaul? if ( (obj.priority < AI_PRI_CRITICAL) || (u->GroupSize() >= MAX_GROUP_SIZE / 2) || !CommandUnitRepair( u ) ) { switch ( obj.type ) { case AI_OBJ_DEFEND: CommandUnitDefend( u, obj ); break; case AI_OBJ_CONQUER: CommandUnitConquer( u, obj ); break; case AI_OBJ_ATTACK: CommandUnitAttack( u, obj ); break; case AI_OBJ_TRANSPORT: CommandUnitTransport( u, obj ); break; } } } //////////////////////////////////////////////////////////////////////// // NAME : AI::CommandUnitDefend // DESCRIPTION: Decide on how the unit can be used to defend the // objective. // PARAMETERS : u - the unit to be decided on // obj - objective of the unit (type AI_OBJ_DEFEND) // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::CommandUnitDefend( Unit *u, AIObj &obj ) { Unit *tg; if ( Distance( u->Position(), obj.pos ) > AI_ATTENTION_RADIUS ) { // find a nice target in the direction we need to go bool attacked = false; Unit *last = NULL; do { tg = ClosestUnit( &mission.GetOtherPlayer(*player), u->Position(), U_GROUND|U_AIR|U_SHIP, U_DESTROYED|U_SHELTERED, last ); if ( tg && u->CanHitType( tg ) && SameDirection( u->Position(), tg->Position(), obj.pos ) && UnitGoTo( u, tg->Position(), u->WeaponRange(tg) ) ) { attacked = true; if ( u->CanHit( tg ) ) mission.RegisterBattle( u, tg ); break; } last = tg; } while ( tg ); if ( !attacked ) UnitGoTo( u, obj.pos, AI_ATTENTION_RADIUS ); } else { tg = ClosestUnit( &mission.GetOtherPlayer(*player), obj.pos, U_GROUND|U_AIR|U_SHIP, U_DESTROYED|U_SHELTERED ); // if the enemy comes too close attack // if our objective is between us and the enemy try to take a position in front of the objective if ( tg && ((Distance( u->Position(), tg->Position() ) <= AI_ATTENTION_RADIUS) || SameDirection( u->Position(), tg->Position(), obj.pos )) ) { CommandUnitAttack( u, obj ); } else if ( obj.pos == u->Position() ) CommandUnitAttack( u, obj ); } } //////////////////////////////////////////////////////////////////////// // NAME : AI::CommandUnitConquer // DESCRIPTION: Try to conquer the objective or help another unit take // it. // PARAMETERS : u - the unit to be decided on // obj - objective of the unit (type AI_OBJ_CONQUER) // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::CommandUnitConquer( Unit *u, AIObj &obj ) { Unit *enemy; if ( u->IsConquer() ) { // this unit won't attack anyone; we need it to get the target building UnitGoTo( u, obj.pos, 0 ); } else { // normal units move towards the objective and attack // hostile units along the way enemy = FindBestTarget( u ); if ( enemy && UnitGoTo( u, enemy->Position(), u->WeaponRange(enemy) ) ) { if ( u->CanHit( enemy ) ) mission.RegisterBattle( u, enemy ); } else if ( !enemy ) CommandUnitReturnToBase( u ); } } //////////////////////////////////////////////////////////////////////// // NAME : AI::CommandUnitAttack // DESCRIPTION: Attack any enemy units we can get our hands on. // PARAMETERS : u - the unit to be decided on // obj - objective of the unit (type AI_OBJ_ATTACK; unused) // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::CommandUnitAttack( Unit *u, AIObj &obj ) { Unit *tg = FindBestTarget( u ); if ( tg ) { Point dest = FindBestHex( u, tg ); if ( (dest == u->Position()) && !u->CanHit(tg) ) UnitGoTo( u, tg->Position(), 0 ); // FIXME: is 0 ok, or should it be WeaponRange? How to get units out then? else { UnitGoTo( u, dest, 0 ); if ( u->CanHit( tg ) ) mission.RegisterBattle( u, tg ); } } else CommandUnitReturnToBase( u ); } //////////////////////////////////////////////////////////////////////// // NAME : AI::CommandUnitTransport // DESCRIPTION: This is called only for transports. Make sure the mail // is delivered. // PARAMETERS : u - unit to process (actually a transport) // obj - objective of the unit (type AI_OBJ_TRANSPORT) // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::CommandUnitTransport( Unit *u, AIObj &obj ) { Transport *t = static_cast(u); if ( t->IsReady() ) { // now try all of the loaded units bool moved = false; TransPath tp( map, t ); Unit *unit; for ( int i = t->UnitCount() - 1; (i >= 0) && !moved; --i ) { unit = t->GetUnit( i ); if ( tp.Find( unit, t->Position(), obj.pos, PATH_BEST, obj.flags ) != -1 ) { Point dest = FollowPath( t, tp, 1 ); Gam->MoveUnit( t, dest ); moved = true; } } if ( moved ) { // maybe we can move the unit(s) now for ( int j = t->UnitCount() - 1; j >= 0; --j ) { unit = t->GetUnit( j ); if ( unit->IsReady() ) CommandUnit( unit, *GetObjectiveForUnit( unit ) ); } } } } //////////////////////////////////////////////////////////////////////// // NAME : AI::CommandUnitRepair // DESCRIPTION: Try to repair a unit. // PARAMETERS : u - the unit to be repaired // RETURNS : TRUE if a suitable base with a sufficient amount of // crystals is found, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool AI::CommandUnitRepair( Unit *u ) { Building *b, *last = NULL; Path path(map); do { b = ClosestBuilding( player, u->Position(), last ); int way; if ( b && (b->Crystals() >= CRYSTALS_REPAIR) && ((way = path.Find( u, u->Position(), b->Position() )) >= 0) && (way <= 5) ) { UnitGoTo( u, b->Position(), 0 ); if ( u->Position() == b->Position() ) { b->SetCrystals( b->Crystals() - CRYSTALS_REPAIR ); if ( mission.GetHistory() ) mission.GetHistory()->RecordUnitEvent( *u, History::HIST_UEVENT_REPAIR ); u->Repair(); } return true; } else last = b; } while ( b ); return false; } //////////////////////////////////////////////////////////////////////// // NAME : AI::CommandUnitReturnToBase // DESCRIPTION: Let this unit retreat to a friendly base. If we do not // own any buildings, the unit won't move at all... // PARAMETERS : u - the retreating unit // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::CommandUnitReturnToBase( Unit *u ) { Building *b, *last = NULL; do { b = ClosestBuilding( player, u->Position(), last ); if ( b && UnitGoTo( u, b->Position(), 0 ) ) break; else last = b; } while ( b ); } //////////////////////////////////////////////////////////////////////// // NAME : AI::UnitStrength // DESCRIPTION: Calculate the combat strength of a unit. Putting this // into a single number makes this approach slightly // inaccurate, but easier to handle. This value is only // used internally by the computer player. // PARAMETERS : u - unit // RETURNS : combat strength //////////////////////////////////////////////////////////////////////// unsigned short AI::UnitStrength( Unit *u ) const { const UnitType *type = u->Type(); return (MAX( MAX( type->Firepower(U_GROUND), type->Firepower(U_SHIP) ), type->Firepower(U_AIR) ) + type->Armour() + 3 * u->XPLevel()) * u->GroupSize() / MAX_GROUP_SIZE; } //////////////////////////////////////////////////////////////////////// // NAME : AI::UnitPresence // DESCRIPTION: Calculate the combined firepower of all units in a given // area which are controlled by the given player. // PARAMETERS : owner - player controlling wanted units // obj - objective; the objective position defines the // center of the area to be scanned, and the // needed_xxx values will be filled with our // findings // radius - area radius; if this is -1, all enemy units // will be considered according to their // distance to the objective (default -1) // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::UnitPresence( Player *owner, AIObj *obj, short radius /* = -1 */ ) const { for ( Unit *u = static_cast(mission.GetUnits().Head()); u; u = static_cast(u->Next()) ) { if ( (u->Owner() == owner) && ((radius == -1) || (Distance( obj->pos, u->Position() ) <= radius)) ) { unsigned short str = MAX( 0, UnitStrength(u) - Distance( obj->pos, u->Position() ) * 2 ); if ( u->IsAircraft() ) obj->needed_air += str; else if ( u->IsGround() ) obj->needed_ground += str; else obj->needed_ship += str; } } obj->requested_ground = obj->needed_ground > 0; obj->requested_air = obj->needed_air > 0; obj->requested_ship = obj->needed_ship > 0; } //////////////////////////////////////////////////////////////////////// // NAME : AI::ClosestUnit // DESCRIPTION: Find the unit with a given set of abilities which is // closest to the target location. // PARAMETERS : owner - player who controls the unit // p - target location // uflags - flags which should be looked for // nuflags - flags which must not be set // last - last unit found. If this is given, find the // next unit which is as far or further away // than that one and matches the criteria. If // it is NULL (default) return the closest unit. // RETURNS : closest unit which matches any ONE of the uflags and // NONE of the nuflags; or NULL if no appropriate unit found //////////////////////////////////////////////////////////////////////// Unit *AI::ClosestUnit( Player *owner, const Point &p, unsigned long uflags, unsigned long nuflags, const Unit *last /* = NULL */ ) const { Unit *u, *best = NULL; int last_dist, best_dist = 9999; if ( last ) { last_dist = Distance( p, last->Position() ); u = static_cast( last->Next() ); if ( !u ) { u = static_cast( mission.GetUnits().Head() ); ++last_dist; } } else { u = static_cast( mission.GetUnits().Head() ); last_dist = -1; } while ( u != last ) { int dist = Distance( u->Position(), p ); if ( (u->Flags() & uflags) && !(u->Flags() & nuflags) && (u->Owner() == owner) && (dist >= last_dist) && (dist < best_dist) ) { best_dist = dist; best = u; } u = static_cast( u->Next() ); if ( !u && last ) { u = static_cast( mission.GetUnits().Head() ); ++last_dist; // increase distance for the next loop } } return best; } //////////////////////////////////////////////////////////////////////// // NAME : AI::ClosestBuilding // DESCRIPTION: Find the building closest to a given hex. // PARAMETERS : owner - owning player // p - target location // last - last building found. If this is given, find // the next building which is as far or further // away than that one. If it is NULL (default) // return the closest building. // RETURNS : closest building owned by the given player, or NULL if // no appropriate building found //////////////////////////////////////////////////////////////////////// Building *AI::ClosestBuilding( Player *owner, const Point &p, const Building *last /* = NULL */ ) const { Building *b, *best = NULL; int last_dist, best_dist = 9999; if ( last ) { last_dist = Distance( p, last->Position() ); b = static_cast( last->Next() ); if ( !b ) { b = static_cast( mission.GetShops().Head() ); ++last_dist; } } else { b = static_cast( mission.GetShops().Head() ); last_dist = -1; } while ( b != last ) { int dist = Distance( b->Position(), p ); if ( (b->Owner() == owner) && (dist >= last_dist) && (dist < best_dist) ) { best_dist = dist; best = b; } b = static_cast( b->Next() ); if ( !b && last ) { b = static_cast( mission.GetShops().Head() ); ++last_dist; // increase distance for the next loop } } return best; } //////////////////////////////////////////////////////////////////////// // NAME : AI::UnitCanReach // DESCRIPTION: Check whether a unit can get close to a given hex, // either by itself or by using an available transport. // PARAMETERS : u - unit // pos - location to be checked for // dist - sometimes it's not necessary to get to the // specified coordinates. Here you can specify the // tolerable distance if you only want to get close. // RETURNS : TRUE if the unit can get close enough to the destination // FALSE otherwise //////////////////////////////////////////////////////////////////////// bool AI::UnitCanReach( const Unit *u, const Point &pos, unsigned short dist ) { Path path(map); return (path.Find( u, u->Position(), pos, PATH_FAST, dist ) != -1) || FindTransport( u, pos, dist, false ); } //////////////////////////////////////////////////////////////////////// // NAME : AI::FollowPath // DESCRIPTION: If a path has been found, determine how far the unit // can get this turn. // PARAMETERS : u - unit // path - path // dist - stop when dist steps left to go (defaults to 0) // RETURNS : furthest hex along the path which can be reached this // turn //////////////////////////////////////////////////////////////////////// Point AI::FollowPath( const Unit *u, const Path &path, unsigned short dist ) const { Point p = u->Position(), next; unsigned short steps = path.StepsToDest( p ); bool leave; short dir; MoveShader shader( map, mission.GetUnits() ); shader.ShadeMap( u ); do { leave = true; if ( steps > dist ) { dir = path.GetStep( p ); if ( dir != -1 ) { map->Dir2Hex( p, (Direction)dir, next ); if ( shader.GetStep( next ) != -1 ) { Unit *block = map->GetUnit( next ); if ( !block || ((block->Owner() == u->Owner()) && block->IsTransport() && static_cast(block)->Allow(u)) ) { p = next; --steps; leave = false; } } } } } while ( !leave ); return p; } //////////////////////////////////////////////////////////////////////// // NAME : AI::FindBestTarget // DESCRIPTION: Decide which enemy unit to attack, if any. // PARAMETERS : u - unit to check targets for // RETURNS : enemy unit considered the best target, or NULL if none //////////////////////////////////////////////////////////////////////// Unit *AI::FindBestTarget( const Unit *u ) { Unit *best = NULL; unsigned short bestval = 0; if ( u->IsDefensive() ) return NULL; Path path( map ); for ( Unit *tg = static_cast( mission.GetUnits().Head() ); tg; tg = static_cast( tg->Next() ) ) { if ( (tg->Owner() == &mission.GetOtherPlayer(*player)) && u->CanHitType( tg ) && !tg->IsSheltered() ) { if ( UnitCanReach( u, tg->Position(), u->WeaponRange(tg) ) ) { unsigned short val = 0; short cost = path.Find( u, u->Position(), tg->Position(), PATH_FAST, u->WeaponRange( tg ) ); if ( cost >= 0 ) { val = MAX( 0, 10000 - UnitStrength( tg ) - cost * 50 ); if ( !tg->CanHitType( u ) ) val += 10; if ( tg->IsConquer() ) val += 20; else if ( tg->IsTransport() ) val += 15; else if ( tg->IsMine() ) val = MAX( 0, val - 40 ); if ( (u->IsSlow() || (u->Type()->Speed() == 0)) && u->CanHit( tg ) ) val += 80; } else { // not yet directly accessible - make that a relatively unlikely target val = MAX( 0, 5000 - UnitStrength( tg ) ); } if ( val > bestval ) { bestval = val; best = tg; } } } } return best; } //////////////////////////////////////////////////////////////////////// // NAME : AI::FindBestHex // DESCRIPTION: Determine the hex from which an attack can be expected // to bear the best result. // PARAMETERS : u - attacking unit // enemy - target unit // RETURNS : best attacking position or current location if target // cannot be reached this turn (however, the current // location may just as well be the best ambush point // indeed, so check the result) //////////////////////////////////////////////////////////////////////// #define _CF_BEST_HEX_INVALID -1000 Point AI::FindBestHex( const Unit *u, const Unit *enemy ) const { Point hex = u->Position(); Path path(map); short turns = path.Find( u, u->Position(), enemy->Position(), PATH_BEST, u->WeaponRange( enemy ) ); // if we can't reach the target this turn get as close as possible; // for long-range attacks, terrain type etc. are not important if ( (turns > 1) || ((u->WeaponRange(enemy) > 1) && (turns >= 0)) ) hex = FollowPath( u, path ); else if ( turns >= 0 ) { Unit *sup; Point nb[6], hlp; short vals[6], bestval = _CF_BEST_HEX_INVALID; int i; map->GetNeighbors( enemy->Position(), nb ); for ( i = NORTH; i <= NORTHWEST; ++i ) { if ( (nb[i].x != -1) && (nb[i].y != -1) && !map->GetUnit( nb[i] ) && ((map->TerrainTypes( nb[i] ) & TT_ENTRANCE) == 0) && (path.Find( u, u->Position(), nb[i], PATH_FAST ) == 1) ) { vals[i] = -Distance( u->Position(), nb[i] ); } else vals[i] = _CF_BEST_HEX_INVALID; } for ( i = NORTH; i <= NORTHWEST; ++i ) { if ( vals[i] != _CF_BEST_HEX_INVALID ) { vals[i] += map->AttackMod( nb[i] ); // check for support in the back of the enemy int j = ReverseDir( (Direction)i ); if ( (nb[j].x != -1) && (nb[j].y != -1) ) { sup = map->GetUnit( nb[j] ); if ( sup && (sup->Owner() == player) ) { if ( sup->CouldHit( enemy ) ) vals[i] += 7; else vals[i] += 2; } } // check for enemy units supporting defence Direction attdir = Hex2Dir( nb[i], enemy->Position() ); if ( !map->Dir2Hex( nb[i], TurnLeft(attdir), hlp ) && (sup = map->GetUnit( hlp )) && (sup->Owner() == player) ) vals[i] -= 8; if ( !map->Dir2Hex( nb[i], TurnRight(attdir), hlp ) && (sup = map->GetUnit( hlp )) && (sup->Owner() == player) ) vals[i] -= 8; } } for ( i = NORTH; i <= NORTHWEST; ++i ) { if ( vals[i] > bestval ) { bestval = vals[i]; hex = nb[i]; } } } return hex; } #undef _CF_BEST_HEX_INVALID //////////////////////////////////////////////////////////////////////// // NAME : AI::FindTransport // DESCRIPTION: Find out whether a unit can reach its destination // through the service of a kind transporter. // PARAMETERS : u - unit to be carried // dest - destination hex // dist - maximum acceptable distance to destination // forreal - should we 'book' the transport if we find one // or is this just a test // RETURNS : a transport which can do the job, or NULL if none is // available //////////////////////////////////////////////////////////////////////// Transport *AI::FindTransport( const Unit *u, const Point &dest, unsigned short dist, bool forreal ) { Transport *t, *best = NULL; AIObj *obj; unsigned short val, bestval = 0; bool booked = false; // make sure we don't overwrite existing transport targets // first of all, search the objectives for a transport which already goes // where we want to be for ( obj = static_cast(objectives.Head()); obj; obj = static_cast(obj->Next()) ) { if ( obj->type == AI_OBJ_TRANSPORT ) { t = static_cast(static_cast(obj->alloc_units.Head())->unit); if ( (t != u) && t->Allow( u ) ) { TransPath tp( map, t ); if ( tp.Find( u, t->Position(), u->Position() ) != -1 ) { Path p( map ); if ( p.Find( u, obj->pos, dest, PATH_FAST, dist ) != -1 ) { val = 500 - Distance( u->Position(), t->Position() ); if ( val > bestval ) { bestval = val; best = t; booked = true; } } } } } } Unit *last = NULL; while ( (t = static_cast( ClosestUnit( player, u->Position(), U_TRANSPORT, U_DONE, last ))) ) { last = t; if ( (t != u) && t->Allow( u ) ) { if ( t->IsBusy() ) { AIObj *to = GetObjectiveForUnit( t ); // AI_OBJ_TRANSPORTs were checked above if ( to->type == AI_OBJ_TRANSPORT ) continue; } TransPath tp2( map, t ); if ( (tp2.Find( u, t->Position(), u->Position(), PATH_FAST, dist ) != -1) && (tp2.Find( u, t->Position(), dest, PATH_FAST, dist ) != -1) ) { // both hexes accessible -> ok // prefer these transports over those found above as this way we // might get a private one all for ourselves val = 520 - Distance( u->Position(), t->Position() ); if ( val > bestval ) { bestval = val; best = t; booked = false; } } } } if ( best && !booked && forreal ) { if ( best->IsBusy() ) GetObjectiveForUnit( best )->ReleaseUnit( best ); obj = new AIObj; obj->pos = dest; obj->priority = AI_PRI_TRANSPORT; obj->type = AI_OBJ_TRANSPORT; obj->flags = dist; // I know, I know, dirty hack... AddObjective( obj ); obj->AssignUnit( best, 0 ); } return best; } //////////////////////////////////////////////////////////////////////// // NAME : AI::UnitGoTo // DESCRIPTION: Try to move a unit from its current location towards a // destination hex. This may include using a transport. // PARAMETERS : u - unit // dest - destination hex // dist - maximum acceptable distance to destination // RETURNS : TRUE if unit was moved, FALSE if no valid path could be // found //////////////////////////////////////////////////////////////////////// bool AI::UnitGoTo( Unit *u, const Point &dest, unsigned short dist ) { bool rc = true; Path p( map ); Point end; if ( p.Find( u, u->Position(), dest, PATH_BEST, dist ) != -1 ) { end = FollowPath( u, p ); Gam->MoveUnit( u, end ); } else { // try to find a way using a transporter short turns; Transport *t = FindTransport( u, dest, dist, true ); if ( t ) { turns = p.Find( u, u->Position(), t->Position() ); if ( (turns != 1) && (t->UnitCount() == 0) ) { // get the transport closer first (only if it's empty) TransPath tp( map, t ); if ( tp.Find( u, t->Position(), u->Position() ) != -1 ) { Gam->SelectUnit( t ); end = FollowPath( t, tp, 1 ); Gam->MoveUnit( t, end ); Gam->SelectUnit( u ); turns = p.Find( u, u->Position(), end ); if ( turns != -1 ) { end = FollowPath( u, p ); Gam->MoveUnit( u, end ); } else { tp.Reverse(); end = FollowPath( u, tp ); Gam->MoveUnit( u, end ); } } } else if ( turns >= 0 ) { end = FollowPath( u, p ); Gam->MoveUnit( u, end ); } } else rc = false; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : AI::SameDirection // DESCRIPTION: Check whether two target hexes are roughly lying in the // same direction. // PARAMETERS : pos - current position to check from // dest1 - first destination hex // dest2 - second destination hex // RETURNS : TRUE if dest1 and dest2 are exactly the same direction // or differ by one tick only, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool AI::SameDirection( const Point &pos, const Point &dest1, const Point &dest2 ) const { Direction dd1 = Hex2Dir( pos, dest1 ); Direction dd2 = Hex2Dir( pos, dest2 ); return ( (dd1 == dd2) || ((dd1 + 1) % 6 == dd2) || (dd1 == (dd2 + 1) % 6) ); } //////////////////////////////////////////////////////////////////////// // NAME : AI::AIObj::AssignUnit // DESCRIPTION: Assign a unit to the objective. // PARAMETERS : unit - unit // str - unit strength value (see AI::UnitStrength()) // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::AIObj::AssignUnit( Unit *unit, unsigned short str ) { AIAllocNode *n = new AIAllocNode( unit ); if ( pos == Point(-1,-1) ) { if ( unit->IsTransport() ) alloc_units.AddTail( n ); else alloc_units.AddHead( n ); } else { // add unit to list according to its distance to the objective; // smaller distance => higher priority AIAllocNode *u = static_cast( alloc_units.Tail() ); unsigned short dist = Distance( unit->Position(), pos ); while ( u && (Distance(u->unit->Position(), pos) > dist) ) { u = static_cast( u->Prev() ); } alloc_units.InsertNode( n, u ); } unit->SetFlags( U_BUSY ); const UnitType *type = unit->Type(); unsigned char num = 0; if ( type->Firepower(U_AIR) > 0 ) ++num; if ( type->Firepower(U_GROUND) > 0 ) ++num; if ( type->Firepower(U_SHIP) > 0 ) ++num; if ( num > 0 ) { str /= num; if ( type->Firepower(U_AIR) > 0 ) needed_air = MAX( 0, needed_air - str ); if ( type->Firepower(U_GROUND) > 0 ) needed_ground = MAX( 0, needed_ground - str ); if ( type->Firepower(U_SHIP) > 0 ) needed_ship = MAX( 0, needed_ship - str ); } } //////////////////////////////////////////////////////////////////////// // NAME : AI::AIObj::ReleaseUnits // DESCRIPTION: Discard the objective and release all units so they can // be assigned to other objectives. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::AIObj::ReleaseUnits( void ) { while ( !alloc_units.IsEmpty() ) { AIAllocNode *n = static_cast( alloc_units.RemHead() ); n->unit->UnsetFlags( U_BUSY ); delete n; } } //////////////////////////////////////////////////////////////////////// // NAME : AI::AIObj::ReleaseUnit // DESCRIPTION: Release a single unit from the objective. // PARAMETERS : u - unit to release // RETURNS : - //////////////////////////////////////////////////////////////////////// void AI::AIObj::ReleaseUnit( Unit *u ) const { for ( AIAllocNode *n = static_cast( alloc_units.Head() ); n; n = static_cast( n->Next() ) ) { if ( n->unit == u ) { n->Remove(); delete n; u->UnsetFlags( U_BUSY ); return; } } } //////////////////////////////////////////////////////////////////////// // NAME : AI::AIObj::UnitAssigned // DESCRIPTION: Check whether a specific unit is assigned to this // objective. // PARAMETERS : u - unit to check for // RETURNS : TRUE if unit is assigned to the objective, FALSE // otherwise //////////////////////////////////////////////////////////////////////// bool AI::AIObj::UnitAssigned( const Unit *u ) const { for ( AIAllocNode *n = static_cast( alloc_units.Head() ); n; n = static_cast( n->Next() ) ) { if ( n->unit == u ) return true; } return false; } crimson-0.5.2.orig/src/cf/ai.h0000600000175000017500000000757610623572563014252 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // ai.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_AI_H #define _INCLUDE_AI_H #include "mission.h" #include "path.h" #include "extwindow.h" class AI { public: AI( Mission &mission ); void Play( void ); private: class AIObj : public Node { public: AIObj( void ) : needed_ground(0), needed_ship(0), needed_air(0), requested_ground(0), requested_ship(0), requested_air(0) {} void AssignUnit( Unit *unit, unsigned short str ); void ReleaseUnits( void ); void ReleaseUnit( Unit *u ) const; bool UnitAssigned( const Unit *u ) const; Point pos; unsigned short type; unsigned short flags; unsigned short needed_ground; unsigned short needed_ship; unsigned short needed_air; bool requested_ground; bool requested_ship; bool requested_air; unsigned char priority; List alloc_units; class AIAllocNode : public Node { public: AIAllocNode( Unit *u ) { unit = u; } Unit *unit; }; }; void IdentifyObjectives( void ); void AssignObjectives( void ); void BuildReinforcements( void ) const; void ProcessObjective( AIObj &obj ); void AddObjective( AIObj *obj ); AIObj *GetObjectiveForUnit( const Unit *u ) const; void CommandUnit( Unit *u, AIObj &obj ); void CommandUnitDefend( Unit *u, AIObj &obj ); void CommandUnitConquer( Unit *u, AIObj &obj ); void CommandUnitAttack( Unit *u, AIObj &obj ); bool CommandUnitRepair( Unit *u ); void CommandUnitReturnToBase( Unit *u ); void CommandUnitTransport( Unit *u, AIObj &obj ); void UnitPresence( Player *owner, AI::AIObj *obj, short radius = -1 ) const; unsigned short UnitStrength( Unit *u ) const; bool UnitCanReach( const Unit *u, const Point &pos, unsigned short dist ); bool UnitGoTo( Unit *u, const Point &dest, unsigned short dist ); Unit *ClosestUnit( Player *owner, const Point &p, unsigned long uflags, unsigned long nuflags, const Unit *last = NULL ) const; Building *ClosestBuilding( Player *owner, const Point &p, const Building *last = NULL ) const; Point FollowPath( const Unit *u, const Path &path, unsigned short dist = 0 ) const; Point FindBestHex( const Unit *u, const Unit *enemy ) const; Unit *FindBestTarget( const Unit *u ); Transport *FindTransport( const Unit *u, const Point &dest, unsigned short dist, bool forreal ); bool SameDirection( const Point &pos, const Point &dest1, const Point &dest2 ) const; Player *player; List objectives; Mission &mission; Map *map; ProgressWindow *progress; }; #define AI_OBJ_DEFEND 0x0001 #define AI_OBJ_CONQUER 0x0002 #define AI_OBJ_ATTACK 0x0004 #define AI_OBJ_TRANSPORT 0x0008 #define AI_PRI_TRANSPORT 0 #define AI_PRI_LOW 20 #define AI_PRI_MEDIUM 40 #define AI_PRI_HIGH 60 #define AI_PRI_CRITICAL 80 #define AI_PRI_MAX 255 #define AI_ATTENTION_RADIUS 10 // the higher this value, the more defensive // computer player will act #endif /* _INCLUDE_AI_H */ crimson-0.5.2.orig/src/cf/building.cpp0000600000175000017500000001247210554366407016001 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // building.cpp //////////////////////////////////////////////////////////////////////// #include "building.h" //////////////////////////////////////////////////////////////////////// // NAME : Building::Load // DESCRIPTION: Load a building definition from a file. // PARAMETERS : file - data file descriptor // RETURNS : -1 on error, owner identifier (>= 0) otherwise //////////////////////////////////////////////////////////////////////// short Building::Load( MemBuffer &file ) { unsigned char pid, minw, maxw; b_id = file.Read16(); b_pos.x = file.Read16(); b_pos.y = file.Read16(); b_flags = file.Read16(); b_crystals = file.Read16(); b_crystalstore = file.Read16(); b_uprod = file.Read32(); b_cprod = file.Read8(); pid = file.Read8(); minw = file.Read8(); maxw = file.Read8(); b_name_id = file.Read8(); SetWeightLimits( minw, maxw ); return pid; } //////////////////////////////////////////////////////////////////////// // NAME : Building::Save // DESCRIPTION: Save the building to a file. // PARAMETERS : file - save file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Building::Save( MemBuffer &file ) const { unsigned char pid; if ( b_player ) pid = b_player->ID(); else pid = PLAYER_NONE; file.Write16( b_id ); file.Write16( b_pos.x ); file.Write16( b_pos.y ); file.Write16( b_flags ); file.Write16( b_crystals ); file.Write16( b_crystalstore ); file.Write32( b_uprod ); file.Write8( b_cprod ); file.Write8( pid ); file.Write8( MinWeight() ); file.Write8( MaxWeight() ); file.Write8( b_name_id ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Building::Allow // DESCRIPTION: Check whether a unit is allowed to enter the building. // PARAMETERS : unit - unit to check permission for // RETURNS : true if unit may enter, false if not //////////////////////////////////////////////////////////////////////// bool Building::Allow( const Unit *unit ) const { if ( (unit->Owner() == b_player) || unit->IsConquer() ) return UnitContainer::Allow( unit ); return false; } //////////////////////////////////////////////////////////////////////// // NAME : Building::SetCrystals // DESCRIPTION: Set crystals in stock to a specified value. This can // never be higher than b_crystalstore. // PARAMETERS : crystals - requested amount of crystals // RETURNS : - //////////////////////////////////////////////////////////////////////// void Building::SetCrystals( unsigned short crystals ) { b_crystals = MIN( crystals, b_crystalstore ); } //////////////////////////////////////////////////////////////////////// // NAME : Building::ModifyCrystals // DESCRIPTION: Change the amount of crystals in stock. // PARAMETERS : crystals - requested change in crystal storage // RETURNS : - //////////////////////////////////////////////////////////////////////// void Building::ModifyCrystals( short crystals ) { short crys = crystals + b_crystals; if ( crys > b_crystalstore ) b_crystals = b_crystalstore; else if ( crys < 0 ) b_crystals = 0; else b_crystals = crys; } //////////////////////////////////////////////////////////////////////// // NAME : Building::ModifyCrystalProduction // DESCRIPTION: Change the current mining value. // PARAMETERS : crystals - requested change in mining activity // RETURNS : - //////////////////////////////////////////////////////////////////////// void Building::ModifyCrystalProduction( short crystals ) { short crys = crystals + b_cprod; if ( crys > 200 ) b_cprod = 200; else if ( crys < 0 ) b_cprod = 0; else b_cprod = crys; } //////////////////////////////////////////////////////////////////////// // NAME : Building::SetOwner // DESCRIPTION: Set the controller of the building. This also makes all // units inside change sides. // PARAMETERS : player - new controller // recurse - if true also change units inside // RETURNS : - //////////////////////////////////////////////////////////////////////// void Building::SetOwner( Player *player, bool recurse /* = true */ ) { b_player = player; if ( recurse ) { // convert all units inside to their new master UCNode *n = static_cast( uc_units.Head() ); while ( n ) { n->uc_unit->SetOwner( player ); n->uc_unit->SetFlags( U_DONE ); n = static_cast( n->Next() ); } } } crimson-0.5.2.orig/src/cf/building.h0000600000175000017500000000573110554366466015453 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // building.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_BUILDING_H #define _INCLUDE_BUILDING_H #include "container.h" #include "player.h" class Building : public UnitContainer, public Node, public MapObject { public: Building( void ) : MapObject(MO_BUILDING), b_name(0), b_player(0) {} short Load( MemBuffer &file ); int Save( MemBuffer &file ) const; bool Allow( const Unit *unit ) const; bool IsWorkshop( void ) const { return (b_flags & BLD_WORKSHOP) != 0; } bool IsFactory( void ) const { return (b_flags & BLD_FACTORY) != 0; } bool IsMine( void ) const { return CrystalProduction() > 0; } unsigned char CrystalProduction( void ) const { return b_cprod; } unsigned short Crystals( void ) const { return b_crystals; } unsigned short MaxCrystals( void ) const { return b_crystalstore; } unsigned short ID( void ) const { return b_id; } const char *Name( void ) const { return b_name; } signed char NameID( void ) const { return b_name_id; } Player *Owner( void ) const { return b_player; } const Point &Position( void ) const { return b_pos; } unsigned long UnitProduction( void ) const { return b_uprod; } void SetOwner( Player *player, bool recurse = true ); void SetCrystalProduction( unsigned char crystals ) { b_cprod = crystals; } void ModifyCrystalProduction( short crystals ); void SetCrystals( unsigned short crystals ); void ModifyCrystals( short crystals ); void SetUnitProduction( unsigned long unitmask ) { b_uprod |= unitmask; } void UnsetUnitProduction( unsigned long unitmask ) { b_uprod &= ~unitmask; } void SetName( const char *name ) { b_name = name; } private: Point b_pos; unsigned short b_id; unsigned short b_flags; unsigned short b_crystals; // amount of crystals on hold unsigned short b_crystalstore; // maximum amount of crystals that can be stored unsigned char b_cprod; // crystal production per turn for mines unsigned long b_uprod; // unit types that can be built for factories signed char b_name_id; const char *b_name; Player *b_player; }; #endif /* _INCLUDE_BUILDING_H */ crimson-0.5.2.orig/src/cf/combat.cpp0000600000175000017500000002160010554366410015434 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////////////// // combat.cpp /////////////////////////////////////////////////////////////////////// #include "combat.h" #include "game.h" #include "hexsup.h" #include "msgs.h" //////////////////////////////////////////////////////////////////////// // NAME : Combat::Combat // DESCRIPTION: Keep the combat data until end of turn when all clashes // will be resolved. // PARAMETERS : att - attacking unit // def - defending unit // RETURNS : - //////////////////////////////////////////////////////////////////////// Combat::Combat( Unit *att, Unit *def ) : c_att(att), c_def(def), aamod(0), admod(0), damod(0), ddmod(0) {} //////////////////////////////////////////////////////////////////////// // NAME : Combat::Load // DESCRIPTION: Load combat data from a file. // PARAMETERS : file - data file descriptor // mission - pointer to mission object // RETURNS : -1 on error, 0 on success //////////////////////////////////////////////////////////////////////// int Combat::Load( MemBuffer &file, Mission &mission ) { aamod = admod = damod = ddmod = 0; c_att = mission.GetUnit( file.Read16() ); c_def = mission.GetUnit( file.Read16() ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Combat::Save // DESCRIPTION: Save combat data to a file. // PARAMETERS : file - data file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Combat::Save( MemBuffer &file ) const { file.Write16( c_att->ID() ); file.Write16( c_def->ID() ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Combat::CalcModifiers // DESCRIPTION: Calculate attack and defence modifiers for this combat. // This should be done after all pairings for this turn // are known and units cannot be moved but before the first // shot is fired. // PARAMETERS : map - pointer to the map object // RETURNS : - //////////////////////////////////////////////////////////////////////// void Combat::CalcModifiers( const Map &map ) { const Point &apos = c_att->Position(), &dpos = c_def->Position(); bool nextto = NextTo( apos, dpos ); // calculate modifiers; these are already calculated when initiating // combat because they are subject to change during the execution of // attack commands; terrain modifiers do not apply for aircraft, of // course, and only if it's not a ranged attack // if, however, it is a ranged attack give a uniform bonus because // we are not directly engaged if ( !c_att->IsAircraft() ) { if ( nextto ) aamod += map.AttackMod( apos ); else aamod += 5; admod = map.DefenceMod( apos ); } if ( !c_def->IsAircraft() ) { damod += map.AttackMod( dpos ); ddmod += map.DefenceMod( dpos ); } // check for units supporting our attack (wedging) or supporting defence (blocking), // only for non-ranged attacks if ( nextto ) { Point nbors[6]; Unit *u; map.GetNeighbors( dpos, nbors ); for ( int i = NORTH; i <= NORTHWEST; ++i ) { if ( nbors[i].x != -1 ) { u = map.GetUnit( nbors[i] ); if ( u ) { if ( u != c_att ) { if ( u->Owner() == c_att->Owner() ) { if ( u->CouldHit( c_def ) ) aamod += 10; else aamod += 5; // the unit might also help defend against the retaliation attack if ( NextTo( nbors[i], apos ) ) admod += 10; } } else { // if there's a supporter in the defender's back get another 10% plus Direction behind = ReverseDir( i ); if ( nbors[behind].x != -1 ) { Unit *stab = map.GetUnit( nbors[behind] ); if ( stab && (stab->Owner() == c_att->Owner()) ) { if ( stab->CouldHit( c_def ) ) aamod += 10; else aamod += 5; } } } } } } // check for units supporting defence (blocking), only for non-ranged attacks Point upos; Direction attdir = Hex2Dir( dpos, apos ); // any unit can help with blocking if ( !map.Dir2Hex( dpos, TurnLeft(attdir), upos ) && (u = map.GetUnit( upos )) && (u->Owner() == c_def->Owner()) ) ddmod += 10; if ( !map.Dir2Hex( dpos, TurnRight(attdir), upos ) && (u = map.GetUnit( upos )) && (u->Owner() == c_def->Owner()) ) ddmod += 10; } else ddmod -= 5; } //////////////////////////////////////////////////////////////////////// // NAME : Combat::CalcResults // DESCRIPTION: Resolve a firefight between two units with a known // outcome. // PARAMETERS : atthits - hits scored by attacker // defhits - hits scored by defender // RETURNS : Point containing hits by the attacker and defender //////////////////////////////////////////////////////////////////////// Point Combat::CalcResults( unsigned char atthits, unsigned char defhits ) const { unsigned short numatts = c_att->GroupSize(), numdefs = c_def->GroupSize(); c_def->Hit( atthits ); c_att->Hit( defhits ); // award experience: 1 if the enemy troops were reduced, 3 if they were destroyed if ( !c_att->IsMine() ) { if ( !c_att->IsAlive() ) c_def->AwardXP( 3 ); else if ( c_att->GroupSize() < numatts ) c_def->AwardXP( 1 ); } if ( !c_def->IsMine() ) { if ( !c_def->IsAlive() ) c_att->AwardXP( 3 ); else if ( c_def->GroupSize() < numdefs ) c_att->AwardXP( 1 ); } return Point( atthits, defhits ); } //////////////////////////////////////////////////////////////////////// // NAME : Combat::CalcResults // DESCRIPTION: Resolve a firefight between two units. // PARAMETERS : - // RETURNS : Point containing hits by the attacker and defender // // NOTE : Should the terrain modifiers also apply for both // attack and defence? Currently they are used for attack // for the attacking unit and for defence for the defending // unit only. //////////////////////////////////////////////////////////////////////// Point Combat::CalcResults( void ) { Point p1 = c_att->Position(), p2 = c_def->Position(); unsigned short numatts = c_att->GroupSize(), numdefs = c_def->GroupSize(), dist = Distance( p1.x, p1.y, p2.x, p2.y ); int i; unsigned char ahits = 0, dhits = 0, atohit, dtohit, atodef, dtodef, aapool = 0, adpool = 0, dapool = 0, ddpool = 0, aastr, adstr, dastr, ddstr, axp = c_att->XPLevel() * 2, dxp = c_def->XPLevel() * 2; atohit = MAX( 25 + axp - (dist - 1) * 2 + aamod, 1 ); atodef = 25 + axp + admod; dtodef = 25 + dxp + ddmod; aastr = c_att->OffensiveStrength( c_def ) + axp; adstr = c_att->DefensiveStrength() + axp; dastr = c_def->OffensiveStrength( c_att ) + dxp; ddstr = c_def->DefensiveStrength() + dxp; // can the defender return fire? if ( (dist == 1) && c_def->CanHit( c_att ) ) { dtohit = 25 + dxp + damod; } else dtohit = 0; for ( i = 0; i < numatts; ++i ) { if ( random( 1, 100 ) <= atohit ) aapool += aastr * random( 80, 120 ) / 100; if ( random( 1, 100 ) <= atodef ) adpool += adstr * random( 80, 120 ) / 100; } for ( i = 0; i < numdefs; ++i ) { if ( random( 1, 100 ) <= dtohit ) dapool += dastr * random( 80, 120 ) / 100; if ( random( 1, 100 ) <= dtodef ) ddpool += ddstr * random( 80, 120 ) / 100; } // set defence pools to a minimum of the enemy unit strength; // that avoids division by zero and leads to somewhat sane results if ( adpool <= dastr ) adpool = MAX( 1, dastr ); if ( ddpool < aastr ) ddpool = aastr; // attacker can't have 0 strength // generally, the number of hits is determined by comparing the attack and // defence pool values. To reduce the impact of luck, however, we take the // average of the "randomized" and a strictly deterministic number. ahits = (aapool/ddpool + (aastr * atohit)/(ddstr * dtodef) + 1) / 2; dhits = (dapool/adpool + (dastr * dtohit)/(adstr * atodef) + 1) / 2; return CalcResults( ahits, dhits ); } crimson-0.5.2.orig/src/cf/combat.h0000600000175000017500000000337610554366466015126 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // combat.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_COMBAT_H #define _INCLUDE_COMBAT_H #include "map.h" #include "list.h" #include "fileio.h" #include "window.h" #include "button.h" class Mission; class Combat : public Node { public: Combat( void ) {} Combat( Unit *att, Unit *def ); int Load( MemBuffer &file, Mission &mission ); int Save( MemBuffer &file ) const; Unit *GetAttacker( void ) const { return c_att; } Unit *GetDefender( void ) const { return c_def; } void CalcModifiers( const Map &map ); Point CalcResults( void ); Point CalcResults( unsigned char atthits, unsigned char defhist ) const; private: Unit *c_att; // attacker Unit *c_def; // defender signed char aamod; signed char admod; signed char damod; // defender only gets terrain bonus for attacks signed char ddmod; }; #endif /* _INCLUDE_COMBAT_H */ crimson-0.5.2.orig/src/cf/container.cpp0000600000175000017500000002515510554366410016162 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // container.cpp //////////////////////////////////////////////////////////////////////// #include "container.h" #include "map.h" //////////////////////////////////////////////////////////////////////// // NAME : UnitContainer::UnitContainer // DESCRIPTION: Initialize a unit container. // PARAMETERS : type - either MO_UNIT or MO_BUILDING // RETURNS : - //////////////////////////////////////////////////////////////////////// UnitContainer::UnitContainer( void ) : uc_slots(UC_MAX_SLOTS), uc_slots_full(0), uc_min_weight(0), uc_max_weight(99) {} //////////////////////////////////////////////////////////////////////// // NAME : UnitContainer::InsertUnit // DESCRIPTION: Put a unit into the container. No checks are performed. // PARAMETERS : unit - unit to insert // RETURNS : 1 if the owner of the building changed because of the // insertion (an enemy unit with the U_CONQUER flag came // in), -1 on error, 0 otherwise //////////////////////////////////////////////////////////////////////// short UnitContainer::InsertUnit( Unit *unit ) { short rc = 0; UCNode *n = new UCNode( unit ); if ( n ) { unit->SetFlags( U_SHELTERED ); uc_units.AddTail( n ); if ( dynamic_cast(this)->Owner() != unit->Owner() ) rc = 1; // if a transport is coming in, we must unload it if ( unit->IsTransport() ) { Transport *t = static_cast(unit); SetCrystals( Crystals() + t->Crystals() ); t->SetCrystals( 0 ); while ( Unit *u = t->GetUnit(0) ) { t->RemoveUnit( u ); InsertUnit( u ); } } uc_slots_full += unit->Weight(); } else rc = -1; return rc; } //////////////////////////////////////////////////////////////////////// // NAME : UnitContainer::RemoveUnit // DESCRIPTION: Take a unit out of the container. // PARAMETERS : unit - unit to remove from container // RETURNS : - //////////////////////////////////////////////////////////////////////// void UnitContainer::RemoveUnit( Unit *unit ) { if ( unit->IsDummy() ) unit->UnsetFlags( U_SHELTERED ); else { UCNode *n = static_cast( uc_units.Head() ); while ( n ) { if ( n->uc_unit == unit ) { n->Remove(); delete n; unit->UnsetFlags( U_SHELTERED ); // only subtract unit's own weight even for transports // since carried units are removed separately uc_slots_full -= unit->Unit::Weight(); break; } n = static_cast( n->Next() ); } } } //////////////////////////////////////////////////////////////////////// // NAME : UnitContainer::GetUnit // DESCRIPTION: Get the unit in the specified slot from the container. // PARAMETERS : slot - slot number for the unit you want // RETURNS : pointer to the unit in slot, or NULL if none //////////////////////////////////////////////////////////////////////// Unit *UnitContainer::GetUnit( short slot ) const { UCNode *n = static_cast( uc_units.GetNode( slot ) ); return ( n ? n->uc_unit : NULL ); } //////////////////////////////////////////////////////////////////////// // NAME : UnitContainer::Allow // DESCRIPTION: Check whether a unit is allowed to enter. // PARAMETERS : unit - unit to check permission for // RETURNS : true if unit may enter, false if not //////////////////////////////////////////////////////////////////////// bool UnitContainer::Allow( const Unit *unit ) const { if ( !Allow( unit->Type() ) ) return false; int i; for ( i = UnitCount() - 1; i >= 0; --i ) if ( GetUnit(i) == unit ) return true; if ( unit->IsTransport() ) { const Transport *t = static_cast(unit); if ( Crystals() + t->Crystals() > MaxCrystals() ) return false; for ( i = t->UnitCount() - 1; i >= 0; --i ) if ( !Allow( t->GetUnit(i) ) ) return false; } return uc_slots >= uc_slots_full + unit->Weight(); } //////////////////////////////////////////////////////////////////////// // NAME : UnitContainer::Allow // DESCRIPTION: Check whether a unit type is allowed to enter. // PARAMETERS : type - unit type to check permission for // RETURNS : true if unit type may enter, false if not //////////////////////////////////////////////////////////////////////// bool UnitContainer::Allow( const UnitType *type ) const { return (type->Weight() >= MinWeight()) && (type->Weight() <= MaxWeight()) && (type->Weight() + uc_slots_full <= uc_slots); } //////////////////////////////////////////////////////////////////////// // NAME : Transport::Transport // DESCRIPTION: Create a new transport instance. // PARAMETERS : type - unit type definition // player - transport controller // id - unique transport unit identifier // pos - position on map // RETURNS : - //////////////////////////////////////////////////////////////////////// Transport::Transport( const UnitType *type, Player *player, unsigned short id, const Point &pos ) : Unit( type, player, id, pos ), t_crystals(0) { uc_slots = u_type->Slots(); uc_min_weight = u_type->MinWeight(); uc_max_weight = u_type->MaxWeight(); } //////////////////////////////////////////////////////////////////////// // NAME : Transport::Load // DESCRIPTION: Load a transport from a data file. // PARAMETERS : file - data file descriptor // type - pointer to a unit type definition // player - pointer to the player this unit belongs to // RETURNS : - //////////////////////////////////////////////////////////////////////// int Transport::Load( MemBuffer &file, const UnitType *type, Player *player ) { Unit::Load( file, type, player ); uc_slots = u_type->Slots(); uc_min_weight = u_type->MinWeight(); uc_max_weight = u_type->MaxWeight(); SetCrystals( file.Read16() ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Transport::Save // DESCRIPTION: Save transport information to a file. // PARAMETERS : file - save file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Transport::Save( MemBuffer &file ) const { Unit::Save( file ); file.Write16( t_crystals ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Transport::SetPosition // DESCRIPTION: When a transport is moved on the map, it must not only // keep track of its own position, but update the // information for all units inside as well. // PARAMETERS : x - new horizontal coordinate // y - new vertical coordinate // RETURNS : - //////////////////////////////////////////////////////////////////////// void Transport::SetPosition( short x, short y ) { Unit::SetPosition( x, y ); UCNode *n = static_cast( uc_units.Head() ); while ( n ) { n->uc_unit->SetPosition( x, y ); n = static_cast( n->Next() ); } } //////////////////////////////////////////////////////////////////////// // NAME : Transport::Hit // DESCRIPTION: When a transport is hit chances are that the units // inside are damaged as well. If the transport is // destroyed, so are the carried units. // PARAMETERS : damage - amount of damage taken // RETURNS : true if transport was destroyed, false otherwise //////////////////////////////////////////////////////////////////////// bool Transport::Hit( unsigned short damage ) { if ( Unit::Hit( damage ) ) { // destroyed UCNode *n = static_cast( uc_units.Head() ); while ( n ) { n->uc_unit->Hit( MAX_GROUP_SIZE ); n = static_cast( n->Next() ); } return true; } else { // randomly damage units inside UCNode *n = static_cast( uc_units.Head() ); while ( n ) { Node *next = n->Next(); if ( n->uc_unit->Hit( random(0, damage) ) ) RemoveUnit( n->uc_unit ); n = static_cast( next ); } return false; } } //////////////////////////////////////////////////////////////////////// // NAME : Transport::Allow // DESCRIPTION: Check whether a unit is allowed to enter the transport. // PARAMETERS : unit - unit to check permission for // RETURNS : true if unit may enter, false if not //////////////////////////////////////////////////////////////////////// bool Transport::Allow( const Unit *unit ) const { if ( unit->Owner() == u_player ) { if ( unit->IsTransport() ) { const Transport *t = static_cast(unit); if ( uc_slots < uc_slots_full - (Crystals()+9)/10 + unit->Weight() + (Crystals() + t->Crystals() + 9)/10 ) return false; } return UnitContainer::Allow( unit ); } return false; } //////////////////////////////////////////////////////////////////////// // NAME : Transport::Weight // DESCRIPTION: Get the weight of the transporter plus carried units. // PARAMETERS : - // RETURNS : combined weight //////////////////////////////////////////////////////////////////////// unsigned short Transport::Weight( void ) const { unsigned short w = Unit::Weight(); UCNode *n = static_cast( uc_units.Head() ); while ( n ) { w += n->uc_unit->Weight(); n = static_cast( n->Next() ); } return w; } //////////////////////////////////////////////////////////////////////// // NAME : Transport::SetCrystals // DESCRIPTION: Set amount of crystals carried. // PARAMETERS : crystals - new amount carried // RETURNS : - //////////////////////////////////////////////////////////////////////// void Transport::SetCrystals( unsigned short crystals ) { uc_slots_full -= (t_crystals + 9) / 10 - (crystals + 9) / 10; t_crystals = crystals; } crimson-0.5.2.orig/src/cf/container.h0000600000175000017500000000603610554366466015637 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // container.h - UnitContainer and Transport classes /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_CONTAINER_H #define _INCLUDE_CONTAINER_H #include "list.h" #include "unit.h" #define UC_MAX_SLOTS 30000 // number of unit slots for buildings (!= units) // node class used for keeping track of units class UCNode : public Node { public: UCNode( Unit *unit ) { uc_unit = unit; } Unit *uc_unit; }; class UnitContainer { public: UnitContainer( void ); virtual ~UnitContainer( void ) {} virtual unsigned short Crystals( void ) const = 0; virtual void SetCrystals( unsigned short crystals ) = 0; virtual unsigned short MaxCrystals( void ) const = 0; void SetWeightLimits( unsigned char min, unsigned char max ) { uc_min_weight = min; uc_max_weight = max; } short InsertUnit( Unit *unit ); void RemoveUnit( Unit *unit ); Unit *GetUnit( short slot ) const; virtual bool Allow( const Unit *unit ) const; bool Allow( const UnitType *type ) const; unsigned char UnitCount( void ) const { return uc_units.CountNodes(); } unsigned short Slots( void ) const { return uc_slots; } unsigned short FullSlots( void ) const { return uc_slots_full; } unsigned char MinWeight( void ) const { return uc_min_weight; } unsigned char MaxWeight( void ) const { return uc_max_weight; } protected: unsigned short uc_slots; unsigned short uc_slots_full; unsigned char uc_min_weight; unsigned char uc_max_weight; List uc_units; }; class Transport : public Unit, public UnitContainer { public: Transport( void ) : t_crystals(0) {} Transport( const UnitType *type, Player *player, unsigned short id, const Point &pos ); int Load( MemBuffer &file, const UnitType *type, Player *player ); int Save( MemBuffer &file ) const; void SetCrystals( unsigned short crystals ); unsigned short Crystals( void ) const { return t_crystals; } unsigned short MaxCrystals( void ) const { return Slots() * 10; } void SetPosition( short x, short y ); bool Hit( unsigned short damage ); bool Allow( const Unit *unit ) const; unsigned short Weight( void ) const; private: unsigned short t_crystals; }; #endif /* _INCLUDE_CONTAINER_H */ crimson-0.5.2.orig/src/cf/event.cpp0000600000175000017500000004323410554366411015320 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // event.cpp //////////////////////////////////////////////////////////////////////// #include "event.h" #include "game.h" #include "extwindow.h" //////////////////////////////////////////////////////////////////////// // NAME : Event::Load // DESCRIPTION: Load an event from a file. // PARAMETERS : file - file descriptor // RETURNS : identifier of the event owner, -1 on error //////////////////////////////////////////////////////////////////////// short Event::Load( MemBuffer &file ) { int i; e_id = file.Read8(); e_type = file.Read8(); e_trigger = file.Read8(); e_depend = file.Read8(); e_discard = file.Read8(); for ( i = 0; i < 3; ++i ) e_tdata[i] = file.Read16(); for ( i = 0; i < 3; ++i ) e_data[i] = file.Read16(); e_title = file.Read16(); e_message = file.Read16(); e_flags = file.Read16(); e_player = 0; return file.Read8(); } //////////////////////////////////////////////////////////////////////// // NAME : Event::Save // DESCRIPTION: Save the event data to a file. // PARAMETERS : file - data file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Event::Save( MemBuffer &file ) const { int i; file.Write8( e_id ); file.Write8( e_type ); file.Write8( e_trigger ); file.Write8( e_depend ); file.Write8( e_discard ); for ( i = 0; i < 3; ++i ) file.Write16( e_tdata[i] ); for ( i = 0; i < 3; ++i ) file.Write16( e_data[i] ); file.Write16( e_title ); file.Write16( e_message ); file.Write16( e_flags ); file.Write8( e_player->ID() ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Event::Check // DESCRIPTION: Check whether the event can be executed. The trigger // conditions and event dependencies must be met. // PARAMETERS : - // RETURNS : TRUE if the activation conditions are met and the event // should be executed, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool Event::Check( void ) { bool rc = CheckTrigger(); if ( rc ) { TLWList deps; deps.AddHead( new TLWNode( "", this, ID() ) ); rc = CheckDependencies( deps ); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Event::CheckTrigger // DESCRIPTION: Check whether the event trigger conditions are met. // PARAMETERS : - // RETURNS : TRUE if trigger conditions met, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool Event::CheckTrigger( void ) { bool rc = Discarded(); Mission *mis = Gam->GetMission(); if ( !rc && !Disabled() ) { switch ( e_trigger ) { case ETRIGGER_TIMER: // the event numbers "turns" starting with 0 with two phases each turn rc = (mis->GetTime() >= e_tdata[0]); break; case ETRIGGER_UNIT_DESTROYED: if ( e_tdata[0] == -1 ) { // destroy all enemy units to score rc = ( mis->GetPlayer( e_tdata[1] ).Units(0) == 0 ); } else if ( e_tdata[0] < -1 ) { // destroy all units of specified type unsigned char utype = -e_tdata[0] - 2; rc = true; for ( Unit *u = static_cast(mis->GetUnits().Head()); u; u = static_cast(u->Next()) ) { if ( u->Owner() && (u->Owner()->ID() == e_tdata[1]) && (u->Type()->ID() == utype) && u->IsAlive() ) { rc = false; break; } } } else { // trigger if Unit *u = mis->GetUnit( e_tdata[0] ); // * unit not found rc = ( !u || !u->IsAlive() || // * unit found, but already dead (u->Owner() && (u->Owner()->ID() != e_tdata[1])) ); // * owner != original owner (captured) } break; case ETRIGGER_HAVE_BUILDING: if ( (e_tdata[2] == -1) || (mis->GetTime() >= e_tdata[2]) ) { Building *b = mis->GetShop( e_tdata[0] ); rc = ( b && b->Owner() && (b->Owner()->ID() == e_tdata[1]) ); } break; case ETRIGGER_HAVE_CRYSTALS: { unsigned short crystals = 0; Building *b; if ( e_tdata[2] >= 0 ) { b = mis->GetShop( e_tdata[2] ); if ( b && b->Owner() && (b->Owner()->ID() == e_tdata[1]) ) crystals = b->Crystals(); } else { for ( b = static_cast(mis->GetShops().Head()); b; b = static_cast(b->Next()) ) { if ( b->Owner() && (b->Owner()->ID() == e_tdata[1]) ) crystals += b->Crystals(); } if ( (e_tdata[2] == -2) && (((e_tdata[0] < 0) && (crystals < -e_tdata[0])) || ((e_tdata[0] > 0) && (crystals < e_tdata[0]))) ) { // also check units for ( Unit *u = static_cast(mis->GetUnits().Head()); u; u = static_cast(u->Next()) ) { if ( u->IsTransport() && !u->IsSheltered() && u->Owner() && (u->Owner()->ID() == e_tdata[1]) && u->IsAlive() ) { crystals += static_cast(u)->Crystals(); } } } } rc = ((e_tdata[0] < 0) && (crystals < -e_tdata[0])) || ((e_tdata[0] > 0) && (crystals >= e_tdata[0])); break; } case ETRIGGER_HAVE_UNIT: if ( (e_tdata[2] == -1) || (mis->GetTime() >= e_tdata[2]) ) { Unit *u = mis->GetUnit( e_tdata[0] ); rc = ( u && u->Owner() && (u->Owner()->ID() == e_tdata[1]) ); } break; case ETRIGGER_UNIT_POSITION: { Point loc = mis->GetMap().Index2Hex(e_tdata[1]); if ( e_tdata[0] < 0 ) { // -1 means any unit, -X is unit of type X - 2 MapObject *mo = mis->GetMap().GetMapObject( loc ); if ( mo && mo->Owner() && (mo->Owner()->ID() == e_tdata[2]) ) { if (e_tdata[0] == -1) { rc = mo->IsUnit() || (static_cast(mo)->UnitCount() > 0); } else { unsigned short type = -e_tdata[0] - 2; UnitContainer *c = NULL; if ( mo->IsUnit() ) { Unit *u = static_cast(mo); if ( u->Type()->ID() == type ) rc = true; else if ( u->IsTransport() ) c = static_cast(u); } else c = static_cast(mo); if ( c ) { for ( int i = c->UnitCount() - 1; i >= 0; --i ) { if ( c->GetUnit( i )->Type()->ID() == type ) { rc = true; break; } } } } } } else { Unit *u = mis->GetUnit( e_tdata[0] ); rc = ( u && u->Owner() && (u->Owner()->ID() == e_tdata[2]) && (u->Position() == loc) ); } break; } case ETRIGGER_HANDICAP: rc = ( (mis->GetHandicap() & e_tdata[0]) != 0 ); break; } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Event::CheckDependencies // DESCRIPTION: Check whether event dependencies are met. // PARAMETERS : deps - list of dependent events already checked (with // positive results) // RETURNS : TRUE if all dependencies are met, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool Event::CheckDependencies( TLWList &deps ) { bool rc = true; if ( e_depend != -1 ) { // if the event does not exist anymore it has already been executed Event *dep = Gam->GetMission()->GetEvent( e_depend ); if ( dep && !dep->Discarded() ) { // did we already check this event earlier in the cycle? if ( !deps.GetNodeByID( dep->ID() ) ) { if ( dep->CheckTrigger() ) { deps.AddTail( new TLWNode( "", dep, dep->ID() ) ); rc = dep->CheckDependencies( deps ); } else rc = false; } } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Event::Execute // DESCRIPTION: Execute this event. What this means depends on the event // type. // PARAMETERS : view - pointer to view // RETURNS : - //////////////////////////////////////////////////////////////////////// void Event::Execute( View *view ) { Mission *mis = Gam->GetMission(); MapWindow *mwin = Gam->GetMapWindow(); MapView *mv = mwin->GetMapView(); bool show_msg = true; switch ( e_type ) { case EVENT_CONFIGURE: switch ( e_data[0] ) { case 0: // briefing player 1 case 1: // briefing player 2 mis->GetPlayer( e_data[0] ).SetBriefing( e_data[1] ); break; case 2: // next map mis->SetSequel( e_data[1] ); break; } break; case EVENT_CREATE_UNIT: { Point p = mis->GetMap().Index2Hex( e_data[1] ); MapObject *mo = mis->GetMap().GetMapObject( p ); if ( mo ) { const UnitType *type = mis->GetUnitSet().GetUnitInfo(e_data[0]); show_msg = (mo->Owner() == e_player) && ((mo->IsUnit() && static_cast(mo)->IsTransport()) || !mo->IsUnit()) && dynamic_cast(mo)->Allow( type ); } if ( show_msg ) { Unit *u = mis->CreateUnit( e_data[0], *e_player, p, (Direction)(e_data[2] & 0x07), (e_data[2] & 0x38) >> 3, (e_data[2] & 0x1C0) >> 6 ); if ( u ) { u->UnsetFlags( U_DONE ); if ( !u->IsSheltered() && mv->Enabled() ) { mwin->DisplayHex( p ); mwin->FadeInUnit( u->Image(), p ); mwin->Show( mv->UpdateHex( p ) ); } } } break; } case EVENT_DESTROY_UNIT: { Unit *u; if ( e_data[0] >= 0 ) { u = mis->GetUnit( e_data[0] ); } else { u = mis->GetMap().GetUnit( mis->GetMap().Index2Hex( e_data[2] ) ); } if ( u && ((e_data[1] == -1) || (u->Owner() && (e_data[1] == u->Owner()->ID())))) { Point p = u->Position(); bool show = !u->IsSheltered() && mv->Enabled(); if ( show ) mwin->DisplayHex( p ); if ( mis->GetHistory() ) mis->GetHistory()->RecordUnitEvent( *u, History::HIST_UEVENT_DESTROY ); u->Hit( MAX_GROUP_SIZE ); mis->GetMap().SetUnit( 0, p ); if ( show ) { mwin->FadeOutUnit( u->Image(), p ); mwin->Show( mv->UpdateHex( p ) ); } } else show_msg = false; break; } case EVENT_MANIPULATE_EVENT: { Event *e = mis->GetEvent( e_data[0] ); if ( e ) { if ( e_data[2] == 0 ) e->SetFlags( e_data[1] ); else if ( e_data[2] == 1 ) e->UnsetFlags( e_data[1] ); else if ( e_data[2] == 2 ) e->ToggleFlags( e_data[1] ); } break; } case EVENT_MESSAGE: break; case EVENT_MINING: { Building *b = mis->GetShop( e_data[0] ); if ( b ) { if ( e_data[2] == 0 ) b->SetCrystals( e_data[1] ); else if ( e_data[2] == 1 ) b->ModifyCrystals( e_data[1] ); else if ( e_data[2] == 2 ) b->SetCrystalProduction( e_data[1] ); else if ( e_data[2] == 3 ) b->ModifyCrystalProduction( e_data[1] ); } else show_msg = false; break; } case EVENT_RESEARCH: { Building *b = mis->GetShop( e_data[0] ); if ( b && (b->Owner() == e_player) ) { if ( e_data[2] == 0 ) b->SetUnitProduction( 1 << e_data[1] ); else b->UnsetUnitProduction( 1 << e_data[1] ); } else show_msg = false; break; } case EVENT_SCORE: // only execute score events when score is below 100 // this way we only get one message when multiple victory conditions // are met on a single turn if ( e_player->Success( 0 ) < 100 ) { e_player->Success( (signed char)e_data[0] ); DisplayMessage( &mis->GetOtherPlayer(*e_player), e_data[1], e_data[2], mis, true, view ); } else show_msg = false; break; case EVENT_SET_HEX: { Point pos = mis->GetMap().Index2Hex( e_data[1] ); if ( mv->Enabled() ) { const TerrainType *tt = mis->GetTerrainSet().GetTerrainInfo( e_data[0] ); mwin->DisplayHex( pos ); mwin->FadeInTerrain( tt->tt_image, pos ); } Map &map = mis->GetMap(); if ( mis->GetHistory() ) { mis->GetHistory()->RecordTileEvent( e_data[0], map.HexTypeID( pos ), pos.x, pos.y ); } map.SetHexType( pos.x, pos.y, e_data[0] ); if ( mv->Enabled() ) mwin->Show( mv->UpdateHex( pos ) ); break; } case EVENT_SET_TIMER: { Event *e = mis->GetEvent( e_data[0] ); if ( e && (e->Trigger() == ETRIGGER_TIMER) ) { short time = e_data[1]; if ( e_data[2] == 1 ) time += mis->GetTime(); else if ( e_data[2] == 2 ) time += e->GetTData( 0 ); e->SetTData( 0, time ); e->UnsetFlags( EFLAG_DISABLED ); } break; } } DisplayMessage( e_player, e_message, e_title, mis, show_msg, view ); if ( e_discard != -1 ) { Event *dis = mis->GetEvent( e_discard ); if ( dis ) dis->Discard(); } } //////////////////////////////////////////////////////////////////////// // NAME : Event::DisplayMessage // DESCRIPTION: Check whether the message is to be displayed, and pop up // a MessageWindow if it is. // PARAMETERS : p - player to show message to // msg - message index // title - title index (if -1 use player name) // m - pointer to mission object // show - if FALSE don't show (and don't record) message // view - current display // RETURNS : - //////////////////////////////////////////////////////////////////////// void Event::DisplayMessage( Player *p, short msg, short title, Mission *m, bool show, View *view ) const { if ( (msg == -1) || !p->IsInteractive() ) show = false; if ( show ) { MapWindow *mwin = Gam->GetMapWindow(); if ( &m->GetPlayer() == p ) { const char *tstr; if ( title == -1 ) tstr = p->Name(); else tstr = m->GetMessage(title); if ( mwin->GetMapView()->Enabled() ) { Point hex = GetFocus(); if ( hex != Point(-1, -1) ) mwin->DisplayHex( hex ); } MessageWindow *win = new MessageWindow( tstr, m->GetMessage(msg), view ); win->Draw(); win->Show(); win->EventLoop(); view->CloseWindow( win ); } else { // if the other player is human (ie. we have a history) put the message // into the turn replay queue History *hist = m->GetHistory(); if ( hist ) { Point hex = GetFocus(); int hexidx = (hex == Point(-1, -1) ? -1 : mwin->GetMapView()->GetMap()->Hex2Index(hex)); hist->RecordMsgEvent( title, msg, hexidx ); } } } } //////////////////////////////////////////////////////////////////////// // NAME : Event::GetFocus // DESCRIPTION: When we display a message it would be nice to focus the // display on the portion of the map that relates to the // message (if any). This method tries to determine this // focal point. // PARAMETERS : - // RETURNS : hex to focus on or -1/-1 if no such hex found //////////////////////////////////////////////////////////////////////// Point Event::GetFocus( void ) const { Mission *mis = Gam->GetMission(); Point p( -1, -1 ); MapObject *mo; switch ( e_type ) { case EVENT_CREATE_UNIT: p = mis->GetMap().Index2Hex( e_data[1] ); break; case EVENT_MESSAGE: p = mis->GetMap().Index2Hex( e_data[0] ); break; case EVENT_MINING: case EVENT_RESEARCH: mo = mis->GetShop( e_data[0] ); if ( mo ) p = mo->Position(); break; case EVENT_SET_HEX: p = mis->GetMap().Index2Hex( e_data[1] ); break; } if ( p == Point( -1, -1 ) ) { switch ( e_trigger ) { case ETRIGGER_UNIT_DESTROYED: if ( e_tdata[0] >= 0 ) { mo = mis->GetUnit( e_tdata[0] ); if ( mo ) p = mo->Position(); } break; case ETRIGGER_HAVE_BUILDING: mo = mis->GetShop( e_tdata[0] ); if ( mo ) p = mo->Position(); break; case ETRIGGER_HAVE_CRYSTALS: if ( e_tdata[0] >= 0 ) { mo = mis->GetShop( e_tdata[0] ); if ( mo ) p = mo->Position(); } break; case ETRIGGER_HAVE_UNIT: mo = mis->GetUnit( e_tdata[0] ); if ( mo ) p = mo->Position(); break; case ETRIGGER_UNIT_POSITION: p = mis->GetMap().Index2Hex(e_tdata[1]); break; } } return p; } //////////////////////////////////////////////////////////////////////// // NAME : Event::Discard // DESCRIPTION: Discard this event, ie. disable it and mark it for // deletion. Also recursively discard another event if told // to do so. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Event::Discard( void ) { if ( !Discarded() ) { SetFlags( EFLAG_DISCARDED ); if ( e_discard != -1 ) { Event *dis = Gam->GetMission()->GetEvent( e_discard ); if ( dis ) dis->Discard(); } } } crimson-0.5.2.orig/src/cf/event.h0000600000175000017500000000516410554366466014777 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // event.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_EVENT_H #define _INCLUDE_EVENT_H #include "player.h" #include "gamedefs.h" #include "textbox.h" class Event : public Node { public: short Load( MemBuffer &file ); int Save( MemBuffer &file ) const; bool Check( void ); void Execute( class View *view ); void Discard( void ); bool Discarded( void ) const { return (e_flags & EFLAG_DISCARDED) != 0; } unsigned char ID( void ) const { return e_id; } unsigned char Trigger( void ) const { return e_trigger; } void SetPlayer( Player &p ) { e_player = &p; } short GetData( unsigned short index ) const { return e_data[index]; } void SetData( unsigned short index, short value ) { e_data[index] = value; } short GetTData( unsigned short index ) const { return e_tdata[index]; } void SetTData( unsigned short index, short value ) { e_tdata[index] = value; } private: bool Disabled( void ) const { return (e_flags & EFLAG_DISABLED) != 0; } void SetFlags( unsigned short flags ) { e_flags |= flags; } void UnsetFlags( unsigned short flags ) { e_flags &= (~flags); } void ToggleFlags( unsigned short flags ) { e_flags ^= flags; } void DisplayMessage( Player *p, short msg, short title, class Mission *m, bool show, class View *view ) const; bool CheckTrigger( void ); bool CheckDependencies( TLWList &deps ); struct Point GetFocus( void ) const; unsigned char e_id; unsigned char e_type; unsigned char e_trigger; signed char e_depend; signed char e_discard; short e_tdata[3]; // trigger data short e_data[3]; // event data short e_title; short e_message; unsigned short e_flags; Player *e_player; }; #endif /* _INCLUDE_EVENT_H */ crimson-0.5.2.orig/src/cf/game.cpp0000600000175000017500000020156010637501177015110 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // game.cpp //////////////////////////////////////////////////////////////////////// #include #include #include "game.h" #include "path.h" #include "unitwindow.h" #include "gamewindow.h" #include "filewindow.h" #include "initwindow.h" #include "fileio.h" #include "sound.h" #include "ai.h" #include "options.h" #include "strutil.h" #include "msgs.h" extern Options CFOptions; // button identifiers used by the game hook function dispatcher enum { G_BUTTON_END_TURN = 10, G_BUTTON_MAP, G_BUTTON_BRIEFING, G_BUTTON_SAVE, G_BUTTON_LEV_INFO, G_BUTTON_GENERAL_OPTIONS, G_BUTTON_LANGUAGE_OPTIONS, G_BUTTON_VIDEO_OPTIONS, G_BUTTON_SOUND_OPTIONS, G_BUTTON_KEYBOARD_OPTIONS, G_BUTTON_ABORT, G_BUTTON_QUIT, G_BUTTON_SAVE_AND_SHUTDOWN, G_BUTTON_SHUTDOWN, G_BUTTON_UNIT_INFO, G_BUTTON_UNIT_CONTENT, G_BUTTON_UNIT_SWEEP, G_BUTTON_UNIT_UNDO, G_BUTTON_MINIMIZE_WINDOW }; enum { G_KEY_QUIT = 0, G_KEY_INFO, G_KEY_MAP, G_KEY_END_TURN, G_KEY_CONTENT, G_KEY_SWEEP }; #ifndef DISABLE_NETWORK class NetworkProgressWindow : public ProgressWindow { public: NetworkProgressWindow( unsigned short w, unsigned short h, const char *msg, View *view ); bool Cancelled( void ); private: bool cancelled; }; NetworkProgressWindow::NetworkProgressWindow( unsigned short w, unsigned short h, const char *msg, View *view ) : ProgressWindow( 0, 0, w, h, 0, 100, msg, WIN_CENTER|WIN_PROG_ABORT, view ), cancelled(false) {} bool NetworkProgressWindow::Cancelled( void ) { if ( !cancelled ) { if ( Get() < 100 ) Advance( 1 ); else Set( 0 ); bool cancel = ProgressWindow::Cancelled(); if ( cancel ) { // ask for confirmation string buttons; buttons.append( MSG(MSG_B_YES) ); buttons += '|'; buttons.append( MSG(MSG_B_NO) ); DialogWindow *req = new DialogWindow( NULL, MSG(MSG_ASK_ABORT_NETWORK), buttons, 1, 0, view ); req->SetButtonID( 1, 0 ); cancelled = (req->EventLoop() == GUI_CLOSE); view->CloseWindow( req ); } } return cancelled; } #endif //////////////////////////////////////////////////////////////////////// // NAME : Game::Game // DESCRIPTION: Create a new game. // PARAMETERS : view - the display surface // RETURNS : - //////////////////////////////////////////////////////////////////////// Game::Game( View *view ) : mission(0), mwin(0), unit(0), shader(0), view(view) { InitKeys(); #ifndef DISABLE_NETWORK peer = NULL; #endif } //////////////////////////////////////////////////////////////////////// // NAME : Game::~Game // DESCRIPTION: Destroy the game. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Game::~Game( void ) { if ( mwin ) view->CloseWindow( mwin ); delete mission; delete shader; #ifndef DISABLE_NETWORK delete peer; #endif } //////////////////////////////////////////////////////////////////////// // NAME : Game::InitKeys // DESCRIPTION: Initialize the array of keyboard commands. These // shortcuts change with the locale the user selected. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::InitKeys( void ) { short labels[] = { MSG_B_QUIT, MSG_B_UNIT_INFO, MSG_B_MAP, MSG_B_END_TURN, MSG_B_UNIT_CONTENT, MSG_B_UNIT_SWEEP }; for ( int i = 0; i <= G_KEY_SWEEP; ++i ) { string label( MSG(labels[i]) ); size_t pos = label.find( '_' ); if ( pos != string::npos ) keys[i] = StringUtil::utf8chartoascii(&label[pos+1]); else keys[i] = 0; } } //////////////////////////////////////////////////////////////////////// // NAME : Game::InitWindows // DESCRIPTION: Initialize the game windows. We need a valid mission // loaded to do that. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::InitWindows( void ) { if ( mission ) { mwin = new MapWindow( 0, 0, view->Width(), view->Height(), 0, view ); if ( CFOptions.GetDamageIndicator() ) mwin->GetMapView()->EnableUnitStats(); mwin->GetMapView()->SetMap( &mission->GetMap() ); // attach map to map window shader = new MoveShader( &mission->GetMap(), mission->GetUnits(), mwin->GetMapView()->GetFogBuffer() ); ExecPreStartEvents(); } } //////////////////////////////////////////////////////////////////////// // NAME : Game::Quit // DESCRIPTION: Ask the user for confirmation and exit. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::Quit( void ) const { Audio::PlaySfx( Audio::SND_GUI_ASK, 0 ); string buttons; buttons.append( MSG(MSG_B_YES) ); buttons += '|'; buttons.append( MSG(MSG_B_NO) ); DialogWindow *req = new DialogWindow( NULL, MSG(MSG_ASK_QUIT), buttons, 1, 0, view ); req->SetButtonID( 0, GUI_QUIT ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::CreateSaveFileName // DESCRIPTION: Get the name of the file to save to. Pop up a file // requester if necessary. // PARAMETERS : filename - default filename // RETURNS : file name or empty string on error //////////////////////////////////////////////////////////////////////// string Game::CreateSaveFileName( const char *filename ) const { string file; string yesno; yesno.append( MSG(MSG_B_YES) ); yesno += '|'; yesno.append( MSG(MSG_B_NO) ); if ( filename ) file.append( filename ); bool filesel; do { GUI_Status rc; DialogWindow *dw; filesel = false; if ( file.length() == 0 ) filesel = true; else if ( File::Exists( file ) ) { // if file exists let user confirm the write string conmsg = StringUtil::strprintf( MSG(MSG_ASK_OVERWRITE), file ); dw = new DialogWindow( NULL, conmsg, yesno, 1, 0, view ); dw->SetButtonID( 0, 1 ); dw->SetButtonID( 1, 0 ); rc = dw->EventLoop(); if ( rc == 0 ) filesel = true; view->CloseWindow( dw ); } if ( filesel ) { bool done = false; FileWindow *fw = new FileWindow( get_save_dir().c_str(), last_file_name.c_str(), ".sav", WIN_FILE_SAVE, view ); fw->ok->SetID( 1 ); fw->cancel->SetID( 0 ); do { rc = fw->EventLoop(); if ( rc == 1 ) { file = fw->GetFile(); if ( file.length() != 0 ) { view->CloseWindow( fw ); done = true; } } else if ( rc == 0 ) { if ( mission->GetFlags() & GI_PBEM ) { // if saving a PBeM game is aborted the game data is lost... dw = new DialogWindow( MSG(MSG_WARNING), MSG(MSG_ASK_ABORT_PBEM), yesno, 1, WIN_FONT_BIG, view ); Audio::PlaySfx( Audio::SND_GUI_ASK, 0 ); dw->SetButtonID( 0, 1 ); dw->SetButtonID( 1, 0 ); rc = dw->EventLoop(); view->CloseWindow( dw ); if ( rc != 0 ) { view->CloseWindow( fw ); file = ""; done = true; filesel = false; } } else { view->CloseWindow( fw ); file.assign( "" ); done = true; filesel = false; } } } while ( !done ); } } while ( filesel ); return file; } //////////////////////////////////////////////////////////////////////// // NAME : Game::Save // DESCRIPTION: Save the current game to a file. // PARAMETERS : filename - data file name; if NULL pops up a file // selection window // RETURNS : 0 on successful write, non-zero otherwise //////////////////////////////////////////////////////////////////////// int Game::Save( const char *filename ) { string fname( CreateSaveFileName( filename ) ); if ( fname.length() == 0 ) return -1; File file( fname ); if ( !file.Open( "wb", false ) ) { new NoteWindow( MSG(MSG_ERROR), MSG(MSG_ERR_WRITE), 0, view ); return -1; } // set last filename last_file_name = file_part( fname ); unsigned int num = last_file_name.rfind( '.' ); last_file_name.erase( num ); unsigned short mflags = mission->GetFlags(); mission->SetFlags( mflags|GI_SAVEFILE ); mission->Save( file ); file.Close(); if ( mflags & GI_PBEM ) { string msg = StringUtil::strprintf( MSG(MSG_GAME_SAVED_PBEM), fname ); NoteWindow *nw = new NoteWindow( MSG(MSG_GAME_SAVED), msg, 0, view ); nw->SetButtonID( 0, G_BUTTON_SHUTDOWN ); nw->SetButtonHook( 0, this ); } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Game::Load // DESCRIPTION: Load a game from a mission file (start a new game) or // a save file (resume game). // PARAMETERS : filename - data file name // RETURNS : 0 on success, -1 otherwise //////////////////////////////////////////////////////////////////////// int Game::Load( const char *filename ) { File file( filename ); if ( !file.Open( "rb" ) ) return -1; int rc = Load( file ); if ( rc != -1 ) { // set last filename last_file_name = file_part( filename ); unsigned int i = last_file_name.rfind( '.' ); last_file_name.erase( i ); } else { cerr << "Error loading " << filename << endl; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Game::Load // DESCRIPTION: Load a game from a buffer. // PARAMETERS : buffer - data buffer // RETURNS : 0 on success, -1 otherwise //////////////////////////////////////////////////////////////////////// int Game::Load( MemBuffer &buffer ) { int rc = -1; mission = new Mission(); if ( mission->Load( buffer ) != -1 ) { mission->SetLocale( CFOptions.GetLanguage() ); unsigned short flags = mission->GetFlags(); if ( flags & GI_SAVEFILE ) { // update CFOptions if ( flags & GI_CAMPAIGN ) CFOptions.SetCampaign( true ); if ( flags & GI_AI ) CFOptions.SetGameType( GTYPE_AI ); else if ( flags & GI_PBEM ) CFOptions.SetGameType( GTYPE_PBEM ); else if ( flags & GI_NETWORK ) CFOptions.SetGameType( GTYPE_NET_SERVER ); } else { // if this is a new map (GI_SAVEFILE not set) GI_SKIRMISH, // GI_CAMPAIGN, and GI_AI only serve as information flags &= ~(GI_AI|GI_CAMPAIGN|GI_SKIRMISH); flags |= ((CFOptions.IsPBEM() ? GI_PBEM : 0)| (CFOptions.IsNetwork() ? GI_NETWORK : 0)| (CFOptions.IsAI() ? GI_AI : 0)| (CFOptions.GetCampaign() ? GI_CAMPAIGN : 0)); mission->SetFlags( flags ); } rc = 0; #ifdef DISABLE_NETWORK if ( flags & GI_NETWORK ) { cerr << "Error: " << PROGRAMNAME << " was compiled without networking support" << endl; rc = -1; delete mission; mission = NULL; } #endif } else { delete mission; mission = NULL; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Game::SwitchMap // DESCRIPTION: Dump the current map and move on to another one. // PARAMETERS : sequel - map file name (excluding path and suffix) // RETURNS : -1 on error, 0 otherwise //////////////////////////////////////////////////////////////////////// int Game::SwitchMap( const char *sequel ) { string mapname = get_levels_dir(); mapname.append( sequel ); mapname.append( ".lev" ); mwin->GetMapView()->Disable(); mwin->Draw(); mwin->Show(); unsigned char p1type = mission->GetPlayer(PLAYER_ONE).Type(); unsigned char p2type = mission->GetPlayer(PLAYER_TWO).Type(); unsigned char handicap = mission->GetHandicap(); // remove current game data delete shader; shader = NULL; delete mission; mission = NULL; // reset variables unit = NULL; // load new map int rc = Load( mapname.c_str() ); if ( !rc ) { mission->GetPlayer(PLAYER_ONE).SetType( p1type ); mission->GetPlayer(PLAYER_TWO).SetType( p2type ); mission->SetHandicap( handicap ); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Game::StartTurn // DESCRIPTION: Start a turn, i.e. draw the map to the display. // PARAMETERS : - // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status Game::StartTurn( void ) { GUI_Status rc = GUI_OK; MapView *mv = mwin->GetMapView(); Player &player = mission->GetPlayer(); // if music is already playing this will do nothing Audio::PlayMusic( mission->GetMusic() ? mission->GetMusic() : CF_MUSIC_DEFAULT ); view->SetFGPen( player.LightColor() ); // set player color scheme view->SetBGPen( player.DarkColor() ); if ( player.IsInteractive() ) { NoteWindow *nw; // show turn information and greeting dialog string turnmsg( MSG(MSG_TURN) ); turnmsg += ' '; turnmsg.append( StringUtil::tostring(mission->GetTurn()) ); nw = new NoteWindow( player.Name(), turnmsg, WIN_FONT_BIG|WIN_CENTER, view ); nw->EventLoop(); view->CloseWindow( nw ); // in email games set up or check player passwords if ( mission->GetFlags() & GI_PBEM ) { if ( !player.Password() ) { if ( !SetPlayerPassword( &player ) ) return GUI_RESTART; } else if ( !CheckPassword( player.Name(), MSG(MSG_ENTER_PASSWORD), player.Password(), 2 ) ) return GUI_RESTART; } } undo.Disable(); if ( mission->GetPhase() == TURN_START ) { // replay History *history = mission->GetHistory(); if ( history ) { if ( player.IsInteractive() ) history->Replay( mwin ); mission->SetHistory( NULL ); delete history; } // begin new turn if ( mission->GetOtherPlayer(player).IsHuman() ) { history = new History(); history->StartRecording( mission->GetUnits() ); mission->SetHistory( history ); } // check for victory conditions if ( mission->GetFlags() & GI_GAME_OVER ) return ShowDebriefing( player, true ); mission->SetPhase( TURN_IN_PROGRESS ); mv->SetCursorImage( IMG_CURSOR_IDLE ); } if ( !player.IsHuman() ) { CheckEvents(); AI ai( *mission ); ai.Play(); rc = EndTurn(); #ifndef DISABLE_NETWORK } else if ( player.IsRemote() ) { // show message while waiting NetworkProgressWindow *pw = new NetworkProgressWindow( view->Width() * 2 / 3, view->SmallFont()->Height() + 20, MSG(MSG_NET_WAITING), view ); DynBuffer *updates = peer->Receive( pw ); if ( updates ) { History remote; remote.Load( *updates, *mission ); CheckEvents(); Execute( remote ); } else { if ( pw->Cancelled() ) { // user aborted, so no error return GUI_RESTART; } else { HandleNetworkError(); return GUI_OK; } } view->CloseWindow( pw ); // make some noise so the local player know it's his turn now Audio::PlaySfx( Audio::SND_GUI_ASK, 0 ); rc = EndTurn(); #endif } else { mv->Enable(); mv->SetFlags( MV_DIRTY ); CheckEvents(); mv->UnsetFlags( MV_DIRTY ); // set the cursor to one of the player's units Point startcursor( 0, 0 ); for ( Unit *u = static_cast(mission->GetUnits().Head()); u; u = static_cast(u->Next()) ) { if ( u->Owner() == &player ) { startcursor = u->Position(); break; } } view->DisableUpdates(); mv->CenterOnHex( startcursor ); SetCursor( startcursor ); view->EnableUpdates(); view->Refresh(); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Game::SetPlayerPassword // DESCRIPTION: Set a password for a player in an email game. // PARAMETERS : player - player to set password for // RETURNS : TRUE if password successfully set, FALSE on error //////////////////////////////////////////////////////////////////////// bool Game::SetPlayerPassword( Player *player ) const { bool pw_ok = false; PasswordWindow *pwin; const char *pw, *msg1 = MSG(MSG_CHOOSE_PASSWORD); pwin = new PasswordWindow( player->Name(), msg1, player->Password(), false, view ); do { pwin->EventLoop(); pw = pwin->string->String(); // only accept if player has entered a password if ( pw ) { pwin->NewPassword( pw ); pwin->string->SetTitle( MSG(MSG_CONFIRM_PASSWORD) ); pwin->string->SetString( NULL ); pwin->Draw(); pwin->Show(); pwin->string->SetFocus(); if ( pwin->EventLoop() == GUI_RESTART ) break; pw_ok = pwin->PasswordOk(); if ( !pw_ok ) { Audio::PlaySfx( Audio::SND_GUI_ERROR, 0 ); pwin->NewPassword( NULL ); pwin->string->SetTitle( msg1 ); pwin->string->SetString( NULL ); pwin->Draw(); pwin->Show(); pwin->string->SetFocus(); } } else pwin->string->SetFocus(); } while ( !pw_ok ); player->SetPassword( pw ); view->CloseWindow( pwin ); return pw_ok; } //////////////////////////////////////////////////////////////////////// // NAME : Game::CheckPassword // DESCRIPTION: Request a password from the player and compare it to a // given string. // PARAMETERS : title - window title // msg - message // pw - password to check against // retry - number of retries if player enters a wrong // password // RETURNS : TRUE if pw and player's password match, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool Game::CheckPassword( const char *title, const char *msg, const char *pw, short retry ) const { PasswordWindow *pwin = new PasswordWindow( title, msg, pw, true, view ); bool pw_ok = false; do { if ( pwin->EventLoop() == GUI_RESTART ) break; pw_ok = pwin->PasswordOk(); if ( !pw_ok ) { Audio::PlaySfx( Audio::SND_GUI_ERROR, 0 ); if ( retry ) { pwin->string->SetString( NULL, true ); pwin->string->SetFocus(); } } } while ( (--retry >= 0) && !pw_ok ); view->CloseWindow( pwin ); return pw_ok; } //////////////////////////////////////////////////////////////////////// // NAME : Game::CheckEvents // DESCRIPTION: Check for pending game events. // PARAMETERS : - // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status Game::CheckEvents( void ) { Event *e = static_cast( mission->GetEvents().Head() ), *e2; while ( e ) { e2 = static_cast( e->Next() ); if ( e->Discarded() ) { e->Remove(); delete e; } else if ( e->Check() ) { // event will be executed and can be taken out of the queue e->Remove(); e->Execute( view ); delete e; // after events have been triggered, undo is no longer allowed undo.Disable(); } e = e2; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : Game::ExecPreStartEvents // DESCRIPTION: This method is called before the very first turn. It is // used to execute initial ETRIGGER_HANDICAP events without // affecting the turn history (this means e.g. that units // created due to handicaps to not appear in turn replays). // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::ExecPreStartEvents( void ) { if ( (mission->GetTime() == 0) && (mission->GetPhase() == TURN_START) ) { Event *e = static_cast( mission->GetEvents().Head() ), *e2; while ( e ) { e2 = static_cast( e->Next() ); if ( (e->Trigger() == ETRIGGER_HANDICAP) && e->Check() ) { e->Remove(); e->Execute( view ); delete e; } e = e2; } } } //////////////////////////////////////////////////////////////////////// // NAME : Game::HaveWinner // DESCRIPTION: Check whether one of the players has won completed his // mission. Notify players and quit the current game if so. // PARAMETERS : - // RETURNS : true if mission is completed by any player AND both // players have been informed so, false otherwise //////////////////////////////////////////////////////////////////////// bool Game::HaveWinner( void ) { bool quit = false; if ( (mission->GetPlayer(PLAYER_ONE).Success( 0 ) >= 100) || (mission->GetPlayer(PLAYER_TWO).Success( 0 ) >= 100) ) { mission->SetFlags( mission->GetFlags()|GI_GAME_OVER ); Player &p = mission->GetPlayer(); quit = !mission->GetOtherPlayer(p).IsHuman(); if ( ShowDebriefing( p, quit ) != GUI_OK ) quit = true; } return quit; } //////////////////////////////////////////////////////////////////////// // NAME : Game::EndTurn // DESCRIPTION: End turn for the current player. Execute combat orders // and prepare everything for the next player. // PARAMETERS : - // RETURNS : GUI_Status (GUI_QUIT if mission is complete) //////////////////////////////////////////////////////////////////////// GUI_Status Game::EndTurn( void ) { GUI_Status rc = GUI_OK; List &battles = mission->GetBattles(); if ( unit ) DeselectUnit(); mwin->GetMapView()->DisableCursor(); mwin->GetPanel()->Update(NULL); // calculate combat modifiers Combat *com = static_cast( battles.Head() ); while ( com ) { com->CalcModifiers( mission->GetMap() ); com = static_cast( com->Next() ); } // execute combat orders while ( !battles.IsEmpty() ) { Combat *com = static_cast(battles.RemHead()); ResolveBattle( com ); delete com; } // destroyed units may have triggered events... rc = CheckEvents(); // check for mission completion if ( !HaveWinner() ) { // set new player Player &p = mission->NextPlayer(); if ( p.ID() == PLAYER_ONE ) mission->NextTurn(); mission->SetPhase( TURN_START ); // remove all destroyed units from the list, // restore movement points, reset status Unit *next, *u = static_cast(mission->GetUnits().Head()); while ( u ) { next = static_cast(u->Next()); if ( !u->IsAlive() ) { u->Remove(); delete u; } else if ( u->Owner() != &p ) { u->UnsetFlags( U_MOVED|U_ATTACKED|U_DONE|U_BUSY ); } u = next; } // produce crystals in mines Building *b = static_cast(mission->GetShops().Head()); while ( b ) { if ( (b->Owner() == &p) && b->IsMine() ) b->SetCrystals( b->Crystals() + b->CrystalProduction() ); b = static_cast(b->Next()); } // check if we're playing an email game. if so, save and exit if ( mission->GetFlags() & GI_PBEM ) { string filebuf( get_save_dir() ); filebuf.append( last_file_name ); filebuf.append( ".sav" ); int err = Save( filebuf.c_str() ); if ( err ) { NoteWindow *nw = new NoteWindow( MSG(MSG_ERROR), MSG(MSG_ERR_SAVE), WIN_CLOSE_ESC, view ); nw->SetButtonID( 0, GUI_RESTART ); } } else { #ifndef DISABLE_NETWORK if ( p.IsRemote() ) { // send data to peer History *history = mission->GetHistory(); if ( history ) { DynBuffer buf; history->Save( buf, true ); if ( !peer->Send( buf ) ) { HandleNetworkError(); return GUI_OK; } } else { cerr << "Error: No history available in network game" << endl; return GUI_ERROR; } } #endif mwin->GetMapView()->Disable(); mwin->Draw(); mwin->Show(); rc = StartTurn(); } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Game::ResolveBattle // DESCRIPTION: Calculate and display battle outcomes for all clashes // queued. // PARAMETERS : com - battle to resolve // result - optional precalculated battle results (hits // scored by attacker/defender, NULL to calculate) // // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// void Game::ResolveBattle( Combat *com, const Point *result /* = NULL */ ) { Unit *att = com->GetAttacker(); Unit *def = com->GetDefender(); if ( !att->IsAlive() || !def->IsAlive() ) return; // calculate modifiers for combat Map &map = mission->GetMap(); History *hist = mission->GetHistory(); CombatWindow *cwin = NULL; if ( mission->GetPlayer().IsInteractive() ) cwin = new CombatWindow( com, mwin, view ); Point apos( att->Position() ), dpos( def->Position() ); Point hits; if ( result == NULL ) hits = com->CalcResults(); else hits = com->CalcResults( result->x, result->y ); // record as a combat event if ( hist && !att->IsDummy() ) hist->RecordCombatEvent( *com, hits.y, hits.x ); if ( !att->IsAlive() ) map.SetUnit( NULL, apos ); if ( !def->IsAlive() ) map.SetUnit( NULL, dpos ); if ( cwin ) { cwin->Draw(); cwin->Show(); cwin->EventLoop(); view->CloseWindow( cwin ); } } //////////////////////////////////////////////////////////////////////// // NAME : Game::SetCursor // DESCRIPTION: Set the cursor to a new hex on the map. Contrary to the // low-level function in MapView this updates the display // at the old and new position if necessary. // PARAMETERS : cursor - new cursor position // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::SetCursor( const Point &cursor ) const { MapView *mv = mwin->GetMapView(); MapObject *mobj = NULL; Unit *u; Rect upd; Player *player = &mission->GetPlayer(); Map *map = &mission->GetMap(); if ( mv->CursorEnabled() ) { Point old = mv->Cursor(); upd = mv->SetCursor( Point(-1,-1) ); // disable cursor for hex update mwin->Show( upd ); // update previous cursor position if ( player->Mode() == MODE_IDLE ) { // if we had highlighted a unit's target we need to remove that mark const Point *target; u = map->GetUnit( old ); if ( u && (u->Owner() == player) && (target = u->Target()) ) { upd = mv->UpdateHex( *target ); mwin->Show( upd ); } } else if ( player->Mode() == MODE_BUSY ) mv->SetCursorImage( IMG_CURSOR_SELECT ); } if ( cursor.x != -1 ) { u = map->GetUnit( cursor ); if ( u ) { if ( u->Owner() != player ) { if ( (player->Mode() == MODE_BUSY) && unit->CanHit( u ) ) mv->SetCursorImage( IMG_CURSOR_ATTACK ); } else if ( player->Mode() == MODE_IDLE ) { // if it's a unit of the active player, highlight its target if it has one const Point *target = u->Target(); if ( target ) { Point p = mv->Hex2Pixel( *target ); mv->DrawTerrain( IMG_CURSOR_HIGHLIGHT, mwin, p.x, p.y, *mwin); mwin->Show( Rect(p.x, p.y, mv->TileWidth(), mv->TileHeight()) ); } } } mobj = map->GetMapObject( cursor ); } upd = mv->SetCursor( cursor ); mwin->GetPanel()->Update( mobj ); mwin->Show( upd ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::MoveUnit // DESCRIPTION: Move a unit to another hex. // PARAMETERS : u - unit to be moved // hx - destination hex x // hy - destination hex y // RETURNS : the unit if it's still available, or NULL if it // cannot be selected this turn (read: deselect it) //////////////////////////////////////////////////////////////////////// Unit *Game::MoveUnit( Unit *u, const Point &dest ) { if ( u->Position() != dest ) { MapView *mv = mwin->GetMapView(); Map *map = mv->GetMap(); const Point &pos = u->Position(); if ( mission->GetPlayer().IsHuman() ) { if ( shader->GetStep(dest) == -1 ) return u; // if we're moving a transport out of a shop/transport check // whether the player wants to take other units with him if ( u->IsTransport() && u->IsSheltered() ) { MapObject *pobj = map->GetMapObject( pos ); UnitContainer *parent; if ( pobj->IsUnit() ) parent = static_cast(pobj); else parent = static_cast(pobj); UnitLoadWindow *ulw = new UnitLoadWindow( *static_cast(u), *parent, *map->GetUnitSet(), *map->GetTerrainSet(), mission->GetHistory(), view ); bool aborted = false; if ( ulw->Opened() ) aborted = (ulw->EventLoop() == GUI_CLOSE); view->CloseWindow( ulw ); if ( aborted ) { DeselectUnit(); ContainerContent( parent ); return u; } } } Path path( map ); if ( path.Find( u, pos, dest ) == -1 ) { cerr << "Internal error: FindPath() failed!" << endl; return u; } SoundEffect *sfx = u->MoveSound(); if ( sfx ) sfx->Play( Audio::SFX_LOOP ); undo.Register( u ); RemoveUnit( u ); short step, n = 0; while ( (step = path.GetStep( u->Position() )) != -1) { MoveUnit( u, (Direction)step, (n < 2) ); ++n; } if ( sfx ) sfx->Stop(); EndMovement( u ); mwin->Show( mv->UpdateHex( u->Position() ) ); if ( !u->IsReady() ) { if ( u == unit ) DeselectUnit(); CheckEvents(); return NULL; } shader->ShadeMap( u ); if ( mv->CursorEnabled() ) mwin->GetPanel()->Update( u ); mwin->Draw(); mwin->Show(); CheckEvents(); } return u; } //////////////////////////////////////////////////////////////////////// // NAME : Game::MoveUnit // DESCRIPTION: Move a unit one hex in a given direction. // PARAMETERS : u - unit to be moved // dir - direction // blink - if TRUE make target cursor blink (default is // FALSE) // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Game::MoveUnit( Unit *u, Direction dir, bool blink /* = false */ ) { MapView *mv = mwin->GetMapView(); Map *map = mv->GetMap(); const Point &pos = u->Position(); Point posnew; if ( map->Dir2Hex( pos, dir, posnew ) ) return -1; u->Face( dir ); if ( mv->Enabled() && (mv->HexVisible(pos) || mv->HexVisible(posnew)) ) mwin->MoveHex( u->Image(), mission->GetUnitSet(), pos, posnew, ANIM_SPEED_UNIT, blink ); u->SetPosition( posnew.x, posnew.y ); if ( !u->IsDummy() ) { History *h = mission->GetHistory(); if ( h ) h->RecordMoveEvent( *u, dir ); } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Game::EndMovement // DESCRIPTION: Finalize a unit move. // PARAMETERS : u - unit to be moved // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::EndMovement( Unit *u ) const { Map &map = mission->GetMap(); u->SetFlags( U_MOVED ); const Point &pos = u->Position(); short oldhex = map.HexTypeID( pos ); int conquer = map.SetUnit( u, pos ); if ( conquer == 1 ) { // a building was conquered History *h = mission->GetHistory(); if ( h ) h->RecordTileEvent( map.HexTypeID( pos ), oldhex, pos.x, pos.y ); } if ( u->IsSlow() || !UnitTargets( u ) ) u->SetFlags( U_DONE ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::RemoveUnit // DESCRIPTION: Remove a unit from the map. // PARAMETERS : u - unit to be removed // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::RemoveUnit( Unit *u ) { Map &map = mission->GetMap(); if ( !u->IsSheltered() ) { map.SetUnit( NULL, u->Position() ); mwin->GetMapView()->UpdateHex( u->Position() ); } else { MapObject *o = map.GetMapObject( u->Position() ); if ( o ) { if ( o->IsUnit() ) static_cast( o )->RemoveUnit( u ); else static_cast(o)->RemoveUnit( u ); } } } //////////////////////////////////////////////////////////////////////// // NAME : Game::UnitTargets // DESCRIPTION: Find out whether the unit still has things to do, i.e. // enemies in range, mines to clear etc. // PARAMETERS : u - unit to check for // RETURNS : TRUE if there are options left, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool Game::UnitTargets( Unit *u ) const { bool rc = false; Unit *tg = static_cast( mission->GetUnits().Head() ); while ( tg && !rc ) { rc = u->CanHit( tg ); tg = static_cast( tg->Next() ); } if ( !rc ) rc = MinesweeperTargets( u ); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Game::MinesweeperTargets // DESCRIPTION: If the unit is a minesweeper check if there are any // mines to be cleared. // PARAMETERS : u - unit to check for // RETURNS : TRUE if there are options left, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool Game::MinesweeperTargets( Unit *u ) const { bool rc = false; if ( u->IsMinesweeper() && u->IsReady() ) { Map *map = &mission->GetMap(); Point adj[6]; map->GetNeighbors( u->Position(), adj ); for ( int i = NORTH; (i <= NORTHWEST) && !rc; ++i ) { if ( adj[i].x != -1 ) { Unit *m = map->GetUnit( adj[i] ); if ( m && m->IsMine() ) { // you can only remove an enemy mine if no other enemy unit // sits next to it rc = true; if ( m->Owner() != u->Owner() ) { Point madj[6]; map->GetNeighbors( m->Position(), madj ); for ( int j = NORTH; (j <= NORTHWEST) && rc; ++j ) { if ( madj[j].x != -1 ) { Unit *e = map->GetUnit( madj[j] ); if ( e && (e->Owner() != u->Owner()) && !e->IsMine() ) rc = false; } } } } } } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Game::SelectUnit // DESCRIPTION: Select a unit to move/attack. // PARAMETERS : u - unit to be selected // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::SelectUnit( Unit *u ) { if ( u->IsReady() ) { MapView *mv = mwin->GetMapView(); if ( unit ) DeselectUnit( false ); unit = u; mission->GetPlayer().SetMode( MODE_BUSY ); if ( mv->Enabled() ) { Audio::PlaySfx( Audio::SND_GAM_SELECT, 0 ); mv->EnableFog(); shader->ShadeMap( unit ); mwin->Draw(); mwin->Show(); mv->SetCursorImage( IMG_CURSOR_SELECT ); SetCursor( u->Position() ); } } } //////////////////////////////////////////////////////////////////////// // NAME : Game::DeselectUnit // DESCRIPTION: Deselect the currently active unit. // PARAMETERS : update - whether to update the display or not (default // value is "true") // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::DeselectUnit( bool display /* = true */ ) { MapView *mv = mwin->GetMapView(); mission->GetPlayer().SetMode( MODE_IDLE ); if ( mv->Enabled() ) { mv->SetCursorImage( IMG_CURSOR_IDLE ); mv->DisableFog(); if ( display ) { mwin->Draw(); mwin->Show(); SetCursor( unit->Position() ); } } unit = NULL; } //////////////////////////////////////////////////////////////////////// // NAME : Game::SelectNextUnit // DESCRIPTION: Select the current player's next available unit. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::SelectNextUnit( void ) { List &units = mission->GetUnits(); Unit *start, *u; if ( unit ) start = unit; else start = static_cast( units.Head() ); u = static_cast( units.NextNode(start) ); while ( u && (u != start) ) { if ( (u->Owner() == &mission->GetPlayer()) && u->IsReady() && !u->IsSheltered() ) { // we ignore SHELTERED units because it wouldn't be obvious which // of the units inside the transport was selected SelectUnit( u ); break; } u = static_cast( units.NextNode(u) ); } } //////////////////////////////////////////////////////////////////////// // NAME : Game::EnterSpecialMode // DESCRIPTION: Activate one of the special game modes (for pioneers, // mine-sweepers, or depot builders) // PARAMETERS : mode - mode to enter (see player.h for definitions) // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::EnterSpecialMode( unsigned char mode ) { MapView *mv = mwin->GetMapView(); mission->GetPlayer().SetMode( mode ); if ( mv->Enabled() ) { MinesweeperShader mss( &mission->GetMap(), mission->GetUnits(), mv->GetFogBuffer() ); mv->EnableFog(); mss.ShadeMap( unit ); mwin->Draw(); mwin->Show(); mv->SetCursorImage( IMG_CURSOR_SPECIAL ); SetCursor( unit->Position() ); } } //////////////////////////////////////////////////////////////////////// // NAME : Game::ClearMine // DESCRIPTION: Try to move a mine from the map into an adjacent mine // sweeper unit. // PARAMETERS : sweeper - mine sweeper unit (currently selected unit) // mine - mine to be cleared // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::ClearMine( Transport *sweeper, Unit *mine ) { const Point &spos = sweeper->Position(); bool allow; if ( mine->Owner() != sweeper->Owner() ) { Player *mowner = mine->Owner(); mine->SetOwner( sweeper->Owner() ); allow = sweeper->Allow( mine ); if ( !allow ) mine->SetOwner( mowner ); } else allow = sweeper->Allow( mine ); if ( allow ) { MoveUnit( mine, spos ); if ( !MinesweeperTargets(sweeper) ) { sweeper->SetFlags( U_DONE ); DeselectUnit(); } undo.Disable(); } else new NoteWindow( MSG(MSG_ERROR), MSG(MSG_ERR_SWEEPER_FULL), WIN_CLOSE_ESC, view ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::Undo // DESCRIPTION: Undo the last move command the player issued. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::Undo( void ) { if ( unit ) DeselectUnit(); Map &map = mission->GetMap(); Unit *u = undo.GetUnit(); RemoveUnit( u ); u->Face( undo.GetDirection() ); u->UnsetFlags( U_DONE|U_MOVED ); // if the unit is a transport and came out of another // container we also need to reset the carried units' flags if ( u->IsTransport() && map.GetMapObject( undo.GetPosition() ) ) { Transport *t = static_cast(u); for ( int i = 0; i < t->UnitCount(); ++i ) t->GetUnit( i )->UnsetFlags( U_DONE|U_MOVED ); } map.SetUnit( u, undo.GetPosition() ); mwin->GetMapView()->UpdateHex( undo.GetPosition() ); mwin->Show(); if ( mission->GetHistory() ) mission->GetHistory()->UndoMove( *u ); undo.Disable(); } //////////////////////////////////////////////////////////////////////// // NAME : Game::HandleEvent // DESCRIPTION: Handle key and mouse button events special to the map // window. // PARAMETERS : event - event received by the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status Game::HandleEvent( const SDL_Event &event ) { GUI_Status rc = GUI_OK; MapView *mv = mwin->GetMapView(); Map &map = mission->GetMap(); // check for keyboard commands if ( event.type == SDL_KEYDOWN ) { // some SDL ports return illegal key values short key = event.key.keysym.sym & 0x1ff; const SDLKey *keymap = CFOptions.GetKeyBindings(); // map user- and locale-defined keys to standard ones if ((key > SDLK_FIRST) && (key < SDLK_LAST)) { // KEYBIND_MINIMIZE is a global binding that is not specific // to the Game class, so it isn't handled here // user-defined keys first for ( int i = 0; i < KEYBIND_COUNT; ++i ) { if ( key == keymap[i] ) { key = -i; break; } } // now check locale-defined keys if ( key >= 0 ) { if ( key == keys[G_KEY_INFO] ) key = -KEYBIND_UNIT_INFO; else if ( key == keys[G_KEY_CONTENT] ) key = -KEYBIND_UNIT_CONTENT; else if ( key == keys[G_KEY_SWEEP] ) key = -KEYBIND_UNIT_SWEEP; else if ( key == keys[G_KEY_END_TURN] ) key = -KEYBIND_END_TURN; else if ( key == keys[G_KEY_MAP] ) key = -KEYBIND_SHOW_MAP; } } switch ( key ) { case SDLK_KP1: case SDLK_KP2: case SDLK_KP3: case SDLK_KP4: case SDLK_KP6: case SDLK_KP7: case SDLK_KP8: case SDLK_KP9: if ( !(event.key.keysym.mod & KMOD_NUM) ) { ScrollCommand( key ); break; } // fall through case SDLK_LEFT: case SDLK_RIGHT: case SDLK_UP: case SDLK_DOWN: MoveCommand( key ); break; case SDLK_ESCAPE: if ( unit ) { DeselectUnit(); break; } GameMenu(); break; // the keys for the following commands can be modified by // user and/or locale, so we use fixed (negative so we don't // collide with regular keysyms) values which get mapped // before the switch statement case -KEYBIND_END_TURN: rc = EndTurn(); break; case -KEYBIND_SHOW_MAP: new TacticalWindow( mv, *mission, view ); break; case -KEYBIND_GAME_MENU: GameMenu(); break; case -KEYBIND_UNIT_MENU: { Unit *u = map.GetUnit( mv->Cursor() ); if ( u ) UnitMenu( u ); } break; case -KEYBIND_UNIT_CONTENT: { MapObject *mo = map.GetMapObject( mv->Cursor() ); if ( mo ) { if ( mo->IsShop() ) ContainerContent( static_cast( static_cast(mo)) ); else if ( static_cast(mo)->IsTransport() ) ContainerContent( static_cast( static_cast(mo)) ); }} break; case -KEYBIND_UNIT_INFO: { Unit *u = map.GetUnit( mv->Cursor() ); if ( u ) UnitInfo( u ); } break; case -KEYBIND_UNIT_NEXT: SelectNextUnit(); break; case -KEYBIND_UNIT_SELECT: // select the unit underneath the cursor SelectCommand( mv->Cursor() ); break; case -KEYBIND_UNIT_UNDO: if ( undo.GetUnit() != NULL) Undo(); break; case -KEYBIND_UNIT_SWEEP: if ( unit && MinesweeperTargets( unit ) ) EnterSpecialMode( MODE_SWEEP ); break; default: if ( key == keys[G_KEY_QUIT] ) Quit(); break; } } else if ( event.type == SDL_MOUSEBUTTONDOWN ) { Point pos; if ( event.button.button == SDL_BUTTON_LEFT ) { if ( !mv->Pixel2Hex( event.button.x - mwin->x, event.button.y - mwin->y, pos ) ) { HandleLMB( pos ); } } else if ( !mv->Pixel2Hex( event.button.x - mwin->x, event.button.y - mwin->y, pos ) ) { Unit *u = map.GetUnit( pos ); if ( event.button.button == SDL_BUTTON_RIGHT ) { if ( u ) UnitMenu( u ); else GameMenu(); } else { // middle mouse button if ( u ) { if ( u->IsTransport() ) ContainerContent( static_cast(u) ); } else if ( map.GetBuilding( pos ) ) ContainerContent( map.GetBuilding( pos ) ); } } else GameMenu(); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Game::MoveCommand // DESCRIPTION: Got a move command from the user. See what he wants to // do. Move the cursor or a selected unit. // PARAMETERS : key - the key code used to give the order // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::MoveCommand( int key ) { Direction dir; switch ( key ) { case SDLK_KP1: dir = SOUTHWEST; break; case SDLK_DOWN: case SDLK_KP2: dir = SOUTH; break; case SDLK_KP3: dir = SOUTHEAST; break; case SDLK_KP7: dir = NORTHWEST; break; case SDLK_UP: case SDLK_KP8: dir = NORTH; break; case SDLK_KP9: dir = NORTHEAST; break; case SDLK_LEFT: case SDLK_KP4: dir = WEST; break; case SDLK_RIGHT: case SDLK_KP6: dir = EAST; break; default: return; } Point cursor = mwin->MoveCursor( dir ); if ( cursor != mwin->GetMapView()->Cursor() ) SetCursor( cursor ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::SelectCommand // DESCRIPTION: Got a select command from the user. See what he wants to // do. Select/deselect a unit, enter a building, or attack // an enemy unit. // PARAMETERS : hex - selected hex // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::SelectCommand( const Point &hex ) { MapView *mv = mwin->GetMapView(); Map *map = mv->GetMap(); Point cursor = mv->Cursor(); Player &p = mission->GetPlayer(); Unit *u = map->GetUnit( hex ); switch ( p.Mode() ) { case MODE_BUSY: if ( unit->Position() == hex ) DeselectUnit(); else if ( u ) { if ( u->Owner() == &p ) { if ( shader->GetStep(hex) != -1 ) MoveUnit( unit, hex ); // try to move into transport else SelectUnit( u ); } else if ( unit->CanHit( u ) ) { // attack the unit mission->RegisterBattle( unit, u ); DeselectUnit(); mwin->FlashUnit( u->Position(), 2 ); undo.Disable(); } } else MoveUnit( unit, hex ); // try to move there break; case MODE_IDLE: if ( u && (u->Owner() == &p) ) SelectUnit( u ); else { Building *b; if ( map->IsShop( hex ) && (b = map->GetBuilding( hex )) ) ContainerContent( b ); } break; case MODE_SWEEP: if ( (shader->GetStep( hex ) != -1) && (cursor != unit->Position()) ) ClearMine( static_cast(unit), u ); else DeselectUnit(); } } //////////////////////////////////////////////////////////////////////// // NAME : Game::ScrollCommand // DESCRIPTION: Scroll the map display in the given direction. // PARAMETERS : key - the key code used to give the order // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::ScrollCommand( int key ) { MapView *mv = mwin->GetMapView(); Point pos = mv->Cursor(); int sw = mv->Width() * 3 / 4 / mv->TileWidth(); int sh = mv->Height() * 3 / 4 / mv->TileHeight(); switch ( key ) { case SDLK_KP1: pos.x -= sw; pos.y += sh; break; case SDLK_KP2: pos.y += sh; break; case SDLK_KP3: pos.x += sw; pos.y += sh; break; case SDLK_KP4: pos.x -= sw; break; case SDLK_KP6: pos.x += sw; break; case SDLK_KP7: pos.x -= sw; pos.y -= sh; break; case SDLK_KP8: pos.y -= sh; break; case SDLK_KP9: pos.x += sw; pos.y -= sh; break; default: return; } const Map *map = mv->GetMap(); if ( pos.x < 0 ) pos.x = 0; else if ( pos.x >= map->Width() ) pos.x = map->Width() - 1; if ( pos.y < 0 ) pos.y = 0; else if ( pos.y >= map->Height() ) pos.y = map->Height() - 1; SetCursor( pos ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::HandleLMB // DESCRIPTION: React to user pressing the left mouse button. // PARAMETERS : hex - hex the user clicked on // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::HandleLMB( const Point &hex ) { bool move = (hex != mwin->GetMapView()->Cursor()); Unit *u = mission->GetMap().GetUnit( hex ); // activate selection if the user // - clicked the same hex twice or // - clicked one of her own units and has currently no unit selected if ( !move || (u && !unit && (u->Owner() == &mission->GetPlayer()) && u->IsReady()) ) SelectCommand( hex ); else if ( move ) SetCursor( hex ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::ContainerContent // DESCRIPTION: Open a window to display the content of a transport or // building. // PARAMETERS : c - container to look into // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::ContainerContent( UnitContainer *c ) { MapObject *mo = dynamic_cast(c); if ( unit ) DeselectUnit(); if ( (mo->Owner() == &mission->GetPlayer()) || !mo->Owner() ) new ContainerWindow( c, view ); else new NoteWindow( mo->Name(), MSG(MSG_ERR_NO_ACCESS), WIN_CLOSE_ESC, view ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::UnitInfo // DESCRIPTION: Display a window with information about a unit. If the // current player is not authorised to peek at the unit // specifications (e.g. because it's a hostile unit) the // information request will fail. // PARAMETERS : unit - unit to show information about // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::UnitInfo( Unit *unit ) { if ( unit->Owner() == &mission->GetPlayer() ) new UnitInfoWindow( unit->Type()->ID(), mission->GetMap(), view ); else new NoteWindow( unit->Name(), MSG(MSG_ERR_NO_ACCESS), WIN_CLOSE_ESC, view ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::ShowLevelInfo // DESCRIPTION: Display level information supplied by the creator, if // any. If no info was supplied, say so. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::ShowLevelInfo( void ) const { const char *msg = mission->GetInfoMsg(); if ( !msg ) msg = MSG(MSG_ERR_NO_LVL_INFO); new NoteWindow( MSG(MSG_LVL_INFO), msg, WIN_CLOSE_ESC, view ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::ShowBriefing // DESCRIPTION: Display a window with the mission objectives for the // current player. If the mission creator did not supply a // briefing, pop up an error. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::ShowBriefing( void ) const { Player &p = mission->GetPlayer(); if ( p.Briefing() != -1 ) new MessageWindow( p.Name(), mission->GetMessage(p.Briefing()), view ); else new NoteWindow( p.Name(), MSG(MSG_ERR_NO_BRIEFING), WIN_CLOSE_ESC, view ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::ShowDebriefing // DESCRIPTION: When the mission is over, display a message telling // the players whether they won or lost and optionally // return to the main menu. // PARAMETERS : player - player to show debriefing for // restart - whether to return to the main menu or load // the next map // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status Game::ShowDebriefing( Player &player, bool restart ) { GUI_Status rc = GUI_OK; if ( player.IsInteractive() ) { Player *winner = NULL; bool draw = false; const char *msg; Player &p1 = mission->GetPlayer(PLAYER_ONE); Player &p2 = mission->GetPlayer(PLAYER_TWO); if ( p1.Success( 0 ) >= 100 ) winner = &p1; if ( p2.Success( 0 ) >= 100 ) { if ( winner ) draw = true; else winner = &p2; } if ( draw ) msg = MSG(MSG_RESULT_DRAW); else if ( &player == winner ) msg = MSG(MSG_RESULT_VICTORY); else msg = MSG(MSG_RESULT_DEFEAT); NoteWindow *note = new NoteWindow( MSG(MSG_DEBRIEFING), msg, WIN_CENTER, view ); if ( restart ) { const char *next_map = NULL; if ( mission->GetFlags() & GI_CAMPAIGN ) next_map = mission->GetSequel(); if ( !next_map || draw || !winner->IsHuman() ) { note->SetButtonID( 0, G_BUTTON_SHUTDOWN ); note->SetButtonHook( 0, this ); } else { note->EventLoop(); view->CloseWindow( note ); CFOptions.Unlock( next_map ); int err = SwitchMap( next_map ); if ( err == -1 ) { note = new NoteWindow( MSG(MSG_ERROR), MSG(MSG_ERR_MAP_NOT_FOUND), 0, view ); note->SetButtonID( 0, G_BUTTON_SHUTDOWN ); note->SetButtonHook( 0, this ); } else { InitWindows(); rc = StartTurn(); } } } else { note->EventLoop(); view->CloseWindow( note ); } } else if ( restart ) rc = GUI_RESTART; return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Game::Execute // DESCRIPTION: Execute the events from a recorded turn history session. // In contrast to History::Replay() which only creates fake // actions for display, this function directly affects the // current state of the game, ie. all actions are treated // exactly as if they had been triggered by the current // player. // PARAMETERS : history - recorded session to execute // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::Execute( const History &history ) { const List &events = history.GetEvents(); // many event types can simply be ignored; // all we care for is movement, attacks, plus (user-triggered) // unit construction and repairs HistEvent *he = static_cast( events.Head() ); while ( he ) { Unit *u, *u2; if ( he->type == History::HIST_MOVE ) { u = mission->GetUnit( he->data[0] ); if ( u ) { RemoveUnit( u ); do { MoveUnit( u, (Direction)he->data[1] ); he = static_cast( he->Next() ); } while ( he && he->type == History::HIST_MOVE && he->data[0] == u->ID() ); EndMovement( u ); CheckEvents(); continue; } } else if ( he->type == History::HIST_UNIT ) { switch ( he->data[1] ) { case History::HIST_UEVENT_CREATE: u = history.GetDummy( he->data[0] ); u2 = mission->GetUnit( he->data[0] ); // units can be created by players (in factories) or by events. // we only want to execute those triggered by players, since we'd // otherwise create units twice. a cleaner solution would be // to clearly indicate for each event who/what caused it, but this // little hack does its job as well: don't build the unit if // another unit with the same ID already exists if ( u && !u2 ) { mission->CreateUnit( u->Type()->ID(), *u->Owner(), u->Position(), (Direction)u->Facing(), u->GroupSize(), u->XP() ); CheckEvents(); } break; case History::HIST_UEVENT_REPAIR: u = mission->GetUnit( he->data[0] ); if ( u ) { UnitContainer *uc = dynamic_cast (mission->GetMap().GetMapObject( u->Position() )); if ( uc ) uc->SetCrystals( uc->Crystals() - CRYSTALS_REPAIR ); if ( mission->GetHistory() ) mission->GetHistory()->RecordUnitEvent( *u, History::HIST_UEVENT_REPAIR ); u->Repair(); } break; default: // ignore break; } } else if ( he->type == History::HIST_ATTACK ) { u = mission->GetUnit( he->data[0] ); u2 = mission->GetMap().GetUnit( Point( he->data[1], he->data[2] ) ); if ( u && u2 ) mission->RegisterBattle( u, u2 ); } else if ( he->type == History::HIST_COMBAT ) { u = mission->GetUnit( he->data[0] ); u2 = mission->GetUnit( he->data[1] ); if ( u && u2 ) { Combat cmb( u, u2 ); Point casualties( he->data[3], he->data[2] ); ResolveBattle( &cmb, &casualties ); CheckEvents(); } } else if ( he->type == History::HIST_TRANSPORT_CRYSTALS ) { u = mission->GetUnit( he->data[0] ); if ( u ) { UnitContainer *uc = dynamic_cast (mission->GetMap().GetMapObject( u->Position() )); if ( uc ) { Transport *t = static_cast( u ); uc->SetCrystals( uc->Crystals() - he->data[1] ); u2->SetFlags( U_MOVED|U_DONE ); t->SetCrystals( t->Crystals() + he->data[1] ); } } } else if ( he->type == History::HIST_TRANSPORT_UNIT ) { u = mission->GetUnit( he->data[0] ); u2 = mission->GetUnit( he->data[1] ); if ( u && u2 ) { UnitContainer *uc = dynamic_cast (mission->GetMap().GetMapObject( u->Position() )); if ( uc ) { Transport *t = static_cast( u ); uc->RemoveUnit( u2 ); t->InsertUnit( u2 ); } } } he = static_cast( he->Next() ); } // make sure the battles are not rerun at EndTurn() mission->GetBattles().Clear(); } //////////////////////////////////////////////////////////////////////// // NAME : Game::GameMenu // DESCRIPTION: Pop up a MenuWindow with general game options like // "End Turn" or "Quit". // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::GameMenu( void ) { MenuWindow *menu = new MenuWindow( PROGRAMNAME, this, view ); menu->AddItem( 0, G_BUTTON_END_TURN, 0, MSG(MSG_B_END_TURN) ); menu->AddItem( 0, G_BUTTON_MAP, 0, MSG(MSG_B_MAP) ); menu->AddItem( 0, G_BUTTON_BRIEFING, 0, MSG(MSG_B_OBJECTIVES) ); menu->AddBar( 0 ); menu->AddItem( 0, G_BUTTON_LEV_INFO, 0, MSG(MSG_B_LEVEL_INFO) ); menu->AddMenu( 0, 0, MSG(MSG_B_OPTIONS) ); menu->AddItem( 1, G_BUTTON_GENERAL_OPTIONS, 0, MSG(MSG_B_OPT_GENERAL) ); menu->AddItem( 1, G_BUTTON_LANGUAGE_OPTIONS, 0, MSG(MSG_B_OPT_LANGUAGE) ); menu->AddItem( 1, G_BUTTON_VIDEO_OPTIONS, 0, MSG(MSG_B_OPT_VIDEO) ); #ifndef DISABLE_SOUND menu->AddItem( 1, G_BUTTON_SOUND_OPTIONS, 0, MSG(MSG_B_OPT_AUDIO) ); #endif menu->AddItem( 1, G_BUTTON_KEYBOARD_OPTIONS, 0, MSG(MSG_B_OPT_KEYBOARD) ); menu->AddBar( 0 ); menu->AddItem( 0, G_BUTTON_SAVE, mission->GetFlags() & GI_PBEM ? WIDGET_DISABLED : 0, MSG(MSG_B_SAVE_GAME) ); if (view->IsFullScreen()) menu->AddItem( 0, G_BUTTON_MINIMIZE_WINDOW, 0, MSG(MSG_OPT_KEY_MINIMIZE) ); menu->AddItem( 0, G_BUTTON_ABORT, 0, MSG(MSG_B_MAIN_MENU) ); menu->AddItem( 0, G_BUTTON_QUIT, 0, MSG(MSG_B_QUIT) ); menu->Layout(); } //////////////////////////////////////////////////////////////////////// // NAME : Game::UnitMenu // DESCRIPTION: Pop up a MenuWindow with possible actions for a selected // unit. // PARAMETERS : u - unit to open window for // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::UnitMenu( Unit *u ) { if ( (u->Owner() == &mission->GetPlayer()) && (u->IsTransport() || u->IsMinesweeper() || (undo.GetUnit() == u)) ) { MenuWindow *menu = new MenuWindow( u->Name(), this, view ); menu->AddItem( 0, G_BUTTON_UNIT_INFO, 0, MSG(MSG_B_UNIT_INFO) ); if ( u->IsTransport() ) menu->AddItem( 0, G_BUTTON_UNIT_CONTENT, 0, MSG(MSG_B_UNIT_CONTENT) ); if ( u->IsMinesweeper() ) menu->AddItem( 0, G_BUTTON_UNIT_SWEEP, (MinesweeperTargets( u ) ? 0 : WIDGET_DISABLED), MSG(MSG_B_UNIT_SWEEP) ); if ( undo.GetUnit() == u ) menu->AddItem( 0, G_BUTTON_UNIT_UNDO, 0, MSG(MSG_B_UNIT_UNDO) ); menu->Layout(); g_tmp_prv_unit = u; } else UnitInfo( u ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::HandleNetworkError // DESCRIPTION: Call when a network error has been detected. Ask user // whether current game should be saved, and shutdown // afterwards. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::HandleNetworkError( void ) { string choices( MSG(MSG_B_SAVE) ); choices += '|'; choices += MSG(MSG_B_CANCEL); DialogWindow *dw = new DialogWindow( MSG(MSG_ERROR), MSG(MSG_ERR_NETWORK), choices, 0, WIN_FONT_BIG|WIN_CENTER, view ); dw->SetButtonHook( this ); dw->SetButtonID( 0, G_BUTTON_SAVE_AND_SHUTDOWN ); dw->SetButtonID( 1, G_BUTTON_SHUTDOWN ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::Shutdown // DESCRIPTION: This method should be called when the current game ends, // either because one player surrendered, or the mission // was completed. It will not be called when quitting the // application altogether. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Game::Shutdown( void ) const { Audio::StopMusic( CF_MUSIC_FADE_TIME ); } //////////////////////////////////////////////////////////////////////// // NAME : Game::WidgetActivated // DESCRIPTION: The WidgetActivated() method gets called whenever a // widget from the game menu or another associated window // (e.g. password confirmation) is activated. // PARAMETERS : button - pointer to the widget that called the function // win - pointer to the window the widget belongs to // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status Game::WidgetActivated( Widget *button, Window *win ) { GUI_Status rc = GUI_OK; switch ( button->ID() ) { case G_BUTTON_END_TURN: view->CloseWindow( win ); rc = EndTurn(); if ( rc == GUI_RESTART ) Shutdown(); break; case G_BUTTON_MAP: view->CloseWindow( win ); new TacticalWindow( mwin->GetMapView(), *mission, view ); break; case G_BUTTON_BRIEFING: view->CloseWindow( win ); ShowBriefing(); break; case G_BUTTON_LEV_INFO: view->CloseWindow( win ); ShowLevelInfo(); break; case G_BUTTON_GENERAL_OPTIONS: static_cast(win)->CloseParent(); view->CloseWindow( win ); new GeneralOptionsWindow( mwin->GetMapView(), view ); break; case G_BUTTON_LANGUAGE_OPTIONS: static_cast(win)->CloseParent(); view->CloseWindow( win ); new LocaleOptionsWindow( this, view ); break; case G_BUTTON_KEYBOARD_OPTIONS: static_cast(win)->CloseParent(); view->CloseWindow( win ); new KeyboardOptionsWindow( view ); break; case G_BUTTON_VIDEO_OPTIONS: static_cast(win)->CloseParent(); view->CloseWindow( win ); new VideoOptionsWindow( view ); break; #ifndef DISABLE_SOUND case G_BUTTON_SOUND_OPTIONS: static_cast(win)->CloseParent(); view->CloseWindow( win ); new SoundOptionsWindow( view ); break; #endif case G_BUTTON_ABORT: { view->CloseWindow( win ); Audio::PlaySfx( Audio::SND_GUI_ASK, 0 ); string buttons; buttons.append( MSG(MSG_B_YES) ); buttons += '|'; buttons.append( MSG(MSG_B_NO) ); DialogWindow *req = new DialogWindow( NULL, MSG(MSG_ASK_ABORT), buttons, 1, 0, view ); req->SetButtonID( 0, G_BUTTON_SHUTDOWN ); req->SetButtonHook( 0, this ); break; } case G_BUTTON_QUIT: view->CloseWindow( win ); Quit(); break; case G_BUTTON_SAVE: case G_BUTTON_SAVE_AND_SHUTDOWN: view->CloseWindow( win ); Save( NULL ); if ( button->ID() == G_BUTTON_SAVE ) break; // otherwise fall through case G_BUTTON_SHUTDOWN: Shutdown(); rc = GUI_RESTART; break; case G_BUTTON_UNIT_INFO: view->CloseWindow( win ); UnitInfo( g_tmp_prv_unit ); break; case G_BUTTON_UNIT_CONTENT: view->CloseWindow( win ); ContainerContent( static_cast(g_tmp_prv_unit) ); break; case G_BUTTON_UNIT_SWEEP: view->CloseWindow( win ); if ( unit != g_tmp_prv_unit ) { // disable display updates so that selection doesn't shade mwin->GetMapView()->Disable(); SelectUnit( g_tmp_prv_unit ); mwin->GetMapView()->Enable(); } EnterSpecialMode( MODE_SWEEP ); break; case G_BUTTON_UNIT_UNDO: view->CloseWindow( win ); Undo(); break; case G_BUTTON_MINIMIZE_WINDOW: view->CloseWindow( win ); SDL_WM_IconifyWindow(); break; } return rc; } crimson-0.5.2.orig/src/cf/game.h0000600000175000017500000001035410617066561014555 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // game.h //////////////////////////////////////////////////////////////////////// #ifndef _INCLUDE_GAME_H #define _INCLUDE_GAME_H #include "mission.h" #include "mapwindow.h" #include "extwindow.h" #include "list.h" #include "path.h" #include "options.h" #include "network.h" #include "globals.h" #define PROGRAMNAME "Crimson Fields" // global vars extern class Game *Gam; extern class Image *Images[]; #define DEFAULT_DELAY (5 * ANIM_SPEED_UNIT) class UndoCache { public: UndoCache( void ) : unit(NULL) {} void Disable( void ) { unit = NULL; } void Register( Unit *u ) { unit = u; pos = u->Position(); dir = u->Facing(); } bool Disabled( void ) const { return unit == NULL; } Unit *GetUnit( void ) const { return unit; } const Point &GetPosition( void ) const { return pos; } unsigned char GetDirection( void ) const { return dir; } private: Unit *unit; Point pos; unsigned char dir; }; class Game : public WidgetHook { public: Game( View *view ); virtual ~Game( void ); int Load( MemBuffer &buffer ); int Load( const char *file ); int Save( MemBuffer &buffer ) { return mission->Save( buffer ); } int Save( const char *file ); void InitWindows( void ); void InitKeys( void ); void Quit( void ) const; void Shutdown( void ) const; GUI_Status HandleEvent( const SDL_Event &event ); GUI_Status StartTurn( void ); GUI_Status EndTurn( void ); void SetCursor( const Point &cursor ) const; Unit *MoveUnit( Unit *u, const Point &dest ); int MoveUnit( Unit *u, Direction dir, bool blink = false ); void SelectUnit( Unit *u ); void DeselectUnit( bool update = true ); MapWindow *GetMapWindow( void ) const { return mwin; } Mission *GetMission( void ) const { return mission; } void UnitInfo( Unit *unit ); void ResolveBattle( Combat *com, const Point *result = NULL ); #ifndef DISABLE_NETWORK void SetNetworkConnection( TCPConnection *c ) { peer = c; } #endif private: string CreateSaveFileName( const char *filename ) const; void ClearMine( Transport *sweeper, Unit *mine ); bool HaveWinner( void ); GUI_Status CheckEvents( void ); void ExecPreStartEvents( void ); void Execute( const History &history ); void MoveCommand( int key ); void SelectCommand( const Point &hex ); void ScrollCommand( int key ); void HandleLMB( const Point &hex ); void EnterSpecialMode( unsigned char mode ); void SelectNextUnit( void ); void RemoveUnit( Unit *u ); void Undo( void ); void EndMovement( Unit *u ) const; bool UnitTargets( Unit *u ) const; bool MinesweeperTargets( Unit *u ) const; void ShowBriefing( void ) const; GUI_Status ShowDebriefing( Player &player, bool restart ); void ShowLevelInfo( void ) const; void ContainerContent( UnitContainer *c ); void GameMenu( void ); void UnitMenu( Unit *unit ); int SwitchMap( const char *mission ); void HandleNetworkError( void ); bool SetPlayerPassword( Player *player ) const; bool CheckPassword( const char *title, const char *msg, const char *pw, short retry ) const; GUI_Status WidgetActivated( Widget *button, Window *win ); Mission *mission; MapWindow *mwin; Unit *unit; // selected unit short keys[6]; // keyboard shortcuts MoveShader *shader; View *view; UndoCache undo; string last_file_name; // remember save file names Unit *g_tmp_prv_unit; #ifndef DISABLE_NETWORK TCPConnection *peer; #endif }; #endif /* _INCLUDE_GAME_H */ crimson-0.5.2.orig/src/cf/history.cpp0000600000175000017500000006161010637506434015701 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // history.cpp //////////////////////////////////////////////////////////////////////// #include "history.h" #include "game.h" #include "options.h" #include "msgs.h" extern Options CFOptions; //////////////////////////////////////////////////////////////////////// // NAME : HistEvent::Load // DESCRIPTION: Load an event from a file. // PARAMETERS : file - file descriptor // RETURNS : -1 on error, 0 otherwise //////////////////////////////////////////////////////////////////////// int HistEvent::Load( MemBuffer &file ) { type = file.Read8(); for ( int i = 0; i < 4; ++i ) data[i] = file.Read16(); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : HistEvent::Save // DESCRIPTION: Save an event to a file. // PARAMETERS : file - file descriptor // RETURNS : 0 on success, non-0 otherwise //////////////////////////////////////////////////////////////////////// int HistEvent::Save( MemBuffer &file ) const { file.Write8( type ); for ( int i = 0; i < 4; ++i ) file.Write16( data[i] ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : History::Load // DESCRIPTION: Load a History from a file. // PARAMETERS : file - open file descriptor // mission - current mission // RETURNS : -1 on error, number of events loaded otherwise //////////////////////////////////////////////////////////////////////// short History::Load( MemBuffer &file, Mission &mission ) { unsigned short num_events = file.Read16(); if ( num_events > 0 ) { unsigned short num_units, i; num_units = file.Read16(); for ( i = 0; i < num_events; ++i ) { HistEvent *he = new HistEvent(); he->Load( file ); events.AddTail( he ); } for ( i = 0; i < num_units; ++i ) { Unit *u = mission.LoadUnit( file, true ); if ( u ) units.AddTail( u ); } } return num_events; } //////////////////////////////////////////////////////////////////////// // NAME : History::Save // DESCRIPTION: Save a history to file. // PARAMETERS : file - open file descriptor // network - do some special processing if saving for // sending over the wire in a network game // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int History::Save( MemBuffer &file, bool network /* = false */ ) const { unsigned short num; if ( network ) { num = 0; for ( HistEvent *he = static_cast( events.Head() ); he; he = static_cast( he->Next() ) ) { // don't resend any events if ( !he->processed ) { if ( he->type == HIST_MOVE || (he->type == HIST_UNIT && he->data[1] != HIST_UEVENT_DESTROY) || he->type == HIST_ATTACK || he->type == HIST_COMBAT || he->type == HIST_TRANSPORT_CRYSTALS || he->type == HIST_TRANSPORT_UNIT ) ++num; else he->processed = true; } } } else num = events.CountNodes(); file.Write16( num ); if ( num == 0 ) return 0; file.Write16( units.CountNodes() ); // save events for ( HistEvent *he = static_cast( events.Head() ); he; he = static_cast( he->Next() ) ) if ( !network || !he->processed ) he->Save( file ); // save units for ( Unit *u = static_cast( units.Head() ); u; u = static_cast( u->Next() ) ) u->Save( file ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : History::StartRecording // DESCRIPTION: Create a new (empty) History from the current game. // PARAMETERS : list - list of units // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::StartRecording( List &list ) { // create the unit copies for ( Unit *u = static_cast( list.Head() ); u; u = static_cast( u->Next() ) ) { Unit *dummy = new Unit( *u ); dummy->SetFlags( U_DUMMY ); units.AddTail( dummy ); } } //////////////////////////////////////////////////////////////////////// // NAME : History::Replay // DESCRIPTION: Play all events that have been stored during the last // turn. // PARAMETERS : mapwin - pointer to MapWindow // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::Replay( MapWindow *mapwin ) { if ( events.IsEmpty() ) return; View *view = mapwin->GetView(); MapView *mv = mapwin->GetMapView(); Map *map = mv->GetMap(); ProgressWindow *progwin = NULL; HistEvent *he = static_cast( events.Head() ); bool abort = false; bool replay = CFOptions.GetTurnReplay(); bool quick = CFOptions.GetQuickReplay(); if ( replay ) { List units_bak; BeginReplay( units_bak, map ); if ( quick ) delay = 0; else { unsigned short count = events.CountNodes(); // undo the map tile changes which have been recorded this turn while ( he && (he->type == HIST_TILE_INTERNAL) ) { map->SetHexType( he->data[1], he->data[2], he->data[0] ); he = static_cast( he->Next() ); --count; } delay = DEFAULT_DELAY; mv->Enable(); mapwin->Draw(); mapwin->Show(); progwin = new ProgressWindow( mapwin->Width() / 4, mapwin->Height() - view->SmallFont()->Height() - 30, mapwin->Width() / 2, view->SmallFont()->Height() + 20, 0, count, NULL, WIN_PROG_ABORT|WIN_PROG_DEFAULT, view ); } while ( he && !abort ) { if ( he->type == HIST_MOVE ) ReplayMoveEvent( *he, mapwin ); else if ( he->type == HIST_COMBAT ) ReplayCombatEvent( *he, mapwin ); else if ( he->type == HIST_MSG ) ReplayMessageEvent( *he, view ); else if ( he->type == HIST_TILE ) ReplayTileEvent( *he, mapwin ); else if ( he->type == HIST_UNIT ) ReplayUnitEvent( *he, mapwin ); else if ( !quick ) { // these events are skipped completely for quick replays if ( he->type == HIST_ATTACK ) ReplayAttackEvent( *he, mapwin ); } if ( !quick ) { progwin->Advance( 1 ); abort = progwin->Cancelled(); } he = static_cast( he->Next() ); } EndReplay( units_bak, map ); if ( progwin ) view->CloseWindow( progwin ); } if ( replay && !abort ) SDL_Delay( delay * 2 ); else if ( !quick ) { // if replay has been stopped or disabled we still need to revert // all changes to the map and display the cached messages while ( he ) { if ( he->type == HIST_TILE ) map->SetHexType( he->data[1], he->data[2], he->data[0] ); else if ( he->type == HIST_MSG ) ReplayMessageEvent( *he, view ); he = static_cast( he->Next() ); } } } //////////////////////////////////////////////////////////////////////// // NAME : History::BeginReplay // DESCRIPTION: Prepare for viewing the last turn replay. We must store // the current list of units in a safe place and replace // them by their "historical" versions. // PARAMETERS : backup - list to store current unit list in // map - map // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::BeginReplay( List &backup, Map *map ) { List &gam_units = Gam->GetMission()->GetUnits(); Unit *u; while ( !gam_units.IsEmpty() ) { u = static_cast( gam_units.RemHead() ); backup.AddTail( u ); if ( !u->IsSheltered() ) map->SetUnit( NULL, u->Position() ); } Unit *next = NULL; for ( u = static_cast(units.Head()); u; u = next ) { next = static_cast( u->Next() ); // we use the BUSY flag internally to signal units which do // not yet exist at the time replay is started if ( !u->IsBusy() ) { u->Remove(); gam_units.AddTail( u ); if ( !u->IsSheltered() ) map->SetUnit( u, u->Position() ); } } lastunit = NULL; lastpos = Point(-1, -1); } //////////////////////////////////////////////////////////////////////// // NAME : History::EndReplay // DESCRIPTION: End replay mode and initiate the next turn. Remove the // historical units and put the real ones back in place. // PARAMETERS : backup - list containing the real units // map - map // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::EndReplay( List &backup, Map *map ) { List &gam_units = Gam->GetMission()->GetUnits(); Unit *u; while ( !gam_units.IsEmpty() ) { u = static_cast( gam_units.RemHead() ); if ( !u->IsSheltered() ) map->SetUnit( NULL, u->Position() ); delete u; } while ( !backup.IsEmpty() ) { u = static_cast( backup.RemHead() ); gam_units.AddTail( u ); if ( !u->IsSheltered() ) map->SetUnit( u, u->Position() ); } } //////////////////////////////////////////////////////////////////////// // NAME : History::RecordMoveEvent // DESCRIPTION: Record the movement of a unit from one hex to another, // neighboring hex. // PARAMETERS : u - unit to be moved // dir - direction to move the unit in // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int History::RecordMoveEvent( const Unit &u, Direction dir ) { HistEvent *he = new HistEvent; he->type = HIST_MOVE; he->data[0] = u.ID(); he->data[1] = dir; he->data[2] = he->data[3] = -1; events.AddTail( he ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : History::RecordAttackEvent // DESCRIPTION: Record an attack being inititated. // PARAMETERS : u - unit to inititate the attack // target - unit being attacked // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int History::RecordAttackEvent( const Unit &u, const Unit &target ) { HistEvent *he = new HistEvent; he->type = HIST_ATTACK; he->data[0] = u.ID(); he->data[1] = target.Position().x; he->data[2] = target.Position().y; he->data[3] = -1; events.AddTail( he ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : History::RecordCombatEvent // DESCRIPTION: Record the results of a combat. // PARAMETERS : combat - combat data // loss1 - attackers' casualties // loss2 - defenders' casualties // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int History::RecordCombatEvent( const Combat &combat, unsigned char loss1, unsigned char loss2 ) { HistEvent *he = new HistEvent; he->type = HIST_COMBAT; he->data[0] = combat.GetAttacker()->ID(); he->data[1] = combat.GetDefender()->ID(); he->data[2] = loss1; he->data[3] = loss2; events.AddTail( he ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : History::RecordTileEvent // DESCRIPTION: Record a modification of the map. This event is special // in so far as two separate events are created for each // event. One allows for the initial map to be created from // the map at the end of the turn, the other represents the // actual map change. // PARAMETERS : tile - tile type being set // old - tile type being replaced // dx - x hex being modified // dy - y hex being modified // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int History::RecordTileEvent( unsigned short tile, unsigned short old, short dx, short dy ) { HistEvent *he = new HistEvent; // first record the actual change he->type = HIST_TILE; he->data[0] = tile; he->data[1] = dx; he->data[2] = dy; he->data[3] = -1; events.AddTail( he ); // now create the map state initializer event and put it at the // head of the list he = new HistEvent; he->type = HIST_TILE_INTERNAL; he->data[0] = old; he->data[1] = dx; he->data[2] = dy; he->data[3] = -1; events.AddHead( he ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : History::RecordMsgEvent // DESCRIPTION: Record a message for the next player. // PARAMETERS : title - title to use for the message window. If -1, // used title will be "Message". // msg - index of the message // pos - location index of a hex on the map that should // be shown when displaying the message // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int History::RecordMsgEvent( short title, unsigned short msg, short pos ) { HistEvent *he = new HistEvent; he->type = HIST_MSG; he->data[0] = title; he->data[1] = msg; he->data[2] = pos; he->data[3] = -1; events.AddTail( he ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : History::RecordUnitEvent // DESCRIPTION: Record the creation or destruction of a unit. // PARAMETERS : unit - created or destroyed unit // type - type of event (created, destroyed, repaired) // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int History::RecordUnitEvent( const Unit &unit, HistUnitEventType type ) { HistEvent *he = new HistEvent; he->type = HIST_UNIT; he->data[0] = unit.ID(); he->data[1] = type; he->data[2] = he->data[3] = -1; events.AddTail( he ); if ( type == HIST_UEVENT_CREATE ) { Unit *clone = new Unit( unit ); clone->SetFlags( U_BUSY|U_DUMMY ); units.AddTail( clone ); } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : History::RecordTransportEvent // DESCRIPTION: Record the (un)loading of crystals. // PARAMETERS : source - outer container to give/receive crystals // dest - inner container to give/receive crystals // crystals - number of crystals to move from source to // destination (may be negative) // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int History::RecordTransportEvent( const UnitContainer &source, const Transport &dest, short crystals ) { HistEvent *he = new HistEvent; he->type = HIST_TRANSPORT_CRYSTALS; he->data[0] = dest.ID(); he->data[1] = crystals; he->data[2] = he->data[3] = -1; events.AddTail( he ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : History::RecordTransportEvent // DESCRIPTION: Record the movement of a unit from one container into // another (without leaving the current hex). // PARAMETERS : source - outer container to remove unit from // dest - inner container to add unit to // u - unit to move from source to dest // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int History::RecordTransportEvent( const UnitContainer &source, const Transport &dest, const Unit &u ) { HistEvent *he = new HistEvent; he->type = HIST_TRANSPORT_UNIT; he->data[0] = dest.ID(); he->data[1] = u.ID(); he->data[2] = he->data[3] = -1; events.AddTail( he ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : History::ReplayMoveEvent // DESCRIPTION: Show the movement of a unit from one hex to another, // neighboring hex. // PARAMETERS : event - move event // mapwin - map window // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::ReplayMoveEvent( const HistEvent &event, MapWindow *mapwin ) { MapView *mv = mapwin->GetMapView(); Map *map = mv->GetMap(); Mission *mission = Gam->GetMission(); Unit *u = mission->GetUnit( event.data[0] ); if ( u ) { if ( u != lastunit ) { if ( lastunit && lastunit->IsTransport() && !map->GetMapObject( lastpos ) ) { // we must adjust the position of carried units manually because // those pseudo-transports can't handle this themselves for ( Unit *carry = static_cast( mission->GetUnits().Head() ); carry; carry = static_cast( carry->Next() ) ) { if ( carry->Position() == lastpos ) carry->SetPosition( lastunit->Position().x, lastunit->Position().y ); } } lastunit = u; lastpos = u->Position(); SDL_Delay( delay ); } mapwin->DisplayHex( u->Position() ); if ( u->IsSheltered() ) { if ( map->GetUnit( u->Position() ) ) u->UnsetFlags( U_SHELTERED ); else map->GetBuilding( u->Position() )->RemoveUnit( u ); } else { map->SetUnit( NULL, u->Position() ); mv->UpdateHex( u->Position() ); } Gam->MoveUnit( u, (Direction)event.data[1] ); map->SetUnit( u, u->Position() ); if ( mv->Enabled() ) mapwin->Show( mv->UpdateHex( u->Position() ) ); } } //////////////////////////////////////////////////////////////////////// // NAME : History::ReplayAttackEvent // DESCRIPTION: Show a unit targetting another one. // PARAMETERS : event - attack event // mapwin - map window // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::ReplayAttackEvent( const HistEvent &event, MapWindow *mapwin ) { MapView *mv = mapwin->GetMapView(); Unit *u = Gam->GetMission()->GetUnit( event.data[0] ); if ( u ) { if ( u != lastunit ) SDL_Delay( delay ); if ( !mv->HexVisible( u->Position() ) || !mv->HexVisible( Point(event.data[1], event.data[2]) ) ) { mv->CenterOnHex( Point((u->Position().x + event.data[1]) / 2, (u->Position().y + event.data[2]) / 2) ); mapwin->Show( *mv ); } Point target( event.data[1], event.data[2]); mv->SetCursorImage( IMG_CURSOR_HIGHLIGHT ); Rect upd = mv->SetCursor( u->Position() ); mapwin->Show( upd ); mv->SetCursorImage( IMG_CURSOR_ATTACK ); upd = mv->SetCursor( target ); mapwin->Show( upd ); mapwin->FlashUnit ( target, 2 ); mv->SetCursor( Point(-1,-1) ); upd = mv->UpdateHex( u->Position() ); mapwin->Show( upd ); upd = mv->UpdateHex( target ); mapwin->Show( upd ); lastunit = u; } } //////////////////////////////////////////////////////////////////////// // NAME : History::ReplayMessageEvent // DESCRIPTION: Display a message. // PARAMETERS : event - message event // view - current view // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::ReplayMessageEvent( const HistEvent &event, View *view ) { MapWindow *mwin = Gam->GetMapWindow(); Mission *m = Gam->GetMission(); if ( mwin->GetMapView()->Enabled() && (event.data[2] >= 0) ) mwin->DisplayHex( m->GetMap().Index2Hex( event.data[2] ) ); MessageWindow *msgw = new MessageWindow( (event.data[0] != -1) ? m->GetMessage( event.data[0] ) : MSG(MSG_MESSAGE), m->GetMessage( event.data[1] ), view ); msgw->EventLoop(); view->CloseWindow( msgw ); } //////////////////////////////////////////////////////////////////////// // NAME : History::ReplayTileEvent // DESCRIPTION: Replay a tile switch. // PARAMETERS : event - tile event // mapwin - map window // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::ReplayTileEvent( const HistEvent &event, MapWindow *mapwin ) { MapView *mv = mapwin->GetMapView(); Map *map = mv->GetMap(); Point pos( event.data[1], event.data[2] ); if ( mv->Enabled() ) { const TerrainType *tt = Gam->GetMission()->GetTerrainSet().GetTerrainInfo( event.data[0] ); mapwin->DisplayHex( pos ); SDL_Delay( delay ); mapwin->FadeInTerrain( tt->tt_image, pos ); SDL_Delay( delay ); } map->SetHexType( event.data[1], event.data[2], event.data[0] ); } //////////////////////////////////////////////////////////////////////// // NAME : History::ReplayCombatEvent // DESCRIPTION: Replay a fight switch. // PARAMETERS : event - combat event // mapwin - map window // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::ReplayCombatEvent( const HistEvent &event, MapWindow *mapwin ) { // for the quick replay we may have to activate the display now MapView *mv = mapwin->GetMapView(); if (!mv->Enabled()) { delay = DEFAULT_DELAY; mv->Enable(); mapwin->Draw(); mapwin->Show(); } Combat cmb( Gam->GetMission()->GetUnit( event.data[0] ), Gam->GetMission()->GetUnit( event.data[1] ) ); Point casualties( event.data[3], event.data[2] ); Gam->ResolveBattle( &cmb, &casualties ); } //////////////////////////////////////////////////////////////////////// // NAME : History::ReplayUnitEvent // DESCRIPTION: Add a new unit to the map. // PARAMETERS : event - unit event // mapwin - map window // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::ReplayUnitEvent( const HistEvent &event, MapWindow *mapwin ) { Mission *mission = Gam->GetMission(); MapView *mv = mapwin->GetMapView(); Map *map = mv->GetMap(); Unit *u = GetDummy( event.data[0] ); if ( u ) { if ( event.data[1] == HIST_UEVENT_CREATE ) { // create unit u->Remove(); if ( !u->IsSheltered() ) { if ( mv->Enabled() ) { mapwin->DisplayHex( u->Position() ); SDL_Delay( delay ); mapwin->FadeInUnit( u->Image(), u->Position() ); SDL_Delay( delay ); } map->SetUnit( u, u->Position() ); } mission->GetUnits().AddTail( u ); } else if ( event.data[1] == HIST_UEVENT_DESTROY ) { // destroy unit if ( !u->IsSheltered() ) { map->SetUnit( NULL, u->Position() ); if ( mv->Enabled() ) { mapwin->DisplayHex( u->Position() ); SDL_Delay( delay ); mapwin->FadeOutUnit( u->Image(), u->Position() ); SDL_Delay( delay ); } } } } } //////////////////////////////////////////////////////////////////////// // NAME : History::UndoMove // DESCRIPTION: Erase all recorded movement and related events for a // specific unit. // PARAMETERS : u - unit to erase movement for // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::UndoMove( const Unit &u ) { HistEvent *he = static_cast( events.Head() ), *tmp; while ( he ) { tmp = static_cast( he->Next() ); if ( ((he->type == HIST_MOVE) || (he->type == HIST_TRANSPORT_CRYSTALS) || (he->type == HIST_TRANSPORT_UNIT)) && (he->data[0] == u.ID()) ) { he->Remove(); delete he; } he = tmp; } } //////////////////////////////////////////////////////////////////////// // NAME : History::GetDummy // DESCRIPTION: Retrieve an internal unit definition. // PARAMETERS : id - unit identifier // RETURNS : dummy for the requested unit, NULL if not found //////////////////////////////////////////////////////////////////////// Unit *History::GetDummy( unsigned short id ) const { Unit *u; for ( u = static_cast( units.Head() ); u && u->ID() != id; u = static_cast( u->Next() ) ); return u; } //////////////////////////////////////////////////////////////////////// // NAME : History::SetEventsProcessed // DESCRIPTION: Set all events to processed. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void History::SetEventsProcessed( void ) const { for ( HistEvent *he = static_cast( events.Head() ); he; he = static_cast( he->Next() ) ) { he->processed = true; } } crimson-0.5.2.orig/src/cf/history.h0000600000175000017500000000664010554366466015357 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////////////// // history.h - constructs to record the important events during a turn // and replay them on the next /////////////////////////////////////////////////////////////////////// #ifndef _INCLUDE_HISTORY_H #define _INCLUDE_HISTORY_H #include "combat.h" class HistEvent : public Node { public: HistEvent( void ) : processed(false) {} int Load ( MemBuffer &file ); int Save( MemBuffer &file ) const; unsigned char type; short data[4]; bool processed; }; class MapWindow; class History { public: enum HistEventType { HIST_MOVE = 0, HIST_ATTACK, HIST_COMBAT, HIST_TILE, // map tile change HIST_TILE_INTERNAL, HIST_MSG, HIST_UNIT, HIST_TRANSPORT_CRYSTALS, HIST_TRANSPORT_UNIT }; enum HistUnitEventType { HIST_UEVENT_CREATE, HIST_UEVENT_DESTROY, HIST_UEVENT_REPAIR }; History( void ) {} short Load( MemBuffer &file, Mission &mission ); int Save( MemBuffer &file, bool network = false ) const; void StartRecording( List &list ); int RecordAttackEvent( const Unit &u, const Unit &target ); int RecordCombatEvent( const Combat &combat, unsigned char loss1, unsigned char loss2 ); int RecordMoveEvent( const Unit &u, Direction dir ); int RecordMsgEvent( short title, unsigned short msg, short pos ); int RecordTileEvent( unsigned short tile, unsigned short old, short dx, short dy ); int RecordTransportEvent( const UnitContainer &source, const Transport &dest, short crystals ); int RecordTransportEvent( const UnitContainer &source, const Transport &dest, const Unit &u ); int RecordUnitEvent( const Unit &u, HistUnitEventType type ); void Replay( MapWindow *mapwin ); void UndoMove( const Unit &u ); void SetEventsProcessed( void ) const; const List &GetEvents( void ) const { return events; } Unit *GetDummy( unsigned short id ) const; private: void BeginReplay( List &backup, Map *map ); void EndReplay( List &backup, Map *map ); void ReplayAttackEvent( const HistEvent &event, MapWindow *mapwin ); void ReplayCombatEvent( const HistEvent &event, MapWindow *mapwin ); void ReplayMessageEvent( const HistEvent &event, View *view ); void ReplayMoveEvent( const HistEvent &event, MapWindow *mapwin ); void ReplayTileEvent( const HistEvent &event, MapWindow *mapwin ); void ReplayUnitEvent( const HistEvent &event, MapWindow *mapwin ); List events; List units; unsigned short delay; Unit *lastunit; Point lastpos; }; #endif /* _INCLUDE_HISTORY_H */ crimson-0.5.2.orig/src/cf/initwindow.cpp0000600000175000017500000015145110546466524016402 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // initwindow.cpp //////////////////////////////////////////////////////////////////////// #include #include #include "initwindow.h" #include "filewindow.h" #include "misc.h" #include "game.h" #include "strutil.h" #include "options.h" #include "msgs.h" enum { IW_WIDGET_TYPE = 0, IW_WIDGET_MAPTYPE, IW_WIDGET_LEVELS, IW_WIDGET_START, IW_WIDGET_OPTIONS, IW_WIDGET_GENERAL_OPTIONS, IW_WIDGET_LANGUAGE_OPTIONS, IW_WIDGET_VIDEO_OPTIONS, IW_WIDGET_SOUND_OPTIONS, IW_WIDGET_KEYBOARD_OPTIONS, IW_WIDGET_DIFFICULTY }; #define MAPTYPE_SINGLE 0 #define MAPTYPE_CAMPAIGN 1 #define MAPTYPE_SAVE 2 #ifdef _WIN32_WCE # define OW_OK_BUTTON_FLAGS 0 #else # define OW_OK_BUTTON_FLAGS WIDGET_DEFAULT #endif extern Options CFOptions; //////////////////////////////////////////////////////////////////////// // NAME : InitWindow::InitWindow // DESCRIPTION: Create the main menu window. The player(s) can select // the level they want to play and set other options. // PARAMETERS : view - view to attach the window to // title - pointer to title window; must be closed when this // window is closed // RETURNS : - //////////////////////////////////////////////////////////////////////// InitWindow::InitWindow( View *view, Window *title ) : Window( WIN_CENTER, view ), title(title) { // read list of maps/saves const string home_lev( get_home_levels_dir() ); if ( !home_lev.empty() ) FileWindow::CreateFilesList( home_lev.c_str(), ".lev", levels ); FileWindow::CreateFilesList( get_levels_dir().c_str(), ".lev", levels ); CompleteFilesList( levels ); FileWindow::CreateFilesList( get_save_dir().c_str(), ".sav", saves ); CompleteFilesList( saves ); Audio::PlayMusic( CF_MUSIC_THEME ); view->SetFGPen( Color( 0x00d87c00 ) ); view->SetBGPen( Color( CF_COLOR_BLACK ) ); Rebuild(); } //////////////////////////////////////////////////////////////////////// // NAME : InitWindow::~InitWindow // DESCRIPTION: Destroy window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// InitWindow::~InitWindow( void ) { TLWNode *n; string *str; while ( !levels.IsEmpty() ) { n = static_cast( levels.RemHead() ); str = (string *)n->UserData(); delete str; delete n; } while ( !campaigns.IsEmpty() ) { n = static_cast( campaigns.RemHead() ); str = (string *)n->UserData(); delete str; delete n; } while ( !saves.IsEmpty() ) { n = static_cast( saves.RemHead() ); str = (string *)n->UserData(); delete str; delete n; } } //////////////////////////////////////////////////////////////////////// // NAME : InitWindow::Rebuild // DESCRIPTION: (Re)create all window content. This is used both in the // constructor and when the window size has changed. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void InitWindow::Rebuild( void ) { RemoveAllWidgets(); // calculate window dimensions const char *typelbl = MSG(MSG_B_GAME_TYPE); const char *mapslbl = MSG(MSG_B_MAP_TYPE); const char *hcaplbl = MSG(MSG_B_HANDICAP); unsigned short typewidth = sfont->TextWidth(typelbl); unsigned short mapswidth = sfont->TextWidth(mapslbl); unsigned short wdh = sfont->Height() + 8; unsigned short xoff = MAX( typewidth, mapswidth ) - sfont->CharWidth('_') + 10; SetSize( MIN(view->Width(), xoff + sfont->Width() * 40 + 20), MIN(view->Height(), wdh * 12 + 10 ) ); // create widgets Widget *wd; const char *typelabels[GTYPE_COUNT + 1]; typelabels[GTYPE_HOTSEAT] = MSG(MSG_GAME_HOT_SEAT); typelabels[GTYPE_AI] = MSG(MSG_GAME_AI); typelabels[GTYPE_PBEM] = MSG(MSG_GAME_PBEM); #ifndef DISABLE_NETWORK typelabels[GTYPE_NET_SERVER] = MSG(MSG_GAME_NETWORK_SERVER); typelabels[GTYPE_NET_CLIENT] = MSG(MSG_GAME_NETWORK_CLIENT); #endif typelabels[GTYPE_COUNT] = 0; const char *mapslabels[4]; mapslabels[MAPTYPE_SINGLE] = MSG(MSG_MAPS_SINGLES); mapslabels[MAPTYPE_CAMPAIGN] = MSG(MSG_MAPS_CAMPAIGNS); mapslabels[MAPTYPE_SAVE] = MSG(MSG_MAPS_SAVES); mapslabels[3] = 0; const char *difflabels[4]; difflabels[0] = MSG(MSG_HANDICAP_NONE); difflabels[1] = MSG(MSG_HANDICAP_P1); difflabels[2] = MSG(MSG_HANDICAP_P2); difflabels[3] = 0; gtypewidget = new CycleWidget( IW_WIDGET_TYPE, xoff, 5, (w - xoff - 10) / 2, wdh, 0, typelbl, CFOptions.GetGameType(), typelabels, this ); gtypewidget->SetHook( this ); xoff = gtypewidget->LeftEdge() + gtypewidget->Width() + 5; wd = new DropWidget( IW_WIDGET_OPTIONS, xoff, gtypewidget->TopEdge(), w - xoff - 5, wdh, 0, MSG(MSG_B_OPTIONS), this ); wd->SetHook( this ); mtypewidget = new CycleWidget( IW_WIDGET_MAPTYPE, gtypewidget->LeftEdge(), gtypewidget->TopEdge() + wdh + 5, gtypewidget->Width(), wdh, 0, mapslbl, 0, mapslabels, this ); mtypewidget->SetHook( this ); CFOptions.SetCampaign( false ); xoff += sfont->TextWidth( hcaplbl ) - sfont->CharWidth( '_' ) + 5; diffwidget = new CycleWidget( IW_WIDGET_DIFFICULTY, xoff, mtypewidget->TopEdge(), w - xoff - 5, wdh, 0, hcaplbl, 0, difflabels, this ); levwidget = new TextListWidget( IW_WIDGET_LEVELS, 5, mtypewidget->TopEdge() + wdh + 5, w/2 - 7, h - (wdh + 5) * 3 - 5, &levels, -1, WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY| (CFOptions.GetGameType() == GTYPE_NET_CLIENT ? WIDGET_DISABLED : 0), NULL, this ); levwidget->SetHook( this ); maxmap = Rect( w/2 + 2, levwidget->TopEdge(), w/2 - 7, levwidget->Height() ); // of these two widgets, only one is actually present at a time mapwidget = new MapWidget( 0, maxmap.x, maxmap.y, maxmap.w, maxmap.h, 0, this ); campinfowidget = new TextScrollWidget( 0, maxmap.x, maxmap.y, maxmap.w, maxmap.h, 0, WIDGET_HIDDEN, 0, this ); wd = new ButtonWidget( IW_WIDGET_START, 5, h - wdh - 2, (w - 10) / 2 - 2, wdh, WIDGET_DEFAULT, MSG(MSG_B_START), this ); wd->SetHook( this ); wd = new ButtonWidget( GUI_QUIT, wd->LeftEdge() + wd->Width() + 4, wd->TopEdge(), wd->Width(), wdh, 0, MSG(MSG_B_EXIT), this ); Draw(); } //////////////////////////////////////////////////////////////////////// // NAME : InitWindow::VideoModeChange // DESCRIPTION: This method is called by the view whenever the video // resolution changes. We can then resize the window and // widgets accordingly. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void InitWindow::VideoModeChange( void ) { Rebuild(); } //////////////////////////////////////////////////////////////////////// // NAME : InitWindow::WidgetActivated // DESCRIPTION: Handle activation of widgets in the window. // PARAMETERS : button - calling widget // win - pointer to active window // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status InitWindow::WidgetActivated( Widget *button, Window *win ) { TLWNode *n; GUI_Status rc = GUI_OK; switch ( button->ID() ) { case IW_WIDGET_LEVELS: // user selected mission, show map n = static_cast( levwidget->Selected() ); if ( n ) { string *lname = (string *)n->UserData(); Mission *m = LoadMission( lname->c_str() ); if ( m ) { if ( mtypewidget->GetValue() == MAPTYPE_CAMPAIGN ) { campinfowidget->SetText( m->GetCampaignInfo() ); } else { Map &map = m->GetMap(); unsigned char magnify = MIN( maxmap.Width() / map.Width(), maxmap.Height() / map.Height() ); if ( magnify == 0 ) magnify = 1; else if ( magnify > 6 ) magnify = 6; mapwidget->w = magnify * map.Width() + 2; mapwidget->h = magnify * map.Height() + 2 + magnify/2; mapwidget->Center( maxmap ); mapwidget->Clip( maxmap ); mapwidget->SetPlayerColors( m->GetPlayer(PLAYER_ONE).LightColor(), m->GetPlayer(PLAYER_TWO).LightColor() ); mapwidget->SetMap( &map, Rect(0,0,250,250), magnify ); } delete m; Draw(); Show(); } } break; case IW_WIDGET_START: { const char *name = NULL; bool err = false; if ( !CFOptions.IsNetwork() || (CFOptions.GetGameType() != GTYPE_NET_CLIENT) ) { n = static_cast( levwidget->Selected() ); if ( !n ) { new NoteWindow( MSG(MSG_ERROR), MSG(MSG_ERR_NO_MAP), WIN_CLOSE_ESC, view ); err = true; } else name = ((string *)n->UserData())->c_str(); } if ( !err ) rc = StartGame( name ); break; } case IW_WIDGET_MAPTYPE: switch ( mtypewidget->GetValue() ) { case MAPTYPE_SINGLE: mapwidget->SetMap( 0, Rect(0,0,0,0), 0 ); mapwidget->SetSize( maxmap.x, maxmap.y, maxmap.w, maxmap.h ); levwidget->SwitchList( &levels, -1 ); gtypewidget->Enable(); diffwidget->Enable(); campinfowidget->Hide(); mapwidget->Unhide(); CFOptions.SetCampaign( false ); break; case MAPTYPE_CAMPAIGN: levwidget->SwitchList( &campaigns, -1 ); gtypewidget->Disable(); diffwidget->Enable(); campinfowidget->Unhide(); mapwidget->Hide(); CFOptions.SetCampaign( true ); break; case MAPTYPE_SAVE: mapwidget->SetMap( 0, Rect(0,0,0,0), 0 ); mapwidget->SetSize( maxmap.x, maxmap.y, maxmap.w, maxmap.h ); levwidget->SwitchList( &saves, -1 ); diffwidget->Disable(); gtypewidget->Disable(); campinfowidget->Hide(); mapwidget->Unhide(); CFOptions.SetCampaign( false ); break; } Draw(); Show(); break; case IW_WIDGET_OPTIONS:{ MenuWindow *menu = new MenuWindow( 0, this, view ); menu->AddItem( 0, IW_WIDGET_GENERAL_OPTIONS, 0, MSG(MSG_B_OPT_GENERAL) ); menu->AddItem( 0, IW_WIDGET_LANGUAGE_OPTIONS, 0, MSG(MSG_B_OPT_LANGUAGE) ); menu->AddItem( 0, IW_WIDGET_VIDEO_OPTIONS, 0, MSG(MSG_B_OPT_VIDEO) ); #ifndef DISABLE_SOUND menu->AddItem( 0, IW_WIDGET_SOUND_OPTIONS, 0, MSG(MSG_B_OPT_AUDIO) ); #endif menu->AddItem( 0, IW_WIDGET_KEYBOARD_OPTIONS, 0, MSG(MSG_B_OPT_KEYBOARD) ); menu->SetPosition( Point( x + button->LeftEdge() + 1, y + button->TopEdge() + button->Height() - 1 ) ); menu->SetMinWidth( button->Width() - 2 ); menu->Layout(); break; } case IW_WIDGET_TYPE: CFOptions.SetGameType( (GameType)gtypewidget->GetValue() ); if ( CFOptions.GetGameType() == GTYPE_NET_CLIENT ) { diffwidget->Disable(); mtypewidget->Disable(); levwidget->Disable(); } else { diffwidget->Enable(); mtypewidget->Enable(); levwidget->Enable(); } Draw(); Show(); break; case IW_WIDGET_GENERAL_OPTIONS: view->CloseWindow( win ); new GeneralOptionsWindow( 0, view ); break; case IW_WIDGET_VIDEO_OPTIONS: view->CloseWindow( win ); new VideoOptionsWindow( view ); break; case IW_WIDGET_LANGUAGE_OPTIONS: view->CloseWindow( win ); new LocaleOptionsWindow( 0, view ); break; case IW_WIDGET_KEYBOARD_OPTIONS: view->CloseWindow( win ); new KeyboardOptionsWindow( view ); break; #ifndef DISABLE_SOUND case IW_WIDGET_SOUND_OPTIONS: view->CloseWindow( win ); new SoundOptionsWindow( view ); break; #endif } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : InitWindow::StartGame // DESCRIPTION: Start a new (or old) game. // PARAMETERS : filename - name of file to load game from // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status InitWindow::StartGame( const char *filename ) { Game *game = NULL; Mission *m; if ( filename ) { game = new Game( view ); if ( !game->Load( filename ) ) { m = game->GetMission(); // apply handicap setting if ( !(m->GetFlags() & GI_SAVEFILE) ) m->SetHandicap( 1 << diffwidget->GetValue() ); } else { delete game; NoteWindow *nw = new NoteWindow( MSG(MSG_ERROR), MSG(MSG_ERR_LOAD_MAP), 0, view ); nw->SetButtonID( 0, GUI_RESTART ); return GUI_OK; } } #ifndef DISABLE_NETWORK if ( CFOptions.IsNetwork() ) { int err; TCPConnection *connection = new TCPConnection(); // ask for network parameters (server/port) bool is_server = (game != NULL); short pid; if ( is_server ) // ask the server which side he'd like to play pid = AskForSide( *m ); NetworkSetupWindow *nsw = new NetworkSetupWindow( is_server, view ); do { err = 0; GUI_Status rc = nsw->EventLoop(); if ( rc <= GUI_OK ) { delete game; delete connection; view->CloseWindow( nsw ); return GUI_OK; } nsw->SetConnecting( true ); // if server, send initial data to client if ( is_server ) { DynBuffer send; // put player ID for client at start of sync buffer send.Write8( pid^1 ); err = connection->Open( NULL, nsw->GetPort(), nsw ); if ( err || game->Save( send ) || !connection->Send( send ) ) { nsw->SetConnecting( false ); connection->Close(); if ( !err ) err = 1; } else { // make sure we won't send any events twice if ( m->GetHistory() ) m->GetHistory()->SetEventsProcessed(); } } // if client, wait for game data to arrive else { DynBuffer *recv = NULL; err = connection->Open( nsw->GetServer(), nsw->GetPort(), nsw ); if ( !err ) { recv = connection->Receive( nsw ); if ( recv ) { game = new Game( view ); // our player ID is sent first pid = recv->Read8(); if ( game->Load( *recv ) != 0 ) { err = -1; } delete recv; } else err = -1; } if ( err ) { nsw->SetConnecting( false ); connection->Close(); delete game; game = NULL; } } if ( err == -1 ) { NoteWindow *nw = new NoteWindow( MSG(MSG_ERROR), MSG(MSG_ERR_LOAD_MAP), 0, view ); nw->EventLoop(); view->CloseWindow( nw ); } } while ( err ); m = game->GetMission(); m->GetPlayer( pid ).SetRemote( false ); m->GetPlayer( pid^1 ).SetRemote( true ); game->SetNetworkConnection( connection ); view->CloseWindow( nsw ); } #endif // !DISABLE_NETWORK Audio::StopMusic( CF_MUSIC_FADE_TIME ); view->CloseWindow( this ); if ( mtypewidget->GetValue() == MAPTYPE_SINGLE ) { if ( m->GetFlags() & GI_AI ) { short pid = AskForSide( *m ); m->GetPlayer( pid ).SetType( HUMAN ); } else { m->GetPlayer(PLAYER_ONE).SetType( HUMAN ); m->GetPlayer(PLAYER_TWO).SetType( HUMAN ); } } else if ( mtypewidget->GetValue() == MAPTYPE_CAMPAIGN ) { m->GetPlayer(PLAYER_ONE).SetType( HUMAN ); } view->Flood( Color(CF_COLOR_SHADOW) ); view->Update(); Gam = game; Gam->InitWindows(); return Gam->StartTurn(); // let the games begin... } //////////////////////////////////////////////////////////////////////// // NAME : InitWindow::AskForSide // DESCRIPTION: Ask the user which side he wants to play on. // PARAMETERS : m - mission to chose side for // RETURNS : identifier of the player/side chosen //////////////////////////////////////////////////////////////////////// short InitWindow::AskForSide( Mission &m ) const { string pnames( "[_1] " ); pnames += m.GetPlayer(PLAYER_ONE).Name(); pnames += "|[_2] "; pnames += m.GetPlayer(PLAYER_TWO).Name(); DialogWindow *pwin = new DialogWindow( MSG(MSG_PLAYER_SELECTION), MSG(MSG_ASK_SIDE), pnames, 0, 0, view ); pwin->SetButtonID( 0, PLAYER_ONE ); pwin->SetButtonID( 1, PLAYER_TWO ); short rc = pwin->EventLoop(); view->CloseWindow( pwin ); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : InitWindow::CompleteFilesList // DESCRIPTION: For the levels list display we need some information // about the maps (campaign info, 1 or 2 players). This // information is attached to the list items. // PARAMETERS : list - list of files created using create_files_list() // RETURNS : - //////////////////////////////////////////////////////////////////////// void InitWindow::CompleteFilesList( TLWList &list ) { bool reorder = false; for ( TLWNode *n = static_cast(list.Head()), *next; n; n = next ) { next = static_cast(n->Next()); string *fullname = (string *)n->UserData(); bool campaign = false, skirmish = false, remove = false; Mission *m = LoadMission( fullname->c_str(), false ); if ( m ) { string filename; string title; filename.assign( n->Name() ); filename.erase( filename.size() - 4 ); // remove .sav/.lev if ( (m->GetFlags() & GI_SAVEFILE) || !m->GetName() ) { // saved game -> use file name title = filename; } else { // new mission // campaign maps are only available if they have been unlocked // by playing the campaign campaign = ( (m->GetFlags() & GI_CAMPAIGN) && // campaign map (m->GetCampaignName() != 0) ); // first map of a campaign skirmish = ( (m->GetFlags() & GI_SKIRMISH) && // skirmish map (!(m->GetFlags() & GI_CAMPAIGN) || // no campaign map campaign || // first campaign map !CFOptions.IsLocked( filename )) ); // or already played if ( (m->GetFlags() & GI_CAMPAIGN) && // campaign map (m->GetCampaignName() != 0) ) { // first map of a campaign TLWNode *cnode = new TLWNode( m->GetCampaignName() ); string *full_path = new string(*fullname); cnode->SetUserData( full_path ); campaigns.InsertNodeSorted( cnode ); } if ( skirmish ) { title.assign( m->GetName() ); reorder = true; } remove = !skirmish; } if ( !remove ) { title += ' '; title += '('; if ( m->GetFlags() & GI_PBEM ) title += MSG(MSG_TAG_PBEM); else if ( m->GetFlags() & GI_NETWORK ) title += MSG(MSG_TAG_NET); else if ( m->GetFlags() & GI_SAVEFILE ) { if ( !m->GetPlayer(PLAYER_ONE).IsHuman() || !m->GetPlayer(PLAYER_TWO).IsHuman() ) title += '1'; else title += '2'; } else title += ((m->GetFlags() & GI_AI) != 0 ? '1' : '2'); if ( m->GetFlags() & GI_SAVEFILE ) { title += ", "; title += MSG(MSG_TURN); title += ' '; title += StringUtil::tostring(m->GetTurn()); } title += ')'; n->SetName( title ); } delete m; } else remove = true; if ( remove ) { n->Remove(); delete (string *)n->UserData(); delete n; } } if ( reorder ) list.Sort(); } //////////////////////////////////////////////////////////////////////// // NAME : InitWindow::LoadMission // DESCRIPTION: Load a mission into memory for inspection. // PARAMETERS : filename - mission filename // full - whether to completely load the mission // (Mission::Load) or only initialize the parts // for the map selection (Mission::QuickLoad). // Defaults to TRUE. // RETURNS : mission if successful, NULL on error //////////////////////////////////////////////////////////////////////// Mission *InitWindow::LoadMission( const char *filename, bool full ) const { Mission *m = 0; File file( filename ); if ( file.Open( "rb" ) ) { int rc; m = new Mission(); if ( full ) rc = m->Load( file ); else rc = m->QuickLoad( file ); if ( rc != -1 ) { m->SetLocale( CFOptions.GetLanguage() ); } else { delete m; m = 0; } } return m; } //////////////////////////////////////////////////////////////////////// // NAME : TitleWindow::TitleWindow // DESCRIPTION: Create a mostly invisible window containing the title // screen image. // PARAMETERS : view - view to attach the window to // RETURNS : - //////////////////////////////////////////////////////////////////////// TitleWindow::TitleWindow( View *view ) : Window( WIN_CENTER, view ) { bool error = false; string tname, tbase = get_data_dir(); append_path_delim( tbase ); // try to load resolution-optimized splash screen first tbase.append( "title" ); tname = tbase + StringUtil::tostring( view->Width() ) + ".bmp"; error = (LoadBMP( tname.c_str() ) != 0); if ( error ) { if ( view->Width() < 320 ) { // one more attempt tname = tbase + "320.bmp"; error = (LoadBMP( tname.c_str() ) != 0); } if ( error ) { // use the standard splash screen tname = tbase + ".bmp"; error = (LoadBMP( tname.c_str() ) != 0); } } if ( error ) SetSize( 0, 0, 0, 0 ); else { DisplayFormat(); Center( *view ); Show(); } } //////////////////////////////////////////////////////////////////////// // NAME : TitleWindow::HandleEvent // DESCRIPTION: Close (or rather, return control to main) when a key or // a mouse button is pressed. // PARAMETERS : event - event received by the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status TitleWindow::HandleEvent( const SDL_Event &event ) { GUI_Status rc = GUI_OK; if ( (event.type == SDL_KEYDOWN) || (event.type == SDL_MOUSEBUTTONDOWN) ) rc = GUI_CLOSE; return rc; } //////////////////////////////////////////////////////////////////////// // NAME : VideoOptionsWindow::VideoOptionsWindow // DESCRIPTION: Show the video options menu. // PARAMETERS : view - view to attach the window to // RETURNS : - //////////////////////////////////////////////////////////////////////// VideoOptionsWindow::VideoOptionsWindow( View *view ) : GenericOptionsWindow( MSG(MSG_OPTIONS_VIDEO), view ) { #ifdef _WIN32_WCE SDL_Rect std_sizes[] = { { 0, 0, GetSystemMetrics(SM_CXSCREEN), GetSystemMetrics(SM_CYSCREEN) }, { 0, 0, GetSystemMetrics(SM_CYSCREEN), GetSystemMetrics(SM_CXSCREEN) } }; #else SDL_Rect std_sizes[] = { { 0, 0, 1280, 1024 }, { 0, 0, 1024, 768 }, { 0, 0, 800, 600}, { 0, 0, 640, 480 } }; #endif const int n_modes = sizeof(std_sizes)/sizeof(SDL_Rect); SDL_Rect *std_modes[n_modes + 1]; short current = -1; int i; // create modes list SDL_Rect **sdl_modes = SDL_ListModes( NULL, SDL_FULLSCREEN ); // if any mode is ok offer some standard ones if ( sdl_modes == (SDL_Rect **)-1 ) { sdl_modes = std_modes; for ( i = 0; i < n_modes; ++i ) std_modes[i] = &std_sizes[i]; std_modes[n_modes] = NULL; } if ( sdl_modes != NULL ) { for ( i = 0; sdl_modes[i]; ++i ) AddMode( sdl_modes[i] ); // add current mode SDL_Rect screen = { 0, 0, view->Width(), view->Height() }; current = AddMode( &screen ); } // set window size const char *fslabel = MSG(MSG_B_OPT_FULLSCREEN); unsigned short width = sfont->TextWidth(fslabel) + DEFAULT_CBW_SIZE + 20; if ( width < sfont->Width() * 15 ) width = sfont->Width() * 15; SetLayout( width, sfont->Height() * 11 + 30 ); // create widgets const Rect &b = GetBounds(); modewidget = new TextListWidget( 0, b.x + 5, b.y + 5, b.w - 10, sfont->Height() * 10, &modes, current, WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY|WIDGET_ALIGN_CENTER, NULL, this ); fswidget = new CheckboxWidget( 0, modewidget->LeftEdge() + 10, modewidget->TopEdge() + modewidget->Height() + 10, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, view->IsFullScreen(), WIDGET_STYLE_NOBORDER|WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT, fslabel, this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : VideoOptionsWindow::~VideoOptionsWindow // DESCRIPTION: Destroy the video options window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// VideoOptionsWindow::~VideoOptionsWindow( void ) { TLWNode *n2; for ( TLWNode *n = static_cast(modes.Head()); n; n = n2 ) { n2 = static_cast(n->Next()); n->Remove(); SDL_Rect *rect = (SDL_Rect *)n->UserData(); delete rect; delete n; } } //////////////////////////////////////////////////////////////////////// // NAME : VideoOptionsWindow::AddMode // DESCRIPTION: Add another resultion to the list. Duplicates and // invalid sizes will be rejected. // PARAMETERS : res - resolution to add // RETURNS : position at which the mode has been added (or existed // before); -1 if mode was rejected //////////////////////////////////////////////////////////////////////// short VideoOptionsWindow::AddMode( SDL_Rect *res ) { short rc = -1; if ( (res->w >= MIN_XRES) && (res->h >= MIN_YRES) ) { TLWNode *walk, *prev = NULL; bool add = true; rc = 0; for ( walk = static_cast(modes.Head()); walk; prev = walk, walk = static_cast(walk->Next()) ) { SDL_Rect *nres = (SDL_Rect *)walk->UserData(); if ( nres->w <= res->w ) { if ( (nres->w == res->w) && (nres->h == res->h) ) add = false; break; } ++rc; } if ( add ) { char buf[16]; sprintf( buf, "%d x %d", res->w, res->h ); SDL_Rect *mode = new SDL_Rect; mode->w = res->w; mode->h = res->h; TLWNode *n = new TLWNode( buf, mode ); modes.InsertNode( n, prev ); } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : VideoOptionsWindow::WidgetActivated // DESCRIPTION: When the user pushes the 'OK' button, switch to the // selected video mode. // PARAMETERS : button - calling widget // win - pointer to active window // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status VideoOptionsWindow::WidgetActivated( Widget *button, Window *win ) { view->CloseWindow( win ); TLWNode *mode = static_cast( modewidget->Selected() ); if ( mode ) { bool fs = fswidget->Clicked(); unsigned long mode_flags = SDL_HWSURFACE|(fs ? SDL_FULLSCREEN : 0); // if selected mode is the same as current mode only check for fullscreen // dimensions of the selected mode are available in the user_data field SDL_Rect *dim = (SDL_Rect *)mode->UserData(); if ( (dim->w == view->Width()) && (dim->h == view->Height()) ) { if ( fs != view->IsFullScreen() ) view->ToggleFullScreen(); } else { view->SetVideoMode( dim->w, dim->h, DISPLAY_BPP, mode_flags ); } } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : GenericOptionsWindow::SetLayout // DESCRIPTION: Set the size of the window. This must be called before // trying to display it or using GetBounds(). // PARAMETERS : w - width (only the part needed by the subclass) // h - height (only the part needed by the subclass) // RETURNS : - //////////////////////////////////////////////////////////////////////// void GenericOptionsWindow::SetLayout( unsigned short w, unsigned short h ) { unsigned short tw = lfont->TextWidth(title); if ( w < tw + 20 ) w = tw + 20; if ( h + 25 + lfont->Height() + sfont->Height() >= view->Height() ) h = view->Height() - lfont->Height() - sfont->Height() - 26; clientarea = Rect( 5, 13 + lfont->Height(), w, h ); Window::SetSize( w + 10, h + lfont->Height() + sfont->Height() + 25 ); Widget *wd = new ButtonWidget( B_ID_OK, 1, Height() - sfont->Height() - 9, Width() - 2, sfont->Height() + 8, OW_OK_BUTTON_FLAGS, MSG(MSG_B_OK), this ); wd->SetHook( this ); } //////////////////////////////////////////////////////////////////////// // NAME : GenericOptionsWindow::Draw // DESCRIPTION: Draw the options window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void GenericOptionsWindow::Draw( void ) { Window::Draw(); DrawBox( clientarea, BOX_RECESSED ); int xpos = (w - lfont->TextWidth(title)) / 2; lfont->Write( title, this, xpos + 3, 8, view->GetBGPen() ); lfont->Write( title, this, xpos, 5, view->GetFGPen() ); } //////////////////////////////////////////////////////////////////////// // NAME : GeneralOptionsWindow::GeneralOptionsWindow // DESCRIPTION: Show the general options menu. // PARAMETERS : mv - current map view (may be NULL) // view - view to attach the window to // RETURNS : - //////////////////////////////////////////////////////////////////////// GeneralOptionsWindow::GeneralOptionsWindow( MapView *mv, View *view ) : GenericOptionsWindow( MSG(MSG_OPTIONS_GENERAL), view ), mv(mv) { unsigned short widths[3] = { 25 + DEFAULT_CBW_SIZE, 25 + DEFAULT_CBW_SIZE, 35 + DEFAULT_CBW_SIZE }, maxw = 0; const char *labels[3]; labels[0] = MSG(MSG_B_OPT_DAMAGE); labels[1] = MSG(MSG_B_OPT_REPLAYS); labels[2] = MSG(MSG_B_OPT_REPLAYS_QUICK); for ( int i = 0; i < 3; ++i ) { widths[i] += sfont->TextWidth(labels[i]); if ( widths[i] > maxw ) maxw = widths[i]; } SetLayout( maxw, sfont->Height() * 3 + 35 ); // create widgets const Rect &b = GetBounds(); // damage indicator diwidget = new CheckboxWidget( 0, b.x + 5, b.y + 5, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, CFOptions.GetDamageIndicator(), WIDGET_STYLE_NOBORDER|WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT, labels[0], this ); // replay repwidget = new CheckboxWidget( 0, b.x + 5, b.y + diwidget->Height() + 10, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, CFOptions.GetTurnReplay(), WIDGET_STYLE_NOBORDER|WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT, labels[1], this ); repwidget->SetHook(this); // quick replays qrepwidget = new CheckboxWidget( 0, b.x + 15, repwidget->y + repwidget->Height() + 5, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, CFOptions.GetQuickReplay(), WIDGET_STYLE_NOBORDER|WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT| (repwidget->Clicked() ? 0 : WIDGET_DISABLED), labels[2], this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : GeneralOptionsWindow::WidgetActivated // DESCRIPTION: When the user pushes the 'OK' button, propagate the // selected options. // PARAMETERS : widget - calling widget // win - pointer to active window // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status GeneralOptionsWindow::WidgetActivated( Widget *widget, Window *win ) { if ( widget == repwidget ) { if ( repwidget->Clicked() ) qrepwidget->Enable(); else { qrepwidget->Release(); qrepwidget->Disable(); } Draw(); Show(); } else { view->CloseWindow( win ); if ( CFOptions.GetDamageIndicator() != diwidget->Clicked() ) { CFOptions.SetDamageIndicator( diwidget->Clicked() ); if ( mv ) { if ( diwidget->Clicked() ) mv->EnableUnitStats(); else mv->DisableUnitStats(); // now redraw the map display mv->Draw(); view->Refresh( *mv ); } } CFOptions.SetTurnReplay( repwidget->Clicked() ); CFOptions.SetQuickReplay( qrepwidget->Clicked() ); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : LocaleOptionsWindow::LocaleOptionsWindow // DESCRIPTION: Show the language options menu. // PARAMETERS : game - current game. If it is NULL we assume the window // has been opened from the initial start window. // Otherwise we do an in-game language switch. // view - view to attach the window to // RETURNS : - //////////////////////////////////////////////////////////////////////// LocaleOptionsWindow::LocaleOptionsWindow( Game *game, View *view ) : GenericOptionsWindow( MSG(MSG_OPTIONS_LANGUAGE), view ), game(game) { // collect language data files short current = ReadLocales(); short found = locales.CountNodes(); if ( found > 5 ) found = 5; SetLayout( sfont->Width() * 20 + 20, found * (sfont->Height() + 2) + 25 ); // create widgets const Rect &b = GetBounds(); locwidget = new TextListWidget( 0, b.x, b.y, b.w, b.h, &locales, current, WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY|WIDGET_ALIGN_CENTER, NULL, this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : LocaleOptionsWindow::~LocaleOptionsWindow // DESCRIPTION: Free resources. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// LocaleOptionsWindow::~LocaleOptionsWindow( void ) { while ( !locales.IsEmpty() ) { TLWNode *n = static_cast(locales.RemHead()); delete (Language *)n->UserData(); delete n; } } //////////////////////////////////////////////////////////////////////// // NAME : LocaleOptionsWindow::ReadLocales // DESCRIPTION: Get the list of locales. // PARAMETERS : - // RETURNS : index of currently selected language //////////////////////////////////////////////////////////////////////// short LocaleOptionsWindow::ReadLocales( void ) { TLWList files; FileWindow::CreateFilesList( get_locale_dir().c_str(), ".dat", files ); short i = 0, current = -1; while ( !files.IsEmpty() ) { TLWNode *n = static_cast(files.RemHead()); string *fname = (string *)n->UserData(); Language *l = new Language(); short num = l->ReadCatalog( fname->c_str() ); if ( num == CF_MSGS ) { n->SetName( l->Name() ); n->SetUserData( l ); n->SetID( i ); locales.AddTail( n ); if ( string(l->ID()) == CFOptions.GetLanguage() ) current = i; ++i; } else { if ( num == -1 ) { cerr << "Error: Could not load language resources from " << n->Name() << endl; } else { cerr << "Error: Language catalog '" << n->Name() << "' contains " << num << " strings, expected " << CF_MSGS << endl; } delete l; delete n; } delete fname; } return current; } //////////////////////////////////////////////////////////////////////// // NAME : LocaleOptionsWindow::WidgetActivated // DESCRIPTION: When the user pushes the 'OK' button, propagate the // selected options. // PARAMETERS : widget - calling widget (only OK) // win - pointer to active window // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status LocaleOptionsWindow::WidgetActivated( Widget *widget, Window *win ) { GUI_Status rc = GUI_OK; view->CloseWindow( win ); TLWNode *n = static_cast(locwidget->Selected()); if ( n ) { Language *l = (Language *)n->UserData(); if ( string(l->ID()) != CFOptions.GetLanguage() ) { Lang = *l; CFOptions.SetLanguage( l->ID() ); if ( game ) { // we've changed the language in-game: // simply set the language and update the panel game->InitKeys(); game->GetMission()->SetLocale( l->ID() ); MapWindow *mwin = game->GetMapWindow(); MapView *mv = mwin->GetMapView(); mwin->GetPanel()->Update( mv->GetMap()->GetMapObject(mv->Cursor()) ); } else { // we've been called from the start menu: set the new language // and start over. This way we don't need to update the individual // widgets rc = GUI_RESTART; } } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : KeyboardOptionsWindow::KeyboardOptionsWindow // DESCRIPTION: Show the keyboard options menu. // PARAMETERS : view - view to attach the window to // RETURNS : - //////////////////////////////////////////////////////////////////////// KeyboardOptionsWindow::KeyboardOptionsWindow( View *view ) : GenericOptionsWindow( MSG(MSG_OPTIONS_KEYBOARD), view ), last( -1 ), request( 0 ) { SetLayout( sfont->Width() * 20 + 20, 10 * (sfont->Height() + 2) + 25 ); // create widgets const Rect &b = GetBounds(); RebuildKeyMap(); fncwidget = new TextListWidget( 0, b.x, b.y, b.w, b.h, &functions, -1, WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY, NULL, this); fncwidget->SetKey( SDLK_SPACE ); fncwidget->SetHook( this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : KeyboardOptionsWindow::HandleEvent // DESCRIPTION: React to user input. // PARAMETERS : event - event received by the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status KeyboardOptionsWindow::HandleEvent( const SDL_Event &event ) { GUI_Status rc; if (request != NULL) { if (event.type == SDL_KEYDOWN ) { switch (event.key.keysym.sym) { case SDLK_UNKNOWN: // reserved for cursor movement case SDLK_LEFT: case SDLK_RIGHT: case SDLK_UP: case SDLK_DOWN: // reserved for map scrolling case SDLK_KP1: case SDLK_KP2: case SDLK_KP3: case SDLK_KP4: case SDLK_KP6: case SDLK_KP7: case SDLK_KP8: case SDLK_KP9: Audio::PlaySfx( Audio::SND_GUI_ERROR, 0 ); break; default: AssignKey( event.key.keysym.sym ); // fall through case SDLK_ESCAPE: view->CloseWindow( request ); request = NULL; break; } } rc = GUI_OK; } else rc = GenericOptionsWindow::HandleEvent( event ); return rc; } ///////////////////////////////////////////////////////////////////////// // NAME : KeyboardOptionsWindow::WidgetActivated // DESCRIPTION: User pressed OK, leave window. // PARAMETERS : widget - calling widget // win - pointer to active window // RETURNS : GUI_CLOSE //////////////////////////////////////////////////////////////////////// GUI_Status KeyboardOptionsWindow::WidgetActivated( Widget *widget, Window *win ) { GUI_Status rc; if (widget == fncwidget) { TLWNode *n = static_cast(fncwidget->Selected()); if (n && (n->ID() == last)) request = new KeyboardPressKeyWindow( this, view ); last = n->ID(); rc = GUI_OK; } else rc = GUI_CLOSE; return rc; } //////////////////////////////////////////////////////////////////////// // NAME : KeyboardOptionsWindow::AssignKey // DESCRIPTION: Assign a key to an action. // PARAMETERS : key - key to assign to currently selected action // RETURNS : - //////////////////////////////////////////////////////////////////////// void KeyboardOptionsWindow::AssignKey( SDLKey key ) { TLWNode *node = static_cast( fncwidget->Selected() ); if ( node != NULL ) { KeyBinding bind = (KeyBinding)node->ID(); const SDLKey *keymap = CFOptions.GetKeyBindings(); switch (key) { case SDLK_DELETE: case SDLK_BACKSPACE: CFOptions.SetKeyBinding( bind, SDLK_UNKNOWN ); break; default: for (int i = 0; i < KEYBIND_COUNT; ++i) { if (keymap[i] == key) CFOptions.SetKeyBinding( (KeyBinding)i, keymap[bind] ); // avoid dupes } CFOptions.SetKeyBinding( bind, key ); break; } Audio::PlaySfx( Audio::SND_GUI_PRESSED, 0 ); RebuildKeyMap(); fncwidget->DrawNodes(); fncwidget->Show(); } } //////////////////////////////////////////////////////////////////////// // NAME : KeyboardOptionsWindow::RebuildKeyMap // DESCRIPTION: Update the list of actions to include the currently // assigned key commands. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void KeyboardOptionsWindow::RebuildKeyMap( void ) { const SDLKey *keymap = CFOptions.GetKeyBindings(); string name; functions.Clear(); for (int bind = 0; bind < KEYBIND_COUNT; ++bind) { name = MSG(MSG_OPT_KEY_MINIMIZE + bind); if (keymap[bind] != 0) { name.append(" - "); if ((keymap[bind] >= 32) && (keymap[bind] < 255)) name.append( StringUtil::strprintf("'%c'", (char)keymap[bind]) ); else if ((keymap[bind] >= SDLK_F1) && (keymap[bind] <= SDLK_F15)) name.append( StringUtil::strprintf("F%d",((int)keymap[bind] - SDLK_F1)+1) ); else name.append( StringUtil::strprintf("#%d",(int)keymap[bind]) ); } functions.AddTail(new TLWNode(name.c_str(), NULL, bind)); } } //////////////////////////////////////////////////////////////////////// // NAME : KeyboardPressKeyWindow::KeyboardPressKeyWindow // DESCRIPTION: Ask the user to press a key. All events are handed down // to the parent window. // PARAMETERS : parent - parent window // view - view to attach the window to // RETURNS : - //////////////////////////////////////////////////////////////////////// KeyboardPressKeyWindow::KeyboardPressKeyWindow( Window *parent, View *view ) : Window( WIN_CENTER, view ), parent(parent) { const char *msg = MSG(MSG_PRESS_KEY); unsigned short width = parent->Width() - 20; unsigned short height = SmallFont()->TextHeight( msg, width - 20, 2 ) + 20; SetSize( width, height ); new TextWidget( 0, 5, 5, w - 10, h - 10, msg, WIDGET_ALIGN_CENTER, NULL, this ); Draw(); Show(); } #ifndef DISABLE_SOUND //////////////////////////////////////////////////////////////////////// // NAME : SoundOptionsWindow::SoundOptionsWindow // DESCRIPTION: Show the sound options menu. // PARAMETERS : view - view to attach the window to // RETURNS : - //////////////////////////////////////////////////////////////////////// SoundOptionsWindow::SoundOptionsWindow( View *view ) : GenericOptionsWindow( MSG(MSG_OPTIONS_AUDIO), view ), volgfx( view->GetSystemIcons(), 145, 46, 12 ,12 ) { const char *sfxlabel = MSG(MSG_B_OPT_SFX); const char *musiclabel = MSG(MSG_B_OPT_MUSIC); unsigned short sfxw = sfont->TextWidth(sfxlabel); unsigned short musw = sfont->TextWidth(musiclabel); SetLayout( MAX(sfxw, musw) + DEFAULT_CBW_SIZE + volgfx.Width() + 100, view->SmallFont()->Height() * 2 + 20 ); // create widgets const Rect &b = GetBounds(); Widget *wd; // sfx wd = new CheckboxWidget( B_ID_SFX, b.x + 5, b.y + 5, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, Audio::GetSfxState(), WIDGET_STYLE_NOBORDER|WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT, sfxlabel, this ); wd->SetHook( this ); // sfx volume short xoff = wd->LeftEdge() + wd->Width() + MAX(sfxw, musw) + volgfx.Width() + 15; sfxvol = new SliderWidget( S_ID_VOL_SFX, xoff, wd->TopEdge() + (wd->Height() - DEFAULT_SLIDER_SIZE)/2, b.w - xoff - 5, DEFAULT_SLIDER_SIZE, 0, MIX_MAX_VOLUME, Audio::GetSfxVolume(), 20, WIDGET_HSCROLL|WIDGET_HSCROLLKEY| (Audio::GetSfxState() ? 0 : WIDGET_DISABLED), NULL, this ); sfxvol->SetHook( this ); // music wd = new CheckboxWidget( B_ID_MUSIC, wd->LeftEdge(), wd->TopEdge() + wd->Height() + 5, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, Audio::GetMusicState(), WIDGET_STYLE_NOBORDER|WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT, musiclabel, this ); wd->SetHook( this ); // music volume musicvol = new SliderWidget( S_ID_VOL_MUSIC, xoff, wd->TopEdge() + (wd->Height() - DEFAULT_SLIDER_SIZE)/2, b.w - xoff - 5, DEFAULT_SLIDER_SIZE, 0, MIX_MAX_VOLUME, Audio::GetMusicVolume(), 20, WIDGET_HSCROLL|WIDGET_VSCROLLKEY| (Audio::GetMusicState() ? 0 : WIDGET_DISABLED), NULL, this ); musicvol->SetHook( this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : SoundOptionsWindow::WidgetActivated // DESCRIPTION: When the user activates a widget, propagate the changes // to the sound layer. // PARAMETERS : widget - calling widget // win - pointer to active window // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status SoundOptionsWindow::WidgetActivated( Widget *widget, Window *win ) { switch ( widget->ID() ) { case B_ID_SFX: Audio::ToggleSfxState(); if ( Audio::GetSfxState() ) sfxvol->Enable(); else sfxvol->Disable(); break; case S_ID_VOL_SFX: Audio::SetSfxVolume( sfxvol->Level() ); break; case B_ID_MUSIC: Audio::ToggleMusicState(); if ( Audio::GetMusicState() ) musicvol->Enable(); else musicvol->Disable(); break; case S_ID_VOL_MUSIC: Audio::SetMusicVolume( musicvol->Level() ); break; case B_ID_OK: view->CloseWindow( this ); break; default: break; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : SoundOptionsWindow::Draw // DESCRIPTION: Draw the sound options window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void SoundOptionsWindow::Draw( void ) { GenericOptionsWindow::Draw(); short xoff = sfxvol->LeftEdge() - volgfx.Width() - 5; volgfx.Draw( this, xoff, sfxvol->TopEdge() + (sfxvol->Height() - volgfx.Height())/2 ); volgfx.Draw( this, xoff, musicvol->TopEdge() + (musicvol->Height() - volgfx.Height())/2 ); } #endif // !DISABLE_SOUND #ifndef DISABLE_NETWORK //////////////////////////////////////////////////////////////////////// // NAME : NetworkSetupWindow::NetworkSetupWindow // DESCRIPTION: Ask user for network parameters. If we are hosting the // game, ask for the local port to use, otherwise ask for // server address/name and port. // PARAMETERS : server - whether we are the host, or the client // view - view to add window to // RETURNS : - //////////////////////////////////////////////////////////////////////// NetworkSetupWindow::NetworkSetupWindow( bool server, View *view ) : Window( WIN_CENTER, view ), server(server), connecting(false), address(NULL), port(NULL), title(MSG(server ? MSG_NET_CONFIG_SERVER : MSG_NET_CONFIG_CLIENT)), title_width(lfont->TextWidth(title)) { const char *ip_label = MSG(MSG_B_SERVER); const char *port_label = MSG(MSG_B_PORT); unsigned short width, height, wdx, wdy, wdh; wdy = lfont->Height() + 15; wdh = sfont->Height() + 8; wdx = sfont->TextWidth( port_label ); width = sfont->Width() * 5 + 25; height = lfont->Height() + wdh * 2 + 30; if (!server) { unsigned short iplen = sfont->TextWidth( ip_label ); wdx = MAX( wdx, iplen ); width += sfont->Width() * 10; height += wdh; } width += MAX( title_width, wdx ); width = MIN( width, view->Width() - 20 ); SetSize( width, height ); wdx += 10; if (!server) { address = new StringWidget( 0, wdx, wdy, w - wdx - 15, wdh, CFOptions.GetRemoteName(), 40, WIDGET_ALIGN_LEFT, ip_label, this ); wdy += address->Height() + 5; } port = new NumberWidget( 0, wdx, wdy, sfont->Width() * 5 + 20, wdh, server ? CFOptions.GetLocalPort() : CFOptions.GetRemotePort(), 1, 65536, WIDGET_ALIGN_LEFT, port_label, this ); Widget *ok = new ButtonWidget( 0, 1, h - wdh - 1, (w - 2) / 2, wdh, WIDGET_DEFAULT, MSG(MSG_B_OK), this ); ok->SetHook( this ); new ButtonWidget( GUI_CLOSE, ok->LeftEdge() + ok->Width() + 1, ok->TopEdge(), ok->Width(), wdh, 0, MSG(MSG_B_CANCEL), this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : NetworkSetupWindow::~NetworkSetupWindow // DESCRIPTION: Destroy the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// NetworkSetupWindow::~NetworkSetupWindow( void ) { if ( connecting ) { delete address; delete port; } } //////////////////////////////////////////////////////////////////////// // NAME : NetworkSetupWindow::SetConnecting // DESCRIPTION: Set current status - whether we are waiting for user // input or connecting to remote peer. // PARAMETERS : connect - currently trying to connect to peer? // RETURNS : - //////////////////////////////////////////////////////////////////////// void NetworkSetupWindow::SetConnecting( bool connect ) { if (connect == connecting) return; connecting = connect; unsigned short wdh = sfont->Height() + 8; if (connecting) { if ( address ) RemoveWidget( address ); RemoveWidget( port ); RemoveAllWidgets(); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, 0, MSG(MSG_B_CANCEL), this ); } else { RemoveAllWidgets(); Widget *ok = new ButtonWidget( 0, 1, h - wdh - 1, (w - 2) / 2, wdh, WIDGET_DEFAULT, MSG(MSG_B_OK), this ); ok->SetHook( this ); new ButtonWidget( GUI_CLOSE, ok->LeftEdge() + ok->Width() + 1, ok->TopEdge(), ok->Width(), ok->Height(), 0, MSG(MSG_B_CANCEL), this ); if ( address ) AddWidget( address ); AddWidget( port ); } Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : NetworkSetupWindow::Draw // DESCRIPTION: Draw the network configuration window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void NetworkSetupWindow::Draw( void ) { Window::Draw(); const Rect box( 5, lfont->Height() + 10, w - 10, h - lfont->Height() - sfont->Height() - 22 ); DrawBox( box, BOX_RECESSED ); short xpos = (w - title_width) / 2; lfont->Write( title, this, xpos + 3, 8, view->GetBGPen() ); lfont->Write( title, this, xpos, 5, view->GetFGPen() ); if (connecting) { const char *connect = MSG( server ? MSG_NET_WAITING_CLIENT : MSG_NET_CONNECTING ); sfont->Write( connect, this, (w - sfont->TextWidth( connect )) / 2, box.y + (box.h - sfont->Height()) / 2 ); } } //////////////////////////////////////////////////////////////////////// // NAME : NetworkSetupWindow::WidgetActivated // DESCRIPTION: When the user pushes the 'OK' button, check whether we // have the necessary information. // PARAMETERS : button - calling widget // win - pointer to active window // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status NetworkSetupWindow::WidgetActivated( Widget *button, Window *win ) { GUI_Status rc = GUI_OK; if ((!server && (address->String() == NULL)) || (port->String() == NULL)) { Audio::PlaySfx( Audio::SND_GUI_ERROR, 0 ); } else { if ( server ) { CFOptions.SetLocalPort( port->Number() ); } else { CFOptions.SetRemoteName( address->String() ); CFOptions.SetRemotePort( port->Number() ); } rc = (GUI_Status)button->ID(); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : NetworkSetupWindow::Cancelled // DESCRIPTION: Check whether the user clicked the 'Cancel' button. // PARAMETERS : - // RETURNS : TRUE if button was activated, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool NetworkSetupWindow::Cancelled( void ) { GUI_Status peek; bool abort = false; do { SDL_Event event; peek = view->PeekEvent( event ); if ( (peek != GUI_NONE) && (HandleEvent( event ) == GUI_CLOSE) ) abort = true; } while ( peek != GUI_NONE ); return abort; } #endif // !DISABLE_NETWORK crimson-0.5.2.orig/src/cf/initwindow.h0000600000175000017500000001234610554366466016051 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // initwindow.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_INITWINDOW_H #define _INCLUDE_INITWINDOW_H #include "window.h" #include "textbox.h" #include "button.h" #include "mapwindow.h" #include "network.h" class TitleWindow : public Window { public: TitleWindow( View *view ); GUI_Status HandleEvent( const SDL_Event &event ); void Draw( void ) {} }; class InitWindow : public Window, public WidgetHook { public: InitWindow( View *view, Window *title ); ~InitWindow( void ); void Close( void ) { Window::Close(); view->CloseWindow(title); } GUI_Status WidgetActivated( Widget *button, Window *win ); void VideoModeChange( void ); private: void CompleteFilesList( TLWList &list ); Mission *LoadMission( const char *filename, bool full = true ) const; GUI_Status StartGame( const char *filename ); void Rebuild( void ); short AskForSide( Mission &m ) const; CycleWidget *gtypewidget; CycleWidget *mtypewidget; CycleWidget *diffwidget; TextListWidget *levwidget; MapWidget *mapwidget; TextScrollWidget *campinfowidget; Rect maxmap; TLWList levels; TLWList campaigns; TLWList saves; Window *title; }; class GenericOptionsWindow : public Window, public WidgetHook { public: GenericOptionsWindow( const char *title, View *view ) : Window( WIN_CENTER, view ), title(title) {} virtual void Draw( void ); protected: virtual GUI_Status WidgetActivated( Widget *widget, Window *win ) = 0; void SetLayout( unsigned short w, unsigned short h ); const Rect &GetBounds( void ) const { return clientarea; } enum { B_ID_OK = 1 }; private: Rect clientarea; // the part subclasses may draw into const char *title; }; class GeneralOptionsWindow : public GenericOptionsWindow { public: GeneralOptionsWindow( MapView *mv, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); CheckboxWidget *diwidget; // damage indicators CheckboxWidget *repwidget; // turn replays CheckboxWidget *qrepwidget; // quick turn replays MapView *mv; }; class VideoOptionsWindow : public GenericOptionsWindow { public: VideoOptionsWindow( View *view ); ~VideoOptionsWindow( void ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); short AddMode( SDL_Rect *res ); TextListWidget *modewidget; CheckboxWidget *fswidget; List modes; }; class Game; class LocaleOptionsWindow : public GenericOptionsWindow { public: LocaleOptionsWindow( Game *game, View *view ); ~LocaleOptionsWindow( void ); private: GUI_Status WidgetActivated( Widget *widget, Window *win ); short ReadLocales( void ); TLWList locales; TextListWidget *locwidget; Game *game; }; class KeyboardOptionsWindow : public GenericOptionsWindow { public: KeyboardOptionsWindow( View *view ); private: GUI_Status HandleEvent( const SDL_Event &event ); GUI_Status WidgetActivated( Widget *widget, Window *win ); void AssignKey( SDLKey key ); void RebuildKeyMap( void ); TextListWidget *fncwidget; List functions; int last; Window *request; }; class KeyboardPressKeyWindow : public Window { public: KeyboardPressKeyWindow( Window *parent, View *view ); GUI_Status HandleEvent( const SDL_Event &event ) { return parent->HandleEvent( event ); } private: Window *parent; }; # ifndef DISABLE_SOUND class SoundOptionsWindow : public GenericOptionsWindow { public: SoundOptionsWindow( View *view ); void Draw( void ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_SFX = 10, B_ID_MUSIC, S_ID_VOL_SFX, S_ID_VOL_MUSIC }; SliderWidget *sfxvol; SliderWidget *musicvol; Image volgfx; }; # endif #ifndef DISABLE_NETWORK class NetworkSetupWindow : public Window, public WidgetHook, public UserActionHook { public: NetworkSetupWindow( bool server, View *view ); ~NetworkSetupWindow( void ); void Draw( void ); void SetConnecting( bool connect ); bool IsServer( void ) const { return server; } bool Cancelled( void ); const char *GetServer( void ) const { return address->String(); } const unsigned short GetPort( void ) const { return port->Number(); } private: GUI_Status WidgetActivated( Widget *button, Window *win ); bool server; bool connecting; StringWidget *address; NumberWidget *port; const char *title; unsigned short title_width; }; #endif #endif /* _INCLUDE_INITWINDOW_H */ crimson-0.5.2.orig/src/cf/main.cpp0000600000175000017500000004440710554366412015127 0ustar uweuwe// Crimson Fields -- a hex-based game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ///////////////////////////////////////////////////////////////////// // main.cpp -- Crimson Fields ///////////////////////////////////////////////////////////////////// #include #include #include #include #ifdef _WIN32_WCE # define time(n) GetTickCount() #else # include #endif #include "SDL.h" #include "view.h" #include "game.h" #include "misc.h" #include "fileio.h" #include "initwindow.h" #include "globals.h" #include "sound.h" #include "options.h" #include "strutil.h" #include "msgs.h" #include "network.h" #include "platform.h" // global vars Game *Gam; Image *Images[NUM_IMAGES] = { NULL }; Language Lang; // global options, can be accessed from everywhere Options CFOptions; // local vars static View *display; // local function prototypes static void parse_options( int argc, char **argv, GUIOptions &opts ); static void print_usage( char *prog ); static View *init( GUIOptions &opts ); static bool init_locale( void ); static void load_settings( GUIOptions &opts ); static void save_settings( View *display ); static void set_icon( const Surface &s, const Rect &icon ); static GUI_Status event_filter( SDL_Event &event, Window *window ); static void do_exit( void ); // Start of program functions ////////////////////////////////////////// #ifdef _MSC_VER int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR szCmdLine, int sw) { int argc = __argc; char **argv = __argv; #else int main( int argc, char **argv ) { #endif struct GUIOptions guiopts = { DEFAULT_RESOLUTION, DISPLAY_BPP, true, true, MIX_MAX_VOLUME*3/4, MIX_MAX_VOLUME/2, SDL_HWSURFACE, NULL }; load_settings( guiopts ); if ( !platform_init( guiopts ) ) return 0; parse_options( argc, argv, guiopts ); display = init( guiopts ); if ( display && platform_setup( display ) ) { // only open intro screen if the user didn't supply a level on the command line int intro = 1; if ( guiopts.level ) { Gam = new Game( display ); intro = Gam->Load( guiopts.level ); Mission *m = Gam->GetMission(); if ( !intro ) { // default is to play single-player single-map if ( !(m->GetFlags() & GI_SAVEFILE) ) m->GetPlayer(PLAYER_ONE).SetType( HUMAN ); Gam->InitWindows(); Gam->StartTurn(); } else { delete Gam; Gam = NULL; intro = 1; } } GUI_Status status; do { if ( intro ) { display->Refresh(); TitleWindow *twin = new TitleWindow( display ); // preload main window, levels, etc. InitWindow *iwin = new InitWindow( display, twin ); // if title image was successfully loaded, wait for click if ( twin->Width() > 0 ) { display->SelectWindow( twin ); twin->EventLoop(); display->SelectWindow( iwin ); } iwin->Show(); } else intro = 1; do { status = display->HandleEvents(); } while ( (status != GUI_QUIT) && (status != GUI_RESTART) ); delete Gam; Gam = NULL; display->CloseAllWindows(); } while ( status != GUI_QUIT ); } do_exit(); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : parse_options // DESCRIPTION: Process any options given to the program on the command // line. // PARAMETERS : argc - argument count // argv - pointer to array of arguments // opts - buffer to store GUI and audio options; should be // initialized with defaults before calling this // method // RETURNS : - //////////////////////////////////////////////////////////////////////// static void parse_options( int argc, char **argv, GUIOptions &opts ) { while ( argc > 1 ) { --argc; if (strcmp(argv[argc-1], "--width") == 0) { opts.px_width = atoi(argv[argc]); } else if (strcmp(argv[argc-1], "--height") == 0) { opts.px_height = atoi(argv[argc]); } else if (strcmp(argv[argc-1], "--level") == 0) { opts.level = argv[argc]; } else if (strcmp(argv[argc-1], "--fullscreen") == 0) { if ( atoi( argv[argc] ) ) opts.sdl_flags |= SDL_FULLSCREEN; else opts.sdl_flags &= ~SDL_FULLSCREEN; } else if (strcmp(argv[argc-1], "--sound") == 0) { if ( atoi( argv[argc] ) ) opts.sfx = opts.music = true; else opts.sfx = opts.music = false; } else { if (strcmp(argv[argc], "--version") == 0) cout << PROGRAMNAME" "VERSION << endl; else print_usage( argv[0] ); exit ( 0 ); } --argc; } if ( opts.px_width < MIN_XRES ) opts.px_width = MIN_XRES; if ( opts.px_height < MIN_YRES ) opts.px_height = MIN_YRES; } //////////////////////////////////////////////////////////////////////// // NAME : print_usage // DESCRIPTION: Print a usage message to stdout. // PARAMETERS : prog - program name as given on the command line // RETURNS : - //////////////////////////////////////////////////////////////////////// static void print_usage( char *prog ) { cout << "Usage: " << prog << " [options]" << endl << endl << "Available options:" << endl << " --level load level or save file" << endl << " --width set screen width" << endl << " --height set screen height" << endl << " --fullscreen <1|0> enable/disable fullscreen mode" << endl #ifndef DISABLE_SOUND << " --sound <1|0> enable/disable sound" << endl #endif << " --help display this help and exit" << endl << " --version output version information and exit" << endl; } //////////////////////////////////////////////////////////////////////// // NAME : init // DESCRIPTION: Initialize the display, the system icons surface and the // game fonts. // PARAMETERS : opts - contains the user settings for the sound and // graphics subsystems // RETURNS : a pointer to the display surface on success, NULL // otherwise //////////////////////////////////////////////////////////////////////// static View *init( GUIOptions &opts ) { View *view = NULL; Font *f1 = NULL, *f2 = NULL; Surface *icons = NULL; bool ok = false; if ( SDL_Init( SDL_INIT_VIDEO ) >= 0 ) { // load locale if ( !init_locale() ) return NULL; string datpath( get_data_dir() ); datpath.append( CF_DATFILE ); File datfile( datpath ); if ( datfile.Open( "rb" ) ) { icons = new Surface; // load icons surface if ( !icons->LoadImageData( datfile ) ) { set_icon( *icons, Rect(64, 0, 32, 32) ); view = new View( opts.px_width, opts.px_height, opts.bpp, opts.sdl_flags ); if ( view->s_surface && !TTF_Init()) { // load fonts int smallsize, largesize; // use smaller fonts on small displays to prevent text clipping if ((opts.px_width <= 240) || (opts.px_height <= 320)) { smallsize = CF_FONT_LOWRES_SMALL; largesize = CF_FONT_LOWRES_LARGE; } else { smallsize = CF_FONT_SMALL; largesize = CF_FONT_LARGE; } datpath = get_data_dir() + CF_FONT; f1 = new Font(); f2 = new Font(); if ( !f1->Load( datpath.c_str(), smallsize ) && !f2->Load( datpath.c_str(), largesize ) ) ok = true; else cerr << "Error: Couldn't load font " << datpath << endl; } else cerr << "Error: Couldn't set video mode (" << SDL_GetError() << ')' << endl; } else cerr << "Error: Couldn't read data file" << endl; } else cerr << "Error: Couldn't open " << datpath << endl; } else cerr << "Error: Couldn't initialize ( " << SDL_GetError() << ')' << endl; if ( ok ) { // set main window title SDL_WM_SetCaption( PROGRAMNAME, PROGRAMNAME ); SDL_EnableKeyRepeat( SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL ); srand( time(0) ); // initialize random number generator Audio::InitSfx( opts.sfx, opts.sfx_vol ); // load sound effects Audio::InitMusic( opts.music, opts.music_vol ); Network::Init(); // initialize networking subsystem for ( int i = 0; i <= XP_MAX_LEVEL; ++i ) Images[ICON_XP_BASE+i] = new Image( icons, 64 + i * XP_ICON_WIDTH, 32, XP_ICON_WIDTH, XP_ICON_HEIGHT ); icons->DisplayFormat(); view->SetSmallFont( f1 ); view->SetLargeFont( f2 ); view->SetFGPen( Color(CF_COLOR_HIGHLIGHT) ); view->SetBGPen( Color(CF_COLOR_SHADOW) ); view->SetEventFilter( event_filter ); view->SetSystemIcons( icons ); // create options and save games directories if possible create_config_dir(); return view; } else { delete icons; delete view; delete f1; delete f2; return NULL; } } //////////////////////////////////////////////////////////////////////// // NAME : init_locale // DESCRIPTION: Load the strings from a file. // PARAMETERS : - // RETURNS : TRUE on success, FALSE otherwise //////////////////////////////////////////////////////////////////////// static bool init_locale( void ) { bool rc = false, retry = false; const string ldir( get_locale_dir() ); string lid( CFOptions.GetLanguage() ); // try the user locale first, and use the default if that fails do { string lfile( ldir + lid + ".dat" ); short num = Lang.ReadCatalog( lfile.c_str() ); if ( num == -1 ) { cerr << "Error: Couldn't load language resources for language '" << lid << "'" << endl; } else if ( num != CF_MSGS ) { cerr << "Error: Language catalog for '" << lid << "' contains " << num << " strings, expected " << CF_MSGS << endl; } else rc = true; // only retry once if ( (rc == false) && (retry == false) && (lid != CF_LANG_DEFAULT) ) { lid.assign( CF_LANG_DEFAULT ); cerr << "Using default locale (" << lid << ") instead" << endl; retry = true; } else { retry = false; if ( rc == true ) { // change the language setting if necessary if ( lid != CFOptions.GetLanguage() ) CFOptions.SetLanguage( lid.c_str() ); } } } while ( retry ); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : load_settings // DESCRIPTION: Read default display settings from the crimsonrc file. // PARAMETERS : opts - buffer to store the settings. These should // already be initialized with some defaults in // case the rc file doesn't exist or this function // fails. // RETURNS : - //////////////////////////////////////////////////////////////////////// static void load_settings( GUIOptions &opts ) { string crimsonrc( get_config_dir() ); crimsonrc.append( CRIMSONRC ); ifstream file( crimsonrc.c_str() ); if ( file.is_open() ) { string buf; const char *val, *linebuf; unsigned int line = 0; size_t pos; while (!file.eof()) { getline(file, buf); ++line; if ( buf.size() > 0 ) { // ignore empty lines pos = buf.find( ' ' ); if ( pos != string::npos ) { linebuf = buf.c_str(); val = &linebuf[pos+1]; while ( *val == ' ' ) ++val; if ( !strncmp( linebuf, "width", 5 ) ) opts.px_width = atoi(val); else if ( !strncmp( linebuf, "height", 6 ) ) opts.px_height = atoi(val); else if ( !strncmp( linebuf, "fullscreen", 10 ) ) { if ( atoi(val) != 0 ) opts.sdl_flags |= SDL_FULLSCREEN; } else if ( !strncmp( linebuf, "sfxvol", 6 ) ) opts.sfx_vol = atoi(val); else if ( !strncmp( linebuf, "musicvol", 8 ) ) opts.music_vol = atoi(val); else if ( !strncmp( linebuf, "sfx", 3 ) ) opts.sfx = (atoi(val) != 0); else if ( !strncmp( linebuf, "music", 5 ) ) opts.music = (atoi(val) != 0); else if ( !strncmp( linebuf, "locale", 6 ) ) CFOptions.SetLanguage(val); else if ( !strncmp( linebuf, "showdamage", 10 ) ) CFOptions.SetDamageIndicator( atoi(val) != 0 ); else if ( !strncmp( linebuf, "unlock", 6 ) ) CFOptions.Unlock( val ); else if ( !strncmp( linebuf, "listen", 6 ) ) CFOptions.SetLocalPort( atoi(val) ); else if ( !strncmp( linebuf, "showreplay", 10 ) ) { int rep = atoi(val); CFOptions.SetTurnReplay( rep != 0 ); CFOptions.SetQuickReplay( rep == 1 ); } else if ( !strncmp( linebuf, "server", 6 ) ) { pos = buf.find( ':', val - linebuf ); if ( pos != string::npos ) { buf[pos] = '\0'; CFOptions.SetRemotePort( atoi(&linebuf[pos+1]) ); } CFOptions.SetRemoteName( val ); } else if ( !strncmp( linebuf, "keymap", 6 ) ) { SDLKey key; char *endptr; for (int i = 0; i < KEYBIND_COUNT && *val; ++i) { key = (SDLKey)strtoul( val, &endptr, 10 ); if ((endptr == NULL) || (*endptr != ';')) break; CFOptions.SetKeyBinding( (KeyBinding)i, key ); val = endptr + 1; } } else cerr << "Warning: unrecognized config option in line " << line << endl; } } } file.close(); } } //////////////////////////////////////////////////////////////////////// // NAME : save_settings // DESCRIPTION: Save current display settings to the crimsonrc file. // PARAMETERS : display - pointer to display // RETURNS : - //////////////////////////////////////////////////////////////////////// static void save_settings( View *display ) { const SDLKey *keymap = CFOptions.GetKeyBindings(); string crimsonrc( get_config_dir() ); crimsonrc.append( CRIMSONRC ); ofstream file( crimsonrc.c_str() ); if ( file.is_open() ) { file << "width " << display->Width() << '\n'; file << "height " << display->Height() << '\n'; file << StringUtil::strprintf("fullscreen %d", display->IsFullScreen()) << '\n'; file << StringUtil::strprintf("sfx %d", Audio::GetSfxState()) << '\n'; file << StringUtil::strprintf("music %d", Audio::GetMusicState()) << '\n'; file << StringUtil::strprintf("sfxvol %d", Audio::GetSfxVolume()) << '\n'; file << StringUtil::strprintf("musicvol %d", Audio::GetMusicVolume()) << '\n'; file << "locale " << CFOptions.GetLanguage() << '\n'; file << StringUtil::strprintf("showdamage %d", CFOptions.GetDamageIndicator()) << '\n'; file << StringUtil::strprintf("showreplay %d", CFOptions.GetTurnReplay() ? (CFOptions.GetQuickReplay() ? 1 : 2) : 0 ) << '\n'; if ( CFOptions.GetRemoteName() ) { file << StringUtil::strprintf( StringUtil::strprintf("server %s:%d", CFOptions.GetRemotePort()), CFOptions.GetRemoteName()) << '\n'; } file << StringUtil::strprintf("listen %d", CFOptions.GetLocalPort()) << '\n'; file << "keymap "; for (int i = 0; i < KEYBIND_COUNT; ++i) file << keymap[i] << ';'; file << '\n'; const vector &maps = CFOptions.GetUnlockedMaps(); for ( vector::const_iterator i = maps.begin(); i != maps.end(); ++i ) file << "unlock " << *i << '\n'; file.close(); } } //////////////////////////////////////////////////////////////////////// // NAME : set_icon // DESCRIPTION: Set the application icon. // PARAMETERS : s - icon surface // icon - icon position and size on the surface // RETURNS : - //////////////////////////////////////////////////////////////////////// static void set_icon( const Surface &s, const Rect &icon ) { Surface is; is.Create( icon.Width(), icon.Height(), DISPLAY_BPP, 0 ); is.SetColorKey( s.GetColorKey() ); is.Flood( is.GetColorKey() ); s.Blit( &is, icon, 0, 0 ); SDL_WM_SetIcon( is.s_surface, NULL ); } //////////////////////////////////////////////////////////////////////// // NAME : event_filter // DESCRIPTION: This is the global event filter function. It is hooked // to the display and called everytime the event handler // receives an event. // PARAMETERS : event - event received by the event handler // window - pointer to the currently active window // RETURNS : GUI_Status; if the filter returns GUI_NONE the event // handler will not pass the event to its windows, but // silently drop it. //////////////////////////////////////////////////////////////////////// static GUI_Status event_filter( SDL_Event &event, Window *window ) { GUI_Status rc = GUI_OK; if ( event.type == SDL_KEYDOWN ) { rc = GUI_NONE; switch ( event.key.keysym.sym ) { case SDLK_F11: // toggle sound Audio::ToggleSfxState(); break; default: if ( event.key.keysym.sym == CFOptions.GetKeyBindings()[KEYBIND_MINIMIZE] ) SDL_WM_IconifyWindow(); else rc = GUI_OK; // send to windows } } else if ( event.type == SDL_QUIT ) do_exit(); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : do_exit // DESCRIPTION: Free all resources and exit the program. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// static void do_exit( void ) { delete Gam; platform_dispose(); if ( display ) { save_settings( display ); delete display; } Network::Shutdown(); Audio::ShutdownSfx(); Audio::ShutdownMusic(); for ( int i = 0; i < NUM_IMAGES; ++i ) delete Images[i]; TTF_Quit(); SDL_Quit(); platform_shutdown(); exit( 0 ); } crimson-0.5.2.orig/src/cf/map.cpp0000600000175000017500000003116010554366412014750 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // map.cpp //////////////////////////////////////////////////////////////////////// #include "map.h" //////////////////////////////////////////////////////////////////////// // NAME : Map::Map // DESCRIPTION: Create a new map instance and initialize data. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Map::Map( void ) { m_data = NULL; m_objects = NULL; } //////////////////////////////////////////////////////////////////////// // NAME : Map::~Map // DESCRIPTION: Free memory allocated by the map structure. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Map::~Map( void ) { delete [] m_data; delete [] m_objects; } //////////////////////////////////////////////////////////////////////// // NAME : Map::Load // DESCRIPTION: Initialize the map structure. // PARAMETERS : file - descriptor of an opened data file from which to // read the map data // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int Map::Load( MemBuffer &file ) { m_w = file.Read16(); m_h = file.Read16(); unsigned short size = m_w * m_h; m_data = new short [size]; m_objects = new MapObject * [size]; // terrain types are loaded from a level set for ( int i = 0; i < size; ++i ) { m_data[i] = file.Read16(); m_objects[i] = NULL; } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Map::Save // DESCRIPTION: Save the current map status to a file. Only the terrain // type information is saved for each hex. Other data // (units, buildings...) must be stored separately. // PARAMETERS : file - descriptor of the save file // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int Map::Save( MemBuffer &file ) const { int rc; file.Write16( m_w ); rc = file.Write16( m_h ); unsigned short size = m_w * m_h; for ( int i = 0; i < size && !rc; ++i ) rc = file.Write16( m_data[i] ); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Map::GetNeighbors // DESCRIPTION: Get the hex coordinates of all hexes surrounding a hex. // PARAMETERS : hex - hex to get neighbors for // parray - pointer to an array of at least six Points to // hold the neighbors' coordinates. Each neighbor // will be put in the slot corresponding to the // direction the hex is in (e.g. the hex north of // the source hex will reside in parray[NORTH]). // If there is no valid neighbor (because the map // ends here), the respective Points will contain // {-1, -1} // RETURNS : number of adjacent hexes found //////////////////////////////////////////////////////////////////////// short Map::GetNeighbors( const Point &hex, Point *parray ) const { short num = 0; for ( int i = NORTH; i <= NORTHWEST; ++i ) { if ( !Dir2Hex( hex, (Direction)i, parray[i] ) ) ++num; else parray[i].x = parray[i].y = -1; } return num; } //////////////////////////////////////////////////////////////////////// // NAME : Map::Dir2Hex // DESCRIPTION: Get the coordinates of the hex we'll be on when we move // in a given direction from another hex. // PARAMETERS : hex - source hex // dir - direction to move in // dest - pointer to a Point to hold the coordinates of the // destination hex // RETURNS : 0 on success, -1 on error (the contents of the Point can // not be relied on in this case) //////////////////////////////////////////////////////////////////////// int Map::Dir2Hex( const Point &hex, Direction dir, Point &dest ) const { short x = hex.x, y = hex.y; switch ( dir ) { case NORTH: --y; break; case SOUTH: ++y; break; case NORTHEAST: if ( !(x & 1) ) --y; // fall through... case EAST: ++x; break; case SOUTHEAST: if ( x & 1 ) ++y; ++x; break; case SOUTHWEST: if ( x & 1 ) ++y; // fall through... case WEST: --x; break; case NORTHWEST: if ( !(x & 1) ) --y; --x; } dest = Point( x, y ); if ( !Contains( dest ) ) return -1; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Map::Contains // DESCRIPTION: Check whether a hex with the given coordinates exists // on the map. // PARAMETERS : hex - hex position // RETURNS : true if the coordinates denote a valid hex, false // otherwise //////////////////////////////////////////////////////////////////////// bool Map::Contains( const Point &hex ) const { return( (hex.x >= 0) && (hex.x < Width()) && (hex.y >= 0) && (hex.y < Height()) ); } //////////////////////////////////////////////////////////////////////// // NAME : Map::GetUnit // DESCRIPTION: Get a unit from the map. // PARAMETERS : hex - hex position // RETURNS : the unit at the given coordinates, or NULL if no unit // was found there //////////////////////////////////////////////////////////////////////// Unit *Map::GetUnit( const Point &hex ) const { MapObject *o = GetMapObject( hex ); if ( o && o->IsUnit() ) return static_cast(o); return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : Map::SetUnit // DESCRIPTION: Put a unit on the map. Also sets the unit parameters // according to the new position. // PARAMETERS : u - unit (may be NULL) // pos - hex position // RETURNS : 1 if a building was conquered, 0 otherwise //////////////////////////////////////////////////////////////////////// short Map::SetUnit( Unit *u, const Point &pos ) { short conquer = 0; short x = pos.x, y = pos.y; if ( (x >= 0) && (y >= 0) ) { if ( u ) { u->SetPosition( x, y ); Transport *local = static_cast(GetUnit( pos )); if ( local ) { // move into transport if ( u->IsDummy() ) u->SetFlags( U_SHELTERED ); else local->InsertUnit( u ); } else { Building *b = GetBuilding( pos ); if ( b ) { // move unit into building if ( u->IsDummy() ) u->SetFlags( U_SHELTERED ); else { conquer = b->InsertUnit( u ); if ( conquer == 1 ) { // building conquered // exchange the building entrance short hextype = HexTypeID(pos), newhex; if ( b->Owner() ) newhex = hextype + u->Owner()->ID() - b->Owner()->ID(); else newhex = hextype + u->Owner()->ID() - PLAYER_NONE; SetHexType( x, y, newhex ); b->SetOwner( u->Owner() ); } } } else { if ( u->IsGround() ) { if ( IsWater( pos ) ) u->SetFlags( U_FLOATING ); else u->UnsetFlags( U_FLOATING ); } m_objects[Hex2Index(pos)] = u; } } } else m_objects[Hex2Index(pos)] = u; } return conquer; } //////////////////////////////////////////////////////////////////////// // NAME : Map::GetBuilding // DESCRIPTION: Get a building from the map. // PARAMETERS : pos - hex position // RETURNS : the building at the given coordinates, or NULL if no // building was found there //////////////////////////////////////////////////////////////////////// Building *Map::GetBuilding( const Point &pos ) const { MapObject *o = GetMapObject( pos ); if ( o && o->IsShop() ) return static_cast(o); return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : Map::HexColor // DESCRIPTION: Get the color of a hex for the overview map. // PARAMETERS : xy - hex index (y * map_height + x) // RETURNS : hex color //////////////////////////////////////////////////////////////////////// unsigned long Map::HexColor( unsigned short xy ) const { return( tset->GetTerrainInfo(m_data[xy])->tt_color ); } //////////////////////////////////////////////////////////////////////// // NAME : Map::HexType // DESCRIPTION: Get some info about a hex. // PARAMETERS : hex - hex position // RETURNS : terrain type information //////////////////////////////////////////////////////////////////////// const TerrainType *Map::HexType( const Point &hex ) const { return tset->GetTerrainInfo(HexTypeID(hex)); } //////////////////////////////////////////////////////////////////////// // NAME : Map::MoveCost // DESCRIPTION: Calculate the number of movement points a certain unit // requires to go to a given adjacent hex. // PARAMETERS : u - unit to calculate cost for // src - from position; this field must be a neighbour // of the destination hex, otherwise the return // value is undefined. // dst - to position // state - indicator for special move attributes; // normally 0; 1 if move ends in building or // transport or on hex blocked by enemy unit(s) // RETURNS : movement cost in points; -1 means unit cannot enter hex // at all //////////////////////////////////////////////////////////////////////// signed char Map::MoveCost( const Unit *u, const Point &src, const Point &dst, unsigned short &state ) const { signed char cost; const TerrainType *type = HexType( dst ); bool hexok = (type->tt_type & u->Terrain()) != 0; state = 0; Unit *block = GetUnit( dst ); if ( block ) { if ( block->IsTransport() && static_cast(block)->Allow(u) ) { if ( !u->IsSheltered() ) { cost = MCOST_MIN; state = 1; } else cost = MCOST_UNIT; } else cost = (hexok ? MCOST_UNIT : -1); } else { Building *bld; if ( u->IsAircraft() || u->IsMine() ) cost = MCOST_MIN; else cost = type->tt_move; if ( !hexok ) cost = -1; else if ( (bld = GetBuilding( dst )) ) { if ( !bld->Allow(u) ) cost = -1; else if ( u->IsSheltered() ) cost = MCOST_UNIT; else state = 1; } else { // Is the path blocked? This is the case if the unit slips through // between two enemy units, or one enemy unit and impassable terrain. // This results in movement cost equal to the unit's remaining points. Direction dir = Hex2Dir( src, dst ); short narrow = 0, foenear = 0; Point p; if ( !Dir2Hex( src, TurnLeft(dir), p ) ) { block = GetUnit( p ); if ( block && (block->Owner() != u->Owner()) ) ++foenear; else if ( !(TerrainTypes(p) & u->Terrain()) ) ++narrow; } else ++narrow; if ( narrow || foenear ) { if ( !Dir2Hex( src, TurnRight(dir), p ) ) { block = GetUnit( p ); if ( block && (block->Owner() != u->Owner()) ) ++foenear; else if ( !(TerrainTypes(p) & u->Terrain()) ) ++narrow; } else ++narrow; if ( (foenear > 1) || ((foenear == 1) && (narrow > 0)) ) state = 1; // blocked } } } return cost; } //////////////////////////////////////////////////////////////////////// // NAME : Map::Index2Hex // DESCRIPTION: Turn a hex index back into a Point. // PARAMETERS : index - hex index // RETURNS : hex coordinates (-1/-1 on invalid index) //////////////////////////////////////////////////////////////////////// Point Map::Index2Hex( int index ) const { Point p(-1, -1); if ( index >= 0 ) { p.x = index % Width(); p.y = index / Width(); if ( (p.x >= Width()) || (p.y >= Height()) ) return Point(-1, -1); } return p; } crimson-0.5.2.orig/src/cf/map.h0000600000175000017500000000670210554366466014432 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // map.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_MAP_H #define _INCLUDE_MAP_H #include "hexsup.h" #include "rect.h" #include "unit.h" #include "building.h" #include "list.h" #include "misc.h" #include "lset.h" #define MCOST_UNIT 20 // theoretical cost to cross a hex occupied by another unit // must be higher than the maximum unit speed class Map { public: Map( void ); ~Map( void ); void SetUnitSet( UnitSet *set ) { uset = set; } UnitSet *GetUnitSet( void ) const { return uset; } void SetTerrainSet( TerrainSet *set ) { tset = set; } TerrainSet *GetTerrainSet( void ) const { return tset; } int Load( MemBuffer &file ); int Save( MemBuffer &file ) const; unsigned short Width( void ) const { return m_w; } unsigned short Height( void ) const { return m_h; } Unit *GetUnit( const Point &pos ) const; short SetUnit( Unit *u, const Point &pos ); Building *GetBuilding( const Point &pos ) const; void SetBuilding( Building *b, const Point &pos ) { m_objects[Hex2Index(pos)] = b; } MapObject *GetMapObject( const Point &hex ) const { return m_objects[Hex2Index(hex)]; } short AttackMod( const Point &hex ) const { return( HexType(hex)->tt_att_mod ); } short DefenceMod( const Point &hex ) const { return( HexType(hex)->tt_def_mod ); } const TerrainType *HexType( const Point &hex ) const; short HexTypeID( const Point &hex ) const { return m_data[Hex2Index(hex)]; } short HexImage( const Point &hex ) const { return( HexType(hex)->tt_image ); } signed char MoveCost( const Point &hex ) const { return( HexType(hex)->tt_move ); } signed char MoveCost( const Unit *u, const Point &src, const Point &dst, unsigned short &state ) const; unsigned short TerrainTypes( const Point &hex ) const { return HexType(hex)->tt_type; } bool IsWater( const Point &hex ) const { return (TerrainTypes(hex) & (TT_WATER|TT_WATER_SHALLOW|TT_WATER_DEEP)) != 0; } bool IsShop( const Point &hex ) const { return (TerrainTypes(hex) & TT_ENTRANCE) != 0; } unsigned long HexColor( unsigned short xy ) const; void SetHexType( short x, short y, short type ) { m_data[y * m_w + x] = type; } short GetNeighbors( const Point &hex, Point *parray ) const; int Hex2Index( const Point &hex ) const { return hex.y * m_w + hex.x; } Point Index2Hex( int index ) const; int Dir2Hex( const Point &hex, Direction dir, Point &dest ) const; bool Contains( const Point &hex ) const; private: unsigned short m_w; unsigned short m_h; short *m_data; MapObject **m_objects; UnitSet *uset; TerrainSet *tset; }; #endif /* _INCLUDE_MAP_H */ crimson-0.5.2.orig/src/cf/mapwindow.cpp0000600000175000017500000007232110637506224016203 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // mapwindow.cpp //////////////////////////////////////////////////////////////////////// #include "mapwindow.h" #include "game.h" #include "msgs.h" //////////////////////////////////////////////////////////////////////// // NAME : MapWindow::MapWindow // DESCRIPTION: Set the basic map window variables. // PARAMETERS : x - left edge of window // y - top edge of window // w - window width // h - window height // flags - window flags (see window.h for details) // view - pointer to the view the window will be put on // RETURNS : - //////////////////////////////////////////////////////////////////////// MapWindow::MapWindow( short x, short y, unsigned short w, unsigned short h, unsigned short flags, View *view ) : Window( x, y, w, h, flags, view ) { panel = new Panel( this, view ); mview = new MapView( this, *this, MV_AUTOSCROLL|MV_DISABLE|MV_DISABLE_CURSOR|MV_DISABLE_FOG ); } //////////////////////////////////////////////////////////////////////// // NAME : MapWindow::HandleEvent // DESCRIPTION: React to user input. // PARAMETERS : event - SDL_Event // RETURNS : - //////////////////////////////////////////////////////////////////////// GUI_Status MapWindow::HandleEvent( const SDL_Event &event ) { return Gam->HandleEvent(event); } //////////////////////////////////////////////////////////////////////// // NAME : MapWindow::Draw // DESCRIPTION: Draw the map window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWindow::Draw( void ) { if ( mview->Enabled() ) mview->Draw(); else Window::DrawBack(); } //////////////////////////////////////////////////////////////////////// // NAME : MapWindow::DrawBack // DESCRIPTION: Draw the map window background into the internal buffer. // PARAMETERS : x - left edge of area to paint // y - top edge of area to paint // w - width of area to paint // h - height of area to paint // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWindow::DrawBack( short x, short y, unsigned short w, unsigned short h ) { FillRect( x, y, w, h, Color(CF_COLOR_SHADOW) ); } //////////////////////////////////////////////////////////////////////// // NAME : MapWindow::MoveHex // DESCRIPTION: Smoothly move a hex image (usually a unit or cursor) // from one hex to another (adjacent) one. // PARAMETERS : img - map tile identifier for the hex image // tiles - tile set containing the image // hex1 - source hex position // hex2 - destination hex position // speed - total time (ms) for the animation // blink - if TRUE make target cursor blink (default is // FALSE) // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWindow::MoveHex( unsigned short img, const TileSet &tiles, const Point &hex1, const Point &hex2, unsigned short speed, bool blink /* = false */ ) { // allocate a new surface where we can store the "background" graphics Point psrc = mview->Hex2Pixel( hex1 ); Point pdst = mview->Hex2Pixel( hex2 ); Rect bg; bg.x = MIN( psrc.x, pdst.x ); bg.y = MIN( psrc.y, pdst.y ); bg.w = tiles.TileWidth() + ABS(psrc.x-pdst.x); bg.h = tiles.TileHeight() + ABS(psrc.y-pdst.y); bg.Clip( *this ); Surface *bgs = new Surface; if ( !bgs->Create( bg.w, bg.h, DISPLAY_BPP, 0 ) ) { unsigned long oldticks, ticks = 0, blinkticks = 0; Point curp = mview->Cursor(); Blit( bgs, bg, 0, 0 ); if ( blink && mview->CursorEnabled() ) { mview->DisableCursor(); Show( mview->UpdateHex( curp ) ); blinkticks = speed / 2; } oldticks = SDL_GetTicks(); do { short cx, cy; // don't modify the following three lines; some versions of gcc // (e.g. 2.95.3) seem to produce bogus code when all the calculations // are done in one line cx = (short)((pdst.x - psrc.x) * ticks); cy = (short)((pdst.y - psrc.y) * ticks); tiles.DrawTile( img, this, psrc.x + cx / speed, psrc.y + cy / speed, bg ); Show( bg ); bgs->Blit( this, Rect( 0, 0, bg.w, bg.h ), bg.x, bg.y ); ticks = SDL_GetTicks() - oldticks; if ( blinkticks && ticks >= blinkticks ) { mview->EnableCursor(); Show( mview->UpdateHex( curp ) ); blinkticks = 0; } } while ( ticks < speed ); Show( bg ); } delete bgs; } //////////////////////////////////////////////////////////////////////// // NAME : MapWindow::FadeHex // DESCRIPTION: Fade in a hex image (a unit or terrain image). // PARAMETERS : img - tile identifier for the hex image // hex - destination hex position // in - whether to fade in or out // unit - if TRUE paint a unit image, otherwise the // respective terrain // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWindow::FadeHex( unsigned short img, const Point &hex, bool in, bool unit ) { unsigned long firstticks, oldticks, ticks; Point pos = mview->Hex2Pixel( hex ); const Rect dest( pos.x, pos.y, mview->TileWidth(), mview->TileHeight() ); const unsigned int speed = 4 * ANIM_SPEED_UNIT; const unsigned short terrain = mview->GetMap()->HexImage( hex ); Surface tile; tile.Create( mview->TileWidth(), mview->TileHeight(), DISPLAY_BPP, SDL_HWSURFACE ); tile.SetAlpha( SDL_ALPHA_TRANSPARENT, SDL_SRCALPHA ); tile.SetColorKey( Color(CF_COLOR_WHITE) ); tile.DisplayFormat(); tile.Flood( Color(CF_COLOR_WHITE) ); Unit *blocker = NULL; if ( unit ) mview->DrawUnit( img, &tile, 0, 0, tile ); else { mview->DrawTerrain( img, &tile, 0, 0, tile ); blocker = mview->GetMap()->GetUnit( hex ); } firstticks = oldticks = SDL_GetTicks(); do { ticks = SDL_GetTicks() - firstticks; int alpha = SDL_ALPHA_OPAQUE * ticks / speed; if ( alpha > SDL_ALPHA_OPAQUE ) alpha = SDL_ALPHA_OPAQUE; if ( !in ) alpha = SDL_ALPHA_OPAQUE - alpha; tile.SetAlpha( alpha, SDL_SRCALPHA ); mview->DrawTerrain( terrain, this, pos.x, pos.y, dest ); tile.Blit( this, tile, pos.x, pos.y ); if ( blocker ) mview->DrawUnit( blocker->Image(), this, pos.x, pos.y, dest ); Show( dest ); if ( ticks - oldticks < 30 ) SDL_Delay( 25 ); oldticks = ticks; } while ( ticks < speed ); Show( dest ); } //////////////////////////////////////////////////////////////////////// // NAME : MapWindow::FlashUnit // DESCRIPTION: Make the unit at the target hex flash with white. // PARAMETERS : hex - destination hex position // : times - desired number of times // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWindow::FlashUnit( const Point &hex, unsigned short times ) { unsigned long firstticks, oldticks, ticks; Point pos = mview->Hex2Pixel( hex ); const Rect dest( pos.x, pos.y, mview->TileWidth(), mview->TileHeight() ); const unsigned int speed = ANIM_SPEED_UNIT * 3 / 2; const unsigned int delay = speed / 3; unsigned short img; bool show_cursor; Surface tile; tile.Create( mview->TileWidth(), mview->TileHeight(), DISPLAY_BPP, 0 ); tile.SetAlpha( SDL_ALPHA_OPAQUE, SDL_SRCALPHA ); tile.SetColorKey( Color(CF_COLOR_WHITE) ); tile.DisplayFormat(); tile.Flood( Color(CF_COLOR_WHITE) ); img = mview->GetMap()->GetUnit( hex )->Image(); mview->DrawUnit( img, &tile, 0, 0, tile ); show_cursor = mview->CursorEnabled() && (mview->Cursor() == hex); if ( show_cursor ) mview->DrawTerrain( mview->GetCursorImage(), &tile, 0, 0, tile ); Surface whitetile; whitetile.Create( mview->TileWidth(), mview->TileHeight(), DISPLAY_BPP, 0 ); whitetile.SetAlpha( SDL_ALPHA_OPAQUE / 4, SDL_SRCALPHA ); whitetile.DisplayFormat(); whitetile.Flood( Color(CF_COLOR_WHITE) ); for ( int i = 0; i < times; ++i ) { firstticks = oldticks = SDL_GetTicks(); do { whitetile.Blit( &tile, whitetile, 0, 0 ); if ( show_cursor ) mview->DrawTerrain( mview->GetCursorImage(), &tile, 0, 0, tile ); tile.Blit( this, tile, pos.x, pos.y ); Show( dest ); ticks = SDL_GetTicks() - firstticks; if ( ticks - oldticks < 30 ) SDL_Delay( 25 ); oldticks = ticks; } while ( ticks < delay ); SDL_Delay( delay ); mview->DrawUnit( img, &tile, 0, 0, tile ); if ( show_cursor ) mview->DrawTerrain( mview->GetCursorImage(), &tile, 0, 0, tile ); tile.Blit( this, tile, pos.x, pos.y ); Show( dest ); SDL_Delay( delay ); } } //////////////////////////////////////////////////////////////////////// // NAME : MapWindow::BoxAvoidHexes // DESCRIPTION: Try to place a box on the screen so that it does not // cover the two given hexes. // PARAMETERS : box - the box; left and top edge will be modified // hex1 - first hex position // hex2 - second hex position // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWindow::BoxAvoidHexes( Rect &box, const Point &hex1, const Point &hex2 ) const { // define some preferred positions; we'll try to take one of these Point defs[4]; defs[0] = Point( (w - box.w) / 2, (h - box.h) / 2 ); defs[1] = Point( (w - box.w) / 2, 40 ); defs[2] = Point( 40, (h - box.h) / 2 ); defs[3] = Point( w - box.w - 40, (h - box.h) / 2 ); Point p1 = mview->Hex2Pixel( hex1 ); Point p2 = mview->Hex2Pixel( hex2 ); for ( int i = 0; i < 4; ++i ) { if ( (((defs[i].x > p1.x + mview->TileWidth()) || (defs[i].x + box.w <= p1.x)) || ((defs[i].y > p1.y + mview->TileHeight()) || (defs[i].y + box.h <= p1.y))) && (((defs[i].x > p2.x + mview->TileWidth()) || (defs[i].x + box.w <= p2.x)) || ((defs[i].y > p2.y + mview->TileHeight()) || (defs[i].y + box.h <= p2.y))) ) { box.x = defs[i].x; box.y = defs[i].y; return; } } } //////////////////////////////////////////////////////////////////////// // NAME : MapWindow::DisplayHex // DESCRIPTION: Make sure the requested hex is visible and update the // display. Only call this function if the map view is // enabled. // PARAMETERS : hex - hex to view // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWindow::DisplayHex( const Point &hex ) { if ( mview->FlagSet( MV_DIRTY ) || !mview->HexVisible( hex ) ) { mview->CenterOnHex( hex ); mview->UnsetFlags( MV_DIRTY ); Show( *mview ); } } //////////////////////////////////////////////////////////////////////// // NAME : MapWindow::MoveCursor // DESCRIPTION: Move the cursor into the given direction if possible. // PARAMETERS : dir - requested direction // RETURNS : new cursor position //////////////////////////////////////////////////////////////////////// Point MapWindow::MoveCursor( Direction dir ) { Point dest, cursor = mview->Cursor(); if ( mview->GetMap()->Dir2Hex( cursor, dir, dest ) ) return cursor; mview->DisableCursor(); mview->UpdateHex( cursor ); MoveHex( mview->GetCursorImage(), *mview->GetMap()->GetTerrainSet(), cursor, dest, ANIM_SPEED_CURSOR ); mview->EnableCursor(); return dest; } //////////////////////////////////////////////////////////////////////// // NAME : MapWindow::VideoModeChange // DESCRIPTION: This method is called by the view whenever the video // resolution changes. The window can then adjust itself // to the new dimensions. Afterwards a View::Refresh() is // performed, i. e. the window just needs to reblit its // contents to its internal buffer, and NOT call a view // update itself. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWindow::VideoModeChange( void ) { if ( (view->Width() != w) || (view->Height() != h) ) { SetSize( view->Width(), view->Height() ); mview->Resize( *this ); Draw(); } } //////////////////////////////////////////////////////////////////////// // NAME : Panel::Panel // DESCRIPTION: Create the panel window. // PARAMETERS : mw - pointer to map window // view - pointer to view // RETURNS : - //////////////////////////////////////////////////////////////////////// Panel::Panel( MapWindow *mw, View *view ) : Window( 0, mw->Height() - DEFAULT_PANEL_HEIGHT, 0, 0, 0, view ), workshop_icon( view->GetSystemIcons(), 148, 32, XP_ICON_WIDTH, XP_ICON_HEIGHT ), factory_icon( view->GetSystemIcons(), 160, 32, XP_ICON_WIDTH, XP_ICON_HEIGHT ) { obj = NULL; mapwin = mw; } //////////////////////////////////////////////////////////////////////// // NAME : Panel::Draw // DESCRIPTION: Draw the panel window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Panel::Draw( void ) { if ( obj ) { short namex = 5; Window::Draw(); if ( obj->IsUnit() ) { Unit *u = static_cast(obj); char buf[4]; sprintf( buf, "(%d)", u->GroupSize() ); namex += 5 + XP_ICON_WIDTH; Images[ICON_XP_BASE + u->XPLevel()]->Draw( this, 5, (h - XP_ICON_HEIGHT)/2 ); sfont->Write( buf, this, namex + 5 + sfont->TextWidth( u->Name() ), (h - sfont->Height())/2 ); } else { Building *b = static_cast(obj); if ( b->IsWorkshop() ) { workshop_icon.Draw( this, 5, (h - XP_ICON_HEIGHT)/2 ); namex += 5 + XP_ICON_WIDTH; } if ( b->IsFactory() ) { factory_icon.Draw( this, namex, (h - XP_ICON_HEIGHT)/2 ); namex += 5 + XP_ICON_WIDTH; } } sfont->Write( obj->Name(), this, namex, (h - sfont->Height())/2 ); } } //////////////////////////////////////////////////////////////////////// // NAME : Panel::Update // DESCRIPTION: Set the information displayed on the panel and update // the display. // PARAMETERS : obj - map object to display information about (may be // NULL, in which case the panel will be cleared) // RETURNS : - //////////////////////////////////////////////////////////////////////// void Panel::Update( MapObject *obj ) { Rect refresh = *this; if ( !obj ) { if ( this->obj ) { w = h = 0; y = mapwin->Height() - DEFAULT_PANEL_HEIGHT; view->Refresh( refresh ); this->obj = NULL; } } else { this->obj = obj; // resize and reposition if necessary w = sfont->TextWidth( obj->Name() ) + 10; if ( obj->IsUnit() ) w += 5 + XP_ICON_WIDTH + sfont->Width() * 3; else { Building *b = static_cast(obj); if ( b->IsWorkshop() ) w += 5 + XP_ICON_WIDTH; if ( b->IsFactory() ) w += 5 + XP_ICON_WIDTH; } h = refresh.h = DEFAULT_PANEL_HEIGHT; MapView *mv = mapwin->GetMapView(); Point pcursor = mv->Hex2Pixel( mv->Cursor() ); if ( pcursor.x <= w + mv->TileWidth() ) { if ( y == 0 ) { if ( pcursor.y <= h + mv->TileHeight() ) { y = mapwin->Height() - h; } } else if ( pcursor.y > y - mv->TileHeight() ) y = 0; } SetSize( w, h ); // allocate surface Draw(); // update the old window position and show the new if ( refresh.y == y ) { if ( w > refresh.w ) refresh.w = w; } else Show(); view->Refresh( refresh ); } } //////////////////////////////////////////////////////////////////////// // NAME : Panel::HandleEvent // DESCRIPTION: The window must pass all incoming events to the map // window which does proper processing. // PARAMETERS : event - event as received from the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status Panel::HandleEvent( const SDL_Event &event ) { return mapwin->HandleEvent( event ); } //////////////////////////////////////////////////////////////////////// // NAME : Panel::VideoModeChange // DESCRIPTION: This method is called by the view whenever the video // resolution changes. The window can then adjust itself // to the new dimensions. Afterwards a View::Refresh() is // performed, i. e. the window just needs to reblit its // contents to its internal buffer, and NOT call a view // update itself. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Panel::VideoModeChange( void ) { Window::VideoModeChange(); if ( TopEdge() + DEFAULT_PANEL_HEIGHT < view->Height() ) y = view->Height() - DEFAULT_PANEL_HEIGHT; } //////////////////////////////////////////////////////////////////////// // NAME : TacticalWindow::TacticalWindow // DESCRIPTION: Create a window and show an overview map of the level. // PARAMETERS : mapview - pointer to map viewport // m - mission object // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// TacticalWindow::TacticalWindow( MapView *mapview, Mission &m, View *view ) : Window( WIN_CLOSE_ESC|WIN_CENTER, view ), mv(mapview), mission(m), p1(m.GetPlayer(PLAYER_ONE)), p2(m.GetPlayer(PLAYER_TWO)) { Map *pmap = mv->GetMap(); Rect win, map, viewport; unsigned char magnify = MIN( (view->Width() - 20) / pmap->Width(), (view->Height() * 3 / 4) / pmap->Height() ); if ( magnify < 2 ) magnify = 2; else if ( magnify > 6 ) magnify = 6; map.w = MIN( pmap->Width() * magnify + 2, view->Width() - 10 ); map.h = MIN( pmap->Height() * magnify + magnify/2 + 2, view->Height() - sfont->Height() * 3 - 40 ); // calculate window dimensions const char *ulabel = MSG(MSG_UNITS); const char *slabel = MSG(MSG_SHOPS); unsigned short ulen = sfont->TextWidth( ulabel ); unsigned short slen = sfont->TextWidth( slabel ); unsigned short labellen = MAX( ulen, slen ); win.w = MAX( map.w + 20, labellen + sfont->Width() * 12 + 30 ); win.h = MIN( map.h + sfont->Height() * 3 + 40, view->h ); win.Center( *view ); win.Align( *view ); map.x = (win.w - map.w) / 2; map.y = MAX( 5, win.h - 3 * sfont->Height() - map.h - 35 ); SetSize( win ); CalcViewPort( viewport ); new ButtonWidget( GUI_CLOSE, 1, h - sfont->Height() - 9, w - 2, sfont->Height() + 8, WIDGET_DEFAULT, MSG(MSG_B_OK), this ); mw = new MapWidget( 0, map.x, map.y, map.w, map.h, WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY, this ); mw->SetPlayerColors( p1.LightColor(), p2.LightColor() ); mw->SetMap( pmap, viewport, magnify ); mw->SetHook( this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : TacticalWindow::WidgetActivated // DESCRIPTION: Handle events from the MapWidget. // PARAMETERS : widget - widget sending the message (unused) // win - window the widget belongs to (unused) // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status TacticalWindow::WidgetActivated( Widget *widget, Window *win ) { Point hex = mw->GetLastHex(); Rect viewport; view->DisableUpdates(); if ( !mv->HexVisible( hex ) ) mv->CenterOnHex( hex ); Gam->SetCursor( hex ); CalcViewPort( viewport ); mw->SetViewPort( viewport ); mw->Draw(); view->EnableUpdates(); view->Refresh(); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : TacticalWindow::Draw // DESCRIPTION: Draw the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void TacticalWindow::Draw( void ) { Window::Draw(); // show unit and building count Color col; unsigned short linewidth = w - 40, lx, l1y, l2y, lh, xoff1, xoff2; char numbuf[4]; unsigned short bs1 = 0, bs2 = 0, bstotal = 0; Building *b = static_cast( mission.GetShops().Head() ); while ( b ) { if ( b->Owner() ) { if ( b->Owner()->ID() == PLAYER_ONE ) ++bs1; else if ( b->Owner()->ID() == PLAYER_TWO ) ++bs2; } ++bstotal; b = static_cast( b->Next() ); } lh = (h - mw->y - mw->h - sfont->Height() * 3 - 9) / 5; lx = MIN( (w - linewidth - 10) / 2, mw->x + 5 ); l1y = mw->y + mw->h + lh * 2; l2y = h - (sfont->Height() + lh) * 2 - 9; DrawBox( Rect( lx - 5, l1y - lh, w - 2*lx + 10, (sfont->Height() * 2 + lh * 3) ), BOX_RECESSED ); lx = (w - linewidth - 10) / 2; xoff1 = sfont->Write( MSG(MSG_UNITS), this, lx, l1y ); xoff2 = sfont->Write( MSG(MSG_SHOPS), this, lx, l2y ); lx += MAX( xoff1, xoff2 ) + 20; col = p1.LightColor(); xoff1 = sfont->Write( itoa( p1.Units(0), numbuf ), this, lx, l1y, col ); xoff2 = sfont->Write( itoa( bs1, numbuf ), this, lx, l2y, col ); lx += MAX( xoff1, xoff2 ) + 20; col = p2.LightColor(); xoff1 = sfont->Write( itoa( p2.Units(0), numbuf ), this, lx, l1y, col ); xoff2 = sfont->Write( itoa( bs2, numbuf ), this, lx, l2y, col ); lx += MAX( xoff1, xoff2 ) + 20; sfont->Write( itoa( mission.GetUnits().CountNodes(), numbuf ), this, lx, l1y ); sfont->Write( itoa( bstotal, numbuf ), this, lx, l2y ); } //////////////////////////////////////////////////////////////////////// // NAME : TacticalWindow::CalcViewPort // DESCRIPTION: Determine which part of the map is currently displayed // on the map window and set the viewport rect accordingly. // PARAMETERS : vp - Rect buffer to hold the view port coordinates // RETURNS : - //////////////////////////////////////////////////////////////////////// void TacticalWindow::CalcViewPort( Rect &vp ) const { vp.x = mv->MinXHex(-1); vp.y = mv->MinYHex(-1); vp.w = (mv->MaxXHex(-1,0) + 1) - vp.x; vp.h = (mv->MaxYHex(-1,0) + 1) - vp.y; } //////////////////////////////////////////////////////////////////////// // NAME : CombatWindow::CombatWindow // DESCRIPTION: The CombatWindow visualizes the fight between two units. // PARAMETERS : combat - pointer to a combat object // mapwin - pointer to the map window; required to update // the display when a unit is destroyed // view - view the window will belong to // RETURNS : - //////////////////////////////////////////////////////////////////////// CombatWindow::CombatWindow( Combat *combat, MapWindow *mapwin, View *view ) : Window( 0, view ), mapwin( mapwin ), att( combat->GetAttacker() ), def( combat->GetDefender() ), apos( att->Position() ), dpos( def->Position() ), startgroup1( att->GroupSize() ), startgroup2( def->GroupSize() ) { MapView *mv = mapwin->GetMapView(); // calculate window dimensions short wwidth = (MAX( sfont->TextWidth( att->Name() ), sfont->TextWidth( def->Name() ) ) + XP_ICON_WIDTH + 25) * 2; wwidth = MAX( wwidth, mv->TileWidth() * 6 + 50 ); Rect win( 0, 0, wwidth, mv->TileHeight() * 3 + sfont->Height() * 2 + 50 ); // place window on map window mv->CenterOnHex( Point( (apos.x + dpos.x) / 2, (apos.y + dpos.y) / 2 ) ); mapwin->BoxAvoidHexes( win, apos, dpos ); SetSize( win.x, win.y, win.w, win.h ); // highlight the fighting units Rect clip; Point punit = mv->Hex2Pixel( apos ); clip = Rect( punit.x, punit.y, mv->TileWidth(), mv->TileHeight() ); clip.Clip( *mv ); mv->DrawTerrain( IMG_CURSOR_HIGHLIGHT, mapwin, punit.x, punit.y, clip ); punit = mv->Hex2Pixel( dpos ); clip = Rect( punit.x, punit.y, mv->TileWidth(), mv->TileHeight() ); clip.Clip( *mv ); mv->DrawTerrain( IMG_CURSOR_HIGHLIGHT, mapwin, punit.x, punit.y, clip ); // create button widget, message areas, and unit display areas Rect brect( 1, h - sfont->Height() - 10, w - 2, sfont->Height() + 10 ); msgbar1 = Rect( 4, h - sfont->Height() - 14 - brect.h, (w - 16) / 2, sfont->Height() + 6 ); msgbar2 = Rect( msgbar1.x + msgbar1.w + 8, msgbar1.y, msgbar1.w, msgbar1.h ); att_anchor = Rect( w/4 - mv->TileWidth()/2, 10 + mv->TileHeight(), mv->TileWidth(), mv->TileHeight() ); def_anchor = Rect( (w * 3)/4 - mv->TileWidth()/2, att_anchor.y, mv->TileWidth(), mv->TileHeight() ); clock[0][0] = Rect( att_anchor.x, att_anchor.y - mv->TileHeight(), mv->TileWidth(), mv->TileHeight() ); clock[0][1] = Rect( att_anchor.x + mv->TileWidth() - mv->TileShiftX(), att_anchor.y - mv->TileShiftY(), mv->TileWidth(), mv->TileHeight() ); clock[0][2] = Rect( att_anchor.x + mv->TileWidth() - mv->TileShiftX(), att_anchor.y + mv->TileShiftY(), mv->TileWidth(), mv->TileHeight() ); clock[0][3] = Rect( att_anchor.x, att_anchor.y + mv->TileHeight(), mv->TileWidth(), mv->TileHeight() ); clock[0][4] = Rect( att_anchor.x - mv->TileWidth() + mv->TileShiftX(), att_anchor.y + mv->TileShiftY(), mv->TileWidth(), mv->TileHeight() ); clock[0][5] = Rect( att_anchor.x - mv->TileWidth() + mv->TileShiftX(), att_anchor.y - mv->TileShiftY(), mv->TileWidth(), mv->TileHeight() ); clock[1][0] = Rect( def_anchor.x, def_anchor.y - mv->TileHeight(), mv->TileWidth(), mv->TileHeight() ); clock[1][1] = Rect( def_anchor.x + mv->TileWidth() - mv->TileShiftX(), def_anchor.y - mv->TileShiftY(), mv->TileWidth(), mv->TileHeight() ); clock[1][2] = Rect( def_anchor.x + mv->TileWidth() - mv->TileShiftX(), def_anchor.y + mv->TileShiftY(), mv->TileWidth(), mv->TileHeight() ); clock[1][3] = Rect( def_anchor.x, def_anchor.y + mv->TileHeight(), mv->TileWidth(), mv->TileHeight() ); clock[1][4] = Rect( def_anchor.x - mv->TileWidth() + mv->TileShiftX(), def_anchor.y + mv->TileShiftY(), mv->TileWidth(), mv->TileHeight() ); clock[1][5] = Rect( def_anchor.x - mv->TileWidth() + mv->TileShiftX(), def_anchor.y - mv->TileShiftY(), mv->TileWidth(), mv->TileHeight() ); button = new ButtonWidget( GUI_CLOSE, brect.x, brect.y, brect.w, brect.h, WIDGET_DEFAULT, MSG(MSG_B_OK), this ); Draw(); view->Refresh(); } //////////////////////////////////////////////////////////////////////// // NAME : CombatWindow::Draw // DESCRIPTION: Draw the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void CombatWindow::Draw( void ) { Window::Draw(); DrawBox( msgbar1, BOX_RECESSED ); DrawBox( msgbar2, BOX_RECESSED ); DrawBox( Rect( msgbar1.x, 4, msgbar1.w, msgbar1.y - 8 ), BOX_CARVED ); DrawBox( Rect( msgbar2.x, 4, msgbar2.w, msgbar2.y - 8 ), BOX_CARVED ); Images[ICON_XP_BASE + att->XPLevel()]->Draw( this, msgbar1.x + 4, msgbar1.y + (msgbar1.h - XP_ICON_HEIGHT)/2 ); Images[ICON_XP_BASE + def->XPLevel()]->Draw( this, msgbar2.x + 4, msgbar2.y + (msgbar2.h - XP_ICON_HEIGHT)/2 ); sfont->Write( att->Name(), this, msgbar1.x + XP_ICON_WIDTH + 8, msgbar1.y + (msgbar1.h - sfont->Height())/2 ); sfont->Write( def->Name(), this, msgbar2.x + XP_ICON_WIDTH + 8, msgbar2.y + (msgbar2.h - sfont->Height())/2 ); // draw terrain and unit image to the center of the 'clock' MapView *mv = mapwin->GetMapView(); Map *map = mv->GetMap(); mv->DrawTerrain( map->HexImage( apos ), this, att_anchor.x, att_anchor.y, att_anchor ); mv->DrawTerrain( map->HexImage( dpos ), this, def_anchor.x, def_anchor.y, def_anchor ); mv->DrawUnit( att->Image(), this, att_anchor.x, att_anchor.y, att_anchor ); mv->DrawUnit( def->Image(), this, def_anchor.x, def_anchor.y, def_anchor ); DrawState(); } //////////////////////////////////////////////////////////////////////// // NAME : CombatWindow::DrawState // DESCRIPTION: Update the two 'clocks' to display the current standing. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void CombatWindow::DrawState( void ) { short group1 = att->GroupSize(), group2 = def->GroupSize(); MapView *mv = mapwin->GetMapView(); for ( int i = NORTH; i <= NORTHWEST; ++i ) { if ( i < startgroup1 ) { mv->DrawTerrain( IMG_RECESSED_HEX, this, clock[0][i].x, clock[0][i].y, clock[0][i] ); mv->DrawUnit( att->BaseImage() + i, this, clock[0][i].x, clock[0][i].y, clock[0][i] ); if ( i >= group1 ) mv->DrawFog( this, clock[0][i].x, clock[0][i].y, clock[0][i] ); } if ( i < startgroup2 ) { mv->DrawTerrain( IMG_RECESSED_HEX, this, clock[1][i].x, clock[1][i].y, clock[1][i] ); mv->DrawUnit( def->BaseImage() + i, this, clock[1][i].x, clock[1][i].y, clock[1][i] ); if ( i >= group2 ) mv->DrawFog( this, clock[1][i].x, clock[1][i].y, clock[1][i] ); } } } crimson-0.5.2.orig/src/cf/mapwindow.h0000600000175000017500000000752610637501177015657 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // mapwindow.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_MAPWINDOW_H #define _INCLUDE_MAPWINDOW_H #include "window.h" #include "mapview.h" #include "mapwidget.h" #include "mission.h" #include "misc.h" #define ANIM_SPEED_UNIT 150 // time it takes for a unit to move one hex (ms) #define ANIM_SPEED_CURSOR 40 // speed when moving cursor #define DEFAULT_PANEL_HEIGHT (20) // the small info panel at the bottom of the map window class Panel : public Window { public: Panel( class MapWindow *mw, View *view ); void Draw( void ); void Update( MapObject *obj ); virtual GUI_Status HandleEvent( const SDL_Event &event ); virtual void VideoModeChange( void ); private: MapObject *obj; MapWindow *mapwin; Image workshop_icon; Image factory_icon; }; class MapWindow : public Window { public: MapWindow( short x, short y, unsigned short w, unsigned short h, unsigned short flags, View *view ); ~MapWindow( void ) { delete mview; } virtual GUI_Status HandleEvent( const SDL_Event &event ); virtual void Draw( void ); virtual void Close( void ) { Window::Close(); view->CloseWindow(panel); } virtual void DrawBack( short x, short y, unsigned short w, unsigned short h ); virtual void VideoModeChange( void ); MapView *GetMapView( void ) const { return mview; } Panel *GetPanel( void ) const { return panel; } void MoveHex( unsigned short img, const TileSet &tiles, const Point &hex1, const Point &hex2, unsigned short speed, bool blink = false ); Point MoveCursor( Direction dir ); void FadeOutUnit( unsigned short img, const Point &hex ) { FadeHex( img, hex, false, true ); } void FadeInUnit( unsigned short img, const Point &hex ) { FadeHex( img, hex, true, true ); } void FadeInTerrain( unsigned short img, const Point &hex ) { FadeHex( img, hex, true, false ); } void FlashUnit( const Point &hex, unsigned short times ); void DisplayHex( const Point &hex ); void BoxAvoidHexes( Rect &rect, const Point &hex1, const Point &hex2 ) const; private: void FadeHex( unsigned short img, const Point &hex, bool in, bool unit ); MapView *mview; Panel *panel; }; class TacticalWindow : public Window, public WidgetHook { public: TacticalWindow( MapView *mapview, Mission &m, View *view ); void Draw( void ); GUI_Status WidgetActivated( Widget *widget, Window *win ); private: void CalcViewPort( Rect &vp ) const; MapView *mv; MapWidget *mw; Mission &mission; Player &p1; Player &p2; }; // window displaying the results of a battle class CombatWindow : public Window { public: CombatWindow( Combat *combat, MapWindow *mapwin, View *view ); virtual void Draw( void ); ButtonWidget *button; private: void DrawState( void ); MapWindow *mapwin; Unit *att; Unit *def; Point apos; Point dpos; short startgroup1; short startgroup2; Rect msgbar1; Rect msgbar2; Rect att_anchor; Rect def_anchor; Rect clock[2][6]; }; #endif /* _INCLUDE_MAPWINDOW_H */ crimson-0.5.2.orig/src/cf/mission.cpp0000600000175000017500000003407510554366415015667 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // mission.cpp //////////////////////////////////////////////////////////////////////// #include #include "mission.h" #include "fileio.h" #include "strutil.h" #include "globals.h" //////////////////////////////////////////////////////////////////////// // NAME : Mission::~Mission // DESCRIPTION: Free mission resources. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Mission::~Mission( void ) { delete history; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::Load // DESCRIPTION: Load a game from a mission file. // PARAMETERS : file - mission file // RETURNS : 0 on success, non-null otherwise //////////////////////////////////////////////////////////////////////// int Mission::Load( MemBuffer &file ) { int rc = -1; // read game info if ( (file.Read32() == FID_MISSION) && (file.Read8() == FILE_VERSION) ) { unsigned short len, i; string uset, tset; flags = file.Read16(); turn = file.Read16(); name = file.Read8(); level_info = file.Read8(); campaign_name = file.Read8(); campaign_info = file.Read8(); next_map = file.Read8(); music = file.Read8(); handicap = file.Read8(); current_player = file.Read8(); turn_phase = file.Read8(); p1.Load( file ); p2.Load( file ); messages.Load( file ); map.Load( file ); // load map len = file.Read16(); // load name of unit set uset = file.ReadS( len ); File ufile( uset + ".units" ); if ( !ufile.OpenData("rb") || unit_set.Load( ufile, uset.c_str() ) ) { cerr << "Error: Unit set '" << uset << "' not available" << endl; return -1; } ufile.Close(); len = file.Read16(); // load name of terrain set tset = file.ReadS( len ); File tfile( tset + ".tiles" ); if ( !tfile.OpenData("rb") || terrain_set.Load( tfile, tset.c_str() ) ) { cerr << "Error: Terrain set '" << tset << "' not available" << endl; return -1; } tfile.Close(); map.SetUnitSet( &unit_set ); map.SetTerrainSet( &terrain_set ); len = file.Read16(); // load shops for ( i = 0; i < len; ++i ) { Building *b = new Building(); short pid = b->Load( file ); b->SetOwner( pid == PLAYER_NONE ? 0 : &GetPlayer( pid ), false ); shops.AddTail( b ); map.SetBuilding( b, b->Position() ); } len = file.Read16(); // load units for ( i = 0; i < len; ++i ) { Unit *u = LoadUnit( file ); if ( u ) { units.AddTail( u ); map.SetUnit( u, u->Position() ); } } len = file.Read16(); // load battles for ( i = 0; i < len; ++i ) { // only present in saved games Combat *combat = new Combat(); combat->Load( file, *this ); battles.AddTail( combat ); } len = file.Read16(); // load events for ( i = 0; i < len; ++i ) { Event *e = new Event(); short pid = e->Load( file ); e->SetPlayer( GetPlayer( pid ) ); events.AddTail( e ); } internal_messages.ReadCatalog( file ); history = new History(); if ( history->Load( file, *this ) == 0 ) { if ( GetPlayer(current_player^1).IsHuman() ) { history->StartRecording( GetUnits() ); } else { delete history; history = 0; } } rc = 0; } else cerr << "Warning: invalid header or version" << endl; return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::LoadUnit // DESCRIPTION: Load a unit from a file. // PARAMETERS : file - file descriptor // dummy - if true don't create transporters (used by History) // RETURNS : pointer to loaded unit or NULL on error //////////////////////////////////////////////////////////////////////// Unit *Mission::LoadUnit( MemBuffer &file, bool dummy /* = false */ ) { unsigned char tid, pid; const UnitType *type; Player *p = 0; Unit *u; tid = file.Read8(); pid = file.Read8(); if ( pid != PLAYER_NONE ) p = &GetPlayer( pid ); type = unit_set.GetUnitInfo( tid ); if ( (type->Flags() & U_TRANSPORT) && !dummy ) u = new Transport(); else u = new Unit(); u->Load( file, type, p ); return u; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::QuickLoad // DESCRIPTION: Load parts of a game from a mission file. This retrieves // only the information required for the map selection // lists. // PARAMETERS : file - mission file // RETURNS : 0 on success, non-null otherwise //////////////////////////////////////////////////////////////////////// int Mission::QuickLoad( MemBuffer &file ) { int rc = -1; // read game info if ( (file.Read32() == FID_MISSION) && (file.Read8() == FILE_VERSION) ) { flags = file.Read16(); turn = file.Read16(); name = file.Read8(); level_info = file.Read8(); campaign_name = file.Read8(); campaign_info = file.Read8(); next_map = file.Read8(); music = file.Read8(); handicap = file.Read8(); current_player = file.Read8(); turn_phase = file.Read8(); p1.Load( file ); p2.Load( file ); messages.Load( file ); rc = 0; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::Save // DESCRIPTION: Save the mission to a file. // PARAMETERS : file - data file // RETURNS : 0 on successful write, non-zero otherwise //////////////////////////////////////////////////////////////////////// int Mission::Save( MemBuffer &file ) { // save game info file.Write32( FID_MISSION ); file.Write8( FILE_VERSION ); file.Write16( flags ); file.Write16( turn ); file.Write8( name ); file.Write8( level_info ); file.Write8( campaign_name ); file.Write8( campaign_info ); file.Write8( next_map ); file.Write8( music ); file.Write8( handicap ); file.Write8( current_player ); file.Write8( turn_phase ); p1.Save( file ); // save player data p2.Save( file ); messages.Save( file ); map.Save( file ); // save map // save mission set info file.Write16( unit_set.GetName().length() ); file.WriteS( unit_set.GetName() ); file.Write16( terrain_set.GetName().length() ); file.WriteS( terrain_set.GetName() ); // save shops file.Write16( shops.CountNodes() ); for ( Building *b = static_cast(shops.Head()); b; b = static_cast(b->Next()) ) b->Save( file ); // save transports; basically, transports are not much different // from other units but we MUST make sure that transports having // other units on board are loaded before those units; we need to // make two passes through the list, first saving all unsheltered // units (which are possibly transports carrying other units), and // all sheltered units in the second run file.Write16( units.CountNodes() ); const Unit *u; for ( u = static_cast(units.Head()); u; u = static_cast(u->Next()) ) { // make sure transports are if ( !u->IsSheltered() ) u->Save( file ); // stored before carried units } for ( u = static_cast(units.Head()); u; u = static_cast(u->Next()) ) { if ( u->IsSheltered() ) u->Save( file ); } // save combat data file.Write16( battles.CountNodes() ); for ( Combat *com = static_cast(battles.Head()); com; com = static_cast(com->Next()) ) com->Save( file ); // save events file.Write16( events.CountNodes() ); for ( Event *ev = static_cast(events.Head()); ev; ev = static_cast(ev->Next()) ) ev->Save( file ); internal_messages.WriteCatalog( file ); if ( history ) history->Save( file ); // save turn history else file.Write16( 0 ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::CreateUnit // DESCRIPTION: Create a new unit. // PARAMETERS : type - unit type identifier // p - controlling player // pos - position on map // dir - direction the unit is facing (default is North) // group - group size (default is MAX_GROUP_SIZE) // xp - initial experience level (default is 0) // RETURNS : created unit or NULL on error //////////////////////////////////////////////////////////////////////// Unit *Mission::CreateUnit( unsigned char type, Player &p, const Point &pos, Direction dir, unsigned char group, unsigned char xp ) { Unit *u; const UnitType *utype = unit_set.GetUnitInfo( type ); if ( utype->Flags() & U_TRANSPORT ) u = new Transport( utype, &p, CreateUnitID(), pos ); else u = new Unit( utype, &p, CreateUnitID(), pos ); u->Face( dir ); u->SetGroupSize( group ); u->AwardXP( xp * XP_PER_LEVEL ); units.AddTail( u ); map.SetUnit( u, pos ); if ( history ) history->RecordUnitEvent( *u, History::HIST_UEVENT_CREATE ); u->SetFlags( U_DONE ); // can't move on the first turn return u; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::GetUnit // DESCRIPTION: Find the unit corresponding to the given identifier. // PARAMETERS : id - identifier of the unit to be searched for // RETURNS : pointer to the unit, or NULL if no unit with that ID // exists //////////////////////////////////////////////////////////////////////// Unit *Mission::GetUnit( unsigned short id ) const { return FindID( units, id ); } //////////////////////////////////////////////////////////////////////// // NAME : Mission::CreateUnitID // DESCRIPTION: Get a unique identifier for a new unit. // PARAMETERS : - // RETURNS : unique unit ID //////////////////////////////////////////////////////////////////////// unsigned short Mission::CreateUnitID( void ) const { // find an unused unit ID; start from the back of the range to avoid // potential conflicts with IDs of destroyed units unsigned short id = 32000; while ( GetUnit( id ) != 0 ) --id; return id; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::GetShop // DESCRIPTION: Find the shop corresponding to the given identifier. // PARAMETERS : id - identifier of the shop to be searched for // RETURNS : pointer to the shop, or NULL if no building with that ID // exists //////////////////////////////////////////////////////////////////////// Building *Mission::GetShop( unsigned short id ) const { return FindID( shops, id ); } //////////////////////////////////////////////////////////////////////// // NAME : Mission::GetEvent // DESCRIPTION: Find the event corresponding to the given identifier. // PARAMETERS : id - identifier of the event to be searched for // RETURNS : pointer to the event, or NULL if no event with that ID // exists //////////////////////////////////////////////////////////////////////// Event *Mission::GetEvent( unsigned short id ) const { return FindID( events, id ); } //////////////////////////////////////////////////////////////////////// // NAME : Mission::GetMessage // DESCRIPTION: Get a message from the catalog. // PARAMETERS : id - message identifier of the requested message // RETURNS : pointer to requested message if successful, 0 otherwise //////////////////////////////////////////////////////////////////////// const char *Mission::GetMessage( short id ) const { return messages.GetMsg( id ); } //////////////////////////////////////////////////////////////////////// // NAME : Mission::GetInternalMessage // DESCRIPTION: Get a message from the internal catalog which contains // untranslatable strings like next map name, or soundtrack // names. // PARAMETERS : id - message identifier of the requested message // RETURNS : pointer to requested message if successful, 0 otherwise //////////////////////////////////////////////////////////////////////// const char *Mission::GetInternalMessage( short id ) const { return internal_messages.GetMsg( id ); } //////////////////////////////////////////////////////////////////////// // NAME : Mission::RegisterBattle // DESCRIPTION: File a new combat. Record it for historical replay. // PARAMETERS : att - attacking unit // def - defending unit // RETURNS : - //////////////////////////////////////////////////////////////////////// void Mission::RegisterBattle( Unit *att, Unit *def ) { battles.AddTail( new Combat( att, def ) ); att->Attack( def ); if ( history ) history->RecordAttackEvent( *att, *def ); } //////////////////////////////////////////////////////////////////////// // NAME : Mission::SetLocale // DESCRIPTION: Set the language to use. // PARAMETERS : lang - locale identifier // RETURNS : - //////////////////////////////////////////////////////////////////////// void Mission::SetLocale( const string &lang ) { messages.SetDefaultLanguage( lang ); unit_set.SetLocale( lang ); p1.SetName( messages.GetMsg(p1.NameID()) ); p2.SetName( messages.GetMsg(p2.NameID()) ); for ( Building *b = static_cast(shops.Head()); b; b = static_cast(b->Next()) ) b->SetName( messages.GetMsg(b->NameID()) ); } crimson-0.5.2.orig/src/cf/mission.h0000600000175000017500000001100610554366467015330 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // mission.h - the data construct to contain all level info /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_MISSION_H #define _INCLUDE_MISSION_H #include "map.h" #include "event.h" #include "lset.h" #include "player.h" #include "history.h" #include "lang.h" class Mission { public: Mission( void ) { history = 0; } ~Mission( void ); int Load( MemBuffer &file ); Unit *LoadUnit( MemBuffer &file, bool dummy = false ); int QuickLoad( MemBuffer &file ); int Save( MemBuffer &file ); Map &GetMap( void ) { return map; } TerrainSet &GetTerrainSet( void ) { return terrain_set; } UnitSet &GetUnitSet( void ) { return unit_set; } const char *GetSequel( void ) const { return GetInternalMessage(next_map); } const char *GetInfoMsg( void ) const { return GetMessage(level_info); } const char *GetCampaignInfo( void ) const { return GetMessage(campaign_info); } const char *GetName( void ) const { return GetMessage(name); } const char *GetCampaignName( void ) const { return GetMessage(campaign_name); } const char *GetMusic( void ) const { return GetMessage(music); } unsigned short GetTurn( void ) const { return turn; } unsigned short NextTurn( void ) { return ++turn; } unsigned char GetPhase( void ) const { return turn_phase; } unsigned short GetTime( void ) const { return (GetTurn() - 1) * 2 + current_player; } unsigned char GetHandicap( void ) const { return handicap; } unsigned short GetFlags( void ) const { return flags; } Unit *CreateUnit( unsigned char type, Player &p, const Point &pos, Direction dir = NORTH, unsigned char group = MAX_GROUP_SIZE, unsigned char xp = 0 ); Unit *GetUnit( unsigned short id ) const; Building *GetShop( unsigned short id ) const; Event *GetEvent( unsigned short id ) const; const char *GetMessage( short id ) const; Player &GetPlayer( void ) { return GetPlayer(current_player); } Player &GetPlayer( unsigned char id ) { return id == PLAYER_ONE ? p1 : p2; } Player &GetOtherPlayer( const Player &p ) { return p.ID() == PLAYER_ONE ? p2 : p1; } Player &NextPlayer( void ) { current_player ^= 1; return GetPlayer(); } void RegisterBattle( Unit *att, Unit *def ); History *GetHistory( void ) const { return history; } void SetHistory( History *h ) { history = h; } List &GetEvents( void ) { return events; } List &GetUnits( void ) { return units; } List &GetShops( void ) { return shops; } List &GetBattles( void ) { return battles; } void SetFlags( unsigned short f ) { flags = f; } void SetLocale( const string &lang ); void SetSequel( signed char seqid ) { next_map = seqid; } void SetPhase( unsigned char phase ) { turn_phase = phase; } void SetHandicap( unsigned char hcap ) { handicap = hcap; } private: const char *GetInternalMessage( short id ) const; unsigned short CreateUnitID( void ) const; unsigned short turn; unsigned char turn_phase; unsigned char current_player; unsigned char handicap; unsigned short flags; signed char name; signed char level_info; signed char campaign_name; signed char campaign_info; signed char next_map; signed char music; Map map; List units; List shops; List events; List battles; Locale messages; Language internal_messages; // non-translatable strings Player p1; Player p2; UnitSet unit_set; TerrainSet terrain_set; History *history; template // get a specific object from a list T *FindID( const List &l, unsigned short id ) const { for ( T *obj = static_cast(l.Head()); obj; obj = static_cast(obj->Next()) ) { if ( obj->ID() == id ) return obj; } return 0; } }; #endif /* _INCLUDE_MISSION_H */ crimson-0.5.2.orig/src/cf/msgs.h0000600000175000017500000000644410554366466014631 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // msgs.h - message identifiers /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_MSGS_H #define _INCLUDE_MSGS_H #include "lang.h" extern Language Lang; #define MSG(m) Lang.GetMsg(m) enum { MSG_B_OK = 0, MSG_B_CANCEL, MSG_B_YES, MSG_B_NO, MSG_B_START, MSG_B_MAP, MSG_B_OBJECTIVES, MSG_B_LEVEL_INFO, MSG_B_LOAD, MSG_B_SAVE, MSG_B_SKIP, MSG_B_END_TURN, MSG_B_OPTIONS, MSG_B_OPT_GENERAL, MSG_B_OPT_VIDEO, MSG_B_OPT_AUDIO, MSG_B_OPT_FULLSCREEN, MSG_B_OPT_DAMAGE, MSG_B_OPT_REPLAYS, MSG_B_OPT_REPLAYS_QUICK, MSG_B_OPT_SFX, MSG_B_OPT_MUSIC, MSG_B_OPT_LANGUAGE, MSG_B_OPT_KEYBOARD, MSG_B_GAME_TYPE, MSG_B_MAP_TYPE, MSG_B_SAVE_GAME, MSG_B_MAIN_MENU, MSG_B_QUIT, MSG_B_EXIT, MSG_B_HANDICAP, MSG_B_REPAIR, MSG_B_UNIT_INFO, MSG_B_UNIT_CONTENT, MSG_B_UNIT_SWEEP, MSG_B_UNIT_UNDO, MSG_B_SERVER, MSG_B_PORT, MSG_GAME_HOT_SEAT, MSG_GAME_PBEM, MSG_GAME_AI, MSG_GAME_NETWORK_SERVER, MSG_GAME_NETWORK_CLIENT, MSG_MAPS_SINGLES, MSG_MAPS_CAMPAIGNS, MSG_MAPS_SAVES, MSG_HANDICAP_NONE, MSG_HANDICAP_P1, MSG_HANDICAP_P2, MSG_TAG_PBEM, MSG_TAG_NET, MSG_TURN, MSG_UNITS, MSG_SHOPS, MSG_PLAYER_SELECTION, MSG_DEBRIEFING, MSG_LVL_INFO, MSG_OPTIONS_GENERAL, MSG_OPTIONS_VIDEO, MSG_OPTIONS_AUDIO, MSG_OPTIONS_LANGUAGE, MSG_OPTIONS_KEYBOARD, MSG_OPT_KEY_MINIMIZE, MSG_OPT_KEY_END_TURN, MSG_OPT_KEY_MAP, MSG_OPT_KEY_GAME_MENU, MSG_OPT_KEY_UNIT_MENU, MSG_OPT_KEY_UNIT_CONTENT, MSG_OPT_KEY_UNIT_INFO, MSG_OPT_KEY_UNIT_NEXT, MSG_OPT_KEY_UNIT_SELECT, MSG_OPT_KEY_UNIT_UNDO, MSG_OPT_KEY_UNIT_SWEEP, MSG_PRESS_KEY, MSG_LOAD_GAME, MSG_SAVE_GAME, MSG_GAME_SAVED, MSG_GAME_SAVED_PBEM, MSG_ENTER_PASSWORD, MSG_CHOOSE_PASSWORD, MSG_CONFIRM_PASSWORD, MSG_NET_WAITING, MSG_NET_WAITING_CLIENT, MSG_NET_CONNECTING, MSG_NET_CONFIG_SERVER, MSG_NET_CONFIG_CLIENT, MSG_TRANSFER_UNITS, MSG_ASK_SIDE, MSG_ASK_REPAIR, MSG_ASK_OVERWRITE, MSG_ASK_ABORT, MSG_ASK_ABORT_PBEM, MSG_ASK_ABORT_NETWORK, MSG_ASK_QUIT, MSG_RESULT_DRAW, MSG_RESULT_VICTORY, MSG_RESULT_DEFEAT, MSG_MESSAGE, MSG_WARNING, MSG_ERROR, MSG_ERR_WRITE, MSG_ERR_SAVE, MSG_ERR_NETWORK, MSG_ERR_LOAD_MAP, MSG_ERR_NO_ACCESS, MSG_ERR_NO_BRIEFING, MSG_ERR_NO_LVL_INFO, MSG_ERR_MAP_NOT_FOUND, MSG_ERR_NO_MAP, MSG_ERR_SWEEPER_FULL, MSG_ERR_NO_CRYSTALS, MSG_ERR_NO_PRODUCTION, CF_MSGS }; #endif /* _INCLUDE_MSGS_H */ crimson-0.5.2.orig/src/cf/network.cpp0000600000175000017500000003160410554366424015672 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // network.cpp - networking //////////////////////////////////////////////////////////////////////// #include #include "network.h" #ifndef DISABLE_NETWORK #include "misc.h" #define DEFAULT_CAPACITY 512 //////////////////////////////////////////////////////////////////////// // NAME : DynBuffer::DynBuffer // DESCRIPTION: Create a new dynamic buffer with the default capacity in // memory. When using the Write*() methods defined for this // class, the buffer will grow dynamically as required. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// DynBuffer::DynBuffer( void ) : mem(0), size(0), capacity(0), pos(0) { Init( DEFAULT_CAPACITY); } //////////////////////////////////////////////////////////////////////// // NAME : DynBuffer::DynBuffer // DESCRIPTION: Create a new buffer in memory. // PARAMETERS : capacity - desired initial buffer size // RETURNS : - //////////////////////////////////////////////////////////////////////// DynBuffer::DynBuffer( unsigned long capacity ) : mem(0), size(0), capacity(0), pos(0) { Init( capacity ); } //////////////////////////////////////////////////////////////////////// // NAME : DynBuffer::~DynBuffer // DESCRIPTION: Free the buffer. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// DynBuffer::~DynBuffer( void ) { if (mem) free( mem ); } //////////////////////////////////////////////////////////////////////// // NAME : DynBuffer::Init // DESCRIPTION: Initialize a new buffer in memory. // PARAMETERS : len - desired initial buffer size // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int DynBuffer::Init( unsigned long len ) { mem = (char *)malloc( len ); if (mem) { capacity = len; return 0; } return -1; } //////////////////////////////////////////////////////////////////////// // NAME : DynBuffer::CheckResize // DESCRIPTION: Check whether a given amount of data fits into the // currently allocated buffer. If it doesn't, resize the // buffer. // PARAMETERS : len - total amount of data that the buffer must be able // to hold // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int DynBuffer::CheckResize( unsigned long len ) { int rc = 0; if (len > capacity) { unsigned long new_capacity = MAX( len, capacity * 2 ); mem = (char *)realloc( mem, new_capacity ); if (mem) capacity = new_capacity; else rc = -1; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : DynBuffer::SetSize // DESCRIPTION: Set buffer to a given size. Current position inside the // buffer is not modified, unless the buffer size is // reduced and the position is outside the valid buffer // after the resize. In that case, position is moved to the // end of the buffer. // PARAMETERS : size - size to set // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int DynBuffer::SetSize( unsigned long size ) { int rc; if (size > capacity) { rc = CheckResize( size ); } else { // buffer reduction will always succeed rc = 0; pos = MIN( size, pos ); } this->size = size; return rc; } //////////////////////////////////////////////////////////////////////// // NAME : DynBuffer::Read // DESCRIPTION: Read a number of bytes from the buffer. // PARAMETERS : buffer - buffer to read into // size - amount of data to read // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int DynBuffer::Read( void *buffer, int size ) { if (pos + size > this->size) return -1; memcpy( buffer, &mem[pos], size ); pos += size; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : DynBuffer::Write // DESCRIPTION: Write a number of bytes to the buffer. // PARAMETERS : buffer - buffer to read from // size - amount of data to write // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int DynBuffer::Write( const void *buffer, int size ) { if (CheckResize( pos + size ) != 0) { return -1; } memcpy( &mem[pos], buffer, size ); pos += size; this->size += size; return 0; } #define CF_PACKET_ID 0xcfcfcfcf #define CF_PACKET_VERSION 0 enum { CF_PACKET_TYPE_DATA, CF_PACKET_TYPE_ACK // might be used for unreliable protocols }; extern "C" { struct TCPPacketHeader { Uint32 id; Uint8 version; Uint8 type; Uint16 reserved; Uint32 size; }; }; //////////////////////////////////////////////////////////////////////// // NAME : TCPConnection::Open // DESCRIPTION: Open the connection. // PARAMETERS : ipaddr - IP address/server name for client connection/ // NULL for server connection // port - port to connect to/to accept clients on // hook - UserActionHook which can be used to abort this // otherwise synchronous operation // RETURNS : 0 on success, -1 on error, 1 if user aborted //////////////////////////////////////////////////////////////////////// int TCPConnection::Open( const char *ipaddr, Uint16 port, UserActionHook *hook ) { // create the socket set; since we'll only have one peer we don't // really need a set, but the SDLNet API doesn't support // asynchronous operation without it... if ( !set ) { set = SDLNet_AllocSocketSet( 1 ); if ( !set ) { fprintf( stderr, "SDLNet_AllocSocketSet failed\n" ); return -1; } } // create the socket if ( !socket ) { IPaddress ip; server = (ipaddr == NULL); if ( !SDLNet_ResolveHost( &ip, ipaddr, port ) ) { socket = SDLNet_TCP_Open( &ip ); if ( !socket ) { fprintf( stderr, "SDLNet_Open: %s\n", SDLNet_GetError() ); return -1; } } else { fprintf( stderr, "SDLNet_ResolveHost: %s\n", SDLNet_GetError() ); return -1; } } if ( server ) { // wait for a client while ( !client ) { client = SDLNet_TCP_Accept( socket ); if ( !client ) { if ( hook && hook->Cancelled() ) return 1; SDL_Delay( 200 ); } else { SDLNet_TCP_AddSocket( set, client ); } } } else { SDLNet_TCP_AddSocket( set, socket ); } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : TCPConnection::Close // DESCRIPTION: Close the connection. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void TCPConnection::Close( void ) { if (client) { SDLNet_TCP_Close( client ); client = NULL; } if (socket) { SDLNet_TCP_Close( socket ); socket = NULL; } if (set) { SDLNet_FreeSocketSet( set ); set = NULL; } } //////////////////////////////////////////////////////////////////////// // NAME : TCPConnection::Send // DESCRIPTION: Send a buffer over the network. // PARAMETERS : buf - buffer to send // RETURNS : TRUE if buffer was sent successfully, FALSE on error //////////////////////////////////////////////////////////////////////// bool TCPConnection::Send( DynBuffer &buf ) { bool rc = false; TCPsocket dest; dest = (server ? client : socket); if (dest) { int len; struct TCPPacketHeader hdr; hdr.id = SDL_SwapLE32(CF_PACKET_ID); hdr.version = CF_PACKET_VERSION; hdr.type = CF_PACKET_TYPE_DATA; hdr.reserved = 0; hdr.size = SDL_SwapLE32(buf.Size()); len = SDLNet_TCP_Send( dest, &hdr, sizeof(struct TCPPacketHeader) ); if ( len != sizeof(struct TCPPacketHeader) ) { fprintf( stderr, "SDLNet_Send (header): %s\n", SDLNet_GetError() ); } else { len = SDLNet_TCP_Send( dest, buf.GetData(), buf.Size() ); rc = ((unsigned long)len == buf.Size()); if (!rc) fprintf( stderr, "SDLNet_Send (data): %s\n", SDLNet_GetError() ); } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : TCPConnection::Receive // DESCRIPTION: Receive a buffer over the network. If a buffer is // returned, it must be freed by the caller after use. // PARAMETERS : hook - UserActionHook which can be used to abort this // otherwise synchronous operation // RETURNS : received buffer or NULL on error or user abort //////////////////////////////////////////////////////////////////////// DynBuffer *TCPConnection::Receive( UserActionHook *hook ) { DynBuffer *buf = NULL; TCPsocket src; src = (server ? client : socket); if ( src ) { struct TCPPacketHeader hdr; if ( !Read( src, (char *)&hdr, sizeof(struct TCPPacketHeader), hook ) ) return NULL; hdr.id = SDL_SwapLE32(hdr.id); hdr.size = SDL_SwapLE32(hdr.size); if (hdr.id != CF_PACKET_ID) { fprintf( stderr, "TCP_Receive: Received unknown ID %d\n", hdr.id ); return NULL; } else if (hdr.version != CF_PACKET_VERSION) { fprintf( stderr, "TCP_Receive: Received unsupported version %d\n", hdr.version ); return NULL; } else if (hdr.type != CF_PACKET_TYPE_DATA) { fprintf( stderr, "TCP_Receive: Received packet of type %d\n", hdr.type ); return NULL; } buf = new DynBuffer( hdr.size ); buf->SetSize( hdr.size ); if ( !Read( src, buf->GetData(), hdr.size, hook ) ) { delete buf; return NULL; } } return buf; } //////////////////////////////////////////////////////////////////////// // NAME : TCPConnection::Read // DESCRIPTION: Receive a buffer of bytes over the network. This // method waits until the requested amount of data has // arrived. // PARAMETERS : socket - socket to read from // buf - buffer to read into. The buffer must be big // enough to hold the requested data. // size - number of bytes to read // hook - UserActionHook which can be used to abort this // otherwise synchronous operation // RETURNS : TRUE on success, FALSE on error //////////////////////////////////////////////////////////////////////// bool TCPConnection::Read( TCPsocket socket, char *buf, Uint32 size, UserActionHook *hook ) { int len; unsigned int read = 0; do { // we don't want SDLNet_TCP_Recv to block, so we check in advance // whether there is any data waiting for us int ready = SDLNet_CheckSockets( set, 0 ); if ( ready < 0 ) { return false; } else if ( ready == 0 ) { if ( hook && hook->Cancelled() ) return false; SDL_Delay( 200 ); } else { // data available len = SDLNet_TCP_Recv( socket, buf + read, size - read ); if ( len <= 0 ) { fprintf( stderr, "SDLNet_TCP_Recv: %s\n", SDLNet_GetError() ); return false; } read += len; } } while (read < size); return true; } #endif // DISABLE_NETWORK //////////////////////////////////////////////////////////////////////// // NAME : Network::Init // DESCRIPTION: Initialize the networking subsystem. // PARAMETERS : - // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Network::Init( void ) { int rc = 0; #ifndef DISABLE_NETWORK if ( SDLNet_Init() != 0 ) { rc = -1; fprintf( stderr, "SDLNet_Init: %s\n", SDLNet_GetError() ); } #endif return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Network::Shutdown // DESCRIPTION: Shutdown the networking subsystem. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Network::Shutdown( void ) { #ifndef DISABLE_NETWORK SDLNet_Quit(); #endif } crimson-0.5.2.orig/src/cf/network.h0000600000175000017500000000543510554366467015351 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // network.h - networking /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_NETWORK_H #define _INCLUDE_NETWORK_H #ifndef DISABLE_NETWORK #include "SDL_net.h" #include "fileio.h" #include "widget.h" // for UserActionHook class DynBuffer : public MemBuffer { public: DynBuffer( void ); DynBuffer( unsigned long capacity ); ~DynBuffer( void ); unsigned long Size( void ) const { return size; } int SetSize( unsigned long size ); int Read( void *buffer, int size ); unsigned char Read8( void ) { return mem[pos++]; } unsigned short Read16( void ) { unsigned short v = SDL_SwapLE16( *((Uint16 *)&mem[pos]) ); pos += 2; return v; } unsigned long Read32( void ) { unsigned long v = SDL_SwapLE32( *((Uint32 *)&mem[pos]) ); pos += 4; return v; } int Write( const void *values, int size ); int Write8( unsigned char value ) { return Write( &value, 1 ); } int Write16( unsigned short value ) { value = SDL_SwapLE16( value ); return Write( &value, 2 ); } int Write32( unsigned long value ) { value = SDL_SwapLE32( value ); return Write( &value, 4 ); } char *GetData( void ) const { return mem; } private: int Init( unsigned long len ); int CheckResize( unsigned long len ); char *mem; unsigned long size; unsigned long capacity; unsigned long pos; }; class TCPConnection { public: TCPConnection( void ) : socket(0), client(0), set(0) {} ~TCPConnection( void ) { Close(); } int Open( const char *ipaddr, Uint16 port, UserActionHook *hook ); void Close( void ); bool Send( DynBuffer &buf ); DynBuffer *Receive( UserActionHook *hook ); private: bool Read( TCPsocket socket, char *buf, Uint32 size, UserActionHook *hook ); TCPsocket socket; TCPsocket client; SDLNet_SocketSet set; bool server; }; #endif /* DISABLE_NETWORK */ class Network { public: static int Init( void ); static void Shutdown( void ); }; #endif /* _INCLUDE_NETWORK_H */ crimson-0.5.2.orig/src/cf/options.cpp0000600000175000017500000000544510554366423015677 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // options.cpp //////////////////////////////////////////////////////////////////////// #include "options.h" #include "lang.h" #define CF_DEFAULT_PORT 9999 #define CF_DEFAULT_SERVER "localhost" //////////////////////////////////////////////////////////////////////// // NAME : Options::Options // DESCRIPTION: Initialize default options. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Options::Options( void ) : gametype(GTYPE_AI), show_damage(true), replay(true), quick_replay(false), campaign(false), language(CF_LANG_DEFAULT), server(CF_DEFAULT_SERVER), server_port(CF_DEFAULT_PORT), local_port(CF_DEFAULT_PORT) { for (int i = 0; i < KEYBIND_COUNT; ++i) keymap[i] = SDLK_UNKNOWN; #ifdef V43 keymap[KEYBIND_GAME_MENU] = SDLK_TAB; keymap[KEYBIND_UNIT_MENU] = SLK_SPACE; keymap[KEYBIND_UNIT_SELECT] = SDLK_RETURN; #else // some default keys keymap[KEYBIND_GAME_MENU] = SDLK_F1; keymap[KEYBIND_UNIT_NEXT] = SDLK_F2; keymap[KEYBIND_UNIT_SELECT] = SDLK_SPACE; #endif } //////////////////////////////////////////////////////////////////////// // NAME : Options::SetRemoteName // DESCRIPTION: Set name of server to connect to. // PARAMETERS : name - server name or IP address (may be NULL) // RETURNS : - //////////////////////////////////////////////////////////////////////// void Options::SetRemoteName( const char *name ) { if ( name ) server.assign( name ); else server.erase(); } //////////////////////////////////////////////////////////////////////// // NAME : Options::GetRemoteName // DESCRIPTION: Get name of server to connect to. // PARAMETERS : - // RETURNS : name or IP address of server or NULL if not available //////////////////////////////////////////////////////////////////////// const char *Options::GetRemoteName( void ) const { if ( server.empty() ) return NULL; return server.c_str(); } crimson-0.5.2.orig/src/cf/options.h0000600000175000017500000001020610554366466015342 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // options.h // This is used as a persistent options container that holds // relevant settings for longer than the actual Game object // exists and can be used to properly reinitialize when a // new game starts. /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_OPTIONS_H #define _INCLUDE_OPTIONS_H #include #include #include using namespace std; #include "SDL.h" enum KeyBinding { KEYBIND_MINIMIZE = 0, KEYBIND_END_TURN, KEYBIND_SHOW_MAP, KEYBIND_GAME_MENU, KEYBIND_UNIT_MENU, KEYBIND_UNIT_CONTENT, KEYBIND_UNIT_INFO, KEYBIND_UNIT_NEXT, KEYBIND_UNIT_SELECT, KEYBIND_UNIT_UNDO, KEYBIND_UNIT_SWEEP, KEYBIND_COUNT }; enum GameType { GTYPE_AI = 0, GTYPE_HOTSEAT, #ifndef DISABLE_NETWORK GTYPE_NET_SERVER, GTYPE_NET_CLIENT, #endif GTYPE_PBEM, GTYPE_COUNT #ifdef DISABLE_NETWORK , // ugh! GTYPE_NET_SERVER, GTYPE_NET_CLIENT #endif }; class Options { public: Options( void ); void SetDamageIndicator( bool di ) { show_damage = di; } void SetTurnReplay( bool rep ) { replay = rep; } void SetQuickReplay( bool rep ) { quick_replay = rep; } void SetCampaign( bool flag ) { campaign = flag; } void SetLanguage( const char *lang ) { language.assign(lang); } void SetGameType( GameType type ) { gametype = type; } bool GetDamageIndicator( void ) const { return show_damage; } bool GetTurnReplay( void ) const { return replay; } bool GetQuickReplay( void ) const { return quick_replay; } bool GetCampaign( void ) const { return campaign; } const char *GetLanguage( void ) const { return language.c_str(); } GameType GetGameType( void ) const { return gametype; } bool IsAI( void ) const { return (gametype == GTYPE_AI) || GetCampaign(); } bool IsPBEM( void ) const { return (gametype == GTYPE_PBEM) && !GetCampaign(); } bool IsNetwork( void ) const { return ((gametype == GTYPE_NET_SERVER) || (gametype == GTYPE_NET_CLIENT)) && !GetCampaign(); } void SetRemoteName( const char *name ); const char *GetRemoteName( void ) const; void SetRemotePort( unsigned short port ) { server_port = port; } unsigned short GetRemotePort( void ) const { return server_port; } void SetLocalPort( unsigned short port ) { local_port = port; } unsigned short GetLocalPort( void ) const { return local_port; } bool IsLocked( const string &map ) const { return find(unlocked_maps.begin(), unlocked_maps.end(), map) == unlocked_maps.end(); } void Unlock( const string &map ) { if (IsLocked(map)) unlocked_maps.push_back( map ); } const vector &GetUnlockedMaps( void ) const { return unlocked_maps; } const SDLKey *GetKeyBindings( void ) const { return keymap; } void SetKeyBinding( KeyBinding action, SDLKey key ) { keymap[action] = key; } private: GameType gametype; // hot seat, ai, pbem, or network bool show_damage; // show damage indicator bool replay; // show turn replays bool quick_replay; // show only combat results bool campaign; // playing a campaign string language; // network related settings string server; unsigned short server_port; // connecting as client unsigned short local_port; // acting as server vector unlocked_maps; SDLKey keymap[KEYBIND_COUNT]; }; #endif /* _INCLUDE_OPTIONS_H */ crimson-0.5.2.orig/src/cf/path.cpp0000600000175000017500000005072710560716404015136 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // path.cpp -- pathfinding functions //////////////////////////////////////////////////////////////////////// #include #include using namespace std; #include "path.h" //////////////////////////////////////////////////////////////////////// // NAME : BasicPath::BasicPath // DESCRIPTION: Create a new path object. // PARAMETERS : map - map to use for pathfinding // buffer - buffer to store path in; if non-NULL must be // large enough to hold at least (map height x // map width) bytes. If NULL, a new buffer will // be allocated and freed when the path object is // destroyed. // RETURNS : - //////////////////////////////////////////////////////////////////////// BasicPath::BasicPath( Map *map, signed char *buffer ) { this->map = map; buf_private = false; SetBuffer( buffer ); } //////////////////////////////////////////////////////////////////////// // NAME : BasicPath::~BasicPath // DESCRIPTION: Destroy the Path object. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// BasicPath::~BasicPath( void ) { if ( buf_private ) delete [] path; } //////////////////////////////////////////////////////////////////////// // NAME : BasicPath::Clear // DESCRIPTION: Clear the path buffer. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void BasicPath::Clear( void ) { unsigned short size = map->Width() * map->Height(); for ( int i = 0; i < size; ++i ) path[i] = -1; } //////////////////////////////////////////////////////////////////////// // NAME : BasicPath::SetBuffer // DESCRIPTION: Set a new path buffer. // PARAMETERS : buffer - new buffer. If NULL a new buffer is allocated. // RETURNS : - //////////////////////////////////////////////////////////////////////// void BasicPath::SetBuffer( signed char *buffer ) { if ( buf_private ) delete [] path; buf_private = !buffer; if ( buf_private ) { path = new signed char [map->Width() * map->Height()]; } else { path = buffer; } } //////////////////////////////////////////////////////////////////////// // NAME : BasicPath::Find // DESCRIPTION: Search a path on the map. // PARAMETERS : u - unit to search a path for; this may be NULL // only in some special cases (see subclasses) // start - hex to start from (can be different from the // unit's current position) // end - destination hex // RETURNS : approximate number of turns to reach the destination // hex, or -1 if no valid path was found //////////////////////////////////////////////////////////////////////// short BasicPath::Find( const Unit *u, const Point &start, const Point &end ) { vector openlist; greater comp; this->start = start; this->end = end; // array to store node cost in so that we don't have to look it // up in the open list unsigned short mapsize = map->Width() * map->Height(); short *nodeval = new short [mapsize]; for ( int i = 0; i < mapsize; ++i ) { nodeval[i] = -1; path[i] = -1; } // to begin, insert the starting node in openlist PathNode pnode; // starting from the destination would make it a bit easier to record the actual path // but this way we can support going towards the target until we have reached a certain // distance which is rather useful for AI routines... pnode.pos = start; pnode.eta = ETA( start ); pnode.cost = 0; pnode.switched = false; openlist.push_back( pnode ); while( !openlist.empty() ) { pnode = openlist.front(); pop_heap( openlist.begin(), openlist.end(), comp ); openlist.pop_back(); // check for destination if ( StopSearch( pnode ) ) break; // not there yet, so let's look at the hexes around it for ( short dir = NORTH; dir <= NORTHWEST; ++dir ) { Point p; // get the hex in that direction if ( !map->Dir2Hex( pnode.pos, (Direction)dir, p ) ) { PathNode pnode2; pnode2.pos = p; if ( AddNode( u, pnode, pnode2 ) ) { unsigned short index = map->Hex2Index( p ); if ( path[index] == -1 ) { // node has not yet been visited; queue it path[index] = ReverseDir((Direction)dir); nodeval[index] = pnode2.cost; openlist.push_back( pnode2 ); push_heap( openlist.begin(), openlist.end(), comp ); } else if ( nodeval[index] > pnode2.cost ) { // node has been visited before; look for it in the // list of open nodes and replace it if the cost of // the new one is smaller for ( vector::iterator it = openlist.begin(); it != openlist.end(); ++it ) { if ( (*it).pos == pnode2.pos ) { path[index] = ReverseDir((Direction)dir); nodeval[index] = pnode2.cost; (*it).cost = pnode2.cost; (*it).switched = pnode2.switched; push_heap( openlist.begin(), it+1, comp ); break; } } } } } } } delete [] nodeval; // check if we reached our destination return FinalizePath( u, pnode ); } // PATH - a Path is the object used for normal unit pathfinding, // trying to move a unit from A to B // //////////////////////////////////////////////////////////////////////// // NAME : Path::Find // DESCRIPTION: Search a path on the map. // PARAMETERS : u - unit to search a path for; this may be NULL // only in some special cases (see subclasses) // start - hex to start from (can be different from the // unit's current position) // end - destination hex // qual - path quality/speed trade-off (1 is best, 10 is // worst but fastest). Default PATH_BEST. // off - sometimes you don't want to reach the target // hex proper but only get close to it. This is // the maximum distance to the destination for a // path to be considered valid. Default 0. // RETURNS : approximate number of turns to reach the destination // hex, or -1 if no valid path was found //////////////////////////////////////////////////////////////////////// short Path::Find( const Unit *u, const Point &start, const Point &end, unsigned char qual, unsigned char off ) { quality = qual; deviation = off; return BasicPath::Find( u, start, end ); } //////////////////////////////////////////////////////////////////////// // NAME : Path::ETA // DESCRIPTION: Estimate the cost to the destination hex. This is used // as an heuristic for the path finding algorithm. // PARAMETERS : current - current location // RETURNS : estimated cost to destination //////////////////////////////////////////////////////////////////////// inline unsigned short Path::ETA( const Point &p ) const { return Distance( p, end ) * quality; } //////////////////////////////////////////////////////////////////////// // NAME : Path::StepsToDest // DESCRIPTION: Get the number of steps on the path from a given hex to // the destination. // PARAMETERS : pos - hex position to start from // RETURNS : number of steps until destination is reached, or 0 if // no path available or already there //////////////////////////////////////////////////////////////////////// unsigned short Path::StepsToDest( const Point &pos ) const { Point p( pos ); short index = map->Hex2Index( p ); Direction dir = (Direction)path[index]; unsigned short steps = 0; while ( dir != (Direction)-1 ) { map->Dir2Hex( p, dir, p ); index = map->Hex2Index( p ); dir = (Direction)path[index]; ++steps; } return steps; } //////////////////////////////////////////////////////////////////////// // NAME : Path::StopSearch // DESCRIPTION: For the normal pathfinder, the search ends when the // destination is reached (or we're sufficiently close). // PARAMETERS : next - path node to be checked next if search is not // cancelled // RETURNS : TRUE if search aborted, FALSE otherwise //////////////////////////////////////////////////////////////////////// inline bool Path::StopSearch( const PathNode &next ) const { return Distance( next.pos, end ) <= deviation; } //////////////////////////////////////////////////////////////////////// // NAME : Path::AddNode // DESCRIPTION: Calculate the cost for the unit to move from one hex to // another and complete the respective PathNode. // PARAMETERS : u - unit // from - path node for source hex // to - destination path node (adjacent to from). Only // the pos member is initialized and this method // must take care of the rest // RETURNS : TRUE if step is allowed and the node should be added to // the open list, FALSE if step is not allowed //////////////////////////////////////////////////////////////////////// bool Path::AddNode( const Unit *u, const PathNode &from, PathNode &to ) const { unsigned short obst; short cost = map->MoveCost( u, from.pos, to.pos, obst ); bool rc = false; if ( obst != 0 ) { if ( !map->GetMapObject( to.pos ) || (to.pos == end) ) cost = MAX( u->Moves() - from.cost, cost ); else cost = -1; } if ( cost >= 0 ) { to.cost = from.cost + cost; to.eta = ETA( to.pos ); rc = true; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Path::FinalizePath // DESCRIPTION: Check whether a path has been found, prepare the buffer // and set the return code of the pathfinder. // PARAMETERS : u - unit searching the path // last - final path node // RETURNS : cost of the path in turns for the unit (approximately), // or -1 if no valid path was found //////////////////////////////////////////////////////////////////////// short Path::FinalizePath( const Unit *u, const PathNode &last ) const { short turns = -1; Point p = last.pos; if ( Distance( p, end ) <= deviation ) { // correct the path // move back to beginning short index = map->Hex2Index( p ); Direction dir = (Direction)path[index], dir2; path[index] = -1; while ( p != start ) { map->Dir2Hex( p, dir, p ); index = map->Hex2Index( p ); dir2 = (Direction)path[index]; path[index] = ReverseDir( dir ); dir = dir2; } if ( u->Type()->Speed() == 0 ) turns = 100; else turns = (last.cost + u->Type()->Speed() - 1) / u->Type()->Speed(); } return turns; } // MOVE SHADER - this is used to create the buffer for shading of // illegal moves when selecting a unit // // //////////////////////////////////////////////////////////////////////// // NAME : MoveShader::ETA // DESCRIPTION: Estimate the cost to the destination hex. This is used // as an heuristic for the path finding algorithm. // PARAMETERS : current - current location // RETURNS : estimated cost to destination //////////////////////////////////////////////////////////////////////// // inline unsigned short MoveShader::ETA( const Point &p ) const; //////////////////////////////////////////////////////////////////////// // NAME : MoveShader::StopSearch // DESCRIPTION: The shader never stops the search while there are nodes // left in the open list. // PARAMETERS : next - path node to be checked next if search is not // cancelled // RETURNS : TRUE if search aborted, FALSE otherwise //////////////////////////////////////////////////////////////////////// // inline bool MoveShader::StopSearch( const PathNode &next ) const; //////////////////////////////////////////////////////////////////////// // NAME : MoveShader::AddNode // DESCRIPTION: Calculate the cost for the unit to move from one hex to // another. // PARAMETERS : u - unit // from - path node for source hex // to - destination path node // RETURNS : TRUE if step is allowed and the node should be added to // the open list, FALSE if step is not allowed //////////////////////////////////////////////////////////////////////// bool MoveShader::AddNode( const Unit *u, const PathNode &from, PathNode &to ) const { unsigned short obst; short cost = map->MoveCost( u, from.pos, to.pos, obst ); bool rc = false; if ( cost > u->Moves() - from.cost ) cost = -1; else if ( obst != 0 ) cost = u->Moves() - from.cost; if ( cost >= 0 ) { to.cost = from.cost + cost; to.eta = ETA( to.pos ); rc = true; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : MoveShader::FinalizePath // DESCRIPTION: The shader doesn't have a path to prepare, but we must // check for valid targets which must not be shaded. // PARAMETERS : u - unit searching the path // last - final path node // RETURNS : always 1 //////////////////////////////////////////////////////////////////////// short MoveShader::FinalizePath( const Unit *u, const PathNode &last ) const { for ( Unit *target = static_cast(units.Head()); target; target = static_cast(target->Next()) ) { if ( u->CanHit( target ) ) path[map->Hex2Index( target->Position() )] = 1; } path[map->Hex2Index( u->Position() )] = 1; return 1; } //////////////////////////////////////////////////////////////////////// // NAME : MinesweeperShader::AddNode // DESCRIPTION: See whether there's a mine to be swept on a hex next to // the mine-sweeper unit. Enemy mines can only be cleared // if there is no other enemy unit (excluding mines) on a // field adjacent to the mine. // PARAMETERS : u - mine-sweeper unit // from - path node for source hex // to - destination path node (adjacent to from) // RETURNS : TRUE if step is allowed and the node should be added to // the open list, FALSE if step is not allowed //////////////////////////////////////////////////////////////////////// bool MinesweeperShader::AddNode( const Unit *u, const PathNode &from, PathNode &to ) const { bool rc = false; if ( NextTo( u->Position(), to.pos ) && (u->Terrain() & map->TerrainTypes(to.pos)) ) { Unit *m = map->GetUnit( to.pos ); if ( m && m->IsMine() ) { bool enemy = false; if ( m->Owner() != u->Owner() ) { Point adj[6]; map->GetNeighbors( to.pos, adj ); for ( int i = NORTH; (i <= NORTHWEST) && !enemy; ++i ) { if ( adj[i].x != -1 ) { Unit *e = map->GetUnit( adj[i] ); if ( e && (e->Owner() == m->Owner()) && !e->IsMine() ) enemy = true; } } } if ( !enemy ) { to.cost = 0; to.eta = ETA( to.pos ); rc = true; } } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : MinesweeperShader::FinalizePath // DESCRIPTION: The shader doesn't have a path to prepare. // PARAMETERS : u - unit searching the path // last - final path node // RETURNS : always 1 //////////////////////////////////////////////////////////////////////// short MinesweeperShader::FinalizePath( const Unit *u, const PathNode &last ) const { path[map->Hex2Index( u->Position() )] = 1; return 1; } //////////////////////////////////////////////////////////////////////// // NAME : TransPath::TransPath // DESCRIPTION: Create a new path object for finding a path from a // source to a destination via a transport. A single // TransPath does only half of the work, either the unit // getting to the transport or the transport containing the // unit getting to the destination. Therefore you always // need two TransPaths to really service a transportation // request. Always call TransPath::Find( , , , ... )! // PARAMETERS : map - map to use for pathfinding // trans - transport which will carry the unit // buffer - buffer to store path in; if non-NULL must be // large enough to hold at least (map height x // map width) bytes. If NULL, a new buffer will // be allocated and freed when the path object is // destroyed. // RETURNS : - //////////////////////////////////////////////////////////////////////// TransPath::TransPath( Map *map, const Transport *trans, signed char *buffer ) : Path( map, buffer ) { t = trans; } //////////////////////////////////////////////////////////////////////// // NAME : TransPath::AddNode // DESCRIPTION: Calculate the cost for the unit to move from one hex to // another. // PARAMETERS : u - unit // from - path node for source hex // to - destination path node (adjacent to from) // RETURNS : TRUE if step is allowed and the node should be added to // the open list, FALSE if step is not allowed //////////////////////////////////////////////////////////////////////// bool TransPath::AddNode( const Unit *u, const PathNode &from, PathNode &to ) const { const Unit *cur = (from.switched ? u : t); bool rc = false; // important for all checks: on a TransPath the path is checked in the // direction Transport->Destination where destination may be the unit // or the final destination. This means that the unit must have made at // least one step before reaching the destination (switched == true) // for any path to be legal. short cost = -1; const TerrainType *type = map->HexType( to.pos ); bool hexok = (type->tt_type & cur->Terrain()) != 0; Unit *block = map->GetUnit( to.pos ); if ( (to.pos != end) || from.switched ) { if ( block ) { if ( block->IsTransport() && (to.pos == end) && from.switched && !cur->IsSheltered() && static_cast(block)->Allow(cur) ) cost = MAX( cur->Moves() - from.cost, MCOST_MIN ); else if ( hexok ) cost = MCOST_UNIT; } else { unsigned short state; cost = map->MoveCost( cur, from.pos, to.pos, state ); if ( state != 0 ) { if ( from.cost >= cur->Moves() ) cost = cur->Moves(); else cost = MAX( cur->Moves() - from.cost, cost ); } } } if ( cost != -1 ) { to.cost = from.cost + cost; to.eta = ETA( to.pos ); to.switched = from.switched; rc = true; } else if ( !from.switched ) { // let's see if we can continue here when switching to the other unit PathNode from2 = from; from2.switched = to.switched = true; rc = AddNode( u, from2, to ); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : TransPath::Reverse // DESCRIPTION: Rerecord a path in the opposite direction. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void TransPath::Reverse( void ) { Point p( start ); short index = map->Hex2Index( p ); Direction dir = (Direction)path[index], dir2; path[index] = -1; while ( p != end ) { map->Dir2Hex( p, dir, p ); index = map->Hex2Index( p ); dir2 = (Direction)path[index]; path[index] = ReverseDir( dir ); dir = dir2; } end = start; start = p; } crimson-0.5.2.orig/src/cf/path.h0000600000175000017500000001012410554366466014602 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ///////////////////////////////////////////////////////////////////////// // path.h - pathfinding ///////////////////////////////////////////////////////////////////////// #ifndef _INCLUDE_PATH_H #define _INCLUDE_PATH_H #include "map.h" #include "misc.h" #define PATH_BEST 1 #define PATH_GOOD 4 #define PATH_FAST 10 struct PathNode { Point pos; unsigned short eta; // estimated time of arrival unsigned short cost; // travelling cost so far bool switched; // only used by TransPath bool operator>(const PathNode &p) const { return eta + cost > p.eta + p.cost; } }; class BasicPath { public: BasicPath( Map *map, signed char *buffer ); virtual ~BasicPath( void ); void Clear( void ); const Point &Destination( void ) const { return end; } signed char GetStep( const Point ¤t ) const { return path[map->Hex2Index(current)]; } protected: void SetBuffer( signed char *buffer ); short Find( const Unit *u, const Point &start, const Point &end ); virtual unsigned short ETA( const Point &p ) const = 0; virtual bool StopSearch( const PathNode &next ) const = 0; virtual bool AddNode( const Unit *u, const PathNode &from, PathNode &to ) const = 0; virtual short FinalizePath( const Unit *u, const PathNode &last ) const = 0; Map *map; signed char *path; Point start; Point end; private: bool buf_private; // delete buffer when path is destroyed }; class Path : public BasicPath { public: Path( Map *map, signed char *buffer = NULL ) : BasicPath(map, buffer) {} short Find( const Unit *u, const Point &start, const Point &end, unsigned char qual = PATH_BEST, unsigned char off = 0 ); unsigned short StepsToDest( const Point &pos ) const; protected: unsigned short ETA( const Point &p ) const; bool StopSearch( const PathNode &next ) const; virtual bool AddNode( const Unit *u, const PathNode &from, PathNode &to ) const; short FinalizePath( const Unit *u, const PathNode &last ) const; unsigned char quality; unsigned char deviation; }; class MoveShader : public BasicPath { public: MoveShader( Map *map, const List &units, signed char *buffer = NULL ) : BasicPath(map, buffer), units(units) {} void ShadeMap( const Unit *u ) { Find( u, u->Position(), Point(0,0) ); } protected: unsigned short ETA( const Point &p ) const { return 1; } bool StopSearch( const PathNode &next ) const { return false; } virtual bool AddNode( const Unit *u, const PathNode &from, PathNode &to ) const; virtual short FinalizePath( const Unit *u, const PathNode &last ) const; const List &units; }; class MinesweeperShader : public MoveShader { public: MinesweeperShader( Map *map, const List &units, signed char *buffer = NULL ) : MoveShader( map, units, buffer ) {} protected: bool AddNode( const Unit *u, const PathNode &from, PathNode &to ) const; short FinalizePath( const Unit *u, const PathNode &last ) const; }; class TransPath : public Path { public: TransPath( Map *map, const Transport *trans, signed char *buffer = NULL ); void Reverse( void ); protected: bool AddNode( const Unit *u, const PathNode &from, PathNode &to ) const; const Transport *t; }; #endif /* _INCLUDE_PATH_H */ crimson-0.5.2.orig/src/cf/platform.cpp0000600000175000017500000001473710554366422016033 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // ported to Windows Mobile 2006 by Silvio Iaccarino (silvio@iaccarino.de) // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // platform.cpp -- platform-specific functions //////////////////////////////////////////////////////////////////////// #include "platform.h" #ifdef _WIN32_WCE #include #include #include #include "game.h" static HWND GetMainWnd( void ) { return FindWindow( _T("SDL_app"), _T(PROGRAMNAME) ); } // a dirty hack to keep phone editions working static void ShowTaskBar( bool bShow ) { HWND hWndTaskBar = FindWindow( TEXT("HHTaskBar"), NULL ); if (!hWndTaskBar) return; if (bShow) { if (!IsWindowVisible( hWndTaskBar )) ShowWindow( hWndTaskBar, SW_SHOWNORMAL ); if (!IsWindowEnabled( hWndTaskBar )) EnableWindow( hWndTaskBar, TRUE ); InvalidateRect( hWndTaskBar, NULL, TRUE ); UpdateWindow( hWndTaskBar ); } else if (IsWindowVisible( hWndTaskBar )) ShowWindow( hWndTaskBar, SW_HIDE ); } // the old SDL window proc static WNDPROC g_oldWindowProc = NULL; static LRESULT crimsonWndProc( HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam ) { View *theView; switch (msg) { case WM_SHOWWINDOW: if (wParam) { SHFullScreen( hWnd, SHFS_HIDESIPBUTTON|SHFS_HIDETASKBAR|SHFS_HIDESTARTICON ); ShowTaskBar( false ); theView = (View *)GetWindowLong( hWnd, GWL_USERDATA ); if (theView) { theView->EnableUpdates(); // screen needs update theView->Refresh(); } } else { SHFullScreen( hWnd, SHFS_SHOWSIPBUTTON|SHFS_SHOWTASKBAR|SHFS_SHOWSTARTICON ); ShowTaskBar( true ); theView = (View *)GetWindowLong( hWnd, GWL_USERDATA ); if (theView) theView->DisableUpdates(); } break; case WM_ACTIVATE: // get the stored reference to the view theView = (View *)GetWindowLong( hWnd, GWL_USERDATA ); if (theView) { // initialized yet WORD fActive = LOWORD(wParam); if (fActive) { SetForegroundWindow(hWnd); // I'm the one and only // hide the SIP panel to disable the virtual keyboard SHFullScreen( hWnd, SHFS_HIDESIPBUTTON|SHFS_HIDETASKBAR|SHFS_HIDESTARTICON ); ShowTaskBar( false ); theView->EnableUpdates(); // screen needs update theView->Refresh(); } else { // restore the SIP panel to enable the virtual keyboard SHFullScreen( hWnd, SHFS_SHOWSIPBUTTON|SHFS_SHOWTASKBAR|SHFS_SHOWSTARTICON ); ShowTaskBar( true ); theView->DisableUpdates(); } } break; case WM_KEYDOWN: case WM_KEYUP: { UINT mappedKey = 0; switch (wParam) { case VK_LWIN: SDL_WM_IconifyWindow(); return TRUE; case VK_ESCAPE: // WinCE devices don't have an ESC key mappedKey=VK_BACK; break; case VK_VOLUME_UP: mappedKey = VK_F6; break; case VK_NUMPAD7: // Volume Down case VK_VOLUME_DOWN: mappedKey = VK_F7; break; case VK_NUMPAD8: // '*' mappedKey = '.'; break; case VK_NUMPAD9: // '#' mappedKey = ','; // VK_F9; break; case VK_MULTIPLY: // camera key mappedKey = VK_F10; break; } if (mappedKey) { // don't route message to SDL, simulate a key instead keybd_event( mappedKey, MapVirtualKey(mappedKey,0), msg == WM_KEYUP ? KEYEVENTF_KEYUP : 0, 0 ); return TRUE; } } break; } // now let SDL do the rest return CallWindowProc( g_oldWindowProc, hWnd, msg, wParam, lParam ); } bool platform_init( GUIOptions &opts ) { HWND hwnd = FindWindow( _T("SDL_app"), _T(PROGRAMNAME) ); if ( hwnd ) { SetForegroundWindow( hwnd ); ShowWindow( hwnd, SW_SHOW ); return false; } unsigned short maxw = GetSystemMetrics(SM_CXSCREEN); unsigned short maxh = GetSystemMetrics(SM_CYSCREEN); if( opts.px_width > maxw ) opts.px_width = maxw; if( opts.px_height > maxh ) opts.px_height = maxh; opts.sdl_flags |= SDL_FULLSCREEN; return true; } bool platform_setup( View *view ) { // prepare the SDL window for the PocketPC environment HWND hwnd = GetMainWnd(); if (!hwnd) // no hook no fun! return false; // hide the SIP panel to disable the virtual keyboard SHFullScreen( hwnd, SHFS_HIDESIPBUTTON|SHFS_HIDETASKBAR|SHFS_HIDESTARTICON ); SHSipPreference( hwnd, SIP_FORCEDOWN ); // hide taskbar notifications without disabling phone ShowTaskBar( false ); // store a reference to the main view SetWindowLong( hwnd, GWL_USERDATA, (LONG)view ); // Subclass the windows proc WNDPROC theWindowProc = (WNDPROC)GetWindowLong( hwnd, GWL_WNDPROC ); if (theWindowProc != NULL && theWindowProc != crimsonWndProc) { g_oldWindowProc = theWindowProc; SetWindowLong( hwnd, GWL_WNDPROC, (LONG)crimsonWndProc ); } return true; } void platform_dispose( void ) { HWND hwnd = GetMainWnd(); if (hwnd) { SetWindowLong( hwnd, GWL_WNDPROC, (LONG)g_oldWindowProc ); SetWindowLong( hwnd, GWL_USERDATA, 0 ); SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON|SHFS_SHOWTASKBAR|SHFS_SHOWSTARTICON ); } // restore previous system state ShowTaskBar( true ); } void platform_shutdown( void ) { HWND hWndTaskBar = FindWindow( TEXT("HHTaskBar"), NULL ); if (hWndTaskBar) { InvalidateRect( hWndTaskBar, NULL, TRUE ); UpdateWindow( hWndTaskBar ); } // sometimes closing SDL windows will leave some rubbish on screen HWND hwnd = ::GetDesktopWindow(); if (IsWindowVisible(hwnd)) { InvalidateRect( hwnd, NULL, TRUE ); UpdateWindow( hwnd ); } } #else bool platform_init( GUIOptions &opts ) { return true; } bool platform_setup( View *view ) { return true; } void platform_dispose( void ) {} void platform_shutdown( void ) {} #endif // _WIN32_WCE crimson-0.5.2.orig/src/cf/platform.h0000600000175000017500000000302110554366467015471 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // platform.h -- platform-specific functions /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_PLATFORM_H #define _INCLUDE_PLATFORM_H #include "view.h" struct GUIOptions { short px_width; short px_height; short bpp; bool sfx; bool music; unsigned char sfx_vol; unsigned char music_vol; unsigned long sdl_flags; const char *level; }; // init environment bool platform_init( GUIOptions &opts ); // setup display bool platform_setup( View *view ); // prepare for closing the display void platform_dispose( void ); // clean up after resources have been released void platform_shutdown( void ); #endif /* _INCLUDE_PLATFORM_H */ crimson-0.5.2.orig/src/cf/player.cpp0000600000175000017500000001005010554366414015464 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // player.cpp //////////////////////////////////////////////////////////////////////// #include #include "player.h" #include "strutil.h" #include "gamedefs.h" //////////////////////////////////////////////////////////////////////// // NAME : Player::Load // DESCRIPTION: Load player information from a file. // PARAMETERS : file - data file descriptor // RETURNS : - //////////////////////////////////////////////////////////////////////// int Player::Load( MemBuffer &file ) { p_id = file.Read8(); p_type = file.Read8(); p_success = file.Read8(); p_briefing = file.Read8(); p_name_id = file.Read8(); unsigned char len = file.Read8(); p_password = StringUtil::crypt( file.ReadS(len) ); p_col_light.r = file.Read8(); p_col_light.g = file.Read8(); p_col_light.b = file.Read8(); p_col_dark.r = file.Read8(); p_col_dark.g = file.Read8(); p_col_dark.b = file.Read8(); p_mode = MODE_IDLE; p_remote = false; p_units = 0; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Player::Save // DESCRIPTION: Save player information to a file. // PARAMETERS : file - data file descriptor // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int Player::Save( MemBuffer &file ) const { file.Write8( p_id ); file.Write8( p_type ); file.Write8( p_success ); file.Write8( p_briefing ); file.Write8( p_name_id ); file.Write8( p_password.size() ); file.WriteS( StringUtil::crypt( p_password ) ); file.Write8( p_col_light.r ); file.Write8( p_col_light.g ); file.Write8( p_col_light.b ); file.Write8( p_col_dark.r ); file.Write8( p_col_dark.g ); file.Write8( p_col_dark.b ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Player::Password // DESCRIPTION: Get the player's password. // PARAMETERS : - // RETURNS : pointer to password, or NULL if no password set //////////////////////////////////////////////////////////////////////// const char *Player::Password( void ) const { if ( !p_password.empty() ) return p_password.c_str(); return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : Player::SetPassword // DESCRIPTION: Set the player's password. // PARAMETERS : password - new player password; the function does not // check whether it fits into the password // buffer; may be NULL to erase the player's // current password // RETURNS : - //////////////////////////////////////////////////////////////////////// void Player::SetPassword( const char *password ) { if ( password == NULL ) p_password.erase(); else p_password.assign( password ); } //////////////////////////////////////////////////////////////////////// // NAME : Player::Units // DESCRIPTION: Increase or decrease the player's unit count. // PARAMETERS : delta - change in number of units // RETURNS : number of units after change //////////////////////////////////////////////////////////////////////// unsigned short Player::Units( short delta ) { p_units += delta; return p_units; } crimson-0.5.2.orig/src/cf/player.h0000600000175000017500000000566610554366466015161 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ///////////////////////////////////////////////////////////////////// // player.h ///////////////////////////////////////////////////////////////////// #ifndef _INCLUDE_PLAYER_H #define _INCLUDE_PLAYER_H #include "fileio.h" #include "gamedefs.h" #include "color.h" #define MODE_IDLE 1 // no unit selected #define MODE_BUSY 2 // unit selected #define MODE_DIG 3 // for pioneers #define MODE_CONSTRUCTION 4 // for depot builders #define MODE_SWEEP 5 // for mine-sweepers class Player { public: Player( void ) : p_name(0) {} int Load( MemBuffer &file ); int Save( MemBuffer &file ) const; signed char Briefing( void ) const { return p_briefing; } unsigned char ID( void ) const { return p_id; } unsigned char Mode( void ) const { return p_mode; } const char *Name( void ) const { return p_name; } signed char NameID( void ) const { return p_name_id; } const char *Password( void ) const; unsigned char Type( void ) const { return p_type; } bool IsHuman( void ) const { return p_type == HUMAN; } bool IsRemote( void ) const { return p_remote; } bool IsInteractive( void ) const { return IsHuman() && !IsRemote(); } void SetBriefing( signed char brief ) { p_briefing = brief; } void SetMode( unsigned char mode ) { p_mode = mode; } void SetType( unsigned char type ) { p_type = type; } void SetRemote( bool remote ) { p_remote = remote; } void SetPassword( const char *password ); void SetName( const char *name ) { p_name = name; } unsigned char Success( signed char success ) { p_success += success; return p_success; } unsigned short Units( short delta ); const Color &LightColor( void ) const { return p_col_light; } const Color &DarkColor( void ) const { return p_col_dark; } private: unsigned char p_id; unsigned char p_mode; unsigned char p_type; // COMPUTER or HUMAN bool p_remote; // remote player in network game unsigned short p_units; unsigned char p_success; // if p_success == 100 the level is completed signed char p_briefing; signed char p_name_id; const char *p_name; string p_password; Color p_col_light; Color p_col_dark; }; #endif /* _INCLUDE_PLAYER_H */ crimson-0.5.2.orig/src/cf/unit.cpp0000600000175000017500000002641010554366414015156 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ///////////////////////////////////////////////////////////////////////// // unit.cpp //////////////////////////////////////////////////////////////////////// #include "unit.h" #include "hexsup.h" //////////////////////////////////////////////////////////////////////// // NAME : Unit::Unit // DESCRIPTION: Create a new unit. // PARAMETERS : type - pointer to a unit type definition // player - pointer to the player this unit belongs to // id - unique unit identifier // pos - position on map // RETURNS : - //////////////////////////////////////////////////////////////////////// Unit::Unit( const UnitType *type, Player *player, unsigned short id, const Point &pos ) : MapObject( MO_UNIT ), u_pos(pos), u_id(id), u_type(type), u_player(0) { u_flags = type->Flags(); u_facing = NORTH; u_group = MAX_GROUP_SIZE; u_xp = 0; u_target.x = u_target.y = 0; SetOwner( player ); } //////////////////////////////////////////////////////////////////////// // NAME : Unit::Load // DESCRIPTION: Load a unit from a data file. // PARAMETERS : file - descriptor of an open data file // type - pointer to a unit type definition // player - pointer to the player this unit belongs to // RETURNS : - //////////////////////////////////////////////////////////////////////// int Unit::Load( MemBuffer &file, const UnitType *type, Player *player ) { u_pos.x = file.Read16(); u_pos.y = file.Read16(); u_flags = file.Read32(); u_id = file.Read16(); u_facing = file.Read8(); u_group = file.Read8(); u_xp = file.Read8(); u_target.x = file.Read16(); u_target.y = file.Read16(); u_type = type; u_player = 0; SetOwner( player ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Unit::Save // DESCRIPTION: Save the unit to a data file. // PARAMETERS : file - descriptor of the save file // RETURNS : 0 on succes, non-zero on error //////////////////////////////////////////////////////////////////////// int Unit::Save( MemBuffer &file ) const { file.Write8( u_type->ID() ); file.Write8( u_player ? u_player->ID() : PLAYER_NONE ); file.Write16( u_pos.x ); file.Write16( u_pos.y ); file.Write32( u_flags ); file.Write16( u_id ); file.Write8( u_facing ); file.Write8( u_group ); file.Write8( u_xp ); file.Write16( u_target.x ); file.Write16( u_target.y ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Unit::AwardXP // DESCRIPTION: Raise the unit's experience level. This will improve its // chances to survive a battle and inflict more damage to // the enemy. // PARAMETERS : xp - number of experience points to give; a unit // advances to a new experience level every 3 points // RETURNS : - //////////////////////////////////////////////////////////////////////// void Unit::AwardXP( unsigned char xp ) { // XP_MAX_LEVEL is the maximum experience level a unit can reach, // i.e. XP_MAX_LEVEL * XP_PER_LEVEL is the upper limit in points u_xp = MIN( u_xp + xp, XP_MAX_LEVEL * XP_PER_LEVEL ); } //////////////////////////////////////////////////////////////////////// // NAME : Unit::SetOwner // DESCRIPTION: Change the controller of the unit. // PARAMETERS : player - pointer to new controller // RETURNS : - //////////////////////////////////////////////////////////////////////// void Unit::SetOwner( Player *player ) { if ( player != u_player ) { if ( !IsDummy() ) { if ( u_player ) u_player->Units( -1 ); player->Units( 1 ); } u_player = player; } } //////////////////////////////////////////////////////////////////////// // NAME : Unit::SetPosition // DESCRIPTION: Change the position of the unit on the map. This is just // the low level function. It does not update the display // or do other fancy things. It's just about data shuffling. // PARAMETERS : x - new x position // y - new y position // RETURNS : - //////////////////////////////////////////////////////////////////////// void Unit::SetPosition( short x, short y ) { u_pos.x = x; u_pos.y = y; } //////////////////////////////////////////////////////////////////////// // NAME : Unit::Attack // DESCRIPTION: Store an attack target. Again, this function does not // handle the display update, or the game mode change. // PARAMETERS : enemy - unit to attack // RETURNS : - //////////////////////////////////////////////////////////////////////// void Unit::Attack( const Unit *enemy ) { u_target = enemy->Position(); SetFlags( U_ATTACKED|U_DONE ); } //////////////////////////////////////////////////////////////////////// // NAME : Unit::DefensiveStrength // DESCRIPTION: Get a number measuring the defensive capabilities // of the unit. // PARAMETERS : - // RETURNS : armour value //////////////////////////////////////////////////////////////////////// unsigned char Unit::DefensiveStrength( void ) const { return u_type->Armour(); } //////////////////////////////////////////////////////////////////////// // NAME : Unit::OffensiveStrength // DESCRIPTION: Return the combat value of the unit against the given // target. // PARAMETERS : target - unit to attack // RETURNS : offensive strength //////////////////////////////////////////////////////////////////////// unsigned char Unit::OffensiveStrength( const Unit *target ) const { unsigned char pow; if ( target->IsShip() || target->IsFloating() ) pow = u_type->Firepower(U_SHIP); else if ( target->IsAircraft() ) pow = u_type->Firepower(U_AIR); else pow = u_type->Firepower(U_GROUND); return pow; } //////////////////////////////////////////////////////////////////////// // NAME : Unit::Hit // DESCRIPTION: Inflict damage to the unit and destroy it if necessary. // PARAMETERS : damage - how much damage is done // RETURNS : true if the unit was destroyed, false otherwise //////////////////////////////////////////////////////////////////////// bool Unit::Hit( unsigned short damage ) { if ( IsAlive() ) { if ( u_group <= damage ) { // unit destroyed u_group = 0; SetFlags( U_DESTROYED ); u_pos.x = u_pos.y = -1; if ( !IsDummy() ) u_player->Units( -1 ); return true; } u_group -= damage; } return false; } //////////////////////////////////////////////////////////////////////// // NAME : Unit::CanHitType // DESCRIPTION: Check whether the unit can shoot at an enemy unit. The // test is performed looking only at the enemy unit type // (ground, ship. aircraft, or submarine). If the function // returns true, this doesn't mean that the enemy is // actually in range for the unit's weapons systems. // PARAMETERS : enemy - enemy unit // RETURNS : true if the unit type can be shot; false otherwise //////////////////////////////////////////////////////////////////////// bool Unit::CanHitType( const Unit *enemy ) const { return WeaponRange( enemy ) > 0; } //////////////////////////////////////////////////////////////////////// // NAME : Unit::CanHit // DESCRIPTION: Check whether the unit can shoot at an enemy unit. The // test is performed with regard to the enemy unit type // (ground, ship. aircraft, or submarine) and the distance // of the target. // PARAMETERS : enemy - enemy unit // RETURNS : true if the unit can be shot; false if it's the wrong // type, too far away, or not hostile //////////////////////////////////////////////////////////////////////// bool Unit::CanHit( const Unit *enemy ) const { if ( (u_player == enemy->Owner()) || (u_flags & (U_DONE|U_SHELTERED)) || enemy->IsSheltered() ) return false; return CouldHit( enemy ); } //////////////////////////////////////////////////////////////////////// // NAME : Unit::CouldHit // DESCRIPTION: Check whether the unit could shoot at an enemy unit. // Current unit status is not taken into account, so this // function may return true, even though the unit already // attacked this turn or moved and can't attack any more. // PARAMETERS : enemy - enemy unit // RETURNS : true if the unit type could be shot; false otherwise //////////////////////////////////////////////////////////////////////// bool Unit::CouldHit( const Unit *enemy ) const { unsigned short dist = Distance( u_pos, enemy->Position() ); unsigned long type; // be careful with amphibian units if ( enemy->IsAircraft() ) type = U_AIR; else if ( enemy->IsShip() || enemy->IsFloating() ) type = U_SHIP; else type = U_GROUND; return u_type->IsInFOF( dist, type ); } //////////////////////////////////////////////////////////////////// // NAME : Unit::Repair // DESCRIPTION: Repair the unit (completely). This will get the // group size of the unit back to the maximum, but will // also lower its experience by one point per "rookie". // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Unit::Repair( void ) { if ( u_group < MAX_GROUP_SIZE ) { u_xp = MAX( 0, u_xp - (MAX_GROUP_SIZE - u_group) ); u_group = MAX_GROUP_SIZE; SetFlags( U_DONE ); // can't move this turn } } //////////////////////////////////////////////////////////////////////// // NAME : Unit::WeaponRange // DESCRIPTION: Get the distance from which the unit may shoot at a // given target. // PARAMETERS : u - target unit // RETURNS : maximum range of fire //////////////////////////////////////////////////////////////////////// unsigned char Unit::WeaponRange( const Unit *u ) const { unsigned char range; if ( u->IsAircraft() ) range = u_type->MaxFOF(U_AIR); else if ( u->IsShip() || u->IsFloating() ) range = u_type->MaxFOF(U_SHIP); else range = u_type->MaxFOF(U_GROUND); return range; } //////////////////////////////////////////////////////////////////////// // NAME : Unit::Moves // DESCRIPTION: Get movement points for this unit. // PARAMETERS : - // RETURNS : movement points //////////////////////////////////////////////////////////////////////// unsigned char Unit::Moves( void ) const { unsigned char mp; if ( Flags() & (U_ATTACKED|U_MOVED|U_DONE) ) mp = 0; // mines inside shops or transporters get MCOST_MIN points so they // can move out else if ( IsMine() && IsSheltered() ) mp = 1; else mp = u_type->Speed(); return mp; } crimson-0.5.2.orig/src/cf/unit.h0000600000175000017500000001234110554366466014630 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // unit.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_UNIT_H #define _INCLUDE_UNIT_H #include "list.h" #include "player.h" #include "sound.h" #include "misc.h" #include "lset.h" #define MO_UNIT 1 #define MO_BUILDING 2 class MapObject { public: MapObject( unsigned short type ) : mo_type(type) {} virtual ~MapObject( void ) {} virtual const char *Name( void ) const = 0; virtual Player *Owner( void ) const = 0; virtual const Point &Position( void ) const = 0; bool IsUnit( void ) const { return mo_type == MO_UNIT; } bool IsShop( void ) const { return mo_type == MO_BUILDING; } private: unsigned short mo_type; }; #define CRYSTALS_REPAIR 5 class Unit : public Node, public MapObject { public: Unit( void ) : MapObject(MO_UNIT) {} Unit( const UnitType *type, Player *player, unsigned short id, const Point &pos ); virtual int Load( MemBuffer &file, const UnitType *type, Player *player ); virtual int Save( MemBuffer &file ) const; unsigned short BaseImage( void ) const { return u_type->Image() + u_player->ID() * 6; } unsigned short BuildCost( void ) const { return u_type->Cost(); } unsigned long Flags( void ) const { return u_flags; } unsigned char GroupSize( void ) const { return u_group; } unsigned short ID( void ) const { return u_id; } unsigned char Facing( void ) const { return u_facing; } unsigned short Image( void ) const { return BaseImage() + Facing(); } unsigned char Moves( void ) const; const char *Name( void ) const { return u_type->Name(); } Player *Owner( void ) const { return u_player; } const Point &Position( void ) const { return u_pos; } const Point *Target( void ) const { return( (u_flags & U_ATTACKED) ? &u_target : NULL ); } unsigned short Terrain( void ) const { return u_type->Terrain(); } const UnitType *Type( void ) const { return u_type; } unsigned char WeaponRange( const Unit *u ) const; unsigned char XP( void ) const { return u_xp; } unsigned char XPLevel( void ) const { return XP()/XP_PER_LEVEL; } void AwardXP( unsigned char xp ); void SetOwner( Player *player ); virtual void SetPosition( short x, short y ); void SetGroupSize( unsigned char size ) { u_group = size; } void SetFlags( unsigned long f ) { u_flags |= (f); } void UnsetFlags( unsigned long f ) { u_flags &= (~f); } bool IsGround( void ) const { return (u_flags & U_GROUND) != 0; } bool IsShip( void ) const { return (u_flags & U_SHIP) != 0; } bool IsAircraft( void ) const { return (u_flags & U_AIR) != 0; } bool IsMine( void ) const { return (u_flags & U_MINE) != 0; } bool IsTransport( void ) const { return (u_flags & U_TRANSPORT) != 0; } bool IsMedic( void ) const { return (u_flags & U_MEDIC) != 0; } bool IsMinesweeper( void ) const { return (u_flags & U_MINESWEEPER) != 0; } bool IsSlow( void ) const { return (u_flags & U_SLOW) != 0; } bool IsConquer( void ) const { return (u_flags & U_CONQUER) != 0; } bool IsSheltered( void ) const { return (u_flags & U_SHELTERED) != 0; } bool IsReady( void ) const { return (u_flags & (U_DESTROYED|U_DONE)) == 0; } bool IsAlive( void ) const { return (u_flags & U_DESTROYED) == 0; } bool IsBusy( void ) const { return (u_flags & U_BUSY) != 0; } bool IsDummy( void ) const { return (u_flags & U_DUMMY) != 0; } bool IsFloating( void ) const { return (u_flags & U_FLOATING) != 0; } bool IsDefensive( void ) const { return (u_type->Firepower(U_GROUND) + u_type->Firepower(U_SHIP) + u_type->Firepower(U_AIR)) == 0; } bool CanHit( const Unit *enemy ) const; bool CanHitType( const Unit *enemy ) const; bool CouldHit( const Unit *enemy ) const; void Attack( const Unit *enemy ); virtual bool Hit( unsigned short damage ); virtual unsigned short Weight( void ) const { return u_type->Weight(); } unsigned char OffensiveStrength( const Unit *target ) const; unsigned char DefensiveStrength( void ) const; void Repair( void ); void Face( unsigned char dir ) { u_facing = dir; } SoundEffect *MoveSound( void ) { return u_type->MoveSound(); } SoundEffect *FireSound( void ) { return u_type->FireSound(); } protected: Point u_pos; // position on map unsigned long u_flags; unsigned short u_id; unsigned char u_facing; // direction unsigned char u_group; // group size unsigned char u_xp; // experience Point u_target; const UnitType *u_type; Player *u_player; }; #endif /* _INCLUDE_UNIT_H */ crimson-0.5.2.orig/src/cf/unitwindow.cpp0000600000175000017500000006675310554366415016425 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ///////////////////////////////////////////////////////////////////////// // unitwindow.cpp ///////////////////////////////////////////////////////////////////////// #include "unitwindow.h" #include "extwindow.h" #include "gamewindow.h" #include "game.h" #include "strutil.h" #include "msgs.h" #define ICON_MINI_WIDTH 15 #define ICON_MINI_HEIGHT 15 #define ICON_MINI_REPAIR1_X 93 #define ICON_MINI_REPAIR1_Y 46 #define ICON_MINI_REPAIR2_X 93 #define ICON_MINI_REPAIR2_Y 46 #define ICON_MINI_BUILD1_X 108 #define ICON_MINI_BUILD1_Y 46 #define ICON_MINI_BUILD2_X 108 #define ICON_MINI_BUILD2_Y 46 #define CW_MODE_NORMAL 0 #define CW_MODE_PRODUCTION 1 #ifdef _WIN32_WCE # define CW_EXIT_BUTTON_FLAGS 0 #else # define CW_EXIT_BUTTON_FLAGS WIDGET_DEFAULT #endif // node class used by the UnitListWidget class ULWNode : public Node { public: const UnitType *type; Unit *unit; unsigned short image; bool ok; bool selected; }; // list widget used to display units... class UnitListWidget : public ListWidget { public: UnitListWidget( short id, short x, short y, unsigned short w, unsigned short h, List *list, short selected, unsigned short flags, const UnitSet &uset, const TerrainSet &tset, Window *window ); void DrawNodes( void ); unsigned short ItemHeight( void ) const { return itemh; } private: unsigned short itemh; const UnitSet &uset; const TerrainSet &tset; Rect hex_bg; }; // button IDs for the container hook #define CH_BUTTON_REPAIR 0 #define CH_BUTTON_BUILD 1 #define CH_BUTTON_REPAIR_CONFIRM 2 #define CH_LIST_UNITS 3 // widget IDs for the UnitLoadWindow #define ULW_WIDGET_LIST 1 #define ULW_WIDGET_OK 2 #define ULW_WIDGET_CRYSTALS 3 //////////////////////////////////////////////////////////////////////// // NAME : UnitListWidget::UnitListWidget // DESCRIPTION: Create a new unit list widget. // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // list - list nodes // selected - node highlighted by default (-1 == none) // flags - widget flags (see widget.h for details) // uset - unit set // tset - terrain set // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// UnitListWidget::UnitListWidget( short id, short x, short y, unsigned short w, unsigned short h, List *list, short selected, unsigned short flags, const UnitSet &uset, const TerrainSet &tset, Window *window ) : ListWidget( id, x, y, w, h, list, selected, flags, NULL, window ), uset(uset), tset(tset), hex_bg( 32, 32, ICON_WIDTH, ICON_HEIGHT ) { spacing = 0; itemh = ICON_HEIGHT + spacing; Update(); } //////////////////////////////////////////////////////////////////////// // NAME : UnitListWidget::DrawNodes // DESCRIPTION: Draw the list nodes. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void UnitListWidget::DrawNodes( void ) { Rect box( x + 4, y + 1 + spacing, listboxw - 8, h - 2 - 2 * spacing ); Rect area( x + 1, y + 1, listboxw - 2, h - 2 ); short num = toprow / ItemHeight(); // number of top node ULWNode *n = static_cast(list->GetNode( num )); // top node short xoff = box.x, yoff = box.y + (num * ItemHeight()) - toprow; Surface *icons = surface->GetView()->GetSystemIcons(); surface->DrawBack( area ); while ( n ) { Rect hilite( x + 2, yoff, listboxw - 4, ItemHeight() ); hilite.Clip( area ); if ( n->selected ) surface->FillRectAlpha( hilite, Color(CF_COLOR_GHOSTED) ); if ( num == current ) surface->FillRectAlpha( hilite, surface->GetFGPen() ); // draw unit icon Rect icon( hex_bg ); Rect dest( xoff, yoff, ICON_WIDTH, ICON_HEIGHT ); dest.ClipBlit( icon, area ); icons->Blit( surface, icon, dest.x, dest.y ); uset.DrawTile( n->image, surface, xoff + (ICON_WIDTH - uset.TileWidth()) / 2, yoff + (ICON_HEIGHT - uset.TileHeight()) / 2, box ); if ( !n->ok || (n->unit && !n->unit->IsReady()) ) tset.DrawTile( IMG_NOT_AVAILABLE, surface, xoff + (ICON_WIDTH - tset.TileWidth()) / 2, yoff + (ICON_HEIGHT - tset.TileHeight()) / 2, box ); char buf[4]; if ( n->unit ) { icon = *Images[ICON_XP_BASE + n->unit->XPLevel()]; dest = Rect( xoff + ICON_WIDTH + 4, yoff + 2, XP_ICON_WIDTH, XP_ICON_HEIGHT ); dest.ClipBlit( icon, area ); icons->Blit( surface, icon, dest.x, dest.y ); font->Write( itoa( n->unit->GroupSize(), buf ), surface, xoff + ICON_WIDTH + 4, yoff + ICON_HEIGHT - font->Height() - 2, box ); } else font->Write( itoa( n->type->Cost(), buf ), surface, xoff + ICON_WIDTH + 4, yoff + (ICON_HEIGHT - font->Height()) / 2, box ); yoff += ItemHeight(); if ( yoff >= box.y + box.h ) break; ++num; n = static_cast(n->Next()); } } //////////////////////////////////////////////////////////////////////// // NAME : ContainerWindow::ContainerWindow // DESCRIPTION: Create a new ContainerWindow for a transport or building. // PARAMETERS : container - unit container to show the window for; this // can be either a transport or a building // view - pointer to the view // RETURNS : - //////////////////////////////////////////////////////////////////////// ContainerWindow::ContainerWindow( UnitContainer *container, View *view ) : Window( WIN_CLOSE_ESC|WIN_CENTER, view ), c(container), mode(CW_MODE_NORMAL), crystals_icon( view->GetSystemIcons(), 160, 0, ICON_WIDTH, ICON_HEIGHT ), last_selected(0) { int i; Building *b; Transport *t; Player *player = dynamic_cast(c)->Owner();; MapView *mv = Gam->GetMapWindow()->GetMapView(); if ( dynamic_cast(c)->IsUnit() ) { unit = true; t = static_cast(c); b = NULL; } else { unit = false; b = static_cast(c); t = NULL; } // calculate window dimensions short width = mv->TileWidth() + XP_ICON_WIDTH + lfont->Width() * 20 + 70; short height = 8 * mv->TileHeight() + 40 + sfont->Height(); SetSize( MIN(width, view->Width()), MIN(height, view->Height()) ); for ( i = 0; i < CH_NUM_BUTTONS; ++i ) buttons[i] = NULL; // create unit list for ( i = 0; i < c->UnitCount(); ++i ) { ULWNode *n = new ULWNode; n->unit = c->GetUnit( i ); n->type = n->unit->Type(); n->selected = false; if ( !player ) { n->image = n->unit->Type()->Image() + Gam->GetMission()->GetPlayer().ID() * 6; n->ok = false; } else { n->image = n->unit->BaseImage(); n->ok = n->unit->IsReady(); } normal.AddTail( n ); } // create list widget width = mv->TileWidth() + XP_ICON_WIDTH + DEFAULT_SLIDER_SIZE + 20; listwidget = new UnitListWidget( CH_LIST_UNITS, 10, 10, width, h - sfont->Height() - 28, &normal, -1, WIDGET_VSCROLL|WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY, *mv->GetMap()->GetUnitSet(), *mv->GetMap()->GetTerrainSet(), this ); listwidget->SetHook( this ); // create buttons Surface *icons = view->GetSystemIcons(); new ButtonWidget( GUI_CLOSE, 10, h - sfont->Height() - 18, width, sfont->Height() + 8, CW_EXIT_BUTTON_FLAGS, MSG(MSG_B_EXIT), this ); if ( player == &Gam->GetMission()->GetPlayer() ) { ButtonWidget *btn; unsigned short xoff = width + 15, yoff = lfont->Height() + 35; if ( (unit && t->IsMedic()) || (!unit && b->IsWorkshop()) ) { btn = new ButtonWidget( CH_BUTTON_REPAIR, xoff, yoff, ICON_MINI_WIDTH + 8 + sfont->Width(), ICON_MINI_HEIGHT + 4, WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT|WIDGET_ALIGN_WITHIN, "_1", this ); btn->SetImage( icons, Rect( ICON_MINI_REPAIR1_X, ICON_MINI_REPAIR1_Y, ICON_MINI_WIDTH, ICON_MINI_HEIGHT ), Rect( ICON_MINI_REPAIR2_X, ICON_MINI_REPAIR2_Y, ICON_MINI_WIDTH, ICON_MINI_HEIGHT ) ); btn->SetHook( this ); xoff += btn->Width(); buttons[CH_BUTTON_REPAIR] = btn; } if ( !unit ) { if ( b->IsFactory() && (b->UnitProduction() != 0) ) { btn = new ButtonWidget( CH_BUTTON_BUILD, xoff, yoff, ICON_MINI_WIDTH + 8 + sfont->Width(), ICON_MINI_HEIGHT + 4, WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT|WIDGET_ALIGN_WITHIN, "_2", this ); btn->SetImage( icons, Rect( ICON_MINI_BUILD1_X, ICON_MINI_BUILD1_Y, ICON_MINI_WIDTH, ICON_MINI_HEIGHT ), Rect( ICON_MINI_BUILD2_X, ICON_MINI_BUILD2_Y, ICON_MINI_WIDTH, ICON_MINI_HEIGHT ) ); btn->SetHook( this ); xoff += btn->Width(); buttons[CH_BUTTON_BUILD] = btn; } } } height = h - lfont->Height() - ICON_MINI_HEIGHT - 55; unitinfo = Rect( width + 15, h - height - 10, w - width - 25, height ); Draw(); if ( !normal.IsEmpty() ) listwidget->Select( 0 ); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : ContainerWindow::Draw // DESCRIPTION: Draw the container window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void ContainerWindow::Draw( void ) { Window::Draw(); UnitInfoWindow::DrawUnitInfo( -1, NULL, NULL, this, unitinfo ); unsigned short xoff; Rect boxrect( unitinfo.x, 10, w - unitinfo.x - 10, lfont->Height() + 20 ); // show the name of the unit/building DrawBox( boxrect, BOX_RAISED ); boxrect.x += 5; boxrect.w -= 10; const char *name = dynamic_cast(c)->Name(); unsigned short nlen = lfont->FitText( name, boxrect.w, false ); if ( nlen < strlen(name) ) xoff = 0; else xoff = (boxrect.w - lfont->TextWidth( name )) / 2; Color col = lfont->GetColor(); lfont->SetColor( view->GetBGPen() ); lfont->WriteEllipsis( name, this, boxrect.x + xoff + 3, 23, boxrect ); lfont->SetColor( view->GetFGPen() ); lfont->WriteEllipsis( name, this, boxrect.x + xoff, 20, boxrect ); lfont->SetColor( col ); // show crystal storage crystals_icon.Draw( this, w - 5 - ICON_WIDTH, lfont->Height() + 30 ); DrawCrystals(); } //////////////////////////////////////////////////////////////////////// // NAME : ContainerWindow::DrawCrystals // DESCRIPTION: Show the crystals storage of the container and its // change per turn. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void ContainerWindow::DrawCrystals( void ) { char buf[16]; unsigned short stock, change; stock = c->Crystals(); if ( unit ) change = 0; else change = static_cast(c)->CrystalProduction(); if ( change > 0 ) sprintf( buf, "%d (+%d)", stock, change ); else itoa( stock, buf ); unsigned short tlen = sfont->TextWidth( buf ); Rect rect( w - ICON_WIDTH - tlen - 5 - 30, lfont->Height() + 30 + (ICON_HEIGHT - sfont->Height()) / 2, tlen + ICON_WIDTH + 5, sfont->Height() ); DrawBack( rect ); sfont->Write( buf, this, rect.x + 30, rect.y ); } //////////////////////////////////////////////////////////////////////// // NAME : ContainerWindow::HandleEvent // DESCRIPTION: React to system events. // PARAMETERS : event - event received by the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status ContainerWindow::HandleEvent( const SDL_Event &event ) { GUI_Status rc; if ( (event.type == SDL_KEYDOWN) && (event.key.keysym.sym == SDLK_SPACE) && listwidget->Selected() ) { // activate the currently selected node in the list widget // => either select the unit for movement (NORMAL mode) or // build the selected unit type (PRODUCTION mode) rc = SelectNode( static_cast( listwidget->Selected() ) ); } else rc = Window::HandleEvent( event ); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : ContainerWindow::SwitchMode // DESCRIPTION: Enter or leave build mode. This function creates or // destroys the unit production list for the unit list // widget. This function may only be used if the object // is a building (more specifically: a factory) // PARAMETERS : newmode - mode to switch to // RETURNS : - //////////////////////////////////////////////////////////////////////// void ContainerWindow::SwitchMode( unsigned short newmode ) { Mission *m = Gam->GetMission(); if ( newmode == CW_MODE_PRODUCTION ) { // only buildings, current // mode must be CW_MODE_NORMAL // create production list Building *b = static_cast(c); unsigned long prod = b->UnitProduction(); if ( prod ) { unsigned short crystals = b->Crystals(); for ( int i = 0; i < 32; ++i ) { if ( prod & (1 << i) ) { // this unit type can be built ULWNode *n = new ULWNode; n->type = m->GetUnitSet().GetUnitInfo( i ); n->unit = NULL; n->image = n->type->Image() + b->Owner()->ID() * 6; n->ok = (n->type->Cost() <= crystals); n->selected = false; build.AddTail( n ); } } // disable repair button if ( buttons[CH_BUTTON_REPAIR] ) buttons[CH_BUTTON_REPAIR]->Disable(); // display new list in list widget DrawBack( unitinfo ); listwidget->SwitchList( &build, 0 ); UnitInfoWindow::DrawUnitInfo( static_cast(build.Head())->type->ID(), &m->GetUnitSet(), &m->GetTerrainSet(), this, unitinfo ); Show(); } } else { // switch back to CW_MODE_NORMAL from CW_MODE_PRODUCTION // destroy production list while ( !build.IsEmpty() ) delete build.RemHead(); // re-enable repair and button if ( buttons[CH_BUTTON_REPAIR] ) buttons[CH_BUTTON_REPAIR]->Enable(); // display normal list in widget DrawBack( unitinfo ); listwidget->SwitchList( &normal, -1 ); UnitInfoWindow::DrawUnitInfo( -1, NULL, NULL, this, unitinfo ); Show(); } mode = newmode; last_selected = NULL; } //////////////////////////////////////////////////////////////////////// // NAME : ContainerWindow::SelectNode // DESCRIPTION: When a node from the list widget is selected, either try // to activate that unit (if in normal mode) or try to // build it (if in production mode). // PARAMETERS : node - selected node from the list widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status ContainerWindow::SelectNode( ULWNode *node ) { GUI_Status rc = GUI_OK; if ( node ) { if ( mode == CW_MODE_NORMAL ) { // normal mode if ( node->ok ) { // unit is ready Gam->SelectUnit( node->unit ); rc = GUI_CLOSE; } } else { // production mode if ( node->ok ) { // sufficient amount of crystals Building *b = static_cast(c); Unit *u = Gam->GetMission()->CreateUnit( node->type->ID(), *b->Owner(), b->Position() ); // add unit to the widget's list ULWNode *ulw = new ULWNode; ulw->unit = u; ulw->type = u->Type(); ulw->image = u->BaseImage(); ulw->ok = false; ulw->selected = false; normal.AddTail( ulw ); b->SetCrystals( b->Crystals() - u->BuildCost() ); DrawCrystals(); Show(); SwitchMode( CW_MODE_NORMAL ); } else new NoteWindow( MSG(MSG_ERR_NO_CRYSTALS), MSG(MSG_ERR_NO_PRODUCTION), 0, view ); } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : ContainerWindow::WidgetActivated // DESCRIPTION: Call the appropriate functions when widgets are pressed // in the ContainerWindow or associated windows. // PARAMETERS : widget - widget that called the function // win - pointer to the window the widget belongs to // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status ContainerWindow::WidgetActivated( Widget *widget, Window *win ) { GUI_Status rc = GUI_OK; switch ( widget->ID() ) { case CH_BUTTON_REPAIR: { ULWNode *n = static_cast(listwidget->Selected()); if ( n ) { Unit *u = n->unit; if ( u->GroupSize() < MAX_GROUP_SIZE ) { string repmsg; repmsg = StringUtil::strprintf( MSG(MSG_ASK_REPAIR), u->Name() ); repmsg = StringUtil::strprintf( repmsg, CRYSTALS_REPAIR ); if ( c->Crystals() >= CRYSTALS_REPAIR ) { string buttons; buttons.append( MSG(MSG_B_REPAIR) ); buttons += '|'; buttons.append( MSG(MSG_B_CANCEL) ); DialogWindow *reqwin = new DialogWindow( NULL, repmsg, buttons, 0, 0, view ); reqwin->SetButtonID( 0, CH_BUTTON_REPAIR_CONFIRM ); reqwin->SetButtonHook( 0, this ); } else new NoteWindow( MSG(MSG_ERR_NO_CRYSTALS), repmsg, WIN_CLOSE_ESC, view ); } } break; } case CH_BUTTON_BUILD: SwitchMode( (Mode() == CW_MODE_NORMAL) ? CW_MODE_PRODUCTION : CW_MODE_NORMAL ); break; case CH_BUTTON_REPAIR_CONFIRM: { Audio::PlaySfx( Audio::SND_GAM_REPAIR, 0 ); Unit *u = static_cast(listwidget->Selected())->unit; c->SetCrystals( c->Crystals() - CRYSTALS_REPAIR ); if ( Gam->GetMission()->GetHistory() ) Gam->GetMission()->GetHistory()->RecordUnitEvent( *u, History::HIST_UEVENT_REPAIR ); u->Repair(); listwidget->Draw(); // update list display DrawCrystals(); // update crystals Show(); rc = GUI_CLOSE; // close the request window break; } case CH_LIST_UNITS: { // Display information about the currently selected unit // or, if the node has been selected twice (e.g. by double // clicking), select the respective unit. ULWNode *node = static_cast( static_cast(widget)->Selected() ); if ( node != last_selected ) { short uid = -1; if ( node ) uid = node->type->ID(); DrawBack( unitinfo ); UnitInfoWindow::DrawUnitInfo( uid, &Gam->GetMission()->GetUnitSet(), &Gam->GetMission()->GetTerrainSet(), this, unitinfo ); win->Show( unitinfo ); last_selected = node; } else if ( node ) rc = SelectNode( node ); break; } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : UnitLoadWindow::UnitLoadWindow // DESCRIPTION: This window is used to ask the player which units to // load when he moves a transport out of a container. // PARAMETERS : t - transport to be moved // c - unit container the transport is moving out of // uset - unit set used // tset - terrain set used // history - for event recording // view - pointer to the view // RETURNS : - //////////////////////////////////////////////////////////////////////// UnitLoadWindow::UnitLoadWindow( Transport &t, UnitContainer &c, const UnitSet &uset, const TerrainSet &tset, History *history, View *view ) : Window( WIN_CENTER, view ), t(t), c(c), last_selected(0), fullslots(t.FullSlots()), crystals(t.Crystals()), have_units(false), history(history) { // calculate window dimensions short width = uset.TileWidth() + XP_ICON_WIDTH + DEFAULT_SLIDER_SIZE + MAX(sfont->Width() * 24, tset.TileWidth() * 4) + 20; short height = tset.TileHeight() + tset.TileShiftY() + ICON_HEIGHT * 3 + sfont->Height() * 3 + 70; SetSize( MIN(width, view->Width()), MIN(height, view->Height()) ); // create unit list for ( int i = 0; i < c.UnitCount(); ++i ) { Unit *u = c.GetUnit( i ); if ( (u != &t) && static_cast(t).Allow( u->Type() ) ) { ULWNode *n = new ULWNode; n->unit = u; n->type = u->Type(); n->image = u->BaseImage(); n->ok = u->IsReady() && t.Allow( u ); n->selected = false; units.AddTail( n ); have_units |= n->ok; } } if ( !Opened() ) return; // create list widget wd_list = new UnitListWidget( ULW_WIDGET_LIST, 10, sfont->Height() + 10, uset.TileWidth() + XP_ICON_WIDTH + DEFAULT_SLIDER_SIZE + 20, h - sfont->Height() * 2 - 28, &units, -1, WIDGET_VSCROLL|WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY, uset, tset, this ); wd_list->SetKey( SDLK_SPACE ); wd_list->SetHook( this ); // create buttons Widget *wd = new ButtonWidget( ULW_WIDGET_OK, 1, h - sfont->Height() - 9, (w - 2) / 2, sfont->Height() + 8, WIDGET_DEFAULT, MSG(MSG_B_OK), this ); wd->SetHook( this ); new ButtonWidget( GUI_CLOSE, wd->LeftEdge() + wd->Width(), wd->TopEdge(), wd->Width(), wd->Height(), 0, MSG(MSG_B_CANCEL), this ); unitinfo = Rect( wd_list->LeftEdge() + wd_list->Width() + 5, wd_list->TopEdge(), w - wd_list->LeftEdge() - wd_list->Width() - 15, wd_list->Height() - ICON_HEIGHT ); char buf[10]; sprintf( buf, "(%d)", c.Crystals() + t.Crystals() ); cstrw = sfont->TextWidth( buf ); wd_crystals = new StringWidget( 0, unitinfo.x + unitinfo.w - cstrw - sfont->Width() * 4, unitinfo.y + unitinfo.h + (ICON_HEIGHT - sfont->Height() - 8)/2, sfont->Width() * 4, sfont->Height() + 8, itoa( crystals, buf ), 4, WIDGET_ALIGN_CENTER|WIDGET_STR_CONST|WIDGET_STYLE_NOBORDER, NULL, this ); unsigned short max = MIN( t.MaxCrystals() - ((fullslots - (crystals+9)/10) * 10), c.Crystals() + t.Crystals() ); wd_slider = new SliderWidget( ULW_WIDGET_CRYSTALS, unitinfo.x + ICON_WIDTH, wd_crystals->TopEdge() + (wd_crystals->Height() - DEFAULT_SLIDER_SIZE) / 2, wd_crystals->LeftEdge() - unitinfo.x - ICON_WIDTH - 5, DEFAULT_SLIDER_SIZE, 0, max, crystals, max/5, WIDGET_HSCROLL|WIDGET_HSCROLLKEY, NULL, this ); wd_slider->SetHook( this ); Draw(); wd_list->Select( 0 ); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : UnitLoadWindow::Draw // DESCRIPTION: Draw the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void UnitLoadWindow::Draw( void ) { Window::Draw(); UnitInfoWindow::DrawUnitInfo( -1, NULL, NULL, this, unitinfo ); const char *msg = MSG(MSG_TRANSFER_UNITS); unsigned short txtw = sfont->TextWidth(msg); sfont->WriteEllipsis( msg, this, MAX( 10, (w - txtw) / 2 ), 5, Rect( 10, 5, w-20, sfont->Height() ) ); Image crystals_icon( view->GetSystemIcons(), 160, 0, ICON_WIDTH, ICON_HEIGHT ); crystals_icon.Draw( this, unitinfo.x, unitinfo.y + unitinfo.h ); char buf[10]; sprintf( buf, "(%d)", c.Crystals() + t.Crystals() ); sfont->Write( buf, this, unitinfo.x + unitinfo.w - cstrw, unitinfo.y + unitinfo.h + (ICON_HEIGHT - sfont->Height() - 2)/2, *this ); } //////////////////////////////////////////////////////////////////////// // NAME : UnitLoadWindow::WidgetActivated // DESCRIPTION: Call the appropriate functions when widgets are pressed // in the window. // PARAMETERS : widget - widget that called the function // win - pointer to the window the widget belongs to // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status UnitLoadWindow::WidgetActivated( Widget *widget, Window *win ) { GUI_Status rc = GUI_OK; ULWNode *node; switch ( widget->ID() ) { case ULW_WIDGET_LIST: { // Display information about the currently selected unit // or, if the node has been selected twice (e.g. by double // clicking), select the respective unit. node = static_cast( wd_list->Selected() ); if ( node != last_selected ) { short uid = -1; if ( node ) uid = node->type->ID(); DrawBack( unitinfo ); UnitInfoWindow::DrawUnitInfo( uid, &Gam->GetMission()->GetUnitSet(), &Gam->GetMission()->GetTerrainSet(), this, unitinfo ); win->Show( unitinfo ); last_selected = node; } else if ( node ) { if ( node->ok ) { node->selected ^= 1; if ( node->selected ) fullslots += node->unit->Weight(); else fullslots -= node->unit->Weight(); // update the ok flag for all nodes for ( node = static_cast(units.Head()); node; node = static_cast(node->Next()) ) { node->ok = node->selected || (node->unit->IsReady() && (t.Slots() >= fullslots + node->unit->Weight())); } wd_list->Draw(); wd_list->Show(); unsigned short max = MIN( t.MaxCrystals() - ((fullslots - (crystals+9)/10) * 10), c.Crystals() + t.Crystals() ); wd_slider->Adjust( 0, max, max/5 ); wd_slider->Draw(); wd_slider->Show(); } else Audio::PlaySfx( Audio::SND_GUI_ERROR, 0 ); } break; } case ULW_WIDGET_CRYSTALS: { char buf[8]; fullslots -= (crystals + 9)/10 - (wd_slider->Level() + 9)/10; crystals = wd_slider->Level(); wd_crystals->SetString( itoa( crystals, buf ), true ); // update the ok flag for all nodes for ( node = static_cast(units.Head()); node; node = static_cast(node->Next()) ) { node->ok = node->selected || (node->unit->IsReady() && (t.Slots() >= fullslots + node->unit->Weight())); } wd_list->Draw(); wd_list->Show(); break; } case ULW_WIDGET_OK: // move selected units into the transport for ( node = static_cast(units.Head()); node; node = static_cast(node->Next()) ) { if ( node->selected ) { c.RemoveUnit( node->unit ); node->unit->SetFlags( U_MOVED|U_DONE ); t.InsertUnit( node->unit ); if ( history ) history->RecordTransportEvent( c, t, *node->unit ); } } if ( history && (t.Crystals() != crystals) ) history->RecordTransportEvent( c, t, crystals - t.Crystals() ); c.SetCrystals( c.Crystals() - (crystals - t.Crystals()) ); t.SetCrystals( crystals ); rc = (GUI_Status)ULW_WIDGET_OK; break; } return rc; } crimson-0.5.2.orig/src/cf/unitwindow.h0000600000175000017500000000565210554366466016067 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ////////////////////////////////////////////////////////////////////////// // unitwindow.h - the window classes used for getting unit specifications // and showing contents of buildings and transports ////////////////////////////////////////////////////////////////////////// #ifndef _INCLUDE_UNITWINDOW_H #define _INCLUDE_UNITWINDOW_H #include "window.h" #include "button.h" #include "listselect.h" #include "textbox.h" #include "map.h" #include "history.h" class UnitListWidget; class ULWNode; // the same window class is used for buildings and transports #define CH_NUM_BUTTONS 3 class ContainerWindow : public Window, public WidgetHook { public: ContainerWindow( UnitContainer *container, View *view ); ~ContainerWindow( void ) {} GUI_Status HandleEvent( const SDL_Event &event ); void SwitchMode( unsigned short newmode ); GUI_Status SelectNode( ULWNode *node ); unsigned short Mode( void ) const { return mode; } void Draw( void ); void DrawCrystals( void ); GUI_Status WidgetActivated( Widget *widget, Window *win ); private: UnitContainer *c; bool unit; // true if transport, false if building unsigned short mode; List normal; List build; Rect unitinfo; Image crystals_icon; UnitListWidget *listwidget; ButtonWidget *buttons[CH_NUM_BUTTONS]; Node *last_selected; }; class UnitLoadWindow : public Window, public WidgetHook { public: UnitLoadWindow( Transport &t, UnitContainer &c, const UnitSet &uset, const TerrainSet &tset, History *history, View *view ); void Draw( void ); GUI_Status WidgetActivated( Widget *widget, Window *win ); bool Opened( void ) const { return have_units || (c.Crystals() > 0); } private: Transport &t; UnitContainer &c; List units; ULWNode *last_selected; unsigned short fullslots; // we can't change these in the transport unsigned short crystals; // because the user may cancel bool have_units; StringWidget *wd_crystals; SliderWidget *wd_slider; ListWidget *wd_list; Rect unitinfo; unsigned short cstrw; History *history; }; #endif /* _INCLUDE_UNITWINDOW_H */ crimson-0.5.2.orig/src/common/0000700000175000017500000000000010730256756014371 5ustar uweuwecrimson-0.5.2.orig/src/common/SDL_zlib.c0000600000175000017500000000757610554366314016214 0ustar uweuwe/* Crimson Fields -- a game of tactical warfare Copyright (C) 2000-2007 Jens Granseuer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* SDL_zlib.c This file provides support for reading and writing zlib-compressed files (gzip) using the SDL_RWops interface of SDL. */ #include "SDL_rwops.h" #include "SDL_error.h" #ifdef HAVE_LIBZ #ifdef HAVE_UNISTD_H #include #endif #include #include /* Functions to read/write gzip files */ static int gzip_seek(SDL_RWops *context, int offset, int whence) { int pos; pos = gzseek((gzFile)context->hidden.unknown.data1, offset, whence); if (pos == -1) SDL_Error(SDL_EFSEEK); return pos; } static int gzip_read(SDL_RWops *context, void *ptr, int size, int maxnum) { size_t nread; nread = gzread((gzFile)context->hidden.unknown.data1, ptr, size * maxnum); if (nread == -1) SDL_Error(SDL_EFREAD); return nread; } static int gzip_write(SDL_RWops *context, const void *ptr, int size, int num) { size_t nwrote; nwrote = gzwrite((gzFile)context->hidden.unknown.data1, ptr, size * num); if (nwrote == 0) SDL_Error(SDL_EFWRITE); return nwrote; } static int gzip_close(SDL_RWops *context) { int rc = 0; if (context) { rc = gzclose((gzFile)context->hidden.unknown.data1); SDL_FreeRW(context); } return rc; } /* this comes straight from the SDL sources */ #ifdef macintosh /* * translate unix-style slash-separated filename to mac-style colon-separated * name; return malloced string */ static char *unix_to_mac(const char *file) { flen = strlen(file); char *path = malloc(flen + 2); const char *src = file; char *dst = path; if(*src == '/') { /* really depends on filesystem layout, hope for the best */ src++; } else { /* Check if this is a MacOS path to begin with */ if(*src != ':') *dst++ = ':'; /* relative paths begin with ':' */ } while(src < file + flen) { const char *end = strchr(src, '/'); int len; if(!end) end = file + flen; /* last component */ len = end - src; if(len == 0 || (len == 1 && src[0] == '.')) { /* remove repeated slashes and . */ } else { if(len == 2 && src[0] == '.' && src[1] == '.') { /* replace .. with the empty string */ } else { memcpy(dst, src, len); dst += len; } if(end < file + flen) *dst++ = ':'; } src = end + 1; } *dst++ = '\0'; return path; } #endif /* macintosh */ #endif /* HAVE_LIBZ */ /* if zlib is not available this function returns a standard file structure as created by SDL_RWFromFile */ SDL_RWops *SDL_RWFromGzip(const char *file, const char *mode) { SDL_RWops *rwops; #ifdef HAVE_LIBZ rwops = SDL_AllocRW(); if (rwops != NULL) { gzFile gzfp; # ifdef macintosh char *mpath = unix_to_mac(file); gzfp = gzopen(mpath, mode); free(mpath); # else gzfp = gzopen(file, mode); # endif /* macintosh */ if (gzfp != NULL) { rwops->hidden.unknown.data1 = gzfp; rwops->seek = gzip_seek; rwops->read = gzip_read; rwops->write = gzip_write; rwops->close = gzip_close; } else { SDL_FreeRW(rwops); rwops = NULL; } } #else rwops = SDL_RWFromFile(file, mode); #endif /* HAVE_LIBZ */ return rwops; } crimson-0.5.2.orig/src/common/SDL_zlib.h0000600000175000017500000000202610554366467016213 0ustar uweuwe/* Crimson Fields - a game of tactical warfare Copyright (C) 2000-2007 Jens Granseuer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* SDL_zlib.h */ #ifndef _SDL_ZLIB_H #define _SDL_ZLIB_H #include "SDL_rwops.h" #ifdef __cplusplus extern "C" { #endif SDL_RWops *SDL_RWFromGzip(const char *file, const char *mode); #ifdef __cplusplus } #endif #endif /* _SDL_ZLIB_H */ crimson-0.5.2.orig/src/common/button.cpp0000600000175000017500000005077210554366431016421 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // button.cpp //////////////////////////////////////////////////////////////////////// #include "button.h" #include "misc.h" #include "sound.h" //////////////////////////////////////////////////////////////////////// // NAME : ButtonWidget::ButtonWidget // DESCRIPTION: Create a button widget. // PARAMETERS : id - widget identifier // x - left edge of widget relative to window border // y - top edge of widget // w - widget width // h - widget height // flags - see widget.h for details // title - widget title (may be NULL) // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// ButtonWidget::ButtonWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ) : Widget( id, x, y, w, h, flags, title, window ) { if ( !(this->flags & (WIDGET_ALIGN_CENTER|WIDGET_ALIGN_LEFT| WIDGET_ALIGN_RIGHT|WIDGET_ALIGN_TOP)) ) this->flags |= WIDGET_ALIGN_CENTER; } //////////////////////////////////////////////////////////////////////// // NAME : ButtonWidget::Draw // DESCRIPTION: Draw the button widget. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void ButtonWidget::Draw( void ) { surface->DrawBack( *this ); if ( (flags & WIDGET_STYLE_MENU) && Clicked() ) { surface->DrawBox( *this, BOX_RECESSED ); surface->FillRectAlpha( x+1, y+1, w-2, h-2, Color(CF_COLOR_SHADOW) ); } else if ( flags & WIDGET_STYLE_HIGHLIGHT ) { surface->FillRectAlpha( *this, surface->GetFGPen() ); } else if ( !(flags & WIDGET_STYLE_NOBORDER) ) { surface->DrawBox( *this, BOX_RECESSED ); surface->DrawBox( Rect(x+1,y+1,w-2,h-2), Clicked() ? BOX_RECESSED : BOX_RAISED ); if ( Clicked() ) surface->FillRectAlpha( x+2, y+2, w-4, h-4, Color(CF_COLOR_SHADOW) ); } if ( flags & WIDGET_STYLE_GFX ) { Image &img = image[Clicked()]; // the flags designate the label alignment; image alignment is opposite int xoff; if ( (flags & (WIDGET_ALIGN_LEFT|WIDGET_ALIGN_WITHIN)) == (WIDGET_ALIGN_LEFT|WIDGET_ALIGN_WITHIN) ) { xoff = x + (w - img.Width()) - 2; } else if ( (flags & (WIDGET_ALIGN_RIGHT|WIDGET_ALIGN_WITHIN)) == (WIDGET_ALIGN_RIGHT|WIDGET_ALIGN_WITHIN) ) { xoff = x + 2; } else { xoff = x + (w - img.Width()) / 2; } img.Draw( surface, xoff, y + (h - img.Height()) / 2 ); } PrintTitle( ((flags & WIDGET_STYLE_HIGHLIGHT) && !Clicked()) ? surface->GetBGPen() : surface->GetFGPen() ); if ( flags & WIDGET_STYLE_SUBMENU ) image[0].Draw( surface, x + w - 3 - image[0].Width(), y + (h - image[0].Height())/2 + (Clicked() ? 1 : 0) ); } //////////////////////////////////////////////////////////////////////// // NAME : ButtonWidget::SetImage // DESCRIPTION: For widgets which have the WIDGET_STYLE_GFX flag set, // define the images to use for displaying them. // PARAMETERS : image - the surface containing the images // state1 - rectangle containing the position of the image // to show when the widget is not selected // state2 - rectangle containing the position of the image // to show when the widget is selected // RETURNS : - //////////////////////////////////////////////////////////////////////// void ButtonWidget::SetImage( Surface *image, const Rect &state1, const Rect &state2 ) { this->image[0] = Image( image, state1.x, state1.y, state1.w, state1.h ); this->image[1] = Image( image, state2.x, state2.y, state2.w, state2.h ); } //////////////////////////////////////////////////////////////////////// // NAME : ButtonWidget::MouseDown // DESCRIPTION: Show the widget in depressed state if it was selected. // PARAMETERS : button - SDL_MouseButtonEvent received from the event // handler // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status ButtonWidget::MouseDown( const SDL_MouseButtonEvent &button ) { if ( (button.button == SDL_BUTTON_LEFT) && Contains( button.x - surface->LeftEdge(), button.y - surface->TopEdge() ) ) Push(); else if ( Clicked() ) Release(); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : ButtonWidget::MouseUp // DESCRIPTION: Release the button and activate it if the mouse pointer // is still over it. // PARAMETERS : button - SDL_MouseButtonEvent received from the event // handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status ButtonWidget::MouseUp( const SDL_MouseButtonEvent &button ) { if ( Clicked() && (button.button == SDL_BUTTON_LEFT) ) { Release(); if ( Contains( button.x - surface->LeftEdge(), button.y - surface->TopEdge() ) ) return Activate(); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : ButtonWidget::KeyDown // DESCRIPTION: Depress button if the correct key was hit. // PARAMETERS : key - SDL_keysym received from the event handler // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status ButtonWidget::KeyDown( const SDL_keysym &key ) { if ( (key.sym == this->key) || ((flags & WIDGET_DEFAULT) && (key.sym == SDLK_RETURN)) ) Push(); else if ( Clicked() ) Release(); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : ButtonWidget::KeyUp // DESCRIPTION: Activate widget if correct key was released. // PARAMETERS : key - SDL_keysym received from the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status ButtonWidget::KeyUp( const SDL_keysym &key ) { if ( Clicked() && ((key.sym == this->key) || ((flags & WIDGET_DEFAULT) && (key.sym == SDLK_RETURN))) ) { Release(); return Activate(); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : ButtonWidget::Push // DESCRIPTION: Change the widget state to 'clicked', redraw, and play // a sound effect. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void ButtonWidget::Push( void ) { if ( !clicked ) { Audio::PlaySfx( Audio::SND_GUI_PRESSED, 0 ); Widget::Push(); } } //////////////////////////////////////////////////////////////////////// // NAME : ButtonWidget::Activate // DESCRIPTION: Activate widget, i.e. call the activation function of // the hook class. // PARAMETERS : - // RETURNS : return code of the activation function //////////////////////////////////////////////////////////////////////// GUI_Status ButtonWidget::Activate( void ) { if ( hook ) return hook->WidgetActivated( this, surface ); return (GUI_Status)id; } //////////////////////////////////////////////////////////////////////// // NAME : CheckboxWidget::CheckboxWidget // DESCRIPTION: Create a checkbox widget. // PARAMETERS : id - widget identifier // x - left edge of widget relative to window border // y - top edge of widget // w - widget width // h - widget height // state - initial state (checked or unchecked) // flags - see widget.h for details // title - widget title (may be NULL) // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// #define GFX_CHECK_SIZE 15 #define GFX_CHECK_OFF_X 64 #define GFX_CHECK_OFF_Y 46 #define GFX_CHECK_ON_X 79 #define GFX_CHECK_ON_Y 46 CheckboxWidget::CheckboxWidget( short id, short x, short y, unsigned short w, unsigned short h, bool state, unsigned short flags, const char *title, Window *window ) : ButtonWidget( id, x, y, w, h, flags, title, window ) { clicked = state; // set default graphics if ( flags & WIDGET_STYLE_GFX ) { Surface *icons = surface->GetView()->GetSystemIcons(); image[0] = Image( icons, GFX_CHECK_OFF_X, GFX_CHECK_OFF_Y, GFX_CHECK_SIZE, GFX_CHECK_SIZE ); image[1] = Image( icons, GFX_CHECK_ON_X, GFX_CHECK_ON_Y, GFX_CHECK_SIZE, GFX_CHECK_SIZE ); } } //////////////////////////////////////////////////////////////////////// // NAME : CheckboxWidget::MouseDown // DESCRIPTION: Check or uncheck the widget, depending on its current // state. // PARAMETERS : button - SDL_MouseButtonEvent received from the event // handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status CheckboxWidget::MouseDown( const SDL_MouseButtonEvent &button ) { if ( (button.button == SDL_BUTTON_LEFT) && Contains( button.x - surface->LeftEdge(), button.y - surface->TopEdge() ) ) { if ( Clicked() ) { Audio::PlaySfx( Audio::SND_GUI_PRESSED, 0 ); Release(); } else Push(); return Activate(); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : CheckboxWidget::KeyDown // DESCRIPTION: Toggle the widget status when the corresponding key was // hit. // PARAMETERS : key - SDL_keysym received from the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status CheckboxWidget::KeyDown( const SDL_keysym &key ) { if ( (key.sym == this->key) || ((flags & WIDGET_DEFAULT) && (key.sym == SDLK_RETURN)) ) { if ( Clicked() ) { Audio::PlaySfx( Audio::SND_GUI_PRESSED, 0 ); Release(); } else Push(); return Activate(); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : MenuButtonWidget::MenuButtonWidget // DESCRIPTION: Create a button widget for a MenuWindow. // PARAMETERS : id - widget identifier // x - left edge of widget relative to window border // y - top edge of widget // w - widget width // h - widget height // flags - see widget.h for details // title - widget title (may be NULL) // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// MenuButtonWidget::MenuButtonWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ) : ButtonWidget( id, x, y, w, h, flags, title, window ) { image[0] = Image( window->GetView()->GetSystemIcons(), 175, 46, 7, 11 ); } //////////////////////////////////////////////////////////////////////// // NAME : MenuButtonWidget::MouseMove // DESCRIPTION: When the mouse is moved over the button, highlight it. // PARAMETERS : motion - SDL_MouseMotionEvent received from the event // handler // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status MenuButtonWidget::MouseMove( const SDL_MouseMotionEvent &motion ) { bool contain = Contains( motion.x - surface->LeftEdge(), motion.y - surface->TopEdge() ); if ( ((flags & WIDGET_STYLE_HIGHLIGHT) && !contain) || (!(flags & WIDGET_STYLE_HIGHLIGHT) && contain) ) { ToggleCurrent(); Draw(); Show(); } return GUI_OK; } #define GFX_CYCLE_W 7 #define GFX_CYCLE_H 12 #define GFX_CYCLE_X 138 #define GFX_CYCLE_Y 46 //////////////////////////////////////////////////////////////////////// // NAME : CycleWidget::CycleWidget // DESCRIPTION: Create a new cycle widget. // PARAMETERS : id - widget identifier // x - left edge of widget relative to window border // y - top edge of widget // w - widget width // h - widget height // flags - see widget.h for details (default title // placement is WIDGET_ALIGN_LEFT) // title - widget title (may be NULL) // defval - default value, starting with 0 // labels - array of available choices, terminated by a // NULL-string // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// CycleWidget::CycleWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, unsigned short defval, const char *labels[], Window *window ) : ButtonWidget( id, x, y, w, h, flags, title, window ), maxval(0) { if ( !(flags & (WIDGET_ALIGN_CENTER|WIDGET_ALIGN_LEFT| WIDGET_ALIGN_RIGHT|WIDGET_ALIGN_TOP)) ) // button widget defaults to center which we must revert this->flags ^= WIDGET_ALIGN_LEFT|WIDGET_ALIGN_CENTER; image[0] = Image( window->GetView()->GetSystemIcons(), GFX_CYCLE_X, GFX_CYCLE_Y, GFX_CYCLE_W, GFX_CYCLE_H ); int i; for ( i = 1; labels[i]; ++i ) ++maxval; choices = new string[maxval+1]; for ( i = 0; i <= maxval; ++i ) choices[i].assign( labels[i] ); val = MIN( defval, maxval ); } //////////////////////////////////////////////////////////////////////// // NAME : CycleWidget::Draw // DESCRIPTION: Draw the cycle widget. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void CycleWidget::Draw( void ) { ButtonWidget::Draw(); short off = (Clicked() ? 1 : 0); Color fcol; surface->FillRect( x + w - image[0].Width() - 8 + off, y + 4 + off, 1, h - 8, Color(CF_COLOR_SHADOW) ); surface->FillRect( x + w - image[0].Width() - 7 + off, y + 4 + off, 1, h - 8, Color(CF_COLOR_HIGHLIGHT) ); image[0].Draw( surface, x + w - image[0].Width() - 4 + off, y + (h - image[0].Height())/2 + off ); if ( Disabled() ) { fcol = font->GetColor(); font->SetColor( Color(CF_COLOR_GHOSTED) ); } // draw current label font->Write( choices[val].c_str(), surface, x + (w - image[0].Width() - 10 - font->TextWidth(choices[val].c_str()))/2 + off, y + (h - font->Height()) / 2 + off, *this ); if ( Disabled() ) font->SetColor( fcol ); } //////////////////////////////////////////////////////////////////////// // NAME : CycleWidget::MouseDown // DESCRIPTION: Show the widget in depressed state if it was selected. // PARAMETERS : button - SDL_MouseButtonEvent received from the event // handler // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status CycleWidget::MouseDown( const SDL_MouseButtonEvent &button ) { if ( ((button.button == SDL_BUTTON_LEFT) || (button.button == SDL_BUTTON_RIGHT)) && Contains( button.x - surface->LeftEdge(), button.y - surface->TopEdge() ) ) { up = (button.button == SDL_BUTTON_LEFT); Push(); } else if ( Clicked() ) Release(); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : CycleWidget::MouseUp // DESCRIPTION: Release the button and activate it if the mouse pointer // is still over it. // PARAMETERS : button - SDL_MouseButtonEvent received from the event // handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status CycleWidget::MouseUp( const SDL_MouseButtonEvent &button ) { if ( Clicked() && ((button.button == SDL_BUTTON_LEFT) || (button.button == SDL_BUTTON_RIGHT)) ) { bool hit = Contains( button.x - surface->LeftEdge(), button.y - surface->TopEdge() ); if ( hit ) CycleValue(); Release(); if ( hit ) return Activate(); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : CycleWidget::KeyUp // DESCRIPTION: Activate widget if correct key was released. // PARAMETERS : key - SDL_keysym received from the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status CycleWidget::KeyUp( const SDL_keysym &key ) { if ( Clicked() && ((key.sym == this->key) || ((flags & WIDGET_DEFAULT) && (key.sym == SDLK_RETURN))) ) { up = ((key.mod & (KMOD_LSHIFT|KMOD_RSHIFT)) == 0); CycleValue(); Release(); return Activate(); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : CycleWidget::CycleValue // DESCRIPTION: Update the widget value according to the button pressed. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void CycleWidget::CycleValue( void ) { if (up) val = (val + 1) % (maxval + 1); else if ( val == 0 ) val = maxval; else --val; } //////////////////////////////////////////////////////////////////////// // NAME : CycleWidget::SetValue // DESCRIPTION: Set the cycle value. // PARAMETERS : value - new value // RETURNS : - //////////////////////////////////////////////////////////////////////// void CycleWidget::SetValue( unsigned short value ) { val = value % (maxval + 1); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : DropWidget::DropWidget // DESCRIPTION: Create a dropd-own widget, which is a ButtonWidget with // a small arrow image. // PARAMETERS : id - widget identifier // x - left edge of widget relative to window border // y - top edge of widget // w - widget width // h - widget height // flags - see widget.h for details // title - widget title (may be NULL) // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// DropWidget::DropWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ) : ButtonWidget( id, x, y, w, h, flags, title, window ) { image[0] = Image( window->GetView()->GetSystemIcons(), 157, 53, 11, 7 ); } //////////////////////////////////////////////////////////////////////// // NAME : DropWidget::Draw // DESCRIPTION: Draw the drop-down widget. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void DropWidget::Draw( void ) { surface->DrawBack( *this ); surface->DrawBox( *this, BOX_RECESSED ); surface->DrawBox( Rect(x+1,y+1,w-2,h-2), Clicked() ? BOX_RECESSED : BOX_RAISED ); if ( Clicked() ) surface->FillRectAlpha( x+2, y+2, w-4, h-4, Color(CF_COLOR_SHADOW) ); short off = (Clicked() ? 1 : 0); short xoff = x + (w - font->TextWidth(title.c_str()) - image[0].Width() - 8) / 2; short yoff = y + (h - font->Height()) / 2; PrintTitle( xoff + off, yoff + off, surface->GetFGPen() ); surface->FillRect( x + w - image[0].Width() - 8 + off, y + 4 + off, 1, h - 8, Color(CF_COLOR_SHADOW) ); surface->FillRect( x + w - image[0].Width() - 7 + off, y + 4 + off, 1, h - 8, Color(CF_COLOR_HIGHLIGHT) ); image[0].Draw( surface, x + w - image[0].Width() - 4 + off, y + (h - image[0].Height())/2 + off ); } crimson-0.5.2.orig/src/common/button.h0000600000175000017500000000760510554366467016074 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // button.h - button widget class /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_BUTTON_H #define _INCLUDE_BUTTON_H #include using namespace std; #include "widget.h" class ButtonWidget : public Widget { public: ButtonWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ); virtual void Draw( void ); void SetImage( Surface *image, const Rect &state1, const Rect &state2 ); virtual GUI_Status MouseDown( const SDL_MouseButtonEvent &button ); virtual GUI_Status MouseUp( const SDL_MouseButtonEvent &button ); virtual GUI_Status KeyDown( const SDL_keysym &key ); virtual GUI_Status KeyUp( const SDL_keysym &key ); virtual void Push( void ); GUI_Status Activate( void ); protected: Image image[2]; }; #define DEFAULT_CBW_SIZE 15 class CheckboxWidget : public ButtonWidget { public: CheckboxWidget( short id, short x, short y, unsigned short w, unsigned short h, bool state, unsigned short flags, const char *title, Window *window ); GUI_Status MouseDown( const SDL_MouseButtonEvent &button ); GUI_Status MouseUp( const SDL_MouseButtonEvent &button ) { return GUI_OK; } GUI_Status KeyDown( const SDL_keysym &key ); GUI_Status KeyUp( const SDL_keysym &key ) { return GUI_OK; } }; class MenuButtonWidget : public ButtonWidget { public: MenuButtonWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ); virtual GUI_Status MouseMove( const SDL_MouseMotionEvent &move ); bool IsMenu( void ) const { return (flags & WIDGET_STYLE_SUBMENU) != 0; } bool IsCurrent( void ) const { return (flags & (WIDGET_STYLE_HIGHLIGHT|WIDGET_DEFAULT)) == (WIDGET_STYLE_HIGHLIGHT|WIDGET_DEFAULT); } void ToggleCurrent( void ) { flags ^= (WIDGET_STYLE_HIGHLIGHT|WIDGET_DEFAULT); } }; class CycleWidget : public ButtonWidget { public: CycleWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, unsigned short defval, const char *labels[], Window *window ); ~CycleWidget( void ) { delete [] choices; } void SetValue( unsigned short value ); unsigned short GetValue( void ) const { return val; } const char *GetLabel( void ) const { return choices[val].c_str(); } GUI_Status MouseDown( const SDL_MouseButtonEvent &button ); GUI_Status MouseUp( const SDL_MouseButtonEvent &button ); GUI_Status KeyUp( const SDL_keysym &key ); void Draw( void ); private: void CycleValue( void ); unsigned short val; unsigned short maxval; bool up; string *choices; }; class DropWidget : public ButtonWidget { public: DropWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ); void Draw( void ); }; #endif /* _INCLUDE_BUTTON_H */ crimson-0.5.2.orig/src/common/color.h0000600000175000017500000000334410554366467015673 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ////////////////////////////////////////////////////////////// // color.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_COLOR_H #define _INCLUDE_COLOR_H class Color { public: Color() {} Color( unsigned char r, unsigned char g, unsigned char b ) { this->r = r; this->g = g; this->b = b; } Color( unsigned long rgb ) { r = (unsigned char)((rgb & 0x00FF0000) >> 16); g = (unsigned char)((rgb & 0x0000FF00) >> 8); b = (unsigned char)(rgb & 0x000000FF); } bool operator==( const Color &col ) const { return col.r == r && col.g == g && col.b == b; } bool operator!=( const Color &col ) const { return col.r != r || col.g != g || col.b != b; } unsigned char r, g, b; }; #define CF_COLOR_BLACK 0x00,0x00,0x00 #define CF_COLOR_WHITE 0xFF,0xFF,0xFF #define CF_COLOR_DARKGRAY 0x50,0x50,0x50 #define CF_COLOR_LIGHTGRAY 0x8B,0x8B,0x8B #endif /* _INCLUDE_COLOR_H */ crimson-0.5.2.orig/src/common/extwindow.cpp0000600000175000017500000006740210554366431017134 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // extwindow.cpp /////////////////////////////////////////////////////////////////////// #include #include "extwindow.h" #include "misc.h" #include "sound.h" #include "msgs.h" #include "globals.h" // for MIN_XRES, MIN_YRES //////////////////////////////////////////////////////////////////////// // NAME : DialogWindow::DialogWindow // DESCRIPTION: Display a window containing a short message and an // arbitrary number of button widgets. // PARAMETERS : title - window title (may be NULL) // msg - message // buttons - captions of the button widgets, separated by // '|'. The first underscore in each caption (if // any) will be used as the keyboard shortcut for // that button. // def - identifier of the default button (starting from // 0; -1 for none) // flags - window flags (see window.h for details) // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// DialogWindow::DialogWindow( const char *title, const string &msg, const string &buttons, short def, unsigned short flags, View *view ) : Window(flags, view), btncnt(1), text(msg), head(title) { Font *tfont = (flags & WIN_FONT_BIG) ? LargeFont() : SmallFont(); unsigned short txtw = sfont->TextWidth( msg.c_str() ); unsigned short defw = MAX( view->Width() * 3/4, 300 ), prefw = MIN( defw, txtw + 25 ), btnw = 0; // count buttons bcaptions = new char [buttons.length() + 1]; strcpy( bcaptions, buttons.c_str() ); char *start = bcaptions; for ( char *ptr = bcaptions; *ptr != '\0'; ++ptr ) { if ( *ptr == '|' ) { *ptr = '\0'; btnw = MAX( btnw, sfont->TextWidth(start) + 15 ); start = ptr+1; ++btncnt; } } btnw = MAX( btnw, sfont->TextWidth(start) + 15 ); if ( btnw * btncnt + 10 > prefw ) prefw = btnw * btncnt + 10; if ( title ) prefw = MAX( prefw, tfont->TextWidth( title ) + 20 ); if ( prefw > view->Width() ) prefw = view->Width(); Rect win( 0, 0, prefw, sfont->TextHeight(msg.c_str(), prefw-20, 2) + sfont->Height() + (title ? tfont->Height() + 10 : 5) + 20 ); win.Clip( *view ); unsigned short bspacing = (win.w - btncnt * btnw) / (btncnt + 1), bx = bspacing, by = win.h - sfont->Height() - 10, txty = (title ? tfont->Height() + 10 : 5); if ( !(flags & WIN_CENTER) ) { // get mouse pointer position int mx, my; SDL_GetMouseState( &mx, &my ); win.x = mx - bspacing - (bspacing + btnw) * MAX(0,def) - btnw/2; win.y = my - win.h + (sfont->Height() + 6)/2 + 4; win.Align( *view ); } SetSize( win ); new TextWidget( 0, 5, txty, w - 10, by - txty - 5, msg.c_str(), WIDGET_ALIGN_CENTER, NULL, this ); btns = new ButtonWidget * [btncnt]; char *cap = bcaptions; for ( int i = 0; i < btncnt; ++i ) { btns[i] = new ButtonWidget( GUI_CLOSE, bx, by, btnw, sfont->Height() + 6, (def == i) ? WIDGET_DEFAULT : 0, cap, this ); bx += btnw + bspacing; do { ++cap; } while ( *cap != '\0' ); ++cap; } Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : DialogWindow::~DialogWindow // DESCRIPTION: Delete the resources used by the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// DialogWindow::~DialogWindow( void ) { delete [] btns; delete [] bcaptions; } //////////////////////////////////////////////////////////////////////// // NAME : DialogWindow::Draw // DESCRIPTION: Draw the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void DialogWindow::Draw( void ) { Window::Draw(); if ( head ) { Font *tf = (flags & WIN_FONT_BIG) ? LargeFont() : SmallFont(); short xoff = (w - tf->TextWidth(head)) / 2; tf->Write( head, this, xoff + 3, 8, GetBGPen() ); tf->Write( head, this, xoff, 5, GetFGPen() ); } } //////////////////////////////////////////////////////////////////////// // NAME : DialogWindow::SetButtonHook // DESCRIPTION: Set a WidgetHook for all buttons of this window. // PARAMETERS : hook - WidgetHook // RETURNS : - //////////////////////////////////////////////////////////////////////// void DialogWindow::SetButtonHook( WidgetHook *hook ) const { for ( int i = 0; i < btncnt; ++i ) btns[i]->SetHook( hook ); } //////////////////////////////////////////////////////////////////////// // NAME : NoteWindow::NoteWindow // DESCRIPTION: Create a window with a title, a short message, and an // "OK" button. // PARAMETERS : title - window title (may be NULL) // note - the message to be displayed // flags - see window.h for details // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// NoteWindow::NoteWindow( const char *title, const string ¬e, unsigned short flags, View *view ) : DialogWindow( title, note, MSG(MSG_B_OK), 0, flags, view ) {} //////////////////////////////////////////////////////////////////////// // NAME : MessageWindow::MessageWindow // DESCRIPTION: Create a message window. It will contain a TextScroll // and a Button widget. // PARAMETERS : title - window title (may be NULL) // msg - the message to be displayed in the text widget // (may be NULL) // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// MessageWindow::MessageWindow( const char *title, const char *msg, View *view ) : Window( WIN_CENTER|WIN_CLOSE_ESC, view ) { this->title = title; // calculate window dimensions SetSize( MAX(view->Width()/2, MIN_XRES), MAX(view->Height()*3/4, MIN_YRES) ); button = new ButtonWidget( GUI_CLOSE, 1, h - sfont->Height() - 11, w - 2, sfont->Height() + 10, WIDGET_DEFAULT, MSG(MSG_B_OK), this ); short boxy = 5; if ( title ) boxy += lfont->Height() * 2; textscroll = new TextScrollWidget( 1, 5, boxy, w - 10, h - boxy - button->Height() - 15, msg, 0, NULL, this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : MessageWindow::Draw // DESCRIPTION: Draw the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void MessageWindow::Draw( void ) { Window::Draw(); if ( title ) { int xoff = (w - lfont->TextWidth( title )) / 2; int yoff = (5 + lfont->Height()) / 2; lfont->Write( title, this, xoff+3, yoff+3, GetBGPen() ); lfont->Write( title, this, xoff, yoff, GetFGPen() ); } } //////////////////////////////////////////////////////////////////////// // NAME : PasswordWindow::PasswordWindow // DESCRIPTION: Create a window containing a string widget for asking // the user for a password. // PARAMETERS : title - window title // msg - single-line message to be printed (may be NULL) // pass - password to check the user input against; if // this is NULL any input will be accepted // abort - whether dialog can be cancelled // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// PasswordWindow::PasswordWindow( const char *title, const char *msg, const char *pass, bool abort, View *view ) : Window( WIN_CENTER, view ) { this->title = title; password = NULL; NewPassword( pass ); // calculate window dimensions unsigned short width = MAX( sfont->TextWidth(title) + 20, sfont->Width() * 9 + 25 ), height = sfont->Height() * 3 + 45; if ( msg ) { width = MAX( width, sfont->TextWidth(msg) + 40 ); height += sfont->Height() + 10; } SetSize( width, height ); string = new StringWidget( 0, (w - sfont->Width() * 9 - 4) / 2, h - sfont->Height() * 2 - 30, sfont->Width() * 9 + 4, sfont->Height() + 4, NULL, 7, WIDGET_ALIGN_TOP|WIDGET_STR_PASSWORD, msg, this ); if ( abort ) width = w/2 - 2; else width = w - 2; Widget *wd = new ButtonWidget( GUI_CLOSE, 1, h - sfont->Height() - 9, width, sfont->Height() + 8, WIDGET_DEFAULT, MSG(MSG_B_OK), this ); if ( abort ) { new ButtonWidget( GUI_RESTART, wd->LeftEdge() + wd->Width() + 1, wd->TopEdge(), wd->Width(), wd->Height(), 0, MSG(MSG_B_CANCEL), this ); } Draw(); Show(); string->SetFocus(); } //////////////////////////////////////////////////////////////////////// // NAME : PasswordWindow::Draw // DESCRIPTION: Draw the password window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void PasswordWindow::Draw( void ) { short xoff = (w - sfont->TextWidth( title )) / 2; Window::Draw(); sfont->Write( title, this, xoff + 3, 10, GetBGPen() ); sfont->Write( title, this, xoff, 7, GetFGPen() ); DrawBox( Rect( 5, 15 + sfont->Height(), w - 10, h - 2 * sfont->Height() - 30 ), BOX_RECESSED ); } //////////////////////////////////////////////////////////////////////// // NAME : PasswordWindow::PasswordOk // DESCRIPTION: Check the user input against the given password string. // PARAMETERS : - // RETURNS : TRUE on match, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool PasswordWindow::PasswordOk( void ) const { if ( !password ) return true; else if ( !string->String() ) return false; return !strcmp( password, string->String() ); } //////////////////////////////////////////////////////////////////////// // NAME : PasswordWindow::NewPassword // DESCRIPTION: Set new password to check the user input against. // PARAMETERS : pass - new password; if this is NULL any user input will // be accepted // RETURNS : - //////////////////////////////////////////////////////////////////////// void PasswordWindow::NewPassword( const char *pass ) { delete [] password; if ( pass ) { password = new char [strlen(pass) + 1]; strcpy( password, pass ); } else password = NULL; } //////////////////////////////////////////////////////////////////////// // NAME : ProgressWindow::ProgressWindow // DESCRIPTION: Create a window containing a progress bar display and // an 'abort' button. // PARAMETERS : x - left edge of window // y - top edge of window // w - window width // h - window height // pmin - value indicating an empty progress bar // pmax - value indicating a filled progress bar // msg - message to display (may be NULL) // flags - window flags (see window.h for details) // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// ProgressWindow::ProgressWindow( short x, short y, unsigned short w, unsigned short h, short pmin, short pmax, const char *msg, unsigned short flags, View *view ) : Window( x, y, w, h, flags, view ) { short bwidth = 0; if ( flags & WIN_PROG_ABORT ) { const char *lbl = MSG(MSG_B_SKIP); bwidth = sfont->TextWidth( lbl ) + 15; new ButtonWidget( GUI_CLOSE, w - bwidth - 5, 5, bwidth, h - 10, (flags & WIN_PROG_DEFAULT ? WIDGET_DEFAULT : 0), lbl, this ); } progress = new ProgressWidget( GUI_OK, 5, 5, w - 10 - bwidth, h - 10, pmin, pmax, 0, msg, this ); progress->SetColor( GetFGPen() ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : ProgressWindow::Cancelled // DESCRIPTION: Check whether the user clicked the 'Cancel' button. // PARAMETERS : - // RETURNS : TRUE if button was activated, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool ProgressWindow::Cancelled( void ) { GUI_Status peek; bool abort = false; do { SDL_Event event; peek = view->PeekEvent( event ); if ( (peek != GUI_NONE) && (HandleEvent( event ) == GUI_CLOSE) ) abort = true; } while ( peek != GUI_NONE ); return abort; } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::MenuWindow // DESCRIPTION: Create a new menu window. // PARAMETERS : title - menu title (may be NULL) // hook - widget hook to be notified when one of the menu // items is activated (may be NULL); sub-menus // are handled internally, so you won't get // messages for those // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// MenuWindow::MenuWindow( const char *title, WidgetHook *hook, View *view ) : Window( WIN_CLOSE_ESC|WIN_CLOSE_UNFOCUS, view ), layout(false), position(-1,-1), item_hook(hook), parent_menu(0) { minwidth = 0; vspacing = 4; barheight = vspacing * 2 + 2; // height of the separator bar if ( title ) { items.AddHead( new MenuItem( MENU_TITLE, 0, 0, 0, title ) ); AddBar( 0 ); } } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::AddItem // DESCRIPTION: Add a menu item to the menu. // PARAMETERS : level - menu level the item will be added to (root is 0) // id - menu button identifier for this item // flags - button flags (see widget.h for details) // title - menu item caption // RETURNS : - //////////////////////////////////////////////////////////////////////// void MenuWindow::AddItem( unsigned char level, short id, unsigned short flags, const char *title ) { items.AddTail( new MenuItem( MENU_ITEM, level, id, flags, title ) ); } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::AddMenu // DESCRIPTION: Add a sub-menu to the menu. // PARAMETERS : level - menu level the menu will be added to (root is 0) // flags - button flags (see widget.h for details) // title - sub-menu caption // RETURNS : - //////////////////////////////////////////////////////////////////////// void MenuWindow::AddMenu( unsigned char level, unsigned short flags, const char *title ) { items.AddTail( // sub-menus get their position in the items list as identifier; // that way the internal button handler can easily get the data // from the list new MenuItem( MENU_SUBMENU, level, items.CountNodes(), flags|WIDGET_STYLE_SUBMENU, title ) ); } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::AddBar // DESCRIPTION: Add a separator bar to the menu. // PARAMETERS : level - menu level the bar will be added to (root is 0) // RETURNS : - //////////////////////////////////////////////////////////////////////// void MenuWindow::AddBar( unsigned char level ) { items.AddTail( new MenuItem( MENU_SEPARATOR, level, 0, 0, "" ) ); } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::Layout // DESCRIPTION: Once the entire menu has been specified (all items // added etc.) we need to calculate the window size and // position and create the buttons. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void MenuWindow::Layout( void ) { if ( items.IsEmpty() ) return; // calculate window size MenuItem *mi = static_cast( items.Head() ); unsigned char lev = mi->mi_level; unsigned short maxwidth = 0, width, height = 10; bool havetitle = false; do { if ( mi->mi_level == lev ) { if ( mi->mi_type == MENU_SEPARATOR ) { width = 0; height += barheight; } else { width = sfont->TextWidth( mi->mi_title.c_str() ); // reserve space for the submenu arrow if ( mi->mi_type == MENU_SUBMENU ) width += 30; height += sfont->Height() + vspacing; if ( mi->mi_type == MENU_TITLE ) havetitle = true; } if ( width > maxwidth ) maxwidth = width; } mi = static_cast( mi->Next() ); } while ( mi ); // if position is -1,-1 (the default setting) the menu will open // close to the mouse pointer Rect win; if ( position == Point(-1,-1) ) { int mx, my; SDL_GetMouseState( &mx, &my ); win.x = mx - (maxwidth - 20) / 2; win.y = my - sfont->Height() / 2 - (havetitle ? sfont->Height() + vspacing + barheight : 0) - 5; } else { win.x = position.x; win.y = position.y; } win.w = MAX( maxwidth + 20, minwidth ); win.h = height; win.Align( *view ); SetSize( win ); // create the buttons mi = static_cast( items.Head() ); unsigned short ypos = 5; do { if ( mi->mi_level == lev ) { if ( (mi->mi_type == MENU_ITEM) || (mi->mi_type == MENU_SUBMENU) ) { MenuButtonWidget *mbw = new MenuButtonWidget( mi->mi_id, 5, ypos, w-10, sfont->Height() + vspacing, WIDGET_STYLE_MENU|WIDGET_STYLE_NOBORDER|mi->mi_flags, mi->mi_title.c_str(), this ); mbw->SetHook( (mi->mi_type == MENU_ITEM ? item_hook : this) ); ypos += mbw->Height(); } else if ( mi->mi_type == MENU_TITLE ) ypos += sfont->Height() + vspacing; else ypos += barheight; } mi = static_cast( mi->Next() ); } while ( mi && (mi->mi_level >= lev) ); layout = true; if ( lev == 0 ) Audio::PlaySfx( Audio::SND_GUI_MENU_SHOW, 0 ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::Draw // DESCRIPTION: Draw the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void MenuWindow::Draw( void ) { if ( !layout ) return; Window::Draw(); MenuItem *mi = static_cast( items.Head() ); unsigned char lev = mi->mi_level; unsigned short ypos = 5; do { if ( mi->mi_level == lev ) { switch ( mi->mi_type ) { case MENU_TITLE: sfont->Write( mi->mi_title.c_str(), this, (w - sfont->TextWidth(mi->mi_title.c_str()))/2, ypos, GetFGPen() ); ypos += sfont->Height() + vspacing; break; case MENU_SEPARATOR: FillRect( 5, ypos + vspacing, w - 10, 1, Color(CF_COLOR_SHADOW) ); FillRect( 5, ypos + vspacing + 1, w - 10, 1, Color(CF_COLOR_HIGHLIGHT) ); ypos += barheight; break; default: // MENU_ITEM and MENU_SUBMENU ypos += sfont->Height() + vspacing; } } mi = static_cast( mi->Next() ); } while ( mi && (mi->mi_level >= lev) ); } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::HandleEvent // DESCRIPTION: In addition to the standard Window::HandleEvent method, // we support menu navigation by keyboard here. // PARAMETERS : event - event received from the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status MenuWindow::HandleEvent( const SDL_Event &event ) { GUI_Status rc = GUI_OK; if ( (event.type == SDL_KEYDOWN) && (event.key.keysym.sym >= SDLK_UP) && (event.key.keysym.sym <= SDLK_LEFT) ) { MenuButtonWidget *cur, *sel; switch( event.key.keysym.sym ) { case SDLK_LEFT: // close window view->CloseWindow( this ); break; case SDLK_RIGHT: // descend into submenu (same as RETURN) cur = CurrentItem(); if ( cur && cur->IsMenu() ) cur->Push(); break; case SDLK_UP: case SDLK_DOWN: cur = CurrentItem(); sel = (event.key.keysym.sym == SDLK_UP) ? PrevItem() : NextItem(); if ( sel ) { sel->ToggleCurrent(); sel->Draw(); sel->Show(); if ( cur ) { cur->ToggleCurrent(); cur->Draw(); cur->Show(); } } break; default: break; } } else if ( (event.type == SDL_KEYUP) && (event.key.keysym.sym == SDLK_RIGHT) ) { MenuButtonWidget *cur = CurrentItem(); if ( cur && cur->IsMenu() && cur->Clicked() ) { cur->Release(); rc = cur->Activate(); } } else rc = Window::HandleEvent( event ); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::WidgetActivated // DESCRIPTION: When one of the sub-menu buttons is selected, we need // to create the appropriate sub-menu. // PARAMETERS : widget - selected button; its ID corresponds to its // position in the items list. // win - window (unused) // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status MenuWindow::WidgetActivated( Widget *button, Window *win ) { MenuWindow *sub = new MenuWindow( NULL, item_hook, view ); MenuItem *mi = static_cast( items.GetNode(button->ID()) ); unsigned char lev = mi->mi_level + 1; for ( mi = static_cast( mi->Next() ); mi && (mi->mi_level >= lev); mi = static_cast( mi->Next() ) ) { switch ( mi->mi_type ) { case MENU_ITEM: sub->AddItem( mi->mi_level, mi->mi_id, mi->mi_flags, mi->mi_title.c_str() ); break; case MENU_SUBMENU: sub->AddMenu( mi->mi_level, mi->mi_flags, mi->mi_title.c_str() ); break; case MENU_SEPARATOR: sub->AddBar( mi->mi_level ); break; } } sub->SetPosition( Point( x + w, y + button->TopEdge() - 5 ) ); sub->SetParent( this ); sub->Layout(); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::CloseParent // DESCRIPTION: When an item from the deepest sub-menu is selected the // higher menues are still open. This method can be used // to close the next higher menu. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void MenuWindow::CloseParent( void ) { if ( parent_menu ) { parent_menu->CloseParent(); view->CloseWindow( parent_menu ); parent_menu = NULL; } } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::NextItem // DESCRIPTION: Get a pointer to the next (enabled) menu button. Widgets // are added to the window in reverse order, so this // actually looks more like PrevItem... // PARAMETERS : - // RETURNS : pointer to the next menu item. If current is the last // valid item in the menu the search will continue at the // beginning. If there is no (other) valid item, the method // returns NULL. //////////////////////////////////////////////////////////////////////// MenuButtonWidget *MenuWindow::NextItem( void ) const { Widget *wd, *prev = NULL, *current = CurrentItem(); wd = NextItem( current ); while ( wd && (wd != current) ) { if ( !wd->Disabled() ) { prev = wd; break; } wd = NextItem( wd ); } return static_cast(prev); } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::PrevItem // DESCRIPTION: Get a pointer to the previous (enabled) menu button. // PARAMETERS : - // RETURNS : pointer to the previous menu item. If current is the // first valid item in the menu the search will continue at // the end. If there is no (other) valid item, the method // returns NULL. //////////////////////////////////////////////////////////////////////// MenuButtonWidget *MenuWindow::PrevItem( void ) const { Widget *wd, *next = NULL, *current = CurrentItem(); if ( current ) wd = current->next; else wd = widgets; do { while ( wd && (wd != current) ) { if ( !wd->Disabled() ) { next = wd; wd = current; break; } wd = wd->next; } if ( wd != current ) wd = widgets; } while ( wd != current ); return static_cast(next); } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::NextItem // DESCRIPTION: Get a pointer to the next menu button of an arbitrary // menu item, regardless of state. // PARAMETERS : current - item to get the successor of // RETURNS : pointer to the next menu item or NULL if there is no // other item //////////////////////////////////////////////////////////////////////// MenuButtonWidget *MenuWindow::NextItem( Widget *current ) const { Widget *wd = widgets, *prev = NULL; if ( !current || (current == widgets) ) { while ( wd ) { prev = wd; wd = wd->next; } } else { while ( wd != current ) { prev = wd; wd = wd->next; } } return static_cast(prev); } //////////////////////////////////////////////////////////////////////// // NAME : MenuWindow::CurrentItem // DESCRIPTION: Get a pointer to the currently selected menu button. // PARAMETERS : - // RETURNS : pointer to the selected menu item or NULL if none is // selected //////////////////////////////////////////////////////////////////////// MenuButtonWidget *MenuWindow::CurrentItem( void ) const { MenuButtonWidget *wd = static_cast(widgets); while ( wd ) { if ( wd->IsCurrent() ) break; wd = static_cast(wd->next); } return wd; } //////////////////////////////////////////////////////////////////////// // NAME : MenuItem::MenuItem // DESCRIPTION: Create a new menu item. // PARAMETERS : type - item type (see extwindow.h for details) // lev - menu level this item belongs to // id - identifier for this item // flags - button flags (see widget.h for details) // title - item caption // RETURNS : - //////////////////////////////////////////////////////////////////////// MenuWindow::MenuItem::MenuItem( unsigned char type, unsigned char lev, short id, unsigned short flags, const string &title ) : mi_type(type), mi_level(lev), mi_id(id), mi_flags(flags), mi_title(title) {} crimson-0.5.2.orig/src/common/extwindow.h0000600000175000017500000001154310554366467016605 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // extwindow.h - extended window classes /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_EXTWINDOW_H #define _INCLUDE_EXTWINDOW_H #include #include "window.h" #include "button.h" #include "textbox.h" #include "misc.h" // window to display some text and an arbitrary number of buttons // to get a response from the user class DialogWindow : public Window { public: DialogWindow( const char *title, const string &msg, const string &buttons, short def, unsigned short flags, View *view ); ~DialogWindow( void ); void Draw( void ); void SetButtonID( unsigned short button, short id ) const { btns[button]->SetID( id ); } void SetButtonHook( unsigned short button, WidgetHook *hook ) const { btns[button]->SetHook( hook ); } void SetButtonHook( WidgetHook *hook ) const; private: ButtonWidget **btns; unsigned short btncnt; string text; const char *head; char *bcaptions; }; // simple window with a short message (used e.g. at the start of each turn) class NoteWindow : public DialogWindow { public: NoteWindow( const char *title, const string ¬e, unsigned short flags, View *view ); }; // message window with a textscroll widget and a button class MessageWindow : public Window { public: MessageWindow( const char *title, const char *msg, View *view ); virtual void Draw( void ); void SetTitle( const char *title ) { this->title = title; } ButtonWidget *button; TextScrollWidget *textscroll; private: const char *title; }; // password window class PasswordWindow : public Window { public: PasswordWindow( const char *title, const char *msg, const char *pass, bool abort, View *view ); ~PasswordWindow( void ) { delete [] password; } void Draw( void ); bool PasswordOk( void ) const; void NewPassword( const char *pass ); StringWidget *string; private: char *password; const char *title; }; // progress window class ProgressWindow : public Window, public UserActionHook { public: ProgressWindow( short x, short y, unsigned short w, unsigned short h, short pmin, short pmax, const char *msg, unsigned short flags, View *view ); virtual bool Cancelled( void ); void Set( short pos ) const { progress->SetLevel( pos ); } short Get( void ) const { return progress->Level(); } void Advance( short pdelta ) const { progress->Advance( pdelta ); } private: ProgressWidget *progress; }; #define MENU_TITLE 1 #define MENU_SUBMENU 2 #define MENU_ITEM 3 #define MENU_SEPARATOR 4 class MenuWindow : public Window, private WidgetHook { public: MenuWindow( const char *title, WidgetHook *hook, View *view ); void AddItem( unsigned char level, short id, unsigned short flags, const char *title ); void AddMenu( unsigned char level, unsigned short flags, const char *title ); void AddBar( unsigned char level ); void SetPosition( const Point &pos ) { position = pos; } void SetMinWidth( unsigned short w ) { minwidth = w; } void Layout( void ); void Draw( void ); void SetParent( MenuWindow *parent ) { parent_menu = parent; } void CloseParent( void ); GUI_Status HandleEvent( const SDL_Event &event ); private: GUI_Status WidgetActivated( Widget *widget, Window *win ); MenuButtonWidget *NextItem( void ) const; MenuButtonWidget *PrevItem( void ) const; MenuButtonWidget *NextItem( Widget *current ) const; MenuButtonWidget *CurrentItem( void ) const; class MenuItem : public Node { public: MenuItem( unsigned char type, unsigned char lev, short id, unsigned short flags, const string &title ); unsigned char mi_type; unsigned char mi_level; short mi_id; unsigned short mi_flags; string mi_title; }; List items; unsigned short vspacing; unsigned short barheight; bool layout; Point position; unsigned short minwidth; WidgetHook *item_hook; MenuWindow *parent_menu; }; #endif /* _INCLUDE_EXTWINDOW_H */ crimson-0.5.2.orig/src/common/fileio.cpp0000600000175000017500000004374610554366432016361 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // fileio.cpp // // * additional code for Win32 by Adam Gates // * additional code for WinCE/Unicode by Maik Stohn //////////////////////////////////////////////////////////////////////// #ifndef _WIN32_WCE # include #endif #ifdef WIN32 # include # include # ifndef _WIN32_WCE # include # endif #endif #include #include #include #include "SDL_zlib.h" #include "fileio.h" #include "globals.h" // for CF_SHORTNAME //////////////////////////////////////////////////////////////////////// // NAME : Directory::Directory // DESCRIPTION: Open a directory and initialize the first directory // entry for reading. Whether the directory was // successfully opened can be checked using // Directory::IsValid(). // PARAMETERS : dir - name of the directory to open // RETURNS : - //////////////////////////////////////////////////////////////////////// Directory::Directory( const char *dir ) { #ifdef WIN32 string search( dir ); append_path_delim( search ); search += "*.*"; # ifdef UNICODE // unicode handling for WindowsCE WCHAR *wsearch = new WCHAR[search.length()+1]; size_t len = mbstowcs( wsearch, search.c_str(), search.length() ); if ( len < 0 ) len = 0; wsearch[len] = 0; m_Dir = FindFirstFile( wsearch, &m_Entry ); delete [] wsearch; # else m_Dir = FindFirstFile( search.c_str(), &m_Entry ); # endif #else m_Entry = NULL; m_Dir = opendir( dir ); if ( m_Dir ) m_Entry = readdir( m_Dir ); #endif } //////////////////////////////////////////////////////////////////////// // NAME : Directory::~Directory // DESCRIPTION: Close a directory. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Directory::~Directory( void ) { #ifdef WIN32 if ( m_Dir ) FindClose( m_Dir ); #else if ( m_Dir ) closedir( m_Dir ); #endif } //////////////////////////////////////////////////////////////////////// // NAME : Directory::GetFileName // DESCRIPTION: Get the name of the currently selected file in the // directory. // PARAMETERS : - // RETURNS : pointer to file name or NULL if end of directory reached // (or not opened). //////////////////////////////////////////////////////////////////////// const char *Directory::GetFileName( void ) const { #ifdef WIN32 # ifdef UNICODE // unicode handling for WindowsCE size_t len = wcstombs( (char *)m_AsciiDir, m_Entry.cFileName, wcslen(m_Entry.cFileName) ); if ( len < 0 ) len = 0; ((char *)m_AsciiDir)[len] = 0; return m_AsciiDir; # else return m_Entry.cFileName; # endif #else if ( m_Entry ) return m_Entry->d_name; else return NULL; #endif } //////////////////////////////////////////////////////////////////////// // NAME : Directory::GetFileNameLen // DESCRIPTION: Get the length of the currently selected file name. // PARAMETERS : - // RETURNS : length of file name in characters //////////////////////////////////////////////////////////////////////// size_t Directory::GetFileNameLen( void ) const { #ifdef WIN32 # ifdef UNICODE return wcslen( m_Entry.cFileName ); # else return strlen( m_Entry.cFileName ); # endif #else if ( m_Entry ) { # ifdef HAVE_DIRENT_H return strlen( m_Entry->d_name ); # else return m_Entry->d_namlen; # endif } return 0; #endif } //////////////////////////////////////////////////////////////////////// // NAME : Directory::IsFileHidden // DESCRIPTION: Determine whether the currently selected file is a // hidden file. // PARAMETERS : - // RETURNS : TRUE if file is a hidden file, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool Directory::IsFileHidden( void ) const { #ifdef WIN32 return (m_Entry.dwFileAttributes & FILE_ATTRIBUTE_HIDDEN) != 0; #else if ( m_Entry ) return m_Entry->d_name[0] == '.'; else return false; #endif } //////////////////////////////////////////////////////////////////////// // NAME : Directory::NextFile // DESCRIPTION: Initialize the next file in the directory for // examination. // PARAMETERS : - // RETURNS : TRUE if another file was found, FALSE if the end of the // directory was reached. //////////////////////////////////////////////////////////////////////// bool Directory::NextFile( void ) { #ifdef WIN32 return FindNextFile( m_Dir, &m_Entry ) != FALSE; #else if ( m_Dir ) m_Entry = readdir( m_Dir ); return m_Entry != NULL; #endif } //////////////////////////////////////////////////////////////////////// // NAME : File::Close // DESCRIPTION: Close the file handle. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void File::Close( void ) { if ( fh != 0 ) { SDL_RWclose( fh ); fh = 0; } } //////////////////////////////////////////////////////////////////////// // NAME : File::Open // DESCRIPTION: Open the file. // PARAMETERS : mode - file access descriptors (r, w, b) // compressed - whether to open for compression. This // parameter should only be used when opening // a file for writing. Default is true. // RETURNS : TRUE on success, FALSE on error //////////////////////////////////////////////////////////////////////// bool File::Open( const char *mode, bool compressed /* = true */ ) { bool rc = false; if ( !fh ) { if ( compressed ) fh = SDL_RWFromGzip( name.c_str(), mode ); else fh = SDL_RWFromFile( name.c_str(), mode ); rc = (fh != 0); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : File::OpenData // DESCRIPTION: Open the file. The "path" parameter passed to the // constructor is treated as a path relative to the data // (sub)directory used by the game. This method first tries // to open the file from the user's home directory (if // available), and only if this attempt fails the file is // loaded from the system data directory. After a // successful call, File::Name() returns the full path to // the file. // PARAMETERS : subdir - data subdirectory to look in // mode - file access descriptors (r, w, b) // compressed - whether to open for compression. This // parameter should only be used when opening // a file for writing. Default is true. // RETURNS : TRUE on success, FALSE on error //////////////////////////////////////////////////////////////////////// bool File::OpenData( const char *mode, const string &subdir /* = "" */, bool compressed /* = true */ ) { bool rc = false; if ( !fh ) { string local( name ); name = get_home_dir(); if ( !name.empty() ) { append_path( name, subdir ); append_path( name, local ); rc = Open( mode, compressed ); } if ( !rc ) { name = get_data_subdir( subdir ); append_path( name, local ); rc = Open( mode, compressed ); } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : File::Exists // DESCRIPTION: Check whether the filename is already in use. // PARAMETERS : name - file name to check for // RETURNS : TRUE if file exists, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool File::Exists( const string &name ) { // try to open the file FILE *fd = fopen( name.c_str(), "r" ); if ( fd ) fclose( fd ); return fd != NULL; } //////////////////////////////////////////////////////////////////////// // NAME : File::Read8 // DESCRIPTION: Read a byte from the buffer. // PARAMETERS : - // RETURNS : byte read //////////////////////////////////////////////////////////////////////// unsigned char File::Read8( void ) { unsigned char val; Read( &val, 1 ); return val; } //////////////////////////////////////////////////////////////////////// // NAME : MemBuffer::ReadS // DESCRIPTION: Read a string from the buffer. // PARAMETERS : size - number of bytes to read // RETURNS : string read //////////////////////////////////////////////////////////////////////// string MemBuffer::ReadS( int size ) { string str; for ( int i = 0; i < size; ++i ) str += Read8(); return str; } //////////////////////////////////////////////////////////////////////// // NAME : MemBuffer::WriteS // DESCRIPTION: Write a string to the buffer. // PARAMETERS : value - string to write // len - minimum number of bytes to write. If value is // shorter than len, a number of NUL-bytes are // written to the buffer. // RETURNS : -1 on error //////////////////////////////////////////////////////////////////////// int MemBuffer::WriteS( string value, int len /* = 0 */ ) { int size = value.size(); int rc = Write( value.c_str(), size ); while ( (size < len) && (rc == 0) ) { rc = Write8( 0 ); ++size; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : append_path_delim // DESCRIPTION: Append a path delimiter to the end of the string if // it isn't already there. // PARAMETERS : path - string containing a path // RETURNS : - //////////////////////////////////////////////////////////////////////// void append_path_delim( string &path ) { if ( path.at( path.length() - 1 ) != PATHDELIM ) path += PATHDELIM; } //////////////////////////////////////////////////////////////////////// // NAME : make_dir // DESCRIPTION: Create a directory. // PARAMETERS : dir - name of the directory to create // RETURNS : - //////////////////////////////////////////////////////////////////////// void make_dir( const char *dir ) { #ifdef WIN32 # ifdef UNICODE WCHAR *wdir = new WCHAR[strlen(dir)+1]; size_t len = mbstowcs( wdir, dir, strlen(dir) ); if ( len < 0 ) len = 0; wdir[len] = 0; CreateDirectory( wdir, NULL ); delete [] wdir; # else CreateDirectory( dir, NULL ); # endif #else mkdir( dir, S_IRWXU|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH ); #endif } //////////////////////////////////////////////////////////////////////// // NAME : create_config_dir // DESCRIPTION: Create a configuration and save directory in the user's // home dir (UNIX & Co.) or his My Documents folder // (Win32). // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void create_config_dir( void ) { string confd = get_config_dir(); // does the directory exist? Directory cfdir( confd.c_str() ); if ( !cfdir.IsValid() ) make_dir( confd.c_str() ); // now check for the saved games directory append_path( confd, "games" ); Directory svdir( confd.c_str() ); if ( !svdir.IsValid() ) make_dir( confd.c_str() ); } //////////////////////////////////////////////////////////////////////// // NAME : get_home_dir // DESCRIPTION: Get the name of the user's home directory. // PARAMETERS : - // RETURNS : the user's home directory if any //////////////////////////////////////////////////////////////////////// string get_home_dir( void ) { #ifdef WIN32 TCHAR dir[MAX_PATH]; SHGetSpecialFolderPath( NULL, dir, CSIDL_PERSONAL, TRUE ); # ifdef UNICODE char mbdir[MAX_PATH]; wcstombs( mbdir, dir, wcslen(dir)+1 ); return mbdir; # else return dir; # endif #elif defined __BEOS__ return "./"; #else return getenv( "HOME" ); #endif } //////////////////////////////////////////////////////////////////////// // NAME : get_config_dir // DESCRIPTION: Get the name of the configuration directory. // PARAMETERS : - // RETURNS : config directory //////////////////////////////////////////////////////////////////////// string get_config_dir( void ) { string confd; string homed( get_home_dir() ); #ifdef WIN32 if ( homed.empty() ) confd = get_data_dir(); #else if ( homed.empty() ) confd.append( CURRENTDIR ); #endif else { confd.append( homed ); append_path_delim( confd ); #ifndef WIN32 confd += '.'; #endif confd.append( CF_SHORTNAME ); } append_path_delim( confd ); return confd; } //////////////////////////////////////////////////////////////////////// // NAME : get_data_dir // DESCRIPTION: Get the name of the directory containing the data files. // PARAMETERS : - // RETURNS : data directory name //////////////////////////////////////////////////////////////////////// string get_data_dir( void ) { #ifdef WIN32 char dir[MAX_PATH]; # ifdef UNICODE WCHAR wdir[MAX_PATH]; GetModuleFileName( NULL, wdir, MAX_PATH ); size_t len = wcstombs( dir, wdir, wcslen(wdir) ); if( len < 0 ) len = 0; dir[len] = 0; # else GetModuleFileName( NULL, dir, MAX_PATH ); # endif { // Remove the file name char *l = dir; char *c = dir; while( *c != '\0' ) { if ( *c == PATHDELIM ) l = c; ++c; } ++l; *l = '\0'; } return dir; #elif defined CF_DATADIR return CF_DATADIR; #else return CURRENTDIR; #endif } //////////////////////////////////////////////////////////////////////// // NAME : get_save_dir // DESCRIPTION: Get the name of the directory to save games in. // PARAMETERS : - // RETURNS : saved games directory //////////////////////////////////////////////////////////////////////// string get_save_dir( void ) { string saved( get_config_dir() ); saved.append( "games" ); append_path_delim( saved ); return saved; } //////////////////////////////////////////////////////////////////////// // NAME : get_data_subdir // DESCRIPTION: Get the full path of a data subdirectory. // PARAMETERS : sub - name of the subdirectory // RETURNS : full path to directory (including trailing slash) //////////////////////////////////////////////////////////////////////// string get_data_subdir( const string &sub ) { string d( get_data_dir() ); append_path( d, sub ); append_path_delim( d ); return d; } //////////////////////////////////////////////////////////////////////// // NAME : get_sfx_dir // DESCRIPTION: Get the name of the directory containing the sound // effects. // PARAMETERS : - // RETURNS : sound effects directory //////////////////////////////////////////////////////////////////////// string get_sfx_dir( void ) { return get_data_subdir( "sound" ); } //////////////////////////////////////////////////////////////////////// // NAME : get_music_dir // DESCRIPTION: Get the name of the directory containing the music // tracks. // PARAMETERS : - // RETURNS : soundtracks directory //////////////////////////////////////////////////////////////////////// string get_music_dir( void ) { return get_data_subdir( "music" ); } //////////////////////////////////////////////////////////////////////// // NAME : get_levels_dir // DESCRIPTION: Get the name of the directory containing the map files. // PARAMETERS : - // RETURNS : levels directory name //////////////////////////////////////////////////////////////////////// string get_levels_dir( void ) { return get_data_subdir( "levels" ); } //////////////////////////////////////////////////////////////////////// // NAME : get_locale_dir // DESCRIPTION: Get the name of the directory containing the language // data files. // PARAMETERS : - // RETURNS : locale directory name //////////////////////////////////////////////////////////////////////// string get_locale_dir( void ) { return get_data_subdir( "locale" ); } //////////////////////////////////////////////////////////////////////// // NAME : get_home_levels_dir // DESCRIPTION: Get the name of an optional directory in the user's home // directory containing additional map files. // PARAMETERS : - // RETURNS : levels directory name or an empty string if it does not // exist //////////////////////////////////////////////////////////////////////// string get_home_levels_dir( void ) { string hld(""); #ifndef WIN32 string homed( get_home_dir() ); if ( !homed.empty() ) { hld = get_config_dir(); hld.append( "levels" ); append_path_delim( hld ); } #endif return hld; } //////////////////////////////////////////////////////////////////////// // DESCRIPTION: Extract the name of a file from a given path. // PARAMETERS : path - filename (including full or partial path) // RETURNS : file part of the path //////////////////////////////////////////////////////////////////////// string file_part( const string &path ) { int pathend = path.rfind( PATHDELIM ); return path.substr( pathend + 1 ); } //////////////////////////////////////////////////////////////////////// // NAME : append_path // DESCRIPTION: Add another subpath to an existing path. Also add path // delimiter if required. // PARAMETERS : path - existing path to be extended // sub - subpath to be added // RETURNS : - //////////////////////////////////////////////////////////////////////// void append_path( string &path, const string &sub ) { append_path_delim( path ); path.append( sub ); } crimson-0.5.2.orig/src/common/fileio.h0000600000175000017500000001037210560715624016011 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // fileio.h //////////////////////////////////////////////////////////////////////// #ifndef _INCLUDE_FILEIO_H #define _INCLUDE_FILEIO_H #if defined WIN32 # include #elif HAVE_DIRENT_H # include #elif HAVE_SYS_NDIR_H # include #elif HAVE_SYS_DIR_H # include #elif HAVE_NDIR_H # include #endif #include using namespace std; #include "SDL.h" #include "SDL_endian.h" #ifdef WIN32 #define PATHDELIM '\\' #define CRIMSONRC "crimson.ini" #else #define PATHDELIM '/' #define CRIMSONRC "crimsonrc" #endif #define CURRENTDIR "." class Directory { public: Directory( const char *dir ); ~Directory( void ); bool IsValid( void ) const #ifdef WIN32 { return m_Dir != INVALID_HANDLE_VALUE; } #else { return m_Dir != NULL; } #endif const char *GetFileName( void ) const; size_t GetFileNameLen() const; bool IsFileHidden( void ) const; bool NextFile( void ); private: #ifdef WIN32 HANDLE m_Dir; WIN32_FIND_DATA m_Entry; # ifdef UNICODE char m_AsciiDir[MAX_PATH]; # endif #elif HAVE_DIRENT_H DIR *m_Dir; dirent *m_Entry; #else DIR *m_Dir; direct *m_Entry; #endif }; // generic buffer access class MemBuffer { public: MemBuffer( void ) {} virtual ~MemBuffer( void ) {} virtual int Read( void *buffer, int size ) = 0; virtual unsigned char Read8( void ) = 0; virtual unsigned short Read16( void ) = 0; virtual unsigned long Read32( void ) = 0; string ReadS( int size ); virtual int Write( const void *values, int size ) = 0; virtual int Write8( unsigned char value ) = 0; virtual int Write16( unsigned short value ) = 0; virtual int Write32( unsigned long value ) = 0; int WriteS( string value, int len = 0 ); }; // file abstraction to encapsulate SDL file access layer class File : public MemBuffer { public: File( const string &path ) : fh(0), name(path) {} ~File( void ) { if (fh) Close(); } int Read( void *buffer, int size ) { return SDL_RWread(fh, buffer, 1, size); } unsigned char Read8( void ); unsigned short Read16( void ) { return SDL_ReadLE16(fh); } unsigned long Read32( void ) { return SDL_ReadLE32(fh); } int Write( const void *values, int size ) { return (SDL_RWwrite(fh, values, size, 1) == 1) ? 0 : -1; } int Write8( unsigned char value ) { return (SDL_RWwrite(fh, &value, 1, 1) == 1) ? 0 : -1; } int Write16( unsigned short value ) { return (SDL_WriteLE16(fh, value) == 1) ? 0 : -1; } int Write32( unsigned long value ) { return (SDL_WriteLE32(fh, value) == 1) ? 0 : -1; } bool Open( const char *mode, bool compressed = true ); bool OpenData( const char *mode, const string &subdir = "", bool compressed = true ); void Close( void ); static bool Exists( const string &name ); const string &Name( void ) const { return name; } private: SDL_RWops *fh; string name; }; string get_config_dir( void ); string get_home_dir( void ); string get_save_dir( void ); string get_data_dir( void ); string get_data_subdir( const string &sub ); string get_sfx_dir( void ); string get_music_dir( void ); string get_levels_dir( void ); string get_locale_dir( void ); string get_home_levels_dir( void ); void create_config_dir( void ); string file_part( const string &path ); void append_path( string &path, const string &sub ); void append_path_delim( string &path ); void make_dir( const char *dir ); #endif /* _INCLUDE_FILEIO_H */ crimson-0.5.2.orig/src/common/filewindow.cpp0000600000175000017500000002106410554366432017246 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////////// // filewindow.cpp /////////////////////////////////////////////////////////////////// #include #include "filewindow.h" #include "fileio.h" #include "misc.h" #include "msgs.h" #include "globals.h" // strcasecmp alternatives //////////////////////////////////////////////////////////////////////// // NAME : FileWindow::FileWindow // DESCRIPTION: Create a new FileWindow instance. At the moment this // class is not usable as a generic file window, but only // for loading and saving Crimson Fields game files. // PARAMETERS : path - directory path to show files in // file - default file name (may be NULL) // suffix - only files with this ending will be displayed; // if the user enters a name the suffix will be // appended if necessary (may be NULL) // flags - window flags (see window.h for details) // view - view to attach window to // RETURNS : - //////////////////////////////////////////////////////////////////////// FileWindow::FileWindow( const char *path, const char *file, const char *suffix, unsigned short flags, View *view ) : Window( flags|WIN_CENTER, view ), path(path), suffix(suffix), last(0) { // calculate window dimensions const char *oklabel = (flags & WIN_FILE_SAVE) ? MSG(MSG_B_SAVE) : MSG(MSG_B_LOAD); const char *cancellabel = MSG(MSG_B_CANCEL); unsigned short oklen = sfont->TextWidth( oklabel ); unsigned short cancellen = sfont->TextWidth( cancellabel ); unsigned short labellen = MAX(oklen, cancellen) + 10; unsigned short winw = labellen + sfont->Width() * 30 + 20; unsigned short winh = sfont->Height() * 15 + lfont->Height() + 30; SetSize( MIN(winw, view->Width()), MIN(winh, view->Height()) ); CreateFilesList( path, suffix, files ); short def_node = FindFileInList( file, files ); // create widgets list = new TextListWidget( 100, 5, lfont->Height() + 10, w - labellen - 20, h - 24 - sfont->Height() - lfont->Height(), &files, def_node, WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY, NULL, this ); list->SetHook( this ); str = new StringWidget( 101, 5, h - 13 - sfont->Height(), list->Width(), sfont->Height() + 8, file, 22, 0, NULL, this ); ok = new ButtonWidget( GUI_CLOSE, w - 5 - labellen, h - 10 - 2 * (sfont->Height() + 8), labellen, sfont->Height() + 8, WIDGET_DEFAULT, oklabel, this ); cancel = new ButtonWidget( GUI_CLOSE, ok->LeftEdge(), h - 13 - sfont->Height(), ok->Width(), ok->Height(), 0, cancellabel, this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : FileWindow::~FileWindow // DESCRIPTION: Destroy a file window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// FileWindow::~FileWindow( void ) { // the list nodes would be cleaned automatically, but the space // allocated for the node names must be freed explicitly while ( !files.IsEmpty() ) { TLWNode *n = static_cast(files.RemHead()); delete (string *)n->UserData(); delete n; } } //////////////////////////////////////////////////////////////////////// // NAME : FileWindow::Draw // DESCRIPTION: Draw the file window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void FileWindow::Draw( void ) { const char *title; if ( flags & WIN_FILE_SAVE ) title = MSG(MSG_SAVE_GAME); else if ( flags & WIN_FILE_LOAD ) title = MSG(MSG_LOAD_GAME); else title = "Select"; Window::Draw(); lfont->Write( title, this, (w - lfont->TextWidth(title))/2 + 3, 8, GetBGPen() ); lfont->Write( title, this, (w - lfont->TextWidth(title))/2, 5, GetFGPen() ); } //////////////////////////////////////////////////////////////////////// // NAME : FileWindow::GetFile // DESCRIPTION: Get the currently selected filename, including the path. // PARAMETERS : - // RETURNS : pointer to a buffer containing the path and filename or // NULL //////////////////////////////////////////////////////////////////////// string FileWindow::GetFile( void ) const { string fw_file; const char *file = str->String(); if ( file ) { fw_file.append( path ); append_path_delim( fw_file ); fw_file.append( file ); // append the suffix if necessary if ( suffix.length() > 0 ) { short suflen = suffix.length(); string::size_type pos = fw_file.find( suffix.c_str(), fw_file.length() - suflen, suflen ); if ( pos == static_cast(-1) ) fw_file.append( suffix ); } } return fw_file; } //////////////////////////////////////////////////////////////////////// // NAME : FileWindow::FindFileInList // DESCRIPTION: Check whether a file dwells in the list. // PARAMETERS : file - file name to search for // list - list (of TLWNodes) to search in // RETURNS : index of the node containing the file, or -1 if not // found //////////////////////////////////////////////////////////////////////// short FileWindow::FindFileInList( const char *file, const TLWList &list ) const { if ( file ) { short i = 0; for ( TLWNode *n = static_cast( list.Head() ); n; n = static_cast( n->Next() ), ++i ) { if ( !strcmp( file, n->Name() ) ) return i; } } return -1; } //////////////////////////////////////////////////////////////////////// // NAME : FileWindow::WidgetActivated // DESCRIPTION: The is the list hook method. Whenever a file is selected // from the list, print its name in the string widget. // PARAMETERS : widget - list widget // win - pointer to file window // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status FileWindow::WidgetActivated( Widget *widget, Window *win ) { Node *node = static_cast(widget)->Selected(); GUI_Status rc = GUI_OK; if ( node ) { if ( node == last ) rc = ok->Activate(); else { str->SetString( static_cast(node)->Name() ); last = node; } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : FileWindow::CreateFilesList // DESCRIPTION: Read the names of all files with a specified suffix in // a directory and put them into a list. // PARAMETERS : dirname - name of the directory to go through // suffix - suffix for the files to grab (may be NULL) // list - list to append nodes to // RETURNS : number of files found or -1 on error; the nodes added // to the list are of the TLWNode class. //////////////////////////////////////////////////////////////////////// short FileWindow::CreateFilesList( const char *dirname, const char *suffix, TLWList &list ) { TLWNode *node; string *full; short num = 0, suflen = 0; if ( suffix ) suflen = strlen( suffix ); Directory dir( dirname ); if ( dir.IsValid() ) { do { int len = dir.GetFileNameLen(); if ( (suflen <= len) && (strcasecmp( &(dir.GetFileName()[len-suflen]), suffix ) == 0) ) { node = new TLWNode( dir.GetFileName() ); full = new string( dirname ); if ( node && full ) { append_path_delim( *full ); // store full file path full->append( dir.GetFileName() ); node->SetUserData( full ); list.InsertNodeSorted( node ); ++num; } else { delete node; delete full; num = -1; break; } } } while ( dir.NextFile() ); } return num; } crimson-0.5.2.orig/src/common/filewindow.h0000600000175000017500000000350110554366467016717 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // filewindow.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_FILEWINDOW_H #define _INCLUDE_FILEWINDOW_H #include #include "window.h" #include "button.h" #include "textbox.h" class FileWindow : public Window, public WidgetHook { public: FileWindow( const char *path, const char *file, const char *suffix, unsigned short flags, View *view ); ~FileWindow( void ); const char *GetPath( void ) const { return path.c_str(); } string GetFile( void ) const; void Draw( void ); GUI_Status WidgetActivated( Widget *widget, Window *win ); static short CreateFilesList( const char *dir, const char *suffix, TLWList &list ); ButtonWidget *ok; ButtonWidget *cancel; private: short FindFileInList( const char *file, const TLWList &list ) const; TextListWidget *list; StringWidget *str; TLWList files; string path; string suffix; Node *last; }; #endif /* _INCLUDE_FILEWINDOW_H */ crimson-0.5.2.orig/src/common/font.cpp0000600000175000017500000002522010554366433016044 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // font.cpp //////////////////////////////////////////////////////////////////////// #include "font.h" //////////////////////////////////////////////////////////////////////// // NAME : Font::~Font // DESCRIPTION: Destroy font. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Font::~Font( void ) { if ( f ) TTF_CloseFont( f ); } //////////////////////////////////////////////////////////////////////// // NAME : Font::Load // DESCRIPTION: Load a font from a data file. // PARAMETERS : file - name of the font file // size - requested font size // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Font::Load( const char *file, int size ) { // SDL_ttf segfaults if the font is not present... if ( File::Exists( file ) ) { f = TTF_OpenFont( file, size ); if ( f ) { col = Color(CF_COLOR_WHITE); TTF_SetFontStyle( f, TTF_STYLE_BOLD ); // this is an ugly hack and rather error prone... int minx, maxx; TTF_GlyphMetrics( f, 'w', &minx, &maxx, 0, 0, 0 ); width = maxx - minx; height = TTF_FontHeight( f ); return 0; } } return -1; } //////////////////////////////////////////////////////////////////////// // NAME : Font::CharWidth // DESCRIPTION: Get the pixel width of a single character. // PARAMETERS : c - character // RETURNS : character width //////////////////////////////////////////////////////////////////////// unsigned char Font::CharWidth( char c ) const { char str[2] = { c, 0 }; return TextWidth( str ); } //////////////////////////////////////////////////////////////////////// // NAME : Font::TextWidth // DESCRIPTION: Calculate the length of a string in pixels. // PARAMETERS : str - string to get the length of // RETURNS : length of str in pixels //////////////////////////////////////////////////////////////////////// unsigned short Font::TextWidth( const char *str ) const { if ( !str ) return 0; unsigned short maxw = 0; string buf( str ); size_t pos, prev = 0; do { pos = buf.find( '\n', prev ); int w; string sub( buf.substr( prev, pos - prev ) ); TTF_SizeUTF8( f, sub.c_str(), &w, 0 ); if ( w > maxw ) maxw = w; prev = pos + 1; } while ( pos != string::npos ); return maxw; } //////////////////////////////////////////////////////////////////////// // NAME : Font::TextHeight // DESCRIPTION: Calculate the height of a string in pixels. // PARAMETERS : str - string to get the height of; A new line is // started whenever the length exceeds the // available line width or a newline character // is encountered // linew - available line width in pixels // spacing - vertical spacing between lines // RETURNS : height of str in pixels //////////////////////////////////////////////////////////////////////// unsigned short Font::TextHeight( const char *str, unsigned short linew, unsigned short spacing ) const { unsigned short lines = 0; int pos = 0, endpos = strlen(str); while ( pos < endpos ) { pos += FitText( &str[pos], linew, true ); ++lines; } return lines * (Height() + spacing); } //////////////////////////////////////////////////////////////////////// // NAME : Font::FitText // DESCRIPTION: Check how much of a string fits into a display. // PARAMETERS : str - string to check // width - display width // word - if TRUE, break string at SPACE and NEWLINE only, // otherwise break whenever linelength exceeds // display width // RETURNS : number of characters that fit into the display //////////////////////////////////////////////////////////////////////// unsigned short Font::FitText( const char *str, unsigned short width, bool word ) const { int lastspace = 0, pos = 0; string line; do { if ( (str[pos] == ' ') || (str[pos] == '\n') || (str[pos] == '\0') ) { if ( TextWidth( line.c_str() ) > width ) { // go back to last space line.erase( lastspace ); pos = lastspace; if ( lastspace != 0 && word ) return pos + 1; else { // add single characters until we hit the wall do { line += str[pos++]; } while ( TextWidth( line.c_str() ) <= width ); return pos - 1; } } if ( (str[pos] == '\n') || (str[pos] == '\0') ) return pos + 1; lastspace = pos; line += str[pos]; } else line += str[pos]; } while ( str[pos++] != '\0' ); return pos; } //////////////////////////////////////////////////////////////////////// // NAME : Font::SetColor // DESCRIPTION: Set the foreground color of the font. // PARAMETERS : fcol - new font color // RETURNS : - //////////////////////////////////////////////////////////////////////// void Font::SetColor( const Color &fcol ) { col = fcol; } //////////////////////////////////////////////////////////////////////// // NAME : Font::Write // DESCRIPTION: Print a string to a surface. // PARAMETERS : str - string // dest - destination surface // x - left edge of string // y - top edge of string // RETURNS : number of horizontal pixels written //////////////////////////////////////////////////////////////////////// int Font::Write( const char *str, Surface *dest, short x, short y ) const { SDL_Color scol = { col.r, col.g, col.b }; SDL_Surface *s = TTF_RenderUTF8_Blended( f, str, scol ); if ( s ) { SDL_Rect src = { 0, 0, s->w, s->h }; SDL_Rect dst = { x, y, s->w, s->h }; SDL_BlitSurface( s, &src, dest->s_surface, &dst ); SDL_FreeSurface( s ); return src.w; } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Font::Write // DESCRIPTION: Print a string to a surface with clipping. // PARAMETERS : str - string // dest - destination surface // x - left edge of string // y - top edge of string // clip - clipping rectangle // RETURNS : number of horizontal pixels written //////////////////////////////////////////////////////////////////////// int Font::Write( const char *str, Surface *dest, short x, short y, const Rect &clip ) const { if ( (y + height < clip.y) || (y >= clip.y + clip.h) || (x >= clip.x + clip.w) ) return 0; Rect oldclip; dest->GetClipRect( oldclip ); dest->SetClipRect( clip ); int px = Write( str, dest, x, y ); dest->SetClipRect( oldclip ); return px; } //////////////////////////////////////////////////////////////////////// // NAME : Font::Write // DESCRIPTION: Print a colored string to a surface. // PARAMETERS : str - string // dest - destination surface // x - left edge of string // y - top edge of string // color - string color // RETURNS : number of horizontal pixels written //////////////////////////////////////////////////////////////////////// int Font::Write( const char *str, Surface *dest, short x, short y, const Color &color ) { Color old = col; SetColor( color ); int px = Write( str, dest, x, y ); SetColor( old ); return px; } //////////////////////////////////////////////////////////////////////// // NAME : Font::Write // DESCRIPTION: Print a character to a surface. // PARAMETERS : c - character // dest - destination surface // x - left edge of destination area // y - top edge of destination area // RETURNS : number of horizontal pixels written //////////////////////////////////////////////////////////////////////// int Font::Write( char c, Surface *dest, short x, short y ) const { char str[2] = { c, 0 }; return Write( str, dest, x, y ); } //////////////////////////////////////////////////////////////////////// // NAME : Font::Write // DESCRIPTION: Print a colored character to a surface. // PARAMETERS : c - character // dest - destination surface // x - left edge of destination area // y - top edge of destination area // color - character color // RETURNS : number of horizontal pixels written //////////////////////////////////////////////////////////////////////// int Font::Write( char c, Surface *dest, short x, short y, const Color &color ) { Color old = col; SetColor( color ); int px = Write( c, dest, x, y ); SetColor( old ); return px; } //////////////////////////////////////////////////////////////////////// // NAME : Font::WriteEllipsis // DESCRIPTION: Print a string to a surface with clipping and ellipsize // (...) it if it doesn't fit. // PARAMETERS : str - string // dest - destination surface // x - left edge of string // y - top edge of string // clip - clipping rectangle // RETURNS : number of horizontal pixels written //////////////////////////////////////////////////////////////////////// int Font::WriteEllipsis( const char *str, Surface *dest, short x, short y, const Rect &clip ) const { if ( (y + height < clip.y) || (y >= clip.y + clip.h) || (x >= clip.x + clip.w) ) return 0; if ( TextWidth( str ) + x - clip.x > clip.w ) { const char *dots = "..."; int w, addw = TextWidth( dots ) + x - clip.x; string text( str ); do { text.erase( text.length() - 1 ); w = TextWidth( text.c_str() ) + addw; } while ( (w > clip.w) && (text.length() > 1) ); text.append( dots ); str = text.c_str(); } return Write( str, dest, x, y, clip ); } crimson-0.5.2.orig/src/common/font.h0000600000175000017500000000435310554366467015524 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // font.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_FONT_H #define _INCLUDE_FONT_H #include "SDL_ttf.h" #include "surface.h" class Font { public: Font( void ) { f = 0; } ~Font( void ); int Load( const char *file, int size ); // returns max. character width for proportional fonts unsigned char Width( void ) const { return width; } unsigned char Height( void ) const { return height; } unsigned char CharWidth( char c ) const; unsigned short TextWidth( const char *str ) const; unsigned short TextHeight( const char *str, unsigned short linew, unsigned short spacing ) const; unsigned short FitText( const char *str, unsigned short width, bool word ) const; void SetColor( const Color &fcol ); Color GetColor( void ) const { return col; } int Write( const char *str, Surface *dest, short x, short y ) const; int Write( char c, Surface *dest, short x, short y ) const; int Write( const char *str, Surface *dest, short x, short y, const Color &color ); int Write( char c, Surface *dest, short x, short y, const Color &color ); int Write( const char *str, Surface *dest, short x, short y, const Rect &clip ) const; int WriteEllipsis( const char *str, Surface *dest, short x, short y, const Rect &clip ) const; private: TTF_Font *f; unsigned char width; unsigned char height; Color col; }; #endif /* _INCLUDE_FONT_H */ crimson-0.5.2.orig/src/common/gamedefs.h0000600000175000017500000001174010554366467016327 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // gamedefs.h - general game definitions // This file can be included by both C and C++ code. /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_GAMEDEFS_H #define _INCLUDE_GAMEDEFS_H /* game info flags */ #define GI_SAVEFILE 0x0001 /* for saved games */ #define GI_PBEM 0x0002 /* email game */ #define GI_CAMPAIGN 0x0004 /* campaign map */ #define GI_AI 0x0008 /* intended as a single-player map */ #define GI_SKIRMISH 0x0010 /* map is suitable for skirmish play */ #define GI_NETWORK 0x0020 /* network game */ #define GI_GAME_OVER 0x8000 #define TURN_START 0 #define TURN_IN_PROGRESS 1 #define HANDICAP_NONE 0x01 #define HANDICAP_P1 0x02 #define HANDICAP_P2 0x04 #define PLAYER_ONE 0 #define PLAYER_TWO 1 #define PLAYER_NONE 2 #define HUMAN 0 #define COMPUTER 1 /* event types */ #define EVENT_MESSAGE 1 /* just show a message */ #define EVENT_MINING 2 /* set crystals in a building */ #define EVENT_SCORE 3 /* raise the success rate of a player */ #define EVENT_CONFIGURE 4 /* change various internal settings */ #define EVENT_CREATE_UNIT 5 /* create a unit */ #define EVENT_MANIPULATE_EVENT 6 /* set or unset flags for another event */ #define EVENT_RESEARCH 7 /* enable new units in factories */ #define EVENT_SET_HEX 8 /* change a map tile */ #define EVENT_SET_TIMER 9 /* adjust the timer for another event */ #define EVENT_DESTROY_UNIT 10 /* remove unit from board */ /* event triggers */ #define ETRIGGER_TIMER 0 #define ETRIGGER_UNIT_DESTROYED 1 #define ETRIGGER_HAVE_BUILDING 2 #define ETRIGGER_HAVE_UNIT 3 #define ETRIGGER_UNIT_POSITION 4 #define ETRIGGER_HANDICAP 5 #define ETRIGGER_HAVE_CRYSTALS 6 /* event flags */ #define EFLAG_DISABLED 0x0001 #define EFLAG_DISCARDED 0x8000 /* terrain definitions */ #define TT_ROAD 0x0001 #define TT_PLAINS 0x0002 #define TT_FOREST 0x0004 #define TT_SWAMP 0x0008 #define TT_MOUNTAINS 0x0010 #define TT_WATER_SHALLOW 0x0020 #define TT_WATER_DEEP 0x0040 #define TT_BARRICADES 0x0080 #define TT_RAILS 0x0100 #define TT_WATER 0x0200 #define TT_RESTRICTED 0x0400 /* for the default set, this means Infantry and aircraft only */ #define TT_TRENCHES 0x0800 #define TT_ENTRANCE 0x4000 /* entrance to a building */ /* unit definitions */ #define U_GROUND 0x00000001 /* a unit can only have one of U_GROUND, U_SHIP */ #define U_SHIP 0x00000002 /* and U_AIR set; for amphibian units you must */ #define U_AIR 0x00000004 /* always set U_GROUND! */ #define U_CONQUER 0x00000010 /* unit can take over enemy buildings */ #define U_SLOW 0x00000020 /* can only fight OR move on one turn */ #define U_TRANSPORT 0x00000040 /* can carry other units, */ /* note: transporters may NEVER have U_CONQUER set! */ #define U_MINE 0x00000080 /* can be cleared/reused by minesweepers */ #define U_MEDIC 0x00000100 /* can repair other units */ #define U_MINESWEEPER 0x00000400 #define U_FLOATING 0x01000000 /* for units which can move on both land and water */ /* (i.e. U_SHIP|U_GROUND) this flag must be set */ /* when the unit moves on water; always true for ships */ #define U_DUMMY 0x02000000 /* used for units generated for replays */ #define U_BUSY 0x04000000 /* used by computer player */ #define U_DONE 0x08000000 #define U_MOVED 0x10000000 /* unit moved this turn */ #define U_ATTACKED 0x20000000 /* unit initiated combat this turn */ #define U_SHELTERED 0x40000000 /* unit is currently inside a building/transporter */ #define U_DESTROYED 0x80000000 #define UT_NO_SOUND 255 #define MAX_GROUP_SIZE 6 #define XP_MAX_LEVEL 6 #define XP_PER_LEVEL 3 #define MCOST_MIN 1 /* cost to cross a road hex for ground units or any hex type for airborne units */ #define ICON_WIDTH 32 #define ICON_HEIGHT 32 #define XP_ICON_WIDTH 12 #define XP_ICON_HEIGHT 14 #define ICON_XP_BASE 0 // XP icons are 0 through 6 #define NUM_IMAGES 7 /* building definitions */ #define BLD_WORKSHOP 0x0001 /* units can be repaired */ #define BLD_FACTORY 0x0002 /* units can be produced */ #endif /* _INCLUDE_GAMEDEFS_H */ crimson-0.5.2.orig/src/common/gamewindow.cpp0000600000175000017500000002131110554366441017233 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // gamewindow.cpp /////////////////////////////////////////////////////////////////////// #include "gamewindow.h" #include "mapview.h" //////////////////////////////////////////////////////////////////////// // NAME : UnitInfoWindow::UnitInfoWindow // DESCRIPTION: Pop up a window with information about the given unit // type. // PARAMETERS : utype - unit type ID // map - map // view - view the window will be attached to // RETURNS : - //////////////////////////////////////////////////////////////////////// UnitInfoWindow::UnitInfoWindow( unsigned short utype, const Map &map, View *view ) : Window(WIN_CENTER, view), unit(utype), uset(map.GetUnitSet()), tset(map.GetTerrainSet()) { const UnitType *type = uset->GetUnitInfo( utype ); unsigned short width = MAX( sfont->Width() * 24, uset->TileWidth() * 4) + 20, height = uset->TileHeight() + uset->TileShiftY() + ICON_HEIGHT * 2 + sfont->Height() + 30; // don't show portrait on small screens short ptnum = type->Portrait(); if ( (view->Width() < 640) || (view->Height() < 480) ) ptnum = -1; if ( ptnum < 0 ) width = MAX( width, uset->TileWidth() * 7 + 40 ); info.x = info.y = 5; info.w = width - 10; info.h = height - 10; if ( ptnum >= 0 ) { portrait = uset->GetPortrait(ptnum); image.w = portrait->Width() + 2; image.h = portrait->Height() + 2; if ( image.w >= image.h ) { // put image below info area width = MAX( width, image.w + 10 ); height += image.h + 5; image.x = (width - image.w) / 2; image.y = height - 5 - image.h; info.w = width - 10; } else { // draw image right of info area width += image.w + 5; height = MAX( height, image.h + 10 ); image.x = width - image.w - 5; image.y = (height - image.h) / 2; info.h = height - 10; } } else portrait = NULL; SetSize( width, height ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : UnitInfoWindow::Draw // DESCRIPTION: Draw the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void UnitInfoWindow::Draw( void ) { Window::Draw(); DrawUnitInfo( unit, uset, tset, this, info ); if ( portrait ) { DrawBox( image, BOX_RECESSED ); portrait->Blit( this, *portrait, image.x + 1, image.y + 1 ); } } //////////////////////////////////////////////////////////////////////// // NAME : UnitInfoWindow::HandleEvent // DESCRIPTION: Close the window on any button or key pressed. // PARAMETERS : event - event received by the event handler // RETURNS : GUI_CLOSE if the window should be closed, // GUI_OK otherwise //////////////////////////////////////////////////////////////////////// GUI_Status UnitInfoWindow::HandleEvent( const SDL_Event &event ) { if ( (event.type == SDL_KEYDOWN) || (event.type == SDL_MOUSEBUTTONDOWN) ) return GUI_CLOSE; return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : UnitInfoWindow::DrawUnitInfo // DESCRIPTION: Display unit type information. // PARAMETERS : uid - unit ID (may be <0 to clear the rect area) // uset - unit set (may be NULL if uid < 0) // tset - terrain set (may be NULL if uid < 0) // dest - destination window // rect - rectangle in which to display // RETURNS : - //////////////////////////////////////////////////////////////////////// void UnitInfoWindow::DrawUnitInfo( short uid, const UnitSet *uset, const TerrainSet *tset, Window *dest, const Rect &rect ) { const UnitType *type; dest->DrawBox( rect, BOX_CARVED ); if ( (uid < 0) || ((type = uset->GetUnitInfo(uid)) == NULL) ) return; char buf[12]; short xpos, ypos, xspacing, yspacing, terbreak; View *view = dest->GetView(); Font *sfont = dest->SmallFont(); Image speed_icon( view->GetSystemIcons(), 0, 0, ICON_WIDTH, ICON_HEIGHT ); Image def_icon( view->GetSystemIcons(), 32, 0, ICON_WIDTH, ICON_HEIGHT ); Image ground_icon( view->GetSystemIcons(), 64, 0, ICON_WIDTH, ICON_HEIGHT ); Image air_icon( view->GetSystemIcons(), 96, 0, ICON_WIDTH, ICON_HEIGHT ); Image ship_icon( view->GetSystemIcons(), 128, 0, ICON_WIDTH, ICON_HEIGHT ); yspacing = rect.h - tset->TileHeight() - (ICON_HEIGHT + sfont->Width()) * 2; if ( rect.w >= rect.h ) { // draw all terrain on the same level terbreak = 7; } else { // draw two terrain levels terbreak = 4; yspacing -= tset->TileHeight(); } yspacing /= 4; sfont->Write( type->Name(), dest, rect.x + (rect.w - sfont->TextWidth(type->Name())) / 2, rect.y + yspacing, rect ); // show unit specs xspacing = (rect.w - 2 * ICON_WIDTH - 3 * sfont->Width()) / 3; xpos = rect.x + xspacing; ypos = rect.y + sfont->Height() + 2 * yspacing; itoa( type->Speed(), buf ); sfont->Write( buf, dest, xpos + ICON_WIDTH + 4, ypos + (ICON_HEIGHT - sfont->Height())/2 ); speed_icon.Draw( dest, xpos, ypos ); xpos += ICON_WIDTH + xspacing; itoa( type->Armour(), buf ); sfont->Write( buf, dest, xpos + ICON_WIDTH + 4, ypos + (ICON_HEIGHT - sfont->Height())/2 ); def_icon.Draw( dest, xpos, ypos ); // show unit combat strength xspacing = (rect.w - 3 * ICON_WIDTH) / 4; xpos = rect.x + xspacing; ypos += ICON_HEIGHT - 5; ground_icon.Draw( dest, xpos, ypos ); if ( type->Firepower(U_GROUND) == 0 ) strcpy( buf, "-" ); else if ( (type->MinFOF(U_GROUND) == type->MaxFOF(U_GROUND)) && (type->MaxFOF(U_GROUND) <= 1) ) itoa( type->Firepower(U_GROUND), buf ); else sprintf( buf, "%2d (%d-%d)", type->Firepower(U_GROUND), type->MinFOF(U_GROUND), type->MaxFOF(U_GROUND) ); sfont->Write( buf, dest, xpos + (ICON_WIDTH - sfont->TextWidth(buf))/2, ypos + ICON_HEIGHT ); xpos += ICON_WIDTH + xspacing; air_icon.Draw( dest, xpos, ypos ); if ( type->Firepower(U_AIR) == 0 ) strcpy( buf, "-" ); else if ( (type->MinFOF(U_AIR) == type->MaxFOF(U_AIR)) && (type->MaxFOF(U_AIR) <= 1) ) itoa( type->Firepower(U_AIR), buf ); else sprintf( buf, "%2d (%d-%d)", type->Firepower(U_AIR), type->MinFOF(U_AIR), type->MaxFOF(U_AIR) ); sfont->Write( buf, dest, xpos + (ICON_WIDTH - sfont->TextWidth(buf))/2, ypos + ICON_HEIGHT ); xpos += ICON_WIDTH + xspacing; ship_icon.Draw( dest, xpos, ypos ); if ( type->Firepower(U_SHIP) == 0 ) strcpy( buf, "-" ); else if ( (type->MinFOF(U_SHIP) == type->MaxFOF(U_SHIP)) && (type->MaxFOF(U_SHIP) <= 1) ) itoa( type->Firepower(U_SHIP), buf ); else sprintf( buf, "%2d (%d-%d)", type->Firepower(U_SHIP), type->MinFOF(U_SHIP), type->MaxFOF(U_SHIP) ); sfont->Write( buf, dest, xpos + (ICON_WIDTH - sfont->TextWidth(buf))/2, ypos + ICON_HEIGHT ); ypos += ICON_HEIGHT + sfont->Height() + yspacing; // show terrain access Rect terborder( rect.x + 10, ypos, rect.w - 20, rect.h - ypos ); dest->FillRect( terborder.x, terborder.y - yspacing/2, terborder.w, 1, Color(CF_COLOR_SHADOW) ); dest->FillRect( terborder.x, terborder.y + 1 - yspacing/2, terborder.w, 1, Color(CF_COLOR_HIGHLIGHT) ); xpos = terborder.x + (terborder.w - tset->TileWidth() * terbreak) / 2; ypos = terborder.y; for ( int i = 0; i < 7; ++i ) { if ( i == terbreak ) { xpos = terborder.x + (terborder.w - tset->TileWidth() * (7 - terbreak)) / 2; ypos += tset->TileHeight(); } const TerrainType *tt = tset->GetTerrainInfo( tset->GetTerrainClassID(i) ); tset->DrawTile( tt->tt_image, dest, xpos, ypos, rect ); if ( !(type->Terrain() & tt->tt_type) ) tset->DrawTile( IMG_NOT_AVAILABLE, dest, xpos, ypos, rect ); xpos += tset->TileWidth(); } } crimson-0.5.2.orig/src/common/gamewindow.h0000600000175000017500000000322610554366467016715 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // gamewindow.h - gameplay window classes /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_GAMEWINDOW_H #define _INCLUDE_GAMEWINDOW_H #include "window.h" #include "button.h" #include "map.h" // unit type information window class UnitInfoWindow : public Window { public: UnitInfoWindow( unsigned short utype, const Map &map, View *view ); void Draw( void ); GUI_Status HandleEvent( const SDL_Event &event ); static void DrawUnitInfo( short uid, const UnitSet *uset, const TerrainSet *tset, Window *dest, const Rect &rect ); private: Rect image; Rect info; unsigned short unit; const UnitSet *uset; const TerrainSet *tset; Surface *portrait; }; #endif /* _INCLUDE_GAMEWINDOW_H */ crimson-0.5.2.orig/src/common/globals.h0000600000175000017500000000460310727755544016177 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // globals.h - global variable declarations // This file can be included by both C and C++ code. /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_GLOBALS_H #define _INCLUDE_GLOBALS_H /* data paths and files * the symbol VERSION should be defined externally (usually via autoconf) * the symbol CF_DATADIR may be defined externally to define the location * of data files. If it is not defined the program will try to * locate the files at runtime (default for Win32). */ #ifndef VERSION # define VERSION "0.5.2" #endif #define CF_SHORTNAME "crimson" #define CF_DATFILE "cf.dat" #define CF_FONT "Bepa-Roman.ttf" #define CF_FONT_SMALL 12 #define CF_FONT_LARGE 16 /* font sizes for small resolutions */ #define CF_FONT_LOWRES_SMALL 9 #define CF_FONT_LOWRES_LARGE 11 #define CF_MUSIC_THEME "theme" #define CF_MUSIC_DEFAULT "default" #define CF_MUSIC_FADE_TIME 2000 #define FILE_VERSION 13 #define FID_MISSION MakeID('M','S','S','N') /* mission file identifier */ #define DISPLAY_BPP 16 /* display depth */ #define MIN_XRES 240 #define MIN_YRES 240 #if defined PSP || defined V43 # define DEFAULT_RESOLUTION 480,272 #elif defined _WIN32_WCE # define DEFAULT_RESOLUTION 240,320 #else # define DEFAULT_RESOLUTION 800,600 #endif #if defined _WIN32_WCE || defined PSP # define strcasecmp _stricmp # define strncasecmp _strnicmp #else # ifndef HAVE_STRCASECMP # define strcasecmp stricmp # endif # ifndef HAVE_STRNCASECMP # define strncasecmp strnicmp # endif #endif #endif /* _INCLUDE_GLOBALS_H */ crimson-0.5.2.orig/src/common/hexsup.cpp0000600000175000017500000000630710554366433016417 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // hexsup.cpp - classless hex functions //////////////////////////////////////////////////////////////////////// #include "hexsup.h" //////////////////////////////////////////////////////////////////////// // NAME : Distance // DESCRIPTION: Calculate the distance between to hexes in hexes. // PARAMETERS : sx - first hex horizontal position // sy - first hex vertical position // tx - second hex horizontal position // ty - second hex vertical position // RETURNS : number of hexes between s and t //////////////////////////////////////////////////////////////////////// int Distance( short sx, short sy, short tx, short ty ) { int x1 = sy - (sx / 2); int y1 = sy + ((sx + 1) / 2); int x2 = ty - (tx / 2); int y2 = ty + ((tx + 1) / 2); int dx = x2 - x1; int dy = y2 - y1; int dist; if ( SIGN(dx) == SIGN(dy) ) dist = MAX( ABS(dx), ABS(dy) ); else dist = ABS(dx) + ABS(dy); return dist; } int Distance( const Point &s, const Point &t ) { return Distance( s.x, s.y, t.x, t.y ); } //////////////////////////////////////////////////////////////////////// // NAME : Hex2Dir // DESCRIPTION: Get the direction to move in to get to the destination // hex. The destination hex must be adjacent to the source // hex for this function to work properly. // PARAMETERS : src - source hex // dest - destination hex // RETURNS : direction to go //////////////////////////////////////////////////////////////////////// Direction Hex2Dir( const Point &src, const Point &dest ) { if ( dest.x < src.x ) { if ( (dest.y < src.y) || ((dest.y == src.y) && !(dest.x & 1)) ) return NORTHWEST; else return SOUTHWEST; } else if ( dest.x > src.x ) { if ( (dest.y < src.y) || ((dest.y == src.y) && !(dest.x & 1)) ) return NORTHEAST; else return SOUTHEAST; } else { if ( dest.y < src.y ) return NORTH; else return SOUTH; } } //////////////////////////////////////////////////////////////////////// // NAME : NextTo // DESCRIPTION: Find out whether two hexes are adjacent. // PARAMETERS : p1 - first hex // p2 - second hex // RETURNS : TRUE if hexes are adjacent, FALSE if not //////////////////////////////////////////////////////////////////////// bool NextTo( const Point &p1, const Point &p2 ) { return (Distance(p1,p2) == 1); } crimson-0.5.2.orig/src/common/hexsup.h0000600000175000017500000000304110554366467016063 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // hexsup.h - miscellaneous classless hex support functions /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_HEXSUP_H #define _INCLUDE_HEXSUP_H #include "misc.h" enum Direction { NORTH, NORTHEAST, SOUTHEAST, SOUTH, SOUTHWEST, NORTHWEST, WEST, EAST }; #define ReverseDir(dir) ((Direction)((dir + 3) % 6)) #define TurnLeft(dir) ((Direction)((dir + 5) % 6)) #define TurnRight(dir) ((Direction)((dir + 1) % 6)) int Distance( short sx, short sy, short tx, short ty ); int Distance( const Point &s, const Point &t ); Direction Hex2Dir( const Point &src, const Point &dest ); bool NextTo( const Point &p1, const Point &p2 ); #endif /* _INCLUDE_HEXSUP_H */ crimson-0.5.2.orig/src/common/lang.cpp0000600000175000017500000002234510554366441016023 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // lang.cpp //////////////////////////////////////////////////////////////////////// #include #include "lang.h" #include "strutil.h" //////////////////////////////////////////////////////////////////////// // NAME : Language::ReadCatalog // DESCRIPTION: Load the messages for this language from a catalog file. // PARAMETERS : catalog - language catalog file name // RETURNS : number of messages read (>= 0) on success, -1 on error //////////////////////////////////////////////////////////////////////// int Language::ReadCatalog( const char *catalog ) { File file( catalog ); int rc = -1; if ( file.Open( "rb" ) && (file.Read32() == FID_CATALOG) && (file.Read8() == CF_CATALOG_VERSION) ) { unsigned char len = file.Read8(); name = file.ReadS( len ); rc = ReadCatalog( file ); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Language::ReadCatalog // DESCRIPTION: Load the messages for this language from a catalog file. // PARAMETERS : file - language catalog file descriptor // RETURNS : number of messages read (>= 0) on success, -1 on error //////////////////////////////////////////////////////////////////////// int Language::ReadCatalog( MemBuffer &file ) { int rc; // dump old messages cat.clear(); id = file.ReadS( 2 ); // load messages unsigned long msg_len = file.Read32(); char *ptr, *msgs = new char[msg_len]; file.Read( msgs, msg_len ); ptr = msgs; while ( ptr < &msgs[msg_len] ) { string text = StringUtil::crypt( ptr ); AddMsg( text.c_str() ); while ( *ptr != '\0' ) ++ptr; ++ptr; } delete [] msgs; rc = cat.size(); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Language::WriteCatalog // DESCRIPTION: Save the messages for this language to a catalog file. // PARAMETERS : catalog - language catalog file name // RETURNS : number of messages written on success, -1 on error //////////////////////////////////////////////////////////////////////// int Language::WriteCatalog( const char *catalog ) { File file( catalog ); int rc = -1; if ( file.Open( "wb" ) ) { file.Write32( FID_CATALOG ); file.Write8( CF_CATALOG_VERSION ); file.Write8( name.length() ); file.WriteS( name ); rc = WriteCatalog( file ); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Language::WriteCatalog // DESCRIPTION: Save the messages for this language to catalog file. // PARAMETERS : file - language catalog file descriptor // RETURNS : number of messages written on success, -1 on error //////////////////////////////////////////////////////////////////////// int Language::WriteCatalog( MemBuffer &file ) { file.WriteS( id ); // calculate catalog size vector::iterator iter; unsigned long msg_len = 0; for ( iter = cat.begin(); iter != cat.end(); ++iter ) msg_len += (*iter).size() + 1; file.Write32( msg_len ); for ( iter = cat.begin(); iter != cat.end(); ++iter ) { file.WriteS( StringUtil::crypt(*iter) ); file.Write8( '\0' ); } return cat.size(); } //////////////////////////////////////////////////////////////////////// // NAME : Language::GetMsg // DESCRIPTION: Retrieve a specific message from the catalog. // PARAMETERS : msg - message identifier // RETURNS : pointer to translated message if available, NULL // otherwise //////////////////////////////////////////////////////////////////////// const char *Language::GetMsg( short id ) const { if ( (id >= 0) && ((short)cat.size() > id) ) return cat[id].c_str(); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Language::Find // DESCRIPTION: Check whether a given message is already stored. // PARAMETERS : msg - message to look for // RETURNS : message identifier or -1 if message wasn't found //////////////////////////////////////////////////////////////////////// short Language::Find( const string &msg ) const { short id = -1; vector::const_iterator it = find( cat.begin(), cat.end(), msg ); if ( it != cat.end() ) id = distance( cat.begin(), it ); return id; } //////////////////////////////////////////////////////////////////////// // NAME : Locale::Load // DESCRIPTION: Load a number of language catalogs from a file. // PARAMETERS : file - file descriptor // RETURNS : number of languages read (>= 0) on success, -1 on error //////////////////////////////////////////////////////////////////////// int Locale::Load( MemBuffer &file ) { unsigned short langs = file.Read16(); for ( int i = 0; i < langs; ++i ) { Language lang; int rc = lang.ReadCatalog( file ); if ( rc >= 0 ) AddLanguage( lang ); else return -1; } if ( lib.size() == 0 ) return -1; if ( !SetDefaultLanguage( CF_LANG_DEFAULT ) ) { // no english translation found, use something we have SetDefaultLanguage( lib.begin()->first ); } return lib.size(); } //////////////////////////////////////////////////////////////////////// // NAME : Locale::Save // DESCRIPTION: Save a number of language catalogs to a file. // PARAMETERS : file - file descriptor // RETURNS : number of languages written on success, -1 on error //////////////////////////////////////////////////////////////////////// int Locale::Save( MemBuffer &file ) { file.Write16( lib.size() ); for ( map::iterator iter = lib.begin(); iter != lib.end(); ++iter ) { if ( iter->second.WriteCatalog( file ) == -1 ) return -1; } return lib.size(); } //////////////////////////////////////////////////////////////////////// // NAME : Locale::GetLanguage // DESCRIPTION: Get a specific language. // PARAMETERS : id - language identifier // RETURNS : - //////////////////////////////////////////////////////////////////////// const Language *Locale::GetLanguage( const string &id ) const { map::const_iterator it; it = lib.find( id ); return (it != lib.end()) ? &(it->second) : 0; } //////////////////////////////////////////////////////////////////////// // NAME : Locale::SetDefaultLanguage // DESCRIPTION: Set the preferred language. // PARAMETERS : id - language identifier // RETURNS : true if new language set, false on error //////////////////////////////////////////////////////////////////////// bool Locale::SetDefaultLanguage( const string &id ) { const Language *l = GetLanguage( id ); if ( l ) lang = l; return l != 0; } //////////////////////////////////////////////////////////////////////// // NAME : Locale::GetMsg // DESCRIPTION: Retrieve a specific message from the preferred // translation. If the requested message is not available // in the current locale, we fall back to the default // (english, usually). // PARAMETERS : msg - message identifier // RETURNS : pointer to translated message if available, NULL // otherwise //////////////////////////////////////////////////////////////////////// const char *Locale::GetMsg( short msg ) const { const char *text = 0; if ( lang ) { text = lang->GetMsg( msg ); if ( text == 0 ) { // try default const Language *def = GetLanguage( CF_LANG_DEFAULT ); if ( def ) text = def->GetMsg( msg ); } } return text; } //////////////////////////////////////////////////////////////////////// // NAME : Locale::AddLanguage // DESCRIPTION: Add an additional language catalog to the Locale. If it // is the first language to be added, also make it the // default. // PARAMETERS : lang - language to add // RETURNS : - //////////////////////////////////////////////////////////////////////// void Locale::AddLanguage( Language &lang ) { lib[lang.ID()] = lang; if ( this->lang == NULL ) this->lang = &lib[lang.ID()]; } //////////////////////////////////////////////////////////////////////// // NAME : Locale::RemoveLanguage // DESCRIPTION: Remove a language catalog from the Locale. Also adjust // the default language if necessary. // PARAMETERS : lang - language to remove // RETURNS : - //////////////////////////////////////////////////////////////////////// void Locale::RemoveLanguage( Language &lang ) { if ( this->lang && (this->lang->ID() == lang.ID()) ) this->lang = NULL; lib.erase( lang.ID() ); } crimson-0.5.2.orig/src/common/lang.h0000600000175000017500000000473410554366467015502 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // lang.h - simple l10n or i18n support /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_LANG_H #define _INCLUDE_LANG_H #include #include #include #include "fileio.h" #include "misc.h" #include "textbox.h" #define CF_CATALOG_VERSION 1 #define FID_CATALOG MakeID('L','C','A','T') #define CF_LANG_DEFAULT "en" class Language { public: int ReadCatalog( const char *catalog ); int ReadCatalog( MemBuffer &file ); int WriteCatalog( const char *catalog ); int WriteCatalog( MemBuffer &file ); const char *ID( void ) const { return id.c_str(); } const char *Name( void ) const { return name.c_str(); } void SetID( const char *lang ) { id.assign( lang ); } void SetName( const char *lang ) { name.assign( lang ); } void AddMsg( const string &msg ) { cat.push_back( msg ); } void SetMsg( const string &msg, size_t pos ) { cat[pos] = msg; } const char *GetMsg( short id ) const; short Find( const string &msg ) const; unsigned short Size( void ) const { return cat.size(); } private: string id; string name; vector cat; }; class Locale { public: Locale( void ) : lang(0) {} int Load( MemBuffer &file ); int Save( MemBuffer &file ); void AddLanguage( Language &lang ); void RemoveLanguage( Language &lang ); bool SetDefaultLanguage( const string &id ); const Language *GetLanguage( const string &id ) const; const char *GetMsg( short msg ) const; const map &GetLibrary( void ) const { return lib; } private: const Language *lang; map lib; }; #endif /* _INCLUDE_LANG_H */ crimson-0.5.2.orig/src/common/list.cpp0000600000175000017500000001701710554366434016057 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // list.cpp -- contains both List and Node class definitions //////////////////////////////////////////////////////////////////////// #include "list.h" // List class //////////////////////////////////////////////////////////////////////// // NAME : List::List // DESCRIPTION: Initialize the List object. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// List::List( void ) { lh_Head.ln_Prev = 0; lh_Head.ln_Next = &lh_Tail; lh_Tail.ln_Prev = &lh_Head; lh_Tail.ln_Next = 0; } //////////////////////////////////////////////////////////////////////// // NAME : List::Clear // DESCRIPTION: Deallocate all list nodes and the list itself. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void List::Clear( void ) { while ( !IsEmpty() ) delete RemHead(); } //////////////////////////////////////////////////////////////////////// // NAME : List::AddHead // DESCRIPTION: Insert a node at the head of the list. // PARAMETERS : n - node to insert // RETURNS : - //////////////////////////////////////////////////////////////////////// void List::AddHead( Node *n ) { InsertNode( n, &lh_Head ); } //////////////////////////////////////////////////////////////////////// // NAME : List::AddTail // DESCRIPTION: Insert a node at the tail of the list. // PARAMETERS : n - node to insert // RETURNS : - //////////////////////////////////////////////////////////////////////// void List::AddTail( Node *n ) { InsertNode( n, lh_Tail.ln_Prev ); } //////////////////////////////////////////////////////////////////////// // NAME : List::RemHead // DESCRIPTION: Remove the first node from the list. The function does // NOT check whether the list is already empty! // PARAMETERS : - // RETURNS : former head node //////////////////////////////////////////////////////////////////////// Node *List::RemHead( void ) { Node *n = lh_Head.ln_Next; n->Remove(); return n; } //////////////////////////////////////////////////////////////////////// // NAME : List::RemTail // DESCRIPTION: Remove the last node from the list. The function does // NOT check whether the list is already empty! // PARAMETERS : - // RETURNS : former tail node //////////////////////////////////////////////////////////////////////// Node *List::RemTail( void ) { Node *n = lh_Tail.ln_Prev; n->Remove(); return n; } //////////////////////////////////////////////////////////////////////// // NAME : List::NextNode // DESCRIPTION: Get the next node from the list. If the current node is // the list tail, this function will start from the head // again, so it can be used like a circular list. // PARAMETERS : n - current node // RETURNS : next node in circular order or NULL if list is empty //////////////////////////////////////////////////////////////////////// Node *List::NextNode( const Node *n ) const { if ( n == 0 ) return Head(); else if ( IsEmpty() ) return 0; else { Node *next = n->Next(); if ( next ) return next; else return Head(); } } //////////////////////////////////////////////////////////////////////// // NAME : List::InsertNode // DESCRIPTION: Put a new node into the list. // PARAMETERS : n - node to insert // prev - node after which to insert n; if NULL make n the // new list head. // RETURNS : - //////////////////////////////////////////////////////////////////////// void List::InsertNode( Node *const n, Node *prev ) { if ( prev == 0 ) prev = &lh_Head; n->ln_Next = prev->ln_Next; n->ln_Next->ln_Prev = n; n->ln_Prev = prev; prev->ln_Next = n; } //////////////////////////////////////////////////////////////////////// // NAME : List::Head // DESCRIPTION: Get the first node from the list. // PARAMETERS : - // RETURNS : first list node or NULL if list is empty //////////////////////////////////////////////////////////////////////// Node *List::Head( void ) const { if ( IsEmpty() ) return 0; return lh_Head.ln_Next; } //////////////////////////////////////////////////////////////////////// // NAME : List::Tail // DESCRIPTION: Get the last node from the list. // PARAMETERS : - // RETURNS : last list node or NULL if list is empty //////////////////////////////////////////////////////////////////////// Node *List::Tail( void ) const { if ( IsEmpty() ) return 0; return lh_Tail.ln_Prev; } //////////////////////////////////////////////////////////////////////// // NAME : List::GetNode // DESCRIPTION: Get the n-th node from the list. // PARAMETERS : n - position of the node in the list // RETURNS : n-th node or NULL if list contains fewer nodes //////////////////////////////////////////////////////////////////////// Node *List::GetNode( unsigned short n ) const { Node *node = lh_Head.ln_Next; while ( node->ln_Next ) { if ( n == 0 ) return node; --n; node = node->ln_Next; } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : List::CountNodes // DESCRIPTION: Get the number of list items. // PARAMETERS : - // RETURNS : number of nodes in the list //////////////////////////////////////////////////////////////////////// unsigned short List::CountNodes( void ) const { Node *n = lh_Head.ln_Next; unsigned short cnt = 0; while ( n->ln_Next ) { ++cnt; n = n->ln_Next; } return cnt; } // Node class //////////////////////////////////////////////////////////////////////// // NAME : Node::Remove // DESCRIPTION: Remove the node from its list. The function does NOT // check whether the node actually IS in a list. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Node::Remove( void ) { ln_Next->ln_Prev = ln_Prev; ln_Prev->ln_Next = ln_Next; } //////////////////////////////////////////////////////////////////////// // NAME : Node::Next // DESCRIPTION: Get the node following this node. // PARAMETERS : - // RETURNS : next node or NULL if node is last node //////////////////////////////////////////////////////////////////////// Node *Node::Next( void ) const { Node *n = ln_Next; if ( n->ln_Next ) return n; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Node::Prev // DESCRIPTION: Get the node's predecessor in the list. // PARAMETERS : - // RETURNS : previous node or NULL if node is list head //////////////////////////////////////////////////////////////////////// Node *Node::Prev( void ) const { Node *n = ln_Prev; if ( n->ln_Prev ) return n; return 0; } crimson-0.5.2.orig/src/common/list.h0000600000175000017500000000346110554366467015530 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // list.h - List and Node classes /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_LIST_H #define _INCLUDE_LIST_H // class definitions class Node { public: friend class List; Node( void ) {}; virtual ~Node( void ) {}; void Remove( void ); Node *Next( void ) const; Node *Prev( void ) const; private: Node *ln_Next; Node *ln_Prev; }; class List { public: List( void ); ~List( void ) { Clear(); } void Clear( void ); bool IsEmpty( void ) const { return( lh_Tail.ln_Prev == &lh_Head ); } void AddHead( Node *n ); void AddTail( Node *n ); void InsertNode( Node *n, Node *prev ); Node *RemHead( void ); Node *RemTail( void ); Node *Head( void ) const; Node *Tail( void ) const; Node *GetNode( unsigned short n ) const; Node *NextNode( const Node *n ) const; unsigned short CountNodes( void ) const; private: Node lh_Head; Node lh_Tail; }; #endif /* _INCLUDE_LIST_H */ crimson-0.5.2.orig/src/common/listselect.cpp0000600000175000017500000002314710546470335017255 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // listselect.cpp //////////////////////////////////////////////////////////////////////// #include "listselect.h" //////////////////////////////////////////////////////////////////////// // NAME : ListWidget::ListWidget // DESCRIPTION: Create a new list widget. All subclasses of ListWidget // must call ListWidget::Update() when initializing. // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // list - list nodes // selected - node highlighted by default (-1 == none) // flags - widget flags (see widget.h for details) // title - widget title (currently unused) // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// ListWidget::ListWidget( short id, short x, short y, unsigned short w, unsigned short h, List *list, short selected, unsigned short flags, const char *title, Window *window ) : CompositeWidget( id, x, y, w, h, flags, title, window ) { this->list = list; current = selected; listboxw = w; spacing = 2; toprow = 0; } //////////////////////////////////////////////////////////////////////// // NAME : ListWidget::Draw // DESCRIPTION: Draw the list widget. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void ListWidget::Draw( void ) { CompositeWidget::Draw(); PrintTitle( surface->GetFGPen() ); surface->DrawBox( Rect(x,y,listboxw,h), BOX_RECESSED ); DrawNodes(); } //////////////////////////////////////////////////////////////////////// // NAME : ListWidget::Update // DESCRIPTION: Update the internal variables if the list was // modified (added/removed nodes, changed names, or even // put in an entirely different list). // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void ListWidget::Update( void ) { nodes = list->CountNodes(); if ( current >= nodes ) { current = nodes - 1; if ( hook ) hook->WidgetActivated( this, surface ); } rows = ItemHeight() * nodes + 2 * spacing + 2; visrows = h - 2 * spacing - 2; if ( visrows > rows ) { visrows = rows; toprow = 0; } else if ( visrows > rows - toprow ) { toprow = rows - visrows; } else if ( current != -1 ) { short selrow = 1 + spacing + current * ItemHeight(); if ( selrow < toprow ) toprow = selrow; else if ( selrow + ItemHeight() >= toprow + visrows ) toprow = selrow - visrows + ItemHeight(); } SliderWidget *slider = static_cast( GetWidget(0) ); if ( rows > visrows ) { if ( slider ) slider->Adjust( 0, rows - visrows, visrows ); else { // create the corresponding slider widget slider = new SliderWidget( 0, x + w - DEFAULT_SLIDER_SIZE, y, DEFAULT_SLIDER_SIZE, h, 0, rows - visrows, toprow, visrows, WIDGET_VSCROLL | WIDGET_COMPOSITE | (flags & WIDGET_HSCROLLKEY ? 0 : WIDGET_HSCROLLKEY) | (flags & WIDGET_VSCROLLKEY ? 0 : WIDGET_VSCROLLKEY), NULL, surface ); slider->SetHook( this ); listboxw = w - DEFAULT_SLIDER_SIZE; // adjust list box size AddWidget( slider ); } } else if ( slider ) { // delete the slider; we don't need it any more listboxw += slider->Width(); // adjust list box size RemoveWidget( slider ); delete slider; } } //////////////////////////////////////////////////////////////////////// // NAME : ListWidget::SwitchList // DESCRIPTION: Replace the current list by another one to be displayed. // PARAMETERS : newlist - pointer to the list to replace the current // select - number of the node to select initially for the // new list // RETURNS : - //////////////////////////////////////////////////////////////////////// void ListWidget::SwitchList( List *newlist, short select ) { list = newlist; current = select; toprow = 0; Update(); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : ListWidget::Select // DESCRIPTION: Adjust the list view so that the selected item is // visible and highlight it. // PARAMETERS : item - number of the item to select // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status ListWidget::Select( short item ) { if ( item < 0 ) item = -1; else if ( item >= nodes ) item = nodes - 1; if ( item != current ) { short newtop = toprow; current = item; if ( current >= 0 ) { short selrow = current * ItemHeight(); if ( selrow < toprow ) newtop = selrow; else if ( selrow + ItemHeight() >= newtop + visrows ) newtop = selrow - visrows + ItemHeight(); } if ( toprow != newtop ) { static_cast( GetWidget(0) )->ScrollTo( newtop ); } else { DrawNodes(); Show(); } } if ( hook ) return hook->WidgetActivated( this, surface ); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : ListWidget::Set // DESCRIPTION: Adjust the list view so that row is the top row. // PARAMETERS : row - first visible row // RETURNS : - //////////////////////////////////////////////////////////////////////// void ListWidget::Set( short row ) { toprow = row; DrawNodes(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : ListWidget::WidgetActivated // DESCRIPTION: The slider has been moved. Update the widgeti // accordingly. // PARAMETERS : widget - calling widget (slider) // win - window the widget is attached to // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status ListWidget::WidgetActivated( Widget *widget, Window *win ) { if ( widget->ID() == 0 ) Set( static_cast(widget)->Level() ); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : ListWidget::MouseDown // DESCRIPTION: Select a node. // PARAMETERS : button - SDL_MouseButtonEvent received from the event // handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status ListWidget::MouseDown( const SDL_MouseButtonEvent &button ) { SDL_MouseButtonEvent mybutton = button; if ( ((button.button == SDL_BUTTON_WHEELUP) || (button.button == SDL_BUTTON_WHEELDOWN)) && Contains( button.x - surface->LeftEdge(), button.y - surface->TopEdge() ) ) { // reroute all wheel events to the scroller SliderWidget *s = static_cast( GetWidget(0) ); if ( s ) { mybutton.x = s->LeftEdge() + surface->LeftEdge(); mybutton.y = s->TopEdge() + surface->TopEdge(); } } GUI_Status rc = CompositeWidget::MouseDown( mybutton ); if ( (rc == GUI_OK) && (button.button == SDL_BUTTON_LEFT) ) { short mx = button.x - surface->LeftEdge(); short my = button.y - surface->TopEdge(); Rect sensitive( x + 2, y + spacing, listboxw - 4, h - 2 * spacing ); if ( sensitive.Contains( mx, my ) ) { short item = (my - y - spacing - 1 + toprow) / ItemHeight(); if ( (item < nodes) ) return Select( item ); } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : ListWidget::KeyDown // DESCRIPTION: If the widget has WIDGET_[HV]SCROLLKEY set, the user can // shuffle through the items with the cursor keys. // PARAMETERS : key - SDL_keysym received from the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status ListWidget::KeyDown( const SDL_keysym &key ) { GUI_Status rc = CompositeWidget::KeyDown( key ); if ( rc != GUI_OK ) return rc; if ( key.sym == this->key ) rc = Select( current ); else if ( flags & (WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY) ) { switch ( key.sym ) { case SDLK_UP: if ( (current > 0) && (flags & WIDGET_VSCROLLKEY) ) return Select( current - 1 ); case SDLK_LEFT: if ( (current > 0) && (flags & WIDGET_HSCROLLKEY) ) return Select( current - 1 ); break; case SDLK_DOWN: if ( (current < nodes - 1) && (flags & WIDGET_VSCROLLKEY) ) return Select( current + 1 ); case SDLK_RIGHT: if ( (current < nodes - 1) && (flags & WIDGET_HSCROLLKEY) ) return Select( current + 1 ); break; #ifdef _WIN32_WCE case SDLK_RETURN: return Select( current ); #endif default: break; } } return rc; } crimson-0.5.2.orig/src/common/listselect.h0000600000175000017500000000421110554366467016722 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // listselect.h - list widget class /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_LISTSELECT_H #define _INCLUDE_LISTSELECT_H #include "list.h" #include "slider.h" class ListWidget : public CompositeWidget, public WidgetHook { public: ListWidget( short id, short x, short y, unsigned short w, unsigned short h, List *list, short selected, unsigned short flags, const char *title, Window *window ); virtual void Draw( void ); virtual void DrawNodes( void ) = 0; void Update( void ); // call after modifying the list GUI_Status Select( short item ); // highlight a list item void SwitchList( List *newlist, short select ); virtual GUI_Status MouseDown( const SDL_MouseButtonEvent &button ); virtual GUI_Status KeyDown( const SDL_keysym &key ); Node *Selected( void ) const { return list->GetNode(current); } virtual unsigned short ItemHeight( void ) const = 0; protected: virtual GUI_Status WidgetActivated( Widget *widget, Window *win ); virtual void Set( short row ); // make row the top row List *list; unsigned short nodes; short current; // selected node unsigned short rows; unsigned short toprow; unsigned short visrows; short spacing; unsigned short listboxw; }; #endif /* _INCLUDE_LISTSELECT_H */ crimson-0.5.2.orig/src/common/lset.cpp0000600000175000017500000003612510554366434016054 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // lset.cpp -- level set handling //////////////////////////////////////////////////////////////////////// #include "lset.h" #include "fileio.h" #include "misc.h" #define FOG_ALPHA 128 #define IMG_FOG 1 //////////////////////////////////////////////////////////////////////// // NAME : TileSet::Load // DESCRIPTION: Load a tile set from a file. This only reads the image // surface(s) and associated data. // PARAMETERS : file - file descriptor // setname - name of the requested tile set. This is // actually only used when saving a mission to // a file // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int TileSet::Load( MemBuffer &file, const char *setname ) { int rc = tiles.LoadImageData( file, true ); if ( !rc ) { tiles.DisplayFormat(); name.assign( setname ); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : TileSet::DrawTile // DESCRIPTION: Draw a tile image to a surface. // PARAMETERS : n - image number // dest - destination surface // px - horizontal offset on surface // py - vertical offset on surface // clip - clipping rectangle // RETURNS : - //////////////////////////////////////////////////////////////////////// void TileSet::DrawTile( unsigned short n, Surface *dest, short px, short py, const Rect &clip ) const { // set up destination Rect dstrect( px, py, TileWidth(), TileHeight() ); if ( dstrect.x + dstrect.w < clip.x ) return; if ( dstrect.y + dstrect.h < clip.y ) return; if ( dstrect.x >= clip.x + clip.w ) return; if ( dstrect.y >= clip.y + clip.h ) return; // set up source Rect srcrect; unsigned short gfx_per_line = tiles.Width() / TileWidth(); srcrect.x = (n % gfx_per_line) * TileWidth(); srcrect.y = (n / gfx_per_line) * TileHeight(); srcrect.w = dstrect.w; srcrect.h = dstrect.h; // clip and blit to surface dstrect.ClipBlit( srcrect, clip ); tiles.LowerBlit( dest, srcrect, dstrect.x, dstrect.y ); } //////////////////////////////////////////////////////////////////////// // NAME : UnitSet::UnitSet // DESCRIPTION: Initialize a new unit set. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// UnitSet::UnitSet( void ) { num_sfx = 0; ut = NULL; sfx = NULL; portraits = NULL; } //////////////////////////////////////////////////////////////////////// // NAME : UnitSet::~UnitSet // DESCRIPTION: Destroy the currently loaded unit set. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// UnitSet::~UnitSet( void ) { delete [] ut; if ( sfx ) { for ( int i = 0; i < num_sfx; ++i ) delete sfx[i]; delete [] sfx; } delete [] portraits; } //////////////////////////////////////////////////////////////////////// // NAME : UnitSet::GetUnitInfo // DESCRIPTION: Retrieve information about a unit type by its ID. // PARAMETERS : utid - unit type ID // RETURNS : pointer to unit info or NULL if ID is invalid //////////////////////////////////////////////////////////////////////// const UnitType *UnitSet::GetUnitInfo( unsigned short utid ) const { if ( utid < num_tiles ) return &ut[utid]; return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : UnitSet::GetSound // DESCRIPTION: Get a sound effect by its ID. // PARAMETERS : sfxid - effect ID // RETURNS : pointer to effect or NULL if ID is invalid //////////////////////////////////////////////////////////////////////// SoundEffect *UnitSet::GetSound( unsigned short sfxid ) const { if ( sfxid < num_sfx ) return sfx[sfxid]; return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : UnitSet::Load // DESCRIPTION: Load a unit set from a file. // PARAMETERS : file - file descriptor // setname - name of the requested unit set. This is // actually only used when saving a mission to // a file // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int UnitSet::Load( MemBuffer &file, const char *setname ) { int rc = -1; if ( file.Read32() == FID_UNITSET ) { num_tiles = file.Read16(); num_sfx = file.Read8(); if ( !LoadSfx( file ) && !LoadUnitTypes( file ) && !TileSet::Load( file, setname ) ) { unsigned char num_portraits = file.Read8(); if ( num_portraits ) { portraits = new Surface [num_portraits]; for ( int i = 0; i < num_portraits; ++i ) { if ( portraits[i].LoadImageData( file ) ) return -1; portraits[i].DisplayFormat(); } } rc = 0; } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : UnitSet::LoadUnitTypes // DESCRIPTION: Load unit type definitions from a unit set file. // PARAMETERS : file - descriptor of the unit set file // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int UnitSet::LoadUnitTypes( MemBuffer &file ) { ut = new UnitType [num_tiles]; if ( !ut ) return -1; int rc = 0; for ( int i = 0; i < num_tiles; ++i ) { if ( ut[i].Load( file, this ) ) { rc = -1; break; } } // load unit names in different languages if ( rc == 0 ) rc = unit_names.Load( file ); if ( rc == -1 ) { delete [] ut; ut = NULL; num_tiles = 0; return -1; } SetLocale( CF_LANG_DEFAULT ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : UnitSet::LoadSfx // DESCRIPTION: Load unit sound effects from a unit set file. // PARAMETERS : file - descriptor of the unit set file // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int UnitSet::LoadSfx( MemBuffer &file ) { if ( num_sfx ) { string sfxd( get_sfx_dir() ), sfxname; unsigned char len; sfx = new SoundEffect * [num_sfx]; if ( !sfx ) return -1; for ( int i = 0; i < num_sfx; ++i ) { len = file.Read8(); sfxname = file.ReadS( len ); sfx[i] = new SoundEffect( (sfxd + sfxname).c_str() ); } } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : UnitSet::SetLocale // DESCRIPTION: Set the language to use. // PARAMETERS : lang - locale identifier // RETURNS : - //////////////////////////////////////////////////////////////////////// void UnitSet::SetLocale( const string &lang ) { unit_names.SetDefaultLanguage( lang ); for ( int i = 0; i < num_tiles; ++i ) ut[i].SetName( unit_names.GetMsg( i ) ); } //////////////////////////////////////////////////////////////////////// // NAME : TerrainType::Load // DESCRIPTION: Load a terrain type definition from a file. // PARAMETERS : file - file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int TerrainType::Load( MemBuffer &file ) { tt_type = file.Read16(); tt_image = file.Read16(); tt_att_mod = file.Read8(); tt_def_mod = file.Read8(); tt_move = file.Read8(); tt_color = file.Read32(); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : TerrainSet::~TerrainSet // DESCRIPTION: Destroy the currently loaded terrain set. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// TerrainSet::~TerrainSet( void ) { delete [] tt; } //////////////////////////////////////////////////////////////////////// // NAME : TerrainSet::Load // DESCRIPTION: Load a terrain set from a file. // PARAMETERS : file - file descriptor // setname - name of the requested terrain set. This is // actually only used when saving a mission to // a file // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int TerrainSet::Load( MemBuffer &file, const char *setname ) { int rc = -1; if ( file.Read32() == FID_TERRAINSET ) { num_tiles = file.Read16(); for ( int i = 0; i < 10; ++i ) classid[i] = file.Read16(); if ( !LoadTerrainTypes( file ) && !TileSet::Load( file, setname ) ) // create the fog surface. This is kept separate from the tiles // surface so that we don't need to modify the alpha value each // time we want fog fog.Create( TileWidth(), TileHeight(), 16, SDL_SWSURFACE ); fog.SetAlpha( FOG_ALPHA, SDL_SRCALPHA ); fog.SetColorKey( Color(CF_COLOR_WHITE) ); fog.DisplayFormat(); fog.Flood( Color(CF_COLOR_WHITE) ); DrawTile( IMG_FOG, &fog, 0, 0, fog ); rc = 0; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : TerrainSet::GetTerrainInfo // DESCRIPTION: Retrieve information about a terrain type by its ID. // PARAMETERS : ttid - terrain type ID // RETURNS : pointer to terrain info or NULL if ID is invalid //////////////////////////////////////////////////////////////////////// const TerrainType *TerrainSet::GetTerrainInfo( unsigned short ttid ) const { if ( ttid < num_tiles ) return &tt[ttid]; return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : TerrainSet::LoadTerrainTypes // DESCRIPTION: Load terrain type definitions from a terrain set file. // PARAMETERS : file - descriptor of the terrain set file // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int TerrainSet::LoadTerrainTypes( MemBuffer &file ) { tt = new TerrainType [num_tiles]; if ( !tt ) return -1; for ( int i = 0; i < num_tiles; ++i ) { if ( tt[i].Load( file ) ) { delete [] tt; tt = NULL; num_tiles = 0; return -1; } } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : TerrainSet::DrawFog // DESCRIPTION: Draw the fog hex to a surface. // PARAMETERS : dest - destination surface // px - horizontal offset on surface // py - vertical offset on surface // clip - clipping rectangle // RETURNS : - //////////////////////////////////////////////////////////////////////// void TerrainSet::DrawFog( Surface *dest, short px, short py, const Rect &clip ) const { fog.Blit( dest, fog, px, py ); } //////////////////////////////////////////////////////////////////////// // NAME : UnitType::Load // DESCRIPTION: Load a unit type definition from a file. // PARAMETERS : file - data source descriptor // set - level set // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int UnitType::Load( MemBuffer &file, const UnitSet *set ) { ut_snd_move = ut_snd_fire = NULL; ut_terrain = file.Read16(); ut_image = file.Read16(); ut_flags = file.Read16(); file.Read( &ut_moves, 13 ); // set sound effects unsigned char sfx[2]; sfx[0] = file.Read8(); sfx[1] = file.Read8(); if ( sfx[0] != UT_NO_SOUND ) ut_snd_move = set->GetSound( sfx[0] ); if ( sfx[1] != UT_NO_SOUND ) ut_snd_fire = set->GetSound( sfx[1] ); file.Read( &ut_trans_slots, 5 ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : UnitType::Firepower // DESCRIPTION: Get firepower of this unit type against a specific // target unit class. // PARAMETERS : target_type - target class (U_*) // RETURNS : firepower //////////////////////////////////////////////////////////////////////// unsigned char UnitType::Firepower( unsigned long target_type ) const { unsigned char fp = 0; if ( target_type == U_GROUND ) fp = ut_pow_ground; else if ( target_type == U_SHIP ) fp = ut_pow_ship; else if ( target_type == U_AIR ) fp = ut_pow_air; return fp; } //////////////////////////////////////////////////////////////////////// // NAME : UnitType::IsInFOF // DESCRIPTION: Check whether a unit of a certain class at a given // distance is still in the field of fire. // PARAMETERS : dist - distance to target // target_type - target unit class (U_*) // RETURNS : TRUE if unit is in FOF, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool UnitType::IsInFOF( unsigned short dist, unsigned long target_type ) const { if ( target_type == U_GROUND ) return ( (ut_min_range_ground <= dist) && (ut_max_range_ground >= dist) ); else if ( target_type == U_SHIP ) return ( (ut_min_range_ship <= dist) && (ut_max_range_ship >= dist) ); else if ( target_type == U_AIR ) return ( (ut_min_range_air <= dist) && (ut_max_range_air >= dist) ); return false; } //////////////////////////////////////////////////////////////////////// // NAME : UnitType::MaxFOF // DESCRIPTION: Get maximum weapon range against a specific unit class. // PARAMETERS : target_type - target class (U_*) // RETURNS : maximum weapon range //////////////////////////////////////////////////////////////////////// unsigned char UnitType::MaxFOF( unsigned long target_type ) const { unsigned char range = 0; if ( target_type == U_GROUND ) range = ut_max_range_ground; else if ( target_type == U_SHIP ) range = ut_max_range_ship; else if ( target_type == U_AIR ) range = ut_max_range_air; return range; } //////////////////////////////////////////////////////////////////////// // NAME : UnitType::MinFOF // DESCRIPTION: Get minimum weapon range against a specific unit class. // PARAMETERS : target_type - target class (U_*) // RETURNS : minimum weapon range //////////////////////////////////////////////////////////////////////// unsigned char UnitType::MinFOF( unsigned long target_type ) const { unsigned char range = 1; if ( target_type == U_GROUND ) range = ut_min_range_ground; else if ( target_type == U_SHIP ) range = ut_min_range_ship; else if ( target_type == U_AIR ) range = ut_min_range_air; return range; } crimson-0.5.2.orig/src/common/lset.h0000600000175000017500000001444710554366467015532 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ///////////////////////////////////////////////////////////////////////// // lset.h - level set handling // A level set contains the definitions of terrain and unit types as // well as the corresponding graphics and sound data. ///////////////////////////////////////////////////////////////////////// #ifndef _INCLUDE_LSET_H #define _INCLUDE_LSET_H #include #include "gamedefs.h" #include "sound.h" #include "surface.h" #include "lang.h" #define FID_UNITSET MakeID('U','S','E','T') #define FID_TERRAINSET MakeID('T','S','E','T') // terrain type definitions class TerrainType { public: int Load( MemBuffer &file ); unsigned short tt_type; // one (or more) of the TT_ defined above unsigned short tt_image; signed char tt_att_mod; // attack modifier (-20% to +20%) signed char tt_def_mod; // defence modifier (-20% to +20%) signed char tt_move; // cost to cross hex type char reserved; unsigned long tt_color; // color shown on the overview map display }; class UnitSet; class UnitType { public: UnitType( void ) {} int Load( MemBuffer &file, const UnitSet *set ); void SetName( const char *name ) { ut_name = name; } unsigned short Terrain( void ) const { return ut_terrain; } unsigned short Image( void ) const { return ut_image; } unsigned short Flags( void ) const { return ut_flags; } unsigned char Speed( void ) const { return ut_moves; } unsigned char Weight( void ) const { return ut_weight; } unsigned char Armour( void ) const { return ut_defence; } unsigned char Firepower( unsigned long target_type ) const; bool IsInFOF( unsigned short dist, unsigned long target_type ) const; unsigned char MaxFOF( unsigned long target_type ) const; unsigned char MinFOF( unsigned long target_type ) const; unsigned char Cost( void ) const { return ut_build; } unsigned char Slots( void ) const { return ut_trans_slots; } unsigned char MinWeight( void ) const { return ut_trans_min_weight; } unsigned char MaxWeight( void ) const { return ut_trans_max_weight; } const char *Name( void ) const { return ut_name; } SoundEffect *MoveSound( void ) const { return ut_snd_move; } SoundEffect *FireSound( void ) const { return ut_snd_fire; } unsigned char ID( void ) const { return ut_typeid; } signed char Portrait( void ) const { return ut_portrait; } protected: unsigned short ut_terrain; // wherever it may roam... unsigned short ut_image; unsigned short ut_flags; unsigned char ut_moves; unsigned char ut_weight; // used by transports unsigned char ut_defence; // defensive strength unsigned char ut_pow_ground; // offensive strengths unsigned char ut_pow_ship; unsigned char ut_pow_air; unsigned char ut_min_range_ground; unsigned char ut_max_range_ground; unsigned char ut_min_range_ship; unsigned char ut_max_range_ship; unsigned char ut_min_range_air; unsigned char ut_max_range_air; unsigned char ut_build; // resources needed to build this unit type unsigned char ut_trans_slots; // max number of units the transport can carry unsigned char ut_trans_min_weight; // min weight of units the transport can carry unsigned char ut_trans_max_weight; // max weight of units the transport can carry unsigned char ut_typeid; signed char ut_portrait; // portrait gfx index SoundEffect *ut_snd_move; SoundEffect *ut_snd_fire; const char *ut_name; }; #define DEFAULT_TILE_WIDTH 32 #define DEFAULT_TILE_HEIGHT 28 // generic set of images class TileSet { public: TileSet( void ) : num_tiles(0) {} virtual ~TileSet( void ) {} virtual int Load( MemBuffer &file, const char *setname ); unsigned short TileWidth( void ) const { return DEFAULT_TILE_WIDTH; } unsigned short TileHeight( void ) const { return DEFAULT_TILE_HEIGHT; } unsigned short TileShiftX( void ) const { return 9; } unsigned short TileShiftY( void ) const { return 14; } void DrawTile( unsigned short n, Surface *dest, short px, short py, const Rect &clip ) const; const string &GetName( void ) const { return name; } unsigned short NumTiles( void ) const { return num_tiles; } protected: unsigned short num_tiles; Surface tiles; string name; }; class UnitSet : public TileSet { public: UnitSet( void ); ~UnitSet( void ); int Load( MemBuffer &file, const char *setname ); const UnitType *GetUnitInfo( unsigned short utid ) const; SoundEffect *GetSound( unsigned short sfxid ) const; Surface *GetPortrait( unsigned char ptid ) const { return &portraits[ptid]; } const char *UnitName( unsigned short utid ) const { return unit_names.GetMsg( utid ); } void SetLocale( const string &lang ); protected: int LoadUnitTypes( MemBuffer &file ); int LoadSfx( MemBuffer &file ); unsigned short num_sfx; UnitType *ut; SoundEffect **sfx; Surface *portraits; Locale unit_names; }; class TerrainSet : public TileSet { public: TerrainSet( void ) : tt(0) {} ~TerrainSet( void ); int Load( MemBuffer &file, const char *setname ); unsigned short GetTerrainClassID( unsigned char num ) const { return classid[num]; } const TerrainType *GetTerrainInfo( unsigned short ttid ) const; void DrawFog( Surface *dest, short px, short py, const Rect &clip ) const; const Surface &HexMask( void ) const { return fog; } protected: int LoadTerrainTypes( MemBuffer &file ); TerrainType *tt; Surface fog; unsigned short classid[10]; // IDs of the 10 most important terrain classes; // determines which images are shown in unit info dialog }; #endif /* _INCLUDE_LSET_H */ crimson-0.5.2.orig/src/common/mapview.cpp0000600000175000017500000004464010554366435016557 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // mapview.cpp //////////////////////////////////////////////////////////////////////// #include "mapview.h" //////////////////////////////////////////////////////////////////////// // NAME : MapView::MapView // DESCRIPTION: Partly set up a map viewport. To be usable, SetMap() and // Enable() must be called afterwards. // PARAMETERS : display - surface on which to display the map // bounds - viewport position and size on surface // flags - viewport flags (see mapview.h for details) // RETURNS : - //////////////////////////////////////////////////////////////////////// MapView::MapView( Surface *display, const Rect &bounds, unsigned short flags ) : Rect( bounds ) { surface = display; map = NULL; shader_map = NULL; SetFlags( flags ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::InitOffsets // DESCRIPTION: Set offsets for map display and scrolling. Call after // having set a new map for the viewport. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapView::InitOffsets( void ) { maxx = MAX( 0, map->Width() * (TileWidth() - TileShiftX()) + TileShiftX() - w ); maxy = MAX( 0, map->Height() * TileHeight() + TileShiftY() - h ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::Resize // DESCRIPTION: Set a new viewport size and position. // PARAMETERS : bounds - new viewport size and position // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapView::Resize( const Rect &bounds ) { x = bounds.x; y = bounds.y; w = bounds.w; h = bounds.h; InitOffsets(); if ( curx > maxx ) curx = maxx; if ( cury > maxy ) cury = maxy; if ( HexVisible( cursor ) ) Draw(); else CenterOnHex( cursor ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::SetMap // DESCRIPTION: Assign another map to this viewport. // PARAMETERS : map - map to display; the map must have already had // a level set assigned // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapView::SetMap( Map *map ) { if ( shader_map ) delete [] shader_map; cursor = Point( -1, -1 ); cursor_image = IMG_CURSOR_IDLE; this->map = map; InitOffsets(); shader_map = new signed char [map->Width() * map->Height()]; } //////////////////////////////////////////////////////////////////////// // NAME : MapView::Enable // DESCRIPTION: Set map offsets back to 0 and enable map display. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapView::Enable( void ) { curx = cury = 0; UnsetFlags( MV_DISABLE ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::Disable // DESCRIPTION: Hide the actual map and display just blackness. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapView::Disable( void ) { SetFlags( MV_DISABLE ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::Draw // DESCRIPTION: Draw a part of the map onto the window surface. // PARAMETERS : x - of the viewport (!) area to update // y - of the viewport area to update // w - width of the update area // h - height of the update area // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapView::Draw( short x, short y, unsigned short w, unsigned short h ) const { surface->FillRect( *this, Color(CF_COLOR_SHADOW) ); if ( Enabled() ) { DrawMap( curx + x, cury + y, w, h, surface, x + this->x, y + this->y ); } } //////////////////////////////////////////////////////////////////////// // NAME : MapView::DrawMap // DESCRIPTION: Draw a part of the map onto a surface. // PARAMETERS : x - leftmost pixel of the map (!) to paint // y - topmost pixel to paint // w - width of the map part to draw // h - height of the map part // dest - destination surface // dx - where to start drawing on the surface // dy - where to start drawing vertically // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapView::DrawMap( short x, short y, unsigned short w, unsigned short h, Surface *dest, short dx, short dy ) const { int hx1 = MinXHex( x ); int hy1 = MinYHex( y ); int hx2 = MaxXHex( x, w ); int hy2 = MaxYHex( y, h ); Rect clip( dx, dy, w, h ); int sx, sy, tx, ty, yoff; Point hex; for ( tx = hx1; tx <= hx2; ++tx ) { sx = tx * (TileWidth() - TileShiftX()) - x + this->x; if ( tx & 1 ) yoff = TileShiftY() - y; else yoff = -y; yoff += this->y; for ( ty = hy1; ty <= hy2; ++ty ) { sy = ty * TileHeight() + yoff; hex = Point( tx, ty ); // draw the terrain image DrawTerrain( map->HexImage( hex ), dest, sx, sy, clip ); // draw unit if ( Unit *u = map->GetUnit( hex ) ) { DrawUnit( u->Image(), dest, sx, sy, clip ); if ( !u->IsReady() ) DrawTerrain( IMG_NOT_AVAILABLE, dest, sx, sy, clip ); // draw unit health if ( UnitStatsEnabled() ) DrawUnitHealth( u->GroupSize(), dest, sx, sy, clip ); } // draw fog if ( FogEnabled() && (shader_map[map->Hex2Index(hex)] == -1) ) DrawFog( dest, sx, sy, clip ); // draw cursor if ( CursorEnabled() && (hex == cursor) ) DrawTerrain( cursor_image, dest, sx, sy, clip ); } } } //////////////////////////////////////////////////////////////////////// // NAME : MapView::Pixel2Hex // DESCRIPTION: Convert viewport coordinates to hex coordinates. // PARAMETERS : px - pixel x relative to viewport border // py - pixel y relative to viewport border // hex - buffer to hold the resulting hex // RETURNS : 0 on success, -1 on error (invalid pixels); // hex will contain -1, -1 then //////////////////////////////////////////////////////////////////////// int MapView::Pixel2Hex( short px, short py, Point &hex ) const { if ( Contains( px, py ) ) { short hx = px + curx - x, hy = py + cury - y; hex.x = hx / (TileWidth() - TileShiftX()); hex.y = (hy + (hex.x & 1) * TileShiftY()) / TileHeight() - (hex.x & 1); // calculate pixel position relative to selected hex hx %= TileWidth() - TileShiftX(); hy -= hex.y * TileHeight() + (hex.x & 1) * TileShiftY(); const Surface &mask = map->GetTerrainSet()->HexMask(); if ( mask.GetPixel( hx, hy ) == mask.GetColorKey() ) { if ( hx < (TileWidth() / 2) ) --hex.x; else ++hex.x; if ( hy < (TileHeight() / 2) ) { if ( hex.x & 1 ) --hex.y; // odd columns } else { if ( !(hex.x & 1) ) ++hex.y; // even columns } } if ( map->Contains( hex ) ) return 0; } hex = Point( -1, -1 ); return -1; } //////////////////////////////////////////////////////////////////////// // NAME : MapView::Hex2Pixel // DESCRIPTION: Get the pixel coordinates (top left edge) of a hex // relative to the display surface offsets. // PARAMETERS : hex - hex coordinates // RETURNS : Point containing the position of the hex in pixels //////////////////////////////////////////////////////////////////////// Point MapView::Hex2Pixel( const Point &hex ) const { return Point( hex.x * (TileWidth() - TileShiftX()) - curx + x, hex.y * TileHeight() + (hex.x & 1) * TileShiftY() - cury + y ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::HexVisible // DESCRIPTION: Check whether a given hex is currently visible in the // map viewport area. // PARAMETERS : hex - hex position // RETURNS : true if hex (or part of it) on screen, false otherwise //////////////////////////////////////////////////////////////////////// bool MapView::HexVisible( const Point &hex ) const { Point p = Hex2Pixel( hex ); // get absolute pixel values return( (p.x >= x) && (p.x <= x + w - TileWidth()) && (p.y >= y) && (p.y <= y + h - TileHeight()) ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::UpdateHex // DESCRIPTION: Redraw a single hex. // PARAMETERS : hex - hex to update // RETURNS : Rect describing the surface area that has been updated // and needs to be refreshed //////////////////////////////////////////////////////////////////////// Rect MapView::UpdateHex( const Point &hex ) { if ( !Enabled() ) return Rect(0,0,0,0); Point p = Hex2Pixel( hex ); // get absolute position Rect clip( p.x, p.y, TileWidth(), TileHeight() ); // create clip rect clip.Clip( *this ); // draw the terrain image DrawTerrain( map->HexImage( hex ), surface, p.x, p.y, clip ); // draw unit if ( Unit *u = map->GetUnit( hex ) ) { DrawUnit( u->Image(), surface, p.x, p.y, clip ); if ( !u->IsReady() ) DrawTerrain( IMG_NOT_AVAILABLE, surface, p.x, p.y, clip ); // draw unit health if ( UnitStatsEnabled() ) DrawUnitHealth( u->GroupSize(), surface, p.x, p.y, clip ); } // draw fog if ( FogEnabled() && (shader_map[map->Hex2Index(hex)] == -1) ) DrawFog( surface, p.x, p.y, clip ); // draw cursor if ( CursorEnabled() && (hex == cursor) ) DrawTerrain( cursor_image, surface, p.x, p.y, clip ); return clip; } //////////////////////////////////////////////////////////////////////// // NAME : MapView::DrawUnitHealth // DESCRIPTION: Draw a unit health bar. // PARAMETERS : health - unit health indicator // dest - destination surface // px - horizontal offset on surface // py - vertical offset on surface // clip - clipping rectangle // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapView::DrawUnitHealth( unsigned char health, Surface *dest, short px, short py, const Rect &clip ) const { Color hcol; if ( health >= 5 ) hcol = Color(0x62,0xAA,0x46); // green else if ( health >= 3 ) hcol = Color(0xFE,0xAA,0x04); // yellow else hcol = Color(0xFE,0x26,0x26); // red unsigned short hp = (TileWidth() - 2 * TileShiftX() - 4) / (MAX_GROUP_SIZE + 2); unsigned short barw = hp * MAX_GROUP_SIZE + 2; Rect outer( px + (TileWidth() - barw) / 2, py + TileHeight() - hp - 4, barw, hp + 3 ); Rect inner( outer.x + 1, outer.y + 1, health * hp, hp + 1 ); outer.Clip( clip ); inner.Clip( clip ); dest->FillRect( outer, Color(CF_COLOR_BLACK) ); dest->FillRect( inner, hcol ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::CenterOnHex // DESCRIPTION: Center the display on a given hex if possible. // PARAMETERS : hex - hex position // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapView::CenterOnHex( const Point &hex ) { Point p = Hex2Pixel( hex ); short off = p.x + (TileWidth() - w) / 2 + curx; if ( off > maxx ) curx = maxx; else if ( off < 0 ) curx = 0; else curx = off; off = p.y + (TileHeight() - h) / 2 + cury; if ( off > maxy ) cury = maxy; else if ( off < 0 ) cury = 0; else cury = off; Draw(); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::MinXHex // DESCRIPTION: Get the leftmost visible hex number. // PARAMETERS : x - leftmost pixel. If a value of -1 is given, use the // current viewport settings (curx) to determine the // hex. // RETURNS : leftmost visible hex column //////////////////////////////////////////////////////////////////////// unsigned short MapView::MinXHex( short x ) const { if ( x == -1 ) x = curx; return MAX( (x - TileShiftX()) / (TileWidth() - TileShiftX()), 0 ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::MinYHex // DESCRIPTION: Get the topmost visible hex number. // PARAMETERS : y - topmost pixel. If a value of -1 is given, use the // current viewport settings (cury) to determine the // hex. // RETURNS : topmost visible hex row //////////////////////////////////////////////////////////////////////// unsigned short MapView::MinYHex( short y ) const { if ( y == -1 ) y = cury; return MAX( (y - TileShiftY()) / TileHeight(), 0 ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::MaxXHex // DESCRIPTION: Get the rightmost visible hex number. // PARAMETERS : x - leftmost pixel. If a value of -1 is given, use the // current viewport settings (curx/MapView::Width()) // to determine the hex. // w - display width // RETURNS : rightmost visible hex column //////////////////////////////////////////////////////////////////////// unsigned short MapView::MaxXHex( short x, unsigned short w ) const { if ( x == -1 ) { x = curx; w = Width(); } return MIN( (x + w) / (TileWidth() - TileShiftX()), map->Width() - 1 ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::MaxYHex // DESCRIPTION: Get the lowest visible hex number. // PARAMETERS : y - topmost pixel. If a value of -1 is given, use the // current viewport settings (cury/MapView::Width()) // to determine the hex. // h - display height // RETURNS : lowest visible hex row //////////////////////////////////////////////////////////////////////// unsigned short MapView::MaxYHex( short y, unsigned short h ) const { if ( y == -1 ) { y = cury; h = Height(); } return MIN( (y + h) / TileHeight(), map->Height() - 1 ); } //////////////////////////////////////////////////////////////////////// // NAME : MapView::CheckScroll // DESCRIPTION: Look at the current cursor position and map offsets and // decide whether we need to scroll the display. If so, do // it. // PARAMETERS : - // RETURNS : TRUE if display was scrolled, FALSE otherwise //////////////////////////////////////////////////////////////////////// bool MapView::CheckScroll( void ) { if ( cursor.x == -1 ) return false; Point p = Hex2Pixel( cursor ); if ( (curx > 0) && (p.x <= x + TileWidth()) ) p.x = -w / 2; else if ( (curx < maxx) && (w + x - p.x - TileWidth() <= TileWidth()) ) p.x = w / 2; else p.x = 0; if ( (cury > 0) && (p.y <= y + TileHeight()) ) p.y = -h / 2; else if ( (cury < maxy) && (h + y - p.y - TileHeight() <= TileHeight()) ) p.y = h / 2; else p.y = 0; if ( p.x || p.y ) { Scroll( p.x, p.y ); return true; } return false; } //////////////////////////////////////////////////////////////////////// // NAME : MapView::Scroll // DESCRIPTION: Scroll the currently visible map area. // PARAMETERS : px - pixels to scroll horizontally // py - pixels to scroll vertically // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapView::Scroll( short px, short py ) { if ( curx + px < 0 ) px = -curx; else if ( curx + px > maxx ) px = maxx - curx; curx += px; if ( cury + py < 0 ) py = -cury; else if ( cury + py > maxy ) py = maxy - cury; cury += py; #ifdef CF_SDL_LOCAL_BLIT // right now SDL cannot blit parts of a surface to another // place on the same surface if both areas overlap // calculate dirty rectangles Rect d1( 0, 0, 0, 0 ); // dirty 1 Rect d2( 0, 0, 0, 0 ); // dirty 2 Rect c( 0, 0, w, h ); // copy, still valid if ( px > 0 ) { d1 = Rect( w - px, 0, px, h ); c.x = px; c.w = w - px; } else if ( px < 0 ) { d1 = Rect( 0, 0, -px, h ); c.w = w + px; } if ( py > 0 ) { d2 = Rect( 0, h - py, w, py ); c.y = py; c.h = h - py; } else if ( py < 0 ) { d2 = Rect( 0, 0, w, -py ); c.h = h + py; } // eliminate overlapping parts if ( (d1.w > 0) && (d2.w > 0) ) { if ( d1.x == d2.x ) d2.x += d1.w; d2.w = MAX( 0, d2.w - d1.w ); } // copy valid part to current position if ( c.w && c.h ) Blit( this, c, (c.x == 0) ? -px : 0, (c.y == 0) ? -py : 0 ); // update dirty parts if ( d1.w && d1.h ) Draw( d1.x, d1.y, d1.w, d1.h ); if ( d2.w && d2.h ) Draw( d2.x, d2.y, d2.w, d2.h ); #else Draw(); #endif } //////////////////////////////////////////////////////////////////////// // NAME : MapView::SetCursor // DESCRIPTION: Move the cursor onto another hex or remove it from the // viewport. // PARAMETERS : hex - hex to set the cursor to. A hex of (-1, -1) will // remove the cursor entirely. If the cursor was // disabled and hex denotes a valid hex, this will // reenable the cursor. // RETURNS : Rect describing the surface area that was updated //////////////////////////////////////////////////////////////////////// Rect MapView::SetCursor( const Point &hex ) { Rect update( 0, 0, 0, 0 ); if ( (hex.x == -1) && (hex.y == -1) ) { // remove cursor if ( CursorEnabled() ) { Point old = cursor; cursor = Point( -1, -1 ); // update old cursor position update = UpdateHex( old ); SetFlags(MV_DISABLE_CURSOR); } } else { UnsetFlags(MV_DISABLE_CURSOR); cursor = hex; update = UpdateHex( hex ); if ( FlagSet(MV_AUTOSCROLL) && CheckScroll() ) update = *this; } return update; } crimson-0.5.2.orig/src/common/mapview.h0000600000175000017500000001242510554366467016225 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // mapview.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_MAPVIEW_H #define _INCLUDE_MAPVIEW_H #include "rect.h" #include "map.h" #include "surface.h" // special hex graphics #define IMG_CURSOR_IDLE 4 #define IMG_CURSOR_SELECT 3 #define IMG_CURSOR_ATTACK 5 #define IMG_CURSOR_SPECIAL 7 // e.g. pioneers, depot builders #define IMG_CURSOR_HIGHLIGHT 0 #define IMG_RECESSED_HEX 2 #define IMG_NOT_AVAILABLE 6 #define MV_AUTOSCROLL 0x0001 // autoscroll when cursor reaches edge of viewport #define MV_DISABLE 0x0002 // disable viewport entirely (don't update) #define MV_DISABLE_FOG 0x0004 // don't show fog #define MV_DISABLE_CURSOR 0x0008 // don't show cursor #define MV_ENABLE_UNIT_STATS 0x0010 // overlay units with stats (health, xp) #define MV_DIRTY 0x8000 // must be redrawn class MapView : public Rect { public: MapView( Surface *display, const Rect &bounds, unsigned short flags ); ~MapView( void ) { delete [] shader_map; } void Resize( const Rect &bounds ); void SetMap( Map *map ); Map *GetMap( void ) const { return map; } signed char *GetFogBuffer( void ) const { return shader_map; } void Enable( void ); bool Enabled( void ) const { return !FlagSet(MV_DISABLE); } void Disable( void ); void EnableFog( void ) { UnsetFlags(MV_DISABLE_FOG); } void DisableFog( void ) { SetFlags(MV_DISABLE_FOG); } bool FogEnabled( void ) const { return !FlagSet(MV_DISABLE_FOG); } void EnableCursor( void ) { UnsetFlags(MV_DISABLE_CURSOR); } void DisableCursor( void ) { SetFlags(MV_DISABLE_CURSOR); } bool CursorEnabled( void ) const { return !FlagSet(MV_DISABLE_CURSOR); } void EnableUnitStats( void ) { SetFlags(MV_ENABLE_UNIT_STATS); } void DisableUnitStats( void ) { UnsetFlags(MV_ENABLE_UNIT_STATS); } bool UnitStatsEnabled( void ) const { return FlagSet(MV_ENABLE_UNIT_STATS); } void SetFlags( unsigned short flags ) { this->flags |= flags; } void UnsetFlags( unsigned short flags ) { this->flags &= (~flags); } bool FlagSet( unsigned short flag ) const { return (flags & flag) == flag; } void Draw( void ) const { Draw( 0, 0, w, h ); } void Draw( short x, short y, unsigned short w, unsigned short h ) const; void DrawMap( short x, short y, unsigned short w, unsigned short h, Surface *dest, short dx, short dy ) const; void DrawUnit( unsigned short n, Surface *dest, short px, short py, const Rect &clip ) const { map->GetUnitSet()->DrawTile( n, dest, px, py, clip ); } void DrawTerrain( unsigned short n, Surface *dest, short px, short py, const Rect &clip ) const { map->GetTerrainSet()->DrawTile( n, dest, px, py, clip ); } void DrawFog( Surface *dest, short px, short py, const Rect &clip ) const { map->GetTerrainSet()->DrawFog( dest, px, py, clip ); } void DrawUnitHealth( unsigned char health, Surface *dest, short px, short py, const Rect &clip ) const; int Pixel2Hex( short px, short py, Point &hex ) const; Point Hex2Pixel( const Point &hex ) const; bool HexVisible( const Point &hex ) const; void Scroll( short px, short py ); Point GetOffsets( void ) const { return Point(curx,cury); } Rect UpdateHex( const Point &hex ); void CenterOnHex( const Point &hex ); Rect SetCursor( const Point &hex ); Point Cursor( void ) const { return cursor; } void SetCursorImage( unsigned short cur ) { cursor_image = cur; } unsigned short GetCursorImage( void ) const { return cursor_image; } unsigned short MinXHex( short x ) const; unsigned short MinYHex( short y ) const; unsigned short MaxXHex( short x, unsigned short w ) const; unsigned short MaxYHex( short y, unsigned short h ) const; unsigned short TileWidth( void ) const { return map->GetTerrainSet()->TileWidth(); } unsigned short TileHeight( void ) const { return map->GetTerrainSet()->TileHeight(); } unsigned short TileShiftX( void ) const { return map->GetTerrainSet()->TileShiftX(); } unsigned short TileShiftY( void ) const { return map->GetTerrainSet()->TileShiftY(); } private: void InitOffsets( void ); bool CheckScroll( void ); Point cursor; unsigned short cursor_image; unsigned short curx; // current map offsets unsigned short cury; unsigned short maxx; // maximum map offsets unsigned short maxy; Map *map; Surface *surface; unsigned short flags; signed char *shader_map; }; #endif /* _INCLUDE_MAPVIEW_H */ crimson-0.5.2.orig/src/common/mapwidget.cpp0000600000175000017500000002210610554366434017060 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // mapwidget.cpp //////////////////////////////////////////////////////////////////////// #include "mapwidget.h" #include "globals.h" //////////////////////////////////////////////////////////////////////// // NAME : MapWidget::MapWidget // DESCRIPTION: Create a new map widget. This widget displays a small // image of the current map and allows the player to move // the viewport around in which case any listeners are // notified. // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // flags - widget flags (see widget.h for details) // window - window to add this widget to // RETURNS : - //////////////////////////////////////////////////////////////////////// MapWidget::MapWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, Window *window ) : Widget( id, x, y, w, h, flags, NULL, window ), magnify(0), draw_vp(false) { Surface *icons = window->GetView()->GetSystemIcons(); bumper[0] = Image( icons, 157, 46, 11, 7 ); // up bumper[1] = Image( icons, 157, 53, 11, 7 ); // down bumper[2] = Image( icons, 168, 46, 7, 11 ); // left bumper[3] = Image( icons, 175, 46, 7, 11 ); // right } //////////////////////////////////////////////////////////////////////// // NAME : MapWidget::Draw // DESCRIPTION: Draw the widget to the display surface. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWidget::Draw( void ) { surface->DrawBox( *this, BOX_RECESSED ); if ( magnify != 0 ) { // blit mapbuffer to window surface mapbuffer.Blit( surface, mp, x + 1, y + 1 ); if ( draw_vp ) { // darken the entire map, then light up the visible part surface->FillRectAlpha( Rect(x+1,y+1,w-2,h-2), Color(CF_COLOR_BLACK), 96 ); mapbuffer.Blit( surface, vp, x + 1 + (vp.x - mp.x), y + 1 + (vp.y - mp.y) ); } if ( mp.x > 0 ) bumper[2].Draw( surface, x + 3, y + (h - bumper[2].Height()) / 2 ); if ( mp.x + mp.w < mapbuffer.w ) bumper[3].Draw( surface, x + w - 3 - bumper[3].Width(), y + (h - bumper[3].Height()) / 2 ); if ( mp.y > 0 ) bumper[0].Draw( surface, x + (w - bumper[0].Width()) / 2, y + 3 ); if ( mp.y + mp.h < mapbuffer.h ) bumper[1].Draw( surface, x + (w - bumper[1].Width()) / 2, y + h - 3 - bumper[1].Height() ); } } //////////////////////////////////////////////////////////////////////// // NAME : MapWidget::SetMap // DESCRIPTION: Assign a map to be displayed to the widget. // PARAMETERS : map - map to display (may be NULL) // viewport - visible part of the map in hexes. A box will // be drawn around this area if the viewport is // smaller than the map. // magnify - magnification to use for the small map (> 0) // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWidget::SetMap( const Map *map, const Rect &viewport, unsigned char magnify ) { this->magnify = 0; if ( map ) { mapsize.x = map->Width(); mapsize.y = map->Height(); if ( !mapbuffer.Create( map->Width() * magnify, map->Height() * magnify + magnify/2, DISPLAY_BPP, 0 ) ) { this->magnify = magnify; SetViewPort( viewport ); DrawMap( map ); } } } //////////////////////////////////////////////////////////////////////// // NAME : MapWidget::SetViewPort // DESCRIPTION: Set the visible area. The widget will draw a box around // it if it is smaller than the widget. // PARAMETERS : viewport - visible part of the map in hexes // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWidget::SetViewPort( const Rect &viewport ) { if ( magnify > 0 ) { vp.x = viewport.x * magnify; vp.y = viewport.y * magnify; vp.w = viewport.w * magnify; vp.h = viewport.h * magnify + magnify/2; mp.x = mp.y = 0; mp.w = MIN( w - 2, mapsize.x * magnify ); mp.h = MIN( h - 2, mapsize.y * magnify + magnify/2 ); draw_vp = (mp >= vp); vp.w = MIN( vp.w, mp.w ); vp.h = MIN( vp.h, mp.h ); if ( draw_vp ) { mp.Center( vp ); mp.Align( mapbuffer ); } last_hex.x = viewport.x + viewport.w/2; last_hex.y = viewport.y + viewport.h/2; } } //////////////////////////////////////////////////////////////////////// // NAME : MapWidget::DrawMap // DESCRIPTION: Draw the map into the internal buffer. From there it can // be blitted as often as needed. // PARAMETERS : map - map to draw // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapWidget::DrawMap( const Map *map ) const { Color color; unsigned short index = 0; short yoff; mapbuffer.Flood( Color(CF_COLOR_BACKGROUND) ); for ( int py = 0; py < map->Height(); ++py ) { for ( int px = 0; px < map->Width(); ++px ) { if ( px & 1 ) yoff = magnify / 2; else yoff = 0; MapObject *obj = map->GetMapObject( Point(px, py) ); if ( obj && obj->Owner() ) color = player_col[obj->Owner()->ID()]; else color = Color( map->HexColor( index ) ); ++index; mapbuffer.FillRect( magnify * px, magnify * py + yoff, magnify, magnify, color ); } } } //////////////////////////////////////////////////////////////////////// // NAME : MapWidget::MouseDown // DESCRIPTION: Report the hex the user clicked on to the hook and let // it decide what to do next (probably update the view // port). // PARAMETERS : button - SDL_MouseButtonEvent received from the event // handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status MapWidget::MouseDown( const SDL_MouseButtonEvent &button ) { if ( magnify > 0 ) { short mx = button.x - surface->LeftEdge(); short my = button.y - surface->TopEdge(); Rect mdsp( x + 1, y + 1, w - 2, h - 2 ); if ( mdsp.Contains( mx, my ) ) { if ( button.button == SDL_BUTTON_LEFT ) { last_hex.x = (mx - LeftEdge() - 1 + mp.x) / magnify; last_hex.y = (my - TopEdge() - 1 - (last_hex.x & 1 ? magnify/2 : 0) + mp.y) / magnify; if ( last_hex.y == mapsize.y ) --last_hex.y; if ( hook ) hook->WidgetActivated( this, surface ); } } } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : MapWidget::KeyDown // DESCRIPTION: If WIDGET_[HV]SCROLLKEY were set for the widget, you can // move the view port via the cursor keys. // PARAMETERS : key - SDL_keysym received from the event handler // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status MapWidget::KeyDown( const SDL_keysym &key ) { if ( draw_vp ) { bool call_hook = false; switch ( key.sym ) { case SDLK_LEFT: if ( flags & WIDGET_HSCROLLKEY ) { // make sure we always scroll an even number of columns // to avoid strong vertical drift last_hex.x -= (vp.w / magnify / 2) & 0xFFFE; call_hook = true; } break; case SDLK_RIGHT: if ( flags & WIDGET_HSCROLLKEY ) { last_hex.x += (vp.w / magnify / 2) & 0xFFFE; call_hook = true; } break; case SDLK_UP: if ( flags & WIDGET_VSCROLLKEY ) { last_hex.y -= (vp.h / magnify / 2); call_hook = true; } break; case SDLK_DOWN: if ( flags & WIDGET_VSCROLLKEY ) { last_hex.y += (vp.h / magnify / 2); call_hook = true; } break; default: break; } if ( call_hook ) { if ( last_hex.x < 0 ) last_hex.x = 0; else if ( last_hex.x >= mapsize.x ) last_hex.x = mapsize.x - 1; if ( last_hex.y < 0 ) last_hex.y = 0; else if ( last_hex.y >= mapsize.y ) last_hex.y = mapsize.y - 1; if ( hook ) hook->WidgetActivated( this, surface ); } } return GUI_OK; } crimson-0.5.2.orig/src/common/mapwidget.h0000600000175000017500000000374510554366467016543 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // mapwidget.h - tactical overview map display /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_MAPWIDGET_H #define _INCLUDE_MAPWIDGET_H #include "widget.h" #include "map.h" class MapWidget : public Widget { public: MapWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, Window *window ); void Draw( void ); void SetMap( const Map *map, const Rect &viewport, unsigned char magnify ); void SetPlayerColors( const Color &p1, const Color &p2 ) { player_col[0] = p1; player_col[1] = p2; } void SetViewPort( const Rect &viewport ); const Point &GetLastHex( void ) const { return last_hex; } GUI_Status MouseDown( const SDL_MouseButtonEvent &button ); GUI_Status KeyDown( const SDL_keysym &key ); private: void DrawMap( const Map *map ) const; Surface mapbuffer; unsigned char magnify; Point mapsize; // map width and height Rect vp; Rect mp; bool draw_vp; Point last_hex; // where the user last clicked Color player_col[2]; Image bumper[4]; }; #endif /* _INCLUDE_MAPWIDGET_H */ crimson-0.5.2.orig/src/common/misc.cpp0000600000175000017500000000567710554366435016051 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // misc.cpp - miscellaneous classless functions //////////////////////////////////////////////////////////////////////// #include #include #include "misc.h" //////////////////////////////////////////////////////////////////////// // NAME : random // DESCRIPTION: Create a pseudo-random number between min and max. // PARAMETERS : min - lower end of random numbers // max - high end of random numbers // RETURNS : min <= r <= max //////////////////////////////////////////////////////////////////////// int random( int min, int max ) { return( rand_range( max - min + 1 ) + min ); } //////////////////////////////////////////////////////////////////////// // NAME : rand_range // DESCRIPTION: Create a pseudo-random number between 0 and range. // PARAMETERS : range - range of pseudo-random numbers; // 1 < range <= RAND_MAX+1 // RETURNS : 0 <= r < range //////////////////////////////////////////////////////////////////////// unsigned int rand_range( unsigned int range ) { unsigned int rmax, r, d; d = (RAND_MAX+1U-range) / range + 1; rmax = d * range - 1; // -1 to avoid "overflow to zero" do r = rand(); while (r > rmax); return r/d; } //////////////////////////////////////////////////////////////////////// // NAME : itoa // DESCRIPTION: Convert a decimal number to an ASCII string. // PARAMETERS : n - number to convert // buf - buffer to hold the resulting string; make sure it // is large enough for the string before calling! // RETURNS : pointer to buffer //////////////////////////////////////////////////////////////////////// char *itoa( int n, char *buf ) { bool neg = false; short i = 0, j; char c; if (n < 0) { neg = true; n = -n; } // output number to buffer in reverse order do { buf[i++] = n % 10 + '0'; } while ( (n /= 10) > 0 ); if (neg) buf[i++] = '-'; buf[i--] = '\0'; // turn the string around for (j = 0; j < i; --i, ++j) { c = buf[i]; buf[i] = buf[j]; buf[j] = c; } return buf; } crimson-0.5.2.orig/src/common/misc.h0000600000175000017500000000313010554366467015501 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // misc.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_MISC_H #define _INCLUDE_MISC_H #define MIN(a,b) ((a)<=(b)?(a):(b)) #define MAX(a,b) ((a)>=(b)?(a):(b)) #define ABS(a) ((a)<0?-(a):(a)) #define SIGN(a) ((a)<0?(-1):(1)) #define MakeID(a,b,c,d) ((a)|((b)<<8)|((c)<<16)|((d)<<24)) int random( int min, int max ); unsigned int rand_range( unsigned int range); char *itoa( int n, char *buf ); struct Point { short x; short y; Point( void ) {} Point( short x, short y ) { this->x = x; this->y = y; } bool operator==( const Point &p ) const { return( (x == p.x) && (y == p.y) ); } bool operator!=( const Point &p ) const { return !(*this == p); } }; #endif /* _INCLUDE_MISC_H */ crimson-0.5.2.orig/src/common/rect.cpp0000600000175000017500000001172710554366436016045 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // rect.cpp //////////////////////////////////////////////////////////////////////// #include "rect.h" //////////////////////////////////////////////////////////////////////// // NAME : Rect::Align // DESCRIPTION: This function ensures that the given Rect is placed // inside the boundaries of its parent Rect. If the child // is larger than the parent, this will not work correctly, // of course. // PARAMETERS : parent - the parent Rect // RETURNS : - //////////////////////////////////////////////////////////////////////// void Rect::Align( const Rect &parent ) { if ( x < parent.x ) x = parent.x; else if ( x + w >= parent.x + parent.w ) x = parent.x + parent.w - w; if ( y < parent.y ) y = parent.y; else if ( y + h >= parent.y + parent.h ) y = parent.y + parent.h - h; } //////////////////////////////////////////////////////////////////////// // NAME : Rect::Center // DESCRIPTION: Center the Rect in another rectangle. // PARAMETERS : anchor - the rectangle to center the Rect in // RETURNS : - //////////////////////////////////////////////////////////////////////// void Rect::Center( const Rect &anchor ) { x = anchor.LeftEdge() + (anchor.Width() - w) / 2; y = anchor.TopEdge() + (anchor.Height() - h) / 2; } //////////////////////////////////////////////////////////////////////// // NAME : Rect::Clip // DESCRIPTION: Cut away the parts of the Rect which are outside the // boundaries of the cliping rectangle. // PARAMETERS : clip - clipping rectangle // RETURNS : - //////////////////////////////////////////////////////////////////////// void Rect::Clip( const Rect &clip ) { int delta; // horizontal clip if ( x < clip.x) { delta = clip.x - x; x += delta; if ( delta >= w ) w = 0; else w -= delta; } if ( (x + w) > (clip.x + clip.w) ) { delta = (x + w) - (clip.x + clip.w); if ( delta >= w ) w = 0; else w -= delta; } // vertical clip if ( y < clip.y) { delta = clip.y - y; y += delta; if ( delta >= h) h = 0; else h -= delta; } if ( (y + h) > (clip.y + clip.h) ) { delta = (y + h) - (clip.y + clip.h); if ( delta >= h ) h = 0; else h -= delta; } } //////////////////////////////////////////////////////////////////////// // NAME : Rect::ClipBlit // DESCRIPTION: Do clipping to the Rect and at the same time adjust the // boundaries of a source Rect. This function is used for // clipping before blitting. // PARAMETERS : src - source rectangle // clip - clipping rectangle // RETURNS : - //////////////////////////////////////////////////////////////////////// void Rect::ClipBlit( Rect &src, const Rect &clip ) { int delta; if ( x < clip.x) { delta = clip.x - x; x += delta; src.x += delta; if ( delta >= w ) { w = 0; src.w = 0; } else { w -= delta; src.w -= delta; } } if ( (x + w) > (clip.x + clip.w) ) { delta = (x + w) - (clip.x + clip.w); if ( delta >= w ) { w = 0; src.w = 0; } else { w -= delta; src.w -= delta; } } if ( y < clip.y ) { delta = clip.y - y; y += delta; src.y += delta; if ( delta >= h ) { h = 0; src.h = 0; } else { h -= delta; src.h -= delta; } } if ( (y + h) > (clip.y + clip.h) ) { delta = (y + h) - (clip.y + clip.h); if ( delta >= h ) { h = 0; src.h = 0; } else { h -= delta; src.h -= delta; } } } //////////////////////////////////////////////////////////////////////// // NAME : Rect::Contains // DESCRIPTION: Check whether some coordinates lie inside the boundaries // of the Rect. // PARAMETERS : x - horizontal coordinate // y - vertical coordinate // RETURNS : true if coordinates are contained within the Rect, // false otherwise //////////////////////////////////////////////////////////////////////// bool Rect::Contains( short x, short y ) const { return( (x >= this->x) && (x < (this->x + w)) && (y >= this->y) && (y < (this->y + h)) ); } crimson-0.5.2.orig/src/common/rect.h0000600000175000017500000000332410554366467015510 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // rect.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_RECT_H #define _INCLUDE_RECT_H class Rect { public: Rect( void ) {}; Rect( short x, short y, unsigned short w, unsigned short h ) { this->x = x; this->y = y; this->w = w; this->h = h; } short LeftEdge( void ) const { return x; } short TopEdge( void ) const { return y; } unsigned short Width( void ) const { return w; } unsigned short Height( void ) const { return h; } void Align( const Rect &parent ); void Center( const Rect &anchor ); void Clip( const Rect &clip ); void ClipBlit( Rect &src, const Rect &clip ); bool Contains( short x, short y ) const; bool operator>=( const Rect &r ) const { return (w >= r.w) && (h >= r.h); } short x; short y; unsigned short w; unsigned short h; }; #endif /* _INCLUDE_RECT_H */ crimson-0.5.2.orig/src/common/slider.cpp0000600000175000017500000003017010546545107016356 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ///////////////////////////////////////////////////////////////////////// // slider.cpp //////////////////////////////////////////////////////////////////////// #include "slider.h" #include "misc.h" //////////////////////////////////////////////////////////////////////// // NAME : SliderWidget::SliderWidget // DESCRIPTION: Create a new slider widget. // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // vmin - lowest slider level allowed // vmax - highest slider level allowed // start - default level // ksize - size of the slider knob in items (if the slider // has 10 possible positions and ksize is 2, the // size will be claculated as if there were 12 // levels and two of them were represented by one // slider position, so the knob would take up // 2/12th of the widget size) // flags - widget flags (see widget.h for details) // title - widget title (currently unused) // window - window to add this widget to // RETURNS : - //////////////////////////////////////////////////////////////////////// SliderWidget::SliderWidget( short id, short x, short y, unsigned short w, unsigned short h, short vmin, short vmax, short start, short ksize, unsigned short flags, const char *title, Window *window ) : Widget( id, x, y, w, h, flags, title, window ) { mousehit = false; current = start; keystep = 1; Adjust( vmin, vmax, ksize ); } //////////////////////////////////////////////////////////////////////// // NAME : SliderWidget::Adjust // DESCRIPTION: Set new minimum and maximum slider values. // PARAMETERS : newmin - new minimum level // newmax - new maximum level // newsize - new knob size // RETURNS : - //////////////////////////////////////////////////////////////////////// void SliderWidget::Adjust( short newmin, short newmax, short newsize ) { min_level = newmin; max_level = newmax; size = MAX( newsize, 1 ); if ( current < min_level ) current = min_level; else if ( current > max_level ) current = max_level; short num = max_level - min_level; if ( flags & WIDGET_HSCROLL ) { knob.w = MAX( 2, (w - 2) * size / (size + num) ); knob.h = h - 2; if ( max_level > min_level ) step = (float)(w - 2 - knob.w) / num; else step = 0; knob.x = (short)(x + 1 + (current - min_level) * step + 0.5); knob.y = y + 1; } else { knob.w = w - 2; knob.h = MAX( 2, (h - 2) * size / (size + num) ); if ( max_level > min_level ) step = (float)(h - 2 - knob.h) / num; else step = 0; knob.x = x + 1; knob.y = (short)(y + 1 + (current - min_level) * step + 0.5); } } //////////////////////////////////////////////////////////////////////// // NAME : SliderWidget::Draw // DESCRIPTION: Draw slider widget and knob. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void SliderWidget::Draw( void ) { surface->DrawBack( *this ); surface->DrawBox( *this, BOX_RECESSED ); // draw knob surface->DrawBox( knob, Clicked() ? BOX_RECESSED : BOX_RAISED ); if ( Clicked() ) surface->FillRectAlpha( knob.x+1, knob.y+1, knob.w-2, knob.h-2, Color(CF_COLOR_SHADOW) ); PrintTitle( surface->GetFGPen() ); } //////////////////////////////////////////////////////////////////////// // NAME : SliderWidget::ScrollTo // DESCRIPTION: Set the slider to a new level. // PARAMETERS : level - new slider position // RETURNS : - //////////////////////////////////////////////////////////////////////// void SliderWidget::ScrollTo( short level ) { current = level; if ( current < min_level ) current = min_level; else if ( current > max_level ) current = max_level; if ( flags & WIDGET_HSCROLL ) knob.x = (short)(x + 1 + (current - min_level) * step + 0.5); else knob.y = (short)(y + 1 + (current - min_level) * step + 0.5); if ( hook ) hook->WidgetActivated( this, surface ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : SliderWidget::MouseDown // DESCRIPTION: Depress the slider or move the knob towards the mouse. // PARAMETERS : button - SDL_MouseButtonEvent received from the event // handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status SliderWidget::MouseDown( const SDL_MouseButtonEvent &button ) { short mx = button.x - surface->LeftEdge(); short my = button.y - surface->TopEdge(); if ( Contains( mx, my ) ) { if ( button.button == SDL_BUTTON_LEFT ) { if ( knob.Contains( mx, my ) ) { Push(); mousehit = true; } else { short diff = MAX( 1, size/2 ); if ( flags & WIDGET_HSCROLL ) { if ( mx < knob.x ) ScrollTo( current - diff ); else if ( mx >= (knob.x + knob.w) ) ScrollTo( current + diff ); } else { if ( my < knob.y ) ScrollTo( current - diff ); else if ( my >= (knob.y + knob.h) ) ScrollTo( current + diff ); } } } else if ( button.button == SDL_BUTTON_WHEELUP ) { ScrollTo( current - MAX(1, size/4) ); } else if ( button.button == SDL_BUTTON_WHEELDOWN ) { ScrollTo( current + MAX(1, size/4) ); } } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : SliderWidget::MouseUp // DESCRIPTION: Release the knob. // PARAMETERS : button - SDL_MouseButtonEvent received from the event // handler // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status SliderWidget::MouseUp( const SDL_MouseButtonEvent &button ) { if ( Clicked() && (button.button == SDL_BUTTON_LEFT) ) { Release(); mousehit = false; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : SliderWidget::KeyDown // DESCRIPTION: Depress knob and move slider if correct key was hit. // PARAMETERS : key - SDL_keysym received from the event handler // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status SliderWidget::KeyDown( const SDL_keysym &key ) { if ( key.sym == this->key ) { Push(); if ( key.mod & (KMOD_LSHIFT|KMOD_RSHIFT) ) { if ( current > min_level ) ScrollTo( current - keystep ); } else if ( current < max_level ) ScrollTo( current + keystep ); } else if ( flags & (WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY) ) { switch( key.sym ) { case SDLK_UP: if ( (flags & WIDGET_VSCROLLKEY) && (current > min_level) ) { Push(); ScrollTo( current - keystep ); } break; case SDLK_DOWN: if ( (flags & WIDGET_VSCROLLKEY) && (current < max_level) ) { Push(); ScrollTo( current + keystep ); } break; case SDLK_LEFT: if ( (flags & WIDGET_HSCROLLKEY) && (current > min_level) ) { Push(); ScrollTo( current - keystep ); } break; case SDLK_RIGHT: if ( (flags & WIDGET_HSCROLLKEY) && (current < max_level) ) { Push(); ScrollTo( current + keystep ); } break; default: break; } } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : SliderWidget::KeyUp // DESCRIPTION: Release the knob if necessary. // PARAMETERS : key - SDL_keysym received from the event handler // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status SliderWidget::KeyUp( const SDL_keysym &key ) { if ( Clicked() ) Release(); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : SliderWidget::MouseMove // DESCRIPTION: Drag the knob after the mouse. // PARAMETERS : motion - SDL_MouseMotionEvent from the event handler // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status SliderWidget::MouseMove( const SDL_MouseMotionEvent &motion ) { if ( mousehit ) { if ( max_level != min_level ) { short val; if ( flags & WIDGET_HSCROLL ) { short dx = knob.x + motion.xrel; knob.x = MIN( MAX( x + 1, dx ), x + w - 1 - knob.w ); val = (short)((knob.x - 1 - x + step/2) / step) + min_level; } else { short dy = knob.y + motion.yrel; knob.y = MIN( MAX( y + 1, dy ), y + h - 1 - knob.h ); val = (short)((knob.y - 1 - y + step/2) / step) + min_level; } Draw(); Show(); if ( val != current ) { current = MAX( min_level, MIN( val, max_level ) ); if ( hook ) hook->WidgetActivated( this, surface ); } } } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : ProgressWidget::ProgressWidget // DESCRIPTION: Create a new progress bar. Initially, the new progress // bar will be empty. // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // vmin - value mapped to an empty bar // vmax - value mapped to a completely filled bar // flags - widget flags (see widget.h for details) // title - widget title // window - window to add this widget to // RETURNS : - //////////////////////////////////////////////////////////////////////// ProgressWidget::ProgressWidget( short id, short x, short y, unsigned short w, unsigned short h, short vmin, short vmax, unsigned short flags, const char *title, Window *window ) : Widget( id, x, y, w, h, flags, title, window ), level(0), min_level(vmin), max_level(vmax), col(CF_COLOR_HIGHLIGHT), title_x(0), title_y(0) { if ( title ) { title_x = x + (w - font->TextWidth( title )) / 2; title_y = y + (h - font->Height()) / 2; } } //////////////////////////////////////////////////////////////////////// // NAME : ProgressWidget::SetLevel // DESCRIPTION: Fill the progress bar. // PARAMETERS : lev - level up to which the bar should be filled. Must // be between min and max. min will clear the bar, // max will fill it completely. // RETURNS : - //////////////////////////////////////////////////////////////////////// void ProgressWidget::SetLevel( short lev ) { if ( lev < min_level ) lev = min_level; else if ( lev > max_level ) lev = max_level; level = lev - min_level; Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : ProgressWidget::Draw // DESCRIPTION: Draw the progress bar. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void ProgressWidget::Draw( void ) { surface->DrawBack( *this ); surface->DrawBox( *this, BOX_RECESSED ); if ( !Disabled() && (level > 0) ) { unsigned short levsize = level * (Width() - 2) / (max_level - min_level); surface->FillRectAlpha( x + 1, y + 1, levsize, h - 2, col ); } PrintTitle( title_x, title_y, col ); } crimson-0.5.2.orig/src/common/slider.h0000600000175000017500000000573410554366467016044 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // slider.h - slider widget class /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_SLIDER_H #define _INCLUDE_SLIDER_H #include "widget.h" // mouse wheel events are only available with SDL 1.2.5 or later #ifndef SDL_BUTTON_WHEELUP # define SDL_BUTTON_WHEELUP 4 #endif #ifndef SDL_BUTTON_WHEELDOWN # define SDL_BUTTON_WHEELDOWN 5 #endif #define DEFAULT_SLIDER_SIZE 12 class SliderWidget : public Widget { public: SliderWidget( short id, short x, short y, unsigned short w, unsigned short h, short vmin, short vmax, short start, short ksize, unsigned short flags, const char *title, Window *window ); void Adjust( short newmin, short newmax, short newsize ); virtual void Draw( void ); void ScrollTo( short level ); virtual GUI_Status MouseMove( const SDL_MouseMotionEvent &motion ); virtual GUI_Status MouseDown( const SDL_MouseButtonEvent &button ); virtual GUI_Status MouseUp( const SDL_MouseButtonEvent &button ); virtual GUI_Status KeyDown( const SDL_keysym &key ); virtual GUI_Status KeyUp( const SDL_keysym &key ); short Level( void ) const { return current; } void SetKeyStep( unsigned short step ) { keystep = step; } private: Rect knob; // the slider knob short min_level; short max_level; short current; short size; float step; // number of pixels to move knob per value bool mousehit; // status var used for mouse dragging unsigned short keystep; // level adjustment when scrolling via keys }; class ProgressWidget : public Widget { public: ProgressWidget( short id, short x, short y, unsigned short w, unsigned short h, short vmin, short vmax, unsigned short flags, const char *title, Window *window ); void SetColor( const Color &col ) { this->col = col; } short Level( void ) const { return level + min_level; } void SetLevel( short lev ); void Advance( short diff ) { SetLevel( Level() + diff ); } void Draw( void ); private: unsigned short level; short min_level; short max_level; Color col; short title_x; short title_y; }; #endif /* _INCLUDE_SLIDER_H */ crimson-0.5.2.orig/src/common/sound.cpp0000600000175000017500000002507010554366437016235 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // sound.cpp //////////////////////////////////////////////////////////////////////// #include #include "SDL.h" #include "sound.h" #include "fileio.h" // initialize static variables bool Audio::sfx_state = false; bool Audio::music_state = false; int Audio::sfx_volume; int Audio::music_volume; #ifndef DISABLE_SOUND bool Audio::init_base = false; bool Audio::init_sfx = false; bool Audio::init_music = false; Mix_Music *Audio::music = 0; string Audio::music_name; SoundEffect *Audio::sfx[]; const char *Audio::sfx_files[] = { "error.wav", "clicked.wav", "menu.wav", "ask.wav", "select.wav", "repair.wav" }; #endif //////////////////////////////////////////////////////////////////////// // NAME : Audio::InitBase // DESCRIPTION: Initialize the basic audio structures. // PARAMETERS : - // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// #ifndef DISABLE_SOUND int Audio::InitBase( void ) { int rc = 0; if ( !init_base ) { rc = SDL_InitSubSystem( SDL_INIT_AUDIO ); if ( rc < 0 ) { cerr << "Couldn't initialize audio: " << SDL_GetError() << endl; } else { rc = Mix_OpenAudio( MIX_DEFAULT_FREQUENCY, AUDIO_S16LSB, MIX_DEFAULT_CHANNELS, 1024 ); if ( rc ) ShutdownBase(); else init_base = true; } } return rc; } #endif //////////////////////////////////////////////////////////////////////// // NAME : Audio::InitSfx // DESCRIPTION: Load the sound effects and prepare the audio device if // necessary. // PARAMETERS : state - initial state of sound effects (on/off) // vol - volume (0 to MIX_MAX_VOLUME) // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Audio::InitSfx( bool state, unsigned char vol ) { int rc = 0; #ifndef DISABLE_SOUND sfx_state = state; SetSfxVolume( vol ); if ( sfx_state && !init_sfx ) { if ( !init_base ) rc = InitBase(); if ( init_base ) { string sndd( get_sfx_dir() ); for ( int i = 0; i < NUM_SFX; ++i ) { sfx[i] = new SoundEffect( (sndd + sfx_files[i]).c_str() ); } init_sfx = true; } } #endif return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Audio::InitMusic // DESCRIPTION: Load music and prepare the audio device if necessary. // PARAMETERS : state - initial state of music (on/off) // vol - volume (0 to MIX_MAX_VOLUME) // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Audio::InitMusic( bool state, unsigned char vol ) { int rc = 0; #ifndef DISABLE_SOUND music_state = state; SetMusicVolume( vol ); if ( music_state && !init_music ) { if ( !init_base ) rc = InitBase(); init_music = init_base; } #endif return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Audio::ToggleSfx // DESCRIPTION: Toggle SFX state (on/off). // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Audio::ToggleSfxState( void ) { #ifndef DISABLE_SOUND sfx_state ^= 1; if ( sfx_state ) { if ( !init_sfx ) InitSfx( sfx_state, sfx_volume ); } else if ( init_sfx ) ShutdownSfx(); #endif } //////////////////////////////////////////////////////////////////////// // NAME : Audio::ToggleMusicState // DESCRIPTION: Toggle music state (on/off). // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Audio::ToggleMusicState( void ) { #ifndef DISABLE_SOUND music_state ^= 1; if ( music_state ) { if ( !init_music ) InitMusic( music_state, music_volume ); if ( init_music ) PlayMusic( 0 ); } else ShutdownMusic(); #endif } //////////////////////////////////////////////////////////////////////// // NAME : Audio::PlaySfx // DESCRIPTION: Play a sound effect by its identifier. // PARAMETERS : sfxid - sound effect identifier // flags - see sound.h for details // RETURNS : pointer to the effect played or NULL if no effect played //////////////////////////////////////////////////////////////////////// SoundEffect *Audio::PlaySfx( unsigned short sfxid, unsigned short flags ) { SoundEffect *se = NULL; #ifndef DISABLE_SOUND if ( (sfxid < NUM_SFX) && sfx[sfxid] ) { se = sfx[sfxid]; se->Play( flags ); } #endif return se; } //////////////////////////////////////////////////////////////////////// // NAME : Audio::SetMusicVolume // DESCRIPTION: Set the music volume. // PARAMETERS : vol - new volume // RETURNS : - //////////////////////////////////////////////////////////////////////// void Audio::SetMusicVolume( int vol ) { music_volume = vol; #ifndef DISABLE_SOUND Mix_VolumeMusic( vol ); #endif } //////////////////////////////////////////////////////////////////////// // NAME : Audio::PlayMusic // DESCRIPTION: Play music by its identifier. This method is a noop if // another track is already being played at the moment. // PARAMETERS : track - track name (without .ogg or .mid suffix). If // NULL try to restart the previous track. // RETURNS : - //////////////////////////////////////////////////////////////////////// void Audio::PlayMusic( const char *track ) { #ifndef DISABLE_SOUND if ( track ) music_name = track; if ( music_state ) { // if another track is being faded out, wait for it to end while ( Mix_FadingMusic() == MIX_FADING_OUT ) SDL_Delay( 100 ); if ( !Mix_PlayingMusic() ) { // free previous track Mix_FreeMusic( music ); string file( get_music_dir() + music_name + ".ogg" ); // try ogg version first music = Mix_LoadMUS( file.c_str() ); if ( !music ) { file = get_music_dir() + music_name + ".mid"; music = Mix_LoadMUS( file.c_str() ); } if ( music ) Mix_PlayMusic( music, -1 ); } } #endif } //////////////////////////////////////////////////////////////////////// // NAME : Audio::StopMusic // DESCRIPTION: Stop music, optionally fading it out. // PARAMETERS : ms - fade time in milliseconds // RETURNS : - //////////////////////////////////////////////////////////////////////// void Audio::StopMusic( int ms ) { #ifndef DISABLE_SOUND if ( music_state && Mix_PlayingMusic() ) { if ( ms <= 0 ) Mix_HaltMusic(); else Mix_FadeOutMusic( ms ); } #endif } //////////////////////////////////////////////////////////////////////// // NAME : Audio::ShutdownSfx // DESCRIPTION: Shutdown the SFX subsystem. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Audio::ShutdownSfx( void ) { #ifndef DISABLE_SOUND if ( init_sfx ) { for ( int i = 0; i < NUM_SFX; ++i ) { delete sfx[i]; sfx[i] = NULL; } init_sfx = false; sfx_state = false; } #endif } //////////////////////////////////////////////////////////////////////// // NAME : Audio::ShutdownMusic // DESCRIPTION: Shutdown the music subsystem. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Audio::ShutdownMusic( void ) { #ifndef DISABLE_SOUND Mix_HaltMusic(); Mix_FreeMusic( music ); music = 0; init_music = false; music_state = false; #endif } //////////////////////////////////////////////////////////////////////// // NAME : Audio::ShutdownBase // DESCRIPTION: Shutdown the base audio system. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// #ifndef DISABLE_SOUND void Audio::ShutdownBase( void ) { if ( init_base ) { Mix_CloseAudio(); SDL_QuitSubSystem( SDL_INIT_AUDIO ); init_base = false; } } #endif //////////////////////////////////////////////////////////////////////// // NAME : SoundEffect::SoundEffect // DESCRIPTION: Load a sound effect from a WAVE file. // PARAMETERS : file - name of the WAVE file to load // dev - audio spec of the (already open) audio device // RETURNS : - //////////////////////////////////////////////////////////////////////// SoundEffect::SoundEffect( const char *file ) { #ifndef DISABLE_SOUND channel = -1; if ( !(sample = Mix_LoadWAV( file )) ) { cerr << "Error: Failed to load sfx " << file << " (" << SDL_GetError() << ')' << endl; } #endif } //////////////////////////////////////////////////////////////////////// // NAME : SoundEffect::~SoundEffect // DESCRIPTION: Free the audio data. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// SoundEffect::~SoundEffect( void ) { #ifndef DISABLE_SOUND if ( sample ) Mix_FreeChunk( sample ); #endif } //////////////////////////////////////////////////////////////////////// // NAME : SoundEffect::Play // DESCRIPTION: Play a sound effect. // PARAMETERS : flags - see sound.h for details // RETURNS : - //////////////////////////////////////////////////////////////////////// void SoundEffect::Play( unsigned short flags ) { #ifndef DISABLE_SOUND if ( Audio::GetSfxState() && sample ) { sample->volume = Audio::GetSfxVolume(); channel = Mix_PlayChannel( -1, sample, (flags & Audio::SFX_LOOP ? -1 : 0) ); } #endif } //////////////////////////////////////////////////////////////////////// // NAME : SoundEffect::Stop // DESCRIPTION: Stop playing a sound effect. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void SoundEffect::Stop( void ) { #ifndef DISABLE_SOUND if ( channel >= 0 ) { if ( Mix_Playing( channel ) ) Mix_HaltChannel( channel ); channel = -1; } #endif } crimson-0.5.2.orig/src/common/sound.h0000600000175000017500000000561710554366467015712 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // sound.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_SOUND_H #define _INCLUDE_SOUND_H #ifndef DISABLE_SOUND # include using namespace std; # include "SDL_mixer.h" # define NUM_SFX 6 // system effects; they have nothing to do with // the sounds defined by a mission set #endif #ifndef MIX_MAX_VOLUME # define MIX_MAX_VOLUME 0 #endif class SoundEffect { public: SoundEffect( const char *file ); ~SoundEffect( void ); void Play( unsigned short flags ); void Stop( void ); private: #ifndef DISABLE_SOUND Mix_Chunk *sample; int channel; #endif }; class Audio { public: // sound effect identifiers enum { SND_GUI_ERROR = 0, SND_GUI_PRESSED, SND_GUI_MENU_SHOW, SND_GUI_ASK, SND_GAM_SELECT, SND_GAM_REPAIR }; // flags for PlaySfx() enum { SFX_LOOP = 0x0001 }; static int InitSfx( bool state, unsigned char vol ); static int InitMusic( bool state, unsigned char vol ); static void ShutdownSfx(); static void ShutdownMusic(); static SoundEffect *PlaySfx( unsigned short sfxid, unsigned short flags ); static bool GetSfxState( void ) { return sfx_state; } static void ToggleSfxState( void ); static int GetSfxVolume( void ) { return sfx_volume; } static void SetSfxVolume( int vol ) { sfx_volume = vol; } static void PlayMusic( const char *track ); static void StopMusic( int ms ); static bool GetMusicState( void ) { return music_state; } static void ToggleMusicState( void ); static int GetMusicVolume( void ) { return music_volume; } static void SetMusicVolume( int vol ); private: static bool sfx_state; static int sfx_volume; static bool music_state; static int music_volume; #ifndef DISABLE_SOUND static int InitBase( void ); static void ShutdownBase( void ); static bool init_base; static bool init_sfx; static bool init_music; static SoundEffect *sfx[NUM_SFX]; static const char *sfx_files[NUM_SFX]; static Mix_Music *music; static string music_name; #endif }; #endif /* _INCLUDE_SOUND_H */ crimson-0.5.2.orig/src/common/strutil.cpp0000600000175000017500000001335210554366440016605 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // strutil.cpp - string utilities //////////////////////////////////////////////////////////////////////// #include #include "strutil.h" //////////////////////////////////////////////////////////////////////// // NAME : crypt // DESCRIPTION: Encrypt/decrypt ASCII strings. The "algorithm" is really // simple and designed to prevent users from "accidentally" // browsing through data files with a hex editor. // PARAMETERS : str - string to encrypt or decrypt // RETURNS : encrypted or decrypted string, depending on input //////////////////////////////////////////////////////////////////////// string StringUtil::crypt( const string &str ) { string crypted; for ( string::const_iterator iter = str.begin(); (iter != str.end()) && (*iter != '\0'); ++iter ) crypted += ~(*iter); return crypted; } //////////////////////////////////////////////////////////////////////// // NAME : strprintf // DESCRIPTION: Replace the first occurence of %d in a printf-style // format string with the given input. // PARAMETERS : format - printf-style formatting template // arg - value to insert // RETURNS : formatted string //////////////////////////////////////////////////////////////////////// string StringUtil::strprintf( const string &format, int arg ) { string result( format ); size_t pos = result.find( "%d", 0 ); if ( pos != string::npos ) result.replace( pos, 2, tostring(arg) ); return result; } //////////////////////////////////////////////////////////////////////// // NAME : strprintf // DESCRIPTION: Replace the first occurence of %c in a printf-style // format string with the given input. // PARAMETERS : format - printf-style formatting template // arg - value to insert // RETURNS : formatted string //////////////////////////////////////////////////////////////////////// string StringUtil::strprintf( const string &format, char arg ) { string result( format ); size_t pos = result.find( "%c", 0 ); if ( pos != string::npos ) { char buf[2] = { arg, '\0' }; result.replace( pos, 2, buf ); } return result; } //////////////////////////////////////////////////////////////////////// // NAME : strprintf // DESCRIPTION: Replace the first occurence of %s in a printf-style // format string with the given input. // PARAMETERS : format - printf-style formatting template // arg - value to insert // RETURNS : formatted string //////////////////////////////////////////////////////////////////////// string StringUtil::strprintf( const string &format, const string &arg ) { string result( format ); size_t pos = result.find( "%s", 0 ); if ( pos != string::npos ) result.replace( pos, 2, arg ); return result; } //////////////////////////////////////////////////////////////////////// // NAME : tostring // DESCRIPTION: Convert an integer to a string. // PARAMETERS : number - integer to convert // RETURNS : number as string //////////////////////////////////////////////////////////////////////// string StringUtil::tostring( int number ) { stringstream numstr; numstr << number; return numstr.str(); } //////////////////////////////////////////////////////////////////////// // NAME : utf8chartoascii // DESCRIPTION: Returns lowercase ASCII equivalent of the first // character of the UTF-8 argument string. For example, the // ASCII equivalent of 'Ð', 'Δ' or 'Д' is 'd'. Returns // literal 0 if it can't find the equivalent. // Currently only supports Cyrillic. // PARAMETERS : str - pointer to a UTF-8 string // RETURNS : see description //////////////////////////////////////////////////////////////////////// short StringUtil::utf8chartoascii( const char *str ) { // if the character's last bit is unset it's plain ASCII, // so just return lowercase version of it if ( ((unsigned char)str[0] & 0x80) == 0 ) return (short)tolower( str[0] ); // ASCII equivalents for Unicode range 0400-043F const static char *cir1 = "eedgeziijlntkiudabvgdezzijklmnoprstufhccss\0\0\0ejjabvgdezzijklmnop"; // ASCII equivalents for Unicode range 0440-045F const static char *cir2 = "rstufhccss\0\0\0ejjeedgeziijlntkiud"; // Unicode range 0400-043F translates to UTF-8 D080-D0BF. If the character's // first byte is D0, and the second byte is >= 80 and < C0, return ASCII // equivalent from cir1, with the second byte reduced by 80 if ( (unsigned char)str[0] == 0xD0 ) { if( (str[1] & 0x80) && !(str[1] & 0x40) ) return cir1[str[1] & 0x3F]; } else if( (unsigned char)str[0] == 0xD1 ) { // Similarly, but for range 0440-045F which translates to UTF-8 D180-D19F if ( (str[1] & 0x80) && !(str[1] & 0x20) ) return cir2[str[1] & 0x1F]; } // otherwise, it is an unsupported character, so just return 0 return 0; } crimson-0.5.2.orig/src/common/strutil.h0000600000175000017500000000264110554366467016262 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // strutil.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_STRUTIL_H #define _INCLUDE_STRUTIL_H #include using namespace std; class StringUtil { public: static string crypt( const string &str ); static string strprintf( const string &format, int arg ); static string strprintf( const string &format, char arg ); static string strprintf( const string &format, const string &arg ); static string tostring( int number ); static short utf8chartoascii( const char *str ); }; #endif /* _INCLUDE_STRUTIL_H */ crimson-0.5.2.orig/src/common/surface.cpp0000600000175000017500000004406310554366437016540 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////////// // surface.cpp //////////////////////////////////////////////////////////////////////////// #include "surface.h" #include "globals.h" //////////////////////////////////////////////////////////////////////// // NAME : Surface::~Surface // DESCRIPTION: Free the memory used by this surface. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Surface::~Surface( void ) { if ( s_surface ) SDL_FreeSurface( s_surface ); } //////////////////////////////////////////////////////////////////////// // NAME : Surface::Create // DESCRIPTION: Allocate a buffer for this surface. // PARAMETERS : w - surface width // h - surface height // bpp - bits per pixel // flags - surface flags (see SDL_video.h for details) // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Surface::Create( short w, short h, int bpp, unsigned long flags ) { if ( s_surface ) SDL_FreeSurface( s_surface ); s_surface = SDL_CreateRGBSurface( flags, w, h, bpp, 0, 0, 0, 0 ); if ( s_surface == 0 ) return -1; this->w = s_surface->w; this->h = s_surface->h; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Surface::SetColorKey // DESCRIPTION: Set transparent color for this surface. // PARAMETERS : col - transparent color // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Surface::SetColorKey( const Color &col ) { if ( s_surface == 0 ) return -1; return SDL_SetColorKey( s_surface, SDL_SRCCOLORKEY, MapRGB( col ) ); } //////////////////////////////////////////////////////////////////////// // NAME : Surface::GetColorKey // DESCRIPTION: Get transparent color for this surface. // PARAMETERS : - // RETURNS : transparent color //////////////////////////////////////////////////////////////////////// Color Surface::GetColorKey( void ) const { Uint8 r, g, b; SDL_GetRGB( s_surface->format->colorkey, s_surface->format, &r, &g, &b ); return Color( r, g, b ); } //////////////////////////////////////////////////////////////////////// // NAME : Surface::GetPixel // DESCRIPTION: Read the pixel color at a specified position. // PARAMETERS : x - horiontal pixel position // y - vertical pixel position // RETURNS : pixel color //////////////////////////////////////////////////////////////////////// Color Surface::GetPixel( unsigned short x, unsigned short y ) const { Uint8 r, g, b, bpp = s_surface->format->BytesPerPixel; Uint32 col = 0; { SurfaceLock lck( this ); Uint8 *pixel = ((Uint8 *)s_surface->pixels) + y * s_surface->pitch + x * bpp; switch ( bpp ) { case 1: col = *pixel; break; case 2: col = *((Uint16 *)pixel); break; case 3: if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) col = pixel[0] | (pixel[1] << 8) | (pixel[2] << 16); else col = (pixel[0] << 16) | (pixel[1] << 8) | pixel[2]; break; case 4: col = *((Uint32 *)pixel); break; } } SDL_GetRGB( col, s_surface->format, &r, &g, &b ); return Color( r, g, b ); } //////////////////////////////////////////////////////////////////////// // NAME : Surface::DisplayFormat // DESCRIPTION: Convert surface format to display format. // PARAMETERS : - // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Surface::DisplayFormat( void ) { SDL_Surface *new_s; if ( s_surface == 0 || !SDL_WasInit( SDL_INIT_VIDEO ) ) return -1; if ( (new_s = SDL_DisplayFormat( s_surface )) == 0 ) return -1; SDL_FreeSurface( s_surface ); s_surface = new_s; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Surface::Blit // DESCRIPTION: Blit parts of the surface onto another surface. // PARAMETERS : dest - destination surface // from - source rectangle // dx - left edge of destination rectangle // dy - top edge of destination rectangle // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Surface::Blit( Surface *dest, const Rect &from, short dx, short dy ) const { if ( (s_surface == 0) || (from.w == 0) || (from.h == 0) ) return -1; SDL_Rect src, dst; src.x = from.x; src.y = from.y; src.w = from.w; src.h = from.h; dst.x = dx; dst.y = dy; dst.w = from.w; dst.h = from.h; return SDL_BlitSurface( s_surface, &src, dest->s_surface, &dst ); } //////////////////////////////////////////////////////////////////////// // NAME : Surface::LowerBlit // DESCRIPTION: This function works exactly like Surface::Blit() but it // calls SDL_LowerBlit() instead of SDL_BitSurface(). // SDL_LowerBlit does not clip the blitted area to the // surface, so it's faster, but you must make sure the // blitting area does not extend beyond the surface. // PARAMETERS : dest - destination surface // from - source rectangle // dx - left edge of destination rectangle // dy - top edge of destination rectangle // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Surface::LowerBlit( Surface *dest, const Rect &from, short dx, short dy ) const { if ( s_surface == 0 ) return -1; SDL_Rect src, dst; src.x = from.x; src.y = from.y; src.w = from.w; src.h = from.h; dst.x = dx; dst.y = dy; dst.w = from.w; dst.h = from.h; return SDL_LowerBlit( s_surface, &src, dest->s_surface, &dst ); } //////////////////////////////////////////////////////////////////////// // NAME : Surface::SetClipRect // DESCRIPTION: Set the clipping rectangle for the surface. // PARAMETERS : clip - clipping rectangle // RETURNS : - //////////////////////////////////////////////////////////////////////// void Surface::SetClipRect( const Rect &clip ) const { SDL_Rect rect; rect.x = clip.LeftEdge(); rect.y = clip.TopEdge(); rect.w = clip.Width(); rect.h = clip.Height(); SDL_SetClipRect( s_surface, &rect ); } //////////////////////////////////////////////////////////////////////// // NAME : Surface::GetClipRect // DESCRIPTION: Get the current clipping rectangle for the surface. // PARAMETERS : clip - rect to hold the current clipping rectangle // RETURNS : - //////////////////////////////////////////////////////////////////////// void Surface::GetClipRect( Rect &clip ) const { SDL_Rect rect; SDL_GetClipRect( s_surface, &rect ); clip = Rect( rect.x, rect.y, rect.w, rect.h ); } //////////////////////////////////////////////////////////////////////// // NAME : Surface::FillRect // DESCRIPTION: Draw a solid rectangle. // PARAMETERS : x - left edge of rectangle // y - top edge of rectangle // w - width of rectangle // h - height of rectangle // col - color of rectangle // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Surface::FillRect( short x, short y, unsigned short w, unsigned short h, unsigned long col ) const { if ( s_surface == 0 ) return -1; SDL_Rect src; src.x = x; src.y = y; src.w = w; src.h = h; return SDL_FillRect( s_surface, &src, col ); } //////////////////////////////////////////////////////////////////////// // NAME : Surface::FillRectAlpha // DESCRIPTION: Draw a rectangle using alpha-blending. // PARAMETERS : x - left edge of rectangle // y - top edge of rectangle // w - width of rectangle // h - height of rectangle // col - color of rectangle // alpha - alpha value to use for blending (default 128) // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Surface::FillRectAlpha( short x, short y, unsigned short w, unsigned short h, const Color &col, unsigned char alpha /* = 128 */ ) const { Uint8 *bits, bpp; SDL_PixelFormat *fmt = s_surface->format; // get offset into surface buffer bpp = fmt->BytesPerPixel; if ( bpp < 2 ) return FillRect( x, y, w, h, col ); // not supported SurfaceLock lck( this ); for ( int py = y; py < y + h; ++py ) { bits = ((Uint8 *)s_surface->pixels) + py * s_surface->pitch + x * bpp; for ( int px = x; px < x + w; ++px ) { unsigned char r, g, b; Uint32 pixel = 0; // get pixel from surface switch ( bpp ) { case 2: pixel = *((Uint16 *)(bits)); break; case 3: if ( SDL_BYTEORDER == SDL_LIL_ENDIAN ) pixel = bits[0] + (bits[1] << 8) + (bits[2] << 16); else pixel = (bits[0] << 16) + (bits[1] << 8) + bits[2]; break; case 4: pixel = *((Uint32 *)(bits)); break; } // get RGB values from pixel r = (((pixel&fmt->Rmask)>>fmt->Rshift)<Rloss); g = (((pixel&fmt->Gmask)>>fmt->Gshift)<Gloss); b = (((pixel&fmt->Bmask)>>fmt->Bshift)<Bloss); // blend with alpha r = (((col.r-r)*alpha)>>8) + r; g = (((col.g-g)*alpha)>>8) + g; b = (((col.b-b)*alpha)>>8) + b; DrawPixel( px, py, Color( r, g, b ) ); bits += bpp; } } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Surface::FillPattern // DESCRIPTION: Fill an area of the surface with a graphical pattern. // PARAMETERS : x - left edge of rectangle // y - top edge of rectangle // w - width of rectangle // h - height of rectangle // pattern - pattern image // dx - left edge of the first pattern on the surface // dy - top edge of the first pattern on the surface // RETURNS : - //////////////////////////////////////////////////////////////////////// void Surface::FillPattern( short x, short y, unsigned short w, unsigned short h, const Image &pattern, short dx, short dy ) { Rect clip; GetClipRect( clip ); SetClipRect( Rect( x, y, w, h ) ); short cx, cy = y - (y - dy) % pattern.Height(); do { cx = x - (x - dx) % pattern.Width(); while ( cx < x + w ) { pattern.Draw( this, cx, cy ); cx += pattern.Width(); } cy += pattern.Height(); } while ( cy < y + h ); SetClipRect( clip ); } //////////////////////////////////////////////////////////////////////// // NAME : Surface::DrawBox // DESCRIPTION: Draw a bevelled 3-dimensional box. // PARAMETERS : box - box position and dimensions // type - box type (see surface.h for details) // RETURNS : - //////////////////////////////////////////////////////////////////////// void Surface::DrawBox( const Rect &box, unsigned short type ) { int x1, y1, x2, y2; Color light, shadow; if ( type & BOX_RECESSED ) { light = Color(CF_COLOR_SHADOW); shadow = Color(CF_COLOR_HIGHLIGHT); } else { light = Color(CF_COLOR_HIGHLIGHT); shadow = Color(CF_COLOR_SHADOW); } if ( type & BOX_SOLID ) FillRect( box, Color(CF_COLOR_BACKGROUND) ); x1 = box.x; y1 = box.y; x2 = box.x + box.w - 1; y2 = box.y + box.h - 1; if ( type & BOX_CARVED ) { FillRect( x1, y1, 1, y2-y1+1, shadow ); FillRect( x1, y1, x2-x1+1, 1, shadow ); FillRect( x2, y1, 1, y2-y1+1, light ); FillRect( x1, y2, x2-x1+1, 1, light ); ++x1; ++y1; --x2; --y2; FillRect( x1, y1, 1, y2-y1+1, light ); FillRect( x1, y1, x2-x1+1, 1, light ); FillRect( x2, y1, 1, y2-y1+1, shadow ); FillRect( x1, y2, x2-x1+1, 1, shadow ); } else { FillRect( x1, y1, 1, y2-y1, light ); FillRect( x1, y1, x2-x1, 1, light ); FillRect( x2, y1, 1, y2-y1+1, shadow ); FillRect( x1, y2, x2-x1+1, 1, shadow ); } } //////////////////////////////////////////////////////////////////////// // NAME : Surface::DrawPixel // DESCRIPTION: Draw a single pixel in the specified color. This // procedure does not check whether the surface needs to // be locked to modify it, so the caller must make sure // everything is properly set up. // PARAMETERS : x - horizontal position in surface // y - vertical position in surface // col - color of pixel // RETURNS : - //////////////////////////////////////////////////////////////////////// void Surface::DrawPixel( short x, short y, const Color &col ) const { Uint32 pixel; Uint8 *bits, bpp; // map color to display pixel = MapRGB( col ); // get offset into surface buffer bpp = s_surface->format->BytesPerPixel; bits = ((Uint8 *)s_surface->pixels) + y * s_surface->pitch + x * bpp; switch ( bpp ) { case 1: *((Uint8 *)(bits)) = (Uint8)pixel; break; case 2: *((Uint16 *)(bits)) = (Uint16)pixel; break; case 3: Uint8 r, g, b; r = (pixel>>s_surface->format->Rshift) & 0xFF; g = (pixel>>s_surface->format->Gshift) & 0xFF; b = (pixel>>s_surface->format->Bshift) & 0xFF; *((bits) + s_surface->format->Rshift / 8) = r; *((bits) + s_surface->format->Gshift / 8) = g; *((bits) + s_surface->format->Bshift / 8) = b; break; case 4: *((Uint16 *)(bits)) = (Uint16)pixel; } } //////////////////////////////////////////////////////////////////////// // NAME : Surface::LoadPalette // DESCRIPTION: Load the color palette from a data file. The file is // supposed to be opened already. // PARAMETERS : file - data file descriptor // num - number of colors to read // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Surface::LoadPalette( MemBuffer &file, unsigned short num ) { unsigned char *pal, *col; // file contains num colors pal = new unsigned char[num * 3]; if ( !pal ) return -1; col = pal; file.Read( pal, num * 3 ); for ( int i = 0; i < num; ++i ) { s_surface->format->palette->colors[i].r = *col++; s_surface->format->palette->colors[i].g = *col++; s_surface->format->palette->colors[i].b = *col++; } delete [] pal; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Surface::LoadImageData // DESCRIPTION: Load image data from a data file. The file is supposed // to be opened already. // PARAMETERS : file - data file descriptor // hwsurface - tell SDL to try to put the image into video // memory (defaults to false) // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Surface::LoadImageData( MemBuffer &file, bool hwsurface /* = false */ ) { unsigned char bpp, flags; unsigned short width, height, colors; Color ckey; width = file.Read16(); height = file.Read16(); bpp = file.Read8(); // nothing but 8 supported for now flags = file.Read8(); colors = file.Read16(); if ( flags & RAW_DATA_TRANSPARENT ) { ckey.r = file.Read8(); ckey.g = file.Read8(); ckey.b = file.Read8(); } if ( Create( width, height, bpp, (hwsurface ? SDL_HWSURFACE : 0) ) ) return -1; if ( LoadPalette( file, colors ) ) return -1; for ( int y = 0; y < height; ++y ) { if ( file.Read( (Uint8 *)s_surface->pixels + y * s_surface->pitch, width ) != width ) { return -1; } } if ( flags & RAW_DATA_TRANSPARENT ) SetColorKey( ckey ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Surface::LoadBMP // DESCRIPTION: Load a BMP image from a file. // PARAMETERS : file - BMP file name // RETURNS : 0 on success, non-0 on error //////////////////////////////////////////////////////////////////////// int Surface::LoadBMP( const char *file ) { s_surface = SDL_LoadBMP( file ); if ( s_surface ) { w = s_surface->w; h = s_surface->h; } return (s_surface == NULL); } //////////////////////////////////////////////////////////////////////// // NAME : Image::Image // DESCRIPTION: Create an image from a surface. An image is simply a // rectangular portion of the surface. // PARAMETERS : surface - image surface // x - left edge of image // y - zop edge of image // w - image width // h - image height // RETURNS : - //////////////////////////////////////////////////////////////////////// Image::Image( Surface *surface, short x, short y, unsigned short w, unsigned short h ) : Rect( x, y, w, h ) { this->surface = surface; } //////////////////////////////////////////////////////////////////////// // NAME : Image::Draw // DESCRIPTION: Draw the image to a surface. // PARAMETERS : dest - destination surface // x - left edge of destination rectangle // y - top edge of destination rectangle // RETURNS : - //////////////////////////////////////////////////////////////////////// void Image::Draw( Surface *dest, short x, short y ) const { surface->Blit( dest, *this, x, y ); } crimson-0.5.2.orig/src/common/surface.h0000600000175000017500000001065110554366467016204 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ////////////////////////////////////////////////////////////// // surface.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_SURFACE_H #define _INCLUDE_SURFACE_H #include "SDL.h" #include "rect.h" #include "color.h" #include "fileio.h" // color definitions #define CF_COLOR_BACKGROUND CF_COLOR_DARKGRAY #define CF_COLOR_HIGHLIGHT CF_COLOR_WHITE #define CF_COLOR_SHADOW CF_COLOR_BLACK #define CF_COLOR_GHOSTED CF_COLOR_LIGHTGRAY // flags for DrawBox() #define BOX_RAISED 0x0001 // | #define BOX_RECESSED 0x0002 // |- only one of these at a time #define BOX_CARVED 0x0004 // | #define BOX_SOLID 0x0010 // fill box with background color class Surface : public Rect { public: Surface( void ) : Rect( 0, 0, 0, 0 ) { s_surface = 0; } ~Surface( void ); int Create( short w, short h, int bpp, unsigned long flags ); int DisplayFormat( void ); int SetAlpha( unsigned char alpha, unsigned long flags ) { return SDL_SetAlpha( s_surface, flags, alpha ); } int SetColorKey( const Color &col ); Color GetColorKey( void ) const; Color GetPixel( unsigned short x, unsigned short y ) const; unsigned long MapRGB( const Color &col ) const { return SDL_MapRGB( s_surface->format, col.r, col.g, col.b ); } int Blit( Surface *dest, const Rect &from, short dx, short dy ) const; int LowerBlit( Surface *dest, const Rect &from, short dx, short dy ) const; void DrawBox( const Rect &box, unsigned short type ); void Flood( const Color &col ) const { FillRect( *this, col ); } int FillRect( short x, short y, unsigned short w, unsigned short h, unsigned long col ) const; int FillRect( const Rect &rect, unsigned long col ) const { return FillRect( rect.x, rect.y, rect.w, rect.h, col ); } int FillRect( short x, short y, unsigned short w, unsigned short h, const Color &col ) const { return FillRect( x, y, w, h, MapRGB( col ) ); } int FillRect( const Rect &rect, const Color &col ) const { return FillRect( rect.x, rect.y, rect.w, rect.h, col ); } int FillRectAlpha( short x, short y, unsigned short w, unsigned short h, const Color &col, unsigned char alpha = 128 ) const; int FillRectAlpha( const Rect &rect, const Color &col, unsigned char alpha = 128 ) const { return FillRectAlpha( rect.x, rect.y, rect.w, rect.h, col, alpha ); } void FillPattern( short x, short y, unsigned short w, unsigned short h, const class Image &pattern, short dx, short dy ); void FillPattern( const Rect &rect, const class Image &pattern, short dx, short dy ) { FillPattern( rect.x, rect.y, rect.w, rect.h, pattern, dx, dy ); } void SetClipRect( const Rect &clip ) const; void GetClipRect( Rect &clip ) const; int LoadImageData( MemBuffer &file, bool hwsurface = false ); int LoadPalette( MemBuffer &file, unsigned short cols ); int LoadBMP( const char *file ); SDL_Surface *s_surface; protected: enum { RAW_DATA_TRANSPARENT = 0x01 }; void DrawPixel( short const x, short const y, const Color &col ) const; }; class SurfaceLock { public: SurfaceLock( const Surface *surface ) : s(surface->s_surface) { locked = ( SDL_MUSTLOCK( s ) && (SDL_LockSurface( s ) == 0) ); } ~SurfaceLock( void ) { if ( locked ) SDL_UnlockSurface( s ); } private: SDL_Surface *s; bool locked; }; class Image : public Rect { public: Image( void ) {} Image( Surface *surface, short x, short y, unsigned short w, unsigned short h ); void Draw( Surface *dest, short x, short y ) const; private: Surface *surface; }; #endif /* _INCLUDE_SURFACE_H */ crimson-0.5.2.orig/src/common/textbox.cpp0000600000175000017500000006673110554366436016612 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // textbox.cpp //////////////////////////////////////////////////////////////////////// #include #include #include #include "textbox.h" #include "misc.h" //////////////////////////////////////////////////////////////////////// // NAME : TextWidget::TextWidget // DESCRIPTION: Create a new TextWidget // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // str - text to display (may be NULL) // flags - widget flags (see widget.h for details) // title - widget title (currently unused) // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// TextWidget::TextWidget( short id, short x, short y, unsigned short w, unsigned short h, const char *str, unsigned short flags, const char *title, Window *window ) : Widget( id, x, y, w, h, flags, title, window ) { textsurface = NULL; spacing = 2; SetText( str ); } //////////////////////////////////////////////////////////////////////// // NAME : TextWidget::~TextWidget // DESCRIPTION: Destroy a TextWidget // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// TextWidget::~TextWidget( void ) { delete textsurface; } //////////////////////////////////////////////////////////////////////// // NAME : TextWidget::SetText // DESCRIPTION: Prepare the text for use and format it appropriately. // PARAMETERS : str - string to display (may be NULL) // RETURNS : - //////////////////////////////////////////////////////////////////////// void TextWidget::SetText( const char *str ) { delete textsurface; textsurface = NULL; rows = visrows = toprow = 0; if ( !str ) return; rows = font->TextHeight( str, w - 10, spacing ); if ( rows > 0 ) { textsurface = new Surface(); if ( textsurface->Create( w - 10, rows, surface->GetView()->ScreenBPP(), 0 ) ) { delete textsurface; textsurface = NULL; return; } textsurface->SetColorKey( Color(CF_COLOR_BLACK) ); textsurface->Flood( Color(CF_COLOR_BLACK) ); string full( str ); int pos = 0, endpos = full.size(), rowcnt = 0; unsigned short xoff = 0; while ( pos < endpos ) { size_t linelen = font->FitText( &str[pos], w - 10, true ); string sub( full.substr( pos, linelen ) ); // remove newlines size_t rep = 0; while ( (rep = sub.find( '\n', rep )) != string::npos ) sub.erase( rep, 1 ); if ( flags & WIDGET_ALIGN_CENTER ) xoff = (w - 10 - font->TextWidth( sub.c_str() )) / 2; font->Write( sub.c_str(), textsurface, xoff, rowcnt ); rowcnt += font->Height() + spacing; pos += linelen; } visrows = h - 6; if ( visrows > rows ) visrows = rows; } } //////////////////////////////////////////////////////////////////////// // NAME : TextWidget::Draw // DESCRIPTION: Draw the widget and render the text. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void TextWidget::Draw( void ) { surface->DrawBack( *this ); surface->DrawBox( *this, BOX_RECESSED ); if ( textsurface ) textsurface->Blit( surface, Rect(0,toprow,textsurface->Width(),visrows), x + 5, y + 3 ); } //////////////////////////////////////////////////////////////////////// // NAME : TextWidget::SetRow // DESCRIPTION: Set the first row visible in the widget textbox. // PARAMETERS : top - first row to be visible; the widget automatically // adjusts this value to fit as much text as possible // into the box // RETURNS : new top row set (after optimization) //////////////////////////////////////////////////////////////////////// unsigned short TextWidget::SetRow( unsigned short top ) { unsigned short maxrow = rows - visrows; if ( top <= maxrow ) toprow = top; else toprow = maxrow; Draw(); Show(); return toprow; } //////////////////////////////////////////////////////////////////////// // NAME : TextScrollWidget::TextScrollWidget // DESCRIPTION: Create a new TextScrollWidget. // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // str - text to display (may be NULL) // flags - widget flags (see widget.h for details) // title - widget title (currently unused) // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// TextScrollWidget::TextScrollWidget( short id, short x, short y, unsigned short w, unsigned short h, const char *str, unsigned short flags, const char *title, Window *window ) : CompositeWidget( id, x, y, w, h, 0, 0, window ) { TextWidget *text = new TextWidget( 0, x, y, w, h, 0, flags|WIDGET_COMPOSITE, title, window ); AddWidget( text ); SetText( str ); } //////////////////////////////////////////////////////////////////////// // NAME : TextWidget::WidgetActivated // DESCRIPTION: Scroller has been used. Scroll the widget to the current // row. // PARAMETERS : widget - calling widget (slider) // win - window the widget belongs to // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status TextScrollWidget::WidgetActivated( Widget *widget, Window *win ) { TextWidget *t = static_cast( GetWidget( 0 ) ); t->SetRow( static_cast(widget)->Level() ); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : TextScrollWidget::MouseDown // DESCRIPTION: Distribute mouse down events to all components. Redirect // all scrollwheel events to the slider so that scrolling // works even if the pointer doesn't hover over the slider. // PARAMETERS : button - button event // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status TextScrollWidget::MouseDown( const SDL_MouseButtonEvent &button ) { SDL_MouseButtonEvent mybutton = button; if ( ((button.button == SDL_BUTTON_WHEELUP) || (button.button == SDL_BUTTON_WHEELDOWN)) && Contains( button.x - surface->LeftEdge(), button.y - surface->TopEdge() ) ) { SliderWidget *s = static_cast( GetWidget(1) ); if ( s ) { // to address the slider widget we must adjust the click // coordinates to be inside the slider box mybutton.x = s->LeftEdge() + surface->LeftEdge(); mybutton.y = s->TopEdge() + surface->TopEdge(); } } return CompositeWidget::MouseDown( mybutton ); } //////////////////////////////////////////////////////////////////////// // NAME : TextScrollWidget::SetText // DESCRIPTION: Set a new text to be displayed in the widget. // PARAMETERS : str - string to display (may be NULL) // RETURNS : - //////////////////////////////////////////////////////////////////////// void TextScrollWidget::SetText( const char *str ) { TextWidget *t = static_cast( GetWidget(0) ); SliderWidget *s = static_cast( GetWidget(1) ); bool needslider = str && (font->TextHeight( str, w - 10, 2 ) > h - 6); if ( needslider ) { if ( !s ) { s = new SliderWidget( 1, x + w - DEFAULT_SLIDER_SIZE, y, DEFAULT_SLIDER_SIZE, h, 0, 0, 0, 0, WIDGET_VSCROLL|WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY|WIDGET_COMPOSITE, NULL, surface ); s->SetKeyStep( font->Height() + 2 ); s->SetHook( this ); AddWidget( s ); t->SetSize( x, y, w - s->Width(), h ); } } else if ( s ) { RemoveWidget( s ); t->SetSize( x, y, w + s->Width(), h ); delete s; } t->SetText( str ); if ( needslider ) { s->Adjust( 0, t->Rows() - t->RowsVisible(), MAX(t->RowsVisible(),1) ); s->ScrollTo( 0 ); } } //////////////////////////////////////////////////////////////////////// // NAME : TextListWidget::DrawNodes // DESCRIPTION: Draw the list nodes. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void TextListWidget::DrawNodes( void ) { Rect box( x + 4, y + 1 + spacing, listboxw - 8, h - 2 - 2 * spacing ); Rect area( x + 1, y + 1, listboxw - 2, h - 2 ); short num = toprow / ItemHeight(); // number of top node TLWNode *n = static_cast(list->GetNode( num )); // top node short xoff = box.x, yoff = box.y + (num * ItemHeight()) - toprow; Color fcol = font->GetColor(); if ( Disabled() ) font->SetColor( Color(CF_COLOR_GHOSTED) ); surface->DrawBack( area ); while ( n ) { if ( flags & WIDGET_ALIGN_CENTER ) xoff = box.x + (box.w - font->TextWidth(n->Name())) / 2; if ( num == current ) { Rect hilite( x + 2, yoff, listboxw - 4, ItemHeight() ); hilite.Clip( area ); surface->FillRectAlpha( hilite, surface->GetFGPen() ); } // print node name and clip to box PrintItem( n, surface, xoff, yoff + 1, box ); yoff += ItemHeight(); if ( yoff >= box.y + box.h ) break; ++num; n = static_cast( n->Next() ); } font->SetColor( fcol ); } //////////////////////////////////////////////////////////////////////// // NAME : TextListWidget::PrintItem // DESCRIPTION: Print one item of the list widget. This can be used to // customize the look of the list, e.g. colour and font. // The item height must keep the same, though. // PARAMETERS : item - node to print // dest - destination surface // x - left edge of printing area // y - top edge of printing area // clip - clipping rectangle // RETURNS : - //////////////////////////////////////////////////////////////////////// void TextListWidget::PrintItem( const TLWNode *item, Surface *dest, short x, short y, const Rect &clip ) const { font->Write( item->Name(), dest, x, y, clip ); } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::StringWidget // DESCRIPTION: Create a new StringWidget. // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // str - string to display // maxlen - maximum length of string in characters (not // including the trailing NUL-byte) // flags - widget flags (see widget.h for details) // title - widget title // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// StringWidget::StringWidget( short id, short x, short y, unsigned short w, unsigned short h, const char *str, unsigned short maxlen, unsigned short flags, const char *title, Window *window ) : Widget( id, x, y, w, h, flags, title, window ), cursor(0), maxlen(maxlen), offset(0), strbox(x+4,y+(h-font->Height())/2,w-8,font->Height()), validator(0) { SetString( str, false ); } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::SetString // DESCRIPTION: Set a new string to display in the widget. // PARAMETERS : newstr - string to display (may be NULL) // upd - whether to update the display (default value // is "true") // RETURNS : - //////////////////////////////////////////////////////////////////////// void StringWidget::SetString( const char *newstr, bool upd /* = true */ ) { if ( newstr ) buffer.assign( newstr ); else buffer.erase(); if ( upd ) { Draw(); Show(); } } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::String // DESCRIPTION: Get the current string. // PARAMETERS : - // RETURNS : pointer to the string, or NULL if string is empty //////////////////////////////////////////////////////////////////////// const char *StringWidget::String( void ) const { if ( !buffer.empty() ) return buffer.c_str(); return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::Draw // DESCRIPTION: Draw the widget. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void StringWidget::Draw( void ) { Rect clip; surface->DrawBack( *this ); if ( !(flags & WIDGET_STYLE_NOBORDER ) ) surface->DrawBox( *this, BOX_RECESSED ); surface->GetClipRect( clip ); surface->SetClipRect( strbox ); if ( Clicked() ) surface->FillRect( strbox.x + CursorPos(), strbox.y, CursorWidth(), font->Height(), surface->GetFGPen() ); short xoff = strbox.x - offset; if ( flags & WIDGET_STR_PASSWORD ) { unsigned short starw = font->CharWidth('*'); unsigned short len = buffer.size(); for ( int i = 0; i < len; ++i ) { if ( Clicked() && (cursor == i) ) font->Write( '*', surface, xoff, strbox.y, surface->GetBGPen() ); else font->Write( '*', surface, xoff, strbox.y ); xoff += starw; } } else { font->Write( buffer.c_str(), surface, strbox.x - offset, strbox.y, strbox ); if ( Clicked() && (cursor < buffer.size()) ) { font->Write( buffer[cursor], surface, strbox.x + CursorPos(), strbox.y, surface->GetBGPen() ); } } surface->SetClipRect( clip ); PrintTitle( surface->GetFGPen() ); } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::MouseDown // DESCRIPTION: React to mouse button presses. // PARAMETERS : button - SDL_MouseButtonEvent received from the event // handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status StringWidget::MouseDown( const SDL_MouseButtonEvent &button ) { if ( (button.button == SDL_BUTTON_LEFT) && !(flags & WIDGET_STR_CONST) && Contains( button.x - surface->LeftEdge(), button.y - surface->TopEdge() ) ) { short xoff = button.x - surface->LeftEdge() - x; unsigned short len = buffer.size(); cursor = 0; while ( (cursor < len) && (CursorPos() + CursorWidth() < xoff) ) ++cursor; short curpix = CursorPos(); if ( curpix < 0 ) offset -= curpix; else if ( curpix + CursorWidth() >= strbox.w ) { offset += curpix + CursorWidth() - strbox.w; } return InputLoop(); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::KeyDown // DESCRIPTION: React to key presses. // PARAMETERS : key - SDL_keysym received from the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status StringWidget::KeyDown( const SDL_keysym &key ) { if ( (key.sym == this->key) && !(flags & WIDGET_STR_CONST) ) { unsigned short buflen = font->TextWidth( buffer.c_str() ); cursor = buffer.size(); offset = MAX( 0, buflen + CursorWidth() - strbox.w ); return InputLoop(); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::InputLoop // DESCRIPTION: After activation of the StringWidget, all events are // exclusively handled by this function, until the // widget is deselected at which point the control is given // back to the main event handler. // PARAMETERS : - // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status StringWidget::InputLoop( void ) { SDL_Event event; GUI_Status rc = GUI_OK; int unicode; bool quit = false; Push(); unicode = SDL_EnableUNICODE( 1 ); do { rc = surface->GetView()->FetchEvent( event ); if ( (rc == GUI_QUIT) || (rc == GUI_ERROR) ) quit = true; else { if ( ((event.type == SDL_MOUSEBUTTONDOWN) && !Contains( event.button.x - x, event.button.y - y )) || ((event.type == SDL_KEYUP) && ((event.key.keysym.sym == SDLK_RETURN) || (event.key.keysym.sym == SDLK_TAB))) ) { quit = true; } else if ( event.type == SDL_KEYDOWN ) { CharInput( event.key.keysym.sym, event.key.keysym.unicode ); } } } while ( !quit ); cursor = offset = 0; SDL_EnableUNICODE( unicode ); Release(); if ( hook ) hook->WidgetActivated( this, surface ); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::CharInput // DESCRIPTION: Insert a new character in the input buffer. // PARAMETERS : sym - ASCII symbol for printable characters // unicode - UNICODE representation for non-printable chars // RETURNS : - //////////////////////////////////////////////////////////////////////// void StringWidget::CharInput( short sym, unsigned short unicode ) { bool changed = false; if ( unicode ) { switch ( unicode ) { case '\b': // BACKSPACE - delete char at cursor-1 if ( cursor > 0 ) { buffer.erase( --cursor, 1 ); changed = true; } break; case 127: // DELETE - delete char at cursor if ( cursor < buffer.size() ) { buffer.erase( cursor, 1 ); changed = true; } break; default: if ( buffer.size() < maxlen ) { // insert char at cursor pos bool accept = (validator ? validator->ValidateKey( buffer.c_str(), unicode, cursor ) : isprint(unicode) != 0 ); if ( accept ) { buffer.insert( cursor++, 1, unicode ); changed = true; } } } } else switch ( sym ) { case SDLK_LEFT: // move cursor left if ( cursor > 0 ) { --cursor; changed = true; } break; case SDLK_RIGHT: if ( cursor < buffer.size() ) { ++cursor; changed = true; } break; default: break; } if ( changed ) { short curpix = CursorPos(); if ( curpix < 0 ) offset += curpix; else if ( curpix + CursorWidth() >= strbox.w ) offset += curpix + CursorWidth() - strbox.w; Draw(); Show(); } } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::CursorWidth // DESCRIPTION: Get width of cursor in pixels. // PARAMETERS : - // RETURNS : cursor width //////////////////////////////////////////////////////////////////////// unsigned short StringWidget::CursorWidth( void ) const { unsigned short curw; if ( flags & WIDGET_STR_PASSWORD ) curw = font->CharWidth('*'); else if ( cursor < buffer.size() ) curw = font->CharWidth( buffer[cursor] ); else curw = font->Width(); return curw; } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::CursorPos // DESCRIPTION: Get position of cursor on display in pixels. // PARAMETERS : - // RETURNS : cursor position (- current offset) //////////////////////////////////////////////////////////////////////// short StringWidget::CursorPos( void ) const { unsigned short cp; if ( flags & WIDGET_STR_PASSWORD ) cp = cursor * font->CharWidth('*'); else { cp = font->TextWidth(buffer.substr(0, cursor + 1).c_str()); if ( buffer.size() > cursor ) cp -= CursorWidth(); } return cp - offset; } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::DispWidth // DESCRIPTION: Get width of a character in pixels. // PARAMETERS : ch - glyph to measure // RETURNS : character width //////////////////////////////////////////////////////////////////////// unsigned short StringWidget::DispWidth( short ch ) const { unsigned short cw; if ( flags & WIDGET_STR_PASSWORD ) cw = font->CharWidth('*'); else cw = font->CharWidth( ch ); return cw; } //////////////////////////////////////////////////////////////////////// // NAME : StringWidget::SetFocus // DESCRIPTION: Activate the widget, i.e. show the cursor and wait for // user input. // PARAMETERS : - // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status StringWidget::SetFocus( void ) { cursor = 0; return InputLoop(); } //////////////////////////////////////////////////////////////////////// // NAME : NumberWidget::NumberWidget // DESCRIPTION: Create a new NumberWidget. // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // number - initial value to display // min - minimum allowed value // max - maximum allowed value // flags - widget flags (see widget.h for details) // title - widget title // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// NumberWidget::NumberWidget( short id, short x, short y, unsigned short w, unsigned short h, long number, long min, long max, unsigned short flags, const char *title, Window *window ) : StringWidget( id, x, y, w, h, itoa(number, numbuf), strlen(itoa(max,numbuf2)), flags, title, window ) { num = number; minval = min; maxval = max; SetValidator( this ); } //////////////////////////////////////////////////////////////////////// // NAME : NumberWidget::SetNumber // DESCRIPTION: Fill the widget with a value. // PARAMETERS : number - new widget value // upd - whether to update the display (default is true) // RETURNS : - //////////////////////////////////////////////////////////////////////// void NumberWidget::SetNumber( long number, bool upd /* = true */ ) { num = MIN( MAX( minval, number ), maxval ); SetString( itoa( num, numbuf ), upd ); } //////////////////////////////////////////////////////////////////////// // NAME : NumberWidget::ValidateKey // DESCRIPTION: Only accept numbers for input. // PARAMETERS : str - string currently entered in widget (not used) // key - char to be entered // pos - position at which to enter the char // RETURNS : TRUE if key is accepted, FALSE if refused //////////////////////////////////////////////////////////////////////// bool NumberWidget::ValidateKey( const char *str, unsigned short key, unsigned short pos ) const { return ((key >= '0') && (key <= '9')) || ((key == '-') && (pos == 0)); } //////////////////////////////////////////////////////////////////////// // NAME : NumberWidget::SetMin // DESCRIPTION: Set a new minimum value. // PARAMETERS : min - new minimum // RETURNS : - //////////////////////////////////////////////////////////////////////// void NumberWidget::SetMin( long min ) { minval = min; if ( Number() < min ) SetNumber( min ); } //////////////////////////////////////////////////////////////////////// // NAME : NumberWidget::SetMax // DESCRIPTION: Set a new maximum value. // PARAMETERS : max - new maximum // RETURNS : - //////////////////////////////////////////////////////////////////////// void NumberWidget::SetMax( long max ) { maxval = max; if ( Number() > max ) SetNumber( max ); } //////////////////////////////////////////////////////////////////////// // NAME : NumberWidget::Release // DESCRIPTION: When the widget is released make sure the number which // was entered is inside the requested boundaries and // adjust it if necessary. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void NumberWidget::Release( void ) { const char *str = String(); short n = (str ? atoi(str) : 0); SetNumber( n ); StringWidget::Release(); } //////////////////////////////////////////////////////////////////////// // NAME : TLWNode::TLWNode // DESCRIPTION: Create a new TextListWidget node. // PARAMETERS : name - name to be displayed in TextListWidget // data - arbitrary data for private use by caller // id - node identifier; this is not used internally // either and may be used by the caller // RETURNS : - //////////////////////////////////////////////////////////////////////// TLWNode::TLWNode( const char *name, void *data, unsigned short id ) : name(name), id(id), user_data(data) { } TLWNode::TLWNode( const char *name, void *data ) : name(name), id(0), user_data(data) { } TLWNode::TLWNode( const char *name ) : name(name), id(0), user_data(0) { } //////////////////////////////////////////////////////////////////////// // NAME : TLWList::Sort // DESCRIPTION: Sort the list in ascending alphabetical order. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void TLWList::Sort( void ) { TLWList s; while ( !IsEmpty() ) s.AddHead( RemHead() ); while ( !s.IsEmpty() ) InsertNodeSorted( static_cast(s.RemTail()) ); } //////////////////////////////////////////////////////////////////////// // NAME : TLWList::InsertNodeSorted // DESCRIPTION: Insert a node into the list according to its name. // Nodes will be sorted in ascending alphabetical order. // PARAMETERS : n - TextListWidget node to be inserted // RETURNS : - //////////////////////////////////////////////////////////////////////// void TLWList::InsertNodeSorted( TLWNode *n ) { TLWNode *walk = static_cast( Tail() ); while ( walk && (strcmp( n->Name(), walk->Name()) < 0) ) walk = static_cast( walk->Prev() ); InsertNode( n, walk ); } //////////////////////////////////////////////////////////////////////// // NAME : TLWList::GetNodeByID // DESCRIPTION: Retrieve the node with the given ID from the list. // PARAMETERS : id - requested node identifier // RETURNS : pointer to the node, or NULL if not found //////////////////////////////////////////////////////////////////////// TLWNode *TLWList::GetNodeByID( unsigned short id ) const { TLWNode *walk = static_cast( Head() ); while ( walk && (walk->ID() != id) ) walk = static_cast( walk->Next() ); return walk; } crimson-0.5.2.orig/src/common/textbox.h0000600000175000017500000001261110554366467016247 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ////////////////////////////////////////////////////////////////////// // textbox.h - various widgets for texts and strings ////////////////////////////////////////////////////////////////////// #ifndef _INCLUDE_TEXTBOX_H #define _INCLUDE_TEXTBOX_H #include using namespace std; #include "widget.h" #include "slider.h" #include "listselect.h" class TextWidget : public Widget { public: TextWidget( short id, short x, short y, unsigned short w, unsigned short h, const char *str, unsigned short flags, const char *title, Window *window ); ~TextWidget( void ); virtual void SetText( const char *str ); unsigned short SetRow( unsigned short top ); unsigned short Rows( void ) const { return rows; } unsigned short RowsVisible( void ) const { return visrows; } void Draw( void ); private: Surface *textsurface; unsigned short rows; // rows of pixels unsigned short visrows; // rows visible at one time unsigned short toprow; // first visible row unsigned short spacing; }; class TextScrollWidget : public CompositeWidget, public WidgetHook { public: TextScrollWidget( short id, short x, short y, unsigned short w, unsigned short h, const char *str, unsigned short flags, const char *title, Window *window ); void SetText( const char *str ); private: GUI_Status WidgetActivated( Widget *widget, Window *win ); GUI_Status MouseDown( const SDL_MouseButtonEvent &button ); }; // node type used by the TextListWidget class TLWNode : public Node { public: TLWNode( const char *name ); TLWNode( const char *name, void *data ); TLWNode( const char *name, void *data, unsigned short id ); const char *Name( void ) const { return name.c_str(); } void SetName( const string &name ) { this->name = name; } unsigned short ID( void ) const { return id; } void SetID( unsigned short id ) { this->id = id; } void *UserData( void ) const { return user_data; } void SetUserData( void *data ) { user_data = data; } private: string name; unsigned short id; void *user_data; }; class TLWList : public List { public: TLWList( void ) {} void Sort( void ); void InsertNodeSorted( TLWNode *n ); TLWNode *GetNodeByID( unsigned short id ) const; }; class TextListWidget : public ListWidget { public: TextListWidget( short id, short x, short y, unsigned short w, unsigned short h, List *list, short selected, unsigned short flags, const char *title, Window *window ) : ListWidget( id, x, y, w, h, list, selected, flags, title, window ) { itemh = font->Height() + spacing; Update(); } virtual void DrawNodes( void ); virtual void PrintItem( const TLWNode *item, Surface *dest, short x, short y, const Rect &clip ) const; virtual unsigned short ItemHeight( void ) const { return itemh; } private: unsigned short itemh; }; class InputValidator { public: virtual ~InputValidator( void ) {} virtual bool ValidateKey( const char *str, unsigned short key, unsigned short pos ) const = 0; }; class StringWidget : public Widget { public: StringWidget( short id, short x, short y, unsigned short w, unsigned short h, const char *str, unsigned short maxlen, unsigned short flags, const char *title, Window *window ); virtual void Draw( void ); const char *String( void ) const; void SetString( const char *newstr, bool upd = true ); GUI_Status SetFocus( void ); void SetValidator( InputValidator *val ) { validator = val; } GUI_Status MouseDown( const SDL_MouseButtonEvent &button ); GUI_Status KeyDown( const SDL_keysym &key ); private: GUI_Status InputLoop( void ); void CharInput( short sym, unsigned short unicode ); unsigned short CursorWidth( void ) const; short CursorPos( void ) const; unsigned short DispWidth( short ch ) const; string buffer; unsigned short cursor; unsigned short maxlen; short offset; Rect strbox; InputValidator *validator; }; class NumberWidget : public StringWidget, public InputValidator { public: NumberWidget( short id, short x, short y, unsigned short w, unsigned short h, long number, long min, long max, unsigned short flags, const char *title, Window *window ); bool ValidateKey( const char *str, unsigned short key, unsigned short pos ) const; long Number( void ) const { return num; } void SetNumber( long number, bool upd = true ); void SetMin( long min ); void SetMax( long max ); void Release( void ); private: long num; long minval; long maxval; char numbuf[8]; char numbuf2[8]; }; #endif /* _INCLUDE_TEXTBOX_H */ crimson-0.5.2.orig/src/common/view.cpp0000600000175000017500000003061010554366440016045 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // view.cpp //////////////////////////////////////////////////////////////////////// #include "view.h" //////////////////////////////////////////////////////////////////////// // NAME : View::View // DESCRIPTION: Initialize the view structure. It will also create a // display surface. // PARAMETERS : w - display surface width // h - display surface height // bpp - display depth // flags - display surface flags (see SDL/SDL.h) // RETURNS : - //////////////////////////////////////////////////////////////////////// View::View( unsigned short w, unsigned short h, short bpp, unsigned long flags ) { sfont = lfont = NULL; sys_icons = NULL; s_surface = NULL; SetVideoMode( w, h, bpp, flags ); if ( !s_surface ) return; x = y = 0; allow_updates = true; filter = NULL; } //////////////////////////////////////////////////////////////////////// // NAME : View::~View // DESCRIPTION: Destroy the view and associated data structures. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// View::~View( void ) { CloseAllWindows(); delete sfont; delete lfont; delete sys_icons; } //////////////////////////////////////////////////////////////////////// // NAME : View::SetVideoMode // DESCRIPTION: Set the view's video mode. If the view already has a // video surface (i.e. the resultion is changed) all // windows are adjusted to the new size. // PARAMETERS : w - resolution width // h - resolution height // bpp - color depth // flags - video flags // RETURNS : - //////////////////////////////////////////////////////////////////////// void View::SetVideoMode( unsigned short w, unsigned short h, short bpp, unsigned long flags ) { bool change = (s_surface != NULL); if ( change ) SDL_FreeSurface( s_surface ); s_surface = SDL_SetVideoMode( w, h, bpp, flags ); if ( s_surface ) { this->w = s_surface->w; this->h = s_surface->h; if ( change ) { // adjust window positions and sizes Window *win = static_cast( windows.Tail() ); while ( win ) { win->VideoModeChange(); win = static_cast( win->Prev() ); } Refresh(); } } } //////////////////////////////////////////////////////////////////////// // NAME : View::Update // DESCRIPTION: Update the display surface without reblitting the // particular window surfaces. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void View::Update( void ) { Update( *this ); } //////////////////////////////////////////////////////////////////////// // NAME : View::Update // DESCRIPTION: Update part of the display surface without reblitting // the particular window surfaces. // PARAMETERS : rect - area to be updated // RETURNS : - //////////////////////////////////////////////////////////////////////// void View::Update( const Rect &rect ) { if ( allow_updates ) SDL_UpdateRect( s_surface, rect.x, rect.y, rect.w, rect.h ); } //////////////////////////////////////////////////////////////////////// // NAME : View::Refresh // DESCRIPTION: Update the entire display surface. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void View::Refresh( void ) { Window *win = static_cast( windows.Tail() ); Flood( Color(CF_COLOR_WHITE) ); while ( win ) { if ( !win->Closed() ) { win->Blit( this, Rect( 0, 0, win->Width(), win->Height() ), win->LeftEdge(), win->TopEdge() ); } win = static_cast( win->Prev() ); } // now update the display Update(); } //////////////////////////////////////////////////////////////////////// // NAME : View::Refresh // DESCRIPTION: Update parts of the display surface only. // PARAMETERS : refresh - area to refresh // RETURNS : - //////////////////////////////////////////////////////////////////////// void View::Refresh( const Rect &refresh ) { Window *window = static_cast( windows.Tail() ); Rect v( refresh ); v.Clip( *this ); FillRect( v, Color(CF_COLOR_WHITE) ); while ( window ) { if ( !window->Closed() ) { // clip the window to the refresh area Rect win = *window; Rect src( 0, 0, window->Width(), window->Height() ); win.ClipBlit( src, v ); if ( win.Width() && win.Height() ) window->Blit( this, src, win.LeftEdge(), win.TopEdge() ); } window = static_cast( window->Prev() ); } Update( v ); } //////////////////////////////////////////////////////////////////////// // NAME : View::AddWindow // DESCRIPTION: Attach a window to the view. The window will then // receive event messages and can be shown. This // function does not automatically update the display. // Call Window::Refresh to do so manually. // PARAMETERS : window - window to add // RETURNS : - //////////////////////////////////////////////////////////////////////// void View::AddWindow( Window *window ) { windows.AddHead( window ); } //////////////////////////////////////////////////////////////////////// // NAME : View::CloseWindow // DESCRIPTION: Close a window. If there are other windows left, update // the display. // This function only marks the window closed. The actual // cleaning up is done in the event handling function. // PARAMETERS : window - window to close // RETURNS : active window after closing, NULL if no windows left //////////////////////////////////////////////////////////////////////// Window *View::CloseWindow( Window *window ) { Window *focus; window->Remove(); // remove from windows list focus = static_cast( windows.Head() ); if ( !windows.IsEmpty() ) Refresh( *window ); window->Close(); windows.AddTail( window ); // put it back to the end of the list return focus; } //////////////////////////////////////////////////////////////////////// // NAME : View::SelectWindow // DESCRIPTION: Redirect all incoming event messages to another window. // PARAMETERS : window - window to receive event messages // RETURNS : - //////////////////////////////////////////////////////////////////////// void View::SelectWindow( Window *window ) { if ( window != static_cast( windows.Head() ) ) { window->Remove(); windows.AddHead( window ); } } //////////////////////////////////////////////////////////////////////// // NAME : Window::CloseAllWindows // DESCRIPTION: Close all windows. This function only marks the window // to be closed. The actual cleaning is done in the event // handling function. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void View::CloseAllWindows( void ) { for ( Window *w = static_cast(windows.Head()); w && !w->Closed(); w = static_cast(w->Next()) ) w->Close(); Refresh(); } //////////////////////////////////////////////////////////////////////// // NAME : View::HandleEvents // DESCRIPTION: Distribute event messages to the windows and react // appropriately. // PARAMETERS : - // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status View::HandleEvents( void ) { SDL_Event event; GUI_Status rc = FetchEvent( event ); if ( (rc != GUI_ERROR) && (rc != GUI_QUIT) && (rc != GUI_NONE) ) { Window *win = static_cast( windows.Head() ); if ( win ) { rc = win->HandleEvent( event ); if ( rc == GUI_CLOSE ) win = CloseWindow( win ); } // collect destroyed windows while ( (win = static_cast(windows.Tail())) && win->Closed() ) { win->Remove(); delete win; } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : View::FetchEvent // DESCRIPTION: Get the next event from the event queue. // PARAMETERS : event - buffer to hold the event information // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status View::FetchEvent( SDL_Event &event ) { GUI_Status rc; do { if ( SDL_WaitEvent( &event ) ) { // try to aggregate several mouse motion events to prevent getting flooded if ( event.type == SDL_MOUSEMOTION ) { SDL_Event next; Uint32 start = SDL_GetTicks(); do { int got = SDL_PeepEvents( &next, 1, SDL_GETEVENT, SDL_MOUSEMOTIONMASK ); if ( got > 0 ) { event.motion.x = next.motion.x; event.motion.y = next.motion.y; event.motion.xrel += next.motion.xrel; event.motion.yrel += next.motion.yrel; } else break; } while ( SDL_GetTicks() - start < 10 ); } rc = SystemFilter( event ); if ( rc != GUI_NONE ) { if ( filter ) { rc = filter( event, static_cast(windows.Head()) ); } else rc = GUI_OK; } } else rc = GUI_ERROR; } while ( rc == GUI_NONE ); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : View::PeekEvent // DESCRIPTION: Get the next event from the event queue if there are any // events pending. If there are no events waiting, return // immediately. // PARAMETERS : event - buffer to hold the event information // RETURNS : GUI status; GUI_NONE is returned if no events waiting //////////////////////////////////////////////////////////////////////// GUI_Status View::PeekEvent( SDL_Event &event ) { GUI_Status rc = GUI_NONE; while ( (rc == GUI_NONE) && SDL_PollEvent( &event ) ) { rc = SystemFilter( event ); if ( rc != GUI_NONE ) { if ( filter ) { rc = filter( event, static_cast(windows.Head()) ); } else rc = GUI_OK; } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : View::ToggleFullScreen // DESCRIPTION: Switch from windowed to fullscreen mode or vice versa. // PARAMETERS : - // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int View::ToggleFullScreen( void ) { return !SDL_WM_ToggleFullScreen( s_surface ); } //////////////////////////////////////////////////////////////////////// // NAME : View::SystemFilter // DESCRIPTION: This is the global system event filter. All events // received by the event handler are first run through // this filter, afterwards through the user filter (if // present), and only then passed on to the windows. The // system filter is the only one allowed to modify event // information. // PARAMETERS : event - event to be checked // RETURNS : GUI_NONE to prevent this event from being processed by // anyone. For any other return code the event is // distributed as usual. //////////////////////////////////////////////////////////////////////// GUI_Status View::SystemFilter( const SDL_Event &event ) { GUI_Status rc; // toggles fullscreen if ( (event.type == SDL_KEYDOWN) && (event.key.keysym.sym == SDLK_RETURN) && (event.key.keysym.mod & KMOD_ALT) != 0) { ToggleFullScreen(); rc = GUI_NONE; } else rc = GUI_OK; return rc; } crimson-0.5.2.orig/src/common/view.h0000600000175000017500000000563110554366467015530 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // view.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_VIEW_H #define _INCLUDE_VIEW_H #include "SDL.h" #include "window.h" typedef GUI_Status (*GUIEventFilter)( SDL_Event &event, Window *window ); class View : public Surface { public: View( unsigned short w, unsigned short h, short bpp, unsigned long flags ); ~View( void ); void SetVideoMode( unsigned short w, unsigned short h, short bpp, unsigned long flags ); void Update( void ); void Update( const Rect &rect ); void Refresh( void ); void Refresh( const Rect &refresh ); void AddWindow( Window *window ); void SelectWindow( Window *window ); Window *CloseWindow( Window *window ); void CloseAllWindows( void ); void DisableUpdates( void ) { allow_updates = false; } void EnableUpdates( void ) { allow_updates = true; } GUI_Status HandleEvents( void ); GUI_Status FetchEvent( SDL_Event &event ); GUI_Status PeekEvent( SDL_Event &event ); void SetEventFilter( GUIEventFilter efilter ) { filter = efilter; } int ToggleFullScreen( void ); bool IsFullScreen( void ) const { return (s_surface->flags & SDL_FULLSCREEN) != 0; } unsigned char ScreenBPP( void ) const { return s_surface->format->BitsPerPixel; } void SetSmallFont( Font *font ) { sfont = font; } void SetLargeFont( Font *font ) { lfont = font; } Font *SmallFont( void ) const { return sfont; } Font *LargeFont( void ) const { return lfont; } void SetSystemIcons( Surface *icons ) { delete sys_icons; sys_icons = icons; } Surface *GetSystemIcons( void ) const { return sys_icons; } void SetFGPen( const Color &fg ) { colors[0] = fg; } void SetBGPen( const Color &bg ) { colors[1] = bg; } const Color &GetFGPen( void ) const { return colors[0]; } const Color &GetBGPen( void ) const { return colors[1]; } private: GUI_Status SystemFilter( const SDL_Event &event ); List windows; Font *sfont, *lfont; // small and large fonts bool allow_updates; Color colors[2]; Surface *sys_icons; GUIEventFilter filter; }; #endif /* _INCLUDE_VIEW_H */ crimson-0.5.2.orig/src/common/widget.cpp0000600000175000017500000003230210554366437016364 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // widget.cpp //////////////////////////////////////////////////////////////////////// #include #include "widget.h" #include "sound.h" #include "misc.h" #include "strutil.h" //////////////////////////////////////////////////////////////////////// // NAME : Widget::Widget // DESCRIPTION: Initialize the widget object. // PARAMETERS : id - widget ID; by default, this ID is returned to // the event handler upon widget activation // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // flags - widget flags (see widget.h for details) // title - widget title, may be NULL, underscore chooses // keystroke // window - window to attach widget to // RETURNS : - //////////////////////////////////////////////////////////////////////// Widget::Widget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ) : Rect( x, y, w, h ), surface(window), key(0), font(NULL), hook(NULL), clicked(false) { this->id = id; this->flags = flags; SetTitle( title ); window->AddWidget( this ); } //////////////////////////////////////////////////////////////////////// // NAME : Widget::Show // DESCRIPTION: Copy the widget to the display surface. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Widget::Show( void ) const { surface->Show( *this ); } //////////////////////////////////////////////////////////////////////// // NAME : Widget::Push // DESCRIPTION: Change the widget state to 'clicked', then redraw and // reblit it to reflect that change graphically. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Widget::Push( void ) { if ( !clicked ) { clicked = true; Draw(); Show(); } } //////////////////////////////////////////////////////////////////////// // NAME : Widget::Release // DESCRIPTION: Change the widget state to 'released', then redraw and // reblit it to reflect that change graphically. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Widget::Release( void ) { clicked = false; Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : Widget::HandleEvent // DESCRIPTION: Distribute system events to the proper handling // functions. // PARAMETERS : event - event received by the (window) event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status Widget::HandleEvent( const SDL_Event &event ) { switch ( event.type ) { case SDL_MOUSEBUTTONDOWN: return MouseDown( event.button ); break; case SDL_MOUSEBUTTONUP: return MouseUp( event.button ); break; case SDL_KEYDOWN: return KeyDown( event.key.keysym ); break; case SDL_KEYUP: return KeyUp( event.key.keysym ); break; case SDL_MOUSEMOTION: return MouseMove( event.motion ); break; default: return GUI_OK; } } //////////////////////////////////////////////////////////////////////// // NAME : Widget::PrintTitle // DESCRIPTION: Draw the widget title to the specified position. // PARAMETERS : xoff - horizontal pixel position // yoff - vertical pixel position // hcol - highlight colour for the keyboard shortcut // RETURNS : - //////////////////////////////////////////////////////////////////////// void Widget::PrintTitle( short xoff, short yoff, const Color &hcol ) const { if ( !title.empty() ) { if ( Disabled() ) font->Write( title.c_str(), surface, xoff, yoff, Color(CF_COLOR_GHOSTED) ); else { font->Write( title.c_str(), surface, xoff, yoff ); // highlight keyboard shortcut if ( key && (keypos != -1) ) { // don't worry about UTF-8 sequences with more than 2 bytes for now short keylen = (title[keypos] & 0x80) ? 2 : 1; xoff += font->TextWidth( title.substr( 0, keypos+keylen ).c_str() ) - font->TextWidth( title.substr( keypos, keylen ).c_str() ); font->Write( title.substr( keypos, keylen ).c_str(), surface, xoff, yoff, hcol ); } } } } //////////////////////////////////////////////////////////////////////// // NAME : Widget::PrintTitle // DESCRIPTION: Draw the widget title to the position requested by the // WIDGET_ALIGN_xxx flags and possibly highlight the // keyboard shortcut. Note: Some widgets may not support // all of the placement flags. // PARAMETERS : hcol - highlight colour for the keyboard shortcut // RETURNS : - //////////////////////////////////////////////////////////////////////// void Widget::PrintTitle( const Color &hcol ) const { if ( !title.empty() ) { unsigned short xoff, yoff; unsigned short tlen = font->TextWidth(title.c_str()); bool within = (flags & (WIDGET_ALIGN_CENTER|WIDGET_ALIGN_WITHIN)) != 0; if ( flags & WIDGET_ALIGN_TOP ) { yoff = y - font->Height() - 4; } else { yoff = y + (h - font->Height()) / 2; } if ( within ) { if ( flags & WIDGET_ALIGN_LEFT ) xoff = x + 4; else if ( flags & WIDGET_ALIGN_RIGHT ) xoff = x + (w - tlen) - 4; else xoff = x + (w - tlen) / 2; if ( Clicked() ) { ++xoff; // slightly displace label ++yoff; } } else { if ( flags & WIDGET_ALIGN_LEFT ) xoff = x - tlen - 4; else if ( flags & WIDGET_ALIGN_RIGHT ) xoff = x + w + 4; else xoff = x + (w - tlen) / 2; surface->DrawBack( xoff, yoff, tlen, font->Height() ); } PrintTitle( xoff, yoff, hcol ); } } //////////////////////////////////////////////////////////////////////// // NAME : Widget::SetTitle // DESCRIPTION: Set the widget title. An underscore character in the // title string designates the following character as the // keyboard shortcut for this widget. // PARAMETERS : str - widget title // RETURNS : - //////////////////////////////////////////////////////////////////////// void Widget::SetTitle( const char *str ) { title.erase(); keypos = -1; if ( str ) { for (int i = 0; str[i] != '\0'; ++i) { if ( str[i] != '_' ) title += str[i]; else if ( str[i+1] != '\0' ) { key = StringUtil::utf8chartoascii( &str[i+1] ); keypos = i; } } } } //////////////////////////////////////////////////////////////////////// // NAME : CompositeWidget::CompositeWidget // DESCRIPTION: Initialize the widget object. // PARAMETERS : id - widget ID; by default, this ID is returned to // the event handler upon widget activation // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // flags - widget flags (see widget.h for details) // title - widget title, may be NULL, underscore chooses // keystroke // window - window to attach widget to // RETURNS : - //////////////////////////////////////////////////////////////////////// CompositeWidget::CompositeWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ) : Widget( id, x, y, w, h, flags, title, window ) {} //////////////////////////////////////////////////////////////////////// // NAME : CompositeWidget::~CompositeWidget // DESCRIPTION: Destroy all components. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// CompositeWidget::~CompositeWidget( void ) { for ( vector::iterator i = components.begin(); i != components.end(); ++i ) delete *i; } //////////////////////////////////////////////////////////////////////// // NAME : CompositeWidget::Draw // DESCRIPTION: Draw all components. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void CompositeWidget::Draw( void ) { for ( vector::iterator i = components.begin(); i != components.end(); ++i ) (*i)->Draw(); } //////////////////////////////////////////////////////////////////////// // NAME : CompositeWidget::MouseDown // DESCRIPTION: Distribute mouse down events to all components. // PARAMETERS : button - button event // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status CompositeWidget::MouseDown( const SDL_MouseButtonEvent &button ) { GUI_Status rc = GUI_OK; for ( vector::iterator i = components.begin(); (i != components.end()) && (rc == GUI_OK); ++i ) { rc = (*i)->MouseDown( button ); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : CompositeWidget::MouseUp // DESCRIPTION: Distribute mouse up events to all components. // PARAMETERS : button - button event // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status CompositeWidget::MouseUp( const SDL_MouseButtonEvent &button ) { GUI_Status rc = GUI_OK; for ( vector::iterator i = components.begin(); (i != components.end()) && (rc == GUI_OK); ++i ) { rc = (*i)->MouseUp( button ); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : CompositeWidget::KeyDown // DESCRIPTION: Distribute key down events to all components. // PARAMETERS : key - key descriptor // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status CompositeWidget::KeyDown( const SDL_keysym &key ) { GUI_Status rc = GUI_OK; for ( vector::iterator i = components.begin(); (i != components.end()) && (rc == GUI_OK); ++i ) { rc = (*i)->KeyDown( key ); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : CompositeWidget::KeyUp // DESCRIPTION: Distribute key up events to all components. // PARAMETERS : key - key descriptor // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status CompositeWidget::KeyUp( const SDL_keysym &key ) { GUI_Status rc = GUI_OK; for ( vector::iterator i = components.begin(); (i != components.end()) && (rc == GUI_OK); ++i ) { rc = (*i)->KeyUp( key ); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : CompositeWidget::MouseMove // DESCRIPTION: Distribute mouse motion events to all components. // PARAMETERS : motion - mouse motion event // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status CompositeWidget::MouseMove( const SDL_MouseMotionEvent &motion ) { GUI_Status rc = GUI_OK; for ( vector::iterator i = components.begin(); (i != components.end()) && (rc == GUI_OK); ++i ) { rc = (*i)->MouseMove( motion ); } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : CompositeWidget::GetWidget // DESCRIPTION: Retrieve a component by its identifier. // PARAMETERS : id - widget identifier // RETURNS : pointer to widget or NULL if not found //////////////////////////////////////////////////////////////////////// Widget *CompositeWidget::GetWidget( short id ) const { for ( vector::const_iterator i = components.begin(); i != components.end(); ++i ) if ( (*i)->ID() == id ) return *i; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : CompositeWidget::RemoveWidget // DESCRIPTION: Remove a component from the widget. // PARAMETERS : w - widget // RETURNS : - //////////////////////////////////////////////////////////////////////// void CompositeWidget::RemoveWidget( Widget *w ) { for ( vector::iterator i = components.begin(); i != components.end(); ++i ) { if ( (*i) == w ) { components.erase( i ); return; } } } crimson-0.5.2.orig/src/common/widget.h0000600000175000017500000001452710554366467016045 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // widget.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_WIDGET_H #define _INCLUDE_WIDGET_H #include #include using namespace std; #include "surface.h" #include "font.h" class Window; // GUI return codes enum GUI_Status { GUI_ERROR = -6, GUI_RESTART, GUI_QUIT, GUI_CLOSE, GUI_NONE, GUI_OK }; // widget flags #define WIDGET_DEFAULT 0x0001 // widget responds to RETURN key #define WIDGET_HIDDEN 0x0002 // widget is not shown and does not receive event messages #define WIDGET_DISABLED 0x0004 // widget is shown, but does not receive event messages #define WIDGET_COMPOSITE 0x0008 // widget is part of a composite widget (not the // CompositeWidget itself) #define WIDGET_ALIGN_CENTER 0x0010 #define WIDGET_ALIGN_LEFT 0x0020 #define WIDGET_ALIGN_RIGHT 0x0040 #define WIDGET_ALIGN_TOP 0x0080 #define WIDGET_ALIGN_WITHIN 0x0100 // must be combined with _LEFT or _RIGHT to be useful // for buttons mostly; some combinations are not allowed (e.g. SUBMENU and GFX) #define WIDGET_STYLE_STD 0x0000 // standard bevelled box #define WIDGET_STYLE_NOBORDER 0x0200 // don't draw widget borders #define WIDGET_STYLE_GFX 0x0400 // use images #define WIDGET_STYLE_MENU 0x0800 // kind of combination of NOBORDER and STD #define WIDGET_STYLE_SUBMENU 0x1000 // display sub-menu indicator #define WIDGET_STYLE_HIGHLIGHT 0x2000 // use highlight instead of background color // for string widgets #define WIDGET_STR_CONST 0x4000 // string in widget cannot be modified #define WIDGET_STR_PASSWORD 0x8000 // display string as asterisks // for scrollers #define WIDGET_HSCROLL 0x1000 // horizontal slider #define WIDGET_VSCROLL 0x2000 // vertical slider #define WIDGET_HSCROLLKEY 0x4000 // scroller supports left/right cursor keys #define WIDGET_VSCROLLKEY 0x8000 // scroller supports up/down cursor keys class WidgetHook; class Widget : public Rect { public: Widget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ); virtual ~Widget( void ) {} short ID( void ) const { return id; } const char *Title( void ) const { return title.c_str(); } Window *GetWindow( void ) const { return surface; } void SetFont( Font *font ) { this->font = font; } void SetID( short id ) { this->id = id; } void SetHook( WidgetHook *hook ) { this->hook = hook; } void SetKey( short key ) { this->key = key; } void SetTitle( const char *title ); void Show( void ) const; virtual void Draw( void ) = 0; void PrintTitle( short xoff, short yoff, const Color &hcol ) const; void PrintTitle( const Color &hcol ) const; virtual void Push( void ); virtual void Release( void ); void Disable( void ) { SetFlags( WIDGET_DISABLED ); } void Enable( void ) { UnsetFlags( WIDGET_DISABLED ); } void Hide( void ) { SetFlags( WIDGET_HIDDEN ); } void Unhide( void ) { UnsetFlags( WIDGET_HIDDEN ); } bool Clicked( void ) const { return clicked; } bool Hidden( void ) const { return (flags & WIDGET_HIDDEN) != 0; } bool Composite( void ) const { return (flags & WIDGET_COMPOSITE) != 0; } bool Disabled( void ) const { return (flags & WIDGET_DISABLED) != 0; } void SetFlags( unsigned short f ) { flags |= f; } void UnsetFlags( unsigned short f ) { flags &= ~f; } GUI_Status HandleEvent( const SDL_Event &event ); virtual GUI_Status MouseDown( const SDL_MouseButtonEvent &button ) { return GUI_OK; } virtual GUI_Status MouseUp( const SDL_MouseButtonEvent &button ) { return GUI_OK; } virtual GUI_Status KeyDown( const SDL_keysym &key ) { return GUI_OK; } virtual GUI_Status KeyUp( const SDL_keysym &key ) { return GUI_OK; } virtual GUI_Status MouseMove( const SDL_MouseMotionEvent &motion ) { return GUI_OK; } void SetSize( short x, short y, unsigned short w, unsigned short h ) { this->x = x; this->y = y; this->w = w; this->h = h; } Widget *next; protected: Window *surface; unsigned short flags; short id; short key; // keystroke to activate widget short keypos; Font *font; string title; WidgetHook *hook; bool clicked; }; // Hook class for widgets. The activate method will be called // whenever a widget is "activated". What this means is up to // the widget class WidgetHook { public: WidgetHook( void ) {} virtual ~WidgetHook( void ) {} virtual GUI_Status WidgetActivated( Widget *widget, Window *win ) = 0; }; // Hook class used to signal aborting in synchronous operations class UserActionHook { public: virtual bool Cancelled( void ) = 0; }; // composite widgets encapsulate several widgets but look and act like // a single widget to the outside class CompositeWidget : public Widget { public: CompositeWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ); ~CompositeWidget( void ); virtual void Draw( void ); virtual GUI_Status MouseDown( const SDL_MouseButtonEvent &button ); virtual GUI_Status MouseUp( const SDL_MouseButtonEvent &button ); virtual GUI_Status KeyDown( const SDL_keysym &key ); virtual GUI_Status KeyUp( const SDL_keysym &key ); virtual GUI_Status MouseMove( const SDL_MouseMotionEvent &motion ); protected: void AddWidget( Widget *w ) { components.push_back( w ); } void RemoveWidget( Widget *w ); Widget *GetWidget( short id ) const; private: vector components; }; #include "window.h" #endif /* _INCLUDE_WIDGET_H */ crimson-0.5.2.orig/src/common/window.cpp0000600000175000017500000002667710554366441016425 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // window.cpp //////////////////////////////////////////////////////////////////////// #include "window.h" //////////////////////////////////////////////////////////////////////// // NAME : Window::Window // DESCRIPTION: Initialize the window. // PARAMETERS : x - left edge of window // y - top edge of window // w - window width // h - window height // flags - window flags (see window.h for details) // view - pointer to the view the window will be put on // RETURNS : - //////////////////////////////////////////////////////////////////////// Window::Window( short x, short y, unsigned short w, unsigned short h, unsigned short flags, View *view ) { Init( flags, view ); SetSize( x, y, w, h ); } //////////////////////////////////////////////////////////////////////// // NAME : Window::Window // DESCRIPTION: Initialize the window without giving a specific size. // If you use this function, you MUST call SetSize() // before trying to draw the window, as this function will // not allocate a surface for it. // PARAMETERS : flags - window flags (see window.h for details) // view - pointer to the view the window will be put on // RETURNS : - //////////////////////////////////////////////////////////////////////// Window::Window( unsigned short flags, View *view ) { Init( flags, view ); } //////////////////////////////////////////////////////////////////////// // NAME : Window::~Window // DESCRIPTION: Destroy the window and release its resources. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Window::~Window( void ) { RemoveAllWidgets(); } //////////////////////////////////////////////////////////////////////// // NAME : Window::Init // DESCRIPTION: Common initializing function for both constructors. // PARAMETERS : flags - window flags (see window.h for details) // view - pointer to the view the window will be put on // RETURNS : - //////////////////////////////////////////////////////////////////////// void Window::Init( unsigned short flags, View *view ) { widgets = NULL; SetSmallFont( view->SmallFont() ); SetLargeFont( view->LargeFont() ); this->view = view; this->flags = flags; view->AddWindow( this ); } //////////////////////////////////////////////////////////////////////// // NAME : Window::SetSize // DESCRIPTION: Set window size and position. These values must be // initialized before trying to draw the window. // PARAMETERS : x - left edge of window // y - top edge of window // w - window width // h - window height // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int Window::SetSize( short x, short y, unsigned short w, unsigned short h ) { int err; this->x = x; this->y = y; err = Create( w, h, view->ScreenBPP(), 0 ); // allocate surface if ( !err && (flags & WIN_CENTER) ) Center( *view ); return err; } //////////////////////////////////////////////////////////////////////// // NAME : Window::SetSize // DESCRIPTION: Same as above, but set window size only and leave the // window position alone. If the WIN_CENTER flag is set, // the window will be recentered, however. // PARAMETERS : w - window width // h - window height // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int Window::SetSize( unsigned short w, unsigned short h ) { return SetSize( x, y, w, h ); } //////////////////////////////////////////////////////////////////////// // NAME : Window::Show // DESCRIPTION: Copy the window surface to the display surface. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Window::Show( void ) { Show( Rect( 0, 0, w, h) ); } //////////////////////////////////////////////////////////////////////// // NAME : Window::Show // DESCRIPTION: Copy part of the window surface to the display surface. // PARAMETERS : rect - rectangle to copy // RETURNS : - //////////////////////////////////////////////////////////////////////// void Window::Show( const Rect &rect ) { view->Refresh( Rect(x + rect.x, y + rect.y, rect.w, rect.h) ); } //////////////////////////////////////////////////////////////////////// // NAME : Window::Draw // DESCRIPTION: Draw the window surface into the internal buffer. To // actually display the window, call Window::Show() // afterwards. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Window::Draw( void ) { DrawBack(); Widget *wd = widgets; while ( wd ) { if ( !wd->Hidden() ) wd->Draw(); wd = wd->next; } } //////////////////////////////////////////////////////////////////////// // NAME : Window::DrawBack // DESCRIPTION: Draw the window background into the internal buffer. // PARAMETERS : rect - area to paint // RETURNS : - //////////////////////////////////////////////////////////////////////// void Window::DrawBack( const Rect &rect ) { const static Image bg( view->GetSystemIcons(), 0, 34, 30, 30 ); Rect clip; FillPattern( rect, bg, 0, 0 ); GetClipRect( clip ); SetClipRect( rect ); DrawBox( Rect(0, 0, w, h), BOX_RAISED ); SetClipRect( clip ); } //////////////////////////////////////////////////////////////////////// // NAME : Window::AddWidget // DESCRIPTION: Attach a widget to the window. This function will set // the widget surface and font. // PARAMETERS : widget - widget to add // RETURNS : - //////////////////////////////////////////////////////////////////////// void Window::AddWidget( Widget *widget ) { widget->SetFont( sfont ); if ( !widget->Composite() ) { widget->next = widgets; widgets = widget; } } //////////////////////////////////////////////////////////////////////// // NAME : Window::RemoveWidget // DESCRIPTION: Remove a widget from the window. // PARAMETERS : widget - widget to remove // RETURNS : pointer to the widget removed //////////////////////////////////////////////////////////////////////// Widget *Window::RemoveWidget( Widget *widget ) { Widget *wd = widgets, **wdptr = &widgets; while ( wd && wd != widget ) { wdptr = &wd->next; wd = wd->next; } if ( wd ) *wdptr = wd->next; return wd; } //////////////////////////////////////////////////////////////////////// // NAME : Window::RemoveAllWidgets // DESCRIPTION: Remove all widgets from the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Window::RemoveAllWidgets( void ) { Widget *wd = widgets; while ( wd ) { Widget *wd2 = wd->next; delete wd; wd = wd2; } widgets = NULL; } //////////////////////////////////////////////////////////////////////// // NAME : Window::HandleEvent // DESCRIPTION: Distribute system events to the window widgets. // PARAMETERS : event - event received by the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status Window::HandleEvent( const SDL_Event &event ) { if ( ((flags & WIN_CLOSE_ESC) && (event.type == SDL_KEYDOWN) && (event.key.keysym.sym == SDLK_ESCAPE)) || ((flags & WIN_CLOSE_UNFOCUS) && (event.type == SDL_MOUSEBUTTONDOWN) && !Contains( event.button.x, event.button.y )) ) return GUI_CLOSE; GUI_Status rc = GUI_OK; Widget *wd = widgets; while ( wd ) { if ( !wd->Hidden() && !wd->Disabled() ) { GUI_Status wrc = wd->HandleEvent( event ); if ( wrc != GUI_OK ) rc = wrc; } wd = wd->next; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Window::EventLoop // DESCRIPTION: Wait for events and distribute them to the widgets. // This function does not return until either an SDL_QUIT // event is received or a widget returns a value other than // GUI_OK. // PARAMETERS : - // RETURNS : GUI status // // NOTE : You MUST make sure that the return value of this // function is handed back to the main event loop. // Otherwise things like the user trying to close the // program window will get lost! If the function returns // GUI_QUIT, GUI_RESTART, or GUI_ERROR do not do any // further processing. // DEPRECATED. Don't use this if you don't have to. // Event propagation doesn't work the way it should. //////////////////////////////////////////////////////////////////////// GUI_Status Window::EventLoop( void ) { SDL_Event event; GUI_Status rc; do { rc = view->FetchEvent( event ); if ( (rc != GUI_QUIT) && (rc != GUI_ERROR) ) rc = HandleEvent( event ); } while ( rc == GUI_OK ); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Window::VideoModeChange // DESCRIPTION: This method is called by the view whenever the video // resolution changes. The window can then adjust itself // to the new dimensions. Afterwards a View::Refresh() is // performed, i. e. the window just needs to reblit its // contents to its internal buffer, and NOT call a view // update itself. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void Window::VideoModeChange( void ) { Rect pos = *this; pos.Align( *view ); pos.Clip( *view ); if ( flags & WIN_CENTER ) pos.Center( *view ); if ( (pos.w != w) || (pos.h != h) ) { SetSize( pos.x, pos.y, pos.w, pos.h ); Draw(); } else { x = pos.x; y = pos.y; } } //////////////////////////////////////////////////////////////////////// // NAME : Window::GetFGPen // DESCRIPTION: Get foreground color. // PARAMETERS : - // RETURNS : foreground color //////////////////////////////////////////////////////////////////////// const Color &Window::GetFGPen( void ) const { return view->GetFGPen(); } //////////////////////////////////////////////////////////////////////// // NAME : Window::GetBGPen // DESCRIPTION: Get background color. // PARAMETERS : - // RETURNS : background color //////////////////////////////////////////////////////////////////////// const Color &Window::GetBGPen( void ) const { return view->GetBGPen(); } crimson-0.5.2.orig/src/common/window.h0000600000175000017500000000663110554366467016066 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // window.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_WINDOW_H #define _INCLUDE_WINDOW_H #include "surface.h" #include "list.h" #include "font.h" #include "widget.h" // window flags #define WIN_CLOSE_ESC 0x0001 // close window on 'ESC' #define WIN_CLOSE_UNFOCUS 0x0002 // close window on clicks outside // the window surface #define WIN_CENTER 0x0004 // center window on screen // flags used by the extended window classes #define WIN_FONT_BIG 0x0010 // use large window font #define WIN_FILE_SAVE 0x0020 // save flag for file window #define WIN_FILE_LOAD 0x0040 // load flag for file window #define WIN_PROG_ABORT 0x0020 // create abort button for progress window #define WIN_PROG_DEFAULT 0x0040 // set WIDGET_DEFAULT for abort button #define WIN_DESTROYED 0x8000 // window has been closed, clean me up! class View; class Window : public Surface, public Node { public: Window( short x, short y, unsigned short w, unsigned short h, unsigned short flags, View *view ); virtual ~Window( void ); virtual void Draw( void ); void DrawBack( const Rect &rect ); virtual void DrawBack( short x, short y, unsigned short w, unsigned short h ) { DrawBack( Rect(x, y, w, h) ); } void DrawBack( void ) { DrawBack( 0, 0, w, h ); } void Show( void ); void Show( const Rect &rect ); int SetSize( unsigned short w, unsigned short h ); int SetSize( short x, short y, unsigned short w, unsigned short h ); int SetSize( const Rect &s ) { return SetSize(s.x, s.y, s.w, s.h); } void AddWidget( Widget *widget ); Widget *RemoveWidget( Widget *widget ); void RemoveAllWidgets( void ); virtual GUI_Status HandleEvent( const SDL_Event &event ); virtual GUI_Status EventLoop( void ); virtual void VideoModeChange( void ); View *GetView( void ) const { return view; } Font *SmallFont( void ) const { return sfont; } Font *LargeFont( void ) const { return lfont; } void SetSmallFont( Font *font ) { sfont = font; } void SetLargeFont( Font *font ) { lfont = font; } const Color &GetFGPen( void ) const; const Color &GetBGPen( void ) const; virtual void Close( void ) { flags |= WIN_DESTROYED; } bool Closed( void ) const { return (flags & WIN_DESTROYED) != 0; } protected: Window( unsigned short flags, View *view ); Widget *widgets; View *view; Font *sfont, *lfont; unsigned short flags; private: void Init( unsigned short flags, View *view ); }; #include "view.h" #endif /* _INCLUDE_WINDOW_H */ crimson-0.5.2.orig/src/comet/0000700000175000017500000000000010730256756014210 5ustar uweuwecrimson-0.5.2.orig/src/comet/Makefile.am0000600000175000017500000000272510527625453016252 0ustar uweuweif BUILD_COMET bin_PROGRAMS = comet endif comet_SOURCES = \ building.cpp building.h \ edwindow.cpp edwindow.h \ eventwindow.cpp eventwindow.h \ extwindow2.cpp extwindow2.h \ gfxwidget.cpp gfxwidget.h \ main.cpp main.h \ map.cpp map.h \ mapgen.cpp mapgen.h \ mission.cpp mission.h \ msgs.h \ uiaux.cpp uiaux.h \ unit.cpp unit.h \ ../common/SDL_zlib.c ../common/SDL_zlib.h \ ../common/button.cpp ../common/button.h \ ../common/color.h \ ../common/extwindow.cpp ../common/extwindow.h \ ../common/fileio.cpp ../common/fileio.h \ ../common/filewindow.cpp ../common/filewindow.h \ ../common/font.cpp ../common/font.h \ ../common/gamedefs.h \ ../common/gamewindow.cpp ../common/gamewindow.h \ ../common/globals.h \ ../common/hexsup.cpp ../common/hexsup.h \ ../common/lang.cpp ../common/lang.h \ ../common/list.cpp ../common/list.h \ ../common/listselect.cpp ../common/listselect.h \ ../common/lset.cpp ../common/lset.h \ ../common/mapview.cpp ../common/mapview.h \ ../common/misc.cpp ../common/misc.h \ ../common/rect.cpp ../common/rect.h \ ../common/slider.cpp ../common/slider.h \ ../common/sound.cpp ../common/sound.h \ ../common/strutil.cpp ../common/strutil.h \ ../common/surface.cpp ../common/surface.h \ ../common/textbox.cpp ../common/textbox.h \ ../common/view.cpp ../common/view.h \ ../common/widget.cpp ../common/widget.h \ ../common/window.cpp ../common/window.h AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir)/src/common LIBS = @LIBS@ @CF_LIBS@ DEFS = @DEFS@ -DCF_DATADIR=\"$(pkgdatadir)/\" crimson-0.5.2.orig/src/comet/Makefile.in0000600000175000017500000015672710730255127016270 0ustar uweuwe# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : @BUILD_COMET_TRUE@bin_PROGRAMS = comet$(EXEEXT) subdir = src/comet DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = am__installdirs = "$(DESTDIR)$(bindir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) PROGRAMS = $(bin_PROGRAMS) am_comet_OBJECTS = building.$(OBJEXT) edwindow.$(OBJEXT) \ eventwindow.$(OBJEXT) extwindow2.$(OBJEXT) gfxwidget.$(OBJEXT) \ main.$(OBJEXT) map.$(OBJEXT) mapgen.$(OBJEXT) \ mission.$(OBJEXT) uiaux.$(OBJEXT) unit.$(OBJEXT) \ SDL_zlib.$(OBJEXT) button.$(OBJEXT) extwindow.$(OBJEXT) \ fileio.$(OBJEXT) filewindow.$(OBJEXT) font.$(OBJEXT) \ gamewindow.$(OBJEXT) hexsup.$(OBJEXT) lang.$(OBJEXT) \ list.$(OBJEXT) listselect.$(OBJEXT) lset.$(OBJEXT) \ mapview.$(OBJEXT) misc.$(OBJEXT) rect.$(OBJEXT) \ slider.$(OBJEXT) sound.$(OBJEXT) strutil.$(OBJEXT) \ surface.$(OBJEXT) textbox.$(OBJEXT) view.$(OBJEXT) \ widget.$(OBJEXT) window.$(OBJEXT) comet_OBJECTS = $(am_comet_OBJECTS) comet_LDADD = $(LDADD) DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(comet_SOURCES) DIST_SOURCES = $(comet_SOURCES) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CF_LIBS = @CF_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ -DCF_DATADIR=\"$(pkgdatadir)/\" DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ @CF_LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ comet_SOURCES = \ building.cpp building.h \ edwindow.cpp edwindow.h \ eventwindow.cpp eventwindow.h \ extwindow2.cpp extwindow2.h \ gfxwidget.cpp gfxwidget.h \ main.cpp main.h \ map.cpp map.h \ mapgen.cpp mapgen.h \ mission.cpp mission.h \ msgs.h \ uiaux.cpp uiaux.h \ unit.cpp unit.h \ ../common/SDL_zlib.c ../common/SDL_zlib.h \ ../common/button.cpp ../common/button.h \ ../common/color.h \ ../common/extwindow.cpp ../common/extwindow.h \ ../common/fileio.cpp ../common/fileio.h \ ../common/filewindow.cpp ../common/filewindow.h \ ../common/font.cpp ../common/font.h \ ../common/gamedefs.h \ ../common/gamewindow.cpp ../common/gamewindow.h \ ../common/globals.h \ ../common/hexsup.cpp ../common/hexsup.h \ ../common/lang.cpp ../common/lang.h \ ../common/list.cpp ../common/list.h \ ../common/listselect.cpp ../common/listselect.h \ ../common/lset.cpp ../common/lset.h \ ../common/mapview.cpp ../common/mapview.h \ ../common/misc.cpp ../common/misc.h \ ../common/rect.cpp ../common/rect.h \ ../common/slider.cpp ../common/slider.h \ ../common/sound.cpp ../common/sound.h \ ../common/strutil.cpp ../common/strutil.h \ ../common/surface.cpp ../common/surface.h \ ../common/textbox.cpp ../common/textbox.h \ ../common/view.cpp ../common/view.h \ ../common/widget.cpp ../common/widget.h \ ../common/window.cpp ../common/window.h AM_CPPFLAGS = -I$(srcdir) -I$(top_srcdir)/src/common all: all-am .SUFFIXES: .SUFFIXES: .c .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign src/comet/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign src/comet/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) comet$(EXEEXT): $(comet_OBJECTS) $(comet_DEPENDENCIES) @rm -f comet$(EXEEXT) $(CXXLINK) $(comet_OBJECTS) $(comet_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SDL_zlib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/building.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/button.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/edwindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eventwindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extwindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/extwindow2.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filewindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/font.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gamewindow.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/gfxwidget.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hexsup.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lang.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listselect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/main.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapgen.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapview.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mission.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/slider.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strutil.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/textbox.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/uiaux.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/view.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/widget.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/window.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` SDL_zlib.o: ../common/SDL_zlib.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT SDL_zlib.o -MD -MP -MF $(DEPDIR)/SDL_zlib.Tpo -c -o SDL_zlib.o `test -f '../common/SDL_zlib.c' || echo '$(srcdir)/'`../common/SDL_zlib.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/SDL_zlib.Tpo $(DEPDIR)/SDL_zlib.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/SDL_zlib.c' object='SDL_zlib.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o SDL_zlib.o `test -f '../common/SDL_zlib.c' || echo '$(srcdir)/'`../common/SDL_zlib.c SDL_zlib.obj: ../common/SDL_zlib.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT SDL_zlib.obj -MD -MP -MF $(DEPDIR)/SDL_zlib.Tpo -c -o SDL_zlib.obj `if test -f '../common/SDL_zlib.c'; then $(CYGPATH_W) '../common/SDL_zlib.c'; else $(CYGPATH_W) '$(srcdir)/../common/SDL_zlib.c'; fi` @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/SDL_zlib.Tpo $(DEPDIR)/SDL_zlib.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../common/SDL_zlib.c' object='SDL_zlib.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o SDL_zlib.obj `if test -f '../common/SDL_zlib.c'; then $(CYGPATH_W) '../common/SDL_zlib.c'; else $(CYGPATH_W) '$(srcdir)/../common/SDL_zlib.c'; fi` .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` button.o: ../common/button.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT button.o -MD -MP -MF $(DEPDIR)/button.Tpo -c -o button.o `test -f '../common/button.cpp' || echo '$(srcdir)/'`../common/button.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/button.Tpo $(DEPDIR)/button.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/button.cpp' object='button.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o button.o `test -f '../common/button.cpp' || echo '$(srcdir)/'`../common/button.cpp button.obj: ../common/button.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT button.obj -MD -MP -MF $(DEPDIR)/button.Tpo -c -o button.obj `if test -f '../common/button.cpp'; then $(CYGPATH_W) '../common/button.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/button.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/button.Tpo $(DEPDIR)/button.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/button.cpp' object='button.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o button.obj `if test -f '../common/button.cpp'; then $(CYGPATH_W) '../common/button.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/button.cpp'; fi` extwindow.o: ../common/extwindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT extwindow.o -MD -MP -MF $(DEPDIR)/extwindow.Tpo -c -o extwindow.o `test -f '../common/extwindow.cpp' || echo '$(srcdir)/'`../common/extwindow.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/extwindow.Tpo $(DEPDIR)/extwindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/extwindow.cpp' object='extwindow.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o extwindow.o `test -f '../common/extwindow.cpp' || echo '$(srcdir)/'`../common/extwindow.cpp extwindow.obj: ../common/extwindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT extwindow.obj -MD -MP -MF $(DEPDIR)/extwindow.Tpo -c -o extwindow.obj `if test -f '../common/extwindow.cpp'; then $(CYGPATH_W) '../common/extwindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/extwindow.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/extwindow.Tpo $(DEPDIR)/extwindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/extwindow.cpp' object='extwindow.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o extwindow.obj `if test -f '../common/extwindow.cpp'; then $(CYGPATH_W) '../common/extwindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/extwindow.cpp'; fi` fileio.o: ../common/fileio.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fileio.o -MD -MP -MF $(DEPDIR)/fileio.Tpo -c -o fileio.o `test -f '../common/fileio.cpp' || echo '$(srcdir)/'`../common/fileio.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/fileio.Tpo $(DEPDIR)/fileio.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/fileio.cpp' object='fileio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fileio.o `test -f '../common/fileio.cpp' || echo '$(srcdir)/'`../common/fileio.cpp fileio.obj: ../common/fileio.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fileio.obj -MD -MP -MF $(DEPDIR)/fileio.Tpo -c -o fileio.obj `if test -f '../common/fileio.cpp'; then $(CYGPATH_W) '../common/fileio.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/fileio.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/fileio.Tpo $(DEPDIR)/fileio.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/fileio.cpp' object='fileio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fileio.obj `if test -f '../common/fileio.cpp'; then $(CYGPATH_W) '../common/fileio.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/fileio.cpp'; fi` filewindow.o: ../common/filewindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT filewindow.o -MD -MP -MF $(DEPDIR)/filewindow.Tpo -c -o filewindow.o `test -f '../common/filewindow.cpp' || echo '$(srcdir)/'`../common/filewindow.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/filewindow.Tpo $(DEPDIR)/filewindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/filewindow.cpp' object='filewindow.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o filewindow.o `test -f '../common/filewindow.cpp' || echo '$(srcdir)/'`../common/filewindow.cpp filewindow.obj: ../common/filewindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT filewindow.obj -MD -MP -MF $(DEPDIR)/filewindow.Tpo -c -o filewindow.obj `if test -f '../common/filewindow.cpp'; then $(CYGPATH_W) '../common/filewindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/filewindow.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/filewindow.Tpo $(DEPDIR)/filewindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/filewindow.cpp' object='filewindow.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o filewindow.obj `if test -f '../common/filewindow.cpp'; then $(CYGPATH_W) '../common/filewindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/filewindow.cpp'; fi` font.o: ../common/font.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT font.o -MD -MP -MF $(DEPDIR)/font.Tpo -c -o font.o `test -f '../common/font.cpp' || echo '$(srcdir)/'`../common/font.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/font.Tpo $(DEPDIR)/font.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/font.cpp' object='font.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o font.o `test -f '../common/font.cpp' || echo '$(srcdir)/'`../common/font.cpp font.obj: ../common/font.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT font.obj -MD -MP -MF $(DEPDIR)/font.Tpo -c -o font.obj `if test -f '../common/font.cpp'; then $(CYGPATH_W) '../common/font.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/font.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/font.Tpo $(DEPDIR)/font.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/font.cpp' object='font.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o font.obj `if test -f '../common/font.cpp'; then $(CYGPATH_W) '../common/font.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/font.cpp'; fi` gamewindow.o: ../common/gamewindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gamewindow.o -MD -MP -MF $(DEPDIR)/gamewindow.Tpo -c -o gamewindow.o `test -f '../common/gamewindow.cpp' || echo '$(srcdir)/'`../common/gamewindow.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/gamewindow.Tpo $(DEPDIR)/gamewindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/gamewindow.cpp' object='gamewindow.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gamewindow.o `test -f '../common/gamewindow.cpp' || echo '$(srcdir)/'`../common/gamewindow.cpp gamewindow.obj: ../common/gamewindow.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT gamewindow.obj -MD -MP -MF $(DEPDIR)/gamewindow.Tpo -c -o gamewindow.obj `if test -f '../common/gamewindow.cpp'; then $(CYGPATH_W) '../common/gamewindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/gamewindow.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/gamewindow.Tpo $(DEPDIR)/gamewindow.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/gamewindow.cpp' object='gamewindow.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o gamewindow.obj `if test -f '../common/gamewindow.cpp'; then $(CYGPATH_W) '../common/gamewindow.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/gamewindow.cpp'; fi` hexsup.o: ../common/hexsup.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT hexsup.o -MD -MP -MF $(DEPDIR)/hexsup.Tpo -c -o hexsup.o `test -f '../common/hexsup.cpp' || echo '$(srcdir)/'`../common/hexsup.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/hexsup.Tpo $(DEPDIR)/hexsup.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/hexsup.cpp' object='hexsup.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o hexsup.o `test -f '../common/hexsup.cpp' || echo '$(srcdir)/'`../common/hexsup.cpp hexsup.obj: ../common/hexsup.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT hexsup.obj -MD -MP -MF $(DEPDIR)/hexsup.Tpo -c -o hexsup.obj `if test -f '../common/hexsup.cpp'; then $(CYGPATH_W) '../common/hexsup.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/hexsup.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/hexsup.Tpo $(DEPDIR)/hexsup.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/hexsup.cpp' object='hexsup.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o hexsup.obj `if test -f '../common/hexsup.cpp'; then $(CYGPATH_W) '../common/hexsup.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/hexsup.cpp'; fi` lang.o: ../common/lang.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lang.o -MD -MP -MF $(DEPDIR)/lang.Tpo -c -o lang.o `test -f '../common/lang.cpp' || echo '$(srcdir)/'`../common/lang.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lang.Tpo $(DEPDIR)/lang.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/lang.cpp' object='lang.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lang.o `test -f '../common/lang.cpp' || echo '$(srcdir)/'`../common/lang.cpp lang.obj: ../common/lang.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lang.obj -MD -MP -MF $(DEPDIR)/lang.Tpo -c -o lang.obj `if test -f '../common/lang.cpp'; then $(CYGPATH_W) '../common/lang.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/lang.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lang.Tpo $(DEPDIR)/lang.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/lang.cpp' object='lang.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lang.obj `if test -f '../common/lang.cpp'; then $(CYGPATH_W) '../common/lang.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/lang.cpp'; fi` list.o: ../common/list.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.o -MD -MP -MF $(DEPDIR)/list.Tpo -c -o list.o `test -f '../common/list.cpp' || echo '$(srcdir)/'`../common/list.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/list.Tpo $(DEPDIR)/list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/list.cpp' object='list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.o `test -f '../common/list.cpp' || echo '$(srcdir)/'`../common/list.cpp list.obj: ../common/list.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.obj -MD -MP -MF $(DEPDIR)/list.Tpo -c -o list.obj `if test -f '../common/list.cpp'; then $(CYGPATH_W) '../common/list.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/list.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/list.Tpo $(DEPDIR)/list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/list.cpp' object='list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.obj `if test -f '../common/list.cpp'; then $(CYGPATH_W) '../common/list.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/list.cpp'; fi` listselect.o: ../common/listselect.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT listselect.o -MD -MP -MF $(DEPDIR)/listselect.Tpo -c -o listselect.o `test -f '../common/listselect.cpp' || echo '$(srcdir)/'`../common/listselect.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/listselect.Tpo $(DEPDIR)/listselect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/listselect.cpp' object='listselect.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o listselect.o `test -f '../common/listselect.cpp' || echo '$(srcdir)/'`../common/listselect.cpp listselect.obj: ../common/listselect.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT listselect.obj -MD -MP -MF $(DEPDIR)/listselect.Tpo -c -o listselect.obj `if test -f '../common/listselect.cpp'; then $(CYGPATH_W) '../common/listselect.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/listselect.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/listselect.Tpo $(DEPDIR)/listselect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/listselect.cpp' object='listselect.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o listselect.obj `if test -f '../common/listselect.cpp'; then $(CYGPATH_W) '../common/listselect.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/listselect.cpp'; fi` lset.o: ../common/lset.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lset.o -MD -MP -MF $(DEPDIR)/lset.Tpo -c -o lset.o `test -f '../common/lset.cpp' || echo '$(srcdir)/'`../common/lset.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lset.Tpo $(DEPDIR)/lset.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/lset.cpp' object='lset.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lset.o `test -f '../common/lset.cpp' || echo '$(srcdir)/'`../common/lset.cpp lset.obj: ../common/lset.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lset.obj -MD -MP -MF $(DEPDIR)/lset.Tpo -c -o lset.obj `if test -f '../common/lset.cpp'; then $(CYGPATH_W) '../common/lset.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/lset.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lset.Tpo $(DEPDIR)/lset.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/lset.cpp' object='lset.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lset.obj `if test -f '../common/lset.cpp'; then $(CYGPATH_W) '../common/lset.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/lset.cpp'; fi` mapview.o: ../common/mapview.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mapview.o -MD -MP -MF $(DEPDIR)/mapview.Tpo -c -o mapview.o `test -f '../common/mapview.cpp' || echo '$(srcdir)/'`../common/mapview.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/mapview.Tpo $(DEPDIR)/mapview.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/mapview.cpp' object='mapview.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mapview.o `test -f '../common/mapview.cpp' || echo '$(srcdir)/'`../common/mapview.cpp mapview.obj: ../common/mapview.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mapview.obj -MD -MP -MF $(DEPDIR)/mapview.Tpo -c -o mapview.obj `if test -f '../common/mapview.cpp'; then $(CYGPATH_W) '../common/mapview.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/mapview.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/mapview.Tpo $(DEPDIR)/mapview.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/mapview.cpp' object='mapview.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mapview.obj `if test -f '../common/mapview.cpp'; then $(CYGPATH_W) '../common/mapview.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/mapview.cpp'; fi` misc.o: ../common/misc.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT misc.o -MD -MP -MF $(DEPDIR)/misc.Tpo -c -o misc.o `test -f '../common/misc.cpp' || echo '$(srcdir)/'`../common/misc.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/misc.Tpo $(DEPDIR)/misc.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/misc.cpp' object='misc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o misc.o `test -f '../common/misc.cpp' || echo '$(srcdir)/'`../common/misc.cpp misc.obj: ../common/misc.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT misc.obj -MD -MP -MF $(DEPDIR)/misc.Tpo -c -o misc.obj `if test -f '../common/misc.cpp'; then $(CYGPATH_W) '../common/misc.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/misc.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/misc.Tpo $(DEPDIR)/misc.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/misc.cpp' object='misc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o misc.obj `if test -f '../common/misc.cpp'; then $(CYGPATH_W) '../common/misc.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/misc.cpp'; fi` rect.o: ../common/rect.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT rect.o -MD -MP -MF $(DEPDIR)/rect.Tpo -c -o rect.o `test -f '../common/rect.cpp' || echo '$(srcdir)/'`../common/rect.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/rect.Tpo $(DEPDIR)/rect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/rect.cpp' object='rect.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o rect.o `test -f '../common/rect.cpp' || echo '$(srcdir)/'`../common/rect.cpp rect.obj: ../common/rect.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT rect.obj -MD -MP -MF $(DEPDIR)/rect.Tpo -c -o rect.obj `if test -f '../common/rect.cpp'; then $(CYGPATH_W) '../common/rect.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/rect.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/rect.Tpo $(DEPDIR)/rect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/rect.cpp' object='rect.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o rect.obj `if test -f '../common/rect.cpp'; then $(CYGPATH_W) '../common/rect.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/rect.cpp'; fi` slider.o: ../common/slider.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT slider.o -MD -MP -MF $(DEPDIR)/slider.Tpo -c -o slider.o `test -f '../common/slider.cpp' || echo '$(srcdir)/'`../common/slider.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/slider.Tpo $(DEPDIR)/slider.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/slider.cpp' object='slider.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o slider.o `test -f '../common/slider.cpp' || echo '$(srcdir)/'`../common/slider.cpp slider.obj: ../common/slider.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT slider.obj -MD -MP -MF $(DEPDIR)/slider.Tpo -c -o slider.obj `if test -f '../common/slider.cpp'; then $(CYGPATH_W) '../common/slider.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/slider.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/slider.Tpo $(DEPDIR)/slider.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/slider.cpp' object='slider.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o slider.obj `if test -f '../common/slider.cpp'; then $(CYGPATH_W) '../common/slider.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/slider.cpp'; fi` sound.o: ../common/sound.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sound.o -MD -MP -MF $(DEPDIR)/sound.Tpo -c -o sound.o `test -f '../common/sound.cpp' || echo '$(srcdir)/'`../common/sound.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/sound.Tpo $(DEPDIR)/sound.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/sound.cpp' object='sound.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sound.o `test -f '../common/sound.cpp' || echo '$(srcdir)/'`../common/sound.cpp sound.obj: ../common/sound.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sound.obj -MD -MP -MF $(DEPDIR)/sound.Tpo -c -o sound.obj `if test -f '../common/sound.cpp'; then $(CYGPATH_W) '../common/sound.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/sound.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/sound.Tpo $(DEPDIR)/sound.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/sound.cpp' object='sound.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sound.obj `if test -f '../common/sound.cpp'; then $(CYGPATH_W) '../common/sound.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/sound.cpp'; fi` strutil.o: ../common/strutil.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT strutil.o -MD -MP -MF $(DEPDIR)/strutil.Tpo -c -o strutil.o `test -f '../common/strutil.cpp' || echo '$(srcdir)/'`../common/strutil.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/strutil.Tpo $(DEPDIR)/strutil.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/strutil.cpp' object='strutil.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o strutil.o `test -f '../common/strutil.cpp' || echo '$(srcdir)/'`../common/strutil.cpp strutil.obj: ../common/strutil.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT strutil.obj -MD -MP -MF $(DEPDIR)/strutil.Tpo -c -o strutil.obj `if test -f '../common/strutil.cpp'; then $(CYGPATH_W) '../common/strutil.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/strutil.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/strutil.Tpo $(DEPDIR)/strutil.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/strutil.cpp' object='strutil.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o strutil.obj `if test -f '../common/strutil.cpp'; then $(CYGPATH_W) '../common/strutil.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/strutil.cpp'; fi` surface.o: ../common/surface.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface.o -MD -MP -MF $(DEPDIR)/surface.Tpo -c -o surface.o `test -f '../common/surface.cpp' || echo '$(srcdir)/'`../common/surface.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/surface.Tpo $(DEPDIR)/surface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/surface.cpp' object='surface.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface.o `test -f '../common/surface.cpp' || echo '$(srcdir)/'`../common/surface.cpp surface.obj: ../common/surface.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface.obj -MD -MP -MF $(DEPDIR)/surface.Tpo -c -o surface.obj `if test -f '../common/surface.cpp'; then $(CYGPATH_W) '../common/surface.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/surface.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/surface.Tpo $(DEPDIR)/surface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/surface.cpp' object='surface.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface.obj `if test -f '../common/surface.cpp'; then $(CYGPATH_W) '../common/surface.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/surface.cpp'; fi` textbox.o: ../common/textbox.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT textbox.o -MD -MP -MF $(DEPDIR)/textbox.Tpo -c -o textbox.o `test -f '../common/textbox.cpp' || echo '$(srcdir)/'`../common/textbox.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/textbox.Tpo $(DEPDIR)/textbox.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/textbox.cpp' object='textbox.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o textbox.o `test -f '../common/textbox.cpp' || echo '$(srcdir)/'`../common/textbox.cpp textbox.obj: ../common/textbox.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT textbox.obj -MD -MP -MF $(DEPDIR)/textbox.Tpo -c -o textbox.obj `if test -f '../common/textbox.cpp'; then $(CYGPATH_W) '../common/textbox.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/textbox.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/textbox.Tpo $(DEPDIR)/textbox.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/textbox.cpp' object='textbox.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o textbox.obj `if test -f '../common/textbox.cpp'; then $(CYGPATH_W) '../common/textbox.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/textbox.cpp'; fi` view.o: ../common/view.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT view.o -MD -MP -MF $(DEPDIR)/view.Tpo -c -o view.o `test -f '../common/view.cpp' || echo '$(srcdir)/'`../common/view.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/view.Tpo $(DEPDIR)/view.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/view.cpp' object='view.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o view.o `test -f '../common/view.cpp' || echo '$(srcdir)/'`../common/view.cpp view.obj: ../common/view.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT view.obj -MD -MP -MF $(DEPDIR)/view.Tpo -c -o view.obj `if test -f '../common/view.cpp'; then $(CYGPATH_W) '../common/view.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/view.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/view.Tpo $(DEPDIR)/view.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/view.cpp' object='view.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o view.obj `if test -f '../common/view.cpp'; then $(CYGPATH_W) '../common/view.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/view.cpp'; fi` widget.o: ../common/widget.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT widget.o -MD -MP -MF $(DEPDIR)/widget.Tpo -c -o widget.o `test -f '../common/widget.cpp' || echo '$(srcdir)/'`../common/widget.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/widget.Tpo $(DEPDIR)/widget.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/widget.cpp' object='widget.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o widget.o `test -f '../common/widget.cpp' || echo '$(srcdir)/'`../common/widget.cpp widget.obj: ../common/widget.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT widget.obj -MD -MP -MF $(DEPDIR)/widget.Tpo -c -o widget.obj `if test -f '../common/widget.cpp'; then $(CYGPATH_W) '../common/widget.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/widget.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/widget.Tpo $(DEPDIR)/widget.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/widget.cpp' object='widget.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o widget.obj `if test -f '../common/widget.cpp'; then $(CYGPATH_W) '../common/widget.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/widget.cpp'; fi` window.o: ../common/window.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT window.o -MD -MP -MF $(DEPDIR)/window.Tpo -c -o window.o `test -f '../common/window.cpp' || echo '$(srcdir)/'`../common/window.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/window.Tpo $(DEPDIR)/window.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/window.cpp' object='window.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o window.o `test -f '../common/window.cpp' || echo '$(srcdir)/'`../common/window.cpp window.obj: ../common/window.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT window.obj -MD -MP -MF $(DEPDIR)/window.Tpo -c -o window.obj `if test -f '../common/window.cpp'; then $(CYGPATH_W) '../common/window.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/window.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/window.Tpo $(DEPDIR)/window.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../common/window.cpp' object='window.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o window.obj `if test -f '../common/window.cpp'; then $(CYGPATH_W) '../common/window.cpp'; else $(CYGPATH_W) '$(srcdir)/../common/window.cpp'; fi` ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) installdirs: for dir in "$(DESTDIR)$(bindir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-exec-am: install-binPROGRAMS install-html: install-html-am install-info: install-info-am install-man: install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic ctags distclean distclean-compile \ distclean-generic distclean-tags distdir dvi dvi-am html \ html-am info info-am install install-am install-binPROGRAMS \ install-data install-data-am install-dvi install-dvi-am \ install-exec install-exec-am install-html install-html-am \ install-info install-info-am install-man install-pdf \ install-pdf-am install-ps install-ps-am install-strip \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic pdf pdf-am ps ps-am tags uninstall \ uninstall-am uninstall-binPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: crimson-0.5.2.orig/src/comet/building.cpp0000600000175000017500000001044510554366425016516 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // building.cpp //////////////////////////////////////////////////////////////////////// #include "building.h" //////////////////////////////////////////////////////////////////////// // NAME : Building::Building // DESCRIPTION: Create a new building. // PARAMETERS : pos - position on map // id - building indentifier // pid - identifier of controlling player // RETURNS : - //////////////////////////////////////////////////////////////////////// Building::Building( const Point &pos, unsigned short id, unsigned char pid ) : MapObject( MO_BUILDING ) { b_id = id; b_pos = pos; b_flags = BLD_WORKSHOP; b_crystals = 0; b_maxcrystals = 1000; b_uprod = 0; b_cprod = 0; b_pid = pid; b_minweight = 0; b_maxweight = 99; b_name_id = -1; b_name = 0; } //////////////////////////////////////////////////////////////////////// // NAME : Building::Load // DESCRIPTION: Load a building definition from a file. // PARAMETERS : file - data file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Building::Load( MemBuffer &file ) { b_id = file.Read16(); b_pos.x = file.Read16(); b_pos.y = file.Read16(); b_flags = file.Read16(); b_crystals = file.Read16(); b_maxcrystals = file.Read16(); b_uprod = file.Read32(); b_cprod = file.Read8(); b_pid = file.Read8(); b_minweight = file.Read8(); b_maxweight = file.Read8(); b_name_id = file.Read8(); b_name = 0; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Building::Save // DESCRIPTION: Save the building to a file. // PARAMETERS : file - save file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Building::Save( MemBuffer &file ) const { file.Write16( b_id ); file.Write16( b_pos.x ); file.Write16( b_pos.y ); file.Write16( b_flags ); file.Write16( b_crystals ); file.Write16( b_maxcrystals ); file.Write32( b_uprod ); file.Write8( b_cprod ); file.Write8( b_pid ); file.Write8( b_minweight ); file.Write8( b_maxweight ); file.Write8( b_name_id ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Building::Export // DESCRIPTION: Save the building to a plain text file. // PARAMETERS : file - save file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Building::Export( ofstream &file, const UnitSet *uset ) const { file << "[building]\n"; file << "name = " << (short)b_name_id << '\n'; file << "player = " << (b_pid+1)%3 << '\n'; file << "id = " << b_id << '\n'; file << "pos = " << b_pos.x << '/' << b_pos.y << '\n'; if ( (b_flags & BLD_WORKSHOP) != 0 ) file << "type = workshop\n"; if ( (b_flags & BLD_FACTORY) != 0 ) { file << "type = factory\n"; for ( int i = 0; i < uset->NumTiles(); ++i ) { if ( ((1< 0; } unsigned char CrystalProduction( void ) const { return b_cprod; } unsigned short Crystals( void ) const { return b_crystals; } unsigned short MaxCrystals( void ) const { return b_maxcrystals; } unsigned short ID( void ) const { return b_id; } signed char NameID( void ) const { return b_name_id; } const char *Name( void ) const { return b_name; } unsigned char Owner( void ) const { return b_pid; } const Point &Position( void ) const { return b_pos; } unsigned short MinWeight( void ) const { return b_minweight; } unsigned short MaxWeight( void ) const { return b_maxweight; } void SetMinWeight( unsigned short w ) { b_minweight = w; } void SetMaxWeight( unsigned short w ) { b_maxweight = w; } unsigned long UnitProduction( void ) const { return b_uprod; } bool CanProduce( unsigned short utid ) const { return (UnitProduction() & (1 << utid)) != 0; } void SetID( unsigned short id ) { b_id = id; } void SetNameID( signed char name ) { b_name_id = name; } void SetName( const char *name ) { b_name = name; } void SetPosition( const Point &pos ) { b_pos = pos; } void SetOwner( unsigned char player ) { b_pid = player; } void SetCrystalProduction( unsigned char crystals ) { b_cprod = crystals; } void SetCrystals( unsigned short crystals ) { b_crystals = crystals; } void SetMaxCrystals( unsigned short crystals ) { b_maxcrystals = crystals; } void SetUnitProduction( unsigned long unitmask ) { b_uprod = unitmask; } void SetFlags( unsigned short flags ) { b_flags |= flags; } void UnsetFlags( unsigned short flags ) { b_flags &= ~(flags); } private: Point b_pos; unsigned short b_id; unsigned short b_flags; unsigned short b_crystals; // amount of crystals on hold unsigned short b_maxcrystals; // maximum amount of crystals that can be stored unsigned long b_uprod; // unit types that can be built for factories unsigned char b_cprod; // crystal production per turn for mines unsigned char b_minweight; // minimum unit weight allowed unsigned char b_maxweight; // maximum unit weight allowed unsigned char b_pid; signed char b_name_id; const char *b_name; }; #endif // _INCLUDE_ED_BUILDING_H crimson-0.5.2.orig/src/comet/edwindow.cpp0000600000175000017500000005645310554366425016552 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // edwindow.cpp //////////////////////////////////////////////////////////////////////// #include "edwindow.h" #include "extwindow.h" #include "extwindow2.h" #include "gamewindow.h" #include "filewindow.h" #include "gfxwidget.h" #include "fileio.h" #include "strutil.h" #include "main.h" //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::EdWindow // DESCRIPTION: Create the editing window. // PARAMETERS : mapdir - directory containing the map files // view - pointer to the view to use // RETURNS : - //////////////////////////////////////////////////////////////////////// EdWindow::EdWindow( const string &mapdir, View *view ) : Window( view->x, view->y, view->w, view->h, 0, view ), mission(NULL), panel( view->w - DEFAULT_TILE_WIDTH * 4 - DEFAULT_SLIDER_SIZE - 20, view->y, DEFAULT_TILE_WIDTH * 4 + DEFAULT_SLIDER_SIZE + 20, view->h ), mv( this, Rect( DEFAULT_SLIDER_SIZE, 0, w - panel.w - DEFAULT_SLIDER_SIZE, h - DEFAULT_SLIDER_SIZE), MV_DISABLE|MV_DISABLE_FOG ), mode(ED_MODE_VIEW), selected(-1), mapdir(mapdir) { unsigned short height = MIN( DEFAULT_TILE_HEIGHT * 6 + 4, h / 3 - 10 ); unit_wd = new UnitWidget( L_ID_UNITS, panel.x + 5, panel.y + panel.h - 6 - height, panel.w - 10, height, 0, NULL, this, NULL ); unit_wd->SetHook( this ); tile_wd = new TileWidget( L_ID_TILES, unit_wd->x, panel.y + sfont->Height() + 15, unit_wd->w, panel.h - height - sfont->Height() - 30, 0, NULL, this, NULL ); tile_wd->SetHook( this ); ud_wd = new SliderWidget( S_ID_VERT, 0, 0, DEFAULT_SLIDER_SIZE, mv.Height(), 0, 0, 0, 1, WIDGET_VSCROLL, NULL, this ); ud_wd->SetHook( this ); lr_wd = new SliderWidget( S_ID_HORIZ, DEFAULT_SLIDER_SIZE, h - DEFAULT_SLIDER_SIZE, mv.Width(), DEFAULT_SLIDER_SIZE, 0, 0, 0, 1, WIDGET_HSCROLL, NULL, this ); lr_wd->SetHook( this ); } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::~EdWindow // DESCRIPTION: Delete the editing window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// EdWindow::~EdWindow( void ) { delete mission; } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::Draw // DESCRIPTION: Draw the editing window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdWindow::Draw( void ) { mv.Draw(); DrawBack( panel ); DrawBox( panel, BOX_RAISED ); Widget *wd = widgets; while ( wd ) { if ( !wd->Hidden() ) wd->Draw(); wd = wd->next; } PrintCursorPos(); } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::PrintCursorPos // DESCRIPTION: Print current cursor position to the panel. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdWindow::PrintCursorPos( void ) { Rect coord( panel.x + 5, panel.y + 5, panel.w - 10, sfont->Height() ); char posbuf[16]; DrawBack( coord ); if ( mission ) { sprintf( posbuf, "X/Y: %d/%d", mv.Cursor().x, mv.Cursor().y ); sfont->Write( posbuf, this, coord.x, coord.y ); MapObject *obj = mission->GetMap().GetMapObject( mv.Cursor() ); if ( obj && obj->Name() ) { string name = StringUtil::strprintf( "(%s)", obj->Name() ); sfont->WriteEllipsis( name.c_str(), this, coord.x + sfont->TextWidth( posbuf ) + 5, coord.y, coord ); } } } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::HandleEvent // DESCRIPTION: React on user input. // PARAMETERS : event - event received by the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdWindow::HandleEvent( const SDL_Event &event ) { if ( !mission ) { if ( event.type == SDL_KEYDOWN ) ShowContextMenu( Point(-1, -1) ); else if ( event.type == SDL_MOUSEBUTTONDOWN ) ShowContextMenu( Point(event.button.x - x, event.button.y - y) ); return GUI_OK; } GUI_Status rc = Window::HandleEvent( event ); if ( rc == GUI_OK ) { // check for keyboard commands if ( event.type == SDL_KEYDOWN ) { switch ( event.key.keysym.sym ) { case SDLK_KP1: case SDLK_KP2: case SDLK_KP3: case SDLK_KP4: case SDLK_KP6: case SDLK_KP7: case SDLK_KP8: case SDLK_KP9: case SDLK_LEFT: case SDLK_RIGHT: case SDLK_UP: case SDLK_DOWN: MoveCursor( event.key.keysym.sym ); break; case SDLK_SPACE: // equivalent to left mouse button LeftMouseButton( mv.Cursor() ); break; case SDLK_q: Quit(); break; case SDLK_ESCAPE: tile_wd->Select( -1 ); unit_wd->Select( -1 ); break; case SDLK_RETURN: ShowContextMenu( mv.Cursor() ); case SDLK_u: { // edit unit Unit *u = mv.GetMap()->GetUnit( mv.Cursor() ); if ( u ) { EdUnitWindow *euw = new EdUnitWindow( *u, *mission, view ); euw->SetMapView( mv ); } break; } case SDLK_b: { // edit building Building *b = mv.GetMap()->GetBuilding( mv.Cursor() ); if ( b ) new EdBuildingWindow( *b, *mission, view ); break; } default: break; } } else if ( event.type == SDL_MOUSEBUTTONDOWN ) { Point pos; bool validhex = !mv.Pixel2Hex( event.button.x - x, event.button.y - y, pos ); if ( event.button.button == SDL_BUTTON_LEFT ) { if ( validhex ) LeftMouseButton( pos ); } else if ( event.button.button == SDL_BUTTON_RIGHT ) { ShowContextMenu( validhex ? pos : Point(-1,-1) ); } } else if ( event.type == SDL_MOUSEMOTION ) { // handle just like a mouse button if LMB is down and // user is terraforming if ( (mode == ED_MODE_TERRAIN) && (event.motion.state & SDL_BUTTON( SDL_BUTTON_LEFT )) && !ud_wd->Clicked() && !lr_wd->Clicked() ) { Point pos; if ( !mv.Pixel2Hex( event.motion.x, event.motion.y, pos ) ) LeftMouseButton( pos ); } } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::MoveCursor // DESCRIPTION: Move the cursor in reaction to a key event. // PARAMETERS : key - the key code used to give the order // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdWindow::MoveCursor( int key ) { Direction dir; switch ( key ) { case SDLK_KP1: dir = SOUTHWEST; break; case SDLK_DOWN: case SDLK_KP2: dir = SOUTH; break; case SDLK_KP3: dir = SOUTHEAST; break; case SDLK_KP7: dir = NORTHWEST; break; case SDLK_UP: case SDLK_KP8: dir = NORTH; break; case SDLK_KP9: dir = NORTHEAST; break; case SDLK_LEFT: case SDLK_KP4: dir = WEST; break; case SDLK_RIGHT: case SDLK_KP6: dir = EAST; break; default: return; } Point dest; if ( !mv.GetMap()->Dir2Hex( mv.Cursor(), dir, dest ) ) SetCursor( dest ); } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::SetCursor // DESCRIPTION: Set the cursor to a new hex on the map. Contrary to the // low-level function in MapView this updates the display // at the old and new position if necessary. // PARAMETERS : cursor - new cursor position // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdWindow::SetCursor( const Point &cursor ) { Rect upd; if ( mv.CursorEnabled() ) { upd = mv.SetCursor( Point(-1,-1) ); // disable cursor for hex update Show( upd ); // update previous cursor position } upd = mv.SetCursor( cursor ); Show( upd ); PrintCursorPos(); Show( panel ); } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::LeftMouseButton // DESCRIPTION: Left mouse button has been pressed. See what we can do. // PARAMETERS : hex - hex the button was clicked over // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdWindow::LeftMouseButton( const Point &hex ) { Map *map = mv.GetMap(); if ( mode == ED_MODE_TERRAIN ) { if ( map->IsBuilding( hex ) && map->GetBuilding(hex) && !(map->GetTerrainSet()->GetTerrainInfo(selected)->tt_type & TT_ENTRANCE) ) new NoteWindow( "Warning", "You have just removed a shop entrance. " "The corresponding shop has NOT been deleted! " "(to do so restore the entrance and delete the shop before " "erasing the entrance)", 0, view ); map->SetHexType( hex, selected ); } else if ( mode == ED_MODE_UNIT ) { if ( map->GetMapObject(hex) ) new NoteWindow( "Error", "Hex occupied.", 0, view ); else { UnitSet *us = map->GetUnitSet(); const UnitType *ut = us->GetUnitInfo( selected < us->NumTiles() ? selected : selected - us->NumTiles() ); mission->CreateUnit( ut, selected < us->NumTiles() ? PLAYER_ONE : PLAYER_TWO, hex ); } } SetCursor( hex ); } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::LoadMission // DESCRIPTION: Load a mission from file and attach it to the display. // PARAMETERS : file - name of mission data file // filereq - pop up file requester // RETURNS : pointer to Mission object on success, NULL on error //////////////////////////////////////////////////////////////////////// Mission *EdWindow::LoadMission( const char *file, bool filereq ) { string fn; Mission *ms = NULL; if ( filereq ) fn = GetFileName( file, ".lev", mapdir, WIN_FILE_LOAD ); else fn = file; if ( fn.length() > 0 ) { ms = new Mission(); if ( ms ) { int err = ms->Load( fn.c_str() ); if ( err ) { delete ms; new NoteWindow( "Error", "Couldn't load map. This could be a file type mismatch.", 0, view ); } else { SetNewMission( ms ); } } } return ms; } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::SaveMission // DESCRIPTION: Save a mission to file. // PARAMETERS : file - name of mission data file // filereq - pop up file requester // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdWindow::SaveMission( const char *file, bool filereq ) { string fn; GUI_Status rc = GUI_OK; if ( filereq ) fn = GetFileName( file, ".lev", mapdir, WIN_FILE_SAVE ); else fn = file; if ( fn.length() > 0 ) { if ( mission->Save( fn.c_str() ) != 0 ) { new NoteWindow( "Error", "Could not save mission!", WIN_CENTER, view ); } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::ExportMission // DESCRIPTION: Save a mission to a plain text file. // PARAMETERS : file - default name of mission data file // filereq - pop up file requester // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdWindow::ExportMission( const char *file, bool filereq ) { string fn; GUI_Status rc = GUI_OK; if ( filereq ) fn = GetFileName( file, ".src", mapdir, WIN_FILE_SAVE ); else fn = file; if ( fn.length() > 0 ) mission->Export( fn.c_str() ); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::GetFileName // DESCRIPTION: Get the name of a file to load or to save to. Pop up a // file requester. // PARAMETERS : filename - default filename // suffix - filename suffix // dirname - name of directory to look in // flag - WIN_FILE_LOAD or WIN_FILE_SAVE // RETURNS : file name or empty string on error //////////////////////////////////////////////////////////////////////// string EdWindow::GetFileName( const char *filename, const char *suffix, const string &dirname, int flag ) const { string file( filename ); if ( file.length() > 0 ) file.append( suffix ); bool filesel; do { GUI_Status rc; DialogWindow *dw; bool done = false; FileWindow *fw = new FileWindow( dirname.c_str(), file.c_str(), suffix, flag, view ); fw->ok->SetID( 1 ); fw->cancel->SetID( 0 ); do { filesel = false; rc = fw->EventLoop(); if ( rc == 1 ) { file = fw->GetFile(); if ( file.length() != 0 ) { view->CloseWindow( fw ); done = true; } } else if ( rc == 0 ) { view->CloseWindow( fw ); file.assign( "" ); done = true; } } while ( !done ); if ( file.length() > 0 && (flag == WIN_FILE_SAVE) && File::Exists( file ) ) { // if file exists let user confirm the write char *conmsg = new char[ file.length() + 20 ]; strcpy( conmsg, file.c_str() ); strcat( conmsg, " exists. Overwrite?" ); dw = new DialogWindow( NULL, conmsg, "_Yes|_No", 1, 0, view ); dw->SetButtonID( 0, 1 ); dw->SetButtonID( 1, 0 ); rc = dw->EventLoop(); view->CloseWindow( dw ); if ( rc == 0 ) { filesel = true; file = file_part( file ); } delete [] conmsg; } } while ( filesel ); return file; } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::WidgetActivated // DESCRIPTION: This method is called when the user selects one of the // widgets associated with this window - the tiles or units // list, the map scrollers, or one of a number of buttons // including the main menu. // PARAMETERS : widget - pointer to calling widget // win - parent window of calling widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdWindow::WidgetActivated( Widget *widget, Window *win ) { GUI_Status rc = GUI_OK; if ( win == this ) { switch ( widget->ID() ) { case L_ID_UNITS: if ( unit_wd->Selected() == -1 ) { if ( tile_wd->Selected() == -1 ) { mode = ED_MODE_VIEW; selected = -1; } } else { mode = ED_MODE_UNIT; selected = unit_wd->Selected(); tile_wd->Select( -1 ); } break; case L_ID_TILES: if ( tile_wd->Selected() == -1 ) { if ( unit_wd->Selected() == -1 ) { mode = ED_MODE_VIEW; selected = -1; } } else { mode = ED_MODE_TERRAIN; selected = tile_wd->Selected(); unit_wd->Select( -1 ); } break; case S_ID_VERT: { Point offset = mv.GetOffsets(); mv.Scroll( 0, ud_wd->Level() - offset.y ); Show( mv ); break; } case S_ID_HORIZ: { Point offset = mv.GetOffsets(); mv.Scroll( lr_wd->Level() - offset.x, 0 ); Show( mv ); break; } } } else { Map *map = mv.GetMap(); // context menu? if ( widget->ID() >= B_ID_TILE_GRAB ) static_cast(win)->CloseParent(); view->CloseWindow(win); switch ( widget->ID() ) { case B_ID_NEW: { NewMissionWindow *nmw = new NewMissionWindow( view ); nmw->SetHook( this, B_ID_NEW_MISSION_OK ); break; } case B_ID_LOAD: LoadMission( "", true ); break; case B_ID_SAVE: rc = SaveMission( mission->GetTitle().c_str(), true ); break; case B_ID_EXPORT: rc = ExportMission( mission->GetTitle().c_str(), true ); break; case B_ID_VALIDATE: ValidateMission(); break; case B_ID_SETTINGS: new EdMissionSetupWindow( *mission, view ); break; case B_ID_QUIT: Quit(); break; case B_ID_TILE_GRAB: tile_wd->Select( map->HexTypeID(selected_hex) ); break; case B_ID_TILE_SWAP: SwapTiles( map->HexTypeID(selected_hex), selected ); break; case B_ID_UNIT_INFO: new UnitInfoWindow( map->GetUnit( selected_hex )->Type()->ID(), *map, view ); break; case B_ID_UNIT_EDIT: { EdUnitWindow *euw = new EdUnitWindow( *(map->GetUnit( selected_hex )), *mission, view ); euw->SetMapView( mv ); break; } case B_ID_UNIT_DEL: mission->DeleteUnit( map->GetUnit(selected_hex) ); Show( mv.UpdateHex( selected_hex ) ); PrintCursorPos(); Show( panel ); break; case B_ID_BLD_CREATE: mission->CreateBuilding( PLAYER_ONE, selected_hex ); // fall through case B_ID_BLD_EDIT: new EdBuildingWindow( *(map->GetBuilding( selected_hex )), *mission, view ); break; case B_ID_BLD_DEL: mission->DeleteBuilding( map->GetBuilding( selected_hex ) ); PrintCursorPos(); Show( panel ); break; case B_ID_EVENTS: new EdEventsWindow( *mission, view ); break; case B_ID_MESSAGES: new EdMsgWindow( mission->GetMessages(), view ); break; case B_ID_NEW_MISSION_OK: { NewMissionWindow *nmw = static_cast(win); if ( nmw->GetMission() ) SetNewMission( nmw->GetMission() ); break; } } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::Quit // DESCRIPTION: Ask user for confirmation and leave the editor. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdWindow::Quit( void ) const { DialogWindow *req = new DialogWindow( NULL, "Do you really want to quit?", "_Yes|_No", 1, 0, view ); req->SetButtonID( 0, GUI_QUIT ); } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::ShowContextMenu // DESCRIPTION: Open a pop-up menu with with context-dependent options. // PARAMETERS : clicked - hex coordinates of the mouse click or -1,-1 if // no specific hex was selected // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdWindow::ShowContextMenu( const Point &clicked ) { MenuWindow *menu = new MenuWindow( PROGRAMNAME, this, view ); if ( mission ) { if ( clicked != Point(-1,-1) ) { Map *map = mv.GetMap(); Unit *u = map->GetUnit( clicked ); selected_hex = clicked; // tile sub-menu menu->AddMenu( 0, 0, "_Tile" ); menu->AddItem( 1, B_ID_TILE_GRAB, 0, "_Grab" ); menu->AddItem( 1, B_ID_TILE_SWAP, (mode == ED_MODE_TERRAIN ? 0 : WIDGET_DISABLED), "_Swap" ); if ( u ) { // unit sub-menu menu->AddMenu( 0, 0, "_Unit" ); menu->AddItem( 1, B_ID_UNIT_INFO, 0, "_Info" ); menu->AddItem( 1, B_ID_UNIT_EDIT, 0, "_Edit..." ); menu->AddItem( 1, B_ID_UNIT_DEL, 0, "_Delete" ); } if ( map->IsBuilding( clicked ) ) { Building *b = map->GetBuilding( clicked ); menu->AddMenu( 0, 0, "_Building" ); if ( b ) { menu->AddItem( 1, B_ID_BLD_EDIT, 0, "_Edit..." ); menu->AddItem( 1, B_ID_BLD_DEL, 0, "_Delete" ); } else menu->AddItem( 1, B_ID_BLD_CREATE, 0, "_Create..." ); } } menu->AddItem( 0, B_ID_EVENTS, 0, "_Events..." ); menu->AddItem( 0, B_ID_MESSAGES, 0, "_Messages..." ); menu->AddBar( 0 ); } // file ops menu->AddMenu( 0, 0, "_Project" ); menu->AddItem( 1, B_ID_NEW, 0, "_New..." ); menu->AddItem( 1, B_ID_LOAD, 0, "_Load..." ); menu->AddItem( 1, B_ID_SAVE, (mission ? 0 : WIDGET_DISABLED), "_Save..." ); menu->AddItem( 1, B_ID_EXPORT, (mission ? 0 : WIDGET_DISABLED), "_Export..." ); menu->AddItem( 1, B_ID_VALIDATE, (mission ? 0 : WIDGET_DISABLED), "_Validate" ); menu->AddItem( 1, B_ID_SETTINGS, (mission ? 0 : WIDGET_DISABLED), "Se_ttings" ); menu->AddItem( 1, B_ID_QUIT, 0, "_Quit..." ); menu->Layout(); } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::SwapTiles // DESCRIPTION: Replace each occurence of one tile on the map with // another tile. // PARAMETERS : t1 - identifier of the tiles to be replaced // t2 - identifier of the tiles to replace t1 // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdWindow::SwapTiles( unsigned short t1, unsigned short t2 ) { Map *map = mv.GetMap(); Point p; for ( p.y = 0; p.y < map->Height(); ++p.y ) { for ( p.x = 0; p.x < map->Width(); ++p.x ) { if ( map->HexTypeID(p) == t1 ) map->SetHexType( p, t2 ); } } mv.Draw(); Show( mv ); } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::ValidateMission // DESCRIPTION: Check mission integrity. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdWindow::ValidateMission( void ) const { stringstream msg; if ( mission->Validate( msg ) > 0 ) { new MessageWindow( "Validation Results", msg.str().c_str(), view ); } else { new NoteWindow( "Validation successful", "No errors or warnings have been detected.", 0, view ); } } //////////////////////////////////////////////////////////////////////// // NAME : EdWindow::SetNewMission // DESCRIPTION: Change the current mission. // PARAMETERS : ms - new mission // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdWindow::SetNewMission( Mission *ms ) { delete mission; mv.Disable(); mode = ED_MODE_VIEW; mission = ms; Map &map = mission->GetMap(); mv.SetMap( &map ); mv.SetCursor( Point(0,0) ); tile_wd->SetTerrainSet( map.GetTerrainSet() ); unit_wd->SetUnitSet( map.GetUnitSet() ); short max = MAX( map.Height() * mv.TileHeight() + mv.TileShiftY() - mv.Height(), 0 ); ud_wd->Adjust( 0, max, mv.Height() ); ud_wd->ScrollTo( 0 ); max = MAX( map.Width() * (mv.TileWidth() - mv.TileShiftX()) + mv.TileShiftX() - mv.Width(), 0 ); lr_wd->Adjust( 0, max, mv.Width() ); lr_wd->ScrollTo( 0 ); mv.Enable(); Draw(); Show(); } crimson-0.5.2.orig/src/comet/edwindow.h0000600000175000017500000000556310554366467016221 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ////////////////////////////////////////////////////////////// // edwindow.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_ED_EDWINDOW_H #define _INCLUDE_ED_EDWINDOW_H #include "window.h" #include "mapview.h" #include "mission.h" #include "gfxwidget.h" #include "button.h" #define ED_MODE_TERRAIN 1 #define ED_MODE_UNIT 2 #define ED_MODE_VIEW 3 class EdWindow : public Window, public WidgetHook { public: EdWindow( const string &mapdir, View *view ); ~EdWindow( void ); MapView &GetMapView( void ) { return mv; } void Draw( void ); GUI_Status HandleEvent( const SDL_Event &event ); void Quit( void ) const; void MoveCursor( int key ); void SetCursor( const Point &cursor ); Mission *LoadMission( const char *file, bool filereq ); GUI_Status SaveMission( const char *file, bool filereq ); GUI_Status ExportMission( const char *file, bool filereq ); string GetFileName( const char *filename, const char *suffix, const string &dirname, int flag ) const; private: GUI_Status WidgetActivated( Widget *widget, Window *win ); void LeftMouseButton( const Point &hex ); void ShowContextMenu( const Point &clicked ); void PrintCursorPos( void ); void SwapTiles( unsigned short t1, unsigned short t2 ); void ValidateMission( void ) const; void SetNewMission( Mission *ms ); enum { L_ID_UNITS = 0, L_ID_TILES, S_ID_VERT, S_ID_HORIZ, B_ID_NEW_MISSION_OK, // button ids for the context menu below B_ID_TILE_GRAB, B_ID_TILE_SWAP, B_ID_UNIT_INFO, B_ID_UNIT_EDIT, B_ID_UNIT_DEL, B_ID_BLD_CREATE, B_ID_BLD_EDIT, B_ID_BLD_DEL, B_ID_EVENTS, B_ID_MESSAGES, B_ID_NEW, B_ID_LOAD, B_ID_SAVE, B_ID_EXPORT, B_ID_VALIDATE, B_ID_SETTINGS, B_ID_QUIT }; Mission *mission; Rect panel; MapView mv; unsigned char mode; short selected; Point selected_hex; TileWidget *tile_wd; UnitWidget *unit_wd; SliderWidget *ud_wd; // up/down SliderWidget *lr_wd; // left/right string mapdir; }; #endif // _INCLUDE_ED_EDWINDOW_H crimson-0.5.2.orig/src/comet/eventwindow.cpp0000600000175000017500000020634110554366425017274 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // eventwindow.cpp /////////////////////////////////////////////////////////////////////// #include "eventwindow.h" #include "extwindow.h" #include "extwindow2.h" #include "uiaux.h" extern const char *player2_labels[]; extern const char *dir_labels[]; extern const char *size_labels[]; extern const char *xp_labels[]; static const char *uselect_labels[] = { "Single Unit", "Unit Type", 0 }; //////////////////////////////////////////////////////////////////////// // NAME : EdEventGenericWindow::EdEventGenericWindow // DESCRIPTION: This window allows modification of the fields common to // all event types, and also offers links to event-specific // options. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventGenericWindow::EdEventGenericWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { // calculate dimensions SetSize( MIN(sfont->Width() * 35 + 20, view->Width()), MIN(sfont->Height() * 12 + 125, view->Height()) ); unsigned short wdh = sfont->Height() + 8, wdx, wdy = 5; Widget *wd; char buf[48] = ""; wd = new NumberWidget( 0, sfont->Width() * 2 + 10, wdy, sfont->Width() * 6, wdh, event.ID(), 0, 32767, WIDGET_STR_CONST|WIDGET_ALIGN_LEFT, "ID", this ); wdx = wd->LeftEdge() + wd->Width() + sfont->TextWidth("Player") + 10; wd = new CheckboxWidget( B_ID_DISABLED, w - 5 - DEFAULT_CBW_SIZE, wdy + (wdh - DEFAULT_CBW_SIZE)/2, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, event.Flags() & EFLAG_DISABLED, WIDGET_STYLE_GFX|WIDGET_STYLE_NOBORDER|WIDGET_ALIGN_LEFT, "_Disabled", this ); wd->SetHook( this ); wd = new CycleWidget( B_ID_PLAYER, wdx, wdy, wd->LeftEdge() - wdx - 15 - sfont->TextWidth("Disabled"), wdh, 0, "_Player", event.Player(), player2_labels, this ); wd->SetHook( this ); wdy += wd->Height() + 5; wd = new ButtonWidget( B_ID_TITLE, 5, wdy, sfont->Width() * 9 + 10, wdh, 0, "Msg _Title", this ); wd->SetHook( this ); wdx = wd->LeftEdge() + wd->Width() + 5; e_title = new StringWidget( 0, wdx, wdy, w - wdx - 5, wdh, (mission.GetMessage(event.Title()) ? mission.GetMessage(event.Title()) : ""), 30, WIDGET_STR_CONST, NULL, this ); wdy += wd->Height() + 5; wd = new ButtonWidget( B_ID_MSG, 5, wdy, w - 10, wdh, 0, "Set Event _Message", this ); wd->SetHook( this ); wdy += wd->Height() + 5; e_msg = new TextScrollWidget( 0, 5, wdy, w - 10, sfont->Height() * 5, (mission.GetMessage(event.Message()) ? mission.GetMessage(event.Message()) : ""), 0, NULL, this ); wdy += e_msg->Height() + 5; wd = new ButtonWidget( B_ID_TRIGGER, 5, wdy, sfont->Width() * 12 + 10, wdh, 0, "Edit T_rigger", this ); wd->SetHook( this ); wdy += wd->Height() + 5; wd = new ButtonWidget( B_ID_EVENT, 5, wdy, wd->Width(), wdh, 0, "Edit _Event", this ); wd->SetHook( this ); wdy += wd->Height() + 5; wd = new ButtonWidget( B_ID_DEPEND, 5, wdy, wd->Width(), wdh, 0, "Depends o_n", this ); wd->SetHook( this ); wdx = wd->LeftEdge() + wd->Width() + 5; if ( event.Dependency() >= 0 ) { Event *e = mission.GetEventByID( event.Dependency() ); if ( e ) sprintf( buf, "%s (%d)", e->Name(), e->ID() ); } e_depends = new StringWidget( 0, wdx, wdy, w - wdx - 5, wdh, buf, 47, WIDGET_STR_CONST, NULL, this ); wdy += wd->Height() + 5; wd = new ButtonWidget( B_ID_DISCARD, 5, wdy, wd->Width(), wdh, 0, "D_iscards", this ); wd->SetHook( this ); buf[0] = '\0'; if ( event.Discard() >= 0 ) { Event *e = mission.GetEventByID( event.Discard() ); if ( e ) sprintf( buf, "%s (%d)", e->Name(), e->ID() ); } e_discards = new StringWidget( 0, wdx, wdy, e_depends->Width(), wdh, buf, 47, WIDGET_STR_CONST, NULL, this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventGenericWindow::Draw // DESCRIPTION: Draw the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdEventGenericWindow::Draw( void ) { Window::Draw(); unsigned short lblx = sfont->Width() * 12 + 20, lbly = e_msg->TopEdge() + e_msg->Height() + 9; sfont->Write( ':', this, lblx, lbly ); sfont->Write( event.TriggerName(), this, lblx + sfont->Width() * 2, lbly ); lbly += sfont->Height() + 13; sfont->Write( ':', this, lblx, lbly ); sfont->Write( event.Name(), this, lblx + sfont->Width() * 2, lbly ); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventGenericWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the button // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventGenericWindow::WidgetActivated( Widget *widget, Window *win ) { TLWNode *n; switch ( widget->ID() ) { case B_ID_TITLE: TLWListBuilder::BuildMsgList( mission.GetMessages(), tlist ); new ListSelectWindow( "Select event title", tlist, event.Title(), true, this, B_ID_TITLE_OK, view ); break; case B_ID_TITLE_OK: n = static_cast(win)->Selected(); event.SetTitle( n ? n->ID() : -1 ); e_title->SetString( n ? n->Name() : NULL, true ); tlist.Clear(); break; case B_ID_MSG: TLWListBuilder::BuildMsgList( mission.GetMessages(), tlist ); new ListSelectWindow( "Select event message", tlist, event.Message(), true, this, B_ID_MSG_OK, view ); break; case B_ID_MSG_OK: n = static_cast(win)->Selected(); event.SetMessage( n ? n->ID() : -1 ); e_msg->SetText( n ? mission.GetMessage(n->ID()) : NULL ); e_msg->Draw(); e_msg->Show(); tlist.Clear(); break; case B_ID_DEPEND: TLWListBuilder::BuildEventList( mission.GetEvents(), tlist ); new ListSelectWindow( "Select event", tlist, event.Dependency(), true, this, B_ID_DEPEND_OK, view ); break; case B_ID_DEPEND_OK: n = static_cast(win)->Selected(); event.SetDependency( n ? n->ID() : -1 ); e_depends->SetString( n ? n->Name() : NULL ); tlist.Clear(); break; case B_ID_DISCARD: TLWListBuilder::BuildEventList( mission.GetEvents(), tlist ); new ListSelectWindow( "Select event", tlist, event.Discard(), true, this, B_ID_DISCARD_OK, view ); break; case B_ID_DISCARD_OK: n = static_cast(win)->Selected(); event.SetDiscard( n ? n->ID() : -1 ); e_discards->SetString( n ? n->Name() : NULL ); tlist.Clear(); break; case B_ID_TRIGGER: switch ( event.Trigger() ) { case ETRIGGER_HAVE_BUILDING: new EdTrigHaveShopWindow( event, mission, view ); break; case ETRIGGER_HAVE_CRYSTALS: new EdTrigHaveCrystalsWindow( event, mission, view ); break; case ETRIGGER_HAVE_UNIT: new EdTrigHaveUnitWindow( event, mission, view ); break; case ETRIGGER_TIMER: new EdTrigTimerWindow( event, view ); break; case ETRIGGER_UNIT_DESTROYED: new EdTrigUnitDestroyedWindow( event, mission, view ); break; case ETRIGGER_UNIT_POSITION: new EdTrigUnitPositionWindow( event, mission, view ); break; case ETRIGGER_HANDICAP: new EdTrigHandicapWindow( event, view ); break; default: new NoteWindow("Sorry", "Not yet implemented", 0, view); } break; case B_ID_EVENT: switch ( event.Type() ) { case EVENT_CONFIGURE: new EdEventConfigureWindow( event, mission, view ); break; case EVENT_CREATE_UNIT: new EdEventCreateUnitWindow( event, mission, view ); break; case EVENT_DESTROY_UNIT: new EdEventDestroyUnitWindow( event, mission, view ); break; case EVENT_MANIPULATE_EVENT: new EdEventManipEventWindow( event, mission, view ); break; case EVENT_MESSAGE: new EdEventMessageWindow( event, mission, view ); break; case EVENT_MINING: new EdEventMiningWindow( event, mission, view ); break; case EVENT_RESEARCH: new EdEventResearchWindow( event, mission, view ); break; case EVENT_SCORE: new EdEventScoreWindow( event, mission, view ); break; case EVENT_SET_HEX: new EdEventSetHexWindow( event, mission, view ); break; case EVENT_SET_TIMER: new EdEventSetTimerWindow( event, mission, view ); break; default: new NoteWindow("Sorry", "Not yet implemented", 0, view); } break; case B_ID_PLAYER: event.SetPlayer( static_cast(widget)->GetValue() ); break; case B_ID_DISABLED: event.ToggleFlags( EFLAG_DISABLED ); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventConfigureWindow::EdEventConfigureWindow // DESCRIPTION: This window allows configuration of a NEXT_MAP event. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventConfigureWindow::EdEventConfigureWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { static const char *setting_labels[] = { "Briefing Player 1", "Briefing Player 2", "Next Map", 0 }; SetSize( MIN(sfont->Width() * 20 + 15, view->Width()), sfont->Height() * 3 + 40 ); unsigned short wdh = sfont->Height() + 8, wdx; Widget *wd; wdx = 10 + sfont->TextWidth( "Setting" ); wd = new CycleWidget( B_ID_SETTING, wdx, 5, w - 5 - wdx, wdh, 0, "_Setting", event.GetData(0), setting_labels, this ); wd->SetHook( this ); e_msg_but = new ButtonWidget( B_ID_MSG, 5, wd->TopEdge() + wd->Height() + 5, sfont->Width() * 7 + 10, wdh, event.GetData(0) == 2 ? WIDGET_DISABLED : 0, "_Message", this ); e_msg_but->SetHook( this ); wdx = e_msg_but->LeftEdge() + e_msg_but->Width() + 5; e_msg = new StringWidget( S_ID_VALUE, wdx, e_msg_but->TopEdge(), w - wdx - 5, wdh, GetValueString(), 30, event.GetData(0) == 2 ? 0 : WIDGET_STR_CONST, NULL, this ); e_msg->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventConfigureWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventConfigureWindow::WidgetActivated( Widget *widget, Window *win ) { switch( widget->ID() ) { case B_ID_SETTING: event.SetData( 0, static_cast(widget)->GetValue() ); if ( event.GetData(0) == 2 ) { e_msg_but->Disable(); e_msg->UnsetFlags( WIDGET_STR_CONST ); } else { e_msg_but->Enable(); e_msg->SetFlags( WIDGET_STR_CONST ); } e_msg->SetString( GetValueString() ); Draw(); Show(); break; case B_ID_MSG: TLWListBuilder::BuildMsgList( mission.GetMessages(), tlist ); new ListSelectWindow( "Select message", tlist, event.GetData(1), false, this, B_ID_MSG_OK, view ); break; case B_ID_MSG_OK: { TLWNode *n = static_cast(win)->Selected(); event.SetData( 1, n ? n->ID() : -1 ); e_msg->SetString( n ? n->Name() : "" ); tlist.Clear(); } break; case S_ID_VALUE: event.SetTmpBuf( e_msg->String() ? e_msg->String() : "" ); break; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventConfigureWindow::GetValueString // DESCRIPTION: Get the string representation of the "value" parameter // that should be shown to the user. // PARAMETERS : - // RETURNS : display string //////////////////////////////////////////////////////////////////////// const char *EdEventConfigureWindow::GetValueString( void ) const { const char *ret = NULL; switch (event.GetData(0) ) { case 0: case 1: ret = mission.GetMessage(event.GetData(1)); break; case 2: if ( event.GetTmpBuf() != "" ) ret = event.GetTmpBuf().c_str(); break; } return ( ret == NULL ) ? "" : ret; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventCreateUnitWindow::EdEventCreateUnitWindow // DESCRIPTION: This window allows configuration of a CREATE_UNIT // event. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventCreateUnitWindow::EdEventCreateUnitWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { SetSize( MIN(sfont->Width() * 30 + 15, view->Width()), sfont->Height() * 4 + 50 ); Widget *wd; unsigned short wdx, wdh = sfont->Height() + 8; Point loc = mission.GetMap().Index2Hex( event.GetData(1) ); wd = new ButtonWidget( B_ID_UNIT, 5, 5, sfont->Width() * 4 + 10, wdh, 0, "_Unit", this ); wd->SetHook( this ); wdx = wd->LeftEdge() + wd->Width() + 5; e_unit = new StringWidget( 0, wdx, 5, w - wdx - 5, wdh, mission.GetUnitSet().GetUnitInfo(event.GetData(0))->Name(), 30, WIDGET_STR_CONST, NULL, this ); wdx = 10 + sfont->TextWidth( "X" ); wd = new NumberWidget( N_ID_XPOS, wdx, wd->TopEdge() + wdh + 5, sfont->Width() * 4 + 10, wdh, loc.x, 0, mission.GetMap().Width() - 1, WIDGET_ALIGN_LEFT, "_X", this ); wd->SetHook( this ); wdx += wd->Width() + 10 + sfont->TextWidth( "Y" ); wd = new NumberWidget( N_ID_YPOS, wdx, wd->TopEdge(), wd->Width(), wdh, loc.y, 0, mission.GetMap().Height() - 1, WIDGET_ALIGN_LEFT, "_Y", this ); wd->SetHook( this ); wdx += wd->Width() + 10 + sfont->TextWidth( "Direction" ); wd = new CycleWidget( B_ID_DIRECTION, wdx, wd->TopEdge(), w - 5 - wdx, wdh, 0, "_Direction", event.GetData(2) & 0x07, dir_labels, this ); wd->SetHook( this ); wdx = 10 + sfont->TextWidth("Squad Size"); wd = new CycleWidget( B_ID_SIZE, wdx, wd->TopEdge() + wd->Height() + 5, w/2 - 5 - wdx, wdh, 0, "Squad _Size", ((event.GetData(2) & 0x38) >> 3) - 1, size_labels, this ); wd->SetHook( this ); wdx += wd->Width() + sfont->TextWidth("XP Level") + 10; wd = new CycleWidget( B_ID_XP, wdx, wd->TopEdge(), w - 5 - wdx, wdh, 0, "XP _Level", (event.GetData(2) & 0x1C0) >> 6, xp_labels, this ); wd->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventCreateUnitWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventCreateUnitWindow::WidgetActivated( Widget *widget, Window *win ) { TLWNode *n; switch( widget->ID() ) { case B_ID_UNIT: TLWListBuilder::BuildUnitTypesList( mission.GetUnitSet(), tlist ); new ListSelectWindow( "Select unit", tlist, event.GetData(0), false, this, B_ID_UNIT_OK, view ); break; case B_ID_UNIT_OK: n = static_cast(win)->Selected(); event.SetData( 0, n ? n->ID() : -1 ); e_unit->SetString( n ? n->Name() : "Error" ); tlist.Clear(); break; case N_ID_XPOS: case N_ID_YPOS: { Point loc = mission.GetMap().Index2Hex( event.GetData(1) ); if ( widget->ID() == N_ID_XPOS ) loc.x = static_cast(widget)->Number(); else loc.y = static_cast(widget)->Number(); event.SetData( 1, mission.GetMap().Hex2Index(loc) ); break; } case B_ID_DIRECTION: event.SetData( 2, (event.GetData(2) & ~0x0007) | static_cast(widget)->GetValue() ); break; case B_ID_SIZE: event.SetData( 2, (event.GetData(2) & ~0x0038) | ((static_cast(widget)->GetValue() + 1) << 3) ); break; case B_ID_XP: event.SetData( 2, (event.GetData(2) & ~0x01C0) | (static_cast(widget)->GetValue() << 6) ); break; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventDestroyUnitWindow::EdEventDestroyUnitWindow // DESCRIPTION: This window allows configuration of a DESTROY_UNIT // event. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventDestroyUnitWindow::EdEventDestroyUnitWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { SetSize( MIN(sfont->Width() * 30 + 15, view->Width()), sfont->Height() * 5 + 60 ); Widget *wd; unsigned short wdx, wdh = sfont->Height() + 8; char buf[32] = "Any"; static const char *player_labels[] = { "Any", "One", "Two", 0 }; Point loc; wd = new ButtonWidget( B_ID_UNIT, 5, 5, sfont->Width() * 4 + 10, wdh, 0, "_Unit", this ); wd->SetHook( this ); Unit *u = mission.GetUnitByID( event.GetData(0) ); if ( u ) { sprintf( buf, "%s (%d)", u->Name(), u->ID() ); loc = Point(0, 0); } else { loc = mission.GetMap().Index2Hex( event.GetData(2) ); } wdx = wd->LeftEdge() + wd->Width() + 5; e_unit = new StringWidget( 0, wdx, 5, w - wdx - 5, wdh, buf, 30, WIDGET_STR_CONST, NULL, this ); wdx = 10 + sfont->TextWidth( "X" ); e_xpos = new NumberWidget( N_ID_XPOS, wdx, wd->TopEdge() + wdh + 5, sfont->Width() * 4 + 10, wdh, loc.x, 0, mission.GetMap().Width() - 1, WIDGET_ALIGN_LEFT|(u ? WIDGET_DISABLED : 0), "_X", this ); e_xpos->SetHook( this ); wdx += wd->Width() + 10 + sfont->TextWidth( "Y" ); e_ypos = new NumberWidget( N_ID_YPOS, wdx, e_xpos->TopEdge(), e_xpos->Width(), wdh, loc.y, 0, mission.GetMap().Height() - 1, WIDGET_ALIGN_LEFT|(u ? WIDGET_DISABLED : 0), "_Y", this ); e_ypos->SetHook( this ); wdx = sfont->Width() * 20 + 10; wd = new CycleWidget( B_ID_PLAYER, wdx, e_ypos->TopEdge() + wdh + 10, w - wdx - 5, wdh, 0, "Controlled by _Player", event.GetData(1) + 1, player_labels, this ); wd->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventDestroyUnitWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventDestroyUnitWindow::WidgetActivated( Widget *widget, Window *win ) { switch( widget->ID() ) { case B_ID_UNIT: TLWListBuilder::BuildUnitList( mission.GetUnits(), tlist ); new ListSelectWindow( "Select unit", tlist, event.GetData(0), true, this, B_ID_UNIT_OK, view ); break; case B_ID_UNIT_OK: { TLWNode *n = static_cast(win)->Selected(); if ( n ) { event.SetData( 0, n->ID() ); event.SetData( 2, 0 ); e_unit->SetString( n->Name() ); e_xpos->SetNumber( 0 ); e_ypos->SetNumber( 0 ); e_xpos->Disable(); e_ypos->Disable(); } else { event.SetData( 0, -1 ); e_unit->SetString( "Any" ); e_xpos->Enable(); e_ypos->Enable(); } e_xpos->Draw(); e_ypos->Draw(); e_xpos->Show(); e_ypos->Show(); tlist.Clear(); break; } case B_ID_PLAYER: event.SetData( 1, static_cast(widget)->GetValue() - 1 ); break; case N_ID_XPOS: case N_ID_YPOS: { Point loc = mission.GetMap().Index2Hex( event.GetData(2) ); if ( widget->ID() == N_ID_XPOS ) loc.x = static_cast(widget)->Number(); else loc.y = static_cast(widget)->Number(); event.SetData( 2, mission.GetMap().Hex2Index(loc) ); break; } } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventManipEventWindow::EdEventManipEventWindow // DESCRIPTION: This window allows configuration of a MANIPULATE_EVENT // event. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventManipEventWindow::EdEventManipEventWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { static const char *action_labels[] = { "Set flags", "Clear flags", "Toggle flags", 0 }; SetSize( MIN(sfont->Width() * 25 + 15, view->Width()), sfont->Height() * 4 + 50 ); Widget *wd; unsigned short wdx, wdy, wdh = sfont->Height() + 8; char buf[48] = "Error"; wd = new ButtonWidget( B_ID_EVENT, 5, 5, sfont->Width() * 5 + 10, wdh, 0, "_Event", this ); wd->SetHook( this ); Event *e = mission.GetEventByID( event.GetData(0) ); if ( e ) sprintf( buf, "%s (%d)", e->Name(), e->ID() ); wdx = wd->LeftEdge() + wd->Width() + 5; e_event = new StringWidget( 0, wdx, 5, w - wdx - 5, wdh, buf, 30, WIDGET_STR_CONST, NULL, this ); wdx = sfont->Width() * 6 + 10; wdy = wdh + 10; wd = new CycleWidget( B_ID_ACTION, wdx, wdy, w - wdx - 5, wdh, 0, "_Action", event.GetData(2), action_labels, this ); wd->SetHook( this ); wdx = w - 10 - DEFAULT_CBW_SIZE; wdy += wdh + 5; wd = new CheckboxWidget( B_ID_DISABLED, wdx, wdy, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, event.GetData(1) & EFLAG_DISABLED, WIDGET_STYLE_GFX|WIDGET_STYLE_NOBORDER|WIDGET_ALIGN_LEFT, "_Disabled", this ); wd->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); TLWListBuilder::BuildEventList( mission.GetEvents(), tlist ); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventManipEventWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventManipEventWindow::WidgetActivated( Widget *widget, Window *win ) { switch( widget->ID() ) { case B_ID_EVENT: new ListSelectWindow( "Select event", tlist, event.GetData(0), false, this, B_ID_EVENT_OK, view ); break; case B_ID_EVENT_OK: { TLWNode *n = static_cast(win)->Selected(); event.SetData( 0, n ? n->ID() : -1 ); e_event->SetString( n ? n->Name() : "Error" ); break; } case B_ID_ACTION: event.SetData( 2, static_cast(widget)->GetValue() ); break; case B_ID_DISABLED: event.SetData( 1, event.GetData(1)^EFLAG_DISABLED ); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventMessageWindow::EdEventMessageWindow // DESCRIPTION: This window allows configuration of a MESSAGE event. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventMessageWindow::EdEventMessageWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { SetSize( MIN(sfont->Width() * 15 + 15, view->Width()), sfont->Height() * 2 + 25 ); unsigned short wdx, wdh = sfont->Height() + 8; Point loc = mission.GetMap().Index2Hex( event.GetData(0) ); wdx = 10 + sfont->TextWidth( "X" ); e_xpos = new NumberWidget( 0, wdx, 5, sfont->Width() * 4 + 10, wdh, loc.x, -1, mission.GetMap().Width() - 1, WIDGET_ALIGN_LEFT, "_X", this ); wdx += e_xpos->Width() + 10 + sfont->TextWidth( "Y" ); e_ypos = new NumberWidget( 0, wdx, e_xpos->TopEdge(), e_xpos->Width(), wdh, loc.y, -1, mission.GetMap().Height() - 1, WIDGET_ALIGN_LEFT, "_Y", this ); ButtonWidget *wd = new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); wd->SetHook( this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventMessageWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventMessageWindow::WidgetActivated( Widget *widget, Window *win ) { Point loc( e_xpos->Number(), e_ypos->Number() ); short idx = ((loc.x >= 0) && (loc.y >= 0)) ? mission.GetMap().Hex2Index(loc) : -1; event.SetData( 0, idx ); return GUI_CLOSE; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventMiningWindow::EdEventMiningWindow // DESCRIPTION: This window allows configuration of a MINING event. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventMiningWindow::EdEventMiningWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { static const char *action_labels[] = { "Set supplies", "Modify supplies", "Set production", "Modify production", 0 }; SetSize( MIN(sfont->Width() * 30 + 15, view->Width()), sfont->Height() * 4 + 50 ); Widget *wd; unsigned short wdx, wdy, wdh = sfont->Height() + 8; wd = new ButtonWidget( B_ID_MINE, 5, 5, sfont->Width() * 6, wdh, 0, "_Mine", this ); wd->SetHook( this ); wdx = wd->LeftEdge() + wd->Width() + 5; Building *b = mission.GetBuildingByID( event.GetData(0) ); e_mine = new StringWidget( 0, wdx, wd->TopEdge(), w - wdx - 5, wdh, b ? b->Name() : "Error", 30, WIDGET_STR_CONST, NULL, this ); wdy = wd->Height() + 10; wd = new CycleWidget( B_ID_ACTION, wdx, wdy, e_mine->Width(), wdh, 0, "_Action", event.GetData(2), action_labels, this ); wd->SetHook( this ); wdy += wdh + 5; e_crystals = new NumberWidget( N_ID_CRYSTALS, wdx, wdy, wd->Width(), wdh, event.GetData(1), -1000, 10000, WIDGET_ALIGN_LEFT, "Amou_nt", this ); e_crystals->SetHook( this ); // this is kind of a hack: it's not (yet) possible to // change the maximum string length after creation of // the widget, so we assumed the maximum above and set // the real values now SetMiningRange( event.GetData(2) ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventMiningWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventMiningWindow::WidgetActivated( Widget *widget, Window *win ) { TLWNode *n; switch( widget->ID() ) { case B_ID_MINE: TLWListBuilder::BuildShopList( mission.GetBuildings(), tlist ); new ListSelectWindow( "Select mine", tlist, event.GetData(0), false, this, B_ID_MINE_OK, view ); break; case B_ID_MINE_OK: n = static_cast(win)->Selected(); event.SetData( 0, n ? n->ID() : -1 ); e_mine->SetString( n ? n->Name() : "Error" ); tlist.Clear(); break; case B_ID_ACTION: event.SetData( 2, static_cast(widget)->GetValue() ); SetMiningRange( static_cast(widget)->GetValue() ); // fall through in case range has changed the number case N_ID_CRYSTALS: event.SetData( 1, e_crystals->Number() ); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventMiningWindow::SetMiningRange // DESCRIPTION: The minimum and maximum numbers allowed in the "amount" // widget are subject of the "action" chosen. We set the // correct range here. // PARAMETERS : action - action to set the range for // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdEventMiningWindow::SetMiningRange( short action ) const { short min = 0, max = 0; switch ( action ) { case 0: max = 1000; break; // set supplies case 1: min = -1000; max = 1000; break; // modify supplies case 2: max = 200; break; // set production case 3: min = -200; max = 200; break; // modify production; } e_crystals->SetMin( min ); e_crystals->SetMax( max ); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventResearchWindow::EdEventResearchWindow // DESCRIPTION: This window allows configuration of a RESEARCH event. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventResearchWindow::EdEventResearchWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { SetSize( MIN(sfont->Width() * 25, view->Width()), sfont->Height() * 4 + 55 ); static const char *action_labels[] = { "Allow", "Disallow", 0 }; Widget *wd; unsigned short wdx, wdh = sfont->Height() + 8; wdx = sfont->TextWidth("Action") + 10; wd = new CycleWidget( B_ID_ACTION, wdx, 5, w - wdx - 5, wdh, 0, "_Action", event.GetData(2), action_labels, this ); wd->SetHook( this ); wd = new ButtonWidget( B_ID_SHOP, 5, wd->TopEdge() + wdh + 5, sfont->Width() * 4 + 10, wdh, 0, "_Shop", this ); wd->SetHook( this ); Building *b = mission.GetBuildingByID( event.GetData(0) ); wdx = wd->LeftEdge() + wd->Width() + 5; e_shop = new StringWidget( 0, wdx, wd->TopEdge(), w - wdx - 5, wdh, b ? b->Name() : "Error", 30, WIDGET_STR_CONST, NULL, this ); wd = new ButtonWidget( B_ID_UNIT, 5, wd->TopEdge() + wdh + 5, wd->Width(), wdh, 0, "_Unit", this ); wd->SetHook( this ); e_unit = new StringWidget( 0, wdx, wd->TopEdge(), e_shop->Width(), wdh, mission.GetUnitSet().GetUnitInfo(event.GetData(1))->Name(), 30, WIDGET_STR_CONST, NULL, this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventResearchWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventResearchWindow::WidgetActivated( Widget *widget, Window *win ) { TLWNode *n; switch( widget->ID() ) { case B_ID_UNIT: TLWListBuilder::BuildUnitTypesList( mission.GetUnitSet(), tlist ); new ListSelectWindow( "Select researched unit", tlist, event.GetData(1), false, this, B_ID_UNIT_OK, view ); break; case B_ID_UNIT_OK: n = static_cast(win)->Selected(); event.SetData( 1, n ? n->ID() : -1 ); e_unit->SetString( n ? n->Name() : "Error" ); tlist.Clear(); break; case B_ID_SHOP: TLWListBuilder::BuildShopList( mission.GetBuildings(), tlist ); new ListSelectWindow( "Select factory", tlist, event.GetData(0), false, this, B_ID_SHOP_OK, view ); break; case B_ID_SHOP_OK: n = static_cast(win)->Selected(); event.SetData( 0, n ? n->ID() : -1 ); e_shop->SetString( n ? n->Name() : "Error" ); tlist.Clear(); break; case B_ID_ACTION: event.SetData( 2, static_cast(widget)->GetValue() ); break; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventScoreWindow::EdEventScoreWindow // DESCRIPTION: This window allows configuration of a SCORE event. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventScoreWindow::EdEventScoreWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { SetSize( MIN(sfont->Width() * 20 + 15, view->Width()), sfont->Height() * 4 + 50 ); unsigned short wdx = sfont->Width() * 5 + 10; Widget *wd = new NumberWidget( N_ID_SCORE, wdx, 5, w - wdx - 5, sfont->Height() + 8, event.GetData(0), 1, 100, WIDGET_ALIGN_LEFT, "_Score", this ); wd->SetHook( this ); wd = new ButtonWidget( B_ID_TITLE, 5, wd->TopEdge() + wd->Height() + 5, sfont->Width() * 10, wd->Height(), 0, "Lose _Title", this ); wd->SetHook( this ); wdx = wd->LeftEdge() + wd->Width() + 5; const char *str = mission.GetMessage(event.GetData(2)); other_title = new StringWidget( 0, wdx, wd->TopEdge(), w - wdx - 5, wd->Height(), (str || event.GetData(2) == -1) ? str : "Error", 30, WIDGET_STR_CONST, NULL, this ); wd = new ButtonWidget( B_ID_MSG, 5, wd->TopEdge() + wd->Height() + 5, wd->Width(), wd->Height(), 0, "Lose _Msg", this ); wd->SetHook( this ); str = mission.GetMessage(event.GetData(1)); other_msg = new StringWidget( 0, wdx, wd->TopEdge(), other_title->Width(), wd->Height(), (str || event.GetData(1) == -1) ? str : "Error", 30, WIDGET_STR_CONST, NULL, this ); new ButtonWidget( GUI_CLOSE, 1, h - wd->Height() - 1, w - 2, wd->Height(), WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); TLWListBuilder::BuildMsgList( mission.GetMessages(), msglist ); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventScoreWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventScoreWindow::WidgetActivated( Widget *widget, Window *win ) { TLWNode *n; switch ( widget->ID() ) { case N_ID_SCORE: event.SetData( 0, static_cast(widget)->Number() ); break; case B_ID_MSG: new ListSelectWindow( "Select lose message", msglist, event.GetData(1), true, this, B_ID_MSG_OK, view ); break; case B_ID_MSG_OK: n = static_cast(win)->Selected(); event.SetData( 1, n ? n->ID() : -1 ); other_msg->SetString( n ? mission.GetMessage(n->ID()) : NULL ); break; case B_ID_TITLE: new ListSelectWindow( "Select lose title", msglist, event.GetData(2), true, this, B_ID_TITLE_OK, view ); break; case B_ID_TITLE_OK: n = static_cast(win)->Selected(); event.SetData( 2, n ? n->ID() : -1 ); other_title->SetString( n ? mission.GetMessage(n->ID()) : NULL ); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventSetHexWindow::EdEventSetHexWindow // DESCRIPTION: This window allows configuration of a SET_HEX event. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventSetHexWindow::EdEventSetHexWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { const TerrainSet &set = mission.GetTerrainSet(); SetSize( MIN(sfont->Width() * 15 + 15, view->Width()), sfont->Height() * 2 + set.TileHeight() + 30 ); tilepos = Rect( (w - set.TileWidth()) / 2, 5, set.TileWidth(), set.TileHeight() ); Widget *wd; unsigned short wdx, wdh = sfont->Height() + 8; Point loc = mission.GetMap().Index2Hex( event.GetData(1) ); wd = new ButtonWidget( B_ID_TILE_PREV, tilepos.x - sfont->Width() - 10, 5, sfont->Width() + 10, tilepos.h, 0, "_<", this ); wd->SetHook( this ); wd = new ButtonWidget( B_ID_TILE_NEXT, tilepos.x + tilepos.w, 5, wd->Width(), tilepos.h, 0, "_>", this ); wd->SetHook( this ); wdx = 10 + sfont->TextWidth( "X" ); wd = new NumberWidget( N_ID_XPOS, wdx, wd->TopEdge() + wd->Height() + 5, sfont->Width() * 4 + 10, wdh, loc.x, 0, mission.GetMap().Width() - 1, WIDGET_ALIGN_LEFT, "_X", this ); wd->SetHook( this ); wdx += wd->Width() + 10 + sfont->TextWidth( "Y" ); wd = new NumberWidget( N_ID_YPOS, wdx, wd->TopEdge(), wd->Width(), wdh, loc.y, 0, mission.GetMap().Height() - 1, WIDGET_ALIGN_LEFT, "_Y", this ); wd->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventSetHexWindow::Draw // DESCRIPTION: Draw the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdEventSetHexWindow::Draw( void ) { Window::Draw(); DrawTerrain( event.GetData(0), false ); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventSetHexWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventSetHexWindow::WidgetActivated( Widget *widget, Window *win ) { unsigned short num; switch( widget->ID() ) { case B_ID_TILE_PREV: num = event.GetData( 0 ); if ( num > 0 ) --num; else num = mission.GetTerrainSet().NumTiles() - 1; event.SetData( 0, num ); DrawTerrain( num, true ); Show( tilepos ); break; case B_ID_TILE_NEXT: num = event.GetData( 0 ); if ( ++num == mission.GetTerrainSet().NumTiles() ) num = 0; event.SetData( 0, num ); DrawTerrain( num, true ); Show( tilepos ); break; case N_ID_XPOS: case N_ID_YPOS: { Point loc = mission.GetMap().Index2Hex( event.GetData(1) ); if ( widget->ID() == N_ID_XPOS ) loc.x = static_cast(widget)->Number(); else loc.y = static_cast(widget)->Number(); event.SetData( 1, mission.GetMap().Hex2Index(loc) ); break; } } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventSetHexWindow::DrawTerrain // DESCRIPTION: Draw a terrain image to the window surface. // PARAMETERS : terrain - terrain identifier // update - whether to update the display // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdEventSetHexWindow::DrawTerrain( unsigned short terrain, bool update ) { const TerrainSet &set = mission.GetTerrainSet(); const TerrainType *tt = set.GetTerrainInfo( terrain ); if ( tt ) { set.DrawTile( tt->tt_image, this, tilepos.x, tilepos.y, tilepos ); if ( update ) Show( tilepos ); } } //////////////////////////////////////////////////////////////////////// // NAME : EdEventSetTimerWindow::EdEventSetTimerWindow // DESCRIPTION: This window allows configuration of a SET_TIMER event. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventSetTimerWindow::EdEventSetTimerWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { static const char *offset_labels[] = { "None (absolute)", "Execution time", "Trigger configuration", 0 }; SetSize( MIN(sfont->Width() * 25 + 15, view->Width()), sfont->Height() * 4 + 50 ); Widget *wd; unsigned short wdx, wdy, wdh = sfont->Height() + 8; char buf[48] = "Error"; wd = new ButtonWidget( B_ID_EVENT, 5, 5, sfont->Width() * 5 + 10, wdh, 0, "_Event", this ); wd->SetHook( this ); Event *e = mission.GetEventByID( event.GetData(0) ); if ( e ) sprintf( buf, "%s (%d)", e->Name(), e->ID() ); wdx = wd->LeftEdge() + wd->Width() + 5; e_event = new StringWidget( 0, wdx, 5, w - wdx - 5, wdh, buf, 30, WIDGET_STR_CONST, NULL, this ); wdy = wdh + 10; wd = new CycleWidget( B_ID_OFFSET, e_event->LeftEdge(), wdy, w - e_event->LeftEdge() - 5, wdh, 0, "O_ffset", event.GetData(2), offset_labels, this ); wd->SetHook( this ); wdx = sfont->TextWidth("Time") + 10; wdy += wdh + 5; wd = new NumberWidget( N_ID_TIME, wdx, wdy, sfont->Width() * 5, wdh, event.GetData(1), 0, 100, WIDGET_ALIGN_LEFT, "_Time", this ); wd->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); TLWListBuilder::BuildEventList( mission.GetEvents(), tlist ); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventSetTimerWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventSetTimerWindow::WidgetActivated( Widget *widget, Window *win ) { switch( widget->ID() ) { case B_ID_EVENT: new ListSelectWindow( "Select event", tlist, event.GetData(0), false, this, B_ID_EVENT_OK, view ); break; case B_ID_EVENT_OK: { TLWNode *n = static_cast(win)->Selected(); if ( n ) { Event *e = static_cast( n->UserData() ); if ( e->Trigger() != ETRIGGER_TIMER ) { n = NULL; new NoteWindow( "Error", "Selected event has no 'Timer' trigger.", 0, view ); } } event.SetData( 0, n ? n->ID() : -1 ); e_event->SetString( n ? n->Name() : "Error" ); break; } case B_ID_OFFSET: event.SetData( 2, static_cast(widget)->GetValue() ); break; case N_ID_TIME: event.SetData( 1, static_cast(widget)->Number() ); break; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigHaveCrystalsWindow::EdTrigHaveCrystalsWindow // DESCRIPTION: This window allows configuration of a HAVE_CRYSTALS // trigger. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdTrigHaveCrystalsWindow::EdTrigHaveCrystalsWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { SetSize( MIN(sfont->Width() * 30 + 15, view->Width()), sfont->Height() * 4 + 50 ); Widget *wd; unsigned short wdx, wdh = sfont->Height() + 8; static const char *moreless_labels[] = { ">=", "<", 0 }; wd = new ButtonWidget( B_ID_SHOP, 5, 5, sfont->Width() * 4 + 10, wdh, 0, "_Shop", this ); wd->SetHook( this ); Building *b = mission.GetBuildingByID( event.GetTData(2) ); wdx = wd->LeftEdge() + wd->Width() + 5; t_shop = new StringWidget( 0, wdx, 5, w - wdx - 5, wdh, b ? b->Name() : "All", 30, WIDGET_STR_CONST, NULL, this ); wdx = sfont->TextWidth("Player") + 10; wd = new CycleWidget( B_ID_PLAYER, wdx, wd->Height() + 10, sfont->Width() * 3 + 20, wdh, 0, "_Player", event.GetTData(1), player2_labels, this ); wd->SetHook( this ); wdx = w - 5 - sfont->Width() * 4 - 20; wd = new CycleWidget( B_ID_MOREORLESS, wdx, wd->TopEdge(), sfont->Width() * 4 + 20, wdh, 0, NULL, event.GetTData(0) < 0 ? 1 : 0, moreless_labels, this ); wd->SetHook( this ); wdx = wd->LeftEdge() - 5 - sfont->Width() * 6; wd = new NumberWidget( N_ID_CRYSTALS, wdx, wd->TopEdge(), sfont->Width() * 6, wdh, ABS(event.GetTData(0)), 1, 5000, WIDGET_ALIGN_LEFT, "_Crystals", this ); wd->SetHook( this ); t_transports = new CheckboxWidget( B_ID_TRANSPORTS, 5, wd->TopEdge() + wd->Height() + 5, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, event.GetTData(2) == -2, WIDGET_STYLE_GFX|WIDGET_STYLE_NOBORDER|WIDGET_ALIGN_RIGHT| (event.GetTData(2) >= 0 ? WIDGET_DISABLED : 0), "_Include Transports", this ); t_transports->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigHaveCrystalsWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdTrigHaveCrystalsWindow::WidgetActivated( Widget *widget, Window *win ) { switch( widget->ID() ) { case B_ID_SHOP: TLWListBuilder::BuildShopList( mission.GetBuildings(), tlist ); new ListSelectWindow( "Select shop", tlist, event.GetTData(2), true, this, B_ID_SHOP_OK, view ); break; case B_ID_SHOP_OK: { TLWNode *n = static_cast(win)->Selected(); event.SetTData( 2, n ? n->ID() : -1 ); t_shop->SetString( n ? n->Name() : "All" ); tlist.Clear(); if ( !n ) { t_transports->Enable(); if ( t_transports->Clicked() ) event.SetTData( 2, -2 ); } else t_transports->Disable(); t_transports->Draw(); Show(); break; } case B_ID_PLAYER: event.SetTData( 1, static_cast(widget)->GetValue() ); break; case N_ID_CRYSTALS: event.SetTData( 0, SIGN(event.GetTData(0)) * static_cast(widget)->Number() ); break; case B_ID_MOREORLESS: event.SetTData( 0, event.GetTData( 0 ) * -1 ); break; case B_ID_TRANSPORTS: event.SetTData( 2, widget->Clicked() ? -2 : -1 ); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigHaveShopWindow::EdTrigHaveShopWindow // DESCRIPTION: This window allows configuration of a HAVE_BUILDING // trigger. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdTrigHaveShopWindow::EdTrigHaveShopWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { SetSize( MIN(sfont->Width() * 30 + 15, view->Width()), sfont->Height() * 4 + 50 ); Widget *wd; unsigned short wdx, wdh = sfont->Height() + 8; wd = new ButtonWidget( B_ID_SHOP, 5, 5, sfont->Width() * 4 + 10, wdh, 0, "_Shop", this ); wd->SetHook( this ); Building *b = mission.GetBuildingByID( event.GetTData(0) ); wdx = wd->LeftEdge() + wd->Width() + 5; t_shop = new StringWidget( 0, wdx, 5, w - wdx - 5, wdh, b ? b->Name() : "Error", 30, WIDGET_STR_CONST, NULL, this ); wdx = sfont->Width() * 20 + 10; wd = new CycleWidget( B_ID_PLAYER, wdx, wd->Height() + 10, w - wdx - 5, wdh, 0, "Controlled by _Player", event.GetTData(1), player2_labels, this ); wd->SetHook( this ); wd = new NumberWidget( N_ID_TIMER, sfont->Width() * 7 + 10, wd->TopEdge() + wd->Height() + 5, sfont->Width() * 6, wdh, event.GetTData(2), -1, 999, WIDGET_ALIGN_LEFT, "At _Time", this ); wd->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigHaveShopWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdTrigHaveShopWindow::WidgetActivated( Widget *widget, Window *win ) { switch( widget->ID() ) { case B_ID_SHOP: TLWListBuilder::BuildShopList( mission.GetBuildings(), tlist ); new ListSelectWindow( "Select shop", tlist, event.GetTData(0), false, this, B_ID_SHOP_OK, view ); break; case B_ID_SHOP_OK: { TLWNode *n = static_cast(win)->Selected(); event.SetTData( 0, n ? n->ID() : -1 ); t_shop->SetString( n ? n->Name() : "Error" ); tlist.Clear(); break; } case B_ID_PLAYER: event.SetTData( 1, static_cast(widget)->GetValue() ); break; case N_ID_TIMER: event.SetTData( 2, static_cast(widget)->Number() ); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigHaveUnitWindow::EdTrigHaveUnitWindow // DESCRIPTION: This window allows configuration of a HAVE_UNIT trigger. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdTrigHaveUnitWindow::EdTrigHaveUnitWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { SetSize( MIN(sfont->Width() * 30 + 15, view->Width()), sfont->Height() * 4 + 50 ); Widget *wd; unsigned short wdx, wdh = sfont->Height() + 8; char buf[32] = "Error"; wd = new ButtonWidget( B_ID_UNIT, 5, 5, sfont->Width() * 4 + 10, wdh, 0, "_Unit", this ); wd->SetHook( this ); Unit *u = mission.GetUnitByID( event.GetTData(0) ); if ( u ) sprintf( buf, "%s (%d)", u->Name(), u->ID() ); wdx = wd->LeftEdge() + wd->Width() + 5; t_unit = new StringWidget( 0, wdx, 5, w - wdx - 5, wdh, buf, 30, WIDGET_STR_CONST, NULL, this ); wdx = sfont->Width() * 20 + 10; wd = new CycleWidget( B_ID_PLAYER, wdx, wd->Height() + 10, w - wdx - 5, wdh, 0, "Controlled by _Player", event.GetTData(1), player2_labels, this ); wd->SetHook( this ); wd = new NumberWidget( N_ID_TIMER, sfont->Width() * 8 + 10, wd->TopEdge() + wd->Height() + 5, sfont->Width() * 6, wdh, event.GetTData(2), -1, 999, WIDGET_ALIGN_LEFT, "At _Time", this ); wd->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigHaveUnitWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdTrigHaveUnitWindow::WidgetActivated( Widget *widget, Window *win ) { switch( widget->ID() ) { case B_ID_UNIT: TLWListBuilder::BuildUnitList( mission.GetUnits(), tlist ); new ListSelectWindow( "Select unit", tlist, event.GetTData(0), false, this, B_ID_UNIT_OK, view ); break; case B_ID_UNIT_OK: { TLWNode *n = static_cast(win)->Selected(); event.SetTData( 0, n ? n->ID() : -1 ); t_unit->SetString( n ? n->Name() : "Error" ); tlist.Clear(); break; } case B_ID_PLAYER: event.SetTData( 1, static_cast(widget)->GetValue() ); break; case N_ID_TIMER: event.SetTData( 2, static_cast(widget)->Number() ); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigTimerWindow::EdTrigTimerWindow // DESCRIPTION: This window allows configuration of a TIMER trigger. // PARAMETERS : event - event to edit // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdTrigTimerWindow::EdTrigTimerWindow( Event &event, View *view ) : Window(WIN_CENTER, view), event(event) { SetSize( MIN(sfont->Width() * 21 + 15, view->Width()), sfont->Height() * 2 + 30 ); unsigned short wdx = sfont->Width() * 15 + 10, wdh = sfont->Height() + 8; Widget *wd = new NumberWidget( 0, wdx, 5, w - wdx - 5, wdh, event.GetTData(0), 0, 999, WIDGET_ALIGN_LEFT, "Execute at _time", this ); wd->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigTimerWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdTrigTimerWindow::WidgetActivated( Widget *widget, Window *win ) { event.SetTData( 0, static_cast(widget)->Number() ); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigUnitDestroyedWindow::EdTrigUnitDestroyedWindow // DESCRIPTION: This window allows configuration of a UNIT_DESTROYED // trigger. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdTrigUnitDestroyedWindow::EdTrigUnitDestroyedWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { SetSize( MIN(sfont->Width() * 30 + 15, view->Width()), sfont->Height() * 4 + 50 ); Widget *wd; unsigned short wdx, wdh = sfont->Height() + 8; char buf[32] = "All"; wdx = 10 + sfont->TextWidth("Select"); t_uselect = new CycleWidget( B_ID_USELECT, wdx, 5, w/2 - wdx - 5, wdh, 0, "_Select", (event.GetTData(0) >= -1) ? 0 : 1, uselect_labels, this ); t_uselect->SetHook( this ); wd = new ButtonWidget( B_ID_UNIT, 5, t_uselect->TopEdge() + wdh + 5, sfont->Width() * 4 + 10, wdh, 0, "_Unit", this ); wd->SetHook( this ); if ( event.GetTData(0) >= 0 ) { Unit *u = mission.GetUnitByID( event.GetTData(0) ); if ( u ) sprintf( buf, "%s (%d)", u->Name(), u->ID() ); } else if ( event.GetTData(0) < -1 ) { strcpy( buf, mission.GetUnitSet().GetUnitInfo(-event.GetTData(0) - 2)->Name() ); } wdx = wd->LeftEdge() + wd->Width() + 5; t_unit = new StringWidget( 0, wdx, wd->TopEdge(), w - wdx - 5, wdh, buf, 30, WIDGET_STR_CONST, NULL, this ); wdx = sfont->Width() * 20 + 10; t_player = new CycleWidget( B_ID_PLAYER, wdx, wd->TopEdge() + wd->Height() + 5, w - wdx - 5, wdh, (event.GetTData(0) >= 0) ? WIDGET_DISABLED : 0, "Controlled by _Player", event.GetTData(1), player2_labels, this ); t_player->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigUnitDestroyedWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdTrigUnitDestroyedWindow::WidgetActivated( Widget *widget, Window *win ) { switch( widget->ID() ) { case B_ID_UNIT: if ( t_uselect->GetValue() == 0 ) { TLWListBuilder::BuildUnitList( mission.GetUnits(), tlist ); new ListSelectWindow( "Select target unit", tlist, event.GetTData(0), true, this, B_ID_UNIT_OK, view ); } else { TLWListBuilder::BuildUnitTypesList( mission.GetUnitSet(), tlist ); new ListSelectWindow( "Select unit type", tlist, -event.GetTData(0) - 2, true, this, B_ID_UNIT_OK, view ); } break; case B_ID_UNIT_OK: { TLWNode *n = static_cast(win)->Selected(); if ( t_uselect->GetValue() == 0 ) { event.SetTData( 0, n ? n->ID() : -1 ); if ( n ) { event.SetTData( 1, static_cast(n->UserData())->Owner() ); t_player->Disable(); } else { event.SetTData( 1, event.Player()^1 ); t_player->Enable(); t_player->SetValue( event.GetTData(1) ); } } else { event.SetTData( 0, n ? -n->ID() - 2 : -1); } t_unit->SetString( n ? n->Name() : "All", true ); Draw(); Show(); tlist.Clear(); break; } case B_ID_USELECT: if ( t_uselect->GetValue() == 0 ) { event.SetTData( 0, -1 ); t_unit->SetString( "All", true ); } else if ( event.GetTData(0) != -1 ) { Unit *u = mission.GetUnitByID( event.GetTData(0) ); if ( u ) { event.SetTData( 0, -u->Type()->ID() - 2 ); t_unit->SetString( u->Name(), true ); } else { event.SetTData( 0, -1 ); t_unit->SetString( "All", true ); } } t_player->Enable(); t_player->SetValue( event.GetTData(1) ); break; case B_ID_PLAYER: event.SetTData( 1, static_cast(widget)->GetValue() ); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigUnitPositionWindow::EdTrigUnitPositionWindow // DESCRIPTION: This window allows configuration of a UNIT_POSITION // trigger. // PARAMETERS : event - event to edit // mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdTrigUnitPositionWindow::EdTrigUnitPositionWindow( Event &event, Mission &mission, View *view ) : Window(WIN_CENTER, view), event(event), mission(mission) { SetSize( MIN(sfont->Width() * 30 + 15, view->Width()), sfont->Height() * 4 + 50 ); Widget *wd; unsigned short wdx, wdh = sfont->Height() + 8; char buf[32] = "Any"; Point loc = mission.GetMap().Index2Hex( event.GetTData(1) ); wdx = 10 + sfont->TextWidth("Select"); t_uselect = new CycleWidget( B_ID_USELECT, wdx, 5, w/2 - wdx - 5, wdh, 0, "_Select", (event.GetTData(0) >= -1) ? 0 : 1, uselect_labels, this ); t_uselect->SetHook( this ); wdx = w/2 + 10 + sfont->TextWidth("Player"); wd = new CycleWidget( B_ID_PLAYER, wdx, t_uselect->TopEdge(), w - wdx - 5, wdh, 0, "_Player", event.GetTData(2), player2_labels, this ); wd->SetHook( this ); wd = new ButtonWidget( B_ID_UNIT, 5, t_uselect->TopEdge() + wdh + 5, sfont->Width() * 4 + 10, wdh, 0, "_Unit", this ); wd->SetHook( this ); if ( event.GetTData(0) >= 0 ) { Unit *u = mission.GetUnitByID( event.GetTData(0) ); if ( u ) sprintf( buf, "%s (%d)", u->Name(), u->ID() ); } else if ( event.GetTData(0) < -1 ) { strcpy( buf, mission.GetUnitSet().GetUnitInfo(-event.GetTData(0) - 2)->Name() ); } wdx = wd->LeftEdge() + wd->Width() + 5; t_unit = new StringWidget( 0, wdx, wd->TopEdge(), w - wdx - 5, wdh, buf, 30, WIDGET_STR_CONST, NULL, this ); wdx = sfont->Width() * 10 + 10; wd = new NumberWidget( N_ID_POSX, wdx, wd->TopEdge() + wd->Height() + 5, (w - wdx - sfont->Width() - 15) / 2, wdh, loc.x, 0, mission.GetMap().Width() - 1, WIDGET_ALIGN_LEFT, "Position _X", this ); wd->SetHook( this ); wdx += wd->Width() + sfont->Width() + 10; wd = new NumberWidget( N_ID_POSY, wdx, wd->TopEdge(), w - wdx - 5, wdh, loc.y, 0, mission.GetMap().Height() - 1, WIDGET_ALIGN_LEFT, "_Y", this ); wd->SetHook( this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigUnitPositionWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdTrigUnitPositionWindow::WidgetActivated( Widget *widget, Window *win ) { switch( widget->ID() ) { case B_ID_UNIT: if ( t_uselect->GetValue() == 0 ) { TLWListBuilder::BuildUnitList( mission.GetUnits(), tlist ); new ListSelectWindow( "Select unit", tlist, event.GetTData(0), true, this, B_ID_UNIT_OK, view ); } else { TLWListBuilder::BuildUnitTypesList( mission.GetUnitSet(), tlist ); new ListSelectWindow( "Select unit type", tlist, -event.GetTData(0) - 2, true, this, B_ID_UNIT_OK, view ); } break; case B_ID_UNIT_OK: { TLWNode *n = static_cast(win)->Selected(); if ( t_uselect->GetValue() == 0 ) event.SetTData( 0, n ? n->ID() : -1 ); else event.SetTData( 0, n ? -n->ID() - 2 : -1); t_unit->SetString( n ? n->Name() : "Any", true ); tlist.Clear(); break; } case N_ID_POSX: case N_ID_POSY: { Point loc = mission.GetMap().Index2Hex( event.GetTData(1) ); if ( widget->ID() == N_ID_POSX ) loc.x = static_cast(widget)->Number(); else loc.y = static_cast(widget)->Number(); event.SetTData( 1, mission.GetMap().Hex2Index(loc) ); break; } case B_ID_USELECT: if ( t_uselect->GetValue() == 0 ) { event.SetTData( 0, -1 ); t_unit->SetString( "Any", true ); } else if ( event.GetTData(0) != -1 ) { Unit *u = mission.GetUnitByID( event.GetTData(0) ); if ( u ) { event.SetTData( 0, -u->Type()->ID() - 2 ); t_unit->SetString( u->Name(), true ); } else { event.SetTData( 0, -1 ); t_unit->SetString( "Any", true ); } } break; case B_ID_PLAYER: event.SetTData( 2, static_cast(widget)->GetValue() ); break; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigHandicapWindow::EdTrigHandicapWindow // DESCRIPTION: This window allows configuration of a HANDICAP trigger. // PARAMETERS : event - event to edit // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdTrigHandicapWindow::EdTrigHandicapWindow( Event &event, View *view ) : Window(WIN_CENTER, view), event(event) { SetSize( MIN(sfont->Width() * 20 + DEFAULT_CBW_SIZE + 15, view->Width()), sfont->Height() * 4 + 40 ); Widget *wd = new CheckboxWidget( HANDICAP_NONE, 5, 5, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, event.GetTData(0) & HANDICAP_NONE, WIDGET_STYLE_GFX|WIDGET_STYLE_NOBORDER|WIDGET_ALIGN_RIGHT, "_No handicap", this ); wd->SetHook( this ); wd = new CheckboxWidget( HANDICAP_P1, 5, wd->TopEdge() + wd->Height() + 5, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, (event.GetTData(0) & HANDICAP_P1) != 0, WIDGET_STYLE_GFX|WIDGET_STYLE_NOBORDER|WIDGET_ALIGN_RIGHT, "Player _1 handicapped", this ); wd->SetHook( this ); wd = new CheckboxWidget( HANDICAP_P2, 5, wd->TopEdge() + wd->Height() + 5, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, (event.GetTData(0) & HANDICAP_P2) != 0, WIDGET_STYLE_GFX|WIDGET_STYLE_NOBORDER|WIDGET_ALIGN_RIGHT, "Player _2 handicapped", this ); wd->SetHook( this ); unsigned short wdh = sfont->Height() + 8; new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdTrigHandicapWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdTrigHandicapWindow::WidgetActivated( Widget *widget, Window *win ) { short handicap = event.GetTData( 0 ); event.SetTData( 0, handicap ^ widget->ID() ); return GUI_OK; } crimson-0.5.2.orig/src/comet/eventwindow.h0000600000175000017500000002045010554366467016742 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // eventwindow.h - event editing window classes for CoMET /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_ED_EVENTWINDOW_H #define _INCLUDE_ED_EVENTWINDOW_H #include "window.h" #include "button.h" #include "mission.h" class EdEventGenericWindow : public Window, public WidgetHook { public: EdEventGenericWindow( Event &event, Mission &mission, View *view ); void Draw( void ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_TITLE = 1, B_ID_MSG, B_ID_PLAYER, B_ID_DEPEND, B_ID_DISCARD, B_ID_TRIGGER, B_ID_EVENT, B_ID_TITLE_OK, B_ID_MSG_OK, B_ID_DEPEND_OK, B_ID_DISCARD_OK, B_ID_DISABLED }; TextScrollWidget *e_msg; StringWidget *e_title; StringWidget *e_depends; StringWidget *e_discards; TLWList tlist; Event &event; Mission &mission; }; class EdEventCreateUnitWindow : public Window, public WidgetHook { public: EdEventCreateUnitWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_UNIT = 1, B_ID_UNIT_OK, N_ID_XPOS, N_ID_YPOS, B_ID_DIRECTION, B_ID_SIZE, B_ID_XP }; StringWidget *e_unit; TLWList tlist; Event &event; Mission &mission; }; class EdEventDestroyUnitWindow : public Window, public WidgetHook { public: EdEventDestroyUnitWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_UNIT = 1, B_ID_UNIT_OK, B_ID_PLAYER, N_ID_XPOS, N_ID_YPOS }; StringWidget *e_unit; NumberWidget *e_xpos; NumberWidget *e_ypos; TLWList tlist; Event &event; Mission &mission; }; class EdEventManipEventWindow : public Window, public WidgetHook { public: EdEventManipEventWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_EVENT = 1, B_ID_EVENT_OK, B_ID_ACTION, B_ID_DISABLED }; StringWidget *e_event; TLWList tlist; Event &event; Mission &mission; }; class EdEventMessageWindow : public Window, public WidgetHook { public: EdEventMessageWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); NumberWidget *e_xpos; NumberWidget *e_ypos; Event &event; Mission &mission; }; class EdEventMiningWindow : public Window, public WidgetHook { public: EdEventMiningWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); void SetMiningRange( short action ) const; enum { B_ID_MINE = 1, B_ID_MINE_OK, B_ID_ACTION, N_ID_CRYSTALS }; StringWidget *e_mine; NumberWidget *e_crystals; TLWList tlist; Event &event; Mission &mission; }; class EdEventConfigureWindow : public Window, public WidgetHook { public: EdEventConfigureWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); const char *GetValueString( void ) const; enum { B_ID_SETTING = 1, B_ID_MSG, B_ID_MSG_OK, S_ID_VALUE }; ButtonWidget *e_msg_but; StringWidget *e_msg; TLWList tlist; Event &event; Mission &mission; }; class EdEventResearchWindow : public Window, public WidgetHook { public: EdEventResearchWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_UNIT = 1, B_ID_UNIT_OK, B_ID_SHOP, B_ID_SHOP_OK, B_ID_ACTION }; StringWidget *e_unit; StringWidget *e_shop; TLWList tlist; Event &event; Mission &mission; }; class EdEventScoreWindow : public Window, public WidgetHook { public: EdEventScoreWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_MSG = 1, B_ID_MSG_OK, B_ID_TITLE, B_ID_TITLE_OK, N_ID_SCORE }; Event &event; Mission &mission; TLWList msglist; StringWidget *other_msg; StringWidget *other_title; }; class EdEventSetHexWindow : public Window, public WidgetHook { public: EdEventSetHexWindow( Event &event, Mission &mission, View *view ); private: void Draw( void ); GUI_Status WidgetActivated( Widget *button, Window *win ); void DrawTerrain( unsigned short terrain, bool update ); enum { B_ID_TILE_PREV = 1, B_ID_TILE_NEXT, N_ID_XPOS, N_ID_YPOS }; Rect tilepos; Event &event; Mission &mission; }; class EdEventSetTimerWindow : public Window, public WidgetHook { public: EdEventSetTimerWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_EVENT = 1, B_ID_EVENT_OK, B_ID_OFFSET, N_ID_TIME }; StringWidget *e_event; TLWList tlist; Event &event; Mission &mission; }; class EdTrigHaveCrystalsWindow : public Window, public WidgetHook { public: EdTrigHaveCrystalsWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_SHOP = 1, B_ID_SHOP_OK, B_ID_PLAYER, N_ID_CRYSTALS, B_ID_MOREORLESS, B_ID_TRANSPORTS }; StringWidget *t_shop; CheckboxWidget *t_transports; TLWList tlist; Event &event; Mission &mission; }; class EdTrigHaveShopWindow : public Window, public WidgetHook { public: EdTrigHaveShopWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_SHOP = 1, B_ID_SHOP_OK, B_ID_PLAYER, N_ID_TIMER }; StringWidget *t_shop; TLWList tlist; Event &event; Mission &mission; }; class EdTrigHaveUnitWindow : public Window, public WidgetHook { public: EdTrigHaveUnitWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_UNIT = 1, B_ID_UNIT_OK, B_ID_PLAYER, N_ID_TIMER }; StringWidget *t_unit; TLWList tlist; Event &event; Mission &mission; }; class EdTrigTimerWindow : public Window, public WidgetHook { public: EdTrigTimerWindow( Event &event, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); Event &event; }; class EdTrigUnitDestroyedWindow : public Window, public WidgetHook { public: EdTrigUnitDestroyedWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_UNIT = 1, B_ID_UNIT_OK, B_ID_PLAYER, B_ID_USELECT }; StringWidget *t_unit; CycleWidget *t_player; CycleWidget *t_uselect; TLWList tlist; Event &event; Mission &mission; }; class EdTrigUnitPositionWindow : public Window, public WidgetHook { public: EdTrigUnitPositionWindow( Event &event, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_UNIT = 1, B_ID_UNIT_OK, N_ID_POSX, N_ID_POSY, B_ID_PLAYER, B_ID_USELECT }; StringWidget *t_unit; CycleWidget *t_uselect; TLWList tlist; Event &event; Mission &mission; }; class EdTrigHandicapWindow : public Window, public WidgetHook { public: EdTrigHandicapWindow( Event &event, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); Event &event; }; #endif // _INCLUDE_ED_EVENTWINDOW_H crimson-0.5.2.orig/src/comet/extwindow2.cpp0000600000175000017500000016125610546470743017042 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // extwindow2.cpp /////////////////////////////////////////////////////////////////////// #include #include "extwindow2.h" #include "extwindow.h" #include "eventwindow.h" #include "filewindow.h" #include "fileio.h" #include "uiaux.h" #include "mapgen.h" // static vars const char *player2_labels[] = { "One", "Two", 0 }; const char *player3_labels[] = { "One", "Two", "Neutral", 0 }; const char *dir_labels[] = { "North", "Northeast", "Southeast", "South", "Southwest", "Northwest", 0 }; const char *xp_labels[] = { "0", "1", "2", "3", "4", "5", "6", 0 }; const char *size_labels[] = { "1", "2", "3", "4", "5", "6", 0 }; extern const char *event_labels[]; extern const char *etrigger_labels[]; // non-private widget ID for the SelectUnitWindow #define B_ID_SUW_OK 102 //////////////////////////////////////////////////////////////////////// // NAME : ListExchangeWindow::ListExchangeWindow // DESCRIPTION: This window displays two TLWList objects. The user can // move nodes from one list to the other and vice versa. // PARAMETERS : l1 - first TLWList // l2 - second TLWList // label1 - label to be shown for l1 // label2 - label to be shown for l2 // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// ListExchangeWindow::ListExchangeWindow( TLWList &l1, TLWList &l2, const char *label1, const char *label2, View *view ) : Window(WIN_CENTER, view), list1(l1), list2(l2) { // calculate window size unsigned short maxlen = sfont->TextWidth(label1), nodes1 = 0, nodes2 = 0; TLWNode *n; for ( n = static_cast(l1.Head()); n; n = static_cast(n->Next()) ) { maxlen = MAX( maxlen, sfont->TextWidth(n->Name()) ); ++nodes1; } for ( n = static_cast(l2.Head()); n; n = static_cast(n->Next()) ) { maxlen = MAX( maxlen, sfont->TextWidth(n->Name()) ); ++nodes2; } Rect win( 0, 0, (maxlen * 2 + 10) + sfont->Width() + 30, (MAX(nodes1, nodes2) + 4) * (sfont->Height() + 4) + 30 ); win.Clip( *view ); SetSize( win ); wd_l1 = new TextListWidget( 0, 5, sfont->Height() + 10, w/2 - sfont->Width() - 10, h - sfont->Height() * 2 - 20, &l1, -1, WIDGET_ALIGN_TOP, label1, this ); wd_l2 = new TextListWidget( 0, w - 5 - wd_l1->Width(), wd_l1->TopEdge(), wd_l1->Width(), wd_l1->Height(), &l2, -1, WIDGET_ALIGN_TOP, label2, this ); Widget *wd; wd = new ButtonWidget( B_ID_RIGHT, wd_l1->LeftEdge() + wd_l1->Width() + 5, wd_l1->TopEdge() + wd_l1->Height()/2 - sfont->Height() - 15, wd_l2->LeftEdge() - wd_l1->LeftEdge() - wd_l1->Width() - 10, sfont->Height() + 8, 0, "_>", this ); wd->SetHook( this ); wd = new ButtonWidget( B_ID_LEFT, wd->LeftEdge(), wd->TopEdge() + wd->Height() + 7, wd->Width(), wd->Height(), 0, "_<", this ); wd->SetHook( this ); ok = new ButtonWidget( B_ID_OK, 1, h - sfont->Height() - 9, w - 2, sfont->Height() + 8, WIDGET_DEFAULT, "_OK", this ); ok->SetHook( this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : ListExchangeWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status ListExchangeWindow::WidgetActivated( Widget *widget, Window *win ) { TLWNode *n; switch ( widget->ID() ) { case B_ID_RIGHT: n = static_cast(wd_l1->Selected()); if ( n ) { n->Remove(); list2.InsertNodeSorted( n ); wd_l1->Update(); wd_l1->Draw(); wd_l1->Show(); wd_l2->Update(); wd_l2->Draw(); wd_l2->Show(); } break; case B_ID_LEFT: n = static_cast(wd_l2->Selected()); if ( n ) { n->Remove(); list1.InsertNodeSorted( n ); wd_l1->Update(); wd_l1->Draw(); wd_l1->Show(); wd_l2->Update(); wd_l2->Draw(); wd_l2->Show(); } break; case B_ID_OK: view->CloseWindow( this ); break; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : ListSelectWindow::ListSelectWindow // DESCRIPTION: This window displays the contents of a TLWList object. // The user can select a single node (or none) and click // OK. // PARAMETERS : title - window title // list - TLWList object to display // defid - identifier of the node to be highlighted by // default (-1 means no node selected) // nullok - if true, accept user hitting OK without a node // selected and deselect a node if clicked twice; // if false, refuse to close the window until the // user has made a choice. If the list is empty, // it will close even if nullok is false. // hook - WidgetHook to notify when the user hits OK // button - button identifier passed to the hook // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// ListSelectWindow::ListSelectWindow( const char *title, TLWList &list, short defid, bool nullok, WidgetHook *hook, short button, View *view ) : Window(WIN_CENTER, view), button(button), nullok(nullok), list(list), client(hook), current(0) { // calculate window size unsigned short maxlen = sfont->TextWidth(title) + 10, nodes = 0; short defnode = -1; TLWNode *n; for ( n = static_cast(list.Head()); n; n = static_cast(n->Next()) ) { maxlen = MAX( maxlen, sfont->TextWidth(n->Name()) ); if ( n->ID() == defid ) { defnode = nodes; current = n; } ++nodes; } Rect win( 0, 0, maxlen + 20, (nodes + 2) * (sfont->Height() + 4) + 25 ); win.Clip( *view ); SetSize( win ); lw = new TextListWidget( button + 1, 5, sfont->Height() + 10, w - 10, h - sfont->Height() * 2 - 20, &list, defnode, WIDGET_ALIGN_TOP|WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY, title, this ); lw->SetHook( this ); Widget *wd = new ButtonWidget( button, 1, h - sfont->Height() - 9, w - 2, sfont->Height() + 8, WIDGET_DEFAULT, "_OK", this ); wd->SetHook( this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : ListSelectWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status ListSelectWindow::WidgetActivated( Widget *widget, Window *win ) { if ( widget->ID() == button ) { if ( nullok || current || (list.CountNodes() == 0) ) { view->CloseWindow( this ); client->WidgetActivated( widget, this ); } else new NoteWindow( "Error", "You must make a selection", 0, view ); } else { TLWNode *n = static_cast(lw->Selected()); if ( (n == current) && nullok ) { lw->Select( -1 ); current = NULL; } else current = n; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : NewMissionWindow::NewMissionWindow // DESCRIPTION: This window pops up when the user wants to create a new // mission. He can adjust a few basic settings like map // size or tileset and create the mission. // PARAMETERS : view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// NewMissionWindow::NewMissionWindow( View *view ) : Window(WIN_CENTER, view), mission(0), hook(0), ok_id(B_ID_OK) { // calculate window dimensions Font *f = SmallFont(); unsigned short width = MIN( f->Width() * 38 + 20, view->Width() ); unsigned short height = f->Height() * 6 + 60; unsigned short xoff, yoff = 5; xoff = MAX(f->TextWidth("Map Width:"), f->TextWidth("Map Height:")) + 10; SetSize( width, height ); m_width = new NumberWidget( 1, xoff, yoff, f->Width() * 4 + 10, f->Height() + 6, 40, 20, 180, WIDGET_ALIGN_LEFT, "Map _Width:", this ); width = MIN( f->Width() * 11 + 10, w - xoff - m_width->w - 24 - f->Width() * 12 ); tileset = new StringWidget( 3, xoff + m_width->w + 10 + f->Width() * 9, yoff, width, m_width->h, "default", 10, WIDGET_ALIGN_LEFT|WIDGET_STR_CONST, "_Tile Set:", this ); ButtonWidget *btn = new ButtonWidget( B_ID_TILESET, tileset->x + tileset->w, tileset->y, f->Width() * 3 + 4, tileset->h, 0, "...", this ); btn->SetKey( 't' ); btn->SetHook( this ); yoff += m_width->Height() + 5; m_height = new NumberWidget( 2, xoff, yoff, m_width->w, m_width->h, 40, 20, 180, WIDGET_ALIGN_LEFT, "Map _Height:", this ); unitset = new StringWidget( 4, tileset->x, yoff, tileset->w, tileset->h, "default", 10, WIDGET_ALIGN_LEFT|WIDGET_STR_CONST, "_Unit Set:", this ); btn = new ButtonWidget( B_ID_UNITSET, btn->x, unitset->y, btn->w, unitset->h, 0, "...", this ); btn->SetKey( 'u' ); btn->SetHook( this ); yoff += btn->Height() + 5; gen_random = new CheckboxWidget( B_ID_RANDOM, 5, yoff, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, true, WIDGET_STYLE_GFX|WIDGET_STYLE_NOBORDER|WIDGET_ALIGN_RIGHT, "_Generate random terrain", this ); gen_random->SetHook( this ); yoff += gen_random->Height() + 5; xoff = gen_random->LeftEdge() + 10 + f->TextWidth("Water Level"); gen_water = new SliderWidget( 0, xoff, yoff, w - xoff - 5, DEFAULT_SLIDER_SIZE, 0, 10, 4, 1, WIDGET_HSCROLL|WIDGET_ALIGN_LEFT, "W_ater Level", this ); yoff += gen_water->Height() + 5; gen_roughness = new SliderWidget( 0, xoff, yoff, w - xoff - 5, DEFAULT_SLIDER_SIZE, 1, 20, 6, 2, WIDGET_HSCROLL|WIDGET_ALIGN_LEFT, "_Roughness", this ); yoff = h - f->Height() - 15; btn = new ButtonWidget( B_ID_OK, 10, yoff, f->Width() * 10, f->Height() + 10, 0, "_OK", this ); btn->SetHook( this ); new ButtonWidget( GUI_CLOSE, w - 10 - btn->w, yoff, btn->w, btn->h, 0, "_Cancel", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : NewMissionWindow::GetMapSize // DESCRIPTION: Get the current slider settings. // PARAMETERS : - // RETURNS : selected size as a Point //////////////////////////////////////////////////////////////////////// Point NewMissionWindow::GetMapSize( void ) const { return Point( m_width->Number(), m_height->Number() ); } //////////////////////////////////////////////////////////////////////// // NAME : NewMissionWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : button - activated button widget // win - window containing the button // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status NewMissionWindow::WidgetActivated( Widget *button, Window *win ) { FileWindow *fw; switch ( button->ID() ) { case B_ID_TILESET: fw = new FileWindow( get_data_dir().c_str(), GetTileSet(), ".tiles", 0, view ); fw->ok->SetID( B_ID_TILESET_OK ); fw->ok->SetHook( this ); break; case B_ID_TILESET_OK: { string file = static_cast(win)->GetFile(); if ( file.length() > 0 ) { file = file_part( file ); file.erase( file.length() - 6 ); // remove file name suffix tileset->SetString( file.c_str() ); view->CloseWindow( win ); if ( file == "default" ) gen_random->Enable(); else gen_random->Disable(); gen_random->Draw(); WidgetActivated( gen_random, this ); } break; } case B_ID_UNITSET: fw = new FileWindow( get_data_dir().c_str(), GetUnitSet(), ".units", 0, view ); fw->ok->SetID( B_ID_UNITSET_OK ); fw->ok->SetHook( this ); break; case B_ID_UNITSET_OK: { string file = static_cast(win)->GetFile(); if ( file.length() > 0 ) { file = file_part( file ); file.erase( file.length() - 6 ); // remove file name suffix unitset->SetString( file.c_str() ); view->CloseWindow( win ); } break; } case B_ID_RANDOM: if ( button->Disabled() || !button->Clicked() ) { gen_water->Disable(); gen_roughness->Disable(); } else { gen_water->Enable(); gen_roughness->Enable(); } gen_water->Draw(); gen_roughness->Draw(); Show(); break; case B_ID_OK: if ( hook ) { mission = NewMission( GetMapSize(), GetTileSet(), GetUnitSet() ); if ( mission ) { if ( !gen_random->Disabled() && gen_random->Clicked() ) { MapGenerator gen; gen.Generate( mission->GetMap(), gen_water->Level(), gen_roughness->Level() ); } // add the most basic messages Language en; en.SetID( CF_LANG_DEFAULT ); en.AddMsg( "Unnamed" ); // map name en.AddMsg( "Player 1" ); // name player 1 en.AddMsg( "Player 2" ); // name player 2 en.AddMsg( "HQ 1" ); // HQ player 1 en.AddMsg( "HQ 2" ); // HQ player 2 mission->GetMessages().AddLanguage( en ); mission->SetName( 0 ); mission->GetPlayer( PLAYER_ONE ).SetNameID( 1 ); mission->GetPlayer( PLAYER_TWO ).SetNameID( 2 ); // use the button ID supplied by the caller button->SetID( ok_id ); hook->WidgetActivated( button, this ); button->SetID( B_ID_OK ); } } } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : NewMissionWindow::NewMission // DESCRIPTION: Create a new mission. // PARAMETERS : size - map size // tset - tile set name // uset - unit set name // RETURNS : pointer to new mission or NULL on error //////////////////////////////////////////////////////////////////////// Mission *NewMissionWindow::NewMission( const Point &size, const string &tset, const string &uset ) { Mission *ms = NULL; TerrainSet *ts = new TerrainSet; UnitSet *us = new UnitSet; string tname( get_data_dir() + tset + ".tiles" ); File tfile( tname ); string uname( get_data_dir() + uset + ".units" ); File ufile( uname ); if ( !tfile.Open("rb") || ts->Load( tfile, tset.c_str() ) ) { new NoteWindow( "Error", "Tile set not available", 0, view ); } else if ( !ufile.Open("rb") || us->Load( ufile, uset.c_str() ) ) { new NoteWindow( "Error", "Unit set not available", 0, view ); } else { ms = new Mission( size, ts, us ); } if ( !ms ) { delete ts; delete us; } tfile.Close(); ufile.Close(); return ms; } //////////////////////////////////////////////////////////////////////// // NAME : EdMissionSetupWindow::EdMissionSetupWindow // DESCRIPTION: This window allows modification of the basic mission // settings like player names. // PARAMETERS : mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdMissionSetupWindow::EdMissionSetupWindow( Mission &mission, View *view ) : Window(WIN_CENTER, view), mission(mission) { // calculate dimensions SetSize( MIN(sfont->Width() * 40 + 20, view->Width()), MIN(sfont->Height() * 11 + 110, view->Height()) ); static const char *msg_labels[] = { "Level Name", "Level Info", "Name 1", "Name 2", "Briefing 1", "Briefing 2", "Campaign Name", "Campaign Info", 0 }; static const char *type_labels[] = { "Solo", "Duel", 0 }; unsigned short wdh = sfont->Height() + 8, wdx, wdy = 5; Widget *wd; wdx = sfont->Width() * 4 + 10; wd = new CycleWidget( B_ID_PLAYERS, wdx, wdy, w/2 - wdx - 5, wdh, WIDGET_ALIGN_LEFT, "_Type", mission.GetNumPlayers()-1, type_labels, this ); wd->SetHook( this ); wdx = w/2 + sfont->Width() * 8 + 10; wd = new StringWidget( S_ID_SEQUEL, wdx, wdy, w - wdx - 5, wdh, mission.GetSequel(), 20, WIDGET_ALIGN_LEFT, "_Next Map", this ); wd->SetHook( this ); wdy += wdh + 5; wd = new StringWidget( S_ID_MUSIC, wdx, wdy, w - wdx - 5, wdh, mission.GetMusic(), 20, WIDGET_ALIGN_LEFT, "M_usic", this ); wd->SetHook( this ); wd = new CheckboxWidget( B_ID_CAMPAIGN, 5, wdy + (wdh - DEFAULT_CBW_SIZE)/2, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, mission.IsCampaign(), WIDGET_STYLE_NOBORDER|WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT, "_Campaign Map", this ); wd->SetHook( this ); wdx = wd->LeftEdge() + wd->Width() + sfont->TextWidth("Campaign Map") + 15; wd = new CheckboxWidget( B_ID_SKIRMISH, wdx, wd->TopEdge(), DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, mission.IsSkirmish(), WIDGET_STYLE_NOBORDER|WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT, "S_kirmish Map", this ); wd->SetHook( this ); wdy += wdh + 10; wd = new ButtonWidget( B_ID_SET, w - 15 - sfont->Width() * 3, wdy, sfont->Width() * 3 + 10, wdh, 0, "_Set", this ); wd->SetHook( this ); // the user can use the following widget to choose which message to // display in the textbox below wdx = sfont->Width() * 7 + 10; showmsg = new CycleWidget( B_ID_SHOWMSG, wdx, wdy, wd->LeftEdge() - wdx - 5, wdh, WIDGET_ALIGN_LEFT, "_Message", 0, msg_labels, this ); showmsg->SetHook( this ); wdy += wdh + 5; msg = new TextScrollWidget( 0, 5, wdy, w - 10, h - wdh - 5 - wdy, mission.GetMessage(mission.GetName()), 0, NULL, this ); new ButtonWidget( GUI_CLOSE, 1, h - wdh - 1, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ); Draw(); Show(); TLWListBuilder::BuildMsgList( mission.GetMessages(), tlist ); } //////////////////////////////////////////////////////////////////////// // NAME : EdMissionSetupWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the button // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdMissionSetupWindow::WidgetActivated( Widget *widget, Window *win ) { TLWNode *n; unsigned char pid; switch ( widget->ID() ) { case B_ID_BRIEF1: case B_ID_BRIEF2: pid = widget->ID() - B_ID_BRIEF1; n = static_cast(win)->Selected(); mission.GetPlayer(pid).SetBriefing( n ? n->ID() : -1 ); msg->SetText( n ? mission.GetMessage(n->ID()) : NULL ); break; case B_ID_NAME: n = static_cast(win)->Selected(); mission.SetName( n ? n->ID() : -1 ); msg->SetText( n ? mission.GetMessage(n->ID()) : NULL ); break; case B_ID_INFO: n = static_cast(win)->Selected(); mission.SetLevelInfoMsg( n ? n->ID() : -1 ); msg->SetText( n ? mission.GetMessage(n->ID()) : NULL ); break; case B_ID_CAMPAIGN: mission.SetCampaign( widget->Clicked() ); break; case B_ID_CAMPAIGN_INFO: n = static_cast(win)->Selected(); mission.SetCampaignInfo( n ? n->ID() : -1 ); msg->SetText( n ? mission.GetMessage(n->ID()) : NULL ); break; case B_ID_CAMPAIGN_NAME: n = static_cast(win)->Selected(); mission.SetCampaignName( n ? n->ID() : -1 ); msg->SetText( n ? mission.GetMessage(n->ID()) : NULL ); break; case B_ID_SKIRMISH: mission.SetSkirmish( widget->Clicked() ); break; case S_ID_SEQUEL: mission.SetSequel( static_cast(widget)->String() ); break; case S_ID_MUSIC: mission.SetMusic( static_cast(widget)->String() ); break; case B_ID_PLAYER1: case B_ID_PLAYER2: pid = widget->ID() - B_ID_PLAYER1; n = static_cast(win)->Selected(); if ( n ) { const char *name = mission.GetMessage(n->ID()); if ( name && strlen(name) > 30 ) { new NoteWindow( "Error", "Player names must not be longer than 30 characters.", 0, view ); } else { mission.GetPlayer(pid).SetNameID( n->ID() ); msg->SetText( name ); } } else { mission.GetPlayer(pid).SetNameID( -1 ); msg->SetText( NULL ); } break; case B_ID_SET: { short msgid; bool optional = true; const char *label; switch ( showmsg->GetValue() ) { case B_ID_NAME: msgid = mission.GetName(); optional = false; label = "Select name"; break; case B_ID_INFO: msgid = mission.GetLevelInfoMsg(); label = "Select info"; break; case B_ID_PLAYER1: msgid = mission.GetPlayer(PLAYER_ONE).NameID(); optional = false; label = "Select name"; break; case B_ID_PLAYER2: msgid = mission.GetPlayer(PLAYER_TWO).NameID(); optional = false; label = "Select name"; break; case B_ID_BRIEF1: msgid = mission.GetPlayer(PLAYER_ONE).Briefing(); label = "Select briefing"; break; case B_ID_BRIEF2: msgid = mission.GetPlayer(PLAYER_TWO).Briefing(); label = "Select briefing"; break; case B_ID_CAMPAIGN_NAME: msgid = mission.GetCampaignName(); label = "Select campaign name"; break; case B_ID_CAMPAIGN_INFO: msgid = mission.GetCampaignInfo(); label = "Select campaign info"; break; default: return GUI_OK; } new ListSelectWindow( label, tlist, msgid, optional, this, showmsg->GetValue(), view ); break; } case B_ID_SHOWMSG: { short msgid; switch ( showmsg->GetValue() ) { case B_ID_NAME: msgid = mission.GetName(); break; case B_ID_INFO: msgid = mission.GetLevelInfoMsg(); break; case B_ID_PLAYER1: msgid = mission.GetPlayer(PLAYER_ONE).NameID(); break; case B_ID_PLAYER2: msgid = mission.GetPlayer(PLAYER_TWO).NameID(); break; case B_ID_BRIEF1: msgid = mission.GetPlayer(PLAYER_ONE).Briefing(); break; case B_ID_BRIEF2: msgid = mission.GetPlayer(PLAYER_TWO).Briefing(); break; case B_ID_CAMPAIGN_INFO: msgid = mission.GetCampaignInfo(); break; case B_ID_CAMPAIGN_NAME: msgid = mission.GetCampaignName(); break; default: msgid = -1; } msg->SetText( (msgid == -1) ? NULL : mission.GetMessage(msgid) ); break; } case B_ID_PLAYERS: mission.SetNumPlayers( static_cast(widget)->GetValue()+1 ); break; } msg->Draw(); msg->Show(); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdBuildingWindow::EdBuildingWindow // DESCRIPTION: This window contains the settings for a building. // PARAMETERS : bld - building to be modified // mission - currently active mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdBuildingWindow::EdBuildingWindow( Building &bld, Mission &mission, View *view ) : Window(WIN_CENTER, view), b(bld), mission(mission) { // calculate dimensions SetSize( MIN(sfont->Width() * 50, view->Width()), MIN(sfont->Height() * 12, view->Height()) ); unsigned short xoff, yoff = 5, wdh = sfont->Height() + 10; ButtonWidget *btn; btn = new ButtonWidget( B_ID_NAME, 5, yoff, sfont->Width() * 4 + 10, wdh, 0, "_Name", this ), btn->SetHook( this ); xoff = 10 + btn->Width(); const char *name = b.Name(); b_name = new StringWidget( 0, xoff, yoff, w/2 - xoff - 5, wdh, name ? name : "Error", 30, WIDGET_STR_CONST, NULL, this ); xoff = w/2 + 10 + sfont->TextWidth("Player"); b_player = new CycleWidget( B_ID_PLAYER, xoff, yoff, w - 5 - xoff, wdh, 0, "_Player", b.Owner(), player3_labels, this ); yoff += 5 + wdh; btn = new CheckboxWidget( B_ID_WORKSHOP, 5, yoff, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, b.IsWorkshop(), WIDGET_STYLE_NOBORDER|WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT, "_Workshop", this ); btn->SetHook( this ); btn = new CheckboxWidget( B_ID_FACTORY, 5, yoff + DEFAULT_CBW_SIZE + 5, DEFAULT_CBW_SIZE, DEFAULT_CBW_SIZE, b.IsFactory(), WIDGET_STYLE_NOBORDER|WIDGET_STYLE_GFX|WIDGET_ALIGN_RIGHT, "_Factory", this ); btn->SetHook( this ); btn = new ButtonWidget( B_ID_UNITS, w/2 + 5, yoff, (w - 20)/2, wdh, 0, "_Units...", this ), btn->SetHook( this ); yoff += 5 + wdh; b_factory_units = new ButtonWidget( B_ID_FACTORY_UNITS, btn->LeftEdge(), yoff, btn->Width(), wdh, (b.IsFactory() ? 0 : WIDGET_DISABLED), "F_actory Settings...", this ); b_factory_units->SetHook( this ); yoff += 5 + wdh; xoff = 10 + sfont->TextWidth("Crystals"); b_crystals = new NumberWidget( 0, xoff, yoff, sfont->Width() * 4 + 10, wdh, b.Crystals(), 0, b.MaxCrystals(), WIDGET_ALIGN_LEFT, "_Crystals", this ); xoff += b_crystals->Width() + 10 + sfont->TextWidth("of"); b_maxcrystals = new NumberWidget( N_ID_MAXCRYSTALS, xoff, yoff, b_crystals->Width(), wdh, b.MaxCrystals(), 0, 10000, WIDGET_ALIGN_LEFT, "of", this ); b_maxcrystals->SetHook( this ); xoff = w/2 + 5 + sfont->Width() * 7; b_mining = new NumberWidget( 0, xoff, yoff, b_crystals->Width(), wdh, b.CrystalProduction(), 0, 1000, WIDGET_ALIGN_LEFT, "O_utput", this ); btn = new ButtonWidget( B_ID_OK, 1, h - 1 - wdh, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ), btn->SetHook( this ); Draw(); Show(); TLWListBuilder::BuildUnitTypesList( mission.GetUnitSet(), fact_list_na ); if ( b.IsFactory() ) { TLWNode *n = static_cast(fact_list_na.Head()), *n2; while ( n ) { n2 = static_cast(n->Next()); if ( b.CanProduce( n->ID() ) ) { n->Remove(); fact_list_ok.InsertNodeSorted( n ); } n = n2; } } TLWListBuilder::BuildMsgList( mission.GetMessages(), msg_list ); } //////////////////////////////////////////////////////////////////////// // NAME : EdBuildingWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdBuildingWindow::WidgetActivated( Widget *widget, Window *win ) { switch ( widget->ID() ) { case B_ID_WORKSHOP: if ( widget->Clicked() ) b.SetFlags( BLD_WORKSHOP ); else b.UnsetFlags( BLD_WORKSHOP ); break; case B_ID_FACTORY: if ( widget->Clicked() ) { b.SetFlags( BLD_FACTORY ); b_factory_units->Enable(); } else { b.UnsetFlags( BLD_FACTORY ); b_factory_units->Disable(); } b_factory_units->Draw(); b_factory_units->Show(); break; case B_ID_UNITS: new EdUnitsWindow( mission, b, view ); break; case B_ID_FACTORY_UNITS: new ListExchangeWindow( fact_list_na, fact_list_ok, "Not Available", "Available", view ); break; case B_ID_OK: view->CloseWindow( win ); b.SetOwner( b_player->GetValue() ); b.SetCrystals( b_crystals->Number() ); b.SetMaxCrystals( b_maxcrystals->Number() ); b.SetCrystalProduction( b_mining->Number() ); for ( Unit *u = static_cast(mission.GetUnits().Head()); u; u = static_cast(u->Next()) ) { if ( u->Position() == b.Position() ) u->SetOwner( b.Owner() ); } // fix factory settings if ( b.IsFactory() ) { unsigned long unitmask = 0; for ( TLWNode *n = static_cast(fact_list_ok.Head()); n; n = static_cast(n->Next()) ) { unitmask |= (1 << n->ID()); } b.SetUnitProduction( unitmask ); } else b.SetUnitProduction( 0 ); break; case N_ID_MAXCRYSTALS: b_crystals->SetMax( b_maxcrystals->Number() ); break; case B_ID_NAME: new ListSelectWindow( "Select name", msg_list, b.NameID(), false, this, B_ID_NAME_OK, view ); break; case B_ID_NAME_OK: { TLWNode *mn = static_cast(win)->Selected(); const char *name = (mn ? mission.GetMessage(mn->ID()) : NULL); if ( name && strlen(name) > 30 ) { new NoteWindow( "Error", "Shop names must not be longer than 30 characters.", 0, view ); } else { b.SetNameID( mn ? mn->ID() : -1 ); b.SetName( name ); b_name->SetString( name ? name : "Error" ); } break; } } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdUnitWindow::EdUnitWindow // DESCRIPTION: This window contains the settings for a unit. // PARAMETERS : unit - unit to be modified // mission - currently active mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdUnitWindow::EdUnitWindow( Unit &unit, Mission &mission, View *view ) : Window(WIN_CENTER, view), u(unit), mission(mission), mv(0) { // calculate dimensions SetSize( MIN(sfont->Width() * 50, view->Width()), MIN(sfont->Height() * 12, view->Height()) ); unsigned short xoff, yoff = 5, wdh = sfont->Height() + 10; Widget *wd = new StringWidget( 0, 5, yoff, w/2 - 10, wdh, u.Name(), 19, WIDGET_STYLE_NOBORDER|WIDGET_STR_CONST, NULL, this ); xoff = w/2 + 10 + sfont->TextWidth("Player"); u_player = new CycleWidget( B_ID_PLAYER, xoff, yoff, w - 5 - xoff, wdh, (u.IsSheltered() ? WIDGET_DISABLED : 0), "_Player", u.Owner(), (u.IsSheltered() ? player3_labels : player2_labels), this ); u_player->SetHook( this ); yoff += 5 + wdh; new NumberWidget( 0, wd->LeftEdge() + 10 + sfont->Width() * 2, yoff, sfont->Width() * 6, wdh, u.ID(), 0, 32000, WIDGET_ALIGN_LEFT|WIDGET_STYLE_NOBORDER|WIDGET_STR_CONST, "ID", this ); xoff = w/2 + 10 + sfont->TextWidth("Direction"); wd = new CycleWidget( B_ID_DIRECTION, xoff, yoff, w - 5 - xoff, wdh, 0, "_Direction", u.GetDirection(), dir_labels, this ); wd->SetHook( this ); yoff += 5 + wdh; xoff = 10 + sfont->TextWidth("Squad Size"); wd = new CycleWidget( B_ID_SIZE, xoff, yoff, w/2 - 5 - xoff, wdh, 0, "Squad _Size", u.GroupSize() - 1, size_labels, this ); wd->SetHook( this ); xoff = w/2 + 10 + sfont->TextWidth("XP Level"); wd = new CycleWidget( B_ID_XP, xoff, yoff, w - 5 - xoff, wdh, 0, "XP _Level", u.XPLevel(), xp_labels, this ); wd->SetHook( this ); yoff += 5 + wdh; if ( u.IsTransport() && !u.IsSheltered() ) { xoff = 10 + sfont->TextWidth("Crystals"); // maximum number of crystals should be // (mission.StorageLeft(u) + (u.Crystals() + 9)/10) * 10, // but we can't update that maxium when the list of contained units // changes, so we allow the maximum here and update manually when the // widget is activated if necessary wd = new NumberWidget( N_ID_CRYSTALS, xoff, yoff, sfont->Width() * 6, wdh, u.Crystals(), 0, u.Type()->Slots() * 10, WIDGET_ALIGN_LEFT, "_Crystals", this ); wd->SetHook( this ); wd = new ButtonWidget( B_ID_UNITS, w/2 + 5, yoff, (w - 20)/2, wdh, 0, "_Units...", this ), wd->SetHook( this ); } wd = new ButtonWidget( B_ID_OK, 1, h - 1 - wdh, w - 2, wdh, WIDGET_DEFAULT, "_OK", this ), wd->SetHook( this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdUnitWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdUnitWindow::WidgetActivated( Widget *widget, Window *win ) { GUI_Status rc = GUI_OK; switch ( widget->ID() ) { case B_ID_DIRECTION: u.SetDirection( static_cast(widget)->GetValue() ); break; case B_ID_SIZE: u.SetGroupSize( static_cast(widget)->GetValue() + 1 ); break; case B_ID_XP: u.SetXP( static_cast(widget)->GetValue() * XP_PER_LEVEL ); break; case B_ID_UNITS: new EdUnitsWindow( mission, u, view ); break; case N_ID_CRYSTALS: { NumberWidget *cwidget = static_cast(widget); unsigned short crystals = MIN( cwidget->Number(), (mission.StorageLeft(u) + (u.Crystals() + 9)/10) * 10 ); if ( cwidget->Number() != crystals ) cwidget->SetNumber( crystals ); u.SetCrystals( crystals ); break; } case B_ID_OK: view->CloseWindow( win ); u.SetOwner( u_player->GetValue() ); if ( u.IsTransport() && !u.IsSheltered() ) { for ( Unit *walk = static_cast(mission.GetUnits().Head()); walk; walk = static_cast(walk->Next()) ) { if ( walk->Position() == u.Position() ) walk->SetOwner( u.Owner() ); } } if ( mv ) view->Refresh( mv->UpdateHex(u.Position()) ); break; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : EdEventsWindow::EdEventsWindow // DESCRIPTION: This window presents the list of events for selection. // PARAMETERS : mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdEventsWindow::EdEventsWindow( Mission &mission, View *view ) : Window(WIN_CENTER, view), mission(mission) { // calculate dimensions SetSize( MIN(sfont->Width() * 20 + 20, view->Width()), MIN( MAX(mission.GetEvents().CountNodes() + 2, 6) * (sfont->Height() + 2) + 40, view->Height()) ); TLWListBuilder::BuildEventList( mission.GetEvents(), nodes ); e_list = new TextListWidget( 0, 5, 5, w - 10, h - sfont->Height() * 2 - 30, &nodes, -1, WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY, NULL, this ); ButtonWidget *btn = new ButtonWidget( B_ID_NEW, 1, h - sfont->Height() * 2 - 17, (w - 2)/2, sfont->Height() + 8, 0, "_New", this ); btn->SetHook( this ); btn = new ButtonWidget( B_ID_EDIT, btn->LeftEdge() + btn->Width(), btn->TopEdge(), btn->Width(), btn->Height(), 0, "_Edit", this ); btn->SetHook( this ); btn = new ButtonWidget( B_ID_DELETE, btn->LeftEdge() - btn->Width(), btn->TopEdge() + btn->Height(), btn->Width(), btn->Height(), 0, "_Delete", this ); btn->SetHook( this ); btn = new ButtonWidget( B_ID_OK, btn->LeftEdge() + btn->Width(), btn->TopEdge(), btn->Width(), btn->Height(), 0, "_OK", this ); btn->SetHook( this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdEventsWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : button - activated button widget // win - window containing the button // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdEventsWindow::WidgetActivated( Widget *button, Window *win ) { switch ( button->ID() ) { case B_ID_EDIT: { TLWNode *n = static_cast( e_list->Selected() ); if ( n ) { Event *e = (Event *)n->UserData(); new EdEventGenericWindow( *e, mission, view ); } break; } case B_ID_NEW: view->CloseWindow( win ); new SelectEventWindow( mission, view ); break; case B_ID_DELETE: { TLWNode *n = static_cast( e_list->Selected() ); if ( n ) { Event *e = (Event *)n->UserData(); n->Remove(); delete n; e_list->Update(); e_list->Draw(); e_list->Show(); mission.DeleteEvent( e ); } break; } case B_ID_OK: view->CloseWindow( win ); break; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : SelectEventWindow::SelectEventWindow // DESCRIPTION: This window presents the list of event types for the // purpose of creating a new event. // PARAMETERS : mission - current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// SelectEventWindow::SelectEventWindow( Mission &mission, View *view ) : Window(WIN_CENTER, view), mission(mission) { // calculate dimensions SetSize( MIN(sfont->Width() * 18 + 20, view->Width()), MIN( 10 * (sfont->Height() + 2) + 42, view->Height()) ); BuildTLWList( nodes ); e_list = new TextListWidget( 0, 5, 5, w - 10, h - sfont->Height() * 3 - 36, &nodes, -1, WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY, NULL, this ); e_trigger = new CycleWidget( B_ID_TRIGGER, e_list->LeftEdge(), e_list->TopEdge() + e_list->Height() + sfont->Height() + 10, e_list->Width(), sfont->Height() + 8, WIDGET_ALIGN_TOP, "_Triggered by", 0, etrigger_labels, this ); ButtonWidget *btn = new ButtonWidget( B_ID_OK, 1, h - sfont->Height() - 9, (w - 2)/2, sfont->Height() + 8, WIDGET_DEFAULT, "_OK", this ); btn->SetHook( this ); btn = new ButtonWidget( B_ID_CANCEL, btn->LeftEdge() + btn->Width(), btn->TopEdge(), btn->Width(), btn->Height(), 0, "_Cancel", this ); btn->SetHook( this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : SelectEventWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : button - activated button widget // win - window containing the button // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status SelectEventWindow::WidgetActivated( Widget *button, Window *win ) { switch ( button->ID() ) { case B_ID_OK: if ( e_list->Selected() ) { view->CloseWindow( win ); Event *e = mission.CreateEvent( static_cast(e_list->Selected())->ID(), e_trigger->GetValue() ); if ( e ) new EdEventGenericWindow( *e, mission, view ); } break; case B_ID_CANCEL: view->CloseWindow( win ); break; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : SelectEventWindow::BuildTLWList // DESCRIPTION: Create a list for a TextListWidget containing all // available event types. // PARAMETERS : list - list of TLWNodes to be filled // RETURNS : - //////////////////////////////////////////////////////////////////////// void SelectEventWindow::BuildTLWList( TLWList &events ) const { for ( int i = 0; event_labels[i]; ++i ) events.InsertNodeSorted( new TLWNode(event_labels[i], 0, i+1) ); } //////////////////////////////////////////////////////////////////////// // NAME : EdUnitsWindow::EdUnitsWindow // DESCRIPTION: This window presents the list of units in a unit // container (building or transporter) for selection. // PARAMETERS : mission - current mission // container - selected unit container // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdUnitsWindow::EdUnitsWindow( Mission &mission, MapObject &container, View *view ) : Window(WIN_CENTER, view), mission(mission), container(container) { TLWListBuilder::BuildUnitList( mission.GetUnits(), nodes, container.Position() ); // calculate dimensions SetSize( MIN(sfont->Width() * 30 + 20, view->Width()), MIN( MAX(nodes.CountNodes() + 2, 6) * (sfont->Height() + 2) + 40, view->Height()) ); e_list = new TextListWidget( 0, 5, 5, w - 10, h - sfont->Height() * 2 - 30, &nodes, -1, WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY, NULL, this ); ButtonWidget *btn = new ButtonWidget( B_ID_NEW, 1, h - sfont->Height() * 2 - 17, (w - 2)/2, sfont->Height() + 8, 0, "_New", this ); btn->SetHook( this ); btn = new ButtonWidget( B_ID_EDIT, btn->LeftEdge() + btn->Width(), btn->TopEdge(), btn->Width(), btn->Height(), 0, "_Edit", this ); btn->SetHook( this ); btn = new ButtonWidget( B_ID_DELETE, btn->LeftEdge() - btn->Width(), btn->TopEdge() + btn->Height(), btn->Width(), btn->Height(), 0, "_Delete", this ); btn->SetHook( this ); btn = new ButtonWidget( B_ID_OK, btn->LeftEdge() + btn->Width(), btn->TopEdge(), btn->Width(), btn->Height(), 0, "_OK", this ); btn->SetHook( this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdUnitsWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : button - activated button widget // win - window containing the button // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdUnitsWindow::WidgetActivated( Widget *button, Window *win ) { TLWNode *n; switch ( button->ID() ) { case B_ID_EDIT: n = static_cast( e_list->Selected() ); if ( n ) new EdUnitWindow( *((Unit *)n->UserData()), mission, view ); break; case B_ID_NEW: utypes.Clear(); BuildTLWList( utypes ); new SelectUnitWindow( mission, utypes, this, view ); break; case B_ID_DELETE: n = static_cast( e_list->Selected() ); if ( n ) { Unit *u = (Unit *)n->UserData(); n->Remove(); delete n; e_list->Update(); e_list->Draw(); e_list->Show(); mission.DeleteUnit( u ); } break; case B_ID_OK: view->CloseWindow( win ); break; case B_ID_SUW_OK: { const UnitType *ut = static_cast(win)->Selected(); view->CloseWindow( win ); if ( ut ) { Unit *u = mission.CreateUnit( ut, container.Owner(), container.Position() ); if ( u ) { char buf[28]; sprintf( buf, "%s (%d)", u->Name(), u->ID() ); nodes.InsertNodeSorted( new TLWNode( buf, u ) ); e_list->Update(); e_list->Draw(); e_list->Show(); } } break; } } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdUnitsWindow::BuildTLWList // DESCRIPTION: Construct a list with all legal unit types for the // current container. // PARAMETERS : list - list to add nodes to // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdUnitsWindow::BuildTLWList( TLWList &list ) const { const UnitSet &us = mission.GetUnitSet(); TLWListBuilder::BuildUnitTypesList( us, list ); // now remove all unit types which are not allowed by the container unsigned short maxw = container.MaxWeight(); if ( container.IsUnit() ) maxw = MIN( maxw, mission.StorageLeft(static_cast(container)) ); TLWNode *n = static_cast(list.Head()), *n2; while ( n ) { const UnitType *ut = us.GetUnitInfo( n->ID() ); if ( (ut->Weight() < container.MinWeight()) || (ut->Weight() > maxw) ) { n2 = static_cast(n->Next()); n->Remove(); delete n; n = n2; } else n = static_cast(n->Next()); } } //////////////////////////////////////////////////////////////////////// // NAME : SelectUnitWindow::SelectUnitWindow // DESCRIPTION: This window presents the list of unit types. // PARAMETERS : mission - current mission // hook - widget hook to activate when OK is pressed // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// SelectUnitWindow::SelectUnitWindow( Mission &mission, WidgetHook *hook, View *view ) : Window(WIN_CENTER, view), mission(mission) { TLWListBuilder::BuildUnitTypesList( mission.GetUnitSet(), nodes ); Init( nodes, hook ); } //////////////////////////////////////////////////////////////////////// // NAME : SelectUnitWindow::SelectUnitWindow // DESCRIPTION: This window presents the list of unit types. // PARAMETERS : mission - current mission // list - use this list instead of constructing our own // hook - widget hook to activate when OK is pressed // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// SelectUnitWindow::SelectUnitWindow( Mission &mission, TLWList &list, WidgetHook *hook, View *view ) : Window(WIN_CENTER, view), mission(mission) { Init( list, hook ); } //////////////////////////////////////////////////////////////////////// // NAME : SelectUnitWindow::Init // DESCRIPTION: Set up the window properties and create the widgets. // PARAMETERS : list - list to present // hook - widget hook to activate when OK is pressed // RETURNS : - //////////////////////////////////////////////////////////////////////// void SelectUnitWindow::Init( TLWList &list, WidgetHook *hook ) { // calculate dimensions SetSize( MIN(sfont->Width() * 24 + 20, view->Width()), MIN( MAX(list.CountNodes() + 1, 6) * (sfont->Height() + 2) + 25, view->Height()) ); e_list = new TextListWidget( 0, 5, 5, w - 10, h - sfont->Height() - 15, &list, -1, WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY, NULL, this ); ButtonWidget *btn = new ButtonWidget( B_ID_SUW_OK, 1, h - sfont->Height() - 9, (w - 2)/2, sfont->Height() + 8, WIDGET_DEFAULT, "_OK", this ); btn->SetHook( hook ); btn = new ButtonWidget( B_ID_CANCEL, btn->LeftEdge() + btn->Width(), btn->TopEdge(), btn->Width(), btn->Height(), 0, "_Cancel", this ); btn->SetHook( this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : SelectUnitWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : button - activated button widget // win - window containing the button // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status SelectUnitWindow::WidgetActivated( Widget *button, Window *win ) { if ( button->ID() == B_ID_CANCEL ) view->CloseWindow( win ); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : SelectUnitWindow::Selected // DESCRIPTION: Get the selected unit type. // PARAMETERS : - // RETURNS : selected unit type or NULL if none selected //////////////////////////////////////////////////////////////////////// const UnitType *SelectUnitWindow::Selected( void ) const { TLWNode *n = static_cast(e_list->Selected()); if ( n ) return mission.GetUnitSet().GetUnitInfo( n->ID() ); return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : EdMsgWindow::EdMsgWindow // DESCRIPTION: This window offers a way to create new language catalogs // and messages or modify existing ones. // PARAMETERS : locale - locale of the current mission // view - pointer to the window's view // RETURNS : - //////////////////////////////////////////////////////////////////////// EdMsgWindow::EdMsgWindow( Locale &locale, View *view ) : Window(WIN_CENTER, view), locale(locale), cur_lang(0), cur_msg_id(-1) { // calculate dimensions SetSize( MIN(sfont->Width() * 35 + 20, view->Width()), MIN((sfont->Height() + 2) * 10 + 50, view->Height()) ); BuildLangsList(); if ( !l_langs.IsEmpty() ) { cur_lang = static_cast(static_cast(l_langs.Head())->UserData()); BuildMsgsList(); if ( !l_msgs.IsEmpty() ) cur_msg_id = 0; } ButtonWidget *btn; unsigned short wdh = sfont->Height() + 8, wdw, wdy; wdw = sfont->TextWidth("Languages") + 10; w_langs = new TextListWidget( L_ID_LANGS, wdw * 2 + 20, 10, w - 30 - wdw * 2, sfont->Height() + 10 + 2 * wdh, &l_langs, l_langs.IsEmpty() ? -1 : 0, WIDGET_HSCROLLKEY, NULL, this ); w_langs->SetHook( this ); btn = new ButtonWidget( B_ID_LANG_NEW, 10, w_langs->TopEdge() + sfont->Height() + 5, wdw, wdh, 0, "_New", this ); btn->SetHook( this ); wdw = sfont->TextWidth("ID") + 5; w_lid = new StringWidget( 0, btn->LeftEdge() + wdw, btn->TopEdge() + wdh + 5, btn->Width() - wdw, wdh, NULL, 2, WIDGET_ALIGN_LEFT, "_ID", this ); btn = new ButtonWidget( B_ID_LANG_DELETE, btn->LeftEdge() + btn->Width() + 5, btn->TopEdge(), btn->Width(), wdh, 0, "_Delete", this ); btn->SetHook( this ); wdy = w_lid->TopEdge() + wdh + 10; w_msgs = new TextListWidget( L_ID_MSGS, 5, wdy, w - 10, h - wdy - 2 * wdh - 15, &l_msgs, cur_msg_id, WIDGET_VSCROLLKEY, NULL, this ); w_msgs->SetHook( this ); wdw = sfont->TextWidth("Text") + 10; w_msg = new StringWidget( 0, wdw, w_msgs->TopEdge() + w_msgs->Height() + 5, w - wdw - 5, wdh, cur_msg_id == -1 ? NULL : cur_lang->GetMsg(cur_msg_id), 4096, WIDGET_ALIGN_LEFT, "_Text", this ); btn = new ButtonWidget( B_ID_MSG_ADD, w_msgs->LeftEdge(), w_msg->TopEdge() + wdh + 5, (w - 20) / 4, wdh, 0, "_Add", this ); btn->SetHook( this ); btn = new ButtonWidget( B_ID_MSG_MODIFY, btn->LeftEdge() + btn->Width() + 5, btn->TopEdge(), btn->Width(), wdh, 0, "_Modify", this ); btn->SetHook( this ); btn = new ButtonWidget( GUI_CLOSE, w - 5 - btn->Width(), btn->TopEdge(), btn->Width(), wdh, 0, "_OK", this ); Draw(); Show(); } //////////////////////////////////////////////////////////////////////// // NAME : EdMsgWindow::WidgetActivated // DESCRIPTION: React to user actions. // PARAMETERS : widget - activated widget // win - window containing the widget // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status EdMsgWindow::WidgetActivated( Widget *widget, Window *win ) { TLWNode *n; switch ( widget->ID() ) { case L_ID_LANGS: n = static_cast( w_langs->Selected() ); if ( n ) { cur_lang = static_cast( n->UserData() ); BuildMsgsList(); w_msgs->Update(); if ( cur_msg_id != -1 ) { w_msgs->Select( cur_msg_id ); w_msg->SetString( cur_lang->GetMsg( cur_msg_id ) ); } w_msgs->Draw(); w_msgs->Show(); } break; case L_ID_MSGS: n = static_cast( w_msgs->Selected() ); if ( n ) { w_msg->SetString( (char *)n->UserData() ); cur_msg_id = n->ID(); } break; case B_ID_LANG_NEW: { Language l; if ( l_langs.CountNodes() == 0 ) { // add empty English catalog l.SetID( CF_LANG_DEFAULT ); } else { // copy English catalog to new language const char *id = w_lid->String(); if ( id ) { if ( locale.GetLanguage( id ) ) { new NoteWindow( "Error", "This ID is already taken.", 0, view ); break; } else { const Language *def = locale.GetLanguage( CF_LANG_DEFAULT ); l.SetID( id ); for ( int i = 0; i < def->Size(); ++i ) l.AddMsg( def->GetMsg( i ) ); } } else { new NoteWindow( "Error", "Please enter an ID first.", 0, view ); break; } } locale.AddLanguage( l ); BuildLangsList(); w_langs->Update(); w_langs->Draw(); w_langs->Show(); break; } case B_ID_LANG_DELETE: if ( cur_lang ) { if ( (string(cur_lang->ID()) == CF_LANG_DEFAULT) && (l_langs.CountNodes() > 1) ) { new NoteWindow( "Error", "You cannot delete the default catalog", 0, view ); } else { locale.RemoveLanguage( *cur_lang ); BuildLangsList(); w_langs->Update(); w_langs->Draw(); w_langs->Show(); if ( w_langs->Selected() ) { cur_lang = static_cast( static_cast(w_langs->Selected())->UserData() ); } else cur_lang = NULL; BuildMsgsList(); cur_msg_id = l_msgs.IsEmpty() ? -1 : 0; w_msgs->Update(); w_msgs->Select( cur_msg_id ); w_msgs->Draw(); w_msgs->Show(); w_msg->SetString( cur_lang ? cur_lang->GetMsg( cur_msg_id ) : NULL ); } } break; case B_ID_MSG_ADD: if ( w_msg->String() ) { // append the message to _all_ languages for ( TLWNode *n = static_cast( l_langs.Head() ); n; n = static_cast( n->Next() ) ) { Language *l = static_cast( n->UserData() ); l->AddMsg( w_msg->String() ); } BuildMsgsList(); w_msgs->Update(); if ( cur_msg_id == -1 ) w_msg->SetString( NULL ); else w_msgs->Select( cur_lang->Size() - 1 ); w_msgs->Draw(); w_msgs->Show(); } break; case B_ID_MSG_MODIFY: if ( (cur_msg_id != -1) && w_msg->String() ) { cur_lang->SetMsg( w_msg->String(), cur_msg_id ); BuildMsgsList(); w_msgs->Draw(); w_msgs->Show(); } break; } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : EdMsgWindow::Draw // DESCRIPTION: Draw the window. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdMsgWindow::Draw( void ) { Window::Draw(); DrawBox( Rect(5, 5, w - 10, w_langs->Height() + 10), BOX_CARVED ); sfont->Write( "Languages", this, 10, 10 ); } //////////////////////////////////////////////////////////////////////// // NAME : EdMsgWindow::BuildLangsList // DESCRIPTION: Compile the list of available languages. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdMsgWindow::BuildLangsList( void ) { const std::map &lib = locale.GetLibrary(); l_langs.Clear(); for ( map::const_iterator iter = lib.begin(); iter != lib.end(); ++iter ) { l_langs.InsertNodeSorted( new TLWNode( iter->second.ID(), const_cast(&iter->second) ) ); } } //////////////////////////////////////////////////////////////////////// // NAME : EdMsgWindow::BuildMsgsList // DESCRIPTION: Compile the list of messages in the current language. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void EdMsgWindow::BuildMsgsList( void ) { l_msgs.Clear(); if ( cur_lang ) { const char *m; for ( int i = 0; (m = cur_lang->GetMsg(i)) != 0; ++i ) { l_msgs.AddTail( new TLWNode(string(m).substr(0, 30).c_str(), const_cast(m), i) ); } } } crimson-0.5.2.orig/src/comet/extwindow2.h0000600000175000017500000001616110554366467016507 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // extwindow2.h - extended window classes for CoMET /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_ED_EXTWINDOW2_H #define _INCLUDE_ED_EXTWINDOW2_H #include "window.h" #include "button.h" #include "misc.h" #include "mission.h" #include "mapview.h" class ListExchangeWindow : public Window, public WidgetHook { public: ListExchangeWindow( TLWList &l1, TLWList &l2, const char *label1, const char *label2, View *view ); void SetHook( WidgetHook *hook ) const { ok->SetHook(hook); } private: GUI_Status WidgetActivated( Widget *widget, Window *win ); enum { B_ID_OK = 1, B_ID_RIGHT, B_ID_LEFT }; ButtonWidget *ok; TextListWidget *wd_l1; TextListWidget *wd_l2; TLWList &list1; TLWList &list2; }; class ListSelectWindow : public Window, public WidgetHook { public: ListSelectWindow( const char *title, TLWList &list, short defid, bool nullok, WidgetHook *hook, short button, View *view ); TLWNode *Selected( void ) const { return current; } private: GUI_Status WidgetActivated( Widget *widget, Window *win ); short button; bool nullok; TextListWidget *lw; const TLWList &list; WidgetHook *client; TLWNode *current; }; // create a new mission class NewMissionWindow : public Window, public WidgetHook { public: NewMissionWindow( View *view ); void SetHook( WidgetHook *hook, short id ) { this->hook = hook; ok_id = id; } Mission *GetMission( void ) const { return mission; } private: Mission *NewMission( const Point &size, const string &tset, const string &uset ); Point GetMapSize( void ) const; const char *GetTileSet( void ) const { return tileset->String(); } const char *GetUnitSet( void ) const { return unitset->String(); } GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_UNITSET = 1, B_ID_TILESET, B_ID_UNITSET_OK, B_ID_TILESET_OK, B_ID_RANDOM, B_ID_OK }; Mission *mission; NumberWidget *m_width; NumberWidget *m_height; StringWidget *tileset; StringWidget *unitset; CheckboxWidget *gen_random; SliderWidget *gen_water; SliderWidget *gen_roughness; WidgetHook *hook; short ok_id; }; class EdMissionSetupWindow : public Window, public WidgetHook { public: EdMissionSetupWindow( Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *widget, Window *win ); enum { B_ID_NAME, B_ID_INFO, B_ID_PLAYER1, B_ID_PLAYER2, B_ID_BRIEF1, B_ID_BRIEF2, B_ID_CAMPAIGN_NAME, B_ID_CAMPAIGN_INFO, B_ID_SHOWMSG, B_ID_SET, S_ID_SEQUEL, B_ID_PLAYERS, S_ID_MUSIC, B_ID_CAMPAIGN, B_ID_SKIRMISH }; Mission &mission; StringWidget *nextmap; TextScrollWidget *msg; CycleWidget *showmsg; TLWList tlist; }; class EdBuildingWindow : public Window, public WidgetHook { public: EdBuildingWindow( Building &bld, Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *widget, Window *win ); enum { B_ID_PLAYER = 1, B_ID_WORKSHOP, B_ID_FACTORY, B_ID_CRYSTALS, B_ID_OK, B_ID_NAME, B_ID_NAME_OK, B_ID_UNITS, N_ID_MAXCRYSTALS, B_ID_FACTORY_UNITS }; Building &b; Mission &mission; StringWidget *b_name; CycleWidget *b_player; NumberWidget *b_crystals; NumberWidget *b_maxcrystals; NumberWidget *b_mining; ButtonWidget *b_factory_units; TLWList fact_list_ok; TLWList fact_list_na; TLWList msg_list; }; class EdUnitWindow : public Window, public WidgetHook { public: EdUnitWindow( Unit &unit, Mission &mission, View *view ); void SetMapView( MapView &mapview ) { mv = &mapview; } private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_PLAYER = 1, B_ID_DIRECTION, B_ID_SIZE, B_ID_XP, N_ID_CRYSTALS, B_ID_UNITS, B_ID_OK }; Unit &u; Mission &mission; MapView *mv; // we need this to update the map display // if e.g. owner or direction changes CycleWidget *u_player; }; class EdEventsWindow : public Window, public WidgetHook { public: EdEventsWindow( Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_NEW = 1, B_ID_EDIT, B_ID_DELETE, B_ID_OK }; TextListWidget *e_list; TLWList nodes; Mission &mission; }; class SelectEventWindow : public Window, public WidgetHook { public: SelectEventWindow( Mission &mission, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); void BuildTLWList( TLWList &list ) const; enum { B_ID_TRIGGER = 1, B_ID_OK, B_ID_CANCEL }; TextListWidget *e_list; CycleWidget *e_trigger; TLWList nodes; Mission &mission; }; class EdUnitsWindow : public Window, public WidgetHook { public: EdUnitsWindow( Mission &mission, MapObject &container, View *view ); private: GUI_Status WidgetActivated( Widget *button, Window *win ); void BuildTLWList( TLWList &list ) const; enum { B_ID_NEW = 1, B_ID_EDIT, B_ID_DELETE, B_ID_OK }; TextListWidget *e_list; TLWList nodes; TLWList utypes; Mission &mission; MapObject &container; }; class SelectUnitWindow : public Window, public WidgetHook { public: SelectUnitWindow( Mission &mission, WidgetHook *hook, View *view ); SelectUnitWindow( Mission &mission, TLWList &list, WidgetHook *hook, View *view ); const UnitType *Selected( void ) const; private: GUI_Status WidgetActivated( Widget *button, Window *win ); void Init( TLWList &list, WidgetHook *hook ); enum { B_ID_CANCEL = 1 }; TextListWidget *e_list; TLWList nodes; Mission &mission; }; class EdMsgWindow : public Window, public WidgetHook { public: EdMsgWindow( Locale &locale, View *view ); private: void Draw( void ); void BuildLangsList( void ); void BuildMsgsList( void ); GUI_Status WidgetActivated( Widget *button, Window *win ); enum { B_ID_LANG_NEW = 1, B_ID_LANG_DELETE, B_ID_MSG_ADD, B_ID_MSG_MODIFY, L_ID_LANGS, L_ID_MSGS }; TextListWidget *w_langs; TextListWidget *w_msgs; StringWidget *w_msg; StringWidget *w_lid; Locale &locale; TLWList l_langs; TLWList l_msgs; Language *cur_lang; int cur_msg_id; }; #endif // _INCLUDE_ED_EXTWINDOW2_H crimson-0.5.2.orig/src/comet/gfxwidget.cpp0000600000175000017500000003111310546530033016671 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // gfxwidget.cpp //////////////////////////////////////////////////////////////////////// #include "gfxwidget.h" #include "misc.h" //////////////////////////////////////////////////////////////////////// // NAME : GfxWidget::GfxWidget // DESCRIPTION: Create a new gfx widget. // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // flags - widget flags (see widget.h for details) // title - widget title (currently unused) // window - widget parent window // RETURNS : - //////////////////////////////////////////////////////////////////////// GfxWidget::GfxWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ) : CompositeWidget( id, x, y, w, h, flags, title, window ), bounds( x + 4, y + 4, w - 8 - DEFAULT_SLIDER_SIZE, h - 8 ) { spacing = 0; init = false; } //////////////////////////////////////////////////////////////////////// // NAME : GfxWidget::Init // DESCRIPTION: Initialize a gfx widget. This needs to be called when a // new set of images is to be bound to the widget. // PARAMETERS : gfxw - width of a gfx item in pixels // gfxh - height of a gfx item in pixels // items - number of gfx items to be displayed // RETURNS : - //////////////////////////////////////////////////////////////////////// void GfxWidget::Init( unsigned short gfxw, unsigned short gfxh, unsigned short items ) { this->items = items; gfx_w = gfxw; gfx_h = gfxh; gfx_per_row = MAX( bounds.w/gfxw, 1 ); toprow = 0; rows = (items + gfx_per_row - 1) / gfx_per_row * ItemHeight(); visrows = MIN( bounds.h, rows ); current = -1; SliderWidget *slider = static_cast( GetWidget(0) ); if ( slider ) { slider->Adjust( 0, rows - visrows, visrows ); slider->ScrollTo( 0 ); } else { // create the corresponding slider widget slider = new SliderWidget( 0, x + w - DEFAULT_SLIDER_SIZE, y, DEFAULT_SLIDER_SIZE, h, 0, rows - visrows, toprow, visrows, WIDGET_VSCROLL|WIDGET_COMPOSITE, NULL, surface ); slider->SetHook( this ); AddWidget( slider ); } init = true; } //////////////////////////////////////////////////////////////////////// // NAME : GfxWidget::Draw // DESCRIPTION: Draw the widget. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void GfxWidget::Draw( void ) { CompositeWidget::Draw(); surface->DrawBox( Rect(x,y,bounds.w+8,h), BOX_RECESSED ); if ( init ) DrawItems(); } //////////////////////////////////////////////////////////////////////// // NAME : GfxWidget::DrawItems // DESCRIPTION: Draw widget content. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// void GfxWidget::DrawItems( void ) { unsigned short row = toprow / ItemHeight(); unsigned short num = row * gfx_per_row; // first visible item short xoff = bounds.x, yoff = bounds.y + row * ItemHeight() - toprow, img; surface->DrawBack( bounds ); while ( (img = GetImage(num)) != -1 ) { if ( num == current ) { Rect hilite( xoff, yoff, gfx_w, ItemHeight() ); hilite.Clip( bounds ); surface->FillRectAlpha( hilite, surface->GetFGPen() ); } DrawItem( img, xoff, yoff ); xoff += gfx_w; if ( xoff + gfx_w >= bounds.x + bounds.w ) { xoff = bounds.x; yoff += ItemHeight(); if ( yoff >= bounds.y + bounds.h ) break; } ++num; } } //////////////////////////////////////////////////////////////////////// // NAME : GfxWidget::Select // DESCRIPTION: Adjust the widget so that the selected item is visible // and highlight it. // PARAMETERS : item - number of the item to select // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status GfxWidget::Select( short item ) { if ( item < 0 ) item = -1; else if ( item >= items ) item = items - 1; if ( item != current ) { short newtop = toprow; current = item; if ( current >= 0 ) { short selrow = (current/gfx_per_row) * ItemHeight(); if ( selrow < toprow ) newtop = selrow; else if ( selrow + ItemHeight() >= newtop + visrows ) newtop = selrow - visrows + ItemHeight(); } if ( toprow != newtop ) { static_cast( GetWidget(0) )->ScrollTo( newtop ); } else { DrawItems(); Show(); } } if ( hook ) return hook->WidgetActivated( this, surface ); return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : GfxWidget::WidgetActivated // DESCRIPTION: Adjust the widget so that it matches the current slider // setting. // PARAMETERS : widget - activated widget (slider) // win - window the widget is attached to // RETURNS : GUI_OK //////////////////////////////////////////////////////////////////////// GUI_Status GfxWidget::WidgetActivated( Widget *widget, Window *win ) { if ( widget->ID() == 0 ) { toprow = static_cast(widget)->Level(); DrawItems(); Show(); } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : GfxWidget::MouseDown // DESCRIPTION: Select an image or scroll the list. // PARAMETERS : button - SDL_MouseButtonEvent received from the event // handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status GfxWidget::MouseDown( const SDL_MouseButtonEvent &button ) { SDL_MouseButtonEvent mybutton = button; if ( ((button.button == SDL_BUTTON_WHEELUP) || (button.button == SDL_BUTTON_WHEELDOWN)) && Contains( button.x - surface->LeftEdge(), button.y - surface->TopEdge() ) ) { // reroute all wheel events to the scroller SliderWidget *s = static_cast( GetWidget(0) ); if ( s ) { mybutton.x = s->LeftEdge() + surface->LeftEdge(); mybutton.y = s->TopEdge() + surface->TopEdge(); } } GUI_Status rc = CompositeWidget::MouseDown( mybutton ); if ( (rc == GUI_OK) && (button.button == SDL_BUTTON_LEFT) ) { short mx = button.x - surface->LeftEdge(); short my = button.y - surface->TopEdge(); if ( bounds.Contains( mx, my ) && (mx < bounds.x + gfx_per_row * gfx_w) ) { short col = (mx - bounds.x) / gfx_w; short row = (my - bounds.y + toprow) / ItemHeight(); short item = row * gfx_per_row + col; if ( item < items ) return Select( item ); } } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : GfxWidget::KeyDown // DESCRIPTION: If the widget has WIDGET_[HV]SCROLLKEY set, the user can // shuffle through the items with the cursor keys. // PARAMETERS : key - SDL_keysym received from the event handler // RETURNS : GUI status //////////////////////////////////////////////////////////////////////// GUI_Status GfxWidget::KeyDown( const SDL_keysym &key ) { GUI_Status rc = CompositeWidget::KeyDown( key ); if ( rc != GUI_OK ) return rc; if ( flags & (WIDGET_HSCROLLKEY|WIDGET_VSCROLLKEY) ) { switch ( key.sym ) { case SDLK_UP: if ( (current > 0) && (flags & WIDGET_VSCROLLKEY) ) return Select( current - 1 ); case SDLK_LEFT: if ( (current > 0) && (flags & WIDGET_HSCROLLKEY) ) return Select( current - 1 ); break; case SDLK_DOWN: if ( (current < items - 1) && (flags & WIDGET_VSCROLLKEY) ) return Select( current + 1 ); case SDLK_RIGHT: if ( (current < items - 1) && (flags & WIDGET_HSCROLLKEY) ) return Select( current + 1 ); break; default: break; } } return GUI_OK; } //////////////////////////////////////////////////////////////////////// // NAME : TileWidget::TileWidget // DESCRIPTION: Create a new tile widget. // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // flags - widget flags (see widget.h for details) // title - widget title (currently unused) // window - widget parent window // ts - terrain set used (may be NULL) // RETURNS : - //////////////////////////////////////////////////////////////////////// TileWidget::TileWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window, TerrainSet *ts ) : GfxWidget( id, x, y, w, h, flags, title, window ) { SetTerrainSet( ts ); } //////////////////////////////////////////////////////////////////////// // NAME : TileWidget::SetTerrainSet // DESCRIPTION: Attach a different terrain set to this widget. // PARAMETERS : ts - terrain set to be used // RETURNS : - //////////////////////////////////////////////////////////////////////// void TileWidget::SetTerrainSet( TerrainSet *ts ) { tset = ts; if ( ts ) Init( ts->TileWidth(), ts->TileHeight(), ts->NumTiles() ); } //////////////////////////////////////////////////////////////////////// // NAME : TileWidget::GetImage // DESCRIPTION: Get the image identifier of a terrain type. // PARAMETERS : type - terrain type // RETURNS : -1 on error, image identifier otherwise //////////////////////////////////////////////////////////////////////// short TileWidget::GetImage( unsigned short type ) const { short rc = -1; if ( tset ) { const TerrainType *tt = tset->GetTerrainInfo(type); if ( tt ) rc = tt->tt_image; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : UnitWidget::UnitWidget // DESCRIPTION: Create a new unit widget. // PARAMETERS : id - widget identifier // x - left edge of widget // y - top edge of widget // w - widget width // h - widget height // flags - widget flags (see widget.h for details) // title - widget title (currently unused) // window - widget parent window // us - unit set used (may be NULL) // RETURNS : - //////////////////////////////////////////////////////////////////////// UnitWidget::UnitWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window, UnitSet *us ) : GfxWidget( id, x, y, w, h, flags, title, window ) { SetUnitSet( us ); } //////////////////////////////////////////////////////////////////////// // NAME : UnitWidget::SetUnitSet // DESCRIPTION: Attach a different unit set to this widget. // PARAMETERS : us - unit set to be used // RETURNS : - //////////////////////////////////////////////////////////////////////// void UnitWidget::SetUnitSet( UnitSet *us ) { uset = us; if ( us ) Init( us->TileWidth(), us->TileHeight(), us->NumTiles() * 2 ); } //////////////////////////////////////////////////////////////////////// // NAME : UnitWidget::GetImage // DESCRIPTION: Get the image identifier of a unit type. // PARAMETERS : type - unit type // RETURNS : -1 on error, image identifier otherwise //////////////////////////////////////////////////////////////////////// short UnitWidget::GetImage( unsigned short type ) const { short rc = -1; if ( uset ) { const UnitType *ut = uset->GetUnitInfo(type % uset->NumTiles()); if ( ut ) { if ( type < uset->NumTiles() ) rc = ut->Image(); else rc = ut->Image() + 9; /* player 2, facing southwards */ } } return rc; } crimson-0.5.2.orig/src/comet/gfxwidget.h0000600000175000017500000000605310554366467016364 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // gfxwidget.h - list widget class for gfx selection /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_ED_GFXWIDGET_H #define _INCLUDE_ED_GFXWIDGET_H #include "slider.h" #include "mapview.h" class GfxWidget : public CompositeWidget, public WidgetHook { public: GfxWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window ); void Draw( void ); GUI_Status Select( short item ); // highlight a list item GUI_Status MouseDown( const SDL_MouseButtonEvent &button ); GUI_Status KeyDown( const SDL_keysym &key ); short Selected( void ) const { return current; } unsigned short ItemHeight( void ) const { return gfx_h + spacing; } protected: GUI_Status WidgetActivated( Widget *widget, Window *win ); void DrawItems( void ); virtual void DrawItem( short image, short x, short y ) = 0; virtual short GetImage( unsigned short item ) const = 0; void Init( unsigned short gfxw, unsigned short gfxh, unsigned short items ); short current; unsigned short items; unsigned short rows; unsigned short toprow; unsigned short visrows; short spacing; unsigned short gfx_w; unsigned short gfx_h; unsigned short gfx_per_row; Rect bounds; bool init; }; class TileWidget : public GfxWidget { public: TileWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window, TerrainSet *ts ); void SetTerrainSet( TerrainSet *ts ); protected: void DrawItem( short image, short x, short y ) { tset->DrawTile( image, surface, x, y, bounds ); } short GetImage( unsigned short type ) const; private: TerrainSet *tset; }; class UnitWidget : public GfxWidget { public: UnitWidget( short id, short x, short y, unsigned short w, unsigned short h, unsigned short flags, const char *title, Window *window, UnitSet *us ); void SetUnitSet( UnitSet *us ); protected: void DrawItem( short image, short x, short y ) { uset->DrawTile( image, surface, x, y, bounds ); } short GetImage( unsigned short type ) const; private: UnitSet *uset; }; #endif // _INCLUDE_ED_GFXWIDGET_H crimson-0.5.2.orig/src/comet/main.cpp0000600000175000017500000002651410554366426015652 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ///////////////////////////////////////////////////////////////////// // main.cpp -- CoMET - The Crimson Fields Map Editing Tool ///////////////////////////////////////////////////////////////////// #include #include #include #include "SDL.h" #ifndef _WIN32_WCE # include #endif #include "edwindow.h" #include "main.h" #include "mission.h" #include "color.h" #include "fileio.h" #include "sound.h" #include "globals.h" // local function prototypes static void parse_options( int argc, char **argv, EdOptions &opts ); static void print_usage( char *prog ); static GUI_Status event_filter( SDL_Event &event, Window *window ); static void load_settings( EdOptions &opts ); static void save_settings( View *display ); // Start of program functions ////////////////////////////////////////// #ifdef _MSC_VER int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPTSTR szCmdLine, int sw) { int argc = __argc; char **argv = __argv; #else int main( int argc, char **argv ) { #endif struct EdOptions options; srand( time(0) ); // init random number generator parse_options( argc, argv, options ); // create options, save games, and maps directories if possible create_config_dir(); string mapdir = get_home_levels_dir(); if ( mapdir.length() == 0 ) mapdir = get_levels_dir(); else if ( !File::Exists( mapdir ) ) make_dir( mapdir.c_str() ); Editor ed( mapdir.c_str(), options ); View *view = ed.GetView(); if ( view ) { GUI_Status status; do { status = view->HandleEvents(); } while ( status != GUI_QUIT ); } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : parse_options // DESCRIPTION: Process any options given to the program on the command // line. // PARAMETERS : argc - argument count // argv - pointer to array of arguments // opts - buffer to store options in // RETURNS : - //////////////////////////////////////////////////////////////////////// // parse command line arguments void parse_options( int argc, char **argv, EdOptions &opts ) { // initialize with some default values opts.width = 800; opts.height = 600; opts.bpp = DISPLAY_BPP; opts.sound = true; opts.flags = SDL_HWSURFACE; opts.level = NULL; load_settings( opts ); while ( argc > 1 ) { --argc; if (strcmp(argv[argc-1], "--width") == 0) { opts.width = atoi(argv[argc]); } else if (strcmp(argv[argc-1], "--height") == 0) { opts.height = atoi(argv[argc]); } else if (strcmp(argv[argc-1], "--level") == 0) { opts.level = argv[argc]; } else if (strcmp(argv[argc-1], "--fullscreen") == 0) { if ( atoi( argv[argc] ) ) opts.flags |= SDL_FULLSCREEN; else opts.flags &= ~SDL_FULLSCREEN; } else if (strcmp(argv[argc-1], "--sound") == 0) { if ( atoi( argv[argc] ) ) opts.sound = true; else opts.sound = false; } else { if (strcmp(argv[argc], "--version") == 0) fprintf( stdout, PROGRAMNAME" "VERSION"\n" ); else print_usage( argv[0] ); exit ( 0 ); } --argc; } if ( opts.width < MIN_XRES ) opts.width = MIN_XRES; if ( opts.height < MIN_YRES ) opts.height = MIN_YRES; } //////////////////////////////////////////////////////////////////////// // NAME : print_usage // DESCRIPTION: Print a usage message to stdout. // PARAMETERS : prog - program name as given on the command line // RETURNS : - //////////////////////////////////////////////////////////////////////// void print_usage( char *prog ) { fprintf( stdout, "Usage: %s [options]\n\n" "Available options:\n" " --level load level or save file\n" " --width set screen width\n" " --height set screen height\n" " --fullscreen <1|0> enable/disable fullscreen mode\n" #ifndef DISABLE_SOUND " --sound <1|0> enable/disable sound\n" #endif " --help display this help and exit\n" " --version output version information and exit\n", prog ); } //////////////////////////////////////////////////////////////////////// // NAME : load_settings // DESCRIPTION: Read default display settings from the crimsonrc file. // PARAMETERS : opts - buffer to store the settings. These should // already be initialized with some defaults in // case the rc file doesn't exist or this function // fails. // RETURNS : - //////////////////////////////////////////////////////////////////////// void load_settings( EdOptions &opts ) { string cfedrc( get_config_dir() ); cfedrc.append( CFEDRC ); FILE *fp = fopen( cfedrc.c_str(), "r" ); if ( fp ) { char linebuf[256], *val; unsigned short linecnt = 0; while ( fgets( linebuf, 255, fp ) ) { ++linecnt; if ( (linebuf[0] != '#') && (linebuf[0] != '\n') ) { val = strchr( linebuf, ' ' ); if ( val ) { while ( *val == ' ' ) ++val; if ( !strncmp( linebuf, "width", 5 ) ) opts.width = atoi( val ); else if ( !strncmp( linebuf, "height", 6 ) ) opts.height = atoi( val ); else if ( !strncmp( linebuf, "fullscreen", 10 ) ) { if ( atoi( val ) != 0 ) opts.flags |= SDL_FULLSCREEN; } else if ( !strncmp( linebuf, "sound", 5 ) ) { if ( atoi( val ) == 0 ) opts.sound = 0; else opts.sound = 1; } else fprintf( stderr, "warning: unrecognized config option in line %d\n", linecnt ); } } } fclose( fp ); } } //////////////////////////////////////////////////////////////////////// // NAME : save_settings // DESCRIPTION: Save current display settings to the crimsonrc file. // PARAMETERS : display - pointer to display // RETURNS : - //////////////////////////////////////////////////////////////////////// void save_settings( View *display ) { string cfedrc( get_config_dir() ); cfedrc.append( CFEDRC ); FILE *fp = fopen( cfedrc.c_str(), "w" ); if ( fp ) { fprintf( fp, "width %d\n", display->Width() ); fprintf( fp, "height %d\n", display->Height() ); fprintf( fp, "fullscreen %d\n", display->IsFullScreen() ? 1 : 0 ); fprintf( fp, "sound %d\n", Audio::GetSfxState() ); fclose( fp ); } } //////////////////////////////////////////////////////////////////////// // NAME : event_filter // DESCRIPTION: This is the global event filter function. It is hooked // to the display and called everytime the event handler // receives an event. // PARAMETERS : event - event received by the event handler // window - pointer to the currently active window // RETURNS : GUI_Status; if the filter returns GUI_NONE the event // handler will not pass the event to its windows, but // silently drop it. //////////////////////////////////////////////////////////////////////// GUI_Status event_filter( SDL_Event &event, Window *window ) { GUI_Status rc = GUI_OK; if ( event.type == SDL_KEYDOWN ) { rc = GUI_NONE; switch ( event.key.keysym.sym ) { case SDLK_F11: // toggle SFX Audio::ToggleSfxState(); break; default: rc = GUI_OK; // send to windows } } else if ( event.type == SDL_QUIT ) rc = GUI_QUIT; return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Editor::Editor // DESCRIPTION: Create a new editor instance and initialize screen // estate and general data. If the constructor fails, // Editor::GetView() will return NULL. // PARAMETERS : mapdir - directory containing the maps // opts - editor options // RETURNS : - //////////////////////////////////////////////////////////////////////// Editor::Editor( const char *mapdir, const EdOptions &opts ) { view = NULL; if ( SDL_Init( SDL_INIT_VIDEO ) < 0 ) { fprintf( stderr, "Couldn't initialize: %s\n", SDL_GetError() ); return; } bool err = false; // set main window title SDL_WM_SetCaption( PROGRAMNAME, PROGRAMNAME ); SDL_EnableKeyRepeat( SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL ); view = new View( opts.width, opts.height, opts.bpp, opts.flags ); if ( !view->s_surface ) { fprintf( stderr, "Couldn't set video mode: %s\n", SDL_GetError() ); err = true; } else if ( !Init(opts) ) { view->SetEventFilter( event_filter ); EdWindow *ew = new EdWindow(mapdir, view); if ( ew ) { if ( opts.level ) ew->LoadMission(opts.level, false); else { ew->Draw(); ew->Show(); } } else err = true; } else err = true; if ( err ) { delete view; view = NULL; } } //////////////////////////////////////////////////////////////////////// // NAME : Editor::~Editor // DESCRIPTION: Close the editor. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Editor::~Editor( void ) { Audio::ShutdownSfx(); Audio::ShutdownMusic(); if ( view ) { save_settings( view ); delete view; } SDL_Quit(); } //////////////////////////////////////////////////////////////////////// // NAME : Editor::Init // DESCRIPTION: Initialize global data structures. // PARAMETERS : opts - editor options // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Editor::Init( const EdOptions &opts ) { string datpath( get_data_dir() ); datpath.append( CF_DATFILE ); File datfile( datpath ); if ( !datfile.Open( "rb" ) ) { cerr << "Error: Couldn't open '" << datpath << "'" << endl; return -1; } Surface *icons = new Surface; // load icons surface if ( icons->LoadImageData( datfile ) ) { cerr << "Error reading data file" << endl; delete icons; return -1; } datfile.Close(); datpath = get_data_dir() + CF_FONT; // load fonts Font *f1 = new Font(); Font *f2 = new Font(); if ( TTF_Init() || f1->Load( datpath.c_str(), CF_FONT_SMALL ) || f2->Load( datpath.c_str(), CF_FONT_LARGE ) ) { cerr << "Error loading fonts" << endl; delete icons; delete f1; delete f2; return -1; } Audio::InitSfx( opts.sound, MIX_MAX_VOLUME ); // load sound effects Audio::InitMusic( false, MIX_MAX_VOLUME ); view->SetFGPen( Color(0x00d87c00) ); view->SetBGPen( Color(CF_COLOR_BLACK) ); view->SetSmallFont( f1 ); view->SetLargeFont( f2 ); icons->DisplayFormat(); view->SetSystemIcons( icons ); return 0; } crimson-0.5.2.orig/src/comet/main.h0000600000175000017500000000270710554366467015322 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ////////////////////////////////////////////////////////////// // main.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_ED_MAIN_H #define _INCLUDE_ED_MAIN_H #define PROGRAMNAME "CoMET" #ifdef WIN32 # define CFEDRC "cfed.ini" #else # define CFEDRC "cfedrc" #endif struct EdOptions { short width; short height; short bpp; bool sound; unsigned long flags; const char *level; }; class Editor { public: Editor( const char *mapdir, const EdOptions &opts ); ~Editor( void ); View *GetView( void ) const { return view; } private: int Init( const EdOptions &opts ); View *view; }; #endif // _INCLUDE_ED_MAIN_H crimson-0.5.2.orig/src/comet/map.cpp0000600000175000017500000002210610554366426015474 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // map.cpp //////////////////////////////////////////////////////////////////////// #include "map.h" //////////////////////////////////////////////////////////////////////// // NAME : Map::Map // DESCRIPTION: Create a new map instance. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Map::Map( void ) : m_data(0), m_objects(0) {} //////////////////////////////////////////////////////////////////////// // NAME : Map::~Map // DESCRIPTION: Free memory allocated by the map structure so we can. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Map::~Map( void ) { delete [] m_data; delete [] m_objects; } //////////////////////////////////////////////////////////////////////// // NAME : Map::SetSize // DESCRIPTION: Set a new map size. Terrain and unit sets must be // non-NULL when calling this method. // PARAMETERS : size - new map size // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Map::SetSize( const Point &size ) { delete [] m_data; delete [] m_objects; m_w = size.x; m_h = size.y; unsigned short imax = m_w * m_h; m_data = new short [imax]; m_objects = new MapObject * [imax]; for ( int i = 0; i < imax; ++i ) { m_data[i] = m_tset->GetTerrainClassID(0); m_objects[i] = NULL; } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Map::Load // DESCRIPTION: Initialize the map structure. // PARAMETERS : file - descriptor of an opened data file from which to // read the map data // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int Map::Load( MemBuffer &file ) { m_w = file.Read16(); m_h = file.Read16(); unsigned short size = m_w * m_h; m_data = new short [size]; m_objects = new MapObject * [size]; // terrain types are loaded from a level set for ( int i = 0; i < size; ++i ) { m_data[i] = file.Read16(); m_objects[i] = NULL; } return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Map::Save // DESCRIPTION: Save the current map status to a file. Only the terrain // type information is saved for each hex. Other data // (units, buildings...) must be stored separately. // PARAMETERS : file - descriptor of the save file // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int Map::Save( MemBuffer &file ) const { int rc; file.Write16( m_w ); rc = file.Write16( m_h ); unsigned short size = m_w * m_h; for ( int i = 0; i < size && !rc; ++i ) rc = file.Write16( m_data[i] ); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Map::Export // DESCRIPTION: Save the map to a plain text file. // PARAMETERS : file - descriptor of the save file // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int Map::Export( ofstream &file ) const { file << "[map-raw]\n"; Point p; for ( p.y = 0; p.y < m_h; ++p.y ) { for ( p.x = 0; p.x < m_w; ++p.x ) { file << HexTypeID( p ); if ( p.x != m_w - 1 ) file << ','; } file << '\n'; } file << '\n'; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Map::Dir2Hex // DESCRIPTION: Get the coordinates of the hex we'll be on when we move // in a given direction from another hex. // PARAMETERS : hex - source hex // dir - direction to move in // dest - pointer to a Point to hold the coordinates of the // destination hex // RETURNS : 0 on success, -1 on error (the contents of the Point can // not be relied on in this case) //////////////////////////////////////////////////////////////////////// int Map::Dir2Hex( const Point &hex, Direction dir, Point &dest ) const { short x = hex.x, y = hex.y; switch ( dir ) { case NORTH: --y; break; case SOUTH: ++y; break; case NORTHEAST: if ( !(x & 1) ) --y; // fall through... case EAST: ++x; break; case SOUTHEAST: if ( x & 1 ) ++y; ++x; break; case SOUTHWEST: if ( x & 1 ) ++y; // fall through... case WEST: --x; break; case NORTHWEST: if ( !(x & 1) ) --y; --x; } dest = Point( x, y ); if ( !Contains( dest ) ) return -1; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Map::Contains // DESCRIPTION: Check whether a hex with the given coordinates exists // on the map. // PARAMETERS : hex - hex position // RETURNS : true if the coordinates denote a valid hex, false // otherwise //////////////////////////////////////////////////////////////////////// bool Map::Contains( const Point &hex ) const { return( (hex.x >= 0) && (hex.x < Width()) && (hex.y >= 0) && (hex.y < Height()) ); } //////////////////////////////////////////////////////////////////////// // NAME : Map::GetUnit // DESCRIPTION: Get a unit from the map. // PARAMETERS : hex - hex position // RETURNS : the unit at the given coordinates, or NULL if no unit // was found there //////////////////////////////////////////////////////////////////////// Unit *Map::GetUnit( const Point &hex ) const { MapObject *o = GetMapObject( hex ); if ( o && o->IsUnit() ) return static_cast(o); return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : Map::SetUnit // DESCRIPTION: Put a unit on the map. Also sets the unit parameters // according to the new position. // PARAMETERS : u - unit (may be NULL) // pos - hex position // RETURNS : 0 //////////////////////////////////////////////////////////////////////// short Map::SetUnit( Unit *u, const Point &pos ) { if ( u ) { u->SetPosition( pos ); if ( u->IsGround() ) { if ( IsWater( pos ) ) u->SetFlags( U_FLOATING ); else u->UnsetFlags( U_FLOATING ); } } m_objects[Hex2Index(pos)] = u; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Map::GetBuilding // DESCRIPTION: Get a building from the map. // PARAMETERS : pos - hex position // RETURNS : the building at the given coordinates, or NULL if no // building was found there //////////////////////////////////////////////////////////////////////// Building *Map::GetBuilding( const Point &pos ) const { MapObject *o = GetMapObject( pos ); if ( o && o->IsBuilding() ) return static_cast(o); return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : Map::HexColor // DESCRIPTION: Get the color of a hex for the overview map. // PARAMETERS : xy - hex index (y * map_height + x) // RETURNS : hex color //////////////////////////////////////////////////////////////////////// unsigned long Map::HexColor( unsigned short xy ) const { return( m_tset->GetTerrainInfo(m_data[xy])->tt_color ); } //////////////////////////////////////////////////////////////////////// // NAME : Map::HexType // DESCRIPTION: Get some info about a hex. // PARAMETERS : hex - hex position // RETURNS : terrain type information //////////////////////////////////////////////////////////////////////// const TerrainType *Map::HexType( const Point &hex ) const { return m_tset->GetTerrainInfo(HexTypeID(hex)); } //////////////////////////////////////////////////////////////////////// // NAME : Map::Index2Hex // DESCRIPTION: Turn a hex index back into a Point. // PARAMETERS : index - hex index // RETURNS : hex coordinates (-1/-1 on invalid index) //////////////////////////////////////////////////////////////////////// Point Map::Index2Hex( int index ) const { Point p(-1, -1); if ( index >= 0 ) { p.x = index % Width(); p.y = index / Width(); if ( (p.x >= Width()) || (p.y >= Height()) ) return Point(-1, -1); } return p; } crimson-0.5.2.orig/src/comet/map.h0000600000175000017500000000612410554366467015150 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // map.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_ED_MAP_H #define _INCLUDE_ED_MAP_H #include "hexsup.h" #include "rect.h" #include "unit.h" #include "building.h" #include "list.h" #include "misc.h" #include "lset.h" class Map { public: Map( void ); ~Map( void ); void SetUnitSet( UnitSet *set ) { m_uset = set; } UnitSet *GetUnitSet( void ) const { return m_uset; } void SetTerrainSet( TerrainSet *set ) { m_tset = set; } TerrainSet *GetTerrainSet( void ) const { return m_tset; } int SetSize( const Point &size ); int Load( MemBuffer &file ); int Save( MemBuffer &file ) const; int Export( ofstream &file ) const; unsigned short Width( void ) const { return m_w; } unsigned short Height( void ) const { return m_h; } Unit *GetUnit( const Point &pos ) const; short SetUnit( Unit *u, const Point &pos ); Building *GetBuilding( const Point &pos ) const; void SetBuilding( Building *b, const Point &pos ) { m_objects[Hex2Index(pos)] = b; } MapObject *GetMapObject( const Point &hex ) const { return m_objects[Hex2Index(hex)]; } const TerrainType *HexType( const Point &hex ) const; short HexTypeID( const Point &hex ) const { return m_data[Hex2Index(hex)]; } short HexImage( const Point &hex ) const { return( HexType(hex)->tt_image ); } unsigned short TerrainTypes( const Point &hex ) const { return HexType(hex)->tt_type; } bool IsWater( const Point &hex ) const { return (TerrainTypes(hex) & (TT_WATER|TT_WATER_SHALLOW|TT_WATER_DEEP)) != 0; } bool IsBuilding( const Point &hex ) const { return (TerrainTypes(hex) & TT_ENTRANCE) != 0; } unsigned long HexColor( unsigned short xy ) const; void SetHexType( const Point &pos, unsigned short type ) { SetHexType( pos.x,pos.y,type); } void SetHexType( short x, short y, unsigned short type ) { m_data[y * m_w + x] = type; } int Hex2Index( const Point &hex ) const { return hex.y * m_w + hex.x; } Point Index2Hex( int index ) const; int Dir2Hex( const Point &hex, Direction dir, Point &dest ) const; bool Contains( const Point &hex ) const; private: unsigned short m_w; unsigned short m_h; short *m_data; MapObject **m_objects; UnitSet *m_uset; TerrainSet *m_tset; }; #endif // _INCLUDE_ED_MAP_H crimson-0.5.2.orig/src/comet/mapgen.cpp0000600000175000017500000001720610554366430016166 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // mapgen.cpp //////////////////////////////////////////////////////////////////////// #include #include "mapgen.h" #include "misc.h" #define TILE_PLAINS 30 #define TILE_PLAINS_PEBBLES_1 34 #define TILE_PLAINS_PEBBLES_2 35 #define TILE_PLAINS_RUGGED_1 31 #define TILE_PLAINS_HOUSE 53 #define TILE_PLAINS_COTTAGE 54 #define TILE_PLAINS_SHED 55 #define TILE_PLAINS_HILLS 38 #define TILE_HILLS_1 65 #define TILE_HILLS_2 66 #define TILE_MOUNTAINS 117 #define TILE_WATER_SHALLOW 360 #define TILE_WATER_CLIFFS_1 363 #define TILE_WATER_CLIFFS_2 364 #define TILE_WATER_CLIFFS_3 365 #define TILE_WATER 361 #define TILE_WATER_DEEP 362 #define TILE_FOREST_1 77 #define TILE_FOREST_2 78 #define TILE_FOREST_3 79 #define TILE_FOREST_4 80 #define TILE_FOREST_5 81 #define TILE_FOREST_6 82 //////////////////////////////////////////////////////////////////////// // NAME : MapGenerator::Generate // DESCRIPTION: Generate a map with the given parameters. The generator // contains a lot of hard-coded knowledge about the tile // set used so it only works with the default set. // PARAMETERS : map - map structure that will be populated // water - water level (0-10) // roughness - map roughness (1-20) // RETURNS : - //////////////////////////////////////////////////////////////////////// void MapGenerator::Generate( Map &map, unsigned char water, unsigned char roughness ) const { water *= 20; HeightMap terrain( map.Width(), map.Height(), roughness ); HeightMap forest( map.Width(), map.Height(), 15 ); // interval for a single terrain type unsigned short interval_land = (255 - water) / 5; // create 5 zones unsigned short interval_sea = water / 3; for ( int y = 0; y < map.Height(); ++y ) { for ( int x = 0; x < map.Width(); ++x ) { unsigned char level = terrain.Height( x, y ); unsigned short tile; if ( level < water ) { // water if ( level < interval_sea ) tile = TILE_WATER_DEEP; else if ( level < 2 * interval_sea ) tile = TILE_WATER; else { switch ( rand()%300 ) { case 0: tile = TILE_WATER_CLIFFS_1; break; case 1: tile = TILE_WATER_CLIFFS_2; break; case 2: tile = TILE_WATER_CLIFFS_3; break; default: tile = TILE_WATER_SHALLOW; } } } else { // land level -= water; if ( level < interval_land * 3 ) { // plains if ( level < interval_land * 2 ) { unsigned char flevel = forest.Height( x, y ); if ( flevel > 165 ) { switch ( (flevel - 165) / 15 ) { case 0: tile = TILE_FOREST_1; break; case 1: tile = TILE_FOREST_2; break; case 2: tile = TILE_FOREST_3; break; case 3: tile = TILE_FOREST_4; break; case 4: tile = TILE_FOREST_5; break; default: tile = TILE_FOREST_6; } } else { switch ( rand()%300 ) { case 0: case 1: case 2: tile = TILE_PLAINS_RUGGED_1; break; case 3: case 4: tile = TILE_PLAINS_PEBBLES_1; break; case 5: case 6: tile = TILE_PLAINS_PEBBLES_2; break; case 7: tile = TILE_PLAINS_HOUSE; break; case 8: tile = TILE_PLAINS_COTTAGE; break; case 9: tile = TILE_PLAINS_SHED; break; default: tile = TILE_PLAINS; } } } else tile = TILE_PLAINS_HILLS; } else if ( level < 4 * interval_land ) { if ( rand()%3 <= 1 ) tile = TILE_HILLS_1; else tile = TILE_HILLS_2; } else tile = TILE_MOUNTAINS; } map.SetHexType( x, y, tile ); } } } //////////////////////////////////////////////////////////////////////// // NAME : HeightMap::HeightMap // DESCRIPTION: Create a fractal height map. This code is based on a // terrain generator by Randy J. Relander // . // PARAMETERS : width - map width // height - map height // scale - map "roughness" (1-20) // RETURNS : - //////////////////////////////////////////////////////////////////////// HeightMap::HeightMap( unsigned short width, unsigned short height, unsigned char scale ) : size(1), scale(scale) { // we always create a square height map with the size being a power of 2 // because that's way easier unsigned short base = MAX( width, height ) - 1; while ( base ) { base /= 2; size *= 2; } data = new unsigned char[(size+1) * (size+1)]; // seed the corners data[ 0 ] = rand()%256; data[ size ] = rand()%256; data[ (size+1) * size ] = rand()%256; data[ size + (size+1) * size ] = rand()%256; // generate fractal for ( int step = size; step > 1; step /= 2 ) { Pass( 1, 0, step ); Pass( 0, 1, step ); Pass( 1, 1, step ); } } //////////////////////////////////////////////////////////////////////// // NAME : HeightMap::~HeightMap // DESCRIPTION: Destroy the height map. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// HeightMap::~HeightMap( void ) { delete [] data; } //////////////////////////////////////////////////////////////////////// // NAME : HeightMap::Pass // DESCRIPTION: Make one pass across the array. // PARAMETERS : xstep - // ystep - // step - // RETURNS : - //////////////////////////////////////////////////////////////////////// void HeightMap::Pass( int xstep, int ystep, int step ) { int x, y, z; int z1, z2; int range = step * scale; int shift = (range/2); int dx = xstep * (step/2); int dy = ystep * (step/2); int delta1 = (size+1) * dy; int delta2 = (size+1) * step; unsigned char *p = data + delta1; for ( y = dy; y <= size; y += step ) { for ( x = dx; x <= size; x += step ) { // select two points if ( rand()%2 ) { z1 = p[x - dx - delta1]; z2 = p[x + dx + delta1]; } else { z1 = p[x + dx - delta1]; z2 = p[x - dx + delta1]; } // average and randomize z = (z1+z2)/2 + (rand()%range) - shift; if (z < 0) z = 0; if (z > 255) z = 255; p[x] = z; } p += delta2; } } //////////////////////////////////////////////////////////////////////// // NAME : HeightMap::Height // DESCRIPTION: Get the height of a specified point. // PARAMETERS : x - horizontal coordinate // y - vertical coordinate // RETURNS : height at the requested point //////////////////////////////////////////////////////////////////////// inline unsigned char HeightMap::Height( unsigned short x, unsigned short y ) const { return data[ x + (size+1) * y ]; } crimson-0.5.2.orig/src/comet/mapgen.h0000600000175000017500000000300510554366467015635 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // mapgen.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_MAPGEN_H #define _INCLUDE_MAPGEN_H #include "map.h" class MapGenerator { public: MapGenerator( void ) {} void Generate( Map &map, unsigned char water, unsigned char roughness ) const; }; class HeightMap { public: HeightMap( unsigned short width, unsigned short height, unsigned char scale ); ~HeightMap( void ); unsigned char Height( unsigned short x, unsigned short y ) const; private: void Pass( int xstep, int ystep, int step ); unsigned short size; unsigned short scale; unsigned char *data; }; #endif /* _INCLUDE_MAPGEN_H */ crimson-0.5.2.orig/src/comet/mission.cpp0000600000175000017500000013405210554366427016405 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // mission.cpp //////////////////////////////////////////////////////////////////////// #include #include "mission.h" #include "fileio.h" #include "strutil.h" #include "globals.h" const char *event_labels[] = { "Message", "Mining", "Score", "Configure", "Create Unit", "Manipulate Event", "Research", "Set Hex", "Set Timer", "Destroy Unit", 0 }; const char *etrigger_labels[] = { "Timer", "Unit Destruction", "Shop Owner", "Unit Owner", "Unit Position", "Handicap", "Have Crystals", 0 }; #define P1_COLOR_LIGHT 0x00FEA604 // yellow #define P1_COLOR_SHADOW 0x0056360C // brown #define P2_COLOR_LIGHT 0x0000AAFF // light blue #define P2_COLOR_SHADOW 0x0002265C // dark blue //////////////////////////////////////////////////////////////////////// // NAME : Mission::Mission // DESCRIPTION: Create a new mission. // PARAMETERS : size - map size // ts - tile set to be used // us - unit set to be used // RETURNS : - //////////////////////////////////////////////////////////////////////// Mission::Mission( const Point &size, TerrainSet *ts, UnitSet *us ) : p1(PLAYER_ONE), p2(PLAYER_TWO) { flags = GI_SKIRMISH; name = -1; campaign_name = -1; level_info = -1; campaign_info = -1; SetTitle( "Unknown" ); unit_set = us; terrain_set = ts; map.SetUnitSet( unit_set ); map.SetTerrainSet( terrain_set ); map.SetSize( size ); } //////////////////////////////////////////////////////////////////////// // NAME : Mission::~Mission // DESCRIPTION: Destructor // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// Mission::~Mission( void ) { delete unit_set; delete terrain_set; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::Load // DESCRIPTION: Load a game from a mission file. // PARAMETERS : filename - mission file name // RETURNS : 0 on success, non-zero otherwise //////////////////////////////////////////////////////////////////////// int Mission::Load( const char *filename ) { int rc = -1; File file( filename ); if ( !file.Open( "rb" ) ) return -1; // read game info if ( (file.Read32() == FID_MISSION) && (file.Read8() == FILE_VERSION) ) { unsigned short len, i; signed char mapid, musicid; string uset, tset; Building *b; Event *e; // set last filename last_file_name = file_part( filename ); i = last_file_name.rfind( '.' ); last_file_name.erase( i ); flags = file.Read16(); i = file.Read16(); // turn number - unused if ( flags & GI_SAVEFILE ) // refuse to load saved games return -1; name = file.Read8(); level_info = file.Read8(); campaign_name = file.Read8(); campaign_info = file.Read8(); mapid = file.Read8(); musicid = file.Read8(); file.Read8(); // handicap - unused file.Read8(); // current player - unused file.Read8(); // turn phase - unused p1.Load( file ); p2.Load( file ); // load text messages messages.Load( file ); map.Load( file ); // load map len = file.Read16(); // load name of unit set uset = file.ReadS( len ); unit_set = new UnitSet; File ufile( uset + ".units" ); if ( !ufile.OpenData("rb") || unit_set->Load( ufile, uset.c_str() ) ) { cerr << "Error: Unit set '" << uset << "' not available." << endl; return -1; } ufile.Close(); len = file.Read16(); // load name of terrain set tset = file.ReadS( len ); terrain_set = new TerrainSet; File tfile( tset + ".tiles" ); if ( !tfile.OpenData("rb") || terrain_set->Load( tfile, tset.c_str() ) ) { cerr << "Error: Terrain set '" << tset << "' not available." << endl; return -1; } tfile.Close(); map.SetUnitSet( unit_set ); map.SetTerrainSet( terrain_set ); len = file.Read16(); // load buildings for ( i = 0; i < len; ++i ) { b = new Building(); b->Load( file ); buildings.AddTail( b ); map.SetBuilding( b, b->Position() ); } len = file.Read16(); // load units for ( i = 0; i < len; ++i ) { unsigned char tid = file.Read8(); Unit *u = new Unit( file, unit_set->GetUnitInfo(tid) ); if ( u ) { units.AddTail( u ); if ( !map.GetMapObject(u->Position()) ) map.SetUnit( u, u->Position() ); else u->SetFlags( U_SHELTERED ); } } len = file.Read16(); // load battles // combat actions - only present in saved games len = file.Read16(); // load events for ( i = 0; i < len; ++i ) { e = new Event(); e->Load( file ); events.AddTail( e ); } Language internal_messages; internal_messages.ReadCatalog( file ); SetSequel( internal_messages.GetMsg( mapid ) ); SetMusic( internal_messages.GetMsg( musicid ) ); // set shop names for ( b = static_cast(buildings.Head()); b; b = static_cast(b->Next()) ) b->SetName( GetMessage( b->NameID() ) ); // set special event properties for ( e = static_cast(events.Head()); e; e = static_cast(e->Next()) ) { if ( (e->Type() == EVENT_CONFIGURE) && (e->GetData(0) == 2) ) { // set next map const char *nmap = internal_messages.GetMsg( e->GetData(1) ); if ( nmap ) e->SetTmpBuf( nmap ); else { e->SetTmpBuf(""); e->SetData(1, -1); } } } len = file.Read16(); // history - only present in saved games rc = 0; } return rc; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::Save // DESCRIPTION: Save the mission to a file. // PARAMETERS : filename - data file name // RETURNS : 0 on successful write, non-zero otherwise //////////////////////////////////////////////////////////////////////// int Mission::Save( const char *filename ) { File file( filename ); if ( !file.Open( "wb", false ) ) { cerr << "Failed to save mission!" << endl; return -1; } unsigned short num; signed char mapid = -1, musicid = -1; Language internal_messages; internal_messages.SetID( "--" ); if ( !next_map.empty() ) { mapid = internal_messages.Size(); internal_messages.AddMsg( next_map ); } if ( !music.empty() ) { musicid = internal_messages.Size(); internal_messages.AddMsg( music ); } // get special event properties Event *e; for ( e = static_cast( events.Head() ); e; e = static_cast( e->Next() ) ) { if ( (e->Type() == EVENT_CONFIGURE) && (e->GetData(0) == 2) ) { // next map if ( e->GetTmpBuf() != "" ) { short msgid = internal_messages.Find( e->GetTmpBuf() ); if ( msgid != -1 ) e->SetData( 1, msgid ); else { e->SetData( 1, internal_messages.Size() ); internal_messages.AddMsg( e->GetTmpBuf() ); } } else e->SetData( 1, -1 ); } } // set last filename last_file_name = file_part( filename ); num = last_file_name.rfind( '.' ); last_file_name.erase( num ); file.Write32( FID_MISSION ); file.Write8( FILE_VERSION ); file.Write16( flags ); file.Write16( 1 ); // turn file.Write8( name ); file.Write8( level_info ); file.Write8( campaign_name ); file.Write8( campaign_info ); file.Write8( mapid ); file.Write8( musicid ); file.Write8( HANDICAP_NONE ); file.Write8( PLAYER_ONE ); file.Write8( TURN_START ); p1.Save( file ); // save player data p2.Save( file ); messages.Save( file ); map.Save( file ); // save map // save mission set info file.Write16( unit_set->GetName().length() ); file.WriteS( unit_set->GetName() ); file.Write16( terrain_set->GetName().length() ); file.WriteS( terrain_set->GetName() ); // save buildings file.Write16( buildings.CountNodes() ); for ( Building *b = static_cast( buildings.Head() ); b; b = static_cast( b->Next() ) ) b->Save( file ); // save transports; basically, transports are not much different // from other units but we MUST make sure that transports having // other units on board are loaded before those units; we need to // make two passes through the list, first saving all unsheltered // units (which are possibly transports carrying other units), and // all sheltered units in the second run file.Write16( units.CountNodes() ); Unit *u; for ( u = static_cast( units.Head() ); u; u = static_cast( u->Next() ) ) { // make sure transports are if ( !u->IsSheltered() ) u->Save( file ); // stored before carried units } for ( u = static_cast( units.Head() ); u; u = static_cast( u->Next() ) ) { if ( u->IsSheltered() ) u->Save( file ); } file.Write16( 0 ); // save combat data // save events file.Write16( events.CountNodes() ); for ( e = static_cast( events.Head() ); e; e = static_cast( e->Next() ) ) e->Save( file ); internal_messages.WriteCatalog( file ); file.Write16( 0 ); // turn history return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::Export // DESCRIPTION: Save the mission data to a plain text file. // PARAMETERS : filename - save file name // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Mission::Export( const string &filename ) const { ofstream file( filename.c_str() ); if ( !file ) return -1; string title( file_part(filename) ); int suffix = title.rfind( '.' ); title.erase( suffix ); file << "[mission]\n"; file << "name = " << (short)name << '\n'; file << "mapwidth = " << map.Width() << '\n'; file << "mapheight = " << map.Height() << '\n'; file << "info = " << (short)level_info << '\n'; file << "skirmish = " << (IsSkirmish() ? '1' : '0') << '\n'; file << "campaign = " << (IsCampaign() ? '1' : '0') << '\n'; file << "campaignname = " << (short)campaign_name << '\n'; file << "campaigninfo = " << (short)campaign_info << '\n'; if ( !next_map.empty() ) file << "nextmap = " << next_map << '\n'; if ( !music.empty() ) file << "music = " << music << '\n'; file << "players = " << (((flags & GI_AI) != 0) ? '1' : '2') << '\n'; file << "tileset = " << terrain_set->GetName() << '\n'; file << "unitset = " << unit_set->GetName() << "\n\n"; map.Export( file ); p1.Export( file ); p2.Export( file ); Unit *u; for ( u = static_cast(units.Head()); u; u = static_cast(u->Next()) ) if ( !u->IsSheltered() ) u->Export( file ); for ( u = static_cast(units.Head()); u; u = static_cast(u->Next()) ) if ( u->IsSheltered() ) u->Export( file ); for ( Building *b = static_cast(buildings.Head()); b; b = static_cast(b->Next()) ) b->Export( file, unit_set ); for ( Event *e = static_cast(events.Head()); e; e = static_cast(e->Next()) ) e->Export( file, map ); if ( messages.GetMsg(0) != 0 ) { const std::map &lib = messages.GetLibrary(); for ( std::map::const_iterator iter = lib.begin(); iter != lib.end(); ++iter ) { file << "[messages(" << iter->first << ")]\n"; file << iter->second.GetMsg(0); const char *m; for ( int i = 1; (m = iter->second.GetMsg(i)) != 0; ++i ) { file << "\n%\n" << m; } file << "\n[/messages]\n\n"; } } file.close(); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::CreateUnit // DESCRIPTION: Create a new unit. // PARAMETERS : type - unit type info // pid - identifier of cotrolling player // pos - position on map // RETURNS : created unit or NULL on error //////////////////////////////////////////////////////////////////////// Unit *Mission::CreateUnit( const UnitType *type, unsigned char pid, const Point &pos ) { Unit *u = new Unit( type, pid, GetUnitID(), pos ); if ( u ) { units.AddTail( u ); if ( !map.GetMapObject( pos ) ) map.SetUnit( u, pos ); else u->SetFlags( U_SHELTERED ); } return u; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::DeleteUnit // DESCRIPTION: Delete a unit, and for transporters also all freight. // PARAMETERS : u - unit to remove from mission // RETURNS : - //////////////////////////////////////////////////////////////////////// void Mission::DeleteUnit( Unit *u ) { u->Remove(); if ( !u->IsSheltered() ) { map.SetUnit( NULL, u->Position() ); if ( u->IsTransport() ) { Unit *next, *f = static_cast( units.Head() ); while ( f ) { next = static_cast( f->Next() ); if ( f->Position() == u->Position() ) { f->Remove(); delete f; } f = next; } } } delete u; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::GetUnitByID // DESCRIPTION: Find the unit corresponding to the given identifier. // PARAMETERS : id - identifier of the unit to be searched for // RETURNS : pointer to the unit, or NULL if no unit with that ID // exists //////////////////////////////////////////////////////////////////////// Unit *Mission::GetUnitByID( unsigned short id ) const { Unit *u = static_cast( units.Head() ); while ( u ) { if ( u->ID() == id ) return u; u = static_cast( u->Next() ); } return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::GetUnitID // DESCRIPTION: Get a unique identifier for a new unit. // PARAMETERS : - // RETURNS : unique unit ID //////////////////////////////////////////////////////////////////////// unsigned short Mission::GetUnitID( void ) const { unsigned short id = 0; Unit *u = static_cast( units.Head() ); while ( u ) { if ( u->ID() == id ) { ++id; u = static_cast( units.Head() ); } else u = static_cast( u->Next() ); } return id; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::CreateBuilding // DESCRIPTION: Create a new building. // PARAMETERS : pid - identifier of cotrolling player // pos - position on map // RETURNS : created building or NULL on error //////////////////////////////////////////////////////////////////////// Building *Mission::CreateBuilding( unsigned char pid, const Point &pos ) { Building *b = new Building( pos, GetBuildingID(), pid ); if ( b ) { buildings.AddTail( b ); map.SetBuilding( b, pos ); } return b; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::DeleteBuilding // DESCRIPTION: Delete a building and all units inside. // PARAMETERS : b - building to remove from mission // RETURNS : - //////////////////////////////////////////////////////////////////////// void Mission::DeleteBuilding( Building *b ) { map.SetBuilding( NULL, b->Position() ); b->Remove(); Unit *next, *f = static_cast( units.Head() ); while ( f ) { next = static_cast( f->Next() ); if ( f->Position() == b->Position() ) { f->Remove(); delete f; } f = next; } delete b; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::GetBuildingByID // DESCRIPTION: Find the shop corresponding to the given identifier. // PARAMETERS : id - identifier of the shop to be searched for // RETURNS : pointer to the shop, or NULL if no building with that ID // exists //////////////////////////////////////////////////////////////////////// Building *Mission::GetBuildingByID( unsigned short id ) const { Building *b = static_cast( buildings.Head() ); while ( b ) { if ( b->ID() == id ) return b; b = static_cast( b->Next() ); } return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::GetBuildingID // DESCRIPTION: Get a unique identifier for a new building. // PARAMETERS : - // RETURNS : unique building ID //////////////////////////////////////////////////////////////////////// unsigned short Mission::GetBuildingID( void ) const { unsigned short id = 0; Building *b = static_cast( buildings.Head() ); while ( b ) { if ( b->ID() == id ) { ++id; b = static_cast( buildings.Head() ); } else b = static_cast( b->Next() ); } return id; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::CreateEvent // DESCRIPTION: Create a new event. The event is initialized with some // default values (which may be invalid in some cases). // PARAMETERS : type - event type // trigger - event trigger type // RETURNS : created event or NULL on error //////////////////////////////////////////////////////////////////////// Event *Mission::CreateEvent( unsigned char type, unsigned char trigger ) { Event *e = new Event( GetEventID(), type, trigger ); if ( e ) events.AddTail( e ); return e; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::DeleteEvent // DESCRIPTION: Delete an event. // PARAMETERS : e - event to remove from mission // RETURNS : - //////////////////////////////////////////////////////////////////////// void Mission::DeleteEvent( Event *e ) { e->Remove(); delete e; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::GetEventByID // DESCRIPTION: Find the event corresponding to the given identifier. // PARAMETERS : id - identifier of the event to be searched for // RETURNS : pointer to the event, or NULL if no event with that ID // exists //////////////////////////////////////////////////////////////////////// Event *Mission::GetEventByID( unsigned short id ) const { Event *e = static_cast( events.Head() ); while ( e ) { if ( e->ID() == id ) return e; e = static_cast( e->Next() ); } return NULL; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::GetEventID // DESCRIPTION: Get a unique identifier for a new event. // PARAMETERS : - // RETURNS : unique event ID //////////////////////////////////////////////////////////////////////// unsigned char Mission::GetEventID( void ) const { unsigned char id = 0; Event *e = static_cast( events.Head() ); while ( e ) { if ( e->ID() == id ) { ++id; e = static_cast( events.Head() ); } else e = static_cast( e->Next() ); } return id; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::SetNumPlayers // DESCRIPTION: Set the intended number of human players for this map. // This is only a hint for the player. // PARAMETERS : num - number of intended players (1 or 2) // RETURNS : - //////////////////////////////////////////////////////////////////////// void Mission::SetNumPlayers( unsigned char num ) { if ( num == 1 ) flags |= GI_AI; else flags &= ~GI_AI; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::StorageLeft // DESCRIPTION: Get the amount of free space in a transport, which can // be used to store crystals or units. Crystals require 1 // storage unit per 10 crystals, units need Unit::Weight() // each. // PARAMETERS : - // RETURNS : number of unused storage units; for non-transport units // returns 0 //////////////////////////////////////////////////////////////////////// short Mission::StorageLeft( Unit &u ) const { short space; if ( u.IsTransport() ) { space = u.Type()->Slots() - ((u.Crystals() + 9) / 10); if ( !u.IsSheltered() ) { for ( Unit *walk = static_cast(units.Head()); walk; walk = static_cast(walk->Next()) ) { if ( (u.Position() == walk->Position()) && walk->IsSheltered() ) space -= walk->Weight(); } } } else space = 0; return space; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::Validate // DESCRIPTION: Check the mission for (logical) errors. This will catch // mistakes concerning settings which can not directly be // enforced by CoMET (e.g. you could create an event // targetting a unit and delete that unit afterwards). // PARAMETERS : errors - stringstream; for each error found, a short // message will be appended which can afterwards // be presented to the user // RETURNS : number of errors and warnings detected //////////////////////////////////////////////////////////////////////// unsigned short Mission::Validate( stringstream &errors ) { unsigned short errs = 0; if ( name == -1 ) { ++errs; errors << "Error: No level name configured.\n\n"; } else if ( !GetMessage(name) ) { ++errs; errors << "Error: Invalid level name " << (short)name << " configured.\n\n"; } Player *pls[2] = { &p1, &p2 }; for ( int i = 0; i < 2; ++i ) { if ( pls[i]->NameID() == -1 ) { ++errs; errors << "Error: No name set for player " << i+1 << ".\n\n"; } else if ( !GetMessage(pls[i]->NameID()) ) { ++errs; errors << "Error: Invalid name " << (short)pls[i]->NameID() << " set for player " << i+1 << ".\n\n"; } if ( pls[i]->Briefing() == -1 ) { ++errs; errors << "Warning: No briefing set for player " << i+1 << ".\n\n"; } else if ( !GetMessage(pls[i]->Briefing()) ) { ++errs; errors << "Error: Invalid briefing " << (short)pls[i]->Briefing() << " set for player " << i+1 << ".\n\n"; } } if ( level_info == -1 ) { ++errs; errors << "Warning: No level info message configured.\n\n"; } else if ( !GetMessage(level_info) ) { ++errs; errors << "Error: Invalid level info message " << (short)level_info << " configured.\n\n"; } if ( (campaign_name != -1) && !GetMessage(campaign_name) ) { ++errs; errors << "Error: Invalid campaign name " << (short)campaign_name << " configured.\n\n"; } if ( (campaign_info != -1) && !GetMessage(campaign_info) ) { ++errs; errors << "Error: Invalid campaign info message " << (short)campaign_info << " configured.\n\n"; } else if ( (campaign_name != -1) && (campaign_info == -1) ) { ++errs; errors << "Warning: Campaign name set, but campaign info unset.\n\n"; } else if ( (campaign_name == -1) && (campaign_info != -1) ) { ++errs; errors << "Warning: Campaign info set, but campaign name unset.\n\n"; } if ( !IsCampaign() && (GetSequel() || (campaign_name != -1) || (campaign_info != -1)) ) { ++errs; errors << "Error: Campaign name, info, or sequel set, but map is not part of a campaign.\n\n"; } errs += ValidateMap( errors ); Node *n; for ( n = events.Head(); n; n = n->Next() ) errs += ValidateEvent( *static_cast(n), errors ); for ( n = buildings.Head(); n; n = n->Next() ) errs += ValidateShop( *static_cast(n), errors ); errors << "Validation summary\n" << "------------------\n" << "Detected " << errs << " errors or warnings."; return errs; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::ValidateMap // DESCRIPTION: Check the map for errors. // PARAMETERS : errors - error stream // RETURNS : number of errors and warnings detected //////////////////////////////////////////////////////////////////////// unsigned short Mission::ValidateMap( stringstream &errors ) const { unsigned short errs = 0; Point p; for ( p.y = 0; p.y < map.Height(); ++p.y ) { for ( p.x = 0; p.x < map.Width(); ++p.x ) { Building *b = map.GetBuilding( p ); bool isshop = map.IsBuilding( p ); if ( isshop && !b ) { ++errs; errors << "Error: Tile at " << p.x << '/' << p.y << " denotes a shop entrance, but no shop has been created.\n\n"; } else if ( !isshop && b ) { ++errs; errors << "Error: A shop exists at " << p.x << '/' << p.y << ", but there is no entrance.\n\n"; } Unit *u = map.GetUnit( p ); if ( u && !u->IsSheltered() && ((map.TerrainTypes(p) & u->Terrain()) == 0) ) { ++errs; errors << "Warning: '" << u->Name() << "' (" << u->ID() << ") at " << p.x << '/' << p.y << " walking on invalid terrain.\n\n"; } } } return errs; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::ValidateEvent // DESCRIPTION: Check the event for errors. // PARAMETERS : e - event to check // errors - error stream // RETURNS : number of errors and warnings detected //////////////////////////////////////////////////////////////////////// unsigned short Mission::ValidateEvent( Event &e, stringstream &errors ) const { unsigned short errs = 0; if ( (e.Title() != -1) && !GetMessage(e.Title()) ) { ++errs; errors << "Error: Invalid title " << (short)e.Title() << " for " << e.Name() << " (" << (short)e.ID() << ") event.\n\n"; } if ( (e.Message() != -1) && !GetMessage(e.Message()) ) { ++errs; errors << "Error: Invalid message " << (short)e.Message() << " for " << e.Name() << " (" << (short)e.ID() << ") event.\n\n"; } if ( (e.Dependency() != -1) && !GetEventByID(e.Dependency()) ) { ++errs; errors << "Warning: Event " << (short)e.ID() << " depends on non-existing event " << (short)e.Dependency() << ".\n\n"; } if ( (e.Discard() != -1) && !GetEventByID(e.Discard()) ) { ++errs; errors << "Warning: Event " << (short)e.ID() << " discards non-existing event " << (short)e.Discard() << ".\n\n"; } switch ( e.Trigger() ) { case ETRIGGER_HANDICAP: break; case ETRIGGER_HAVE_BUILDING: if ( (e.GetTData(0) == -1) || !GetBuildingByID(e.GetTData(0)) ) { ++errs; errors << "Error: Trigger of " << e.Name() << " (" << (short)e.ID() << ") event targets non-existing shop with ID " << e.GetTData(0) << ".\n\n"; } break; case ETRIGGER_HAVE_CRYSTALS: if ( (e.GetTData(2) >= 0) && !GetBuildingByID(e.GetTData(2)) ) { ++errs; errors << "Error: Trigger of " << e.Name() << " (" << (short)e.ID() << ") event targets non-existing shop with ID " << e.GetTData(2) << ".\n\n"; } break; case ETRIGGER_HAVE_UNIT: if ( (e.GetTData(0) < 0) || !GetUnitByID(e.GetTData(0)) ) { ++errs; errors << "Error: Trigger of " << e.Name() << " (" << (short)e.ID() << ") event targets non-existing unit with ID " << e.GetTData(0) << ".\n\n"; } break; case ETRIGGER_TIMER: break; case ETRIGGER_UNIT_DESTROYED: if ( e.GetTData(0) >= 0 ) { Unit *u = GetUnitByID( e.GetTData(0) ); if ( !u ) { ++errs; errors << "Error: Trigger of " << e.Name() << " (" << (short)e.ID() << ") event targets non-existing unit with ID " << e.GetTData(0) << ".\n\n"; } else if ( u->Owner() != e.GetTData(1) ) { ++errs; errors << "Warning: Trigger of " << e.Name() << " (" << (short)e.ID() << ") event had incorrect owner of " << u->Name() << " (" << u->ID() << "). Fixed.\n\n"; e.SetTData( 1, u->Owner() ); } } break; case ETRIGGER_UNIT_POSITION: if ( (e.GetTData(0) > 0) && !GetUnitByID(e.GetTData(0)) ) { ++errs; errors << "Error: Trigger of " << e.Name() << " (" << (short)e.ID() << ") event targets non-existing unit with ID " << e.GetTData(0) << ".\n\n"; } else if ( (e.GetTData(0) < -1) && (-e.GetTData(0) - 2 >= unit_set->NumTiles()) ) { ++errs; errors << "Error: Trigger of " << e.Name() << " (" << (short)e.ID() << ") event targets invalid unit type with ID " << -e.GetTData(0) - 2 << ".\n\n"; } break; default: ++errs; errors << "Warning: Unknown event trigger " << e.TriggerName() << " for " << e.Name() << " (" << (short)e.ID() << ") event.\n\n"; } switch ( e.Type() ) { case EVENT_CONFIGURE: if ( (e.GetData(1) != -1) && !GetMessage(e.GetData(1)) ) { ++errs; errors << "Error: Invalid message " << e.GetData(1) << " for " << e.Name() << " (" << (short)e.ID() << ") event.\n\n"; } case EVENT_MINING: case EVENT_RESEARCH: if ( (e.GetData(0) == -1) || !GetBuildingByID(e.GetData(0)) ) { ++errs; errors << "Error: " << e.Name() << " (" << (short)e.ID() << ") event targets non-existing shop with ID " << e.GetData(0) << ".\n\n"; } break; case EVENT_MANIPULATE_EVENT: if ( (e.GetData(0) == -1) || !GetEventByID(e.GetData(0)) ) { ++errs; errors << "Error: " << e.Name() << " (" << (short)e.ID() << ") event targets non-existing event with ID " << e.GetData(0) << ".\n\n"; } break; case EVENT_CREATE_UNIT: case EVENT_MESSAGE: case EVENT_SET_HEX: break; case EVENT_DESTROY_UNIT: if ((e.GetData(0) >= 0) && !GetUnitByID(e.GetData(0))) { ++errs; errors << "Error: Invalid unit " << e.GetData(0) << " for " << e.Name() << " (" << (short)e.ID() << ") event.\n\n"; } break; case EVENT_SCORE: if ( (e.GetData(1) != -1) && !GetMessage(e.GetData(1)) ) { ++errs; errors << "Error: Invalid message " << e.GetData(1) << " for " << e.Name() << " (" << (short)e.ID() << ") event.\n\n"; } if ( (e.GetData(1) != -1) && (e.GetData(2) != -1) && !GetMessage(e.GetData(2)) ) { ++errs; errors << "Error: Event " << (short)e.ID() << " references illegal message " << e.GetData(2) << ".\n\n"; } else if ( (e.GetData(1) == -1) && (e.GetData(2) != -1) ) { ++errs; errors << "Warning: Event " << (short)e.ID() << " set a title but no message.\n\n"; } break; case EVENT_SET_TIMER: if ( (e.GetData(0) == -1) || !GetEventByID(e.GetData(0)) ) { ++errs; errors << "Error: " << e.Name() << " (" << (short)e.ID() << ") event targets non-existing event with ID " << e.GetData(0) << ".\n\n"; } else { Event *tev = GetEventByID(e.GetData(0)); if ( tev->Trigger() != ETRIGGER_TIMER ) { ++errs; errors << "Error: " << e.Name() << " (" << (short)e.ID() << ") event targets event that has no " << etrigger_labels[ETRIGGER_TIMER] << " trigger.\n\n"; } } break; default: ++errs; errors << "Warning: Unknown event type " << e.Name() << " for event ID " << (short)e.ID() << ".\n\n"; } return errs; } //////////////////////////////////////////////////////////////////////// // NAME : Mission::ValidateShop // DESCRIPTION: Check the shop for errors. // PARAMETERS : b - shop to check // errors - error stream // RETURNS : number of errors and warnings detected //////////////////////////////////////////////////////////////////////// unsigned short Mission::ValidateShop( Building &b, stringstream &errors ) const { unsigned short errs = 0; if ( b.NameID() == -1 ) { ++errs; errors << "Error: No name set for shop " << b.ID() << ".\n\n"; } else if ( !b.Name() ) { ++errs; errors << "Error: Invalid name " << (short)b.NameID() << " for shop " << b.ID() << ".\n\n"; } else if ( strlen(b.Name()) > 30 ) { ++errs; errors << "Error: Name for shop " << b.ID() << " is longer than 30 characters.\n\n"; } return errs; } //////////////////////////////////////////////////////////////////////// // NAME : Player::Player // DESCRIPTION: Create a new player. // PARAMETERS : id - player identifier (PLAYER_ONE or PLAYER_TWO) // RETURNS : - //////////////////////////////////////////////////////////////////////// Player::Player( unsigned char id ) : p_col_light(id == PLAYER_ONE ? P1_COLOR_LIGHT : P2_COLOR_LIGHT ), p_col_dark(id == PLAYER_ONE ? P1_COLOR_SHADOW : P2_COLOR_SHADOW ) { p_id = id; p_success = 0; p_briefing = -1; p_name_id = -1; p_type = COMPUTER; } //////////////////////////////////////////////////////////////////////// // NAME : Player::Load // DESCRIPTION: Load player information from a file. // PARAMETERS : file - data file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Player::Load( MemBuffer &file ) { p_id = file.Read8(); p_type = file.Read8(); p_success = file.Read8(); p_briefing = file.Read8(); p_name_id = file.Read8(); unsigned char len = file.Read8(); p_password = StringUtil::crypt(file.ReadS(len)); p_col_light.r = file.Read8(); p_col_light.g = file.Read8(); p_col_light.b = file.Read8(); p_col_dark.r = file.Read8(); p_col_dark.g = file.Read8(); p_col_dark.b = file.Read8(); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Player::Save // DESCRIPTION: Save player information to a file. // PARAMETERS : file - data file descriptor // RETURNS : 0 on success, non-zero on error //////////////////////////////////////////////////////////////////////// int Player::Save( MemBuffer &file ) const { file.Write8( p_id ); file.Write8( p_type ); file.Write8( p_success ); file.Write8( p_briefing ); file.Write8( p_name_id ); file.Write8( p_password.size() ); file.WriteS( StringUtil::crypt( p_password ) ); file.Write8( p_col_light.r ); file.Write8( p_col_light.g ); file.Write8( p_col_light.b ); file.Write8( p_col_dark.r ); file.Write8( p_col_dark.g ); file.Write8( p_col_dark.b ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Player::Export // DESCRIPTION: Save the player to a plain text file. // PARAMETERS : file - data file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Player::Export( ofstream &file ) const { file << "[player]\n"; file << "name = " << (short)p_name_id << '\n'; file << "briefing = " << (short)p_briefing << '\n'; file << "fcolor = " << (short)p_col_light.r << ',' << (short)p_col_light.g << ',' << (short)p_col_light.b << '\n'; file << "bcolor = " << (short)p_col_dark.r << ',' << (short)p_col_dark.g << ',' << (short)p_col_dark.b << "\n\n"; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Event::Event // DESCRIPTION: Create a new event. // PARAMETERS : id - unique event identifier // type - event type // trigger - event trigger type // RETURNS : - //////////////////////////////////////////////////////////////////////// Event::Event( unsigned char id, unsigned char type, unsigned char trigger ) { e_id = id; e_type = type; e_trigger = trigger; e_depend = -1; e_discard = -1; e_title = -1; e_message = -1; e_flags = 0; e_player = PLAYER_ONE; // set event data defaults switch ( e_type ) { case EVENT_CONFIGURE: e_data[0] = 0; // set player 1 briefing e_data[1] = -1; // no briefing available e_data[2] = 0; break; case EVENT_CREATE_UNIT: e_data[0] = 0; // build first unit type in set e_data[1] = 0; // build at position (0, 0) e_data[2] = NORTH | (MAX_GROUP_SIZE << 3) | (0 << 6); // face northwards, MAX_GROUP_SIZE, no xp break; case EVENT_DESTROY_UNIT: e_data[0] = -1; // destroy any unit e_data[1] = -1; // any owner e_data[2] = 0; // at position 0/0 break; case EVENT_MANIPULATE_EVENT: e_data[0] = -1; // modify event -1 e_data[1] = 0; // flags affected e_data[2] = 0; // set selected flags break; case EVENT_MESSAGE: e_data[0] = -1; // no default focus e_data[1] = e_data[2] = 0; break; case EVENT_MINING: e_data[0] = -1; // change mining in shop -1 e_data[1] = 0; // set crystals to this amount e_data[2] = 0; // set storage to absolute amount break; case EVENT_RESEARCH: e_data[0] = -1; // research in shop -1 e_data[1] = 0; // research first unit in set e_data[2] = 0; // allow production of unit break; case EVENT_SCORE: e_data[0] = 100; // award 100 points e_data[1] = e_data[2] = -1; // don't show a message to the loser break; case EVENT_SET_HEX: e_data[0] = 0; // set to first tile e_data[1] = 0; // change hex at (0, 0) e_data[2] = 0; break; case EVENT_SET_TIMER: e_data[0] = -1; // invalid event e_data[1] = 0; // set timer to 0 e_data[2] = 2; // relative to current configuration break; } switch ( e_trigger ) { case ETRIGGER_TIMER: e_tdata[0] = 0; // activate at beginning of first turn e_tdata[1] = e_tdata[2] = 0; break; case ETRIGGER_UNIT_DESTROYED: e_tdata[0] = -1; // destroy all enemy units e_tdata[1] = PLAYER_ONE; e_tdata[2] = 0; break; case ETRIGGER_HAVE_CRYSTALS: e_tdata[0] = 100; // >= 100 crystals e_tdata[1] = PLAYER_ONE; // owned by first player e_tdata[2] = -1; // check all shops break; case ETRIGGER_HAVE_BUILDING: case ETRIGGER_HAVE_UNIT: e_tdata[0] = -1; // check shop/unit -1 e_tdata[1] = PLAYER_ONE; // owned by first player e_tdata[2] = -1; // activate any turn if condition is true break; case ETRIGGER_UNIT_POSITION: e_tdata[0] = -1; // require no specific unit e_tdata[1] = 0; // coordinates of target hex (0/0) e_tdata[2] = PLAYER_ONE; // player required to control the unit break; case ETRIGGER_HANDICAP: e_tdata[0] = HANDICAP_NONE|HANDICAP_P1|HANDICAP_P2; // trigger always e_tdata[1] = e_tdata[2] = 0; break; } e_tmpbuf = ""; } //////////////////////////////////////////////////////////////////////// // NAME : Event::Load // DESCRIPTION: Load an event from a file. // PARAMETERS : file - file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Event::Load( MemBuffer &file ) { int i; e_id = file.Read8(); e_type = file.Read8(); e_trigger = file.Read8(); e_depend = file.Read8(); e_discard = file.Read8(); for ( i = 0; i < 3; ++i ) e_tdata[i] = file.Read16(); for ( i = 0; i < 3; ++i ) e_data[i] = file.Read16(); e_title = file.Read16(); e_message = file.Read16(); e_flags = file.Read16(); e_player = file.Read8(); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Event::Save // DESCRIPTION: Save the event data to a file. // PARAMETERS : file - data file descriptor // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Event::Save( MemBuffer &file ) const { int i; file.Write8( e_id ); file.Write8( e_type ); file.Write8( e_trigger ); file.Write8( e_depend ); file.Write8( e_discard ); for ( i = 0; i < 3; ++i ) file.Write16( e_tdata[i] ); for ( i = 0; i < 3; ++i ) file.Write16( e_data[i] ); file.Write16( e_title ); file.Write16( e_message ); file.Write16( e_flags ); file.Write8( e_player ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Event::Export // DESCRIPTION: Save the event to a plain text file. // PARAMETERS : file - data file descriptor // map - current map // RETURNS : 0 on success, -1 on error //////////////////////////////////////////////////////////////////////// int Event::Export( ofstream &file, const Map &map ) const { const char *type[] = { "message", "mining", "score", "configure", "createunit", "manipulateevent", "research", "sethex", "settimer", "destroyunit" }; Point loc; const UnitSet *uset = map.GetUnitSet(); file << "[event]\n"; file << "id = " << (short)e_id << '\n'; file << "type = " << type[e_type-1] << '\n'; file << "player = " << (e_player + 1) << '\n'; if ( e_depend != -1 ) file << "depend = " << (short)e_depend << '\n'; if ( e_discard != -1 ) file << "discard = " << (short)e_discard << '\n'; if ( e_title != -1 ) file << "title = " << e_title << '\n'; if ( e_message != -1 ) file << "message = " << e_message << '\n'; if ( e_flags != 0 ) file << "flags = " << e_flags << '\n'; file << "trigger = "; switch ( e_trigger ) { case ETRIGGER_TIMER: file << "timer\n"; file << "ttime = " << e_tdata[0] << '\n'; break; case ETRIGGER_UNIT_DESTROYED: file << "unitdestroyed\n"; file << "tunit = "; if ( e_tdata[0] >= -1 ) file << e_tdata[0] << '\n'; else file << uset->GetUnitInfo(-e_tdata[0] - 2)->Name() << '\n'; file << "towner = " << e_tdata[1] + 1 << '\n'; break; case ETRIGGER_HAVE_BUILDING: file << "havebuilding\n"; file << "tbuilding = " << e_tdata[0] << '\n'; file << "towner = " << e_tdata[1] + 1 << '\n'; file << "ttime = " << e_tdata[2] << '\n'; break; case ETRIGGER_HAVE_CRYSTALS: file << "havecrystals\n"; file << "tcrystals = " << e_tdata[0] << '\n'; file << "towner = " << e_tdata[1] + 1 << '\n'; file << "tbuilding = " << e_tdata[2] << '\n'; break; case ETRIGGER_HAVE_UNIT: file << "haveunit\n"; file << "tunit = " << e_tdata[0] << '\n'; file << "towner = " << e_tdata[1] + 1 << '\n'; file << "ttime = " << e_tdata[2] << '\n'; break; case ETRIGGER_UNIT_POSITION: file << "unitposition\n"; file << "tunit = "; if ( e_tdata[0] >= -1 ) file << e_tdata[0] << '\n'; else file << uset->GetUnitInfo(-e_tdata[0] - 2)->Name() << '\n'; file << "towner = " << e_tdata[2] + 1 << '\n'; loc = map.Index2Hex( e_tdata[1] ); file << "tpos = " << loc.x << '/' << loc.y << '\n'; break; case ETRIGGER_HANDICAP: file << "handicap\n"; file << "thandicap = " << e_tdata[0] << '\n'; break; } switch ( e_type ) { case EVENT_CONFIGURE: file << "setting = "; switch ( e_data[0] ) { case 0: file << "briefing1"; break; case 1: file << "briefing2"; break; case 2: file << "nextmap"; break; } file << '\n' << "value = "; switch ( e_data[0] ) { case 0: case 1: file << e_data[1]; break; case 2: file << e_tmpbuf; break; } file << '\n'; break; case EVENT_CREATE_UNIT: file << "unit = " << uset->GetUnitInfo(e_data[0])->Name() << '\n'; loc = map.Index2Hex( e_data[1] ); file << "pos = " << loc.x << '/' << loc.y << '\n'; file << "face = " << (e_data[2] & 0x07) << '\n'; if ( ((e_data[2] & 0x38) >> 3) != MAX_GROUP_SIZE ) file << "size = " << ((e_data[2] & 0x38) >> 3) << '\n'; if ( ((e_data[2] & 0x1C0) >> 6) != 0 ) file << "xp = " << ((e_data[2] & 0x1C0) >> 6) << '\n'; break; case EVENT_DESTROY_UNIT: file << "unit = " << e_data[0] << '\n'; file << "owner = " << (e_data[1] == -1 ? -1 : e_data[1] + 1) << '\n'; file << "pos = " << e_data[2] << '\n'; break; case EVENT_MANIPULATE_EVENT: file << "event = " << e_data[0] << '\n'; file << "eflags = " << e_data[1] << '\n'; file << "action = " << e_data[2] << '\n'; break; case EVENT_MESSAGE: loc = map.Index2Hex( e_data[0] ); if ( loc != Point(-1,-1) ) file << "pos = " << loc.x << '/' << loc.y << '\n'; break; case EVENT_MINING: file << "building = " << e_data[0] << '\n'; file << "crystals = " << e_data[1] << '\n'; file << "action = " << e_data[2] << '\n'; break; case EVENT_RESEARCH: file << "building = " << e_data[0] << '\n'; file << "unit = " << uset->GetUnitInfo(e_data[1])->Name() << '\n'; if ( e_data[2] != 0 ) file << "action = " << e_data[2] << '\n'; break; case EVENT_SCORE: file << "success = " << e_data[0] << '\n'; file << "othermsg = " << e_data[1] << '\n'; file << "othertitle = " << e_data[2] << '\n'; break; case EVENT_SET_HEX: file << "tile = " << e_data[0] << '\n'; loc = map.Index2Hex( e_data[1] ); file << "pos = " << loc.x << '/' << loc.y << '\n'; break; case EVENT_SET_TIMER: file << "event = " << e_data[0] << '\n'; file << "time = " << e_data[1] << '\n'; file << "offset = " << e_data[2] << '\n'; break; } file << '\n'; return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Event::Name // DESCRIPTION: Get the name of the event (or rather, the event type). // PARAMETERS : - // RETURNS : event type string //////////////////////////////////////////////////////////////////////// const char *Event::Name( void ) const { return event_labels[Type()-1]; } //////////////////////////////////////////////////////////////////////// // NAME : Event::TriggerName // DESCRIPTION: Get the name of the event trigger type. // PARAMETERS : - // RETURNS : event trigger type string //////////////////////////////////////////////////////////////////////// const char *Event::TriggerName( void ) const { return etrigger_labels[Trigger()]; } crimson-0.5.2.orig/src/comet/mission.h0000600000175000017500000001716410554366467016062 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // mission.h - the data construct to contain all level info /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_ED_MISSION_H #define _INCLUDE_ED_MISSION_H #include #include #include using namespace std; #include "map.h" class Player { public: Player( unsigned char id ); int Load( MemBuffer &file ); int Save( MemBuffer &file ) const; int Export( ofstream &file ) const; void SetID( unsigned char id ) { p_id = id; } void SetNameID( signed char name ) { p_name_id = name; } void SetBriefing( signed char briefing ) { p_briefing = briefing; } void SetLightColor( const Color &col ) { p_col_light = col; } void SetDarkColor( const Color &col ) { p_col_dark = col; } signed char NameID( void ) const { return p_name_id; } signed char Briefing( void ) const { return p_briefing; } Color LightColor( void ) const { return p_col_light; } Color DarkColor( void ) const { return p_col_dark; } private: unsigned char p_id; unsigned char p_type; unsigned char p_success; signed char p_briefing; signed char p_name_id; string p_password; Color p_col_light; Color p_col_dark; }; class Event : public Node { public: Event( void ) {} Event( unsigned char id, unsigned char type, unsigned char trigger ); int Load( MemBuffer &file ); int Save( MemBuffer &file ) const; int Export( ofstream &file, const Map &map ) const; unsigned char ID( void ) const { return e_id; } void SetID( unsigned char id ) { e_id = id; } const char *Name( void ) const; unsigned char Trigger( void ) const { return e_trigger; } void SetTrigger( unsigned char trig ) { e_trigger = trig; } const char *TriggerName( void ) const; unsigned char Type( void ) const { return e_type; } void SetType( unsigned char type ) { e_type = type; } unsigned char Player( void ) const { return e_player; } void SetPlayer( unsigned char player ) { e_player = player; } short Title( void ) const { return e_title; } void SetTitle( short title ) { e_title = title; } short Message( void ) const { return e_message; } void SetMessage( short msg ) { e_message = msg; } unsigned short Flags( void ) const { return e_flags; } void SetFlags( unsigned short f ) { e_flags = f; } void ToggleFlags( unsigned short flags ) { e_flags ^= flags; } signed char Dependency( void ) const { return e_depend; } void SetDependency( signed char dep ) { e_depend = dep; } signed char Discard( void ) const { return e_discard; } void SetDiscard( signed char ev ) { e_discard = ev; } short GetData( unsigned short index ) const { return e_data[index]; } void SetData( unsigned short index, short value ) { e_data[index] = value; } short GetTData( unsigned short index ) const { return e_tdata[index]; } void SetTData( unsigned short index, short value ) { e_tdata[index] = value; } void SetTmpBuf( const string &s ) { e_tmpbuf = s; } const string &GetTmpBuf( void ) const { return e_tmpbuf; } private: unsigned char e_id; unsigned char e_type; unsigned char e_trigger; signed char e_depend; signed char e_discard; short e_tdata[3]; short e_data[3]; short e_title; short e_message; unsigned short e_flags; unsigned char e_player; string e_tmpbuf; }; class Mission { public: Mission( void ) : flags(GI_SKIRMISH), p1(PLAYER_ONE), p2(PLAYER_TWO), unit_set(0), terrain_set(0) {} Mission( const Point &size, TerrainSet *ts, UnitSet *us ); ~Mission( void ); Map &GetMap( void ) { return map; } const string &GetTitle( void ) const { return last_file_name; } void SetTitle( const string &title ) { last_file_name = title; } const char *GetSequel( void ) const { return next_map.empty() ? 0 : next_map.c_str(); } void SetSequel( const char *map ) { map ? next_map = map : next_map.erase(); } const char *GetMusic( void ) const { return music.empty() ? 0 : music.c_str(); } void SetMusic( const char *track ) { track ? music = track : music.erase(); } TerrainSet &GetTerrainSet( void ) const { return *terrain_set; } const UnitSet &GetUnitSet( void ) const { return *unit_set; } signed char GetLevelInfoMsg( void ) const { return level_info; } void SetLevelInfoMsg( signed char msg ) { level_info = msg; } signed char GetCampaignInfo( void ) const { return campaign_info; } void SetCampaignInfo( signed char msg ) { campaign_info = msg; } signed char GetName( void ) const { return name; } void SetName( signed char msg ) { name = msg; } signed char GetCampaignName( void ) const { return campaign_name; } void SetCampaignName( signed char msg ) { campaign_name = msg; } unsigned char GetNumPlayers( void ) const { return ((flags & GI_AI) == 0) ? 2 : 1; } void SetNumPlayers( unsigned char num ); Player &GetPlayer( unsigned char id ) { return (id == PLAYER_ONE) ? p1 : p2; } int Load( const char *filename ); int Save( const char *filename ); int Export( const string &filename ) const; unsigned short Validate( stringstream &errors ); Unit *CreateUnit( const UnitType *type, unsigned char pid, const Point &pos ); void DeleteUnit( Unit *u ); Unit *GetUnitByID( unsigned short id ) const; Building *CreateBuilding( unsigned char pid, const Point &pos ); void DeleteBuilding( Building *b ); Building *GetBuildingByID( unsigned short id ) const; Event *CreateEvent( unsigned char type, unsigned char trigger ); void DeleteEvent( Event *e ); Event *GetEventByID( unsigned short id ) const; short StorageLeft( Unit &u ) const; List &GetEvents( void ) { return events; } List &GetUnits( void ) { return units; } List &GetBuildings( void ) { return buildings; } Locale &GetMessages( void ) { return messages; } const char *GetMessage( short id ) const { return messages.GetMsg(id); } bool IsCampaign( void ) const { return (flags & GI_CAMPAIGN) != 0; } void SetCampaign( bool c ) { c ? flags |= GI_CAMPAIGN : flags &= ~(GI_CAMPAIGN); } bool IsSkirmish( void ) const { return (flags & GI_SKIRMISH) != 0; } void SetSkirmish( bool s ) { s ? flags |= GI_SKIRMISH : flags &= ~(GI_SKIRMISH); } protected: unsigned short GetUnitID( void ) const; unsigned short GetBuildingID( void ) const; unsigned char GetEventID( void ) const; unsigned short ValidateEvent( Event &e, stringstream &errors ) const; unsigned short ValidateShop( Building &b, stringstream &errors ) const; unsigned short ValidateMap( stringstream &errors ) const; unsigned short flags; signed char name; signed char level_info; signed char campaign_name; signed char campaign_info; string next_map; string music; Map map; List units; List buildings; List events; Player p1; Player p2; UnitSet *unit_set; TerrainSet *terrain_set; Locale messages; string last_file_name; }; #endif // _INCLUDE_ED_MISSION_H crimson-0.5.2.orig/src/comet/msgs.h0000600000175000017500000000241510554366467015343 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // msgs.h - message identifiers /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_ED_MSGS_H #define _INCLUDE_ED_MSGS_H #define MSG(m) m #define MSG_B_OK "_OK" #define MSG_B_CANCEL "_Cancel" #define MSG_B_LOAD "_Load" #define MSG_B_SAVE "_Save" #define MSG_B_SKIP "_Abort" #define MSG_LOAD_GAME "Load game" #define MSG_SAVE_GAME "Save game" #endif /* _INCLUDE_ED_MSGS_H */ crimson-0.5.2.orig/src/comet/uiaux.cpp0000600000175000017500000001271610547540675016062 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // //////////////////////////////////////////////////////////////////////// // uiaux.cpp //////////////////////////////////////////////////////////////////////// #include "uiaux.h" //////////////////////////////////////////////////////////////////////// // NAME : TLWListBuilder::BuildEventList // DESCRIPTION: Use the events list to create a second list which can // be displayed by a TextListWidget. // PARAMETERS : events - list of events // tlw - list of TLWNodes to be filled // RETURNS : - //////////////////////////////////////////////////////////////////////// void TLWListBuilder::BuildEventList( const List &events, TLWList &tlw ) { for ( Event *e = static_cast( events.Head() ); e; e = static_cast(e->Next()) ) { char buf[64]; sprintf( buf, "%s / %s (%d)", e->Name(), e->TriggerName(), e->ID() ); tlw.InsertNodeSorted( new TLWNode(buf, e, e->ID()) ); } } //////////////////////////////////////////////////////////////////////// // NAME : TLWListBuilder::BuildUnitList // DESCRIPTION: Use the units list to create a second list which can // be displayed by a TextListWidget. // PARAMETERS : units - list of units // tlw - list of TLWNodes to be filled // RETURNS : - //////////////////////////////////////////////////////////////////////// void TLWListBuilder::BuildUnitList( const List &units, TLWList &tlw ) { for ( Unit *u = static_cast( units.Head() ); u; u = static_cast(u->Next()) ) { char buf[28]; sprintf( buf, "%s (%d)", u->Name(), u->ID() ); tlw.InsertNodeSorted( new TLWNode(buf, u, u->ID()) ); } } //////////////////////////////////////////////////////////////////////// // NAME : TLWListBuilder::BuildUnitList // DESCRIPTION: Use the units list to create a second list which can // be displayed by a TextListWidget. Only include units at // the given hex coordinates which are inside a unit // container. // PARAMETERS : units - list of units // tlw - list of TLWNodes to be filled // pos - requested hex position // RETURNS : - //////////////////////////////////////////////////////////////////////// void TLWListBuilder::BuildUnitList( const List &units, TLWList &tlw, const Point &pos ) { for ( Unit *u = static_cast( units.Head() ); u; u = static_cast(u->Next()) ) { if ( (u->Position() == pos) && u->IsSheltered() ) { char buf[28]; sprintf( buf, "%s (%d)", u->Name(), u->ID() ); tlw.InsertNodeSorted( new TLWNode(buf, u, u->ID()) ); } } } //////////////////////////////////////////////////////////////////////// // NAME : TLWListBuilder::BuildShopList // DESCRIPTION: Use the buildings list to create a second list which can // be displayed by a TextListWidget. // PARAMETERS : shops - list of buildings // tlw - list of TLWNodes to be filled // RETURNS : - //////////////////////////////////////////////////////////////////////// void TLWListBuilder::BuildShopList( const List &shops, TLWList &tlw ) { for ( Building *b = static_cast( shops.Head() ); b; b = static_cast(b->Next()) ) { char buf[40]; sprintf( buf, "%s (%d)", b->Name(), b->ID() ); tlw.InsertNodeSorted( new TLWNode(buf, b, b->ID()) ); } } //////////////////////////////////////////////////////////////////////// // NAME : TLWListBuilder::BuildMsgList // DESCRIPTION: Use the messages list to create a second list which can // be displayed by a TextListWidget. // PARAMETERS : msgs - message catalog // tlw - list of TLWNodes to be filled // RETURNS : - //////////////////////////////////////////////////////////////////////// void TLWListBuilder::BuildMsgList( Locale &msgs, TLWList &tlw ) { const char *m; for ( int i = 0; (m = msgs.GetMsg(i)) != 0; ++i ) { tlw.InsertNodeSorted( new TLWNode(string(m).substr(0, 30).c_str(), const_cast(m), i) ); } } //////////////////////////////////////////////////////////////////////// // NAME : TLWListBuilder::BuildUnitTypesList // DESCRIPTION: Create a list containing all unit types defined in a // given unit set. // PARAMETERS : set - unit set to use // tlw - list of TLWNodes to be filled // RETURNS : - //////////////////////////////////////////////////////////////////////// void TLWListBuilder::BuildUnitTypesList( const UnitSet &set, TLWList &tlw ) { const UnitType *ut; for ( unsigned short i = 0; (ut = set.GetUnitInfo( i )) != NULL; ++i ) { tlw.InsertNodeSorted( new TLWNode(ut->Name(), NULL, i) ); } } crimson-0.5.2.orig/src/comet/uiaux.h0000600000175000017500000000304110554366467015521 0ustar uweuwe// Crimson Fields -- a game of tactical warfare // Copyright (C) 2000-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // uiaux.h - auxiliary user interface classes /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_UIAUX_H #define _INCLUDE_UIAUX_H #include "textbox.h" #include "mission.h" #include "misc.h" class TLWListBuilder { public: static void BuildEventList( const List &events, TLWList &tlw ); static void BuildUnitList( const List &units, TLWList &tlw ); static void BuildUnitList( const List &units, TLWList &tlw, const Point &pos ); static void BuildShopList( const List &shops, TLWList &tlw ); static void BuildMsgList( Locale &msgs, TLWList &tlw ); static void BuildUnitTypesList( const UnitSet &set, TLWList &tlw ); }; #endif /* _INCLUDE_UIAUX_H */ crimson-0.5.2.orig/src/comet/unit.cpp0000600000175000017500000001035510554366427015702 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // ///////////////////////////////////////////////////////////////////////// // unit.cpp //////////////////////////////////////////////////////////////////////// #include "unit.h" #include "hexsup.h" //////////////////////////////////////////////////////////////////////// // NAME : Unit::Unit // DESCRIPTION: Create a new unit. // PARAMETERS : type - pointer to a unit type definition // pid - owner identifier // id - unique unit identifier // pos - position on map // RETURNS : - //////////////////////////////////////////////////////////////////////// Unit::Unit( const UnitType *type, unsigned char pid, unsigned short id, const Point &pos ) : MapObject( MO_UNIT ) { u_type = type; u_pos = pos; u_flags = type->Flags(); u_id = id; u_facing = (pid == PLAYER_TWO) ? SOUTH : NORTH; u_group = MAX_GROUP_SIZE; u_xp = 0; u_pid = pid; u_crystals = 0; } //////////////////////////////////////////////////////////////////////// // NAME : Unit::Unit // DESCRIPTION: Load a unit from a data file. // PARAMETERS : file - descriptor of an open data file // type - pointer to a unit type definition // RETURNS : - //////////////////////////////////////////////////////////////////////// Unit::Unit( MemBuffer &file, const UnitType *type ) : MapObject( MO_UNIT ) { u_pid = file.Read8(); u_pos.x = file.Read16(); u_pos.y = file.Read16(); u_flags = file.Read32(); u_id = file.Read16(); u_facing = file.Read8(); u_group = file.Read8(); u_xp = file.Read8(); file.Read32(); // ignore target information if ( IsTransport() ) u_crystals = file.Read16(); else u_crystals = 0; u_type = type; } //////////////////////////////////////////////////////////////////////// // NAME : Unit::Save // DESCRIPTION: Save the unit to a data file. // PARAMETERS : file - descriptor of the save file // RETURNS : 0 on succes, non-zero on error //////////////////////////////////////////////////////////////////////// int Unit::Save( MemBuffer &file ) const { file.Write8( u_type->ID() ); file.Write8( u_pid ); file.Write16( u_pos.x ); file.Write16( u_pos.y ); file.Write32( u_flags ); file.Write16( u_id ); file.Write8( u_facing ); file.Write8( u_group ); file.Write8( u_xp ); file.Write16( (unsigned short)-1 ); // target information file.Write16( (unsigned short)-1 ); if ( IsTransport() ) file.Write16( u_crystals ); return 0; } //////////////////////////////////////////////////////////////////////// // NAME : Unit::Export // DESCRIPTION: Save the unit to a plain text file. // PARAMETERS : file - descriptor of the save file // RETURNS : 0 on succes, non-zero on error //////////////////////////////////////////////////////////////////////// int Unit::Export( ofstream &file ) const { file << "[unit]\n"; file << "type = " << Name() << '\n'; file << "player = " << (u_pid+1)%3 << '\n'; file << "id = " << u_id << '\n'; file << "pos = " << u_pos.x << '/' << u_pos.y << '\n'; if ( u_group < MAX_GROUP_SIZE ) file << "size = " << (short)u_group << '\n'; if ( XPLevel() != 0 ) file << "xp = " << (short)XPLevel() << '\n'; if ( !IsSheltered() && (((u_pid == PLAYER_ONE) && (u_facing != NORTH)) || ((u_pid == PLAYER_TWO) && (u_facing != SOUTH))) ) file << "face = " << (short)u_facing << '\n'; if ( IsTransport() && (u_crystals > 0) ) file << "crystals = " << u_crystals << '\n'; file << '\n'; return 0; } crimson-0.5.2.orig/src/comet/unit.h0000600000175000017500000001142610554366467015353 0ustar uweuwe// CoMET - The Crimson Fields Map Editing Tool // Copyright (C) 2002-2007 Jens Granseuer // // This program is free software; you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation; either version 2 of the License, or // (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // You should have received a copy of the GNU General Public License // along with this program; if not, write to the Free Software // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. // /////////////////////////////////////////////////////////////// // unit.h /////////////////////////////////////////////////////////////// #ifndef _INCLUDE_ED_UNIT_H #define _INCLUDE_ED_UNIT_H #include using namespace std; #include "list.h" #include "misc.h" #include "lset.h" #define MO_UNIT 1 #define MO_BUILDING 2 class MapObject { public: MapObject( unsigned short type ) : mo_type(type) {} virtual ~MapObject( void ) {} unsigned short Type( void ) const { return mo_type; } bool IsUnit( void ) const { return mo_type == MO_UNIT; } bool IsBuilding( void ) const { return mo_type == MO_BUILDING; } virtual const char *Name( void ) const = 0; virtual unsigned char Owner( void ) const = 0; virtual const Point &Position( void ) const = 0; virtual unsigned short MinWeight( void ) const = 0; virtual unsigned short MaxWeight( void ) const = 0; private: unsigned short mo_type; }; class Unit : public Node, public MapObject { public: Unit( void ) : MapObject(MO_UNIT) {} Unit( const UnitType *type, unsigned char pid, unsigned short id, const Point &pos ); Unit( MemBuffer &file, const UnitType *type ); int Save( MemBuffer &file ) const; int Export( ofstream &file ) const; unsigned short BaseImage( void ) const { return u_type->Image() + u_pid * 6; } unsigned short BuildCost( void ) const { return u_type->Cost(); } unsigned short Crystals( void ) const { return u_crystals; } void SetCrystals( unsigned short crystals ) { u_crystals = crystals; } unsigned char GroupSize( void ) const { return u_group; } void SetGroupSize( unsigned char size ) { u_group = size; } unsigned short ID( void ) const { return u_id; } void SetID( unsigned short id ) { u_id = id; } unsigned short Image( void ) const { return BaseImage() + u_facing; } const char *Name( void ) const { return u_type->Name(); } unsigned char Owner( void ) const { return u_pid; } void SetOwner( unsigned char pid ) { u_pid = pid; } const Point &Position( void ) const { return u_pos; } void SetPosition( const Point &pos ) { u_pos = pos; } unsigned short Terrain( void ) const { return u_type->Terrain(); } const UnitType *Type( void ) const { return u_type; } void SetType( const UnitType *type ) { u_type = type; } unsigned char XPLevel( void ) const { return u_xp/XP_PER_LEVEL; } void SetXP( unsigned char xp ) { u_xp = xp; } void SetDirection( unsigned char dir ) { u_facing = dir; } unsigned char GetDirection( void ) const { return u_facing; } unsigned long Flags( void ) const { return u_flags; } void SetFlags( unsigned long f ) { u_flags |= (f); } void UnsetFlags( unsigned long f ) { u_flags &= (~f); } bool IsGround( void ) const { return (u_flags & U_GROUND) != 0; } bool IsShip( void ) const { return (u_flags & U_SHIP) != 0; } bool IsAircraft( void ) const { return (u_flags & U_AIR) != 0; } bool IsMine( void ) const { return (u_flags & U_MINE) != 0; } bool IsTransport( void ) const { return (u_flags & U_TRANSPORT) != 0; } bool IsMedic( void ) const { return (u_flags & U_MEDIC) != 0; } bool IsMinesweeper( void ) const { return (u_flags & U_MINESWEEPER) != 0; } bool IsSlow( void ) const { return (u_flags & U_SLOW) != 0; } bool IsSheltered( void ) const { return (u_flags & U_SHELTERED) != 0; } bool IsFloating( void ) const { return (u_flags & U_FLOATING) != 0; } bool IsReady( void ) const { return (u_flags & U_DONE) == 0; } unsigned short Weight( void ) const { return u_type->Weight(); } unsigned short MinWeight( void ) const { return u_type->MinWeight(); } unsigned short MaxWeight( void ) const { return u_type->MaxWeight(); } protected: Point u_pos; // position on map unsigned long u_flags; unsigned short u_id; unsigned char u_facing; // direction unsigned char u_group; // group size unsigned char u_xp; // experience unsigned char u_pid; // player id const UnitType *u_type; unsigned short u_crystals; // only for transports }; #endif // _INCLUDE_ED_UNIT_H crimson-0.5.2.orig/tools/0000700000175000017500000000000010730256756013452 5ustar uweuwecrimson-0.5.2.orig/tools/Makefile.am0000600000175000017500000000524410203626451015501 0ustar uweuweif BUILD_BI2CF inst_bi2cf = bi2cf endif if BUILD_CFED inst_cfed = cfed else noinst_cfed = cfed endif if BUILD_CF2BMP inst_cf2bmp = cf2bmp endif bin_PROGRAMS = $(inst_bi2cf) $(inst_cfed) $(inst_cf2bmp) noinst_PROGRAMS = mkdatafile mklocale mktileset mkunitset $(noinst_cfed) bi2cf_SOURCES = bi2cf.c bi2cf.h bi_data.c bidd1_data.c bidd2_data.c hl_data.c cfed_SOURCES = cfed.cpp parser.cpp parser.h \ ../src/common/SDL_zlib.c \ ../src/common/fileio.cpp \ ../src/common/lang.cpp \ ../src/common/list.cpp \ ../src/common/lset.cpp \ ../src/common/misc.cpp \ ../src/common/rect.cpp \ ../src/common/sound.cpp \ ../src/common/strutil.cpp \ ../src/common/surface.cpp \ ../src/comet/building.cpp \ ../src/comet/map.cpp \ ../src/comet/mission.cpp \ ../src/comet/unit.cpp mklocale_SOURCES = mklocale.cpp \ ../src/common/SDL_zlib.c \ ../src/common/lang.cpp \ ../src/common/fileio.cpp \ ../src/common/strutil.cpp mkunitset_SOURCES = mkunitset.cpp \ mksurface.cpp mksurface.h parser.cpp parser.h \ ../src/common/fileio.cpp \ ../src/common/lang.cpp \ ../src/common/lset.cpp \ ../src/common/rect.cpp \ ../src/common/sound.cpp \ ../src/common/strutil.cpp \ ../src/common/surface.cpp \ ../src/common/SDL_zlib.c mktileset_SOURCES = mktileset.cpp \ mksurface.cpp mksurface.h parser.cpp parser.h \ ../src/common/SDL_zlib.c \ ../src/common/fileio.cpp \ ../src/common/lang.cpp \ ../src/common/lset.cpp \ ../src/common/rect.cpp \ ../src/common/sound.cpp \ ../src/common/strutil.cpp \ ../src/common/surface.cpp mkdatafile_SOURCES = mkdatafile.cpp mksurface.cpp \ ../src/common/SDL_zlib.c \ ../src/common/fileio.cpp \ ../src/common/surface.cpp cf2bmp_SOURCES = cf2bmp.cpp \ ../src/common/SDL_zlib.c \ ../src/common/fileio.cpp \ ../src/common/lang.cpp \ ../src/common/list.cpp \ ../src/common/lset.cpp \ ../src/common/mapview.cpp \ ../src/common/misc.cpp \ ../src/common/rect.cpp \ ../src/common/sound.cpp \ ../src/common/strutil.cpp \ ../src/common/surface.cpp \ ../src/comet/building.cpp \ ../src/comet/map.cpp \ ../src/comet/mission.cpp \ ../src/comet/unit.cpp AM_CPPFLAGS = -DDISABLE_SOUND -I$(top_srcdir)/src/common -I$(top_srcdir)/src/comet DEFS = @DEFS@ -DCF_DATADIR=\"$(pkgdatadir)/\" pkgdata_DATA = cf.dat default.tiles default.units CLEANFILES = $(pkgdata_DATA) EXTRA_DIST = default.tsrc default.usrc gfxdir = $(top_srcdir)/gfx cf.dat: mkdatafile $(cfdat_gfx) $(top_builddir)/tools/mkdatafile $(gfxdir)/CFIcons.bmp cf.dat default.tiles: mktileset default.tsrc $(gfxdir)/CFTiles.bmp $(top_builddir)/tools/mktileset $(top_srcdir)/tools/default.tsrc default.tiles $(gfxdir) default.units: mkunitset default.usrc $(gfxdir)/CFUnits.bmp $(top_builddir)/tools/mkunitset $(top_srcdir)/tools/default.usrc default.units $(gfxdir) crimson-0.5.2.orig/tools/Makefile.in0000600000175000017500000013617410730255130015516 0ustar uweuwe# Makefile.in generated by automake 1.10 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006 Free Software Foundation, Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : bin_PROGRAMS = $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) noinst_PROGRAMS = mkdatafile$(EXEEXT) mklocale$(EXEEXT) \ mktileset$(EXEEXT) mkunitset$(EXEEXT) $(am__EXEEXT_4) subdir = tools DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(install_sh) -d CONFIG_CLEAN_FILES = @BUILD_BI2CF_TRUE@am__EXEEXT_1 = bi2cf$(EXEEXT) @BUILD_CFED_TRUE@am__EXEEXT_2 = cfed$(EXEEXT) @BUILD_CF2BMP_TRUE@am__EXEEXT_3 = cf2bmp$(EXEEXT) am__installdirs = "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgdatadir)" binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) @BUILD_CFED_FALSE@am__EXEEXT_4 = cfed$(EXEEXT) PROGRAMS = $(bin_PROGRAMS) $(noinst_PROGRAMS) am_bi2cf_OBJECTS = bi2cf.$(OBJEXT) bi_data.$(OBJEXT) \ bidd1_data.$(OBJEXT) bidd2_data.$(OBJEXT) hl_data.$(OBJEXT) bi2cf_OBJECTS = $(am_bi2cf_OBJECTS) bi2cf_LDADD = $(LDADD) am_cf2bmp_OBJECTS = cf2bmp.$(OBJEXT) SDL_zlib.$(OBJEXT) \ fileio.$(OBJEXT) lang.$(OBJEXT) list.$(OBJEXT) lset.$(OBJEXT) \ mapview.$(OBJEXT) misc.$(OBJEXT) rect.$(OBJEXT) \ sound.$(OBJEXT) strutil.$(OBJEXT) surface.$(OBJEXT) \ building.$(OBJEXT) map.$(OBJEXT) mission.$(OBJEXT) \ unit.$(OBJEXT) cf2bmp_OBJECTS = $(am_cf2bmp_OBJECTS) cf2bmp_LDADD = $(LDADD) am_cfed_OBJECTS = cfed.$(OBJEXT) parser.$(OBJEXT) SDL_zlib.$(OBJEXT) \ fileio.$(OBJEXT) lang.$(OBJEXT) list.$(OBJEXT) lset.$(OBJEXT) \ misc.$(OBJEXT) rect.$(OBJEXT) sound.$(OBJEXT) \ strutil.$(OBJEXT) surface.$(OBJEXT) building.$(OBJEXT) \ map.$(OBJEXT) mission.$(OBJEXT) unit.$(OBJEXT) cfed_OBJECTS = $(am_cfed_OBJECTS) cfed_LDADD = $(LDADD) am_mkdatafile_OBJECTS = mkdatafile.$(OBJEXT) mksurface.$(OBJEXT) \ SDL_zlib.$(OBJEXT) fileio.$(OBJEXT) surface.$(OBJEXT) mkdatafile_OBJECTS = $(am_mkdatafile_OBJECTS) mkdatafile_LDADD = $(LDADD) am_mklocale_OBJECTS = mklocale.$(OBJEXT) SDL_zlib.$(OBJEXT) \ lang.$(OBJEXT) fileio.$(OBJEXT) strutil.$(OBJEXT) mklocale_OBJECTS = $(am_mklocale_OBJECTS) mklocale_LDADD = $(LDADD) am_mktileset_OBJECTS = mktileset.$(OBJEXT) mksurface.$(OBJEXT) \ parser.$(OBJEXT) SDL_zlib.$(OBJEXT) fileio.$(OBJEXT) \ lang.$(OBJEXT) lset.$(OBJEXT) rect.$(OBJEXT) sound.$(OBJEXT) \ strutil.$(OBJEXT) surface.$(OBJEXT) mktileset_OBJECTS = $(am_mktileset_OBJECTS) mktileset_LDADD = $(LDADD) am_mkunitset_OBJECTS = mkunitset.$(OBJEXT) mksurface.$(OBJEXT) \ parser.$(OBJEXT) fileio.$(OBJEXT) lang.$(OBJEXT) \ lset.$(OBJEXT) rect.$(OBJEXT) sound.$(OBJEXT) \ strutil.$(OBJEXT) surface.$(OBJEXT) SDL_zlib.$(OBJEXT) mkunitset_OBJECTS = $(am_mkunitset_OBJECTS) mkunitset_LDADD = $(LDADD) DEFAULT_INCLUDES = depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) CCLD = $(CC) LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) CXXLD = $(CXX) CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ SOURCES = $(bi2cf_SOURCES) $(cf2bmp_SOURCES) $(cfed_SOURCES) \ $(mkdatafile_SOURCES) $(mklocale_SOURCES) $(mktileset_SOURCES) \ $(mkunitset_SOURCES) DIST_SOURCES = $(bi2cf_SOURCES) $(cf2bmp_SOURCES) $(cfed_SOURCES) \ $(mkdatafile_SOURCES) $(mklocale_SOURCES) $(mktileset_SOURCES) \ $(mkunitset_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = `echo $$p | sed -e 's|^.*/||'`; pkgdataDATA_INSTALL = $(INSTALL_DATA) DATA = $(pkgdata_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CF_LIBS = @CF_LIBS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CXX = @CXX@ CXXDEPMODE = @CXXDEPMODE@ CXXFLAGS = @CXXFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ -DCF_DATADIR=\"$(pkgdatadir)/\" DEPDIR = @DEPDIR@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ GREP = @GREP@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ LDFLAGS = @LDFLAGS@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MKDIR_P = @MKDIR_P@ OBJEXT = @OBJEXT@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ SDL_CFLAGS = @SDL_CFLAGS@ SDL_CONFIG = @SDL_CONFIG@ SDL_LIBS = @SDL_LIBS@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ STRIP = @STRIP@ VERSION = @VERSION@ XMLLINT = @XMLLINT@ XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_CC = @ac_ct_CC@ ac_ct_CXX = @ac_ct_CXX@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build_alias = @build_alias@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host_alias = @host_alias@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ @BUILD_BI2CF_TRUE@inst_bi2cf = bi2cf @BUILD_CFED_TRUE@inst_cfed = cfed @BUILD_CFED_FALSE@noinst_cfed = cfed @BUILD_CF2BMP_TRUE@inst_cf2bmp = cf2bmp bi2cf_SOURCES = bi2cf.c bi2cf.h bi_data.c bidd1_data.c bidd2_data.c hl_data.c cfed_SOURCES = cfed.cpp parser.cpp parser.h \ ../src/common/SDL_zlib.c \ ../src/common/fileio.cpp \ ../src/common/lang.cpp \ ../src/common/list.cpp \ ../src/common/lset.cpp \ ../src/common/misc.cpp \ ../src/common/rect.cpp \ ../src/common/sound.cpp \ ../src/common/strutil.cpp \ ../src/common/surface.cpp \ ../src/comet/building.cpp \ ../src/comet/map.cpp \ ../src/comet/mission.cpp \ ../src/comet/unit.cpp mklocale_SOURCES = mklocale.cpp \ ../src/common/SDL_zlib.c \ ../src/common/lang.cpp \ ../src/common/fileio.cpp \ ../src/common/strutil.cpp mkunitset_SOURCES = mkunitset.cpp \ mksurface.cpp mksurface.h parser.cpp parser.h \ ../src/common/fileio.cpp \ ../src/common/lang.cpp \ ../src/common/lset.cpp \ ../src/common/rect.cpp \ ../src/common/sound.cpp \ ../src/common/strutil.cpp \ ../src/common/surface.cpp \ ../src/common/SDL_zlib.c mktileset_SOURCES = mktileset.cpp \ mksurface.cpp mksurface.h parser.cpp parser.h \ ../src/common/SDL_zlib.c \ ../src/common/fileio.cpp \ ../src/common/lang.cpp \ ../src/common/lset.cpp \ ../src/common/rect.cpp \ ../src/common/sound.cpp \ ../src/common/strutil.cpp \ ../src/common/surface.cpp mkdatafile_SOURCES = mkdatafile.cpp mksurface.cpp \ ../src/common/SDL_zlib.c \ ../src/common/fileio.cpp \ ../src/common/surface.cpp cf2bmp_SOURCES = cf2bmp.cpp \ ../src/common/SDL_zlib.c \ ../src/common/fileio.cpp \ ../src/common/lang.cpp \ ../src/common/list.cpp \ ../src/common/lset.cpp \ ../src/common/mapview.cpp \ ../src/common/misc.cpp \ ../src/common/rect.cpp \ ../src/common/sound.cpp \ ../src/common/strutil.cpp \ ../src/common/surface.cpp \ ../src/comet/building.cpp \ ../src/comet/map.cpp \ ../src/comet/mission.cpp \ ../src/comet/unit.cpp AM_CPPFLAGS = -DDISABLE_SOUND -I$(top_srcdir)/src/common -I$(top_srcdir)/src/comet pkgdata_DATA = cf.dat default.tiles default.units CLEANFILES = $(pkgdata_DATA) EXTRA_DIST = default.tsrc default.usrc gfxdir = $(top_srcdir)/gfx all: all-am .SUFFIXES: .SUFFIXES: .c .cpp .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ && exit 0; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign tools/Makefile'; \ cd $(top_srcdir) && \ $(AUTOMAKE) --foreign tools/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh install-binPROGRAMS: $(bin_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(bindir)" || $(MKDIR_P) "$(DESTDIR)$(bindir)" @list='$(bin_PROGRAMS)'; for p in $$list; do \ p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ if test -f $$p \ ; then \ f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(bindir)/$$f'"; \ $(INSTALL_PROGRAM_ENV) $(binPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(bindir)/$$f" || exit 1; \ else :; fi; \ done uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ echo " rm -f '$(DESTDIR)$(bindir)/$$f'"; \ rm -f "$(DESTDIR)$(bindir)/$$f"; \ done clean-binPROGRAMS: -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) clean-noinstPROGRAMS: -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) bi2cf$(EXEEXT): $(bi2cf_OBJECTS) $(bi2cf_DEPENDENCIES) @rm -f bi2cf$(EXEEXT) $(LINK) $(bi2cf_OBJECTS) $(bi2cf_LDADD) $(LIBS) cf2bmp$(EXEEXT): $(cf2bmp_OBJECTS) $(cf2bmp_DEPENDENCIES) @rm -f cf2bmp$(EXEEXT) $(CXXLINK) $(cf2bmp_OBJECTS) $(cf2bmp_LDADD) $(LIBS) cfed$(EXEEXT): $(cfed_OBJECTS) $(cfed_DEPENDENCIES) @rm -f cfed$(EXEEXT) $(CXXLINK) $(cfed_OBJECTS) $(cfed_LDADD) $(LIBS) mkdatafile$(EXEEXT): $(mkdatafile_OBJECTS) $(mkdatafile_DEPENDENCIES) @rm -f mkdatafile$(EXEEXT) $(CXXLINK) $(mkdatafile_OBJECTS) $(mkdatafile_LDADD) $(LIBS) mklocale$(EXEEXT): $(mklocale_OBJECTS) $(mklocale_DEPENDENCIES) @rm -f mklocale$(EXEEXT) $(CXXLINK) $(mklocale_OBJECTS) $(mklocale_LDADD) $(LIBS) mktileset$(EXEEXT): $(mktileset_OBJECTS) $(mktileset_DEPENDENCIES) @rm -f mktileset$(EXEEXT) $(CXXLINK) $(mktileset_OBJECTS) $(mktileset_LDADD) $(LIBS) mkunitset$(EXEEXT): $(mkunitset_OBJECTS) $(mkunitset_DEPENDENCIES) @rm -f mkunitset$(EXEEXT) $(CXXLINK) $(mkunitset_OBJECTS) $(mkunitset_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SDL_zlib.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bi2cf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bi_data.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bidd1_data.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/bidd2_data.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/building.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cf2bmp.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cfed.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/fileio.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hl_data.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lang.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/list.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mapview.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/misc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mission.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkdatafile.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mklocale.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mksurface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mktileset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mkunitset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/parser.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rect.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sound.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strutil.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/surface.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/unit.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` SDL_zlib.o: ../src/common/SDL_zlib.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT SDL_zlib.o -MD -MP -MF $(DEPDIR)/SDL_zlib.Tpo -c -o SDL_zlib.o `test -f '../src/common/SDL_zlib.c' || echo '$(srcdir)/'`../src/common/SDL_zlib.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/SDL_zlib.Tpo $(DEPDIR)/SDL_zlib.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/common/SDL_zlib.c' object='SDL_zlib.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o SDL_zlib.o `test -f '../src/common/SDL_zlib.c' || echo '$(srcdir)/'`../src/common/SDL_zlib.c SDL_zlib.obj: ../src/common/SDL_zlib.c @am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT SDL_zlib.obj -MD -MP -MF $(DEPDIR)/SDL_zlib.Tpo -c -o SDL_zlib.obj `if test -f '../src/common/SDL_zlib.c'; then $(CYGPATH_W) '../src/common/SDL_zlib.c'; else $(CYGPATH_W) '$(srcdir)/../src/common/SDL_zlib.c'; fi` @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/SDL_zlib.Tpo $(DEPDIR)/SDL_zlib.Po @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='../src/common/SDL_zlib.c' object='SDL_zlib.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o SDL_zlib.obj `if test -f '../src/common/SDL_zlib.c'; then $(CYGPATH_W) '../src/common/SDL_zlib.c'; else $(CYGPATH_W) '$(srcdir)/../src/common/SDL_zlib.c'; fi` .cpp.o: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< .cpp.obj: @am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` fileio.o: ../src/common/fileio.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fileio.o -MD -MP -MF $(DEPDIR)/fileio.Tpo -c -o fileio.o `test -f '../src/common/fileio.cpp' || echo '$(srcdir)/'`../src/common/fileio.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/fileio.Tpo $(DEPDIR)/fileio.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/fileio.cpp' object='fileio.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fileio.o `test -f '../src/common/fileio.cpp' || echo '$(srcdir)/'`../src/common/fileio.cpp fileio.obj: ../src/common/fileio.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT fileio.obj -MD -MP -MF $(DEPDIR)/fileio.Tpo -c -o fileio.obj `if test -f '../src/common/fileio.cpp'; then $(CYGPATH_W) '../src/common/fileio.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/fileio.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/fileio.Tpo $(DEPDIR)/fileio.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/fileio.cpp' object='fileio.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o fileio.obj `if test -f '../src/common/fileio.cpp'; then $(CYGPATH_W) '../src/common/fileio.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/fileio.cpp'; fi` lang.o: ../src/common/lang.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lang.o -MD -MP -MF $(DEPDIR)/lang.Tpo -c -o lang.o `test -f '../src/common/lang.cpp' || echo '$(srcdir)/'`../src/common/lang.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lang.Tpo $(DEPDIR)/lang.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/lang.cpp' object='lang.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lang.o `test -f '../src/common/lang.cpp' || echo '$(srcdir)/'`../src/common/lang.cpp lang.obj: ../src/common/lang.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lang.obj -MD -MP -MF $(DEPDIR)/lang.Tpo -c -o lang.obj `if test -f '../src/common/lang.cpp'; then $(CYGPATH_W) '../src/common/lang.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/lang.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lang.Tpo $(DEPDIR)/lang.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/lang.cpp' object='lang.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lang.obj `if test -f '../src/common/lang.cpp'; then $(CYGPATH_W) '../src/common/lang.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/lang.cpp'; fi` list.o: ../src/common/list.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.o -MD -MP -MF $(DEPDIR)/list.Tpo -c -o list.o `test -f '../src/common/list.cpp' || echo '$(srcdir)/'`../src/common/list.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/list.Tpo $(DEPDIR)/list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/list.cpp' object='list.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.o `test -f '../src/common/list.cpp' || echo '$(srcdir)/'`../src/common/list.cpp list.obj: ../src/common/list.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT list.obj -MD -MP -MF $(DEPDIR)/list.Tpo -c -o list.obj `if test -f '../src/common/list.cpp'; then $(CYGPATH_W) '../src/common/list.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/list.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/list.Tpo $(DEPDIR)/list.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/list.cpp' object='list.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o list.obj `if test -f '../src/common/list.cpp'; then $(CYGPATH_W) '../src/common/list.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/list.cpp'; fi` lset.o: ../src/common/lset.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lset.o -MD -MP -MF $(DEPDIR)/lset.Tpo -c -o lset.o `test -f '../src/common/lset.cpp' || echo '$(srcdir)/'`../src/common/lset.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lset.Tpo $(DEPDIR)/lset.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/lset.cpp' object='lset.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lset.o `test -f '../src/common/lset.cpp' || echo '$(srcdir)/'`../src/common/lset.cpp lset.obj: ../src/common/lset.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT lset.obj -MD -MP -MF $(DEPDIR)/lset.Tpo -c -o lset.obj `if test -f '../src/common/lset.cpp'; then $(CYGPATH_W) '../src/common/lset.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/lset.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/lset.Tpo $(DEPDIR)/lset.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/lset.cpp' object='lset.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o lset.obj `if test -f '../src/common/lset.cpp'; then $(CYGPATH_W) '../src/common/lset.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/lset.cpp'; fi` mapview.o: ../src/common/mapview.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mapview.o -MD -MP -MF $(DEPDIR)/mapview.Tpo -c -o mapview.o `test -f '../src/common/mapview.cpp' || echo '$(srcdir)/'`../src/common/mapview.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/mapview.Tpo $(DEPDIR)/mapview.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/mapview.cpp' object='mapview.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mapview.o `test -f '../src/common/mapview.cpp' || echo '$(srcdir)/'`../src/common/mapview.cpp mapview.obj: ../src/common/mapview.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mapview.obj -MD -MP -MF $(DEPDIR)/mapview.Tpo -c -o mapview.obj `if test -f '../src/common/mapview.cpp'; then $(CYGPATH_W) '../src/common/mapview.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/mapview.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/mapview.Tpo $(DEPDIR)/mapview.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/mapview.cpp' object='mapview.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mapview.obj `if test -f '../src/common/mapview.cpp'; then $(CYGPATH_W) '../src/common/mapview.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/mapview.cpp'; fi` misc.o: ../src/common/misc.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT misc.o -MD -MP -MF $(DEPDIR)/misc.Tpo -c -o misc.o `test -f '../src/common/misc.cpp' || echo '$(srcdir)/'`../src/common/misc.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/misc.Tpo $(DEPDIR)/misc.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/misc.cpp' object='misc.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o misc.o `test -f '../src/common/misc.cpp' || echo '$(srcdir)/'`../src/common/misc.cpp misc.obj: ../src/common/misc.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT misc.obj -MD -MP -MF $(DEPDIR)/misc.Tpo -c -o misc.obj `if test -f '../src/common/misc.cpp'; then $(CYGPATH_W) '../src/common/misc.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/misc.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/misc.Tpo $(DEPDIR)/misc.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/misc.cpp' object='misc.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o misc.obj `if test -f '../src/common/misc.cpp'; then $(CYGPATH_W) '../src/common/misc.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/misc.cpp'; fi` rect.o: ../src/common/rect.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT rect.o -MD -MP -MF $(DEPDIR)/rect.Tpo -c -o rect.o `test -f '../src/common/rect.cpp' || echo '$(srcdir)/'`../src/common/rect.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/rect.Tpo $(DEPDIR)/rect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/rect.cpp' object='rect.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o rect.o `test -f '../src/common/rect.cpp' || echo '$(srcdir)/'`../src/common/rect.cpp rect.obj: ../src/common/rect.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT rect.obj -MD -MP -MF $(DEPDIR)/rect.Tpo -c -o rect.obj `if test -f '../src/common/rect.cpp'; then $(CYGPATH_W) '../src/common/rect.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/rect.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/rect.Tpo $(DEPDIR)/rect.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/rect.cpp' object='rect.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o rect.obj `if test -f '../src/common/rect.cpp'; then $(CYGPATH_W) '../src/common/rect.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/rect.cpp'; fi` sound.o: ../src/common/sound.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sound.o -MD -MP -MF $(DEPDIR)/sound.Tpo -c -o sound.o `test -f '../src/common/sound.cpp' || echo '$(srcdir)/'`../src/common/sound.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/sound.Tpo $(DEPDIR)/sound.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/sound.cpp' object='sound.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sound.o `test -f '../src/common/sound.cpp' || echo '$(srcdir)/'`../src/common/sound.cpp sound.obj: ../src/common/sound.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT sound.obj -MD -MP -MF $(DEPDIR)/sound.Tpo -c -o sound.obj `if test -f '../src/common/sound.cpp'; then $(CYGPATH_W) '../src/common/sound.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/sound.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/sound.Tpo $(DEPDIR)/sound.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/sound.cpp' object='sound.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o sound.obj `if test -f '../src/common/sound.cpp'; then $(CYGPATH_W) '../src/common/sound.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/sound.cpp'; fi` strutil.o: ../src/common/strutil.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT strutil.o -MD -MP -MF $(DEPDIR)/strutil.Tpo -c -o strutil.o `test -f '../src/common/strutil.cpp' || echo '$(srcdir)/'`../src/common/strutil.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/strutil.Tpo $(DEPDIR)/strutil.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/strutil.cpp' object='strutil.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o strutil.o `test -f '../src/common/strutil.cpp' || echo '$(srcdir)/'`../src/common/strutil.cpp strutil.obj: ../src/common/strutil.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT strutil.obj -MD -MP -MF $(DEPDIR)/strutil.Tpo -c -o strutil.obj `if test -f '../src/common/strutil.cpp'; then $(CYGPATH_W) '../src/common/strutil.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/strutil.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/strutil.Tpo $(DEPDIR)/strutil.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/strutil.cpp' object='strutil.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o strutil.obj `if test -f '../src/common/strutil.cpp'; then $(CYGPATH_W) '../src/common/strutil.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/strutil.cpp'; fi` surface.o: ../src/common/surface.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface.o -MD -MP -MF $(DEPDIR)/surface.Tpo -c -o surface.o `test -f '../src/common/surface.cpp' || echo '$(srcdir)/'`../src/common/surface.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/surface.Tpo $(DEPDIR)/surface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/surface.cpp' object='surface.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface.o `test -f '../src/common/surface.cpp' || echo '$(srcdir)/'`../src/common/surface.cpp surface.obj: ../src/common/surface.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT surface.obj -MD -MP -MF $(DEPDIR)/surface.Tpo -c -o surface.obj `if test -f '../src/common/surface.cpp'; then $(CYGPATH_W) '../src/common/surface.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/surface.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/surface.Tpo $(DEPDIR)/surface.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/common/surface.cpp' object='surface.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o surface.obj `if test -f '../src/common/surface.cpp'; then $(CYGPATH_W) '../src/common/surface.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/common/surface.cpp'; fi` building.o: ../src/comet/building.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT building.o -MD -MP -MF $(DEPDIR)/building.Tpo -c -o building.o `test -f '../src/comet/building.cpp' || echo '$(srcdir)/'`../src/comet/building.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/building.Tpo $(DEPDIR)/building.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/comet/building.cpp' object='building.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o building.o `test -f '../src/comet/building.cpp' || echo '$(srcdir)/'`../src/comet/building.cpp building.obj: ../src/comet/building.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT building.obj -MD -MP -MF $(DEPDIR)/building.Tpo -c -o building.obj `if test -f '../src/comet/building.cpp'; then $(CYGPATH_W) '../src/comet/building.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/comet/building.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/building.Tpo $(DEPDIR)/building.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/comet/building.cpp' object='building.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o building.obj `if test -f '../src/comet/building.cpp'; then $(CYGPATH_W) '../src/comet/building.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/comet/building.cpp'; fi` map.o: ../src/comet/map.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT map.o -MD -MP -MF $(DEPDIR)/map.Tpo -c -o map.o `test -f '../src/comet/map.cpp' || echo '$(srcdir)/'`../src/comet/map.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/map.Tpo $(DEPDIR)/map.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/comet/map.cpp' object='map.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o map.o `test -f '../src/comet/map.cpp' || echo '$(srcdir)/'`../src/comet/map.cpp map.obj: ../src/comet/map.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT map.obj -MD -MP -MF $(DEPDIR)/map.Tpo -c -o map.obj `if test -f '../src/comet/map.cpp'; then $(CYGPATH_W) '../src/comet/map.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/comet/map.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/map.Tpo $(DEPDIR)/map.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/comet/map.cpp' object='map.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o map.obj `if test -f '../src/comet/map.cpp'; then $(CYGPATH_W) '../src/comet/map.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/comet/map.cpp'; fi` mission.o: ../src/comet/mission.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mission.o -MD -MP -MF $(DEPDIR)/mission.Tpo -c -o mission.o `test -f '../src/comet/mission.cpp' || echo '$(srcdir)/'`../src/comet/mission.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/mission.Tpo $(DEPDIR)/mission.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/comet/mission.cpp' object='mission.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mission.o `test -f '../src/comet/mission.cpp' || echo '$(srcdir)/'`../src/comet/mission.cpp mission.obj: ../src/comet/mission.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT mission.obj -MD -MP -MF $(DEPDIR)/mission.Tpo -c -o mission.obj `if test -f '../src/comet/mission.cpp'; then $(CYGPATH_W) '../src/comet/mission.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/comet/mission.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/mission.Tpo $(DEPDIR)/mission.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/comet/mission.cpp' object='mission.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o mission.obj `if test -f '../src/comet/mission.cpp'; then $(CYGPATH_W) '../src/comet/mission.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/comet/mission.cpp'; fi` unit.o: ../src/comet/unit.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT unit.o -MD -MP -MF $(DEPDIR)/unit.Tpo -c -o unit.o `test -f '../src/comet/unit.cpp' || echo '$(srcdir)/'`../src/comet/unit.cpp @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/unit.Tpo $(DEPDIR)/unit.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/comet/unit.cpp' object='unit.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o unit.o `test -f '../src/comet/unit.cpp' || echo '$(srcdir)/'`../src/comet/unit.cpp unit.obj: ../src/comet/unit.cpp @am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT unit.obj -MD -MP -MF $(DEPDIR)/unit.Tpo -c -o unit.obj `if test -f '../src/comet/unit.cpp'; then $(CYGPATH_W) '../src/comet/unit.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/comet/unit.cpp'; fi` @am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/unit.Tpo $(DEPDIR)/unit.Po @AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='../src/comet/unit.cpp' object='unit.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o unit.obj `if test -f '../src/comet/unit.cpp'; then $(CYGPATH_W) '../src/comet/unit.cpp'; else $(CYGPATH_W) '$(srcdir)/../src/comet/unit.cpp'; fi` install-pkgdataDATA: $(pkgdata_DATA) @$(NORMAL_INSTALL) test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" @list='$(pkgdata_DATA)'; for p in $$list; do \ if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ f=$(am__strip_dir) \ echo " $(pkgdataDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgdatadir)/$$f'"; \ $(pkgdataDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgdatadir)/$$f"; \ done uninstall-pkgdataDATA: @$(NORMAL_UNINSTALL) @list='$(pkgdata_DATA)'; for p in $$list; do \ f=$(am__strip_dir) \ echo " rm -f '$(DESTDIR)$(pkgdatadir)/$$f'"; \ rm -f "$(DESTDIR)$(pkgdatadir)/$$f"; \ done ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$tags $$unique; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) tags=; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) ' { files[$$0] = 1; } \ END { for (i in files) print i; }'`; \ test -z "$(CTAGS_ARGS)$$tags$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$tags $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && cd $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) $$here distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \ fi; \ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \ else \ test -f $(distdir)/$$file \ || cp -p $$d/$$file $(distdir)/$$file \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(DATA) installdirs: for dir in "$(DESTDIR)$(bindir)" "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-binPROGRAMS clean-generic clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am info: info-am info-am: install-data-am: install-pkgdataDATA install-dvi: install-dvi-am install-exec-am: install-binPROGRAMS install-html: install-html-am install-info: install-info-am install-man: install-pdf: install-pdf-am install-ps: install-ps-am installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-binPROGRAMS uninstall-pkgdataDATA .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-binPROGRAMS \ clean-generic clean-noinstPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-tags distdir dvi \ dvi-am html html-am info info-am install install-am \ install-binPROGRAMS install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-pkgdataDATA install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ mostlyclean mostlyclean-compile mostlyclean-generic pdf pdf-am \ ps ps-am tags uninstall uninstall-am uninstall-binPROGRAMS \ uninstall-pkgdataDATA cf.dat: mkdatafile $(cfdat_gfx) $(top_builddir)/tools/mkdatafile $(gfxdir)/CFIcons.bmp cf.dat default.tiles: mktileset default.tsrc $(gfxdir)/CFTiles.bmp $(top_builddir)/tools/mktileset $(top_srcdir)/tools/default.tsrc default.tiles $(gfxdir) default.units: mkunitset default.usrc $(gfxdir)/CFUnits.bmp $(top_builddir)/tools/mkunitset $(top_srcdir)/tools/default.usrc default.units $(gfxdir) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: crimson-0.5.2.orig/tools/bi2cf.c0000600000175000017500000007347310363231442014606 0ustar uweuwe/* bi2cf - A map converter for Crimson Fields copyright (c) 2002 by Florian Dietrich 2003-2006 by Jens Granseuer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ //----------------------------------------------------------------------------- // bi2cf.c: // this file contains the main program and some helper functions // // It's far from being perfect, some parts are a little ugly, there's hardly // any error or boundary checking etc. //----------------------------------------------------------------------------- #include #include #include #include "bi2cf.h" extern const tconvdata bi_convdata; extern const tconvdata bidd1_convdata; extern const tconvdata bidd2_convdata; extern const tconvdata hl_convdata; #ifdef WIN32 const char *pathdelimiter = "\\"; #else const char *pathdelimiter = "/"; #endif const char *mapstrings[5] = {"unknown","BI","BIDD1","BIDD2","HL"}; const char verstr[] = "0.4.9"; const char helpstr[] = "Usage: %s mapname [options]\n" "\n" "(mapname must be the map filename without extension, e.g. \"00\")\n" "\n" "Available options:\n" " -h Print this help message\n" " -p [1|2] Set number of players to 1 or 2\n" " -f [b|1|2|h] Force map type to BI / BI Data1 / BI Data2 / HL\n" " (this is always necessary for BI Data1 Maps!)\n" " -l Skip last row and column of the map. This is necessary for\n" " the maps of the PC versions of BI.\n" " -t [mapname] Map title for this map,\n" " default is -\n" " -i [mapinfo] Map info for this map\n" " -o [output file] Writes map to given output file,\n" " by default it becomes the same as mapname + .src\n" " -d [map dir] Directory the map files are in\n" " -O [output dir] Directory to write the output file to\n" " (will be ignored for now if you give an output filename)\n" " -q Don't print progess diagnostics\n" " -v Print version information\n" "\n" "Example: %s 01 -p 1 -f 1 -o map2.src -d MAP\n" "(means: process map 01 in directory \"MAP\", define as 1 player map,\n" "force map type BI Data1 and write the converted map to \"map2.src\")\n" "\n"; static int quiet = 0; // ----------------------------------------------------------------------------- // functions for map file reading // ----------------------------------------------------------------------------- int uncompress(unsigned char **buffer, int src_size) // decompress data in buffer { int i,j; int dst_size, src_count, dst_count; unsigned char *dstbuf = NULL; unsigned char *srcbuf = *buffer; unsigned short copy_num, repeat_num, repeat_offset, temp; // little/big endian "detection", not very reliable, but enough for now // (should work fine for file sizes up to 65535 bytes, all map files are smaller) if ( (srcbuf[4]+srcbuf[5]) > (srcbuf[6]+srcbuf[7]) ) dst_size = (srcbuf[4]) | (srcbuf[5] << 8) | (srcbuf[6] << 16) | (srcbuf[7] << 24); else dst_size = (srcbuf[7]) | (srcbuf[6] << 8) | (srcbuf[5] << 16) | (srcbuf[4] << 24); dstbuf = malloc(dst_size * sizeof(unsigned char)); src_count = 8; dst_count = 0; while( (src_count < src_size) && (dst_count < dst_size) ) { copy_num = srcbuf[src_count++]; for( i=0 ; i<=7 ; i++) { if( (dst_count >= dst_size) || (src_count >= src_size) ) break; copy_num *= 2; if (copy_num > 0xFF) { copy_num &= 0x00FF; temp = srcbuf[src_count++]; if(src_count >= src_size) break; repeat_num = (temp & 0x000F) + 2; repeat_offset = srcbuf[src_count++] | ( (temp << 4) & 0x0F00 ); for( j=0 ; j<=repeat_num ; j++) { dstbuf[dst_count] = dstbuf[dst_count-repeat_offset]; if(++dst_count >= dst_size) break; } } else dstbuf[dst_count++] = srcbuf[src_count++]; } } free(srcbuf); *buffer=dstbuf; return dst_size; } int readfin(FILE *finfile, tmapdata *mapdata) // Read from XX.FIN file (contains terrain and unit data): // 1st and 3rd byte are 0x00, 2nd is the map width, 4th map height. After that // comes one byte of terrain data, one byte of unit data then again one byte of // terrain data and so on, row by row. HL maps actually have an uneven width // and height, but there's always one more terrain & unit byte (0xAE 0xFF) // added at the end of each row, and at the end of the file there is a whole // row of these, so width & height become even. { int i; int maptype = MAP_NONE; int highest = 0; // get fin file size, allocate mem and read the whole file into the buffer fseek(finfile,0,SEEK_END); mapdata->finsize = ftell(finfile); if( (mapdata->rawfin = (unsigned char *) malloc( mapdata->finsize * sizeof(unsigned char) ) ) == NULL) return 0; fseek(finfile,0,SEEK_SET); fread(mapdata->rawfin,mapdata->finsize,1,finfile); // uncompressing the file if it's TPWM compressed if( (mapdata->rawfin[0]=='T') && (mapdata->rawfin[1]=='P') && (mapdata->rawfin[2]=='W') && (mapdata->rawfin[3]=='M') ) { if(!quiet) printf("FIN file is compressed, decompressing...\n"); mapdata->finsize = uncompress(&mapdata->rawfin,mapdata->finsize); } // make pointer to actual map data, get x and y size mapdata->map = (tfindata *)(mapdata->rawfin + 4); mapdata->mapx = mapdata->rawfin[1]; mapdata->mapy = mapdata->rawfin[3]; mapdata->mapsize = mapdata->mapx * mapdata->mapy; // Find out map type from highest terrain value used: // There's always a 0xAE terrain in HL maps, never anything higher than // 0x67 in BI and BIDD1 maps, and at least for the BIDD2 standard maps the // highest value is always in between those two. maptype = MAP_BIDD2; for ( i=0 ; imapsize ; i++ ) if( mapdata->map[i].terrain > highest ) highest = mapdata->map[i].terrain; if( highest >= 0xAE ) maptype = MAP_HL; if( highest <= 0x67 ) maptype = MAP_BI; return maptype; } int readshp(FILE *shpfile, tmapdata *mapdata, int maxunits) // Read from XX.SHP file (contains data about buildings, units in buildings and // units in transports): // First come as many bytes as there are different units in the game, if they // are 0x00, the according unit can be built in factories, if they are 0x01 it // can't be built. Then comes a byte with the number of records in this file. // Those records then follow, each being 12 bytes long and carrying information // about buildings and units inside buildings and transports. See bi2cf.h // (->tshpdata) for the record's exact format. { // get shp file size, allocate mem and read the whole file into the buffer fseek(shpfile,0,SEEK_END); mapdata->shpsize = ftell(shpfile); if( (mapdata->rawshp = (unsigned char *) malloc( mapdata->shpsize * sizeof(unsigned char) ) ) == NULL) return 0; fseek(shpfile,0,SEEK_SET); fread(mapdata->rawshp,mapdata->shpsize,1,shpfile); // uncompressing the file if it's TPWM compressed if( (mapdata->rawshp[0]=='T') && (mapdata->rawshp[1]=='P') && (mapdata->rawshp[2]=='W') && (mapdata->rawshp[3]=='M') ) { if(!quiet) printf("SHP file is compressed, decompressing...\n"); mapdata->shpsize = uncompress(&mapdata->rawshp,mapdata->shpsize); } // get number of building records, make pointers to building infos mapdata->numbuildings = mapdata->rawshp[maxunits]; mapdata->canbuild = mapdata->rawshp; mapdata->buildings = (tshpdata *)(mapdata->rawshp + maxunits + 1); return 1; } // ----------------------------------------------------------------------------- // helper functions // ----------------------------------------------------------------------------- void putunit(FILE *myfile, tconvdata convdata, int xpos, int ypos, unsigned char type, int player, int id) // puts a specified unit at the specified place { // if type is 0xFF, there's no unit at this place if ( type < 0xFF ) { fprintf(myfile,"[unit]\n"); fprintf(myfile,"type = %s\n",convdata.units[type]); fprintf(myfile,"player = %d\n",player); fprintf(myfile,"id = %d\n",id); fprintf(myfile,"pos = %d/%d\n",xpos,ypos); fprintf(myfile,"\n"); } } void putbuilding(FILE *myfile, tconvdata convdata, tmapdata mapdata, int xpos, int ypos, unsigned char type, int crystals, int id) // puts a specified building at the specified place { int i; int mining = 0; // another fix for HL: crystals are actually mining. // move AND attack turns count for mining, so it is doubled. if( convdata.type == MAP_HL ) { mining = crystals*2; crystals = 0; } fprintf(myfile,"[building]\n"); // write name of building if( (type+1)/3 == 0 ) fprintf(myfile,"name = 5\n"); /* HQ */ else if( (type+1)/3 == 1 ) fprintf(myfile,"name = 6\n"); /* Factory */ else fprintf(myfile,"name = 7\n"); /* Depot */ // all buildings are workshops (can repair units) fprintf(myfile,"type = workshop\n"); // make factories factories and set units you can build in them if( (type+1)/3 == 1 ) { fprintf(myfile,"type = factory\n"); for( i=0 ; i 0) ) fprintf(myfile,"factory = %s\n",convdata.units[i]); } } // all the other properties if( mining > 0 ) { fprintf(myfile,"mining = %d\n",mining); } fprintf(myfile,"crystals = %d\n",crystals); fprintf(myfile,"player = %i\n",(type+1)%3); fprintf(myfile,"id = %d\n",id); fprintf(myfile,"pos = %d/%d\n",xpos,ypos); fprintf(myfile,"\n"); } unsigned char getcrystals(tmapdata mapdata, unsigned char type, unsigned char index) // gets the crystal amounts from shp data for specified building { int i; for ( i=0 ; i 0 ) { fprintf(myfile,"mapwidth = %d\n",mapdata.mapx-1); fprintf(myfile,"mapheight = %d\n",mapdata.mapy-1); } else { fprintf(myfile,"mapwidth = %d\n",mapdata.mapx); fprintf(myfile,"mapheight = %d\n",mapdata.mapy); } fprintf(myfile,"\n"); // briefing for both players fprintf(myfile,"[player]\n"); fprintf(myfile,"name = 3\n"); fprintf(myfile,"briefing = 0\n"); fprintf(myfile,"\n"); fprintf(myfile,"[player]\n"); fprintf(myfile,"name = 4\n"); fprintf(myfile,"briefing = 0\n"); fprintf(myfile,"\n"); // messages (briefing and info); fprintf(myfile,"[messages(en)]\n"); fprintf(myfile,"Destroy all enemy units or capture enemy headquarters!\n"); fprintf(myfile,"%%\n"); fprintf(myfile,"%s\n",mapinfo.title); fprintf(myfile,"%s\n",mapinfo.info); fprintf(myfile,"This map was automatically created by bi2cf %s.\n",verstr); fprintf(myfile,"%%\n"); fprintf(myfile,"%s\n",mapinfo.title); fprintf(myfile,"%%\n"); fprintf(myfile,"Player 1\n"); fprintf(myfile,"%%\n"); fprintf(myfile,"Player 2\n"); fprintf(myfile,"%%\n"); fprintf(myfile,"Headquarters\n"); fprintf(myfile,"%%\n"); fprintf(myfile,"Factory\n"); fprintf(myfile,"%%\n"); fprintf(myfile,"Depot\n"); fprintf(myfile,"[/messages]\n"); fprintf(myfile,"\n"); } void write_rawmap(FILE *myfile, tconvdata convdata, tmapdata mapdata, int skip) // writes the translated map in raw format to src file { int x,y; // little fixes for HL, don't write last tile & last row int maxx = mapdata.mapx, maxy = mapdata.mapy; if( skip > 0 ) { maxx--; maxy--; } // read the terrain row by row and write converted map data to file fprintf(myfile,"[map-raw]\n"); for( y=0; y 0) ) { putunit(myfile, convdata, x, y, mapdata.map[y*mapdata.mapx+x].unit/2, (mapdata.map[y*mapdata.mapx+x].unit%2)+1, (*unit_id)++); if ( convdata.transport[ mapdata.map[y*mapdata.mapx+x].unit/2 ] > 0 ) getsubunits( myfile, convdata, mapdata, x, y, 3, (mapdata.map[y*mapdata.mapx+x].unit%2)+1, trans_index++,unit_id); } } } } void write_events(FILE *myfile, int hqid[]) // writes all the events to file { int i, id = 0; for( i=1; i<=2; i++) { // player i gets enemy hq fprintf(myfile,"[event]\n"); fprintf(myfile,"id = %d\n", id++); fprintf(myfile,"type = score\n"); fprintf(myfile,"player = %d\n", i); fprintf(myfile,"trigger = havebuilding\n"); fprintf(myfile,"tbuilding = %d\n",hqid[2-i]); fprintf(myfile,"towner = %d\n", i); fprintf(myfile,"ttime = -1\n"); fprintf(myfile,"success = 100\n\n"); // player i destroys all enemy units fprintf(myfile,"[event]\n"); fprintf(myfile,"id = %d\n", id++); fprintf(myfile,"type = score\n"); fprintf(myfile,"player = %d\n", i); fprintf(myfile,"trigger = unitdestroyed\n"); fprintf(myfile,"tunit = -1\n"); fprintf(myfile,"success = 100\n\n"); // show briefing at the beginning fprintf(myfile,"[event]\n"); fprintf(myfile,"id = %d\n", id++); fprintf(myfile,"type = message\n"); fprintf(myfile,"player = %d\n", i); fprintf(myfile,"trigger = timer\n"); fprintf(myfile,"ttime = 0\n"); fprintf(myfile,"message = 0\n\n"); } } // ----------------------------------------------------------------------------- // cleanung up // ----------------------------------------------------------------------------- void cleanup(tmapfiles mapfiles, tmapinfo mapinfo, tmapdata mapdata) // clean up allocated memory; NULL comparison not necessarily needed { if( mapdata.rawfin != NULL ) free( mapdata.rawfin ); if( mapdata.rawshp != NULL ) free( mapdata.rawshp ); if( mapinfo.number != NULL ) free( mapinfo.number ); if( mapinfo.title != NULL ) free( mapinfo.title ); if( mapinfo.info != NULL ) free( mapinfo.info ); if( mapinfo.tileset != NULL ) free( mapinfo.tileset ); if( mapinfo.unitset != NULL ) free( mapinfo.unitset ); if( mapfiles.shpfilename != NULL ) free( mapfiles.shpfilename ); if( mapfiles.srcfilename != NULL ) free( mapfiles.srcfilename ); if( mapfiles.finfilename != NULL ) free( mapfiles.finfilename ); if( mapfiles.inputdir != NULL ) free( mapfiles.inputdir ); if( mapfiles.outputdir != NULL ) free( mapfiles.outputdir ); } // ----------------------------------------------------------------------------- // main // ----------------------------------------------------------------------------- int main(int argc, char *argv[]) { // ------------------------------------------------------------------------- // variables // ------------------------------------------------------------------------- int i; int quiet = 0; int maptype = MAP_NONE; int forcedmaptype = MAP_NONE; tmapfiles mapfiles = { NULL,NULL,NULL,NULL,NULL }; tmapinfo mapinfo = { 1,NULL,NULL,NULL,NULL,NULL }; tmapdata mapdata = { NULL,NULL,0,0,0,0,NULL,NULL,NULL,0,0 }; tconvdata convdata; FILE *finfile; FILE *shpfile; FILE *srcfile; int unit_id = 0; int hqid[2]; int skiplast = 0; // ------------------------------------------------------------------------- // print standard option stuff // ------------------------------------------------------------------------- if ( argc<=1 ) { printf(helpstr,argv[0],argv[0]); return 1; } // ------------------------------------------------------------------------- // parse command line arguments, not quite perfect yet // ------------------------------------------------------------------------- for (i=1; i.lev .bmp The unit and tile sets must be present in the working directory. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include using namespace std; #include #include #ifdef HAVE_UNISTD_H # include #endif #include "SDL.h" #include "mission.h" #include "mapview.h" #include "globals.h" #ifdef _MSC_VER // SDL_Main linkage destroys the command line in VS8 #undef main #endif int main( int argc, char *argv[] ) { string outmap, level; if ( argc != 3 ) { cout << "Usage: " << argv[0] << " .lev .bmp" << endl << " --help display this help and exit" << endl; return 1; } else { level = argv[1]; outmap = argv[2]; } if ( SDL_Init(SDL_INIT_VIDEO) < 0 ) { cerr << "Error: Could not init SDL. " << SDL_GetError() << endl; return 1; } atexit(SDL_Quit); Mission m; if ( m.Load( level.c_str() ) ) { cerr << "Error: Could not load level " << level << endl; return 1; } // create full-size bmp image Surface ms; Map &map = m.GetMap(); const TerrainSet &tset = m.GetTerrainSet(); Rect size( 0, 0, map.Width() * (tset.TileWidth() - tset.TileShiftX()) + tset.TileShiftX(), map.Height() * tset.TileHeight() + tset.TileShiftY() ); if ( ms.Create( size.w, size.h, DISPLAY_BPP, 0 ) ) { cerr << "Error: Could not create surface" << endl; return 1; } MapView mv( &ms, size, MV_DISABLE_FOG|MV_DISABLE_CURSOR ); mv.SetMap( &map ); mv.Enable(); mv.Draw(); if ( SDL_SaveBMP( ms.s_surface, outmap.c_str() ) ) { cerr << "Error: Could not save to " << outmap << endl; return 1; } return 0; } crimson-0.5.2.orig/tools/cfed.cpp0000600000175000017500000020653010554366451015065 0ustar uweuwe/* cfed -- a level editor for Crimson Fields Copyright (C) 2000-2007 Jens Granseuer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* cfed.cpp */ #include #include #include "SDL.h" #include "parser.h" #include "mission.h" #include "gamedefs.h" #include "strutil.h" #include "globals.h" #ifdef _MSC_VER // SDL_Main linkage destroys the command line in VS8 #undef main #endif #define MAX_MAP_WIDTH 180 #define MAX_MAP_HEIGHT 180 class CfedParserUtils { protected: CfedParserUtils( Mission &m ) : m(m) {} Point ParseCoords( const string &s ) const; const UnitType *ParseUnitName( const string &name ) const; int ParsePlayerId( const string &s ) const; Mission &m; }; class MissionHandler : public KeyValueSectionHandler { public: MissionHandler( Mission &m, string &tileset, string &unitset, Point &mapsize ); int ParseSection( ifstream &in, const string *opt, unsigned long &line ); private: Mission &m; string &tiles; string &units; Point &mapsize; }; class PlayerHandler : public KeyValueSectionHandler { public: PlayerHandler( Mission &m ) : m(m) {} int ParseSection( ifstream &in, const string *opt, unsigned long &line ); private: int ParseColor( const string &s, Color &col ) const; Mission &m; static int parsed; }; class UnitHandler : public KeyValueSectionHandler, public CfedParserUtils { public: UnitHandler( Mission &m ) : CfedParserUtils(m) {} int ParseSection( ifstream &in, const string *opt, unsigned long &line ); }; class ShopHandler : public KeyValueSectionHandler, public CfedParserUtils { public: ShopHandler( Mission &m ) : CfedParserUtils(m) {} int ParseSection( ifstream &in, const string *opt, unsigned long &line ); }; class EventHandler : public KeyValueSectionHandler, public CfedParserUtils { public: EventHandler( Mission &m ) : CfedParserUtils(m) {} int ParseSection( ifstream &in, const string *opt, unsigned long &line ); }; class MessagesHandler : public SectionHandler { public: MessagesHandler( Mission &m ) : m(m) {} int ParseSection( ifstream &in, const string *opt, unsigned long &line ); private: Mission &m; }; class MapHandler : public SectionHandler { public: MapHandler( Mission &m, const Point &size ) : m(m), size(size) {} int ParseSection( ifstream &in, const string *opt, unsigned long &line ); private: Mission &m; const Point &size; }; class MapRawHandler : public SectionHandler { public: MapRawHandler( Mission &m, const Point &size ) : m(m), size(size) {} int ParseSection( ifstream &in, const string *opt, unsigned long &line ); private: Mission &m; const Point &size; }; // parser helpers // parse positional information of the form "x/y" Point CfedParserUtils::ParseCoords( const string &s ) const { string val; Point pos; size_t sep = s.find( '/' ); if ( sep == string::npos ) return Point(-1,-1); val = s.substr( 0, sep ); CFParser::RemWhitespace( val ); if ( val.size() == 0 ) return Point(-1,-1); pos.x = CFParser::StrToNum( val ); val = s.substr( sep + 1 ); CFParser::RemWhitespace( val ); if ( val.size() == 0 ) return Point(-1,-1); pos.y = CFParser::StrToNum( val ); if ( (pos.x < 0) || (pos.y < 0) ) return Point(-1,-1); return pos; } // get the unit description from a unit name const UnitType *CfedParserUtils::ParseUnitName( const string &name ) const { const UnitType *ut = NULL; const UnitSet &us = m.GetUnitSet(); for ( int i = 0; i < us.NumTiles(); ++i ) { if ( name == us.UnitName(i) ) { ut = us.GetUnitInfo(i); break; } } return ut; } // turn the number given into a player id int CfedParserUtils::ParsePlayerId( const string &s ) const { int rc = -1; // this is different from internal use in the game! here 0 means no owner! int id = CFParser::StrToNum(s); if ( id == 1 ) rc = PLAYER_ONE; else if ( id == 2 ) rc = PLAYER_TWO; else if ( id == 0 ) rc = PLAYER_NONE; return rc; } // mission parser MissionHandler::MissionHandler( Mission &m, string &tileset, string &unitset, Point &mapsize ) : m(m), tiles(tileset), units(unitset), mapsize(mapsize) { tiles = "default"; units = "default"; mapsize = Point(-1, -1); } int MissionHandler::ParseSection( ifstream &in, const string *opt, unsigned long &line ) { int rc = KeyValueSectionHandler::ParseSection( in, opt, line ); if ( rc == 0 ) { for ( vector >::iterator it = pairs.begin(); it != pairs.end(); ++it ) { string key = (*it).first; string val = (*it).second; if ( key == "mapwidth" ) mapsize.x = StrToNum(val); // map width else if ( key == "mapheight" ) mapsize.y = StrToNum(val); // map height else if ( key == "name" ) m.SetName(StrToNum(val)); // map name else if ( key == "info" ) m.SetLevelInfoMsg(StrToNum(val)); // level info else if ( key == "campaignname" ) m.SetCampaignName(StrToNum(val)); // campaign name else if ( key == "campaigninfo" ) m.SetCampaignInfo(StrToNum(val)); // campaign info else if ( key == "players" ) m.SetNumPlayers(StrToNum(val)); // 1 or 2 player map else if ( key == "unitset" ) units = val; // unit set to use else if ( key == "tileset" ) tiles = val; // tile set to use else if ( key == "nextmap" ) m.SetSequel(val.c_str()); // next map else if ( key == "music" ) m.SetMusic(val.c_str()); // soundtrack else if ( key == "campaign" ) m.SetCampaign(StrToNum(val) != 0); // campaign map else if ( key == "skirmish" ) m.SetSkirmish(StrToNum(val) != 0); // suitable for skirmishes else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "'" << endl; break; } } } return rc; } // player parser int PlayerHandler::parsed = 0; int PlayerHandler::ParseSection( ifstream &in, const string *opt, unsigned long &line ) { if ( parsed > 1 ) { cerr << "Error in line " << line << ": more than two [player] sections defined" << endl; return 1; } int rc = KeyValueSectionHandler::ParseSection( in, opt, line ); if ( rc == 0 ) { Player &p = m.GetPlayer( parsed ); for ( vector >::iterator it = pairs.begin(); it != pairs.end(); ++it ) { string key = (*it).first; string val = (*it).second; if ( key == "name" ) p.SetNameID(StrToNum(val)); else if ( key == "briefing" ) p.SetBriefing(StrToNum(val)); else if ( (key == "fcolor") || (key == "bcolor") ) { Color col; if ( !ParseColor(val, col) ) { if ( key[0] == 'f' ) p.SetLightColor(col); else p.SetDarkColor(col); } else { rc = 1; cerr << "Error near line " << line << ": Could not parse color '" << val << "'" << endl; } } else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "' in this context" << endl; } } } ++parsed; return rc; } // parse a color defined as "rr,gg,bb" int PlayerHandler::ParseColor( const string &s, Color &col ) const { size_t pos1, pos2; short comp; string val; pos1 = s.find( ',' ); pos2 = s.rfind( ',' ); if ( pos1 == pos2 ) return -1; val = s.substr( 0, pos1 ); RemWhitespace( val ); if ( val.size() == 0 ) return -1; comp = StrToNum( val ); if ( (comp < 0) || (comp > 255) ) return -1; col.r = comp; val = s.substr( pos1 + 1, pos2 - pos1 - 1 ); RemWhitespace( val ); if ( val.size() == 0 ) return -1; comp = StrToNum( val ); if ( (comp < 0) || (comp > 255) ) return -1; col.g = comp; val = s.substr( pos2 + 1 ); RemWhitespace( val ); if ( val.size() == 0 ) return -1; comp = StrToNum( val ); if ( (comp < 0) || (comp > 255) ) return -1; col.b = comp; return 0; } // unit parser int UnitHandler::ParseSection( ifstream &in, const string *opt, unsigned long &line ) { int rc = KeyValueSectionHandler::ParseSection( in, opt, line ); if ( rc == 0 ) { Unit *u = new Unit(); u->SetPosition( Point(-1,-1) ); u->SetID( 0 ); u->UnsetFlags( ~0 ); u->SetOwner( PLAYER_NONE ); u->SetType( m.GetUnitSet().GetUnitInfo(0) ); u->SetCrystals( 0 ); u->SetDirection( 99 ); u->SetGroupSize( MAX_GROUP_SIZE ); u->SetXP( 0 ); for ( vector >::iterator it = pairs.begin(); (it != pairs.end()) && (rc == 0); ++it ) { string key = (*it).first; string val = (*it).second; if ( key == "pos" ) u->SetPosition(ParseCoords(val)); // unit position else if ( key == "id" ) u->SetID(StrToNum(val)); // unit id else if ( key == "crystals" ) u->SetCrystals(StrToNum(val)); // crystals else if ( key == "face" ) u->SetDirection(StrToNum(val)); // direction else if ( key == "size" ) u->SetGroupSize(StrToNum(val)); // group size else if ( key == "xp" ) u->SetXP(StrToNum(val) * XP_PER_LEVEL); // experience else if ( key == "type" ) { // unit type const UnitType *type = ParseUnitName( val ); if ( type ) { u->SetType( type ); u->SetFlags( u->Flags() | type->Flags() ); } else { rc = 1; cerr << "Error: Unknown unit type '" << val << "' near line " << line << endl; } } else if ( key == "player" ) { // owning player int id = ParsePlayerId( val ); if ( id != -1 ) u->SetOwner( id ); else { rc = 1; cerr << "Error near line " << line << ": Invalid owner of unit" << endl; } } else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "' in this context" << endl; } } if ( rc == 0 ) m.GetUnits().AddTail( u ); else delete u; } return rc; } // shop parser int ShopHandler::ParseSection( ifstream &in, const string *opt, unsigned long &line ) { int rc = KeyValueSectionHandler::ParseSection( in, opt, line ); if ( rc == 0 ) { Building *b = new Building(); b->SetPosition( Point(0,0) ); b->SetID( 0 ); b->SetOwner( PLAYER_NONE ); b->SetCrystalProduction( 0 ); b->SetCrystals( 0 ); b->SetMaxCrystals( 1000 ); b->SetUnitProduction( 0 ); b->UnsetFlags( ~0 ); b->SetMinWeight( 0 ); b->SetMaxWeight( 99 ); b->SetNameID( -1 ); for ( vector >::iterator it = pairs.begin(); (it != pairs.end()) && (rc == 0); ++it ) { string key = (*it).first; string val = (*it).second; if ( key == "pos" ) b->SetPosition(ParseCoords(val)); // shop position else if ( key == "id" ) b->SetID(StrToNum(val)); // ID else if ( key == "name" ) b->SetNameID(StrToNum(val)); // name else if ( key == "mining" ) b->SetCrystalProduction(StrToNum(val)); // mining else if ( key == "crystals" ) b->SetCrystals(StrToNum(val)); // resources else if ( key == "capacity" ) b->SetMaxCrystals(StrToNum(val)); // max. resources else if ( key == "minweight" ) b->SetMinWeight(StrToNum(val)); // smallest unit allowed else if ( key == "maxweight" ) b->SetMaxWeight(StrToNum(val)); // biggest unit allowed else if ( key == "player" ) { // owning player int id = ParsePlayerId( val ); if ( id != -1 ) b->SetOwner( id ); else { rc = 1; cerr << "Error near line " << line << ": Invalid owner of building" << endl; } } else if ( key == "type" ) { // type if ( val == "workshop" ) b->SetFlags(BLD_WORKSHOP); else if ( val == "factory" ) b->SetFlags(BLD_FACTORY); else { rc = 1; cerr << "Error in line " << line << ": Unknown type '" << val << "'" << endl; } } else if ( key == "factory" ) { // can produce which units const UnitType *type = ParseUnitName( val ); if ( type ) { b->SetFlags(BLD_FACTORY); b->SetUnitProduction(b->UnitProduction()|(1<ID())); } else { rc = 1; cerr << "Error: Unknown unit type '" << val << "' near line " << line << endl; } } else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "' in this context" << endl; } } if ( rc == 0 ) m.GetBuildings().AddTail( b ); else delete b; } return rc; } // event parser int EventHandler::ParseSection( ifstream &in, const string *opt, unsigned long &line ) { int rc = KeyValueSectionHandler::ParseSection( in, opt, line ); if ( rc == 0 ) { Event *e = new Event(); e->SetID( 0 ); e->SetType( 99 ); e->SetPlayer( PLAYER_NONE ); e->SetTrigger( 99 ); e->SetDependency( -1 ); e->SetDiscard( -1 ); for ( int i = 0; i < 3; ++i ) { e->SetData( i, -9999 ); e->SetTData( i, -9999 ); } e->SetTitle( -1 ); e->SetMessage( -1 ); e->SetFlags( 0 ); e->SetTmpBuf( "" ); for ( vector >::iterator it = pairs.begin(); (it != pairs.end()) && (rc == 0); ++it ) { string key = (*it).first; string val = (*it).second; Point loc; int id; if ( key == "type" ) { // type if ( val == "message" ) e->SetType(EVENT_MESSAGE); else if ( val == "research" ) e->SetType(EVENT_RESEARCH); else if ( val == "mining" ) e->SetType(EVENT_MINING); else if ( val == "score" ) e->SetType(EVENT_SCORE); else if ( val == "configure" ) e->SetType(EVENT_CONFIGURE); else if ( val == "manipulateevent" ) e->SetType(EVENT_MANIPULATE_EVENT); else if ( val == "sethex" ) e->SetType(EVENT_SET_HEX); else if ( val == "settimer" ) e->SetType(EVENT_SET_TIMER); else if ( val == "destroyunit" ) e->SetType(EVENT_DESTROY_UNIT); else if ( val == "createunit" ) { e->SetType(EVENT_CREATE_UNIT); e->SetData(2, NORTH | (MAX_GROUP_SIZE << 3) | (0 << 6)); // dir, group size, xp defaults } else { rc = 1; cerr << "Error near line " << line << ": Unknown event type '" << val << "'" << endl; } } else if ( key == "trigger" ) { // trigger if ( val == "timer" ) e->SetTrigger(ETRIGGER_TIMER); else if ( val == "unitdestroyed" ) e->SetTrigger(ETRIGGER_UNIT_DESTROYED); else if ( val == "unitposition" ) e->SetTrigger(ETRIGGER_UNIT_POSITION); else if ( val == "handicap" ) e->SetTrigger(ETRIGGER_HANDICAP); else if ( val == "havecrystals" ) e->SetTrigger(ETRIGGER_HAVE_CRYSTALS); else if ( val == "havebuilding" ) { e->SetTrigger(ETRIGGER_HAVE_BUILDING); e->SetTData(2, -1); } else if ( val == "haveunit" ) { e->SetTrigger(ETRIGGER_HAVE_UNIT); e->SetTData(2, -1); } else { rc = 1; cerr << "Error near line " << line << ": Unknown trigger type '" << val << "'" << endl; } } else if ( key == "player" ) { // player id = ParsePlayerId( val ); if ( (id != -1) && (id != PLAYER_NONE) ) e->SetPlayer( id ); else { rc = 1; cerr << "Error near line " << line << ": Invalid player" << endl; } } else if ( key == "title" ) e->SetTitle(StrToNum(val)); else if ( key == "message" ) e->SetMessage(StrToNum(val)); else if ( key == "id" ) e->SetID(StrToNum(val)); else if ( key == "flags" ) e->SetFlags(StrToNum(val)); else if ( key == "depend" ) e->SetDependency(StrToNum(val)); else if ( key == "discard" ) e->SetDiscard(StrToNum(val)); else { if ( (e->Trigger() == ETRIGGER_TIMER) && (key == "ttime") ) e->SetTData(0, StrToNum(val)); // timer else if ( (e->Trigger() == ETRIGGER_HAVE_UNIT) && (key == "tunit") ) e->SetTData(0, StrToNum(val)); // unit else if ( (e->Trigger() == ETRIGGER_HAVE_BUILDING) && (key == "tbuilding") ) e->SetTData(0, StrToNum(val)); // building id else if ( (e->Trigger() == ETRIGGER_HAVE_CRYSTALS) && (key == "tbuilding") ) e->SetTData(2, StrToNum(val)); // building id else if ( (e->Trigger() == ETRIGGER_HAVE_CRYSTALS) && (key == "tcrystals") ) e->SetTData(0, StrToNum(val)); // number of crystals else if ( ((e->Trigger() == ETRIGGER_HAVE_BUILDING) || (e->Trigger() == ETRIGGER_HAVE_UNIT) || (e->Trigger() == ETRIGGER_UNIT_DESTROYED) || (e->Trigger() == ETRIGGER_HAVE_CRYSTALS)) && (key == "towner") ) e->SetTData(1, StrToNum(val)-1); // owner of shop/unit else if ( (e->Trigger() == ETRIGGER_UNIT_POSITION) && (key == "towner") ) e->SetTData(2, StrToNum(val)-1); // owner of unit else if ( ((e->Trigger() == ETRIGGER_HAVE_BUILDING) || (e->Trigger() == ETRIGGER_HAVE_UNIT)) && (key == "ttime") ) e->SetTData(2, StrToNum(val)); // time after which to check else if ( (e->Trigger() == ETRIGGER_UNIT_POSITION) && (key == "tpos") ) { loc = ParseCoords(val); if ( (loc.x < 0) || (loc.y < 0) ) { rc = 1; cerr << "Error near line " << line << ": Invalid position " << val << endl; } else e->SetTData(1, m.GetMap().Hex2Index(loc)); // unit position } else if ( ((e->Trigger() == ETRIGGER_UNIT_POSITION) || (e->Trigger() == ETRIGGER_UNIT_DESTROYED)) && (key == "tunit") ) { // unit or unit type if ( val.size() > 0 && (val[0] == '-' || isdigit(val[0])) ) { // seems to be a number -> specific unit or -1 e->SetTData(0, StrToNum(val)); } else { const UnitType *type = ParseUnitName( val ); if ( type ) e->SetTData(0, -type->ID() - 2); else { rc = 1; cerr << "Error near line " << line << ": Invalid unit type " << val << endl; } } } else if ( (e->Trigger() == ETRIGGER_HANDICAP) && (key == "thandicap") ) e->SetTData(0, StrToNum(val)); // handicap else switch ( e->Type() ) { case EVENT_CREATE_UNIT: // e_data[2] is split: 0000000 111 111 111 // xp size dir if ( key == "face" ) // direction to face e->SetData(2, (e->GetData(2) & ~0x0007) | (StrToNum(val) & 0x0007)); else if ( key == "size" ) // group size e->SetData(2, (e->GetData(2) & ~0x0038) | ((StrToNum(val) << 3) & 0x0038)); else if ( key == "xp" ) // experience e->SetData(2, (e->GetData(2) & ~0x01C0) | ((StrToNum(val) << 6) & 0x01C0)); else if ( key == "pos" ) { // where to create loc = ParseCoords(val); if ( (loc.x < 0) || (loc.y < 0) ) { rc = 1; cerr << "Error near line " << line << ": Invalid position " << val << endl; } else e->SetData(1, m.GetMap().Hex2Index(loc)); } else if ( key == "unit" ) { // unit type const UnitType *type = ParseUnitName( val ); if ( type ) e->SetData(0, type->ID()); else { rc = 1; cerr << "Error: Unknown unit type '" << val << "' near line " << line << endl; } } else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "'" << endl; } break; case EVENT_DESTROY_UNIT: if ( key == "unit" ) e->SetData(0, StrToNum(val)); // id of unit to destroy else if ( key == "owner" ) e->SetData(1, StrToNum(val)-1); // unit owner else if ( key == "pos" ) { // unit position loc = ParseCoords(val); if ( (loc.x < 0) || (loc.y < 0) ) { rc = 1; cerr << "Error near line " << line << ": Invalid position " << val << endl; } else e->SetData(2, m.GetMap().Hex2Index(loc)); } break; case EVENT_MANIPULATE_EVENT: if ( key == "event" ) e->SetData(0, StrToNum(val)); // ID of target event else if ( key == "eflags" ) e->SetData(1, StrToNum(val)); // flags to modify else if ( key == "action" ) e->SetData(2, StrToNum(val)); // set/clear/toggle else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "'" << endl; } break; case EVENT_MESSAGE: if ( key == "pos" ) { // hex to focus on loc = ParseCoords(val); if ( (loc.x < 0) || (loc.y < 0) ) { rc = 1; cerr << "Error near line " << line << ": Invalid position " << val << endl; } else e->SetData(0, m.GetMap().Hex2Index(loc)); } else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "'" << endl; } break; case EVENT_MINING: if ( key == "building" ) e->SetData(0, StrToNum(val)); // id of building else if ( key == "crystals" ) e->SetData(1, StrToNum(val)); // crystal production else if ( key == "action" ) e->SetData(2, StrToNum(val)); // modification action else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "'" << endl; } break; case EVENT_CONFIGURE: if ( key == "setting" ) { // setting to change if ( val == "briefing1" ) e->SetData(0, 0); else if ( val == "briefing2" ) e->SetData(0, 1); else if ( val == "nextmap" ) e->SetData(0, 2); } else if ( key == "value" ) { // value to set switch (e->GetData(0)) { case 0: case 1: e->SetData(1, StrToNum(val)); break; case 2: e->SetTmpBuf(val); break; default: rc = 1; cerr << "Error near line " << line << ": Configure event does not support value before setting" << endl; } } else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "'" << endl; } break; case EVENT_RESEARCH: if ( key == "building" ) e->SetData(0, StrToNum(val)); // id of building else if ( key == "action" ) e->SetData(2, StrToNum(val)); // whether to allow or disallow this unit else if ( key == "unit" ) { // unit type const UnitType *type = ParseUnitName( val ); if ( type ) e->SetData(1, type->ID()); else { rc = 1; cerr << "Error: Unknown unit type '" << val << "' near line " << line << endl; } } else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "'" << endl; } break; case EVENT_SCORE: if ( key == "success" ) e->SetData(0, StrToNum(val)); // success rate increase else if ( key == "othermsg" ) e->SetData(1, StrToNum(val)); // message for other player else if ( key == "othertitle" ) e->SetData(2, StrToNum(val)); // message title for other player else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "'" << endl; } break; case EVENT_SET_HEX: if ( key == "pos" ) { // hex to change loc = ParseCoords(val); if ( (loc.x < 0) || (loc.y < 0) ) { rc = 1; cerr << "Error near line " << line << ": Invalid position " << val << endl; } else e->SetData(1, m.GetMap().Hex2Index(loc)); } else if ( key == "tile" ) { // new terrain type id = StrToNum(val); if ( (id < m.GetTerrainSet().NumTiles()) && (id >= 0) ) e->SetData(0, id); else { rc = 0; cerr << "Error: Invalid tile '" << val << "' near line " << line << endl; } } else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "'" << endl; } break; case EVENT_SET_TIMER: if ( key == "event" ) e->SetData(0, StrToNum(val)); // ID of target event else if ( key == "time" ) e->SetData(1, StrToNum(val)); // time else if ( key == "offset" ) e->SetData(2, StrToNum(val)); // time offset else { rc = 1; cerr << "Error near line " << line << ": Invalid keyword '" << key << "'" << endl; } break; } } } if ( rc == 0 ) m.GetEvents().AddTail( e ); else delete e; } return rc; } // map parser int MapHandler::ParseSection( ifstream &in, const string *opt, unsigned long &line ) { if ( (size.x <= 0) || (size.x > MAX_MAP_WIDTH) || (size.y <= 0) || (size.y > MAX_MAP_HEIGHT) ) { cerr << "Error: Invalid map size" << endl; return -1; } m.GetMap().SetSize( size ); string buf; for ( int i = 0; i < size.y; ++i ) { getline( in, buf ); ++line; if ( in.eof() ) { cerr << "Error in line " << line << ": Unexpected end of map data" << endl; return -1; } RemWhitespace( buf ); if ( buf.size() != (unsigned short)size.x ) { cerr << "Error in line " << line << ": map row " << i << " does not comply with width parameter" << endl; return -1; } for ( int j = 0; j < size.x; ++j ) { unsigned short terrain; switch ( buf[j] ) { case '.': terrain = 30; break; /* plains */ case '*': terrain = 81; break; /* forest */ case '%': terrain = 117; break; /* mountains */ case '=': terrain = 360; break; /* shallow water */ case '~': terrain = 361; break; /* water */ case '-': terrain = 362; break; /* deep water */ case '1': terrain = 6; break; /* yellow hq entrance, east */ case '2': terrain = 7; break; /* blue hq entrance, east */ case '0': terrain = 8; break; /* neutral hq entrance, east */ case '<': terrain = 22; break; /* hq, left part */ case '>': terrain = 23; break; /* hq, right part */ case '^': terrain = 21; break; /* hq, upper part */ case 'v': terrain = 24; break; /* hq, lower part */ case '#': terrain = 307; break; /* swamp */ case '\\': terrain = 177; break; /* road, se-nw */ case '|': terrain = 176; break; /* road, s-n */ case '/': terrain = 178; break; /* road, sw-ne */ case 'y': terrain = 193; break; /* road, sw-n-ne */ case 'Y': terrain = 194; break; /* road, se-n-nw */ case '(': terrain = 180; break; /* road, n-se */ case ')': terrain = 179; break; /* road, n-sw */ case ']': terrain = 181; break; /* road, nw-s */ case '[': terrain = 182; break; /* road, ne-s */ case 'n': terrain = 184; break; /* road, sw-se */ case 'u': terrain = 183; break; /* road, nw-ne */ case 'o': terrain = 201; break; /* road, sw-nw-ne-se */ case 'k': terrain = 192; break; /* road, sw-s-ne */ case 'K': terrain = 191; break; /* road, s-se-nw */ case 'T': terrain = 188; break; /* road, n-s-se */ case 'U': terrain = 187; break; /* road, n-s-sw */ case 'V': terrain = 198; break; /* road, n-s-ne */ case 'W': terrain = 189; break; /* road, n-s-nw */ case 'X': terrain = 199; break; /* road, s-se-nw-n */ case 'x': terrain = 200; break; /* road, s-sw-ne-n */ case '!': terrain = 208; break; /* bridge, n-s */ case '`': terrain = 209; break; /* bridge, se-nw */ case '\'': terrain = 210; break; /* bridge, sw-ne */ case '4': terrain = 9; break; /* yellow depot entrance */ case '5': terrain = 10; break; /* blue depot entrance */ case '3': terrain = 11; break; /* neutral depot entrance */ case '7': terrain = 12; break; /* yellow factory entrance, north */ case '8': terrain = 13; break; /* blue factory entrance, north */ case '6': terrain = 14; break; /* neutral factory entrance, north */ case 'a': terrain = 144; break; /* wire fence, se-nw end */ case 'b': terrain = 147; break; /* wire fence, nw-se end */ case 'c': terrain = 146; break; /* wire fence, ne-sw end */ case 'd': terrain = 145; break; /* wire fence, sw-ne end */ case 'e': terrain = 133; break; /* wire fence, n-s */ case 'f': terrain = 135; break; /* wire fence, sw-ne */ case 'g': terrain = 134; break; /* wire fence, nw-se */ case 'h': terrain = 138; break; /* wire fence, nw-s */ case 'i': terrain = 139; break; /* wire fence, ne-s */ case 'j': terrain = 136; break; /* wire fence, sw-n */ case 'l': terrain = 137; break; /* wire fence, se-n */ case 'm': terrain = 140; break; /* wire fence, nw-ne */ case 'p': terrain = 141; break; /* wire fence, sw-se */ case '"': terrain = 363; break; /* cliff 1 */ case 'A': terrain = 18; break; /* yellow city */ case 'B': terrain = 19; break; /* blue city */ case 'C': terrain = 20; break; /* neutral city */ case 'D': terrain = 3; break; /* yellow hq entrance, west */ case 'E': terrain = 4; break; /* blue hq entrance, west */ case 'F': terrain = 5; break; /* neutral hq entrance, west */ case 'G': terrain = 0; break; /* yellow hq entrance, north */ case 'H': terrain = 1; break; /* blue hq entrance, north */ case 'I': terrain = 2; break; /* neutral hq entrance, north */ case '9': terrain = 15; break; /* yellow factory entrance, east */ case 'J': terrain = 16; break; /* blue factory entrance, east */ case 'L': terrain = 17; break; /* neutral factory entrance, east */ default: cerr << "Error in line " << line << ": Invalid character '" << buf[j] << "' in map" << endl; return -1; } m.GetMap().SetHexType( j, i, terrain ); } } return 0; } // read a raw map; a hex is represented by its ID and hexes are separated by comma; // this way, much more hex types can be accessed than by using plain ASCII code int MapRawHandler::ParseSection( ifstream &in, const string *opt, unsigned long &line ) { string buf; unsigned short terrain; size_t pos; const char *start; Map &map = m.GetMap(); if ( (size.x <= 0) || (size.x > MAX_MAP_WIDTH) || (size.y <= 0) || (size.y > MAX_MAP_HEIGHT) ) { cerr << "Error: Invalid map size" << endl; return -1; } map.SetSize( size ); for ( int i = 0; i < size.y; ++i ) { getline(in, buf); ++line; if ( in.eof() ) { cerr << "Error in line " << line << ": unexpected end of map data" << endl; return -1; } RemWhitespace( buf ); pos = 0; for ( int j = 0; j < size.x; ++j ) { start = &buf.c_str()[pos]; while ( (buf[pos] >= '0') && (buf[pos] <= '9') ) ++pos; if ( (buf[pos] == ',') || (buf[pos] == '\0') ) { buf[pos++] = '\0'; terrain = atoi( start ); if ( terrain >= map.GetTerrainSet()->NumTiles() ) { cerr << "Error in line " << line << ": Invalid hex id '" << terrain << "'" << endl; return -1; } else map.SetHexType( j, i, terrain ); } else { cerr << "Error in line " << line << ": Invalid character '" << buf[pos] << "' in map" << endl; return -1; } } } return 0; } // messages parser int MessagesHandler::ParseSection( ifstream &in, const string *opt, unsigned long &line ) { if ( !opt ) { cerr << "Error in line " << line << ": [Messages] section does not specify a language" << endl; return -1; } else if ( opt->size() != 2 ) { cerr << "Error in line " << line << ": " << *opt << " is not a valid language" << endl; return -1; } Language lang; lang.SetID( opt->c_str() ); string buf, msg; bool done = false; do { getline(in, buf); ++line; RemWhitespace( buf ); if ((buf.size() > 0) && ((buf[0] == '%') || (buf.substr(0,11) == "[/messages]"))) { // save last message if (!msg.empty()) { lang.AddMsg(msg); msg.erase(); } if (buf.substr(0,11) == "[/messages]") done = true; } else { if (!msg.empty()) msg += '\n'; msg.append(buf); } } while ( !in.eof() && !done ); int rc; if (in.eof()) { rc = -1; cerr << "Error in line " << line << ": Messages section unterminated" << endl; } else { rc = 0; m.GetMessages().AddLanguage( lang ); } return rc; } #define SECTION_MAP (1<<0) #define SECTION_MISSION (1<<1) #define SECTION_PLAYER1 (1<<2) #define SECTION_PLAYER2 (1<<3) class MissionParser : public Mission, public SectionParsedCallback { public: MissionParser( void ); int parse( const char *file ); int load_unit_set( const char *set ); int load_tile_set( const char *set ); void SectionParsed( const string §ion, SectionHandler &handler, CFParser &parser ); private: int check_game( void ) const; int check_units( void ) const; int check_shops( void ) const; int check_events( void ) const; int check_player( const Player &p ) const; template bool find_dups( const List &l, const T *o1 ) const { int cnt = 0; for ( T *o2 = static_cast(l.Head()); o2; o2 = static_cast(o2->Next()) ) { if ( o1->ID() == o2->ID() ) ++cnt; } return cnt > 1; } unsigned short parsed_sections; }; // start of program functions int main( int argc, char **argv ) { short show_help = 0; int rc, i; char *uset = NULL, *tset = NULL; string outname; if ( SDL_Init( 0 ) < 0 ) { cerr << "Error: Could not init SDL. " << SDL_GetError() << endl; return 1; } if ( argc < 2 ) show_help = 1; else { for ( i = argc - 1; i > 1; --i ) { if (strcmp(argv[i], "--help") == 0) show_help = 1; else if (strcmp(argv[i], "--version") == 0) { cout << "cfed "VERSION << endl; return 0; } else if (strcmp(argv[i-1], "--units") == 0) uset = argv[i]; else if (strcmp(argv[i-1], "--tiles") == 0) tset = argv[i]; else if (strcmp(argv[i-1], "-o") == 0) outname = argv[i]; } } if ( !uset || !tset ) show_help = 1; if ( show_help ) { cout << "Usage: " << argv[0] << " file --tiles --units [-o ]" << endl << " --help display this help and exit" << endl << " --version output version information and exit" << endl; return 0; } MissionParser parser; if ( parser.load_unit_set( uset ) != 0 ) { cerr << "Unable to open unit set " << uset << endl; return 1; } if ( parser.load_tile_set( tset ) != 0 ) { cerr << "Unable to open tile set " << tset << endl; return 1; } rc = parser.parse( argv[1] ); if ( !rc ) { if ( outname.empty() ) { outname = argv[1]; size_t pos = outname.rfind( '.' ); if ( pos != string::npos ) outname.erase( pos ); outname.append( ".lev" ); } rc = parser.Save( outname.c_str() ); if ( rc ) cerr << "Error opening file '" << outname << "' for writing" << endl; } return rc; } /* parse the file and create a binary mission file from it */ int MissionParser::parse( const char *file ) { parsed_sections = 0; int err = 0; Point mapsize; string tileset, unitset; CFParser parser; SectionHandler *h; parser.AddHandler( "mission", new MissionHandler( *this, tileset, unitset, mapsize ) ); parser.AddHandler( "player", new PlayerHandler( *this ) ); parser.AddHandler( "messages", new MessagesHandler( *this ) ); h = new UnitHandler( *this ); h->SetEnabled( false ); parser.AddHandler( "unit", h ); h = new ShopHandler( *this ); h->SetEnabled( false ); parser.AddHandler( "building", h ); h = new EventHandler( *this ); h->SetEnabled( false ); parser.AddHandler( "event", h ); h = new MapHandler( *this, mapsize ); h->SetEnabled( false ); parser.AddHandler( "map", h ); h = new MapRawHandler( *this, mapsize ); h->SetEnabled( false ); parser.AddHandler( "map-raw", h ); parser.SetCallback( this ); err = parser.Parse( file ); if ( !err ) { if ( (parsed_sections & SECTION_MISSION) == 0 ) { cerr << "Error: Basic mission definitions missing" << endl; err = 1; } else if ( (parsed_sections & SECTION_MAP) == 0 ) { cerr << "Error: No map" << endl; err = 1; } } if ( !err && !messages.SetDefaultLanguage( CF_LANG_DEFAULT ) ) { cerr << "Error: No english language data found" << endl; err = 1; } if ( !err ) err = check_game(); if ( !err ) err = check_shops(); if ( !err ) err = check_units(); if ( !err ) err = check_events(); if ( !err ) err = check_player( p1 ); if ( !err ) err = check_player( p2 ); return err; } // mission parser callback called when a section has been // successfully parsed void MissionParser::SectionParsed( const string §ion, SectionHandler &handler, CFParser &parser ) { if ( section == "mission" ) { parsed_sections |= SECTION_MISSION; handler.SetEnabled( false ); parser.EnableHandler( "unit", true ); parser.EnableHandler( "building", true ); parser.EnableHandler( "event", true ); parser.EnableHandler( "map", true ); parser.EnableHandler( "map-raw", true ); } else if ( section == "player" ) { if ( parsed_sections & SECTION_PLAYER1 ) { parsed_sections |= SECTION_PLAYER2; handler.SetEnabled( false ); } else parsed_sections |= SECTION_PLAYER1; } else if ( (section == "map") || (section == "map-raw") ) { parsed_sections |= SECTION_MAP; parser.EnableHandler( "map", false ); parser.EnableHandler( "map-raw", false ); } } /* check game data for validity */ int MissionParser::check_game( void ) const { if ( (map.Width() == 0) || (map.Height() == 0) ) { cerr << "Error: map width or height is 0" << endl; return 1; } if ( GetName() == -1 ) { cerr << "Error: Level has not been given a name" << endl; return 1; } else if ( !GetMessage(GetName()) ) { cerr << "Error: Invalid mission name " << (short)GetName() << endl; return 1; } else { short num_msgs = -1, cnt; for ( std::map::const_iterator it = messages.GetLibrary().begin(); it != messages.GetLibrary().end(); ++it ) { const Language *lang = &it->second; // count messages for ( cnt = 0; lang->GetMsg(cnt); ++cnt ); // empty loop if ( num_msgs == -1 ) num_msgs = cnt; else if ( num_msgs != cnt ) { cerr << "Error: Language data for '" << lang->ID() << "' contains " << cnt << " messages." << endl << " Previous languages had " << num_msgs << endl; return 1; } if ( strlen(lang->GetMsg(GetName())) > 30 ) { cerr << "Error (" << lang->ID() << "): Mission name must not exceed 30 characters" << endl; return 1; } } } if ( (GetLevelInfoMsg() != -1) && !GetMessage(GetLevelInfoMsg()) ) { cerr << "Error: Invalid level info message " << (short)GetLevelInfoMsg() << endl; return 1; } if ( (GetCampaignName() != -1) && !GetMessage(GetCampaignName()) ) { cerr << "Error: Invalid campaign name " << (short)GetCampaignName() << endl; return 1; } if ( (GetCampaignInfo() != -1) && !GetMessage(GetCampaignInfo()) ) { cerr << "Error: Invalid campaign info message " << (short)GetCampaignInfo() << endl; return 1; } if ( !IsCampaign() && (GetSequel() || (GetCampaignName() != -1) || (GetCampaignInfo() != -1)) ) { cerr << "Error: Campaign settings found but map is not marked as a campaign map" << endl; return 1; } return 0; } /* check players */ int MissionParser::check_player( const Player &p ) const { short msg = p.NameID(); if ( msg == -1 ) { cerr << "Error: No name set for player" << endl; return 1; } else { if ( !GetMessage(msg) ) { cerr << "Error: Invalid name " << msg << " for player" << endl; return 1; } else { for ( std::map::const_iterator it = messages.GetLibrary().begin(); it != messages.GetLibrary().end(); ++it ) { const Language *lang = &it->second; if ( strlen(lang->GetMsg(msg)) > 30 ) { cerr << "Error(" << lang->ID() << "): Player names must not be longer than 30 characters" << endl; return 1; } } } } msg = p.Briefing(); if ( (msg != -1) && !GetMessage(msg) ) { cerr << "Error: Invalid briefing " << msg << " for player" << endl; return 1; } return 0; } /* check units */ int MissionParser::check_units( void ) const { Unit *u, *walk; /* if there is a transport at a unit's location put it in if possible */ /* this only checks for transports appearing before the actual unit in the file */ for ( u = static_cast(units.Head()); u; u = static_cast(u->Next()) ) { if ( (u->Position().x >= map.Width()) || (u->Position().y >= map.Height()) || (u->Position().x < 0) || (u->Position().y < 0) ) { cerr << "Error: unit (ID: " << u->ID() << ") out of map" << endl; return 1; } if ( u->IsTransport() && !u->IsSheltered() ) { if ( StorageLeft( *u ) < 0 ) { cerr << "Error: Unit " << u->Name() << " at " << u->Position().x << '/' << u->Position().y << " carries too many units or crystals" << endl; return 1; } for ( walk = static_cast(u->Next()); walk; walk = static_cast(walk->Next()) ) { if ( walk->Position() == u->Position() ) { if ( walk->Weight() > u->MaxWeight() ) { cerr << "Error: Unit " << walk->Name() << " too heavy for transport at " << u->Position().x << '/' << u->Position().y << endl; return 1; } else if ( walk->Weight() < u->MinWeight() ) { cerr << "Error: Unit " << walk->Name() << " too light for transport at " << u->Position().x << '/' << u->Position().y << endl; return 1; } else walk->SetFlags( U_SHELTERED ); } } } if ( u->Crystals() && !u->IsTransport() ) cerr << "Error: non-transport unit (ID: " << u->ID() << ") cannot carry crystals" << endl; for ( walk = static_cast(u->Next()); walk; walk = static_cast(walk->Next()) ) { if ( u->ID() == walk->ID() ) { cerr << "Error: Two or more units sharing one ID (" << u->ID() << ')' << endl; return 1; } if ( (u->Position() == walk->Position()) && (!(u->IsSheltered() || u->IsTransport()) || !walk->IsSheltered()) ) { cerr << "Error: Two or more units sharing one hex (" << u->Position().x << '/' << u->Position().y << ')' << endl; if ( walk->IsTransport() ) cerr << " This might be caused by a transport being declared after a unit it carries." << endl; return 1; } } if ( (u->Owner() == PLAYER_ONE) || (u->Owner() == PLAYER_TWO) ) { if ( u->GetDirection() == 99 ) u->SetDirection( u->Owner() * 3 ); /* direction not set, use defaults */ else if ( u->GetDirection() > NORTHWEST ) { cerr << "Error: Invalid direction " << (short)u->GetDirection() << " for unit (ID: " << u->ID() << ')' << endl; return 1; } } else { u->SetDirection( 0 ); if ( !(u->Owner() == PLAYER_NONE) || !u->IsSheltered() ) { cerr << "Error: unit with ID " << u->ID() << " has no legal owner" << endl; return 1; } } if ( (u->GroupSize() > MAX_GROUP_SIZE) || (u->GroupSize() == 0) ) { cerr << "Error: unit with ID " << u->ID() << " has size " << (short)u->GroupSize() << endl; return 1; } if ( u->XPLevel() > XP_MAX_LEVEL ) { cerr << "Error: unit with ID " << u->ID() << " has been promoted to XP level " << (short)u->XPLevel() << ", maximum is " << XP_MAX_LEVEL << endl; return 1; } } return 0; } /* check buildings */ int MissionParser::check_shops( void ) const { Building *b, *walk; Unit *u; for ( b = static_cast(buildings.Head()); b; b = static_cast(b->Next()) ) { if ( (b->Position().x >= map.Width()) || (b->Position().y >= map.Height()) ) { cerr << "Error: Shop (" << b->Position().x << '/' << b->Position().y << ") out of map" << endl; return 1; } if ( !(map.TerrainTypes( b->Position() ) & TT_ENTRANCE) ) { cerr << "Error: Map does not have a shop entrance at " << b->Position().x << '/' << b->Position().y << endl; return 1; } if ( b->NameID() == -1 ) { cerr << "Error: No name set for shop " << b->ID() << endl; return 1; } else if ( !GetMessage(b->NameID()) ) { cerr << "Error: Invalid name " << (short)b->NameID() << " for shop " << b->ID() << endl; return 1; } else { for ( std::map::const_iterator it = messages.GetLibrary().begin(); it != messages.GetLibrary().end(); ++it ) { const Language *lang = &it->second; if ( strlen(lang->GetMsg(b->NameID())) > 30 ) { cerr << "Error(" << lang->ID() << "): Shop names must not be longer than 30 characters" << endl; return 1; } } } if ( b->Crystals() > b->MaxCrystals() ) { cerr << "Error: Shop at " << b->Position().x << '/' << b->Position().y << " contains " << b->Crystals() << " crystals, but only " << b->MaxCrystals() << " fit in" << endl; return 1; } if ( b->MinWeight() > b->MaxWeight() ) { cerr << "Error: Shop at " << b->Position().x << '/' << b->Position().y << " has minweight (" << (short)b->MinWeight() << ") > maxweight (" << b->MaxWeight() << ')' << endl; return 1; } for ( walk = static_cast(b->Next()); walk; walk = static_cast(walk->Next()) ) { if ( b->ID() == walk->ID() ) { cerr << "Error: Two shops sharing ID " << b->ID() << endl; return 1; } if ( b->Position() == walk->Position() ) { cerr << "Error: Two shops sharing one hex (" << b->Position().x << '/' << b->Position().y << ')' << endl; return 1; } } for ( u = static_cast(units.Head()); u; u = static_cast(u->Next()) ) { if ( b->Position() == u->Position() ) { if ( (u->Owner() != b->Owner()) && (b->Owner() != PLAYER_NONE) ) { cerr << "Error: Hostile unit (" << u->ID() << ") in building (" << b->Position().x << '/' << b->Position().y << ')' << endl; return 1; } else u->SetOwner( b->Owner() ); if ( u->Weight() < b->MinWeight() ) { cerr << "Error: Unit (" << u->ID() << ") too light for building at " << b->Position().x << '/' << b->Position().y << endl; return 1; } else if ( u->Weight() > b->MaxWeight() ) { cerr << "Error: Unit (" << u->ID() << ") too heavy for building at " << b->Position().x << '/' << b->Position().y << endl; return 1; } u->SetFlags( U_SHELTERED ); } } } return 0; } /* check events for consistency */ int MissionParser::check_events( void ) const { Event *e; Building *b; Unit *u; short msg; for ( e = static_cast(events.Head()); e; e = static_cast(e->Next()) ){ if ( (e->Player() != PLAYER_ONE) && (e->Player() != PLAYER_TWO) ) { cerr << "Error: Event " << (short)e->ID() << " has no player assigned" << endl; return 1; } msg = e->Message(); if ( (msg != -1) && !messages.GetMsg(msg) ) { cerr << "Error: Event " << (short)e->ID() << " has invalid message '" << msg << "'" << endl; return 1; } msg = e->Title(); if ( (msg != -1) && !messages.GetMsg(msg) ) { cerr << "Error: Event " << (short)e->ID() << " has invalid title '" << msg << "'" << endl; return 1; } /* check dependencies */ if ( e->Dependency() != -1 ) { if ( !GetEventByID( e->Dependency() ) ) { cerr << "Error: Event " << (short)e->ID() << " depends on non-existing event " << (short)e->Dependency() << endl; return 1; } } if ( e->Discard() != -1 ) { if ( !GetEventByID( e->Discard() ) ) { cerr << "Error: Event " << (short)e->ID() << " discards non-existing event " << (short)e->Discard() << endl; return 1; } } /* check ID's */ if ( find_dups( events, e ) ) { cerr << "Error: Two or more events with the same ID '" << (short)e->ID() << "'" << endl; return 1; } switch ( e->Type() ) { case EVENT_CREATE_UNIT: if ( e->GetData(0) < 0 ) { cerr << "Error: No unit type specified for Create Unit event " << (short)e->ID() << endl; return 1; } if ( map.Index2Hex(e->GetData(1)) == Point(-1, -1) ) { cerr << "Error: Invalid location for event " << (short)e->ID() << endl; return 1; } { unsigned short cu_dir = e->GetData(2) & 0x0007; unsigned short cu_size = (e->GetData(2) & 0x0038) >> 3; unsigned short cu_xp = (e->GetData(2) & 0x01C0) >> 6; if ( cu_dir > NORTHWEST ) { cerr << "Error: Invalid direction " << cu_dir << " for event " << (short)e->ID() << endl; return 1; } if ( (cu_size == 0) || (cu_size > MAX_GROUP_SIZE) ) { cerr << "Error: Invalid unit size " << cu_size << " for event " << (short)e->ID() << endl; return 1; } if ( cu_xp > XP_MAX_LEVEL ) { cerr << "Error: Invalid unit experience level " << cu_xp << " for event " << (short)e->ID() << endl; return 1; } } break; case EVENT_DESTROY_UNIT: if ( e->GetData(0) < 0 ) { if (e->GetData(2) == -9999) { cerr << "Error: No target specified for Destroy Unit event " << (short)e->ID() << endl; return 1; } e->SetData(0, -1); } else { if ( !GetUnitByID( e->GetData(0) ) ) { cerr << "Error: Unit with ID " << e->GetData(0) << " specified in event " << (short)e->ID() << " does not exist" << endl; return 1; } e->SetData(2, 0); } if ( e->GetData(1) < -1 ) e->SetData(1, -1); else if ( e->GetData(1) > PLAYER_TWO ) { cerr << "Error: Invalid unit owner for event " << (short)e->ID() << endl; return 1; } break; case EVENT_MANIPULATE_EVENT: if ( e->GetData(0) < 0 ) { cerr << "Error: Event manipulation event " << (short)e->ID() << " without valid target" << endl; return 1; } /* for now, this event can only enable/disable other events */ e->SetData(1, EFLAG_DISABLED); if ( e->GetData(1) == 0 ) { cerr << "Error: Event manipulation (" << (short)e->ID() << ") with invalid flags 0" << endl; return 1; } if ( (e->GetData(2) < 0) || (e->GetData(2) > 2) ) { cerr << "Error: Event manipulation (" << (short)e->ID() << ") with invalid action " << e->GetData(2) << endl; return 1; } if ( !GetEventByID( e->GetData(0) ) ) { cerr << "Error: Event with ID " << e->GetData(0) << " does not exist" << endl; return 1; } break; case EVENT_MESSAGE: if ( e->Message() == -1 ) { cerr << "Error: Message event " << (short)e->ID() << " has no message" << endl; return 1; } if ( map.Index2Hex( e->GetData(0) ) == Point(-1,-1) ) e->SetData(0, -1); else if ( !map.Contains( map.Index2Hex( e->GetData(0) ) ) ) { cerr << "Error: Invalid location set for message event (" << (short)e->ID() << ')' << endl; return 1; } e->SetData(1, 0); e->SetData(2, 0); break; case EVENT_MINING: if ( e->GetData(0) < 0 ) { cerr << "Error: Mining event " << (short)e->ID() << " with no shop" << endl; return 1; } if ( (e->GetData(2) < 0) || (e->GetData(2) > 3) ) { cerr << "Error: Mining event " << (short)e->ID() << " with invalid action " << e->GetData(2) << endl; return 1; } if ( ((e->GetData(2) == 0) || (e->GetData(2) == 2)) && (e->GetData(1) < 0) ) { cerr << "Error: Trying to set negative absolute amount for mining event " << (short)e->ID() << endl; return 1; } if ( !GetBuildingByID(e->GetData(0)) ) { cerr << "Error: Shop with ID " << e->GetData(0) << " does not exist (event " << (short)e->ID() << ')' << endl; return 1; } break; case EVENT_CONFIGURE: if ( e->GetData(0) < -9999 ) { cerr << "Error: Configure event " << (short)e->ID() << " does not specify setting" << endl; return 1; } if ( (e->GetData(0) == 0) || (e->GetData(0) == 1) ) { msg = e->GetData(1); if ( (msg != -1) && !messages.GetMsg(msg) ) { cerr << "Error: Event " << (short)e->ID() << " references invalid message '" << msg << "'" << endl; return 1; } } e->SetData(2, 0); break; case EVENT_RESEARCH: if ( e->GetData(0) < 0 ) { cerr << "Error: Research event " << (short)e->ID() << " with no shop" << endl; return 1; } if ( e->GetData(2) == -9999 ) e->SetData(2, 0); else if ( (e->GetData(2) < 0) || (e->GetData(2) > 1) ) { cerr << "Error: Research event " << (short)e->ID() << " specifies invalid action " << e->GetData(2) << endl; return 1; } if ( e->GetData(1) < 0 ) { cerr << "Error: Research event " << (short)e->ID() << " with no unit type" << endl; return 1; } if ( !GetBuildingByID(e->GetData(0)) ) { cerr << "Error: Shop with ID " << e->GetData(0) << " does not exist (event " << (short)e->ID() << ')' << endl; return 1; } break; case EVENT_SCORE: if ( e->GetData(0) < 0 ) { cerr << "Warning: Corrected success rate for score event < 0" << endl; e->SetData(0, 0); } if ( e->GetData(1) < -1 ) e->SetData(1, -1); msg = e->GetData(1); if ( (msg != -1) && !messages.GetMsg(msg) ) { cerr << "Error: Event " << (short)e->ID() << " references invalid message '" << msg << "'" << endl; return 1; } if ( e->GetData(2) < -1 ) e->SetData(2, -1); msg = e->GetData(2); if ( (e->GetData(1) != -1) && (msg != -1) && !messages.GetMsg(msg) ) { cerr << "Error: Event " << (short)e->ID() << " references invalid message '" << msg << "'" << endl; return 1; } else if ( (e->GetData(1) == -1) && (msg != -1) ) { cerr << "Warning: Event " << (short)e->ID() << " set a title but no message" << endl; e->SetData(2, -1); } break; case EVENT_SET_HEX: if ( e->GetData(0) < 0 ) { cerr << "Error: No tile specified for Set Hex event " << (short)e->ID() << endl; return 1; } if ( map.Index2Hex( e->GetTData(1) ) == Point(-1,-1) ) e->SetTData(1, -1); else if ( !map.Contains( map.Index2Hex( e->GetTData(1) ) ) ) { cerr << "Error: Invalid location set for event trigger (" << (short)e->ID() << ')' << endl; return 1; } break; case EVENT_SET_TIMER: if ( e->GetData(0) < 0 ) { cerr << "Error: Set Timer event " << (short)e->ID() << " without valid target" << endl; return 1; } else { Event *tev = GetEventByID( e->GetData(0) ); if ( !tev ) { cerr << "Error: Event with ID " << e->GetData(0) << " does not exist (event " << (short)e->ID() << ")" << endl; return 1; } else if ( tev->Trigger() != ETRIGGER_TIMER ) { cerr << "Error: Event with ID " << e->GetData(0) << " has no timer trigger (event " << (short)e->ID() << ")" << endl; return 1; } } if ( e->GetData(1) < 0 ) { cerr << "Error: Set Timer (" << (short)e->ID() << ") with invalid time " << e->GetData(1) << endl; return 1; } if ( (e->GetData(2) < 0) || (e->GetData(2) > 2) ) { cerr << "Error: Set Timer (" << (short)e->ID() << ") with invalid offset " << e->GetData(2) << endl; return 1; } break; default: cerr << "Error: Event with ID " << (short)e->ID() << " has invalid type" << endl; } switch ( e->Trigger() ) { case ETRIGGER_TIMER: if ( e->GetTData(0) < 0 ) { cerr << "Error: Event trigger lacks time (" << (short)e->ID() << ')' << endl; return 1; } e->SetTData(1, 0); e->SetTData(2, 0); break; case ETRIGGER_UNIT_DESTROYED: if ( e->GetTData(0) >= 0 ) { u = GetUnitByID( e->GetTData(0) ); /* the event must also be triggered when the unit is not destroyed but captured by the enemy. Therefore we need the original owner */ if (u) e->SetTData(1, u->Owner()); else { cerr << "Error: Event trigger targets non-existing unit with ID " << e->GetTData(0) << endl; return 1; } } else { if ( -e->GetTData(0) - 2 >= unit_set->NumTiles() ) { cerr << "Error: Event trigger targets non-existing unit type " << -e->GetTData(0) - 2 << " (" << (short)e->ID() << ')' << endl; return 1; } if ( e->GetTData(1) == -9999 ) e->SetTData(1, e->Player()^1); } e->SetTData(2, 0); break; case ETRIGGER_HAVE_UNIT: if ( (e->GetTData(1) != PLAYER_ONE) && (e->GetTData(1) != PLAYER_TWO) ) { cerr << "Error: Event trigger wants invalid player to own a unit (" << (short)e->ID() << endl; return 1; } if ( e->GetTData(2) < 0 ) e->SetTData(2, -1); u = GetUnitByID( e->GetTData(0) ); if (u) { if ( (u->Owner() == e->GetTData(1)) && (e->GetTData(2) < 0) && (e->Dependency() == -1) ) { cerr << "Error: Event trigger: unit " << u->ID() << " is already owned by player " << u->Owner()+1 << '(' << (short)e->ID() << ')' << endl; return 1; } } else { cerr << "Error: Event trigger targets non-existing unit " << e->GetTData(0) << " (" << (short)e->ID() << ')' << endl; return 1; } break; case ETRIGGER_HAVE_BUILDING: if ( (e->GetTData(1) != PLAYER_ONE) && (e->GetTData(1) != PLAYER_TWO) ) { cerr << "Error: Event trigger wants invalid player to own a shop (" << (short)e->ID() << endl; return 1; } if ( e->GetTData(2) < 0 ) e->SetTData(2, -1); b = GetBuildingByID( e->GetTData(0) ); if (b) { if ( (b->Owner() == e->GetTData(1)) && (e->GetTData(2) < 0) && (e->Dependency() == -1) ) { cerr << "Error: Event trigger: shop " << b->ID() << " is already owned by player " << b->Owner()+1 << '(' << (short)e->ID() << ')' << endl; return 1; } } else { cerr << "Error: Event trigger targets non-existing shop " << e->GetTData(0) << " (" << (short)e->ID() << ')' << endl; return 1; } break; case ETRIGGER_HAVE_CRYSTALS: if ( e->GetTData(0) == -9999 ) { cerr << "Error: Crystals trigger does not specify amount (" << (short)e->ID() << ")" << endl; return 1; } else if ( ABS(e->GetTData(0)) > 5000 ) { cerr << "Error: Invalid crystals amount " << e->GetTData(0) << " for event trigger (" << (short)e->ID() << ")" << endl; return 1; } if ( e->GetTData(1) == -9999 ) e->SetTData(1, e->Player()); else if ( (e->GetTData(1) != PLAYER_ONE) && (e->GetTData(1) != PLAYER_TWO) ) { cerr << "Error: Event trigger wants invalid player to own a shop (" << (short)e->ID() << ")" << endl; return 1; } if ( e->GetTData(2) < -2 ) e->SetTData(2, -1); else if ( e->GetTData(2) >= 0 ) { if ( !GetBuildingByID( e->GetTData(2) ) ) { cerr << "Error: Event trigger targets non-existing shop " << e->GetTData(2) << " (" << (short)e->ID() << ')' << endl; return 1; } } break; case ETRIGGER_UNIT_POSITION: if ( map.Index2Hex( e->GetTData(1) ) == Point(-1,-1) ) { cerr << "Error: Invalid location set for event trigger (" << (short)e->ID() << ')' << endl; return 1; } if ( e->GetTData(0) < -1 ) { if ( -e->GetTData(0) - 2 >= unit_set->NumTiles() ) { cerr << "Error: Event trigger targets non-existing unit type " << -e->GetTData(0) - 2 << " (" << (short)e->ID() << ')' << endl; return 1; } } else if ( e->GetTData(0) >= 0 ) { if (!GetUnitByID( e->GetTData(0) )) { cerr << "Error: Event trigger targets non-existing unit " << e->GetTData(0) << " (" << (short)e->ID() << ')' << endl; return 1; } } if ( e->GetTData(2) == -9999 ) e->SetTData( 2, e->Player() ); else if ( (e->GetTData(2) != PLAYER_ONE) && (e->GetTData(2) != PLAYER_TWO) ) { cerr << "Error: Event trigger wants invalid player to control a unit (" << (short)e->ID() << endl; return 1; } break; case ETRIGGER_HANDICAP: if ( e->GetTData(0) == -9999 ) { cerr << "Error: Handicap event trigger without a handicap (" << (short)e->ID() << ')' << endl; return 1; } else if ( e->GetTData(0) & 0xFFF8 ) { cerr << "Error: Invalid handicap " << e->GetTData(0) << " (" << (short)e->ID() << ')' << endl; return 1; } e->SetTData(1, 0); e->SetTData(2, 0); break; default: cerr << "Error: Invalid event trigger type " << (short)e->Trigger() << " (" << (short)e->ID() << ')' << endl; return 1; } } return 0; } /* load a unit set */ int MissionParser::load_unit_set( const char *set ) { string setshort( set ); // keep only the file part; check for both Unix and Windows path // separator characters or this breaks when building with MinGW setshort = setshort.substr( setshort.find_last_of( "/\\" ) + 1 ); size_t pos = setshort.find( ".units" ); if ( pos != string::npos ) setshort.erase( pos ); File file( set ); if ( !file.Open("rb") ) return -1; unit_set = new UnitSet(); if ( unit_set->Load( file, setshort.c_str() ) == -1 ) { delete unit_set; unit_set = 0; return -1; } map.SetUnitSet( unit_set ); return 0; } /* load a terrain set */ int MissionParser::load_tile_set( const char *set ) { string setshort( set ); // keep only the file part; check for both Unix and Windows path // separator characters or this breaks when building with MinGW setshort = setshort.substr( setshort.find_last_of( "/\\" ) + 1 ); size_t pos = setshort.find( ".tiles" ); if ( pos != string::npos ) setshort.erase( pos ); File file( set ); if ( !file.Open("rb") ) return -1; terrain_set = new TerrainSet(); if ( terrain_set->Load( file, setshort.c_str() ) == -1 ) { delete terrain_set; return -1; } map.SetTerrainSet( terrain_set ); return 0; } MissionParser::MissionParser( void ) { SetLevelInfoMsg( -1 ); SetCampaignName( -1 ); SetCampaignInfo( -1 ); SetTitle( "Unknown" ); } crimson-0.5.2.orig/tools/parser.cpp0000600000175000017500000002134310554366455015461 0ustar uweuwe/* Crimson Fields - a game of tactical warfare Copyright (C) 2000-2007 Jens Granseuer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* parser.cpp */ #include #include "parser.h" //////////////////////////////////////////////////////////////////////// // NAME : SectionHandler::StrToNum // DESCRIPTION: Convert a string to an integer. // PARAMETERS : s - string to convert // RETURNS : number //////////////////////////////////////////////////////////////////////// int SectionHandler::StrToNum( const string &s ) const { return CFParser::StrToNum( s ); } //////////////////////////////////////////////////////////////////////// // NAME : SectionHandler::RemWhitespace // DESCRIPTION: Remove leading and trailing whitespace characters from // a string. // PARAMETERS : s - string to crop // RETURNS : - //////////////////////////////////////////////////////////////////////// void SectionHandler::RemWhitespace( string &s ) const { CFParser::RemWhitespace( s ); } //////////////////////////////////////////////////////////////////////// // NAME : CFParser::~CFParser // DESCRIPTION: Destroy the parser and all registered handlers. // PARAMETERS : - // RETURNS : - //////////////////////////////////////////////////////////////////////// CFParser::~CFParser( void ) { for ( map::iterator it = handlers.begin(); it != handlers.end(); ++it ) { delete it->second; } } //////////////////////////////////////////////////////////////////////// // NAME : CFParser::AddHandler // DESCRIPTION: Register a SectionHandler for a named section type (aka // entity). All handlers attached to the parser will be // destroyed when the parser is destroyed. // PARAMETERS : section - section name the handler is responsible for // handler - the handler itself // RETURNS : - //////////////////////////////////////////////////////////////////////// void CFParser::AddHandler( const string §ion, SectionHandler *handler ) { handlers[section] = handler; } //////////////////////////////////////////////////////////////////////// // NAME : CFParser::EnableHandler // DESCRIPTION: Enable or disable a handler for a named section. // PARAMETERS : section - section name the handler is responsible for // enabled - whether to enable or disable the handler // RETURNS : - //////////////////////////////////////////////////////////////////////// void CFParser::EnableHandler( const string §ion, bool enabled ) { map::iterator it = handlers.find( section ); if ( it != handlers.end() ) { it->second->SetEnabled( enabled ); } } //////////////////////////////////////////////////////////////////////// // NAME : CFParser::RemWhitespace // DESCRIPTION: Remove leading and trailing whitespace characters from // a string. // PARAMETERS : s - string to crop // RETURNS : - //////////////////////////////////////////////////////////////////////// void CFParser::RemWhitespace( string &s ) { int len = s.size(), start = 0, end; if (len == 0) return; while ( (start < len) && (s[start] == ' ') ) ++start; for ( end = len - 1; ((s[end] == ' ') || (s[end] == '\n') || (s[end] == '\r')) && (end >= start); --end ); /* empty loop */ s.erase( end + 1 ); s.erase( 0, start ); } //////////////////////////////////////////////////////////////////////// // NAME : CFParser::StrToNum // DESCRIPTION: Convert a string to an integer. // PARAMETERS : s - string to convert // RETURNS : number //////////////////////////////////////////////////////////////////////// int CFParser::StrToNum( const string &s ) { if ( s.size() > 0 && s[0] != '-' && !isdigit(s[0]) ) // complain cerr << "Warning: trying to convert non-numeric chars to number: " << s << endl; return atoi(s.c_str()); } //////////////////////////////////////////////////////////////////////// // NAME : CFParser::Parse // DESCRIPTION: Parse a file using the registered handlers. // PARAMETERS : file - name of the file to parse // RETURNS : 0 on success, non-0 on error //////////////////////////////////////////////////////////////////////// int CFParser::Parse( const string &file ) { int rc = 0; unsigned long line = 0; ifstream f( file.c_str() ); if ( !f.is_open() ) { cerr << "Unable to open file " << file << endl; return 1; } // skip possible UTF-8 BOM unsigned char s[4]; f.get( (char *)s, 4 ); if ((s[0] != 0xef) || (s[1] != 0xbb) || (s[2] != 0xbf)) f.seekg( 0 ); string buf; while ( !f.eof() && (rc == 0) ) { getline( f, buf ); ++line; RemWhitespace( buf ); if ((buf.size() > 0) && (buf[0] != '#')) { // comment rc = 1; // get the section name pair sec = ParseSectionHeader( buf ); if ( sec.first.size() == 0 ) { cerr << "Syntax error in line " << line << ": Invalid section header '" << buf << "'" << endl; break; } map::iterator it = handlers.find( sec.first ); if ( it == handlers.end() ) { cerr << "Error in line " << line << ": No handler available for section '" << sec.first << "'" << endl; break; } else if ( !it->second->Enabled() ) { cerr << "Error in line " << line << ": Handler for section '" << sec.first << "' is disabled" << endl; break; } rc = it->second->ParseSection( f, (sec.second.size() > 0) ? &sec.second : NULL, line ); if ( (rc == 0) && hook ) hook->SectionParsed( sec.first, *it->second, *this ); } } f.close(); return rc; } //////////////////////////////////////////////////////////////////////// // NAME : CFParser::ParseSectionHeader // DESCRIPTION: Parse a section header to retrieve the name and any // options. A section header can llok like this: // "[unit]" - standard header // "[messages(en)]" - header with optional argument // PARAMETERS : s - section header string // RETURNS : pair containing the section name and the optional // parameter if any //////////////////////////////////////////////////////////////////////// const pair CFParser::ParseSectionHeader( const string &s ) { size_t pos; pair sec("", ""); if ( s[0] == '[' ) { // starts a new entity pos = s.find( ']' ); if ( pos != string::npos ) { string head = s.substr( 1, pos - 1 ); // look for optional parameter pos = head.find( '(' ); if ( pos != string::npos ) { sec.second = head.substr( pos + 1, head.size() - pos - 2 ); head.erase( pos ); } sec.first = head; } } return sec; } //////////////////////////////////////////////////////////////////////// // NAME : KeyValueSectionHandler::ParseSection // DESCRIPTION: Parse a section or entity containing key/value pairs // ("key = value"). // PARAMETERS : in - stream to read data from // opt - if not NULL, optional parameter for this section // line - line counter to be incremented while reading // RETURNS : 0 on success, non-0 on error //////////////////////////////////////////////////////////////////////// int KeyValueSectionHandler::ParseSection( ifstream &in, const string *opt, unsigned long &line ) { int rc = 0; size_t pos; string buf, val; pairs.clear(); while ( !in.eof() ) { getline( in, buf ); ++line; RemWhitespace( buf ); if ( buf.size() == 0 ) break; // empty lines are treated as section separators else if ( buf[0] != '#' ) { // comment pos = buf.find( '=' ); if ( pos == string::npos ) { cerr << "Syntax error in line " << line << ": '=' missing" << endl; rc = 1; break; } val = buf.substr( pos+1 ); // separate key from data buf.erase( pos ); RemWhitespace( buf ); RemWhitespace( val ); pairs.push_back( pair( buf, val ) ); } } return rc; } crimson-0.5.2.orig/tools/parser.h0000600000175000017500000000524010554366467015127 0ustar uweuwe/* Crimson Fields - a game of tactical warfare Copyright (C) 2000-2007 Jens Granseuer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef _ED_INCLUDE_PARSER_H #define _ED_INCLUDE_PARSER_H #include #include #include #include #include #include using namespace std; // callback when a section has been successfully parsed class SectionParsedCallback { public: virtual ~SectionParsedCallback( void ) {} virtual void SectionParsed( const string §ion, class SectionHandler &handler, class CFParser &parser ) = 0; }; // class that handles parsing of a section type, e.g. [unit] class SectionHandler { public: SectionHandler( void ) : enabled(true) {} virtual ~SectionHandler( void ) {} virtual int ParseSection( ifstream &in, const string *opt, unsigned long &line ) = 0; void SetEnabled( bool flag ) { enabled = flag; } bool Enabled( void ) const { return enabled; } protected: void RemWhitespace( string &s ) const; int StrToNum( const string &s ) const; bool enabled; }; class CFParser { public: CFParser( void ) : hook(0) {} ~CFParser( void ); int Parse( const string &file ); void AddHandler( const string §ion, SectionHandler *handler ); void EnableHandler( const string §ion, bool enabled ); void SetCallback( SectionParsedCallback *cb ) { hook = cb; } static void RemWhitespace( string &s ); static int StrToNum( const string &s ); private: const pair ParseSectionHeader( const string &s ); map handlers; SectionParsedCallback *hook; }; // section handler subclass for parsing key/value pairs class KeyValueSectionHandler : public SectionHandler { public: KeyValueSectionHandler( void ) {} virtual ~KeyValueSectionHandler( void ) {} virtual int ParseSection( ifstream &in, const string *opt, unsigned long &line ); protected: vector > pairs; }; #endif /* _ED_INCLUDE_PARSER_H */ crimson-0.5.2.orig/tools/mkdatafile.cpp0000600000175000017500000000335510554366453016267 0ustar uweuwe/* mkdatafile -- create a Crimson Fields data file Copyright (C) 2000-2007 Jens Granseuer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* takes two file names: icons BMP and output filename The data file is written in little-endian format. Creates a data file for Crimson Fields containing icons image data */ #include using namespace std; #include "SDL.h" #include "fileio.h" #include "mksurface.h" #ifdef _MSC_VER // SDL_Main linkage destroys the command line in VS8 #undef main #endif int main( int argc, char *argv[] ) { int status; if ( argc != 3 ) { cerr << "Invalid number of arguments" << endl << "Usage: " << argv[0] << " " << endl; exit(-1); } if ( SDL_Init(0) < 0 ) { cerr << "Couldn't init SDL: " << SDL_GetError() << endl; exit(-1); } atexit(SDL_Quit); File out( argv[2] ); if ( !out.Open( "wb" ) ) { cerr << "Couldn't open output file " << argv[5] << endl; exit(-1); } // icons MkSurface img; status = img.SaveImageData( argv[1], out, true ); out.Close(); return status; } crimson-0.5.2.orig/tools/mksurface.cpp0000600000175000017500000000660010554366454016143 0ustar uweuwe/* Crimson Fields - a game of tactical warfare Copyright (C) 2000-2007 Jens Granseuer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* mksurface.cpp */ #include using namespace std; #include "mksurface.h" //////////////////////////////////////////////////////////////////////// // NAME : MkSurface::SaveImageData // DESCRIPTION: Load a bitmap file and save the data into another file. // PARAMETERS : from - name of the bitmap to load // out - file to save to // tp - whether to save color key information // (transparent color). If true we look at the upper // left pixel and assume that should be the color // key (should work for hex images at least). // RETURNS : 0 on success, non-0 on error //////////////////////////////////////////////////////////////////////// int MkSurface::SaveImageData( const string &from, MemBuffer &out, bool tp ) { int rc = LoadBMP( from.c_str() ); if ( rc == 0 ) { if ( s_surface->format->BitsPerPixel == 8 ) { SDL_Palette *palette = s_surface->format->palette; int i; out.Write16( Width() ); out.Write16( Height() ); out.Write8( s_surface->format->BitsPerPixel ); out.Write8( tp ? RAW_DATA_TRANSPARENT : 0 ); out.Write16( palette->ncolors ); // only for <= 256 colors (bpp = 8) if ( tp ) { int ck = GuessColorKey(); // transparent color first out.Write8( palette->colors[ck].r ); out.Write8( palette->colors[ck].g ); out.Write8( palette->colors[ck].b ); } for ( i = 0; i < palette->ncolors; ++i ) { out.Write8( palette->colors[i].r ); out.Write8( palette->colors[i].g ); out.Write8( palette->colors[i].b ); } // save surface lines to file for ( i = 0; i < Height(); ++i ) { Uint8 *pix = (Uint8 *)s_surface->pixels + i * s_surface->pitch; out.Write( pix, Width() ); } } else { cerr << "Error: Couldn't find palette in image " << from << endl << "Make sure it is 8 bit (<= 256 colors) only" << endl; rc = -1; } } else cerr << "Error: Couldn't load image " << from << endl; return rc; } //////////////////////////////////////////////////////////////////////// // NAME : MkSurface::GuessColorKey // DESCRIPTION: Look at the pixel in the upper left corner and assume it // should be transparent (should be true for hex images). // PARAMETERS : - // RETURNS : palette index of the transparent color //////////////////////////////////////////////////////////////////////// int MkSurface::GuessColorKey( void ) const { // only implemented for 8 bit surfaces return *((Uint8 *)s_surface->pixels); } crimson-0.5.2.orig/tools/mklocale.cpp0000600000175000017500000001516710554366442015757 0ustar uweuwe/* mklocale -- compile or disassemble a language file for Crimson Fields Copyright (C) 2004-2007 Jens Granseuer This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #include #include #include #include "SDL.h" #include "lang.h" #include "globals.h" #ifdef _MSC_VER // SDL_Main linkage destroys the command line in VS8 #undef main #endif class LanguageTemplate { public: int Parse(const char *fname, Language &lang) const; int Write(const char *fname, const Language &lang) const; private: int ParseMessages(ifstream &file, Language &lang) const; void RemWS(string &str) const; }; static char parse_args(int argc, char *argv[]); static const char *templatefile; static const char *localefile; /* an exemplary language template file might look like this: * * # foobar language file for Crimson Fields * # translated by Foo Bar * language=foobar * id=fo * * [messages] * first message * # <- message delimiter * second message * # multiple delimiters are possible * # * third message * containing a line break * [/messages] */ int LanguageTemplate::Parse(const char *fname, Language &lang) const { int rc = 0; ifstream file(fname); if (file.is_open()) { string buf, value; unsigned int line = 0; size_t i; while (!file.eof()) { getline(file, buf); ++line; RemWS(buf); if ((buf.size() > 0) && (buf[0] != '#')) { /* ignore comments and empty lines */ if (strncasecmp(buf.c_str(), "language", 8) == 0) { i = buf.find("=", 8); if (i == string::npos) { cerr << "Error in line " << line << ": format invalid" << endl; rc = -1; break; } value = buf.substr(i+1, 50); RemWS(value); lang.SetName(value.c_str()); } else if (strncasecmp(buf.c_str(), "id", 2) == 0) { i = buf.find("=", 2); if (i == string::npos) { cerr << "Error in line " << line << ": format invalid" << endl; rc = -1; break; } value = buf.substr(i+1, 10); RemWS(value); if (value.size() != 2) { cerr << "Error in line " << line << ": only two-character identifiers allowed" << endl; rc = -1; break; } lang.SetID(value.c_str()); } else if (strncasecmp(buf.c_str(), "[messages]", 10) == 0) { rc = ParseMessages(file, lang); } else { rc = -1; cerr << "Error in line " << line << ": unkown token" << endl; break; } } } file.close(); if (strlen(lang.ID()) == 0) { cerr << "Error parsing template: no language id found" << endl; rc = -1; } else if (strlen(lang.Name()) == 0) { cerr << "Error parsing template: no language name found" << endl; rc = -1; } } else cerr << "Error opening template file" << endl; return rc; } int LanguageTemplate::ParseMessages(ifstream &file, Language &lang) const { bool done = false; string buf, msg; do { getline(file, buf); RemWS(buf); if ((buf.size() > 0) && ((buf[0] == '#') || (strncasecmp(buf.c_str(), "[/messages]", 11) == 0))) { /* save last message */ if (!msg.empty()) { lang.AddMsg(msg); msg.erase(); } if (strncasecmp(buf.c_str(), "[/messages]", 11) == 0) done = true; } else { if (!msg.empty()) msg += '\n'; msg.append(buf); } } while ( !file.eof() && !done ); int rc = 0; if (file.eof()) { rc = -1; cerr << "Error: messages section unterminated" << endl; } return rc; } /* remove leading and trailing spaces and cr + lf from the string */ void LanguageTemplate::RemWS(string &str) const { size_t i = 0; if (str.empty()) return; while (str[i] == ' ') ++i; str.erase(0, i); for (i = str.size() - 1; (i >= 0) && ((str[i] == ' ') || (str[i] == '\n') || (str[i] == '\r')); --i); /* empty loop */ str.erase(i+1); } int LanguageTemplate::Write(const char *fname, const Language &lang) const { int rc; ofstream file(fname); if (file.is_open()) { file << "# " << lang.Name() << " language template for Crimson Fields " << VERSION << endl; file << "language=" << lang.Name() << endl; file << "id=" << lang.ID() << endl; file << endl; file << "[messages]" << endl; const char *msg = lang.GetMsg(0); file << msg << endl; for (int i = 1; (msg = lang.GetMsg(i)) != 0; ++i) { file << '#' << endl; file << msg << endl; } file << "[/messages]" << endl; file.close(); rc = 0; } else { rc = -1; cerr << "Error opening template file" << endl; } return rc; } int main(int argc, char *argv[]) { if (SDL_Init(0) < 0) { cerr << "Couldn't init SDL:" << endl << SDL_GetError(); exit(-1); } atexit(SDL_Quit); char op = parse_args(argc, argv); if (op == 0) return 1; Language lang; LanguageTemplate tmpl; int rc; if (op == 'l') { rc = tmpl.Parse(templatefile, lang); if (rc == 0) { rc = lang.WriteCatalog(localefile); if (rc == -1) cerr << "Error writing catalog file" << endl; else rc = 0; } } else { rc = lang.ReadCatalog(localefile); if (rc != -1) { rc = tmpl.Write(templatefile, lang); } else cerr << "Error reading catalog file" << endl; } return rc; } char parse_args(int argc, char *argv[]) { bool usage = true; char rc = 0; if (argc == 4) { string op(argv[1]); if (op == "-l") { rc = 'l'; templatefile = argv[2]; localefile = argv[3]; usage = false; } else if (op == "-t") { rc = 't'; templatefile = argv[3]; localefile = argv[2]; usage = false; } } if (usage) { cerr << "Usage:" << endl << argv[0] << " -l