Merge branch 'release/3.13.0'

This commit is contained in:
filux 2017-03-08 21:39:12 +01:00
commit 967257e491
178 changed files with 3898 additions and 3197 deletions

View File

@ -1,12 +1,97 @@
#!/bin/sh
#!/bin/bash
# script for use with travis and on linux only
#
# Copyright (c) 2015-2016 MegaGlest Team under GNU GPL v3.0+
set -ex
export LANG=C
SCRIPTDIR="$(dirname "$(readlink -f "$0")")"
# ----------------------------------------------------------------------------
# Load shared functions
. $SCRIPTDIR/mk/linux/mg_shared.sh
detect_system
# ----------------------------------------------------------------------------
Compiler_name="$1"; Compiler_version="$2"
Compiler_version_grep="$(echo "$Compiler_version" | sed 's/\./\\./g')"
wget https://www.libsdl.org/release/SDL2-2.0.3.tar.gz
tar xf SDL2-2.0.3.tar.gz
(
cd SDL2-2.0.3
./configure --enable-static --disable-shared
make
sudo make install
)
set -x
if [ "$Compiler_version" != "" ] && [ "$Compiler_version" != "default" ]; then
# UPDATE REPOS
sudo apt-get update -qq
sudo apt-get install -y -qq
set +x
if [ "$Compiler_name" = "gcc" ]; then
VersionAvByDefault="$(apt-cache search ^g[c+][c+]-[0-9] | grep -v '[0-9]-[a-zA-Z]' | grep "^gcc-$Compiler_version_grep")"
elif [ "$Compiler_name" = "clang" ]; then
VersionAvByDefault="$(apt-cache search ^clang-[0-9] | grep -v '[0-9]-[a-zA-Z]' | grep "^clang-$Compiler_version_grep")"
fi
set -x
if [ "$VersionAvByDefault" = "" ]; then
if [ "$distribution" = "Ubuntu" ]; then
if [ "$Compiler_name" = "gcc" ] || ( [ "$Compiler_name" = "clang" ] && [ "$codename" = "precise" ] ); then
# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
sudo add-apt-repository --yes "deb http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu ${codename} main"
#sudo add-apt-repository --yes "deb-src http://ppa.launchpad.net/ubuntu-toolchain-r/test/ubuntu ${codename} main"
fi
fi
if [ "$distribution" = "Ubuntu" ] || [ "$distribution" = "Debian" ]; then
if [ "$Compiler_name" = "clang" ]; then
# http://apt.llvm.org/
sudo add-apt-repository --yes "deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename} main"
#sudo add-apt-repository --yes "deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename} main"
sudo add-apt-repository --yes "deb http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${Compiler_version} main"
#sudo add-apt-repository --yes "deb-src http://apt.llvm.org/${codename}/ llvm-toolchain-${codename}-${Compiler_version} main"
wget -O - http://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
fi
fi
fi
fi
set -e
if [ "$VersionAvByDefault" = "" ]; then
# UPDATE REPOS
sudo apt-get update -qq
#sudo apt-get upgrade -qq # UPGRADE SYSTEM TO LATEST PATCH LEVEL
sudo apt-get install -y -qq
fi
if [ "$Compiler_version" != "" ] && [ "$Compiler_version" != "default" ]; then
if [ "$Compiler_name" = "gcc" ]; then
set +ex
Gcc_AvSepGpp="$(apt-cache search ^g[c+][c+]-[0-9] | grep -v '[0-9]-[a-zA-Z]' | grep "^g++-$Compiler_version_grep")"
set -ex
if [ "$Gcc_AvSepGpp" = "" ]; then
sudo apt-get --allow-unauthenticated install -qq --force-yes gcc-${Compiler_version}
else
sudo apt-get --allow-unauthenticated install -qq --force-yes gcc-${Compiler_version} g++-${Compiler_version}
fi
elif [ "$Compiler_name" = "clang" ]; then
sudo apt-get --allow-unauthenticated install -qq --force-yes clang-${Compiler_version}
fi
fi
# what available versions we can use
set +x
apt-cache search ^g[c+][c+]-[0-9] | grep -v '[0-9]-[a-zA-Z]'
apt-cache search ^clang-[0-9] | grep -v '[0-9]-[a-zA-Z]'
set -x
# INSTALL OUR DEPENDENCIES
sudo $SCRIPTDIR/mk/linux/setupBuildDeps.sh --quiet
if [ "$distribution" = "Ubuntu" ]; then
case $release in
12.04*)
SDL2_version="2.0.5"
wget https://www.libsdl.org/release/SDL2-${SDL2_version}.tar.gz
tar xf SDL2-${SDL2_version}.tar.gz
( cd SDL2-${SDL2_version}
./configure --enable-static --disable-shared
make
sudo make install )
;;
*)
;;
esac
fi

View File

@ -3,40 +3,37 @@ language: cpp
sudo: required
os:
- linux
- osx
compiler:
- gcc
- clang
env:
- GCC_VERSION="5"
- GCC_VERSION="native"
- LLVM_VERSION="3.7"
- LLVM_VERSION="native"
matrix:
exclude:
- compiler: gcc
env: LLVM_VERSION="3.7"
- compiler: gcc
env: LLVM_VERSION="native"
- compiler: clang
env: GCC_VERSION="5"
- compiler: clang
env: GCC_VERSION="native"
include:
- os: linux
compiler: gcc
env: Tr_Compiler_Version="6"
# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
dist: trusty # broken compiler on 12.04
- os: linux
compiler: gcc
env: Tr_Compiler_Version="default"
- os: linux
compiler: clang
env: LLVM_VERSION="native" # broken compiler
- os: osx
compiler: gcc # unsupported compiler
- os: osx
env: Tr_Compiler_Version="3.9"
# http://apt.llvm.org/, compiler not newer than available on debian testing
# https://packages.debian.org/search?suite=testing&keywords=clang-
dist: trusty
- os: linux
compiler: clang
env: LLVM_VERSION="3.7" # missing compiler by brew
#allow_failures:
# - os: osx
env: Tr_Compiler_Version="default"
dist: trusty # broken compiler on 12.04
- os: osx
#osx_image: xcode6.4 # seems broken and has lower priority in queue than default one
env: Tr_Xcode_Version="default"
#env: Tr_Xcode_Version="6.4"
# https://docs.travis-ci.com/user/osx-ci-environment/#OS-X-Version
# https://github.com/Homebrew/brew/blob/master/docs/Installation.md#requirements
fast_finish: true
allow_failures:
- os: osx
# it's not really acceptable to wait 40 minutes or sometimes up to even 3 hours
# for the result just because the queue for mac is always so long
git:
submodules: false
@ -46,30 +43,26 @@ git:
# - master
before_install:
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$GCC_VERSION" != "native" ]; then sudo add-apt-repository --yes ppa:ubuntu-toolchain-r/test; fi
# https://launchpad.net/~ubuntu-toolchain-r/+archive/ubuntu/test
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$CXX" == "clang++" ] && [ "$LLVM_VERSION" != "native" ]; then sudo add-apt-repository --yes 'deb http://llvm.org/apt/precise/ llvm-toolchain-precise main'; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$CXX" == "clang++" ] && [ "$LLVM_VERSION" != "native" ]; then sudo add-apt-repository --yes "deb http://llvm.org/apt/precise/ llvm-toolchain-precise-${LLVM_VERSION} main"; fi
# http://llvm.org/apt/
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$CXX" == "clang++" ] && [ "$LLVM_VERSION" != "native" ]; then wget -O - http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add -; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get update -qq; fi # UPDATE REPOS
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then ./.travis-before_install.sh "$CC" "$Tr_Compiler_Version"; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew update; fi
#- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get upgrade -qq; fi # UPGRADE SYSTEM TO LATEST PATCH LEVEL
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo apt-get install -y -qq; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$CXX" = "g++" ] && [ "$GCC_VERSION" != "native" ]; then sudo apt-get install -qq gcc-${GCC_VERSION} g++-${GCC_VERSION}; fi
- if [ "$CXX" = "g++" ] && [ "$GCC_VERSION" != "native" ]; then export CXX="g++-${GCC_VERSION}" CC="gcc-${GCC_VERSION}"; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$CXX" == "clang++" ] && [ "$LLVM_VERSION" != "native" ]; then sudo apt-get --allow-unauthenticated -qq install clang-${LLVM_VERSION}; fi
- if [ "$CXX" == "clang++" ] && [ "$LLVM_VERSION" != "native" ]; then export CXX="clang++-${LLVM_VERSION}" CC="clang-${LLVM_VERSION}"; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo mk/linux/setupBuildDeps.sh --quiet; fi # INSTALL OUR DEPENDENCIES
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew install sdl2 lua freetype ftgl libogg glew libvorbis cppunit glib fribidi miniupnpc wxmac; fi
# ^ not on travis also needed are: cmake + pkgconfig + xquartz (find by "search") + (maybe) git + (maybe) bash
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew outdated cmake || brew upgrade cmake; brew outdated pkgconfig || brew upgrade pkgconfig; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then brew link --force gettext; fi
# ^ odd linking problems related with brew which is not creating links
- if [ "$TRAVIS_OS_NAME" = "osx" ] && [ "$Tr_Xcode_Version" = "6.4" ]; then brew install Caskroom/cask/xquartz; fi
- if [ "$Tr_Compiler_Version" != "" ] && [ "$Tr_Compiler_Version" != "default" ] && [ "$CC" = "gcc" ]; then export CXX="g++-${Tr_Compiler_Version}" CC="gcc-${Tr_Compiler_Version}"; fi
- if [ "$Tr_Compiler_Version" != "" ] && [ "$Tr_Compiler_Version" != "default" ] && [ "$CC" == "clang" ]; then export CXX="clang++-${Tr_Compiler_Version}" CC="clang-${Tr_Compiler_Version}"; fi
- $CC --version
- $CXX --version
- cmake --version
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then sudo ./.travis-before_install.sh; fi
script:
# ALL THE BUILD COMMANDS HERE
- if [ "$TRAVIS_OS_NAME" = "linux" ]; then mk/linux/build-mg.sh -c 4; fi
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then mk/macosx/build-mg.sh -c 4; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$(echo "$CC" | grep 'clang')" = "" ]; then mk/linux/build-mg.sh -c 4; fi
- if [ "$TRAVIS_OS_NAME" = "linux" ] && [ "$(echo "$CC" | grep 'clang')" != "" ]; then mk/linux/build-mg.sh -w -c 4; fi
# ^ -w may be removed on more modern dist: than trusty, problems related with 'new wx+clang+old gcc'
- if [ "$TRAVIS_OS_NAME" = "osx" ]; then mk/macos/build-mg.sh -c 4; fi
# https://docs.travis-ci.com/user/notifications/#IRC-notification
notifications:
@ -80,7 +73,4 @@ notifications:
use_notice: true
on_success: change
template:
#- "[%{repository_slug}#%{branch} @%{commit}] %{author}): %{message}"
#- "Diff: %{compare_url}"
#- "Build: %{build_url}"
- "[%{repository_name}#%{branch}@%{commit}] %{author}: %{message} %{build_url}"

View File

@ -97,7 +97,7 @@ ENDIF()
## Compiler flags, CPACK configuration and other Apple specific code.
IF(APPLE)
include(${PROJECT_SOURCE_DIR}/mk/macosx/CMakeLists.txt)
include(${PROJECT_SOURCE_DIR}/mk/macos/CMakeLists.txt)
ENDIF(APPLE)
IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
@ -227,7 +227,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
# Get the current commit SHA1
execute_process(
COMMAND git log -1 --format=%h
COMMAND git log -1 --format=%h --abbrev=7
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_SHA1
OUTPUT_STRIP_TRAILING_WHITESPACE
@ -241,7 +241,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
OUTPUT_STRIP_TRAILING_WHITESPACE
)
SET(GIT_LIVE_REV_CMD "`cd '${PROJECT_SOURCE_DIR}' && git rev-list HEAD --count`.`cd '${PROJECT_SOURCE_DIR}' && git log -1 --format=%h`")
SET(GIT_LIVE_REV_CMD "`cd '${PROJECT_SOURCE_DIR}' && git rev-list HEAD --count`.`cd '${PROJECT_SOURCE_DIR}' && git log -1 --format=%h --abbrev=7`")
MESSAGE(STATUS "Using GIT revision stamp: [${GIT_COMMIT_COUNT}.${GIT_SHA1}] CMD [${GIT_LIVE_REV_CMD}]")
@ -282,8 +282,10 @@ IF(CMAKE_COMPILER_IS_GNUCXX OR MINGW)
ENDFOREACH()
ENDIF()
IF(NOT CUSTOM_DATA_INSTALL_PATH AND NOT WANT_SINGLE_INSTALL_DIRECTORY)
SET(CUSTOM_DATA_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${MEGAGLEST_DATA_INSTALL_PATH}" CACHE STRING "The FULL installation path for data files (this is build automatically by combining CMAKE_INSTALL_PREFIX and MEGAGLEST_DATA_INSTALL_PATH)")
IF(NOT WANT_SINGLE_INSTALL_DIRECTORY)
IF(NOT CUSTOM_DATA_INSTALL_PATH)
SET(CUSTOM_DATA_INSTALL_PATH "${CMAKE_INSTALL_PREFIX}/${MEGAGLEST_DATA_INSTALL_PATH}" CACHE STRING "The FULL installation path for data files (this is build automatically by combining CMAKE_INSTALL_PREFIX and MEGAGLEST_DATA_INSTALL_PATH)")
ENDIF()
SET(CUSTOM_DATA_INSTALL_PATH_VALUE "-DCUSTOM_DATA_INSTALL_PATH=${CUSTOM_DATA_INSTALL_PATH}")
ENDIF()
@ -337,7 +339,7 @@ OPTION(WANT_DEV_OUTPATH "Use developer friendly output paths." OFF)
IF(UNIX AND "${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
SET(MEGAGLEST_FRIENDLY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/mk/linux/")
ELSEIF(UNIX AND APPLE)
SET(MEGAGLEST_FRIENDLY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/mk/macosx/")
SET(MEGAGLEST_FRIENDLY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/mk/macos/")
ELSEIF(UNIX AND NOT APPLE)
SET(MEGAGLEST_FRIENDLY_OUTPUT_PATH "${PROJECT_SOURCE_DIR}/mk/other_unix/")
ELSE()

View File

@ -10,8 +10,8 @@ MegaGlest is an entertaining free (freeware and free software)
and open source cross-platform 3D real-time strategy (RTS) game,
where you control the armies of one of seven different factions:
Tech, Magic, Egypt, Indians, Norsemen, Persian or Romans. The
game is setup in one of 17 naturally looking settings, which
-like the unit models- are crafted with great appreciation for
game is played in one of 17 naturally looking settings, which,
like the unit models, are crafted with great attention to
detail. A lot of additional game data can be downloaded from
within the game at no cost.
@ -22,10 +22,12 @@ within the game at no cost.
[![intro](http://megaglest.org/uploads/images/trailer3.png)]
(http://downloads.megaglest.org/videos/megaglest_game_trailer_lq.webm)
If you want compile MegaGlest yourself then you should read the
[**tutorial**](https://docs.megaglest.org/MG/Development) or
[tutorial2](https://github.com/MegaGlest/megaglest-source/wiki/Git-How-To)
If you want to compile MegaGlest yourself, you should read the following:
[Development Tutorial](https://docs.megaglest.org/MG/Development)
[Git Workflow](https://github.com/MegaGlest/megaglest-source/wiki/Git-How-To)
go to the [Main Repository](https://github.com/MegaGlest/megaglest-source)
( e.g. from the fork ... )
Return to the main (upstream) repository [**here**](https://github.com/MegaGlest/megaglest-source)

@ -1 +1 @@
Subproject commit c256b69196d8aae7f00b833e75d6acdcb73953b0
Subproject commit 2bafae40da1a8c358920970bff46b08b0e8daf90

View File

@ -4,6 +4,22 @@ MEGAGLEST CHANGELOG
To see a timeline of detail changes please visit:
https://github.com/MegaGlest/megaglest-source/commits/master
v3.13.0
- important sounds like "attack alarm" are always played
- display build/morph/upgrade time
- new AI tag <ai-build-size> for units(buildings) which allows fake size for buildings
while placing them
- much better error handling and messages especially for modders and xml-related problems
- fix unwanted double event for some keys ( like alt+enter )
- map filter option for game setup on headless server
- option to select/command multiple buildings of same type ( uniform-selection )
- major cross platform OOS fix which especially showed up quite often when playing without
fog of war
- you must prove basic game knowledge before you can play online by winning a special scenario
- less visible parts of black squares while rendering cliffs
- possibility to let units spawn units on death
- improved AI behavior per faction ( mostly magic )
v3.12.0
- MegaGlest uses SDL2 now
- glowing meshes. ( models can glow like particles do )
@ -16,12 +32,12 @@ v3.12.0
v3.11.1
- no more false clicks when commanding via mini map
- map editor has a more useful and powerful map height randomizer
- map editor saves all maps with .mgm ending by default.
- map editor saves all maps with .mgm ending by default
- fixed map editor ( several linux distributions had trouble )
- for missing tilesets and techs optional download from mod center instead of server. (bugfix)
- healthbar default set to "if needed"
- nicer tilesets as defaults
- improved camera startposition on game start ( main building in center ).
- improved camera startposition on game start ( main building in center )
- attackBoosts: Ep + Hp regeneration is shown in description
- MegaGlest can be build easier on MacOS ( sadly noone was willing to test )

View File

@ -5,33 +5,28 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build instructions for Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Architecture
~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. Architecture ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Developed on Linux with glibc, little endian CPU. While MacIntel builds exist
(for some versions of the game), MegaGlest does not currently work on big
endian CPUs like PPC (though some unfinished patches for vanilla Glest float
around on the forums, e.g. http://forum.megaglest.org/?topic=1426#).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~ 2. Building and Installation ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2. Building and Installation
--- 2.1 Prerequesites ---
2.1 Prerequesites
Compiling MegaGlest requires the following dependencies to be installed:
The game depends on some tools and libraries to be present, before you can
start compiling it:
* Standard GNU compiler and additional tools (g++ version 3.2 or later is
* Standard GNU compiler and additional tools (g++ version 4.6.3 or later is
required at the moment)
* Kitware CMake 2.8 or later (used as build tool)
* Kitware CMake 2.8.2 or later (used as build tool)
* X11 libraries + headers
http://x.org/
* SDL 1.2.5 or later
* SDL 2.0.0 or later
http://libsdl.org/
* OpenGL
@ -46,9 +41,6 @@ start compiling it:
* wxWidgets
http://wxwidgets.org/
* Xerces-C
http://xerces.apache.org/xerces-c/
* OpenAL
http://openal.org/
@ -81,17 +73,10 @@ start compiling it:
* libdl
NOTE: We have produced a script that tries to install build dependencies on many
Linux distros. The script is located in mk/linux/setupBuildDeps.sh
NOTE: A script which tries to install build dependencies on many Linux distros
is located in mk/linux/setupBuildDeps.sh
If CMake reports that it cannot find some of the libraries, make sure that you
also have the ...-dev(el) packages installed that some distributions provide.
At this point we would like to thank all the authors of these helpful libraries
who made our development easy and straight forward.
2.2 Building
--- 2.2 Building ---
To build the game simply invoke the build script:
@ -100,93 +85,90 @@ To build the game simply invoke the build script:
This script manually calls cmake with some optional parameters. Feel free to
examine it and build manually using cmake.
2.3 Installation
--- 2.3 Installation --
We provide MojoSetup based installers for Linux and NSIS based installers for
Windows. By default, the Linux installers install to your home directory. The
Windows installers install to %ProgramFiles%, so to the systems' global scope.
Windows installers install to %ProgramFiles% (global system scope).
There are also community maintained packages available for several Linux and
BSD distributions. Please see the website, forums and wiki for details.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~ 3. Troubleshooting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3. Troubleshooting
--- General ---
* Make sure both the hardware and software of your system match the requirements
* If you cannot find what you are looking for on here please check the FAQs
(https://docs.megaglest.org/MG/FAQ) before contacting the developers.
Some hints for troubleshooting.
--- Compiling ---
* If CMake reports that it cannot find some of the libraries, make sure that
the relevant ...-dev(el) packages are also installed (distro-dependent).
In General:
* Make sure both hard- and software of your system match the requirements
* Sound is played through OpenAL - you might need to take a look at your
configuration: http://supertux.lethargik.org/wiki/OpenAL_Configuration
Compiling:
* If CMake fails make sure you have read all of section 2.1 above.
Sound/Audio errors when starting:
--- Sound/Audio ---
* If the game doesn't start because of audio/sound errors:
Make sure no other application is using your soundcard. Typical problems are
the Gnome/KDE sound dameons esd and artsd. You can kill these daemons with
killall esd ; killall artsd
* If this doesn't solve your sound problems try to get an updated OpenAL from
the following commands:
# killall esd ; killall artsd
* If this doesn't solve the sound problems, get an updated OpenAL from
http://openal.org or a newer repository provided by your distribution.
The game complains about OpenGL 1.3 not available, is missing OpenGL extensions
or works very slowly:
* Look at glxinfo and make sure the system is using the drivers you want to
use. If you have a NVIDIA or AMD/ATI graphics card then consider using the
proprietary drivers (where available), which usually provide much better
* Sound is played through OpenAL - double-check the OpenAL system
configuration: http://supertux.lethargik.org/wiki/OpenAL_Configuration
--- OpenGL ---
* If the game produces error messages regarding OpenGL or OpenGL extensions
being unavailable, look at glxinfo and make sure the system is using the
drivers you want to use. If you have a NVIDIA or AMD/ATI graphics card then
consider using the proprietary drivers, which may provide better
performance than the open source drivers most distributions use by default.
Most Intel graphics chips use an open source driver on Linux, based on Mesa
("glxinfo | grep -i mesa"). This hardware is much slower than any dedicated
graphics cards produced during the past few years. The same holds true for
AMD APUs, the graphics chips embedded into AMD processors.
AMD APUs (the graphics chips embedded into AMD processors).
The game crashes:
--- Crashing ---
* Check the forums at http://forums.megaglest.org/
* It would be nice if you could report any crashes and freezes that are not yet
described on the forums, preferably with a gdb backtrace from a debugging
enabled build (cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo)
* Please report any crashes and freezes that are not yet described on the forums,
preferably with a gdb backtrace from a debugging enabled build
(cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4. More information
~~~~~~~~~~~~~~~~~~~~~~~~~~ 4. More information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Website
http://megaglest.org/
* Wiki
http://wiki.megaglest.org/
https://docs.megaglest.org/Main_Page
* Forums
http://forum.megaglest.org/
http://forums.megaglest.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5. Contact + Credits ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* MegaGlest is developed by:
Titus Tscharntke (info@titusgames.de)
Mark Vejvoda (www.soft-haus.com - mark_vejvoda@hotmail.com)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* General contact:
contact@megaglest.org
5. Contact + Credits
* MegaGlest is a fork of Glest:
http://glest.org/
MegaGlest is developed by:
Titus Tscharntke (info@titusgames.de)
Mark Vejvoda (www.soft-haus.com - mark_vejvoda@hotmail.com)
General contact:
contact@megaglest.org
Website:
http://megaglest.org
MegaGlest is a fork of Glest:
http://glest.org/
Linux port by:
Matthias Braun <matze@braunis.de> with help from Karl Robillard
<krobbillard@san.rr.com>
Please also refer to the copyright file.
* Linux port by:
Matthias Braun
<matze@braunis.de>
with help from
Karl Robillard
<krobbillard@san.rr.com>
*** Please also refer to the copyright file. ***
On Debian GNU/Linux systems please find license information in:
/usr/share/common-licenses

View File

@ -4,85 +4,84 @@
by Titus Tscharntke and Mark Vejvoda
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Build instructions for Windows
Build Instructions for Windows
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1. Architecture
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. Architecture ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Developed on Windows with Microsoft Visual C++ 2010 Express (free version),
Developed on Windows with Microsoft Visual Studio Community 2015,
little endian CPU. Compiling using the mingw32 toolset is experimental, which
also allows for cross compiling.
On Debian GNU/Linux systems please find license information in:
/usr/share/common-licenses
Also see Build Instructions for Linux
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~ 2. Building and Installation ~~~~~~~~~~~~~~~~~~~~~~~~
2. Building and Installation
2.1 Prerequesites
--- 2.1 Prerequesites ---
To build the game, the following tools and libraries must be present:
* Microsoft Visual C++ Express 2010
OR
- Pick 1:
* Microsoft Visual Studio Community 2015
https://www.microsoft.com/en-us/download/details.aspx?id=48146
(Experimental Microsoft Visual C++ Express 2012 projects also exist in the vc2012
folder)
* mingw32
* Experiemtnal Microsoft Visual C++ Express 2012 projects also exist in the vc2012
folder
* MegaGlest Windows 32 bit dependencies for building with VC++:
https://github.com/MegaGlest/megaglest-source/releases/download/3.2.3/windows_deps.7z
OR
http://mingw.org/
- Pick 1:
* MegaGlest dependencies for building with VC++, which which will be downloaded
automatically in 'Option A' (see below)
* MegaGlest Windows 32 bit dependencies for building with mingw:
https://github.com/MegaGlest/megaglest-source/releases/download/3.2.3/win32_deps_mingw.7z
These include:
- These include:
* Xerces-C
http://xerces.apache.org/xerces-c/
* wxWidgets
http://wxwidgets.org/
And many more.
* For a more verbose list, please inspect the archive contents and refer to the
* And many more. For a more verbose list, please inspect the archive contents and refer to the
Linux build instructions.
2.2 Building
--- 2.2 Building ---
To build and install the game proceed as follows:
Option A) (recommended) Automated build on the command line:
*** Option A ~ (recommended) Automated build on the command line:
1. Open a command prompt and navigate to the root folder where you have acquired the source code.
2. cd mk\windoze
3. build-mg-2010.bat (build-mg-2012.bat for vc 2012)
3. build-mg-2015.bat (or build-mg32bit-2015.bat for 32 bit build)
4. megaglest.exe --version
5. megaglest.exe
Option B) Using VC++ IDE:
*** Option B ~ Using VC++ IDE:
1. Download the dependencies archive listed above and decompress its contents
into the 'source' directory (where you see glest_game, g3d_viewer, etc).
This should create a subdirectory called "win32_deps" with many files and
1. Download the dependencies archive (which one and from where you can find
out in the "code" of build-...bat script from 'Option A' approach, some line
with "wget.exe") and decompress its contents into the 'source' directory. This
should create a subdirectory called "windows_deps..." with many files and
subdirectories in it.
2. Start the Visual C++ 2010 IDE and open the solution file:
\mk\windoze\Glest-2010.sln
2. Start the Visual C++ 2015 IDE and open the solution file:
\mk\windoze\Glest_vc2015.sln
3. Right Click on the top level 'Glest' node in Solution Explorer and select
'Rebuild All'.
'Rebuild All' (choose release mode or release with debug info).
If you had no errors all binaries will be created in \data\glest_game.
Before running MegaGlest you must run CopyWindowsRuntimeDlls_2010.bat.
You should now be able to just run megaglest.exe.
Note: If you had no errors all binaries will be created.
Before running MegaGlest you must run CopyWindowsRuntimeDlls_2015.bat.
You should now be able to just run megaglest.exe.
2.3 Installation
--- 2.3 Installation ---
We provide NSIS based installation packages. By default, these will create a
system-wide installation below %ProgramFiles% and setup Desktop icons for
@ -90,70 +89,64 @@ simplified access. User specific configuration will be stored within the
directory tree the %AppData% environment variable points to.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 3. Troubleshooting ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
3. Troubleshooting
--- General ---
* Make sure that the hardware and software of your system match the
requirements
Some hints for troubleshooting.
In General:
* Make sure both hard- and software of your system match the requirements
* Sound is played through OpenAL - you might need to take a look at your
configuration: http://supertux.lethargik.org/wiki/OpenAL_Configuration
Compiling:
* If you cannot find what you are looking for on here please check the FAQs
(https://docs.megaglest.org/MG/FAQ) before contacting.
--- Compiling ---
* If configure fails make sure you have read the Building section above
Sound/Audio errors when starting:
--- Sound/Audio errors when starting ---
* If the game doesn't start because of audio/sound errors:
Make sure no other application is using your soundcard.
* If this doesn't solve your sound problems try to get an updated OpenAL from
http://openal.org
* Sound is played through OpenAL - you might need to take a look at your
configuration: http://supertux.lethargik.org/wiki/OpenAL_Configuration
The game complains about OpenGL 1.3 not available, is missing OpenGL extensions
or works very slowly:
--- The game complains that OpenGL 1.3: is not available, is missing OpenGL
extensions, or works very slowly ---
* Try to get updated graphics drivers.
The game crashes:
-- The game crashes ---
* Check the forums at http://forums.megaglest.org/
* It would be nice if you could report any other crashes and freezes that are
not yet described on the forums, preferably with a backtrace from a
debugging enabled build
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4. More information
* Please report any other crashes and freezes that are not yet described on
the forums, preferably with a backtrace from a debugging enabled build
~~~~~~~~~~~~~~~~~~~~~~~~~~ 4. More information ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* Website
http://megaglest.org/
* Wiki
http://wiki.megaglest.org/
https://docs.megaglest.org/Main_Page
* Forums
http://forums.megaglest.org/
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 5. Contact + Credits ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* MegaGlest is developed by:
Titus Tscharntke (info@titusgames.de)
Mark Vejvoda (www.soft-haus.com - mark_vejvoda@hotmail.com)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* General contact:
contact@megaglest.org
5. Contact + Credits
* MegaGlest is a fork of Glest:
http://glest.org/
MegaGlest is developed by:
Titus Tscharntke (info@titusgames.de)
Mark Vejvoda (www.soft-haus.com - mark_vejvoda@hotmail.com)
* Linux port by:
Matthias Braun
<matze@braunis.de>
with help from
Karl Robillard
<krobbillard@san.rr.com>
General contact:
contact@megaglest.org
Website:
http://megaglest.org
MegaGlest is a fork of Glest:
http://glest.org/
Linux port by:
Matthias Braun <matze@braunis.de> with help from Karl Robillard
<krobbillard@san.rr.com>
Please also refer to the copyright file.
*** Please also refer to the copyright file. ***

View File

@ -33,8 +33,8 @@ To build this archive open a terminal and from the mk/linux folder run:
This will produce megaglest-source-<VERSION>.tar.xz in the release subfolder
#2. The embedded source archive:
This archive contains 3rd party source code for binary compilation of the application and
tools (which is often already included in Linux distros)
This archive contains 3rd party source code for binary (and data) compilation of the
application and tools (which is often already included in Linux distros)
The naming convention for the source archive is:
megaglest-source-embedded-<VERSION>.tar.xz
@ -100,37 +100,22 @@ Linux Installer(s):
mojosetup on the platform that is building the installer.
For either 32 or 64 bit Linux installers open a terminal and navigate to:
mk/linux/tools-for-standalone-client/installer
mk/linux/mojosetup
mkdir build
cd build
cmake ../
make
cd ../
-----------------------
-- deprecation start --
NOTE this part is now deprecated as it is handled by the synch script above
but the info is left here for education
#2 Navigate into the megaglest-installer subfolder and modify / save changes:
#2 Occasionally navigate into the 'scripts' subfolder and modify / save changes:
- config.lua
local GAME_INSTALL_SIZE = 680000000;
local GAME_VERSION = "3.6.0";
-- deprecation end --
---------------------
Now in a terminal session from inside the megaglest-installer folder run:
------------------------
Now in a terminal session from inside the 'installer' folder run:
./make.sh
When complete this will produce the platform specific installer in the same
folder called:
folder called:
MegaGlest-Installer_<architecture>_<kernel>.run
MegaGlest-Installer_<version>_<architecture>_<kernel>.run
This is a native binary installer that wil install MegaGlest on the same
This is a native binary installer that wil install MegaGlest on the same
platform as was sued to build it. (ie: 32 or 64 bit Linux)

View File

@ -24,7 +24,7 @@
1. System requirements
Hardware requirements:
* >= 6th generation x86 CPU with 1.5 GHz or better
* >= 6th generation x86 CPU with 2.0 GHz or better
(modern CPU series with at least two cores of at least 1.5 Ghz recommended)
* 1.5 GB RAM
(2.0 GB RAM recommended)
@ -90,7 +90,7 @@ the administrative user (root) or via sudo, but as a normal (restricted) user.
The graphical installer will show up and display the MegaGlest license. Install
the game into a directory below your home directory (the default location of
~/.megaglest is fine) or any location of your choice (within the boundaries of
~/megaglest is fine) or any location of your choice (within the boundaries of
where your Linux user may write to). Once the installer completes, a MegaGlest
starter/shortcut will show up on your window managers' application menu.
@ -216,8 +216,8 @@ network slots and the other players have to join.
The best ways to find people to play a multi-player game are:
a) using the Internet Game menu
b) scheduling a game on the Glest forums
c) finding other players on the #megaglest IRC channel on irc.freenode.net.
b) scheduling a game on the MegaGlest forums
c) finding other players on the #megaglest-lobby IRC channel on irc.freenode.net.
For LAN play, clients may click the 'Find LAN games' menu item to find servers
with an open network slot on the local network (this uses UDP broadcasting).

View File

@ -25,7 +25,7 @@ ELSE()
FIND_LIBRARY(VORBIS_LIBRARY NAMES vorbis)
ENDIF()
#on macosx the vorbisfile library is part of the vorbisone...
#on macos the vorbisfile library is part of the vorbisone...
#IF(NOT APPLE)
# comment above is full of lies

1
mk/linux/.gitignore vendored
View File

@ -6,6 +6,7 @@
core
core.bak
core.1
/build/
/release/

View File

@ -20,12 +20,13 @@ MAKE_ONLY=0
CLANG_FORCED=0
WANT_STATIC_LIBS="-DWANT_STATIC_LIBS=ON"
FORCE_EMBEDDED_LIBS=0
GCC_FORCED_VERSION=0
LUA_FORCED_VERSION=0
FORCE_32BIT_CROSS_COMPILE=0
COMPILATION_WITHOUT=0
BUILD_MEGAGLEST_TESTS="ON"
while getopts "c:defhl:mnwx" option; do
while getopts "c:defg:hl:mnwx" option; do
case "${option}" in
c)
CPU_COUNT=${OPTARG}
@ -43,14 +44,19 @@ while getopts "c:defhl:mnwx" option; do
CLANG_FORCED=1
# echo "${option} value: ${OPTARG}"
;;
g)
GCC_FORCED_VERSION=${OPTARG}
echo "${option} value: ${OPTARG} GCC_FORCED_VERSION [${GCC_FORCED_VERSION}]"
;;
h)
echo "Usage: $0 <option>"
echo " where <option> can be: -c x, -d, -e, -f, -m, -n, -h, -l x, -w, -x"
echo " where <option> can be: -c x, -d, -e, -f, -m, -n, -h, -l x, -w, -x -g"
echo " option descriptions:"
echo " -c x : Force the cpu / cores count to x - example: -c 4"
echo " -d : Force DYNAMIC compile (do not want static libs)"
echo " -e : Force compile with EMBEDDED libraries"
echo " -f : Force using CLANG compiler"
echo " -g x : Force using GCC version x - example: -g 6"
echo " -l x : Force using LUA version x - example: -l 5.3"
echo " -m : Force running CMAKE only to create Make files (do not compile)"
echo " -n : Force running MAKE only to compile (assume CMAKE already built make files)"
@ -94,7 +100,7 @@ done
# Compiler selection
# Unless both the CC and CXX environment variables point to clang and clang++
# respectively, we use GCC. To enforce clang compilation:
# respectively, we use GCC. To enforce clang compilation:
# 1. Install clang (sudo apt-get install clang)
# 2. Set the two vars below:
# WANT_CLANG=YES and CLANG_BIN_PATH=<path_to_the_clang_binary>
@ -113,9 +119,9 @@ cd ${SCRIPTDIR}
BREAKPAD_ROOT="$SCRIPTDIR/../../google-breakpad/"
# CMake options
# The default configuration works fine for regular developers and is also used
# The default configuration works fine for regular developers and is also used
# by our installers.
# For more cmake/build options refer to
# For more cmake/build options refer to
# http://wiki.megaglest.org/Linux_Compiling#Building_using_CMake_by_Hand
EXTRA_CMAKE_OPTIONS=
@ -135,13 +141,13 @@ echo "CPU cores to be used: $NUMCORES"
# ----------------------------------------------------------------------------
if [ $MAKE_ONLY = 0 ]; then
if [ $MAKE_ONLY = 0 ]; then
mkdir -p build
fi
cd build
if [ $MAKE_ONLY = 0 ]; then
if [ $MAKE_ONLY = 0 ]; then
if [ -f 'CMakeCache.txt' ]; then rm -f 'CMakeCache.txt'; fi
fi
@ -160,54 +166,69 @@ if [ "$WANT_STATIC_LIBS" = "-DWANT_STATIC_LIBS=ON" ]; then
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DSTATIC_FontConfig=OFF"
fi
if [ "$distribution" != "Mageia" ]; then
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DWANT_USE_OpenSSL=OFF"
fi
case $distribution in
Debian)
case $release in
6.*|7.*) ;;
*)
6|6.*|7|7.*) ;;
8|8.*)
if [ "$WANT_STATIC_LIBS" = "-DWANT_STATIC_LIBS=ON" ]; then
echo 'Turning ON dynamic FTGL, LUA, JPEG, PNG ... and forcing use the embedded IRCCLIENT'
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DSTATIC_FTGL=OFF -DSTATIC_LUA=OFF -DSTATIC_JPEG=OFF -DSTATIC_PNG=OFF -DSTATIC_OGG=OFF -DFORCE_USE_EMBEDDED_Ircclient=ON"
# ^ static jpeg seems to work again, debian testing 18.01.2016
fi
if [ $CLANG_FORCED = 1 ]; then BUILD_MEGAGLEST_TESTS="OFF"; fi
;;
*)
if [ "$WANT_STATIC_LIBS" = "-DWANT_STATIC_LIBS=ON" ]; then
echo 'Turning ON dynamic FTGL, LUA, PNG ... and forcing use the embedded IRCCLIENT'
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DSTATIC_FTGL=OFF -DSTATIC_LUA=OFF -DSTATIC_PNG=OFF -DSTATIC_OGG=OFF -DFORCE_USE_EMBEDDED_Ircclient=ON"
fi
if [ $CLANG_FORCED = 1 ]; then BUILD_MEGAGLEST_TESTS="OFF"; fi
# ^ may be removed ~ when default clang's version will be 3.9+
;;
esac
;;
Ubuntu)
case $release in
10.*|11.*|12.*|13.*|14.*) ;;
*)
15.*|16.*)
if [ "$WANT_STATIC_LIBS" = "-DWANT_STATIC_LIBS=ON" ]; then
echo 'Turning ON dynamic FTGL, LUA, JPEG, PNG ... and forcing use the embedded IRCCLIENT'
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DSTATIC_FTGL=OFF -DSTATIC_LUA=OFF -DSTATIC_JPEG=OFF -DSTATIC_PNG=OFF -DSTATIC_OGG=OFF -DFORCE_USE_EMBEDDED_Ircclient=ON"
fi;;
fi
;;
*)
if [ "$WANT_STATIC_LIBS" = "-DWANT_STATIC_LIBS=ON" ]; then
echo 'Turning ON dynamic FTGL, LUA, PNG ... and forcing use the embedded IRCCLIENT'
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DSTATIC_FTGL=OFF -DSTATIC_LUA=OFF -DSTATIC_PNG=OFF -DSTATIC_OGG=OFF -DFORCE_USE_EMBEDDED_Ircclient=ON"
fi
;;
esac
;;
LinuxMint)
case $release in
13|13.*|14|15|16|17|17.*) ;;
*)
18|18.*|19|19.*)
if [ "$WANT_STATIC_LIBS" = "-DWANT_STATIC_LIBS=ON" ]; then
echo 'Turning ON dynamic FTGL, LUA, JPEG, PNG ... and forcing use the embedded IRCCLIENT'
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DSTATIC_FTGL=OFF -DSTATIC_LUA=OFF -DSTATIC_JPEG=OFF -DSTATIC_PNG=OFF -DSTATIC_OGG=OFF -DFORCE_USE_EMBEDDED_Ircclient=ON"
fi;;
esac
;;
SuSE|SUSE?LINUX|Opensuse)
case $release in
fi
;;
*)
if [ "$WANT_STATIC_LIBS" = "-DWANT_STATIC_LIBS=ON" ]; then
echo 'Turning ON dynamic CURL ...'
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DSTATIC_CURL=OFF"
fi;;
echo 'Turning ON dynamic FTGL, LUA, PNG ... and forcing use the embedded IRCCLIENT'
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DSTATIC_FTGL=OFF -DSTATIC_LUA=OFF -DSTATIC_PNG=OFF -DSTATIC_OGG=OFF -DFORCE_USE_EMBEDDED_Ircclient=ON"
fi
;;
esac
;;
Fedora)
SuSE|SUSE?LINUX|Opensuse|Fedora|Mageia)
case $release in
*)
if [ "$WANT_STATIC_LIBS" = "-DWANT_STATIC_LIBS=ON" ]; then
@ -225,9 +246,9 @@ case $distribution in
;;
esac
# If, in the configuration section on top of this script, the user has
# If, in the configuration section on top of this script, the user has
# indicated they want to use clang in favor of the default of GCC, use clang.
if [ $CLANG_FORCED = 1 ]; then
if [ $CLANG_FORCED = 1 ]; then
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DCMAKE_C_COMPILER=${CLANG_BIN_PATH} -DCMAKE_CXX_COMPILER=${CLANGPP_BIN_PATH}"
echo "USER WANTS to use CLANG / LLVM compiler! EXTRA_CMAKE_OPTIONS = ${EXTRA_CMAKE_OPTIONS}"
#exit 1;
@ -249,6 +270,11 @@ elif [ "`echo $CC | grep -oF 'clang'`" = 'clang' -a "`echo $CXX | grep -oF 'clan
#exit 1;
fi
if [ "$GCC_FORCED_VERSION" != "0" ] && [ "$GCC_FORCED_VERSION" != "" ]; then
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DCMAKE_C_COMPILER=$(which gcc-$GCC_FORCED_VERSION) -DCMAKE_CXX_COMPILER=$(which g++-$GCC_FORCED_VERSION)"
echo "USER WANTS TO FORCE USE of GCC $GCC_FORCED_VERSION"
fi
if [ "$LUA_FORCED_VERSION" != "0" ] && [ "$LUA_FORCED_VERSION" != "" ]; then
EXTRA_CMAKE_OPTIONS="${EXTRA_CMAKE_OPTIONS} -DFORCE_LUA_VERSION=$LUA_FORCED_VERSION"
#echo "USER WANTS TO FORCE USE of LUA $LUA_FORCED_VERSION"
@ -291,6 +317,6 @@ else
echo ''
echo 'To launch MegaGlest from the current directory, use:'
echo ' ./megaglest'
echo 'Or change into mk/linux and run it from there:'
echo ' ./megaglest --ini-path=./ --data-path=./'
#echo 'Or change into mk/linux and run it from there:'
#echo ' ./megaglest --ini-path=./ --data-path=./'
fi

View File

@ -9,7 +9,7 @@
# Requires:
# - curl, built with SSL support, in $PATH
# - wget, built with SSL support, in $PATH
# - 7z (command line utility of 7-zip), in $PATH
# - tar, in $PATH
# - Coverity Scan Build Tool, in $PATH
#
@ -20,10 +20,7 @@ export LANG=C
CURRENTDIR="$(dirname $(readlink -f $0))"
echo "Script path [${CURRENTDIR}]"
# Load shared functions
. $CURRENTDIR/mg_shared.sh
# Project name (case sensitive)
# Project title on Coverity Scan (case sensitive)
PROJECT=MegaGlest
# Coverity Scan project token as listed on the Coverity Scan project page
@ -47,19 +44,18 @@ fi
# echo "Read config values: TOKEN [$TOKEN] EMAIL [$EMAIL] COVERITY_ANALYSIS_ROOT [$COVERITY_ANALYSIS_ROOT] NUMCORES [${NUMCORES}]"
# exit 1
GITBRANCH=$(git rev-parse --abbrev-ref HEAD | tr '/' '_')
GITVERSION_SHA1=$(git log -1 --format=%h)
GITBRANCH=$(git rev-parse --abbrev-ref HEAD | tr '/' '-')
GITVERSION_SHA1=$(git log -1 --format=%h --abbrev=7)
GITVERSION_REV=$(git rev-list HEAD --count)
VERSION=${GITBRANCH}.${GITVERSION_REV}.${GITVERSION_SHA1}
# Included from shared functions
detect_system
distribution=$(lsb_release -si | tr '[A-Z]' '[a-z]' | tr '[._]' '-')
dist_release=$(lsb_release -sr | tr '[A-Z]' '[a-z]' | tr '[._]' '-')
architecture=$(uname -m | tr '[A-Z]' '[a-z]' | tr '[._]' '-')
hostname=$(hostname)
#DESCRIPTION=${distribution}-${release}-${architecture}_${hostname}
DESCRIPTION=${GITBRANCH}.${GITVERSION_SHA1}.${distribution}-${architecture}.${hostname}
FILENAME=${PROJECT}.${DESCRIPTION}
DESCRIPTION=${GITBRANCH}-${GITVERSION_SHA1}_${distribution}_${architecture}_${hostname}
FILENAME=$(echo "${PROJECT}" | tr '/' '_')_${DESCRIPTION}
# echo "FILENAME = [${FILENAME}]"
# exit 1
@ -70,32 +66,23 @@ FILENAME=${PROJECT}.${DESCRIPTION}
export PATH="${PATH}:${COVERITY_ANALYSIS_ROOT}/bin"
# cleanup old build files
# rm -rf ../../build && ../../build-mg.sh -m 1
#cd ../../
cd $CURRENTDIR
rm -rf build
./build-mg.sh -m 1
# Build megaglest using coverity build tool
# cov-build --dir $BUILDTOOL ../../build-mg.sh -n 1 -c 4
# Build using Coverity Scan build tool
cd build/
cov-build --dir ${BUILDTOOL} make -j ${NUMCORES}
# Create archive to upload to coverity
7z a ${FILENAME}.tar ${BUILDTOOL}/
7z a ${FILENAME}.tar.gz ${FILENAME}.tar
rm -rf ${FILENAME}.tar
tar czf ${FILENAME}.tar.gz ${BUILDTOOL}/
ls -la ${FILENAME}.tar.gz
# exit 1
echo "Running curl to upload analysis file..."
# echo "curl --progress-bar --insecure --form \"project=${PROJECT}\" --form \"token=${TOKEN}\" --form \"email=${EMAIL}\" --form \"version=${VERSION}\" --form \"description=${DESCRIPTION}\" --form \"file=@${FILENAME}.tar.gz\" https://scan5.coverity.com/cgi-bin/upload.py"
# exit 1
curl --progress-bar --insecure --form "token=${TOKEN}" --form "email=${EMAIL}" --form "version=${VERSION}" --form "description=${DESCRIPTION}" --form "file=@${FILENAME}.tar.gz" "https://scan.coverity.com/builds?project=${PROJECT}" | tee -a "coverity-scan.log" ; test ${PIPESTATUS[0]} -eq 0
curl --progress-bar --insecure --form "token=${TOKEN}" --form "email=${EMAIL}" --form "version=${VERSION}" --form "description=${DESCRIPTION}" --form "file=@${FILENAME}.tar.gz" "https://scan.coverity.com/builds?project=${PROJECT}" | tee -a "coverity-scan.log"
echo "CURL returned: $?"
if [ $? != 0 ]; then
if [[ ${PIPESTATUS[0]} -ne 0 ]]; then
echo "An error occurred trying to send the archive to coverity. Error: $?"
else
echo "CURL was SUCCESSFUL!"
@ -105,4 +92,3 @@ fi
# This currently fails to detect the following error situation, as reported in the HTML of the HTTP response (to the upload request):
# ERROR: Too many build submitted. Wait for few days before submitting next build: Refer build frequency at https://scan.coverity.com/faq#frequency

View File

@ -1,28 +1,28 @@
#!/bin/bash
LANG=en_US.utf-8
export LANG=C
cd "$(dirname $(readlink -f $0))"
echo STAGE 1/3 - GIT PULL
echo "STAGE 1/3 - GIT PULL"
echo
echo Entering ../..
echo "Entering '../..'"
git pull
echo
git submodule foreach 'git pull; echo'
echo
echo
echo STAGE 2/3 - GIT BRANCH
echo "STAGE 2/3 - GIT BRANCH"
echo
echo Entering ../..
echo "Entering '../..'"
git branch
echo
git submodule foreach 'git branch; echo'
echo
echo STAGE 3/3 - GIT STATUS
echo "STAGE 3/3 - GIT STATUS"
echo
echo Entering ../..
echo "Entering '../..'"
git status
echo
git submodule foreach 'git status; echo'

View File

@ -60,11 +60,13 @@ FontMenuNormalPrefix=-*-arial-*-r-*-*-
FontMenuVeryBigBaseSize=25
FontSizeAdjustment=0
FONT_HEIGHT_TEXT=yW
InternetGamesBlockScenario=lobby_access
Lang=english
MaxLights=3
Masterserver=http://master.megaglest.org/
NetPlayerName=newbie
NetworkConsistencyChecks=true
NetworkInterfaces=lo,eth,wlan,vlan,vboxnet,br-lan,br-gest,enp0s,enp1s,enp2s,enp3s,enp4s,enp5s,enp6s,enp7s,enp8s,enp9s
PhotoMode=false
PortList=61357,61367,61377,61387,61397
PortServer=61357

View File

@ -5,9 +5,13 @@
# Copyright (c) 2011 Mark Vejvoda under GNU GPL v3.0+
LANG=C
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
# set this to non 0 to skip building the binary
skipbinarybuild=0
if [ "$1" = "-CI" ] || [ "$1" = "--installer" ]; then skipbinarybuild=1; fi
if [ "$1" = "-CI" ] || ( [ "$1" = "--installer" ] && \
[ "$(find "$CURRENTDIR" -maxdepth 1 -name 'megaglest' -mmin -60)" ] ); then
skipbinarybuild=1
fi
# Consider setting this for small packages if there's plenty of RAM and CPU available:
#export XZ_OPT="$XZ_OPT -9e"
@ -16,7 +20,6 @@ if [ "$1" = "-CI" ] || [ "$1" = "--installer" ] || [ "$(echo "$1" | grep '\--sho
if [ "$2" != "" ]; then SOURCE_BRANCH="$2"; fi
fi
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
cd "$CURRENTDIR"
VERSION=`./mg-version.sh --version`
kernel=`uname -s | tr '[A-Z]' '[a-z]'`
@ -29,7 +32,7 @@ REPO_DATADIR="$REPODIR/data/glest_game"
if [ -d "$REPODIR/.git" ] && [ "$(which git 2>/dev/null)" != "" ]; then
cd "$REPODIR"
if [ "$SOURCE_BRANCH" = "" ]; then SOURCE_BRANCH="$(git branch | awk -F '* ' '/^* / {print $2}')"; fi
SOURCE_COMMIT="$(echo "[$(git rev-list HEAD --count).$(git log -1 --format=%h)]")"
SOURCE_COMMIT="$(echo "[$(git rev-list HEAD --count).$(git log -1 --format=%h --abbrev=7)]")"
fi
ARCHIVE_TYPE="tar.xz"
SNAPSHOTNAME="mg-binary-$kernel-$architecture"
@ -66,12 +69,12 @@ fi
cd $PROJDIR
mkdir -p "$RELEASEDIR/lib"
[[ -d "lib" ]] && rm -rf "lib"
if [ -d "lib" ]; then rm -rf "lib"; fi
echo "building binary dependencies ..."
./makedeps_folder.sh megaglest
if [ $? -ne 0 ]; then
echo 'ERROR: "./makedeps_folder.sh megaglest" failed.' >&2; exit 2
fi
for mg_bin in megaglest megaglest_editor megaglest_g3dviewer; do
./makedeps_folder.sh "$mg_bin"
if [ "$?" -ne "0" ]; then echo "ERROR: \"./makedeps_folder.sh $mg_bin\" failed." >&2; exit 2; fi
done
# copy binary info
cd $PROJDIR
@ -83,12 +86,12 @@ cd $REPO_DATADIR/others/icons
cp *.bmp *.png *.xpm "$RELEASEDIR/"
if [ "$1" != "--installer" ]; then cd $REPO_DATADIR/others/desktop; cp *.desktop "$RELEASEDIR/"; fi
cd $PROJDIR
cp megaglest megaglest_editor megaglest_g3dviewer start_megaglest \
start_megaglest_mapeditor start_megaglest_g3dviewer \
start_megaglest_gameserver "$RELEASEDIR/"
cp megaglest megaglest_editor megaglest_g3dviewer start_megaglest_gameserver "$RELEASEDIR/"
cd "$CURRENTDIR/tools-for-standalone-client"
cp start_megaglest start_megaglest_mapeditor start_megaglest_g3dviewer "$RELEASEDIR/"
if [ "$1" != "--installer" ]; then cp megaglest-configure-desktop.sh "$RELEASEDIR/"; fi
if [ "$(echo "$VERSION" | grep -v '\-dev$')" != "" ]; then
./prepare-mini-update.sh --only_script; sleep 0.5s
cp megaglest-mini-update.sh "$RELEASEDIR/"

View File

@ -25,14 +25,14 @@ if [ -f "$REPO_DATADIR/.git" ] && [ "$(which git 2>/dev/null)" != "" ]; then
DATA_BRANCH="$(git branch | grep '^* ' | awk '{print $2}')"
# on macos are problems with more advanced using awk ^
DATA_COMMIT_NR="$(git rev-list HEAD --count)"
DATA_COMMIT="$(echo "[$DATA_COMMIT_NR.$(git log -1 --format=%h)]")"
DATA_COMMIT="$(echo "[$DATA_COMMIT_NR.$(git log -1 --format=%h --abbrev=7)]")"
DATA_HASH=$(git log -1 --format=%H)
fi
if [ -d "$REPODIR/.git" ] && [ "$(which git 2>/dev/null)" != "" ]; then
cd "$REPODIR"
if [ "$SOURCE_BRANCH" = "" ]; then SOURCE_BRANCH="$(git branch | grep '^* ' | awk '{print $2}')"; fi
# on macos are problems with more advanced using awk ^
SOURCE_COMMIT="$(echo "[$(git rev-list HEAD --count).$(git log -1 --format=%h)]")"
SOURCE_COMMIT="$(echo "[$(git rev-list HEAD --count).$(git log -1 --format=%h --abbrev=7)]")"
if [ "$DATA_HASH" = "" ]; then DATA_HASH=$(git submodule status "$REPO_DATADIR" | awk '{print $1}'); fi
fi
classic_snapshot_for_tests=0
@ -53,16 +53,38 @@ elif [ "$1" = "--show-result-path2" ]; then echo "${RELEASEDIR_ROOT}/$RELEASENAM
DATA_HASH_MEMORY="$RELEASEDIR_ROOT/data_memory"
DATA_HASH_FILE="$DATA_HASH_MEMORY/$VERSION-$SOURCE_BRANCH.log"
if [ ! -d "$DATA_HASH_MEMORY" ]; then mkdir -p "$DATA_HASH_MEMORY"; fi
SyncNote() {
echo; echo " This situation is allowed for \"git submodule\", but in MG case it usually mean sync to wrong data commit. In case of wrong sync, to fix the situation someone should again commit in the megaglest-source repo the recent data HASH. If sync to older data wasn't a mistake then just ignore this warning."; echo
}
if [ "$DATA_HASH" != "" ]; then
if [ ! -e "$DATA_HASH_FILE" ]; then
echo "$DATA_HASH $DATA_COMMIT_NR" > "$DATA_HASH_FILE"
elif [ "$(cat "$DATA_HASH_FILE" | grep "$DATA_HASH")" = "" ]; then
DATA_COMMIT_PREV_NR="$(cat "$DATA_HASH_FILE" | head -1 | awk '{print $2}')"
if [ "$DATA_COMMIT_PREV_NR" != "" ] && [ "$DATA_COMMIT_NR" -lt "$DATA_COMMIT_PREV_NR" ]; then
echo " warning: Detected older git revision of data than previously, $DATA_COMMIT_NR < $DATA_COMMIT_PREV_NR."
if [ -e "$DATA_HASH_FILE" ]; then
CAT_DATA_HASH_FILE="$(cat "$DATA_HASH_FILE" | head -1)"
DATA_COMMIT_PREV_NR="$(echo "$CAT_DATA_HASH_FILE" | awk '{print $2}')"
DATA_COMMIT_LATEST_NR="$(echo "$CAT_DATA_HASH_FILE" | awk '{print $3}')"
else
echo "$DATA_HASH $DATA_COMMIT_NR $DATA_COMMIT_NR" > "$DATA_HASH_FILE"
fi
if [ -e "$DATA_HASH_FILE" ] && [ "$DATA_COMMIT_PREV_NR" != "" ]; then
if [ "$DATA_COMMIT_NR" -lt "$DATA_COMMIT_PREV_NR" ]; then
echo; echo " warning: Detected older git revision of data than previously, $DATA_COMMIT_NR < $DATA_COMMIT_PREV_NR."
SyncNote
else
if [ "$DATA_COMMIT_LATEST_NR" != "" ] && [ "$DATA_COMMIT_NR" -lt "$DATA_COMMIT_LATEST_NR" ]; then
echo; echo " warning: Detected older git revision of data than synced in the past, $DATA_COMMIT_NR < $DATA_COMMIT_LATEST_NR."
SyncNote
if [ "$DATA_COMMIT_NR" -gt "$DATA_COMMIT_PREV_NR" ]; then DATA_COMMIT_LATEST_NR="$DATA_COMMIT_NR"; fi
# ^ first sync commit -gt than the wrong one = warning seen for last time, so situation still may be not fixed, but is most likely improved and we avoid endless warnings
fi
if [ "$1" != "--installer" ] && [ "$(echo "$CAT_DATA_HASH_FILE" | grep "$DATA_HASH")" != "" ]; then
echo; echo " NOTE: The archive wasn't created because for almost sure it would be exactly the same like last time (the same commit) and new creation date would convince many users to download it again."; echo
exit 0
fi
fi
echo "$DATA_HASH $DATA_COMMIT_NR" > "$DATA_HASH_FILE"
else exit 0; fi
if [ "$DATA_COMMIT_LATEST_NR" = "" ] || [ "$DATA_COMMIT_NR" -gt "$DATA_COMMIT_LATEST_NR" ]; then
DATA_COMMIT_LATEST_NR="$DATA_COMMIT_NR"
fi
echo "$DATA_HASH $DATA_COMMIT_NR $DATA_COMMIT_LATEST_NR" > "$DATA_HASH_FILE"
fi
fi
cd "$CURRENTDIR"

View File

@ -75,6 +75,12 @@ mkdir -p "$RELEASEDIR/tutorials/"
cd "$RELEASEDIR/tutorials/"
git archive --remote ${REPODIR}/data/glest_game/ HEAD:tutorials | tar x
echo "Exporting files from 'others' directory ..."
cd "$RELEASEDIR"
mkdir -p "$RELEASEDIR/others/"
cd "$RELEASEDIR/others/"
git archive --remote ${REPODIR}/data/glest_game/ HEAD:others | tar x
echo "Removing non required files ..."
cd "$CURRENTDIR"
# START

View File

@ -22,16 +22,22 @@ sync_support_libs(){
local _cp="/bin/cp"
#local skip_deps="libm.so libpthread.so libstdc++.so libgcc_s.so libc.so libdl.so libX11.so libpulse libfusion libdirect libnvidia libXext librt libxcb libICE libSM libXtst libwrap libdbus libXau libXdmcp libnsl libFLAC libGL"
local skip_deps=""
local keep_deps="libcurl libgnu libgcrypt libnghttp libidn librtmp libssh libnettle libicu liblua libjpeg libpng libwx libgtk libgdk libftgl libfreetype libvlc"
local keep_deps="libcurl libgnu libgcrypt libnghttp libidn libpsl libunistring librtmp libssh libnettle libicu liblua libjpeg libpng libvorbis libogg libircclient libminiupnpc libwx_ libGLEW libftgl libfreetype libvlc libopenal libSDL2-"
# libwx_ - recommended to keep always just because API/ABI compatibility, huge impact for map editor
# libGLEW - most likely safe to keep embedded everywhere, its version matters with tools
# libopenal - safe to keep but if any version is available locally then should be replaced
# libSDL2 - safe to keep on .deb family only and even there, if any version is available locally then should be replaced
# liblber & libldap_r - aren't safe to keep, very nasty secondary dependencies
# libunistring - is it enough popular to not be necessary there? not sure
local scan_via_skiplist=1
if [ -n "$skip_deps" ]; then
scan_via_skiplist=1
echo 'scanning for deps TO SKIP...'
elif [ -n "$keep_deps" ]; then
echo "scanning for deps TO SKIP for '$pFILE'..."
elif [ -n "$keep_deps" ]; then
scan_via_skiplist=0
echo 'scanning for deps TO KEEP...'
echo "scanning for deps TO KEEP for '$pFILE'..."
fi
@ -48,7 +54,7 @@ sync_support_libs(){
skipfile=0
if [ $scan_via_skiplist -eq 1 ]; then
if [ $scan_via_skiplist -eq 1 ]; then
for j in $(echo $skip_deps)
do
if [ `awk "BEGIN {print index(\"$i\", \"$j\")}"` -ne 0 ]; then
@ -57,7 +63,7 @@ sync_support_libs(){
break
fi
done
elif [ $scan_via_skiplist -eq 0 ]; then
elif [ $scan_via_skiplist -eq 0 ]; then
skipfile=1
for j in $(echo $keep_deps)
do
@ -69,7 +75,7 @@ sync_support_libs(){
done
fi
if [ $skipfile -eq 0 ]; then
if [ "$skipfile" -eq "0" ] && [ ! -e "$d/$(basename "$i")" ]; then
echo Including file = [$i]
${_cp} -f $i ${d}
fi
@ -91,9 +97,7 @@ usage(){
}
[ $# -eq 0 ] && usage
#[ ! -d $BASE ] && mkdir -p $BASE
[ -d $BASE ] && rm -r $BASE
mkdir -p $BASE
if [ ! -d "$BASE" ]; then mkdir -p "$BASE"; fi
# copy all files
for f in $file

View File

@ -11,6 +11,7 @@ CURRENT_VERSION=`./mg-version.sh --version`
OLD_VERSION=`./mg-version.sh --oldversion_binary`
VERSION_INFO_FILE="$(dirname "$(readlink -f "$0")")/../../source/version.txt"
LastCompatibleSaveGameVersion="$(awk -F '=' '/^LastCompatibleSaveGameVersion =/ {print $2}' "$VERSION_INFO_FILE" | awk -F '"' '{print $2}')"
CurrYear="$(date +%y)"
MapeditorVersion="$CURRENT_VERSION"
G3dviewerVersion="$CURRENT_VERSION"
modifymore="yes"
@ -23,6 +24,15 @@ sed -i 's/^const string glestVersionString = "[^"]*";$/const string glestVersio
echo 'Game version # after:'
grep -E '^const string glestVersionString = "[^"]*";$' ../../source/glest_game/facilities/game_util.cpp
echo
echo 'Game Copyright date # before:'
grep -E 'Copyright 2010-20[0-9][0-9] The MegaGlest Team' ../../source/glest_game/facilities/game_util.cpp
sed -i 's/Copyright 2010-20[0-9][0-9] The MegaGlest Team/Copyright 2010-20'$CurrYear' The MegaGlest Team/' ../../source/glest_game/facilities/game_util.cpp
grep -E '© 2001-20[0-9][0-9] The MegaGlest Team' ../../mk/macos/bundle_resources/Info.plist.in
sed -i 's/© 2001-20[0-9][0-9] The MegaGlest Team/© 2001-20'$CurrYear' The MegaGlest Team/' ../../mk/macos/bundle_resources/Info.plist.in
echo 'Game Copyright date # after:'
grep -E 'Copyright 2010-20[0-9][0-9] The MegaGlest Team' ../../source/glest_game/facilities/game_util.cpp
grep -E '© 2001-20[0-9][0-9] The MegaGlest Team' ../../mk/macos/bundle_resources/Info.plist.in
echo
if [ "$modifymore" = "yes" ]; then
# const string lastCompatibleSaveGameVersionString = "v3.9.0";
echo 'Compatible Save Game version # before:'
@ -33,16 +43,16 @@ if [ "$modifymore" = "yes" ]; then
echo
fi
if [ "$modifymore" = "yes" ] && [ "$(git status >/dev/null 2>&1; echo "$?")" -eq "0" ]; then
# const string GIT_RawRev = "$4446.1a8673f$";
GitCommitForRelease="`git rev-list HEAD --count`.`git log -1 --format=%h`";
# const string GIT_RawRev = "$4446.1a8673f$";
GitCommitForRelease="`git rev-list HEAD --count`.`git log -1 --format=%h --abbrev=7`";
echo 'GitCommitForRelease # before:'
grep -E '^GitCommitForRelease = "[^"]*";$' "$VERSION_INFO_FILE"
grep -E '^const string GIT_RawRev = "\$[^"$]*\$";$' ../../source/glest_game/facilities/game_util.cpp
grep -E '^ const string GIT_RawRev = "\$[^"$]*\$";$' ../../source/glest_game/facilities/game_util.cpp
sed -i 's/^GitCommitForRelease = "[^"]*";$/GitCommitForRelease = "'$GitCommitForRelease'";/' "$VERSION_INFO_FILE"
sed -i 's/^const string GIT_RawRev = "$[^"]*";$/const string GIT_RawRev = "$'$GitCommitForRelease'$";/' ../../source/glest_game/facilities/game_util.cpp
sed -i 's/^ const string GIT_RawRev = "$[^"]*";$/ const string GIT_RawRev = "$'$GitCommitForRelease'$";/' ../../source/glest_game/facilities/game_util.cpp
echo 'GitCommitForRelease # after:'
grep -E '^GitCommitForRelease = "[^"]*";$' "$VERSION_INFO_FILE"
grep -E '^const string GIT_RawRev = "\$[^"$]*\$";$' ../../source/glest_game/facilities/game_util.cpp
grep -E '^ const string GIT_RawRev = "\$[^"$]*\$";$' ../../source/glest_game/facilities/game_util.cpp
fi
echo
if [ "$modifymore" = "yes" ]; then
@ -54,6 +64,12 @@ if [ "$modifymore" = "yes" ]; then
echo 'Mapeditor version # after:'
grep -E '^const string mapeditorVersionString = "[^"]*";$' ../../source/glest_map_editor/main.cpp
echo
echo 'Mapeditor Copyright date # before:'
grep -E 'Copyright 2010-20[0-9][0-9] The MegaGlest Team' ../../source/glest_map_editor/main.cpp
sed -i 's/Copyright 2010-20[0-9][0-9] The MegaGlest Team/Copyright 2010-20'$CurrYear' The MegaGlest Team/' ../../source/glest_map_editor/main.cpp
echo 'Mapeditor Copyright date # after:'
grep -E 'Copyright 2010-20[0-9][0-9] The MegaGlest Team' ../../source/glest_map_editor/main.cpp
echo
echo '===== Updating G3dviewer ======'
# const string g3dviewerVersionString= "v1.3.6";
echo 'G3dviewer version # before:'

View File

@ -4,12 +4,26 @@
# Written by Mark Vejvoda <mark_vejvoda@hotmail.com>
# Copyright (c) 2011 Mark Vejvoda under GNU GPL v3.0+
OUTFILE=./cppcheck.log
# (Actual) Location of the cppcheck binary
CPPCHECK=$(readlink -f $(which cppcheck))
CPUS=`lscpu -p | grep -cv '^#'`
if [ "$CPUS" = '' ]; then CPUS=1; fi
# cppcheck now depends on this library (see 'cppcheck --help' for the '--library' option)
# If you use the Debian / Ubuntu package set this to: /usr/share/cppcheck/cfg/std.cfg
CPPCHECKLIB=$(dirname $CPPCHECK)/cfg/std.cfg
#~/cppcheck-1.62/cppcheck ../../source/ -i ../../source/win32_deps -i ../../source/configurator -i ../../source/shared_lib/sources/libircclient -i ../../source/shared_lib/sources/platform/miniupnpc -j $CPUS --enable=all --force --verbose 2> $OUTFILE
cppcheck ../../source/ -i ../../source/win32_deps -i ../../source/configurator -i ../../source/shared_lib/sources/libircclient -i ../../source/shared_lib/sources/platform/miniupnpc -i ../../source/shared_lib/sources/streflop -j $CPUS --enable=all --force --verbose 2> $OUTFILE
# File to write results to
LOGFILE=/tmp/cppcheck.log
echo "Results from cppcheck were written to $OUTFILE"
$CPPCHECK ../../source/ \
-i ../../source/win32_deps \
-i ../../source/configurator \
-i ../../source/shared_lib/sources/libircclient \
-i ../../source/shared_lib/sources/platform/miniupnpc \
-i ../../source/shared_lib/sources/streflop \
--library=$CPPCHECKLIB \
--enable=all \
--force \
--verbose \
2> $LOGFILE
echo "Results from cppcheck were written to $LOGFILE"

64
mk/linux/mg_shared.sh Normal file → Executable file
View File

@ -1,8 +1,8 @@
#!/bin/bash
#!/bin/sh
#
# Functions shared by several scripts
#
# Copyright (c) 2013-2016 MegaGlest Team under GNU GPL v3.0+
function detect_system {
# Determine distro title, release, codename
@ -18,48 +18,43 @@ function detect_system {
# codename: codename of the detected Linux distribution (string)
# architecture: detected machine architecture (string)
if [[ `which lsb_release` = '' ]]
then
if [ "$(which lsb_release)" = "" ]; then
lsb=0
if [ -e /etc/debian_version ]
then
release='unknown release'
if [ -e "/etc/os-release" ]; then
distribution="$(cat "/etc/os-release" | grep '^ID=' | awk -F '=' '{print $2}' \
| awk '{print toupper(substr($0,1,1))substr($0,2)}')"
codename="$(cat "/etc/os-release" | grep '^PRETTY_NAME=' | awk -F '"' '{print $2}')"
# example output ^ on debian testing: "Debian GNU/Linux stretch/sid"
elif [ -e /etc/debian_version ]; then
distribution='Debian'
release='unknown release version'
codename=`cat /etc/debian_version`
elif [ -e /etc/SuSE-release ]
then
codename="$(cat /etc/debian_version)"
elif [ -e /etc/SuSE-release ]; then
distribution='SuSE'
release='unknown release version'
codename=`cat /etc/SuSE-release`
elif [ -e /etc/redhat-release ]
then
if [ -e /etc/fedora-release ]
then
codename="$(cat /etc/SuSE-release)"
elif [ -e /etc/redhat-release ]; then
if [ -e /etc/fedora-release ]; then
distribution='Fedora'
release='unknown release version'
codename=`cat /etc/fedora-release`
else
codename="$(cat /etc/fedora-release)"
else
distribution='Redhat'
release='unknown release version'
codename=`cat /etc/redhat-release`
codename="$(cat /etc/redhat-release)"
fi
elif [ -e /etc/fedora-release ]
then
elif [ -e /etc/fedora-release ]; then
distribution='Fedora'
release='unknown release version'
codename=`cat /etc/fedora-release`
elif [ -e /etc/mandrake-release ]
then
codename="$(cat /etc/fedora-release)"
elif [ -e /etc/mandrake-release ]; then
distribution='Mandrake'
release='unknown release version'
codename=`cat /etc/mandrake-release`
codename="$(cat /etc/mandrake-release)"
else
distribution='unknown distribution'
codename='unknown codename'
fi
else
lsb=1
distribution=`lsb_release -i | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }'`
release=`lsb_release -r | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }'`
codename=`lsb_release -c | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }'`
distribution="$(lsb_release -i | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }')"
release="$(lsb_release -r | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }')"
codename="$(lsb_release -c | awk -F':' '{ gsub(/^[ \t]*/,"",$2); print $2 }')"
# Some distribution examples:
#
@ -89,6 +84,5 @@ function detect_system {
# Release: 12.04
# Codename: precise
fi
architecture=`uname -m`
architecture="$(uname -m)"
}

View File

@ -4,51 +4,60 @@
# ----------------------------------------------------------------------------
# Originally written by Mark Vejvoda <mark_vejvoda@hotmail.com>
# Rewritten by Tom Reynolds <tomreyn@megaglest.org>
# Copyright (c) 2012 Mark Vejvoda, Tom Reynolds under GNU GPL v3.0
# Copyright (c) 2012-2017 Mark Vejvoda, Tom Reynolds under GNU GPL v3.0
LANG=C
SCRIPTDIR="$(dirname $(readlink -f $0))"
gitcommit=`git log -1 --pretty=tformat:"%H" $SCRIPTDIR/../..`
SCRIPTDIR="$(dirname "$(readlink -f "$0")")"
# If you wanna only see the BuildDeps then launch script like that: './setupBuildDeps.sh --manually'.
# If you wanna see the BuildDeps for other linux distribution (mentioned in this script) then e.g.
# './setupBuildDeps.sh --manually "Debian"' is for you.
# If you wanna see the BuildDeps for other linux distribution (mentioned in this script) and for
# specific release (mentioned in this script) then e.g.
# './setupBuildDeps.sh --manually "Debian" "stable"' is for you.
# Load shared functions
. $SCRIPTDIR/mg_shared.sh
# Got root?
if [ `id -u`'x' != '0x' ]
then
echo 'This script must be run as root (UID 0).' >&2
if [ `id -u`'x' != '0x' ] && [ "$1" != "--manually" ]; then
echo 'This script should be run as root (UID 0).' >&2
exit 1
fi
# Do you have the 'git' command?
if [ `which git`'x' = 'x' ]
then
echo 'Could not find "git", please make sure it is installed.' >&2
exit 1
fi
# Allow for quiet/silent installs
if [ $1'x' = '-qx' -o $1'x' = '--quietx' -o $1'x' = '--silentx' ]
then
quiet=1
if [ "$(which git 2>/dev/null)" != "" ]; then
gitcommit="$(git log -1 --pretty=tformat:"%H" $SCRIPTDIR/../..)"
else
quiet=0
gitcommit="- 'git' tool not available -"
fi
# Included from shared functions
detect_system
echo 'We have detected the following system:'
echo ' [ '"$distribution"' ] [ '"$release"' ] [ '"$codename"' ] [ '"$architecture"' ]'
echo ''
echo 'On supported systems, we will now install build dependencies.'
echo ''
# Allow for quiet/silent installs or manual installation
if [ "$1" = "-q" ] || [ "$1" = "--quiet" ] || [ "$1" = "--silent" ]; then
quiet=1; manual_install=0
elif [ "$1" = "--manually" ]; then
quiet=0; manual_install=1
if [ "$2" != "" ]; then
distribution="$2"; codename="-"; lsb="-"
if [ "$3" != "" ]; then release="$3"; else release="-"; fi
fi
else
quiet=0; manual_install=0
fi
if [ "$manual_install" = "0" ]; then
echo 'We have detected the following system:'
echo ' [ '"$distribution"' ] [ '"$release"' ] [ '"$codename"' ] [ '"$architecture"' ]'
echo; echo 'On supported systems, we will now install build dependencies.'; echo
fi
common_info() {
echo ''
echo 'Please report a bug at http://bugs.megaglest.org providing the following information:'
echo
if [ "$1" != "no_install" ]; then
echo 'Please report a bug at http://bugs.megaglest.org providing the following information:'
fi
echo '--- snip ---'
echo 'Git revision: '"$gitcommit"
echo 'LSB support: '"$lsb"
@ -57,11 +66,12 @@ common_info() {
echo 'Codename: '"$codename"
echo 'Architecture: '"$architecture"
echo '--- snip ---'
echo ''
echo
if [ "$1" = "+wiki" ]; then
echo 'For now, you may want to take a look at the build hints on the MegaGlest wiki at:'
echo ' https://docs.megaglest.org/MG/Linux_Compiling'
echo 'If you can come up with something which works for you, please report back to us, too. Thanks!'
exit 1
fi
}
unsupported_distribution () {
@ -71,78 +81,82 @@ unsupported_distribution () {
unsupported_release () {
echo 'Unsupported '"$distribution"' release.' >&2
common_info
if [ "$installcommand" != '' ]
then
echo 'For now, please try this (which works with other '"$distribution"' releases) and report back how it works for you:'
echo $installcommand
if [ "$installcommand" != '' ]; then
echo 'For now, please try this (which works with other '"$distribution"' releases) and report back how it works for you:'; echo
echo "$installcommand"; echo
echo 'Thanks!'
fi
exit 1
}
error_during_installation () {
echo 'An error occurred while installing build dependencies.' >&2
common_info +wiki
install_command () {
if [ "$installcommand" = '' ]; then echo 'Error detected: Empty install command!' >&2; exit 1; fi
if [ "$manual_install" = "1" ]; then
echo 'Proposed command to use:'; echo
echo "$installcommand"
common_info no_install
else
$installcommand
if [ "$?" -ne "0" ]; then
echo 'An error occurred while installing build dependencies.' >&2
common_info +wiki
fi
fi
}
if [ "$quiet" -eq "1" ]; then
APT_OPTIONS="$APT_OPTIONS -y -q"
URPMI_OPTIONS="$URPMI_OPTIONS -q --auto"
PACMAN_OPTIONS="$PACMAN_OPTIONS -q --noconfirm"
DNF_OPTIONS="$DNF_OPTIONS -y -q"
fi
packages_for_next_debian_ubuntu_mint="build-essential cmake libcurl4-gnutls-dev libsdl2-dev libopenal-dev liblua5.3-dev libjpeg-dev libpng12-dev libfreetype6-dev libwxgtk3.0-dev libcppunit-dev libfribidi-dev libftgl-dev libglew-dev libogg-dev libvorbis-dev libminiupnpc-dev libircclient-dev libvlc-dev libvlccore-dev libxml2-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev librtmp-dev libkrb5-dev libldap2-dev libidn11-dev libgnutls28-dev libnghttp2-dev"
packages_for_next_debian_ubuntu_mint="build-essential cmake libcurl4-gnutls-dev libsdl2-dev libopenal-dev liblua5.3-dev libjpeg-dev libpng-dev libfreetype6-dev libwxgtk3.0-dev libcppunit-dev libfribidi-dev libftgl-dev libglew-dev libogg-dev libvorbis-dev libminiupnpc-dev libircclient-dev libvlc-dev libvlccore-dev libxml2-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev librtmp-dev libkrb5-dev libldap2-dev libidn2-0-dev libpsl-dev libgnutls28-dev libnghttp2-dev libssh2-1-dev"
case $distribution in
Debian)
case $release in
oldstable|7|7.*)
installcommand="apt-get install $APT_OPTIONS build-essential cmake libsdl2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libminiupnpc-dev librtmp-dev libgtk2.0-dev libcppunit-dev"
$installcommand
if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
;;
stable|8|8.*)
installcommand="apt-get install $APT_OPTIONS build-essential cmake libcurl4-gnutls-dev libsdl2-dev libopenal-dev liblua5.2-dev libjpeg-dev libpng12-dev libfreetype6-dev libwxgtk3.0-dev libcppunit-dev libfribidi-dev libftgl-dev libglew-dev libogg-dev libvorbis-dev libminiupnpc-dev libircclient-dev libvlc-dev libxml2-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev librtmp-dev libkrb5-dev libldap2-dev libidn11-dev libgnutls28-dev"
$installcommand
if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
;;
testing|unstable|9|9.0)
installcommand="apt-get install $APT_OPTIONS $packages_for_next_debian_ubuntu_mint"
$installcommand
if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
;;
*)
installcommand="apt-get install $APT_OPTIONS $packages_for_next_debian_ubuntu_mint"
unsupported_release; exit 1
unsupported_currently_this_OS="release"
;;
esac
;;
Ubuntu)
case $release in
12.04.2|12.04.3|12.04.4|14.04.2|14.04.3|14.04.4)
# "not so LTS" are those LTS v xD
installcommand="apt-get install $APT_OPTIONS $packages_for_next_debian_ubuntu_mint"
unsupported_currently_this_OS="release"
;;
12.04*)
#LTS
#LTS, name > precise
installcommand="apt-get install $APT_OPTIONS build-essential cmake libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libvlc-dev libcppunit-dev"
$installcommand
if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
;;
14.04*)
#LTS
installcommand="apt-get install $APT_OPTIONS build-essential cmake libsdl2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libvlc-dev libvlccore-dev libcppunit-dev"
$installcommand
if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
#LTS, name > trusty
installcommand="apt-get install $APT_OPTIONS build-essential cmake libsdl2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxgtk3.0-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libvlc-dev libvlccore-dev libcppunit-dev"
;;
15.04)
installcommand="apt-get install $APT_OPTIONS build-essential cmake libcurl4-gnutls-dev libsdl2-dev libopenal-dev liblua5.2-dev libjpeg-dev libpng12-dev libfreetype6-dev libwxgtk3.0-dev libcppunit-dev libfribidi-dev libftgl-dev libglew-dev libogg-dev libvorbis-dev libminiupnpc-dev libircclient-dev libvlc-dev libvlccore-dev libxml2-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev librtmp-dev libkrb5-dev libldap2-dev libidn11-dev libgnutls28-dev"
$installcommand
if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
16.04*)
#LTS, name > xenial
installcommand="apt-get install $APT_OPTIONS build-essential cmake libcurl4-gnutls-dev libsdl2-dev libopenal-dev liblua5.3-dev libjpeg-dev libpng12-dev libfreetype6-dev libwxgtk3.0-dev libcppunit-dev libfribidi-dev libftgl-dev libglew-dev libogg-dev libvorbis-dev libminiupnpc-dev libircclient-dev libvlc-dev libvlccore-dev libxml2-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev librtmp-dev libkrb5-dev libldap2-dev libidn11-dev libgnutls28-dev libnghttp2-dev libssh2-1-dev"
;;
16.04)
installcommand="apt-get install $APT_OPTIONS build-essential cmake libcurl4-gnutls-dev libsdl2-dev libopenal-dev liblua5.2-dev libjpeg-dev libpng12-dev libfreetype6-dev libwxgtk3.0-dev libcppunit-dev libfribidi-dev libftgl-dev libglew-dev libogg-dev libvorbis-dev libminiupnpc-dev libircclient-dev libvlc-dev libvlccore-dev libxml2-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev librtmp-dev libkrb5-dev libldap2-dev libidn11-dev libgnutls28-dev"
$installcommand
if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
16.10)
#name > yakkety
installcommand="apt-get install $APT_OPTIONS build-essential cmake libcurl4-gnutls-dev libsdl2-dev libopenal-dev liblua5.3-dev libjpeg-dev libpng-dev libfreetype6-dev libwxgtk3.0-dev libcppunit-dev libfribidi-dev libftgl-dev libglew-dev libogg-dev libvorbis-dev libminiupnpc-dev libircclient-dev libvlc-dev libvlccore-dev libxml2-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev librtmp-dev libkrb5-dev libldap2-dev libidn11-dev libgnutls28-dev libnghttp2-dev libssh2-1-dev"
;;
*)
installcommand="apt-get install $APT_OPTIONS $packages_for_next_debian_ubuntu_mint"
unsupported_release
exit 1
unsupported_currently_this_OS="release"
;;
esac
;;
@ -150,91 +164,72 @@ case $distribution in
LinuxMint)
case $release in
13|13.*)
#LTS
#LTS, based on Ubuntu 12.04
installcommand="apt-get install $APT_OPTIONS build-essential cmake libsdl2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libvlc-dev libcppunit-dev"
$installcommand
if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
;;
17|17.*)
#LTS
installcommand="apt-get install $APT_OPTIONS build-essential cmake libsdl2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxbase2.8-dev libwxgtk2.8-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libvlc-dev libvlccore-dev libcppunit-dev"
$installcommand
if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
#LTS, based on Ubuntu 14.04
installcommand="apt-get install $APT_OPTIONS build-essential cmake libsdl2-dev libalut-dev libgl1-mesa-dev libglu1-mesa-dev libvorbis-dev libwxgtk3.0-dev libx11-dev liblua5.1-0-dev libjpeg-dev libpng12-dev libcurl4-gnutls-dev libxml2-dev libircclient-dev libglew-dev libftgl-dev libfribidi-dev libvlc-dev libvlccore-dev libcppunit-dev"
;;
18|18.*)
#LTS, based on Ubuntu 16.04
installcommand="apt-get install $APT_OPTIONS build-essential cmake libcurl4-gnutls-dev libsdl2-dev libopenal-dev liblua5.3-dev libjpeg-dev libpng12-dev libfreetype6-dev libwxgtk3.0-dev libcppunit-dev libfribidi-dev libftgl-dev libglew-dev libogg-dev libvorbis-dev libminiupnpc-dev libircclient-dev libvlc-dev libvlccore-dev libxml2-dev libx11-dev libgl1-mesa-dev libglu1-mesa-dev librtmp-dev libkrb5-dev libldap2-dev libidn11-dev libgnutls28-dev libnghttp2-dev libssh2-1-dev"
;;
*)
installcommand="apt-get install $APT_OPTIONS $packages_for_next_debian_ubuntu_mint"
unsupported_release
exit 1
unsupported_currently_this_OS="release"
;;
esac
;;
SuSE|SUSE?LINUX|Opensuse*|openSUSE*)
case $release in
13.1)
#LTS
installcommand="zypper install gcc gcc-c++ cmake libSDL2-devel Mesa-libGL-devel freeglut-devel libvorbis-devel wxGTK-devel lua-devel libjpeg-devel libpng-devel libcurl-devel openal-soft-devel xorg-x11-libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel"
$installcommand
if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
42.1)
installcommand="zypper install gcc gcc-c++ cmake libSDL2-devel Mesa-libGL-devel freeglut-devel libvorbis-devel wxWidgets-devel lua-devel libjpeg8-devel libpng16-devel libcurl-devel openal-soft-devel libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel libminiupnpc-devel vlc-devel"
;;
*)
installcommand="zypper install gcc gcc-c++ cmake libSDL2-devel Mesa-libGL-devel freeglut-devel libvorbis-devel wxGTK-devel lua-devel libjpeg-devel libpng14-devel libcurl-devel openal-soft-devel xorg-x11-libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel"
unsupported_release
exit 1
installcommand="zypper install gcc gcc-c++ cmake libSDL2-devel Mesa-libGL-devel freeglut-devel libvorbis-devel wxWidgets-devel lua-devel libjpeg8-devel libpng16-devel libcurl-devel openal-soft-devel libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel libminiupnpc-devel vlc-devel"
unsupported_currently_this_OS="release"
;;
esac
;;
Fedora)
case $release in
#18)
# installcommand='yum groupinstall development-tools'
# $installcommand
# if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
# installcommand='yum install cmake SDL2-devel mesa-libGL-devel mesa-libGLU-devel libvorbis-devel wxBase wxGTK-devel lua-devel libjpeg-devel libpng-devel libcurl-devel openal-soft-devel libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel'
# $installcommand
# if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
# ;;
*)
installcommand='yum groupinstall "Development Tools"; yum install cmake SDL2-devel mesa-libGL-devel mesa-libGLU-devel libvorbis-devel wxBase wxGTK-devel lua-devel libjpeg-devel libpng-devel libcurl-devel openal-soft-devel libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel'
unsupported_release
exit 1
installcommand="dnf $DNF_OPTIONS install gcc gcc-c++ redhat-rpm-config cmake SDL2-devel mesa-libGL-devel mesa-libGLU-devel libvorbis-devel wxBase wxGTK-devel lua-devel libjpeg-devel libpng-devel libcurl-devel openal-soft-devel libX11-devel libxml2-devel libircclient-devel glew-devel ftgl-devel fribidi-devel cppunit-devel miniupnpc-devel"
unsupported_currently_this_OS="release"
;;
esac
;;
Mageia)
if [ "$architecture" = "x86_64" ]; then lib="lib64"; else lib="lib"; fi
static="-static" #static=""
case $release in
#4)
# installcommand="urpmi $URPMI_OPTIONS gcc gcc-c++ cmake make ${lib}curl-devel ${lib}SDL2-devel ${lib}openal-devel ${lib}lua-devel ${lib}jpeg-devel ${lib}png-devel ${lib}freetype6-devel ${lib}wxgtku2.9-devel ${lib}cppunit-devel ${lib}fribidi-devel ${lib}ftgl-devel ${lib}glew-devel ${lib}ogg-devel ${lib}vorbis-devel ${lib}miniupnpc-devel ${lib}ircclient-static-devel ${lib}vlc-devel ${lib}xml2-devel ${lib}x11-devel ${lib}mesagl1-devel ${lib}mesaglu1-devel"
# $installcommand
# if [ "$?" -ne "0" ]; then error_during_installation; exit 1; fi
# ;;
*)
installcommand="urpmi $URPMI_OPTIONS gcc gcc-c++ cmake make ${lib}curl-devel ${lib}SDL2-devel ${lib}openal-devel ${lib}lua-devel ${lib}jpeg-devel ${lib}png-devel ${lib}freetype6-devel ${lib}wxgtku2.9-devel ${lib}cppunit-devel ${lib}fribidi-devel ${lib}ftgl-devel ${lib}glew-devel ${lib}ogg-devel ${lib}vorbis-devel ${lib}miniupnpc-devel ${lib}ircclient-static-devel ${lib}vlc-devel ${lib}xml2-devel ${lib}x11-devel ${lib}mesagl1-devel ${lib}mesaglu1-devel"
# ^ probably should be added ssl/openssl-devel to the list
unsupported_release
exit 1
installcommand="urpmi $URPMI_OPTIONS gcc gcc-c++ cmake make ${lib}curl-devel ${lib}sdl2.0-devel ${lib}openal-devel ${lib}lua${static}-devel ${lib}jpeg${static}-devel ${lib}png-devel ${lib}freetype6${static}-devel ${lib}wxgtku3.0-devel ${lib}cppunit-devel ${lib}fribidi${static}-devel ${lib}ftgl-devel ${lib}glew-devel ${lib}ogg${static}-devel ${lib}vorbis-devel ${lib}miniupnpc-devel ${lib}ircclient-static-devel ${lib}vlc-devel ${lib}xml2-devel ${lib}x11-devel ${lib}mesagl1-devel ${lib}mesaglu1-devel ${lib}openssl${static}-devel"
unsupported_currently_this_OS="release"
;;
esac
;;
archlinux)
ManjaroLinux)
if [ "$architecture" = "x86_64" ]; then lib=""; else lib="lib32-"; fi
case $release in
rolling)
unsupported_release
exit 1
;;
*)
installcommand="pacman $PACMAN_OPTIONS -S --needed gcc-multilib cmake ${lib}libcurl-gnutls ${lib}sdl2 ${lib}openal lua ${lib}libjpeg-turbo ${lib}libpng ${lib}freetype2 ${lib}wxgtk cppunit fribidi ftgl ${lib}glew ${lib}libogg ${lib}libvorbis miniupnpc libircclient vlc ${lib}libxml2 ${lib}libx11 ${lib}mesa ${lib}glu"
unsupported_currently_this_OS="release"
esac
;;
*)
unsupported_distribution
exit 1
unsupported_currently_this_OS="distribution"
;;
esac
echo ''
echo 'Installation of build dependencies complete.'
if [ "$unsupported_currently_this_OS" = "release" ]; then unsupported_release
elif [ "$unsupported_currently_this_OS" = "distribution" ]; then unsupported_distribution
else install_command; fi
if [ "$manual_install" = "0" ]; then
echo; echo 'Installation of build dependencies complete.'
fi

View File

@ -5,7 +5,7 @@
# Using this script, a headless game server is started, waiting for players to
# connect (if your firewall configuration permits). Players connect and start a
# game. As soon as the game ends, the server will quit, and this script will
# start up a new server immidiately. This is a stability measure to rule out
# start up a new server again. This is a stability measure to rule out
# the unlikely case where side effects (such as memory leaks or corruption)
# could drain on system resources.
#
@ -21,34 +21,36 @@
# user connecting to a headless server controls it. If this user disconnects,
# the next user who connects (or had already connected) takes control.
#
# Please read http://wiki.megaglest.org/Dedicated_Server for more information
# Please read https://docs.megaglest.org/MG/Dedicated_Server for more information
#
# ----------------------------------------------------------------------------
# 2013 Written by Tom Reynolds <tomreyn[at]megaglest.org>
# 2015 Rewritten by filux <heross(@@)o2.pl>
# Copyright (c) 2013-2015 under GNU GPL v3.0+
# Copyright (c) 2013-2017 under GNU GPL v3.0+
# ----------------------------------------------------------------------------
LANG=C
trap "kill -- -$$" HUP INT QUIT TERM EXIT
KERNEL="$(uname -s | tr '[A-Z]' '[a-z]')"
if [ "$(echo "$(readlink -f "$0" >/dev/null 2>&1; echo $?)" | grep '^[0-9]$')" -eq "0" ]; then
if [ "$KERNEL" = "linux" ] || [ "$(echo "$(readlink -f "$0" >/dev/null 2>&1; echo $?)" | grep '^[0-9]$')" -eq "0" ]; then
GAMEDIR="$(dirname "$(readlink -f "$0")")"
else
GAMEDIR="$(cd "$(dirname "$0")"; pwd)"
fi
HOME_DIR="$HOME"
B_SCRIPT_DIR="$GAME_DIR"
B_SCRIPT_DIR="$GAMEDIR"
# -------
# useful for mods
BASIC_SCRIPT="start_megaglest"
FAKE_EXC_BINARY_MAC="MegaGlest"
EXC_BINARY="megaglest"
EXC_BINARY_DISTRO="megaglest"
SHORT_GAME_NAME="megaglest"
# -------
PORTSTART=62001
NUM_OA_SERVERS=2
NUM_OM_SERVERS=2
NUM_OA_SERVERS=1
# Log file location (beware, this can grow large)
# LOG_SERVER=/dev/null
@ -56,11 +58,11 @@ if [ "$(which curl 2>/dev/null)" = "" ]; then
echo "WARNING: Downloading tool 'curl' DOES NOT EXIST on this system, please install it." >&2
fi
if [ "$KERNEL" = "darwin" ]; then
if [ -e "$GAMEDIR/../../MacOS/$FAKE_EXC_BINARY_MAC" ]; then
BASIC_SCRIPT="$FAKE_EXC_BINARY_MAC"; B_SCRIPT_DIR="$(cd "${GAMEDIR}/../../MacOS/"; pwd)"
elif [ -e "$GAMEDIR/$FAKE_EXC_BINARY_MAC.sh" ]; then
BASIC_SCRIPT="$FAKE_EXC_BINARY_MAC.sh"
fi
if [ -e "$GAMEDIR/../../MacOS/$FAKE_EXC_BINARY_MAC" ]; then
BASIC_SCRIPT="$FAKE_EXC_BINARY_MAC"; B_SCRIPT_DIR="$(cd "${GAMEDIR}/../../MacOS/"; pwd)"
elif [ -e "$GAMEDIR/$FAKE_EXC_BINARY_MAC.sh" ]; then
BASIC_SCRIPT="$FAKE_EXC_BINARY_MAC.sh"
fi
fi
if [ "$(which lscpu 2>/dev/null)" != "" ]; then NUMCORES="$(lscpu -p | grep -cv '^#')"
elif [ "$(which sysctl 2>/dev/null)" != "" ]; then NUMCORES="$(sysctl -n hw.ncpu)"; fi
@ -76,43 +78,83 @@ if [ "$1" != "" ] && [ "$(echo "$1" | grep '^[0-9]\+$')" != "" ]; then SERVERCOU
if [ "$2" != "" ] && [ "$(echo "$2" | grep '[0-9.:]\+' | grep -v '[A-Za-z]')" != "" ]; then
SERVER_GREP_IP="$(echo "$2" | sed 's/\./\\./g')"; else SERVER_GREP_IP=""; fi
if [ "$3" != "" ] && [ "$(echo "$3" | grep '^[0-9]\+$')" != "" ]; then PORTSTART="$3"; fi
PORT="$(($PORTSTART + $(($(($SERVERCOUNT - 1)) * 11))))"
STATUSPORT="$(($PORT - 1))"
PORT_FD="$(echo "$PORT" | cut -c1-3)"
if [ "$4" != "" ]; then SERVERTITLE="$4"; fi
PORT="$(($PORTSTART + (($SERVERCOUNT - 1) * 11)))"; STATUSPORT="$(($PORT - 1))"
PORT_FD="$(echo "$PORT" | cut -c1-2)"; PORT_NLD="$((${#PORT} - ${#PORT_FD}))"
PORT_FDX="$PORT_FD"; c=1; while [ "$c" -le "$PORT_NLD" ]; do PORT_FDX="$(echo "${PORT_FDX}X")"; c="$(($c + 1))"; done
IDLE_TIME_MOD=12
if [ "$NUM_OA_SERVERS" -ge "$NUM_OM_SERVERS" ]; then NUM_OS_MOD="$NUM_OA_SERVERS"
else NUM_OS_MOD="$NUM_OM_SERVERS"; fi
if [ "$NUM_OS_MOD" -lt "3" ]; then NUM_OS_SMOD="$(($NUM_OS_MOD + 1))"
else NUM_OS_SMOD="$(($NUM_OS_MOD + ($NUM_OS_MOD / 3)))"; fi
if [ "$SERVERCOUNT" -ge "1" ]; then
IDLE_TIME_MOD="$((18 + ($NUM_OS_MOD * 2) - ($SERVERCOUNT * 2)))"
if [ "$IDLE_TIME_MOD" -lt "2" ]; then IDLE_TIME_MOD=2
elif [ "$IDLE_TIME_MOD" -gt "24" ]; then IDLE_TIME_MOD=24; fi
fi
MAX_IDLE_TIME="$(($IDLE_TIME_MOD * 3600))"
SERVER_SCRIPT="$(basename "$0")"
if [ -f "$GAMEDIR/glest.ini" ]; then
GLEST_INI="$(cat "$GAMEDIR/glest.ini")"
LOG_DIR="$(echo "$GLEST_INI" | awk -F '=' '/^LogPath=/ {print $2}' | sed -e 's:\$HOME:'"$HOME_DIR"':g')"
MASTER_SERVER="$(echo "$GLEST_INI" | awk -F '=' '/^Masterserver=/ {print $2}')"
GLEST_INI="$(cat "$GAMEDIR/glest.ini" | sed -e 's:\$HOME:'"$HOME_DIR"':g')"
LOG_DIR="$(echo "$GLEST_INI" | grep '^LogPath=' | awk -F '=' '{print $2}')"
# e.g. on macos are problems with more advanced using awk ^
if [ "$LOG_DIR" != "" ] && [ "$(echo "$LOG_DIR" | grep '/$')" ]; then LOG_DIR="${LOG_DIR%?}"; fi
MASTER_SERVER="$(echo "$GLEST_INI" | grep '^Masterserver=' | awk -F '=' '{print $2}')"
if [ "$(echo "$MASTER_SERVER" | grep '/$')" ]; then CLEAR_M_SERVER="${MASTER_SERVER}showServersForGlest.php"
else CLEAR_M_SERVER="$MASTER_SERVER/showServersForGlest.php"; fi
if [ "$SERVERCOUNT" -gt "0" ]; then
USER_DATA_DIR="$(echo "$GLEST_INI" | grep '^UserData_Root=' | awk -F '=' '{print $2}')"
if [ "$USER_DATA_DIR" != "" ] && [ "$(echo "$USER_DATA_DIR" | grep '/$')" ]; then
USER_DATA_DIR="${USER_DATA_DIR%?}"
fi
if [ "$SERVERTITLE" = "" ] && [ -f "$USER_DATA_DIR/glestuser.ini" ]; then
GLEST_USER_INI="$(cat "$USER_DATA_DIR/glestuser.ini")"
SERVERNAME="$(echo "$GLEST_USER_INI" | grep '^NetPlayerName=' | awk -F '=' '{print $2}')"
if [ "$SERVERNAME" = "" ]; then SERVERNAME="Unknown"; fi
fi
fi
elif [ "$SERVER_GREP_IP" != "" ]; then
echo "WARNING: file 'glest.ini' not found, maybe '$SERVER_SCRIPT' script is placed in the wrong location." >&2
fi
EXC_BINARY_FPID="$EXC_BINARY"; EXC_BINARY_DISTRO_W="$(which "$EXC_BINARY_DISTRO" 2>/dev/null)"
if [ -e "$B_SCRIPT_DIR/$BASIC_SCRIPT" ]; then SERVER_EXEC="$B_SCRIPT_DIR/$BASIC_SCRIPT"
elif [ -e "$GAMEDIR/$EXC_BINARY" ]; then SERVER_EXEC="$GAMEDIR/$EXC_BINARY"
else SERVER_EXEC="$EXC_BINARY"; fi
else SERVER_EXEC="$EXC_BINARY_DISTRO_W"; EXC_BINARY_FPID="$EXC_BINARY_DISTRO"; fi
if [ "$SERVERCOUNT" -eq "0" ]; then
if [ "$SERVER_EXEC" != "$EXC_BINARY" ]; then ulimit -c unlimited; fi
#if [ "$SERVER_EXEC" != "$EXC_BINARY_DISTRO_W" ]; then ulimit -c unlimited; fi
USED_PORTS=""; LOG_FILE="server.log"
RestartMarker="${SHORT_GAME_NAME}-server-restart.log"
else
USED_PORTS=" --use-ports=$PORT,$PORT,$STATUSPORT"
USED_PORTS="--use-ports=$PORT,$PORT,$STATUSPORT "
RestartMarker="${SHORT_GAME_NAME}-server-restart-${PORT}.log"
WaitMarker="${SHORT_GAME_NAME}-server-wait-${PORT_FDX}.log"
LOG_FILE="server_${SERVERCOUNT}.log"
echo "Info: Server nr. $SERVERCOUNT ($2 ; $PORT)." >&2
SERVERNAME="$SERVERNAME-${SERVERCOUNT}"
fi
SER_PARAMETERS="--headless-server-mode=vps,exit$USED_PORTS"
SER_GREP_PARAMETERS="$(echo "$SER_PARAMETERS" | sed 's/--/\\--/g')"
SingleSMarker=".${SHORT_GAME_NAME}-server-single.log"
if [ "$LOG_DIR" != "" ]; then
if [ ! -f "$LOG_DIR/$SingleSMarker" ] && [ "$SERVERCOUNT" -le "1" ]; then
echo "#" > "$LOG_DIR/$SingleSMarker"; sleep 1s
elif [ -f "$LOG_DIR/$SingleSMarker" ] && [ "$SERVERCOUNT" -gt "1" ]; then
sleep 1s; rm -f "$LOG_DIR/$SingleSMarker"
fi
fi
if [ "$SERVERTITLE" = "" ] && [ "$SERVERNAME" != "" ]; then SERVERTITLE="$SERVERNAME"; fi
if [ "$SERVERCOUNT" -gt "0" ]; then
sleep "$(($SERVERCOUNT * 30))"s
echo "Info: Server '$SERVERTITLE' nr. $SERVERCOUNT ($2 ; $PORT)." >&2
sleep "$(($SERVERCOUNT * 3))"s
fi
SER_PARAMETERS="--headless-server-mode=vps,exit"
#^ parameters without spaces and numbers inside
SER_GREP_PARAMETERS="$(echo "${USED_PORTS}$SER_PARAMETERS" | sed 's/--/\\--/g')"
if [ "$LOG_SERVER" != "" ]; then :
elif [ "$LOG_DIR" != "" ]; then
mkdir -p "$LOG_DIR"
if [ "$(echo "$LOG_DIR" | grep '/$')" ]; then LOG_SERVER="${LOG_DIR}${LOG_FILE}"
else LOG_SERVER="$LOG_DIR/$LOG_FILE"; fi
LOG_SERVER="$LOG_DIR/$LOG_FILE"
else
LOG_SERVER=/dev/null
fi
@ -122,9 +164,10 @@ AVG_LOAD="unknown"; SER_SITUATION="unknown"; CHECK_AVG_LOAD_M=0
if [ -e "/proc/loadavg" ]; then CHECK_AVG_LOAD_M=1
elif [ "$(which sysctl 2>/dev/null)" != "" ]; then CHECK_AVG_LOAD_M=2; fi
while true; do
if [ -f "$LOG_SERVER" ]; then mv -f "$LOG_SERVER" "$LOG_SERVER.1"; fi
if [ "$LOG_SERVER" != "/dev/null" ] && [ -f "$LOG_SERVER" ] && [ "$(wc -c < "$LOG_SERVER")" -gt "250000" ]; then
mv -f "$LOG_SERVER" "$LOG_SERVER.1"; fi
if [ -e "core" ]; then mv -f "core" "core.1"; fi
date > "$LOG_SERVER"
date >> "$LOG_SERVER"
while true; do
if [ "$CHECK_AVG_LOAD_M" -eq "1" ]; then
AVG_LOAD="$(awk '{print $2}' /proc/loadavg)"
@ -139,25 +182,64 @@ while true; do
echo "WARNING: Detected high load on the server." >&2
OLD_SER_SITUATION_STATUS="yes"
fi
sleep 5m; sleep "$((RANDOM % 180))"s
sleep 2.5m; sleep "$((RANDOM % 30))"s
else
OLD_SER_SITUATION_STATUS=""
if [ "$SERVERCOUNT" -ne "0" ] && [ "$SERVERCOUNT" -ne "1" ] && [ "$MASTER_SERVER" != "" ] && [ "$SERVER_GREP_IP" != "" ]; then
NUM_O_FREE_SER="$(curl -s -L "$CLEAR_M_SERVER" | grep '^\([^|]*|\)\{4\}'"$SERVER_GREP_IP"'|.*$' \
| grep '^\([^|]*|\)\{11\}'"$PORT_FD"'' | grep '^\([^|]*|\)\{13\}0|.*$' | wc -l)"
else
NUM_O_FREE_SER=""
OLD_SER_SITUATION_STATUS=""; NUM_O_FREE_SER=""
if [ "$LOG_DIR" != "" ] && [ ! -f "$LOG_DIR/$SingleSMarker" ]; then
if [ "$MASTER_SERVER" != "" ] && [ "$SERVER_GREP_IP" != "" ]; then
if [ "$WaitMarker" != "" ] && [ ! -f "$LOG_DIR/$WaitMarker" ]; then
echo "#" > "$LOG_DIR/$WaitMarker"; sleep 1s
fi
if [ -f "$LOG_DIR/$WaitMarker" ]; then
InWaitMarker="$(cat "$LOG_DIR/$WaitMarker" | tail -1 | grep '^[0-9]*$')"
if [ "$InWaitMarker" = "" ] || \
[ "$(find "$LOG_DIR/" -maxdepth 1 -name "$WaitMarker" -mmin +30)" ]; then
InWaitMarker=100; NUM_O_FREE_SER=103
fi
if [ "$SERVERCOUNT" -lt "$InWaitMarker" ]; then
echo "$SERVERCOUNT" >> "$LOG_DIR/$WaitMarker"; InWaitMarker="$SERVERCOUNT"
fi
fi
fi
if [ -f "$LOG_DIR/$WaitMarker" ] && [ "$NUM_O_FREE_SER" != "103" ] && \
[ "$(($(date +%s)-$(date +%s -r "$LOG_DIR/$WaitMarker")))" -le "30" ]; then
NUM_O_FREE_SER=102
elif [ "$MASTER_SERVER" != "" ] && [ "$SERVER_GREP_IP" != "" ]; then
if [ "$SERVERCOUNT" -ne "$InWaitMarker" ]; then
NUM_O_FREE_SER=101
elif [ "$OLD_InWaitMarker" = "" ] || [ "$InWaitMarker" -ne "$OLD_InWaitMarker" ]; then
NUM_O_FREE_SER=100; OLD_InWaitMarker="$InWaitMarker"
fi
if [ "$NUM_O_FREE_SER" = "" ]; then
FIND_ALL_SER="$(curl -s -L "$CLEAR_M_SERVER")"; M_SERVER_STATUS="$?"
FIND_OUR_SER="$(echo "$FIND_ALL_SER" | grep '^\([^|]*|\)\{4\}'"$SERVER_GREP_IP"'|' \
| grep '^\([^|]*|\)\{11\}'"$PORT_FD"'[0-9]\{'"$PORT_NLD"'\}|')"
NUM_O_O_SER="$(echo "$FIND_OUR_SER" | wc -l)"
if [ "$NUM_O_O_SER" != "" ] && [ "$NUM_O_O_SER" -lt "$NUM_OM_SERVERS" ]; then :
elif [ "$SERVERCOUNT" -le "$NUM_OS_SMOD" ]; then
NUM_O_FREE_SER="$(echo "$FIND_OUR_SER" | grep '^\([^|]*|\)\{10\}0|' -c)"
else
NUM_O_FREE_SER="$(echo "$FIND_OUR_SER" | grep '^\([^|]*|\)\{13\}0|' -c)"
fi
fi
fi
fi
if [ "$NUM_O_FREE_SER" != "" ] && [ "$NUM_O_FREE_SER" -ge "$NUM_OA_SERVERS" ]; then
if [ "$OLD_NUM_OFS_STATUS" = "" ]; then
if [ "$OLD_NUM_OFS_STATUS" = "" ] && [ "$NUM_O_FREE_SER" -ne "100" ]; then
echo "Notice: Waiting for situation when server may be really needed." >&2
OLD_NUM_OFS_STATUS="yes"
fi
sleep 2m; sleep "$((RANDOM % 60))"s
else
OLD_NUM_OFS_STATUS=""
break
if [ "$M_SERVER_STATUS" = "" ] || [ "$M_SERVER_STATUS" -eq "0" ] || [ "$SERVERCOUNT" -le "1" ]; then
OLD_NUM_OFS_STATUS=""
if [ -f "$LOG_DIR/$WaitMarker" ]; then echo "#" > "$LOG_DIR/$WaitMarker"; fi
break
else
echo "WARNING: Detected some problems with connection to master server." >&2
M_SERVER_STATUS=""
fi
fi
sleep 32s
fi
done
@ -167,7 +249,7 @@ while true; do
echo "... dev_version update:" >&2
"$GAMEDIR/../${SHORT_GAME_NAME}-dev_version-update.sh" "$GAMEDIR"; sleep 1s
echo "#" > "$GAMEDIR/${SHORT_GAME_NAME}-dev_version-update-done.log"; sleep 1s
"$GAMEDIR/$SERVER_SCRIPT" $@ &
"$GAMEDIR/$SERVER_SCRIPT" "$@" &
break
else
rm -f "$GAMEDIR/${SHORT_GAME_NAME}-dev_version-update-done.log"
@ -178,16 +260,19 @@ while true; do
if [ "$MASTER_SERVER" != "" ] && [ "$SERVER_GREP_IP" != "" ]; then
( check_nr=0; force_restart=0; loop_start="yes"; BeginTime="$(date +"%s")"; sleep 4m
while true; do
SER_PID="$(ps -ef | grep "$SER_GREP_PARAMETERS" | awk '/\/'"$EXC_BINARY"' / {print $2}')"
SER_PID="$(ps -ef | grep "[ \t/]$EXC_BINARY_FPID $SER_GREP_PARAMETERS" | grep -v 'grep' | awk '{print $2}')"
if [ "$loop_start" = "yes" ]; then SER_PID_S="$SER_PID"; loop_start="no"; fi
CheckTime="$(date +"%s")"; DiffTime="$(($CheckTime-$BeginTime))"
if [ "$SER_PID" != "" ] && [ "$SER_PID" = "$SER_PID_S" ]; then
FIND_SER="$(curl -s -L "$CLEAR_M_SERVER" | grep '^\([^|]*|\)\{4\}'"$SERVER_GREP_IP"'|.*$' \
| grep '^\([^|]*|\)\{11\}'"$PORT"'|.*$')"
FIND_SER="$(curl -s -L "$CLEAR_M_SERVER" | grep '^\([^|]*|\)\{4\}'"$SERVER_GREP_IP"'|' \
| grep '^\([^|]*|\)\{11\}'"$PORT"'|')"
if [ "$FIND_SER" = "" ]; then
check_nr="$(($check_nr + 1))"
if [ "$OLD_FIND_SER_STATUS" = "" ]; then
echo "WARNING: The master server doesn't see this server." >&2
OLD_FIND_SER_STATUS="yes"
elif [ "$check_nr" -eq "120" ]; then
echo "ERROR: The master server doesn't see this server for over 4 hours." >&2; force_restart=1
fi
else
OLD_FIND_SER_STATUS=""
@ -196,9 +281,9 @@ while true; do
echo "ERROR: Server status cannot be determined." >&2
fi
fi
if [ "$SER_STATUS" != "2" ] && [ "$DiffTime" -gt "43200" ]; then
echo "Notice: The server is working continuously for over 12 hours." >&2; force_restart=1
elif [ "$SER_STATUS" = "2" ]; then
if [ "$SER_STATUS" != "2" ] && [ "$DiffTime" -gt "$MAX_IDLE_TIME" ]; then
echo "Notice: The server is working continuously for over $IDLE_TIME_MOD hour(s)." >&2; force_restart=1
elif [ "$SER_STATUS" != "" ] && [ "$SER_STATUS" -eq "2" ]; then
if [ "$OLD_PROG_STATUS" = "" ]; then
echo "Status: Game in progress..." >&2
OLD_PROG_STATUS="yes"; BeginTime2="$(date +"%s")"
@ -209,7 +294,7 @@ while true; do
else
sleep 8m
fi
elif [ "$SER_STATUS" = "1" ]; then
elif [ "$SER_STATUS" != "" ] && [ "$SER_STATUS" -eq "1" ]; then
if [ "$OLD_READY_STATUS" = "" ]; then
OLD_READY_STATUS="yes"; BeginTime3="$(date +"%s")"
fi
@ -220,18 +305,13 @@ while true; do
else
OLD_READY_STATUS=""
fi
if [ "$SER_STATUS" != "" ] && [ "$SER_STATUS" -ne "2" ]; then OLD_PROG_STATUS=""; fi
if [ "$force_restart" -eq "1" ]; then
FIND_SER=""; if [ "$check_nr" -lt "120" ]; then check_nr=120; fi
if [ "$LOG_DIR" != "" ]; then echo "#" > "$LOG_DIR/${SHORT_GAME_NAME}-server-forced-restart.log"; sleep 2s; fi
fi
if [ "$FIND_SER" = "" ]; then
check_nr="$(($check_nr + 1))"
if [ "$check_nr" -lt "119" ]; then :
elif [ "$check_nr" -eq "119" ] && [ "$force_restart" -ne "1" ]; then
echo "ERROR: The master server doesn't see this server for over 4 hours." >&2
elif [ "$check_nr" -ge "123" ]; then kill -9 "$SER_PID"
else kill "$SER_PID"; fi
else
if [ "$check_nr" -lt "120" ]; then check_nr=120; fi
if [ "$LOG_DIR" != "" ]; then echo "#" > "$LOG_DIR/$RestartMarker"; sleep 2s; fi
if [ "$check_nr" -ge "123" ]; then kill -9 "$SER_PID"
else kill "$SER_PID"; fi
elif [ "$FIND_SER" != "" ]; then
check_nr=0
fi
sleep 2m
@ -241,9 +321,13 @@ while true; do
done
) &
fi
"$SERVER_EXEC" $SER_PARAMETERS >> "$LOG_SERVER" 2>&1
if [ "$SERVERTITLE" != "" ]; then
"$SERVER_EXEC" ${USED_PORTS}"$SER_PARAMETERS" --server-title="Headless (${SERVERTITLE})" >> "$LOG_SERVER" 2>&1
else
"$SERVER_EXEC" ${USED_PORTS}"$SER_PARAMETERS" >> "$LOG_SERVER" 2>&1
fi
if [ "$?" -ne "0" ]; then
if [ ! -f "$LOG_DIR/${SHORT_GAME_NAME}-server-forced-restart.log" ]; then
if [ ! -f "$LOG_DIR/$RestartMarker" ]; then
echo 'ERROR: Server has quit unexpectedly.' >> "$LOG_SERVER"
echo 'ERROR: Server has quit unexpectedly.' >&2
if [ "$SERVERCOUNT" -eq "0" ]; then
@ -251,15 +335,16 @@ while true; do
exit 1
fi
sleep 5s
if [ "$SERVERCOUNT" -eq "1" ] && [ "$SERVER_GREP_IP" != "" ] && [ -e "$GAMEDIR/${SHORT_GAME_NAME}-mini-update.sh" ]; then
if [ "$SERVERCOUNT" -eq "1" ] && [ "$SERVER_GREP_IP" != "" ] && \
[ -e "$GAMEDIR/${SHORT_GAME_NAME}-mini-update.sh" ]; then
echo "... attempt to perform mini update, which may solve tiny problems:" >&2
"$GAMEDIR/${SHORT_GAME_NAME}-mini-update.sh"; sleep 1s
fi
else
echo 'Notice: Server was restarted by script.' >> "$LOG_SERVER"
rm -f "$LOG_DIR/${SHORT_GAME_NAME}-server-forced-restart.log"
if [ "$LOG_DIR" != "" ]; then rm -f "$LOG_DIR/$RestartMarker"; fi
fi
sleep "$((RANDOM % 30))"s
sleep 2s
else
echo 'Server has quit.' | tee -a "$LOG_SERVER"
fi

View File

@ -166,6 +166,7 @@ cd "$CURRENTDIR"
rm -rf cmake-build
mkdir cmake-build
cd cmake-build
# 'MOJOSETUP_GUI_*_STATIC=TRUE' > oddly it is not static after this, but isn't optional anymore so this kills portability
cmake \
-DCMAKE_BUILD_TYPE=$BUILDTYPE \
-DCMAKE_C_COMPILER=$CC \
@ -178,8 +179,9 @@ cmake \
-DMOJOSETUP_INPUT_XZ=TRUE \
-DMOJOSETUP_BUILD_LUAC=TRUE \
-DMOJOSETUP_GUI_GTKPLUS2=TRUE \
-DMOJOSETUP_GUI_GTKPLUS2_STATIC=FALSE \
-DMOJOSETUP_GUI_NCURSES=TRUE \
-DMOJOSETUP_GUI_NCURSES_STATIC=TRUE \
-DMOJOSETUP_GUI_NCURSES_STATIC=FALSE \
-DMOJOSETUP_GUI_STDIO=TRUE \
-DMOJOSETUP_GUI_STDIO_STATIC=TRUE \
-DMOJOSETUP_GUI_WWW=FALSE \

@ -1 +1 @@
Subproject commit 0bc051300e71b01d332f03e6e7acb7d066052052
Subproject commit 86bb138f83988ada5c8cd75ca1b556d013f43190

View File

@ -1,5 +1,5 @@
local GAME_INSTALL_SIZE = 680000000;
local GAME_VERSION = "3.12.0";
local GAME_INSTALL_SIZE = 705000000;
local GAME_VERSION = "3.13.0";
local _ = MojoSetup.translate

View File

@ -2,7 +2,7 @@
# Use this script to improve configuration of '.desktop' files.
# ----------------------------------------------------------------------------
# 2014 Written by filux <heross(@@)o2.pl>
# Copyright (c) 2014-2015 under GNU GPL v3.0+
# Copyright (c) 2014-2016 under GNU GPL v3.0+
LANG=C
CURRENTDIR="$(dirname "$(readlink -f "$0")")"
@ -11,23 +11,23 @@ if [ -f "megaglest.desktop" ] && [ -f "megaglest.png" ] && [ -f "megaglest" ] \
&& [ -f "start_megaglest" ] && [ ! -f "glest-dev.ini" ]; then
desktop_location="$CURRENTDIR/megaglest.desktop"; icon_location="$CURRENTDIR/megaglest.png"
exec_location="$CURRENTDIR/start_megaglest"
sed -i -e "s#$prmtr.*#$prmtr$icon_location#" -e "s#$prmtr2.*#$prmtr2$exec_location#" \
sed -i -e "s#$prmtr.*#$prmtr$icon_location#" -e "s#$prmtr2.*#$prmtr2\"$exec_location\"#" \
"$desktop_location"
chmod +x $desktop_location
chmod +x "$desktop_location"
fi
if [ -f "megaglest_editor.desktop" ] && [ -f "megaglest.png" ] && [ -f "megaglest_editor" ] \
&& [ -f "start_megaglest_mapeditor" ] && [ ! -f "glest-dev.ini" ]; then
desktop_location="$CURRENTDIR/megaglest_editor.desktop"
icon_location="$CURRENTDIR/megaglest.png"; exec_location="$CURRENTDIR/start_megaglest_mapeditor"
sed -i -e "s#$prmtr.*#$prmtr$icon_location#" -e "s#$prmtr2.*#$prmtr2$exec_location#" \
sed -i -e "s#$prmtr.*#$prmtr$icon_location#" -e "s#$prmtr2.*#$prmtr2\"$exec_location\"#" \
"$desktop_location"
chmod +x $desktop_location
chmod +x "$desktop_location"
fi
if [ -f "megaglest_g3dviewer.desktop" ] && [ -f "megaglest.png" ] && [ -f "megaglest_g3dviewer" ] \
&& [ -f "start_megaglest_g3dviewer" ] && [ ! -f "glest-dev.ini" ]; then
desktop_location="$CURRENTDIR/megaglest_g3dviewer.desktop"
icon_location="$CURRENTDIR/megaglest.png"; exec_location="$CURRENTDIR/start_megaglest_g3dviewer"
sed -i -e "s#$prmtr.*#$prmtr$icon_location#" -e "s#$prmtr2.*#$prmtr2$exec_location#" \
sed -i -e "s#$prmtr.*#$prmtr$icon_location#" -e "s#$prmtr2.*#$prmtr2\"$exec_location\"#" \
"$desktop_location"
chmod +x $desktop_location
chmod +x "$desktop_location"
fi

View File

@ -61,8 +61,8 @@ exit 0' > "megaglest-mini-update.sh"
if [ -d "megaglest-mini_update" ]; then rm -rf "megaglest-mini_update"; fi
mkdir -p "megaglest-mini_update"
cp -f --no-dereference --preserve=all ../start_megaglest \
../start_megaglest_mapeditor ../start_megaglest_g3dviewer \
cp -f --no-dereference --preserve=all start_megaglest \
start_megaglest_mapeditor start_megaglest_g3dviewer \
megaglest-mini-update.sh megaglest-configure-desktop.sh "megaglest-mini_update"
cp -R -f --no-dereference --preserve=all lib-x86 lib-x86_64 "megaglest-mini_update"
sleep 0.5s

View File

@ -1,12 +1,11 @@
#!/bin/sh
# 2011 Written by Mark Vejvoda <mark_vejvoda@hotmail.com>
# 2014 Rewritten by filux <heross(@@)o2.pl>
# Copyright (c) 2011-2015 under GNU GPL v3.0+
# Copyright (c) 2011-2016 under GNU GPL v3.0+
# ----------------------------------------------------------------------------
# If you want to have core files generated (for debugging purposes):
# ulimit -c unlimited
LANG=C
SCRIPTLOCATION="$(readlink -f "$0")"
GAMEDIR="$(dirname "$SCRIPTLOCATION")"
ARCHITECTURE="$(uname -m | tr '[A-Z]' '[a-z]')"
@ -18,21 +17,28 @@ BugReportBoth2="$BugReportBoth"
BugReportData="https://github.com/MegaGlest/megaglest-data/issues"
EXC_BINARY="megaglest"
SHORT_GAME_NAME="megaglest"
# if long game name contain spaces then write it inside quotes
# e.g. "\"long name with spaces\""
LONG_GAME_NAME="MegaGlest"
# -------
LIBDIR="lib"; ExitStatus=0; LibsWarnings=""; IgnoredLibs=""
if [ ! -d "$GAMEDIR/$LIBDIR" ]; then mkdir "$GAMEDIR/$LIBDIR"; fi
LIBDIR="lib"; ExitStatus=0; LibsWarnings=""; IgnoredLibs=""; FirstLnError=""
LibDir_wP="$GAMEDIR/$LIBDIR"; if [ ! -d "$LibDir_wP" ]; then mkdir "$LibDir_wP"; fi
if [ "$1" = "--tool-editor" ] || [ "$1" = "--tool-g3dviewer" ] || [ "$1" = "--tool-buginfo" ];
then OperatingMode="$1"; else OperatingMode="--game"; fi
BeginTime="$(date +"%s")"
if [ "$(which lsb_release 2>/dev/null)" != "" ]; then
OS_INFO_P="$(which lsb_release) -d"
OS_INFO="$($OS_INFO_P | awk -F ':[ \t]*' '{print $2}')"
if [ -e "/etc/os-release" ]; then
OS_INFO="$(cat "/etc/os-release" | grep '^PRETTY_NAME=' | awk -F '"' '{print $2}')"
else
WhichLsbRelease="$(which lsb_release 2>/dev/null)"
if [ "$WhichLsbRelease" != "" ]; then
OS_INFO="$($WhichLsbRelease -d | awk -F ':[ \t]*' '{print $2}')"
fi
fi
if [ "$OperatingMode" != "--tool-buginfo" ]; then
if [ "$LDCONFIG" = "" ]; then
if [ "$(which ldconfig 2>/dev/null)" != "" ]; then
LDCONFIG="$(which ldconfig 2>/dev/null)"; LDconfigType=1
WhichLdconfig="$(which ldconfig 2>/dev/null)"
if [ "$WhichLdconfig" != "" ]; then
LDCONFIG="$WhichLdconfig"; LDconfigType=1
elif [ -x "/sbin/ldconfig" ]; then
LDCONFIG="/sbin/ldconfig"; LDconfigType=2
else
@ -43,33 +49,17 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
else
LDconfigType=9
fi
LibsWarnings="$LibsWarnings
|| If for some reason you see an error related with library, then you should try install this library
|| in your linux. Hints with full names and with default versions of just detected missing libraries you
|| see below.
|| You can also perform mini update by launch '${SHORT_GAME_NAME}-mini-update.sh' script, which may solve tiny problems.
|| If it is other problem or after your tries it still doesn't work then please report a bug
|| here: '$BugReportEngine',
|| or here: '$BugReportBoth'."
LibsWarnings="$LibsWarnings
||
|| Found LDCONFIG variable [$LDconfigType][$LDCONFIG]...
|| OS info. [$OS_INFO], Arch.[$ARCHITECTURE], Dir.[$GAMEDIR]"
LibsWarnings="Found LDCONFIG variable [$LDconfigType][$LDCONFIG]..."
if [ "$ARCHITECTURE" = "x86_64" ]; then GrepPattern="x86[_-]64"
else GrepPattern="$ARCHITECTURE"; fi
else GrepPattern="$ARCHITECTURE"; fi
LDCONFIG_P="$($LDCONFIG -p)"; ArchSortLibs="no"
LDCONFIG_P_ARCH="$(echo "$LDCONFIG_P" | grep "$GrepPattern")"
if [ "$LDCONFIG_P_ARCH" != "" ]; then
LDCONFIG_P_R_ARCH="$(echo "$LDCONFIG_P" | grep -v "$GrepPattern")"
ArchSortLibs="yes"
fi
if [ "$OperatingMode" = "--game" ]; then
ldd_target="$GAMEDIR/$EXC_BINARY"
else
ldd_target="$GAMEDIR/$2"
fi
c_required_libs="$(ldd "$ldd_target")"
if [ "$OperatingMode" = "--game" ]; then ldd_target="$GAMEDIR/$EXC_BINARY"
else ldd_target="$GAMEDIR/$2"; fi
hasSOlib() {
if [ "$2" = "myarch" ]; then
@ -83,22 +73,26 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
}
findMissingSO() {
SO_WANTED_LIB="$1"; SO_WANTED_LIB2="$2"; SO_LIB_PATTERN="$3"
SO_LINKED_LIB="$GAMEDIR/$LIBDIR/$SO_WANTED_LIB2"
SO_LINKED_LIB="$LibDir_wP/$SO_WANTED_LIB2"
hasSO="$(hasSOlib "$SO_LIB_PATTERN" "myarch")"; CommonPart="no"
if [ "$hasSO" != "" ]; then
if [ ! -L "$SO_LINKED_LIB" ] && [ -e "$SO_LINKED_LIB" ]; then EmbLibExist="yes"; else EmbLibExist="no"; fi
if [ "$hasSO" != "" ] && ( [ "$6" != "|L" ] || [ "$EmbLibExist" = "no" ] ); then
CommonPart="yes"
elif [ "$SO_WANTED_LIB" = "$SO_LIB_PATTERN" ] && [ ! -h "$SO_LINKED_LIB" ] && [ -e "$SO_LINKED_LIB" ]; then
elif [ "$SO_WANTED_LIB" = "$SO_LIB_PATTERN" ] && [ "$EmbLibExist" = "yes" ] && [ "$6" != "|H" ]; then
if [ "$6" = "|L" ]; then Emb_Keyword=" is used as"; else Emb_Keyword=" is missing in your OS, using"; fi
LibsWarnings="$LibsWarnings
||- default library [$SO_WANTED_LIB2] is missing in your OS, using embedded library."
||- default library ${5}[$SO_WANTED_LIB2]$Emb_Keyword embedded library."
return 0
else
hasSO="$(hasSOlib "$SO_LIB_PATTERN")"
if [ "$ArchSortLibs" = "yes" ] && [ "$hasSO" != "" ]; then
CommonPart="yes"
else
if [ "$SO_WANTED_LIB" = "$SO_LIB_PATTERN" ]; then
if [ "$SO_WANTED_LIB" = "$SO_LIB_PATTERN" ] && ( [ "$EmbLibExist" = "no" ] || [ "$6" = "|H" ] ); then
if [ "$6" = "|H" ] && [ "$EmbLibExist" = "yes" ]; then Emb_Keyword2=" (ae)"; else Emb_Keyword2=""; fi
LibsWarnings="$LibsWarnings
||- default library [$SO_WANTED_LIB2] is missing in your OS, attempting to find and link to different version if is available..."
||- default library ${5}[$SO_WANTED_LIB2] is missing in your OS${Emb_Keyword2}, attempting to find and link to different version if is available..."
fi
if [ "$4" != "no" ]; then
LibsWarnings="$LibsWarnings
@ -109,15 +103,24 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
fi
if [ "$CommonPart" = "yes" ]; then
if [ "$SO_WANTED_LIB" != "$SO_LIB_PATTERN" ]; then
LibsWarnings="$LibsWarnings
|| new library link [.../$LIBDIR/$SO_WANTED_LIB2] pointed to [$hasSO]."
ln -f -s "$hasSO" "$SO_LINKED_LIB"
if [ "$?" -eq "0" ]; then
LibsWarnings="$LibsWarnings
|| new library link [.../$LIBDIR/$SO_WANTED_LIB2] pointed to [$hasSO]."
else
LibsWarnings="$LibsWarnings
|| ERROR: Detected some problems during process of creating symlink."
if [ "$FirstLnError" = "" ]; then FirstLnError="no"
LibsWarnings="$LibsWarnings
|| ... lack of write permissions in game location?"
fi
fi
else
if [ -e "$SO_LINKED_LIB" ]; then rm -f "$SO_LINKED_LIB"; fi
if [ "$(echo "$c_required_libs" | grep "$SO_LIB_PATTERN[ \t]*=>[ \t]*not found")" != "" ]; then
if [ "$(echo "$c_required_libs" | grep "${SO_LIB_PATTERN}[ \t]*=>[ \t]*not found")" != "" ] && [ "$EmbLibExist" = "no" ]; then
#rare exception
LibsWarnings="$LibsWarnings
||- default library: [$SO_WANTED_LIB2] is missing in your OS, attempting to find and link to different version if is available...
||- default library: ${5}[$SO_WANTED_LIB2] is missing in your OS, attempting to find and link to different version if is available...
|| > not found !"
fi
fi
@ -127,28 +130,41 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
checkLibsStatus() {
if [ "$1" != "" ]; then
list_of_libs="$(echo "$1" | sed -e 's|\([^\]\)\.|\1\\.|g' -e 's|\[num\]|[0-9]\\+|g')"
for var in $list_of_libs; do
patterns="$(echo "$var" | sed -e 's|^ */||' -e 's|/| |g' -e 's/| /|/')"
patterns_num="$(echo "$patterns" | wc -w)"
wanted_lib="$(echo "$patterns" | awk '{print $1}')"; i=2
wanted_lib2="$(echo "$wanted_lib" | sed 's/\\//g')";
last_pattern="$(echo "$patterns" | awk '{print $(NF-1)}')"
if [ "$(echo "$c_required_libs" | grep "[^_-]$last_pattern")" != "" ]; then
for var2 in $patterns; do
if [ "$var2" = "|" ]; then break; fi
lib_pattern="$(echo "$var" | awk -F '/' -v ii="$i" '{print $ii}')"
if [ "$i" -lt "$patterns_num" ]; then end_w="no"; else end_w="yes"; fi
findMissingSO "$wanted_lib" "$wanted_lib2" "$lib_pattern" "$end_w"
if [ "$?" -eq "0" ]; then break; else i=$((i + 1)); fi
done
else
IgnoredLibs="$IgnoredLibs $wanted_lib2"
check_nr=1
while [ "$check_nr" -le "2" ]; do
if [ "$check_nr" -eq "1" ]; then c_required_libs="$(ldd "$ldd_target")"; else
c_required_libs="$(LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${LibDir_wP}" ldd "$ldd_target")"
fi
list_of_libs="$(echo "$1" | sed -e 's|\([^\]\)\.|\1\\.|g' -e 's|\[num\]|[0-9]\\+|g')"
for var in $list_of_libs; do
patterns="$(echo "$var" | sed -e 's|^ */||' -e 's|/| |g' -e 's/\(|[HL]\?\) /\1/')"
wanted_lib="$(echo "$patterns" | awk '{print $1}')"; i=2
if [ "$check_nr" -ne "1" ] && [ "$(echo "$IgnoredLibs" | grep "$wanted_lib")" != "" ]; then WantedLibIgnored="yes"
else WantedLibIgnored="no"; fi
if [ "$check_nr" -eq "1" ] || [ "$WantedLibIgnored" = "yes" ]; then
wanted_lib2="$(echo "$wanted_lib" | sed 's/\\//g')"; patterns_num="$(echo "$patterns" | wc -w)"
last_pattern="$(echo "$patterns" | awk '{print $(NF-1)}')"; end_mark="$(echo "$patterns" | awk '{print $NF}')"
if [ "$check_nr" -ne "1" ]; then foreign_dep="(sd) "; else foreign_dep=""; fi
if [ "$(echo "$c_required_libs" | grep "[^_-]$last_pattern")" != "" ]; then
if [ "$WantedLibIgnored" = "yes" ]; then IgnoredLibs="$(echo "$IgnoredLibs" | sed "s|$wanted_lib||")"; fi
for var2 in $patterns; do
if [ "$var2" = "|" ] || [ "$var2" = "|H" ] || [ "$var2" = "|L" ]; then break; fi
lib_pattern="$(echo "$var" | awk -F '/' -v ii="$i" '{print $ii}')"
if [ "$wanted_lib" != "$last_pattern" ] && [ "$i" -lt "$patterns_num" ]; then end_w="no"
else end_w="yes"; fi
findMissingSO "$wanted_lib" "$wanted_lib2" "$lib_pattern" "$end_w" "$foreign_dep" "$end_mark"
if [ "$?" -eq "0" ]; then break; else i=$((i + 1)); fi
done
elif [ "$WantedLibIgnored" = "no" ]; then
IgnoredLibs="$IgnoredLibs $wanted_lib2"
if [ -L "$LibDir_wP/$wanted_lib2" ]; then rm -f "$LibDir_wP/$wanted_lib2"; fi
fi
fi
done
check_nr=$((check_nr + 1))
done
fi
}
# Each line /.../.../|/ .
# First entry libs_list="...\n...\n..." ,
# each next libs_list="$libs_list\n...\n..." .
@ -156,15 +172,20 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
# or [num] what mean "any number with one or more digits".
# Last word should have length at least 6 chars, but use longer if string is too much common.
# If line is ended by /|H/ this mean 'H'igher priority about finding local library instead of existing
# (if exist) embedded version, useful in case if embedded library has a lot of own dependencies.
# If line is ended by /|L/ this mean 'L'ower priority about finding local library instead of existing
# (if exist) embedded version, (rarely) useful in case if embedded library may eliminate ABI-API
# conflixts, e.g. binary <> WxWidgets.
# ignored: linux-vdso.so*, linux-gate.so*, ld-linux-*.so*, libpthread.so*, libpulsecommon-*.so, libresolv.so*
libs_list="/libSDL2-2.0.so.0/libSDL2-2.[num].so/libSDL2-[0-9].[num].so/libSDL2-/|/
libs_list="/libSDL2-2.0.so.0/libSDL2-2.[num].so/libSDL2-[0-9].[num].so/libSDL2-/|H/
/libGLU.so.1/libGLU.so/|/
/libGL.so.1/libGL.so/|/
/libX11.so.6/libX11.so/|/
/libidn.so.11/libidn.so/|/
/librtmp.so.0/librtmp.so/|/
/libgcrypt.so.11/libgcrypt.so.1[0-9]/libgcrypt.so/libgcrypt/|/
/libgnutls.so.26/libgnutls.so.2[0-9]/libgnutls.so/libgnutls/|/
/libgcrypt.so.11/|/
/libgnutls.so.26/|/
/libgssapi_krb5.so.2/libgssapi_krb[0-9].so/libgssapi_krb[num].so/libgssapi_krb/|/
/liblber-2.4.so.2/liblber-2.[num].so/liblber-[0-9].[num].so/liblber-/liblber/|/
/libldap_r-2.4.so.2/libldap_r-2.[num].so/libldap_r-[0-9].[num].so/libldap_r-/libldap_r/|/
@ -243,14 +264,14 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
/libGLEW.so.1.10/libGLEW.so.1.[num]/libGLEW.so/|/"
if [ "$OperatingMode" = "--game" ]; then
libs_list="$libs_list
/libopenal.so.1/libopenal.so/libopenal/|/
/libopenal.so.1/libopenal.so/libopenal/|H/
/libvlccore.so.7/libvlccore.so/libvlccore/|/
/libvlc.so.5/libvlc.so/|/"
else
libs_list="$libs_list
/libwx_gtk2u_core-3.0.so.0/libwx_gtk2u_core-3.[num].so/|/
/libwx_baseu-3.0.so.0/libwx_baseu-3.[num].so/|/
/libwx_gtk2u_gl-3.0.so.0/libwx_gtk2u_gl-3.[num].so/|/
/libwx_gtk2u_core-3.0.so.0/libwx_gtk2u_core-3.[num].so/|L/
/libwx_baseu-3.0.so.0/libwx_baseu-3.[num].so/|L/
/libwx_gtk2u_gl-3.0.so.0/libwx_gtk2u_gl-3.[num].so/|L/
/libgtk-x11-2.0.so.0/libgtk-x11-2.[num].so/libgtk-x11-[0-9].[num].so/libgtk-x11-[0-9]/libgtk-x11/|/
/libgdk-x11-2.0.so.0/libgdk-x11-2.[num].so/libgdk-x11-[0-9].[num].so/libgdk-x11-[0-9]/libgdk-x11/|/
/libpangocairo-1.0.so.0/libpangocairo-1.[num].so/libpangocairo-[0-9].[num].so/libpangocairo-[0-9]/libpangocairo/|/
@ -260,7 +281,7 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
/libgobject-2.0.so.0/libgobject-2.[num].so/libgobject-[0-9].[num].so/libgobject-[0-9]/libgobject/|/
/libglib-2.0.so.0/libglib-2.[num].so/libglib-[0-9].[num].so/libglib-[0-9]/libglib-/|/
/libSM.so.6/libSM.so/|/
/libjpeg.so.8/libjpeg.so.[0-9]/libjpeg.so/|/
/libjpeg.so.8/|/
/libtiff.so.5/libtiff.so/|/
/libgmodule-2.0.so.0/libgmodule-2.[num].so/libgmodule-[0-9].[num].so/libgmodule-[0-9]/libgmodule/|/
/libatk-1.0.so.0/libatk-1.[num].so/libatk-[0-9].[num].so/libatk-[0-9]/|/
@ -282,10 +303,61 @@ if [ "$OperatingMode" != "--tool-buginfo" ]; then
/libgraphite2.so.3/libgraphite2.so/libgraphite[0-9].so/|/"
fi
#if [ "$ARCHITECTURE" = "x86_64" ]; then
#else
#fi
checkLibsStatus "$libs_list"
IfRealLibExist() {
RealEmbLib="$LibDir_wP/$1"
if [ ! -L "$RealEmbLib" ] && [ -e "$RealEmbLib" ]; then
if [ "$2" = "remove" ]; then rm -f "$RealEmbLib"; else return 0; fi
else return 1; fi
}
# exceptions, keep them in sync with listed libraries on 'libs_list'
if [ "$(echo "$OS_INFO" | grep 'Debian\|Ubuntu\|LinuxMint')" = "" ]; then IfRealLibExist "libSDL2-2.0.so.0" "remove"; fi
if [ "$OperatingMode" = "--game" ]; then
if [ "$(IfRealLibExist "libvlc.so.5"; echo "$?")" -ne "0" ] && [ "$(IfRealLibExist "libvlccore.so.7"; echo "$?")" -ne "0" ] && \
[ -d "$LibDir_wP/vlc" ]; then rm -rf "$LibDir_wP/vlc"; fi
else
if [ "$(IfRealLibExist "libwx_gtk2u_core-3.0.so.0"; echo "$?")" -ne "0" ] || \
[ "$(IfRealLibExist "libwx_baseu-3.0.so.0"; echo "$?")" -ne "0" ] || \
[ "$(IfRealLibExist "libwx_gtk2u_gl-3.0.so.0"; echo "$?")" -ne "0" ]; then
IfRealLibExist "libwx_gtk2u_core-3.0.so.0" "remove"
IfRealLibExist "libwx_baseu-3.0.so.0" "remove"
IfRealLibExist "libwx_gtk2u_gl-3.0.so.0" "remove"
fi
fi
lw_log="$LibDir_wP/.last_w_check.log"; li_log="$LibDir_wP/.last_i_check.log"
pw_log="$LibDir_wP/.previous_w_check.log"; pi_log="$LibDir_wP/.previous_i_check.log"
LibsWarningsLogs() {
if [ "$1" = "create_new" ]; then
echo "#" > "$lw_log"; echo "#" > "$li_log"
elif [ "$1" = "save_new" ] && [ "$OperatingMode" = "--game" ]; then
echo "$LibsWarnings" > "$lw_log"; echo "$IgnoredLibs" > "$li_log"
elif [ "$1" = "read_old" ]; then
LibsWarnings="$(cat "$pw_log")"; IgnoredLibs="$(cat "$pi_log")"
elif [ "$1" = "check_old" ]; then
if [ -f "$pw_log" ] && [ -f "$pi_log" ] && \
[ "$(find "$LibDir_wP" -name '.previous_w_check.log' -mtime -29)" ]; then return 0
else return 1; fi
elif [ "$1" = "check_current" ] || [ "$1" = "rotate" ]; then
if [ -f "$lw_log" ] && [ -f "$li_log" ]; then
if [ "$1" = "rotate" ] || [ "$(find "$LibDir_wP" -name '.last_w_check.log' -mmin +10)" ]; then
mv -f "$lw_log" "$pw_log"; mv -f "$li_log" "$pi_log"
else return 0; fi
elif [ "$1" != "rotate" ]; then return 1; fi
fi
}
checkLibsStatus2() {
checkLibsStatus "$libs_list"; LibsWarningsLogs "save_new"; sleep 1s; LibsWarningsLogs "rotate"
}
if [ "$OperatingMode" = "--game" ] && [ "$(LibsWarningsLogs "check_current"; echo "$?")" -eq "0" ]; then
LibsWarningsLogs "read_old"
elif [ "$OperatingMode" = "--game" ] && [ "$(LibsWarningsLogs "check_old"; echo "$?")" -eq "0" ]; then
( LibsWarningsLogs "create_new"; checkLibsStatus2 ) &
LibsWarningsLogs "read_old"
else
checkLibsStatus2
fi
if [ -f "$GAMEDIR/${SHORT_GAME_NAME}-configure-desktop.sh" ]; then
"$GAMEDIR/${SHORT_GAME_NAME}-configure-desktop.sh"
rm -f "$GAMEDIR/${SHORT_GAME_NAME}-configure-desktop.sh"
@ -298,25 +370,48 @@ else
BinaryToCheck="$6"
fi
if [ "$OperatingMode" = "--game" ]; then
if [ -d "$GAMEDIR/$LIBDIR" ]; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${GAMEDIR}/${LIBDIR}"
if [ -d "$GAMEDIR/$LIBDIR/vlc" ]; then
export VLC_PLUGIN_PATH="${GAMEDIR}/${LIBDIR}/vlc"
fi
if [ -d "$LibDir_wP" ]; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${LibDir_wP}"
if [ -d "$LibDir_wP/vlc" ]; then export VLC_PLUGIN_PATH="${LibDir_wP}/vlc"; fi
fi
"$GAMEDIR/$EXC_BINARY" $@
"$GAMEDIR/$EXC_BINARY" "$@"
ExitStatus="$?"
BinaryToCheck="$EXC_BINARY"
ErrorTime="$(date +"%s")"
fi
if [ "$ExitStatus" -ne "0" ] || [ "$OperatingMode" = "--tool-editor" ] || [ "$OperatingMode" = "--tool-g3dviewer" ]; then
if [ "$(echo "$@" | grep "^[ \t]*--help[ \t]*$")" = "" ] && [ "$(echo "$@" | grep "^[ \t]*-h[ \t]*$")" = "" ]; then
if [ "$(echo "$@" | grep '^[ \t]*--help[ \t]*$\|^[ \t]*-h[ \t]*$')" = "" ]; then
DiffTime="$(($ErrorTime-$BeginTime))"
if [ "$DiffTime" -le "15" ] && [ -e "$GAMEDIR/$BinaryToCheck" ] && [ -x "$GAMEDIR/$BinaryToCheck" ]; then
if [ "$OperatingMode" = "--game" ]; then ShowLibsTime=35; else ShowLibsTime=45; fi
if [ "$DiffTime" -le "$ShowLibsTime" ] && [ -e "$GAMEDIR/$BinaryToCheck" ] && [ -x "$GAMEDIR/$BinaryToCheck" ]; then
if [ "$OperatingMode" = "--game" ] || [ "$OperatingMode" = "--tool-buginfo" ]; then
LibsWarnings="
|| $LONG_GAME_NAME requires some libraries to be present on this operating system.
|| Missing libraries (if any) will be listed next, along with full names
|| and default versions. Use the package manager provided by your Linux
|| distribution to install them. Most Linux distributions provide a web search
|| allowing you to identify the packages containing these libraries.
|| Once you installed additional libraries, just run this script again.
||
|| Other issues preventing $LONG_GAME_NAME from starting can occur if
|| this version of game has not been tested with this version of your Linux
|| distribution. If so, we may provide compatibility updates which can be
|| downloaded and installed by running this script:
|| '${SHORT_GAME_NAME}-mini-update.sh'
||
|| If after this, $LONG_GAME_NAME still fails to start, please report a bug at
|| '$BugReportEngine'
|| or '$BugReportBoth'
||
|| OS info. [$OS_INFO], Arch.[$ARCHITECTURE], Dir.[$GAMEDIR]
|| $LibsWarnings"
fi
echo "$LibsWarnings" | sed 's/^[\t ]*||//g' >&2; echo
if [ "$IgnoredLibs" != "" ]; then
echo "... and as information useful only for game developers, List of ignored libs:" >&2
if [ "$OperatingMode" != "--tool-buginfo" ]; then
IgnoredLibs="$(echo "$IgnoredLibs" | sed -e 's/ */ /g' -e 's/^ //g')"
if [ "$IgnoredLibs" = "" ]; then IgnoredLibs="-none-"; fi
echo "Ignored libraries (please include in bug reports):" >&2
echo "$IgnoredLibs" >&2; echo
fi
else
@ -327,7 +422,7 @@ if [ "$ExitStatus" -ne "0" ] || [ "$OperatingMode" = "--tool-editor" ] || [ "$Op
|| here: '$BugReportBoth2',
|| or if you think that bug is related with game engine here:
|| '$BugReportEngine'"
if [ "$BugReportData" != "" ] && [ "$BugReportData" != "$BugReportBoth2" ] && [ "$BugReportData" != "$BugReportEngine" ] ; then
if [ "$BugReportData" != "" ] && [ "$BugReportData" != "$BugReportBoth2" ] && [ "$BugReportData" != "$BugReportEngine" ]; then
BugReportInfo="$BugReportInfo,
|| or if you think that bug is related with game data here:
|| '$BugReportData'."
@ -336,10 +431,6 @@ if [ "$ExitStatus" -ne "0" ] || [ "$OperatingMode" = "--tool-editor" ] || [ "$Op
fi
echo "$BugReportInfo" | sed 's/^[\t ]*||//g' >&2; echo
fi
#if [ "$OperatingMode" = "--game" ] && [ -f "$GAMEDIR/${SHORT_GAME_NAME}-mini-update.sh" ]; then
#echo "... attempt to perform mini update, which may solve tiny problems:" >&2
#"$GAMEDIR/${SHORT_GAME_NAME}-mini-update.sh"
#fi
fi
fi
exit "$ExitStatus"

View File

@ -17,5 +17,5 @@ if [ -d "$GAMEDIR/$LIBDIR" ]; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${GAMEDIR}/${LIBDIR}"
fi
BeginTime="$(date +"%s")"
"$GAMEDIR/$EXC_BINARY" $@
"$GAMEDIR/$EXC_BINARY" "$@"
"$GAMEDIR/$BASIC_SCRIPT" --tool-buginfo "$?" "$WARNINGS" "$BeginTime" "$(date +"%s")" "$EXC_BINARY"

View File

@ -17,5 +17,5 @@ if [ -d "$GAMEDIR/$LIBDIR" ]; then
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH:+$LD_LIBRARY_PATH:}${GAMEDIR}/${LIBDIR}"
fi
BeginTime="$(date +"%s")"
"$GAMEDIR/$EXC_BINARY" $@
"$GAMEDIR/$EXC_BINARY" "$@"
"$GAMEDIR/$BASIC_SCRIPT" --tool-buginfo "$?" "$WARNINGS" "$BeginTime" "$(date +"%s")" "$EXC_BINARY"

View File

@ -28,9 +28,9 @@ INCLUDE_DIRECTORIES(/usr/X11/include /opt/local/include)
# This changes Info.plist from something with variables and CMakeisms to
# something that can be installed on disk.
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/bundle_resources/Info.plist.in"
"${CMAKE_CURRENT_BINARY_DIR}/mk/macosx/bundle_resources/Info.plist")
SET(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/mk/macosx/bundle_resources/Info.plist")
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/mk/macos/bundle_resources/Info.plist.in"
"${CMAKE_CURRENT_BINARY_DIR}/mk/macos/bundle_resources/Info.plist")
SET(CPACK_BUNDLE_PLIST "${CMAKE_CURRENT_BINARY_DIR}/mk/macos/bundle_resources/Info.plist")
include (InstallRequiredSystemLibraries)
@ -38,6 +38,6 @@ include (InstallRequiredSystemLibraries)
SET(CPACK_GENERATOR "Bundle")
SET(CPACK_BUNDLE_NAME "MegaGlest")
SET(CPACK_PACKAGE_FILE_NAME "MegaGlest-game-macos-${MEGAGLEST_VERSION}")
SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/bundle_resources/MegaGlest.icns")
SET(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macosx/bundle_resources/MegaGlest.icns")
SET(CPACK_BUNDLE_STARTUP_COMMAND "${PROJECT_SOURCE_DIR}/mk/macosx/bundle_resources/MegaGlest.sh")
SET(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macos/bundle_resources/MegaGlest.icns")
SET(CPACK_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/mk/macos/bundle_resources/MegaGlest.icns")
SET(CPACK_BUNDLE_STARTUP_COMMAND "${PROJECT_SOURCE_DIR}/mk/macos/bundle_resources/MegaGlest.sh")

View File

@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>MegaGlest</string>
<key>CFBundleGetInfoString</key>
<string>v${MEGAGLEST_VERSION}, © 2001-2015 The MegaGlest Team.</string>
<string>v${MEGAGLEST_VERSION}, © 2001-2017 The MegaGlest Team.</string>
<key>CFBundleIconFile</key>
<string>MegaGlest</string>
<key>CFBundleIdentifier</key>

View File

@ -59,6 +59,7 @@ FontMenuNormalPrefix=-*-arial-*-r-*-*-
FontMenuVeryBigBaseSize=25
FontSizeAdjustment=0
FONT_HEIGHT_TEXT=yW
InternetGamesBlockScenario=lobby_access
Lang=english
MaxLights=3
Masterserver=http://master.megaglest.org/

View File

@ -18,7 +18,10 @@ cd "$CURRENTDIR"
#export XZ_OPT="$XZ_OPT -9e"
if [ "$1" = "-CI" ] || [ "$1" = "-" ] || [ "$(echo "$1" | grep '\--show-result-path')" != "" ]; then
if [ "$2" != "" ]; then SOURCE_BRANCH="$2"; fi
if [ "$2" != "" ]; then
SOURCE_BRANCH="$2"
if [ "$3" != "" ]; then NUMCORES="$3"; fi
fi
fi
VERSION="$(../linux/mg-version.sh --version)"
@ -28,7 +31,7 @@ if [ -d "$REPODIR/.git" ] && [ "$(which git 2>/dev/null)" != "" ]; then
cd "$REPODIR"
if [ "$SOURCE_BRANCH" = "" ]; then SOURCE_BRANCH="$(git branch | grep '^* ' | awk '{print $2}')"; fi
# on macos are problems with more advanced using awk ^
SOURCE_COMMIT="$(echo "[$(git rev-list HEAD --count).$(git log -1 --format=%h)]")"
SOURCE_COMMIT="$(echo "[$(git rev-list HEAD --count).$(git log -1 --format=%h --abbrev=7)]")"
fi
ARCHIVE_TYPE="tar.bz2"
@ -55,7 +58,9 @@ if [ "$skipbinarybuild" -eq "0" ]; then
echo "building binaries ..."
cd "$CURRENTDIR"
if [ -d "build" ]; then rm -rf "build"; fi
./build-mg.sh -b
build_command="./build-mg.sh -b"
if [ "$NUMCORES" != "" ]; then build_command="$build_command -c $NUMCORES"; fi
$build_command
if [ "$?" -ne "0" ]; then echo 'ERROR: "./build-mg.sh" failed.' >&2; exit 1; fi
else
echo "SKIPPING build of binaries ..."

View File

@ -33,7 +33,7 @@ cp -r "$BINARY_DIR/"* "$APP_GAME_DIR"
cp -r "$DATA_DIR/"* "$APP_GAME_DIR"; sleep 0.5s
if [ -f "$APP_GAME_DIR/MegaGlest.sh" ]; then rm -f "$APP_GAME_DIR/MegaGlest.sh"; fi
cp "$CURRENTDIR/build/mk/macosx/bundle_resources/Info.plist" "$APP_PLIST_DIR"
cp "$CURRENTDIR/build/mk/macos/bundle_resources/Info.plist" "$APP_PLIST_DIR"
cp "$CURRENTDIR/bundle_resources/MegaGlest.icns" "$APP_RES_DIR"
cp "$CURRENTDIR/bundle_resources/MegaGlest.sh" "$APP_BIN_DIR"
mv "$APP_BIN_DIR/MegaGlest.sh" "$APP_BIN_DIR/MegaGlest"

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1 @@
lib/

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1,4 @@
# Ignore everything in this directory
*
# Except this file
!.gitignore

View File

@ -0,0 +1 @@
builder\steamcmd.exe +login megaglest_team %1 +run_app_build_http ..\scripts\megaglest_build_windows_578870.vdf +quit

View File

@ -0,0 +1,6 @@
#!/usr/bin/env bash
STEAMROOT="$(cd "${0%/*}" && echo $PWD)"
STEAMCMD=`basename "$0" .sh`
./builder_linux/steamcmd.sh +login megaglest_team $1 +run_app_build_http ../scripts/megaglest_build_linux_578870.vdf +quit

View File

@ -0,0 +1,25 @@
"DepotBuildConfig"
{
// Set your assigned depot ID here
"DepotID" "578873"
"ContentRoot" "../content/base_content"
// include all files recursivley
"FileMapping"
{
// This can be a full path, or a path relative to ContentRoot
"LocalPath" "*"
// This is a path relative to the install folder of your game
"DepotPath" "."
// If LocalPath contains wildcards, setting this means that all
// matching files within subdirectories of LocalPath will also
// be included.
"recursive" "1"
}
// but exclude all symbol files
// This can be a full path, or a path relative to ContentRoot
"FileExclusion" "*.pdb"
}

View File

@ -0,0 +1,25 @@
"DepotBuildConfig"
{
// Set your assigned depot ID here
"DepotID" "578871"
"ContentRoot" "../content/linux_x64"
// include all files recursivley
"FileMapping"
{
// This can be a full path, or a path relative to ContentRoot
"LocalPath" "*"
// This is a path relative to the install folder of your game
"DepotPath" "."
// If LocalPath contains wildcards, setting this means that all
// matching files within subdirectories of LocalPath will also
// be included.
"recursive" "1"
}
// but exclude all symbol files
// This can be a full path, or a path relative to ContentRoot
"FileExclusion" "*.pdb"
}

View File

@ -0,0 +1,16 @@
"appbuild"
{
"appid" "578870"
"desc" "MegaGlest" // description for this build
"buildoutput" "..\output\" // build output folder for .log, .csm & .csd files, relative to location of this file
"contentroot" "..\content\" // root content folder, relative to location of this file
"setlive" "" // branch to set live after successful build, non if empty
"preview" "0" // to enable preview builds
"local" "" // set to flie path of local content server
"depots"
{
"578873" "base_content_build_578873.vdf"
"578871" "linux_x64_build_578871.vdf"
}
}

View File

@ -0,0 +1,16 @@
"appbuild"
{
"appid" "578870"
"desc" "MegaGlest" // description for this build
"buildoutput" "..\output\" // build output folder for .log, .csm & .csd files, relative to location of this file
"contentroot" "..\content\" // root content folder, relative to location of this file
"setlive" "" // branch to set live after successful build, non if empty
"preview" "0" // to enable preview builds
"local" "" // set to flie path of local content server
"depots"
{
"578872" "win_x86_build_578872.vdf"
"578874" "win_x64_build_578874.vdf"
}
}

View File

@ -0,0 +1,25 @@
"DepotBuildConfig"
{
// Set your assigned depot ID here
"DepotID" "578874"
"ContentRoot" "..\content\win_x64\"
// include all files recursivley
"FileMapping"
{
// This can be a full path, or a path relative to ContentRoot
"LocalPath" "*"
// This is a path relative to the install folder of your game
"DepotPath" "."
// If LocalPath contains wildcards, setting this means that all
// matching files within subdirectories of LocalPath will also
// be included.
"recursive" "1"
}
// but exclude all symbol files
// This can be a full path, or a path relative to ContentRoot
"FileExclusion" "*.pdb"
}

View File

@ -0,0 +1,25 @@
"DepotBuildConfig"
{
// Set your assigned depot ID here
"DepotID" "578872"
"ContentRoot" "..\content\win_x86\"
// include all files recursivley
"FileMapping"
{
// This can be a full path, or a path relative to ContentRoot
"LocalPath" "*"
// This is a path relative to the install folder of your game
"DepotPath" "."
// If LocalPath contains wildcards, setting this means that all
// matching files within subdirectories of LocalPath will also
// be included.
"recursive" "1"
}
// but exclude all symbol files
// This can be a full path, or a path relative to ContentRoot
"FileExclusion" "*.pdb"
}

View File

@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 14
VisualStudioVersion = 14.0.24720.0
VisualStudioVersion = 14.0.25420.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "g2xml", "vc2015\g2xml.vcxproj", "{407355A4-D12A-4E3B-A7EB-A835E573B376}"
EndProject

View File

@ -3,8 +3,8 @@
!define APNAME MegaGlest
!define APNAME_OLD Mega-Glest
!define APVER_OLD 3.11.1
!define APVER 3.12.0
!define APVER_OLD 3.12.0
!define APVER 3.13.0
!ifdef NSIS_WIN32_MAKENSIS
!define NSISCONF_3 ";" ; NSIS 2 tries to parse some preprocessor instructions inside "!if 0" blocks!

View File

@ -2,10 +2,10 @@
; General Attributes
!define APNAME MegaGlest
!define APVER 3.12.0
!define APVER 3.13.0
!define APNAME_OLD Mega-Glest
!define APVER_OLD 3.11.1
!define APVER_UPDATE 3.12.0
!define APVER_OLD 3.12.0
!define APVER_UPDATE 3.13.0
Name "${APNAME} ${APVER_UPDATE}"
SetCompressor /FINAL /SOLID lzma

View File

@ -84,7 +84,7 @@ git submodule update
set GITVERSION_SHA1=.
set GITVERSION_REV=.
set GET_GIT_SHA1="git log -1 --format=%%h"
set GET_GIT_SHA1="git log -1 --format=%%h --abbrev=7"
for /f "delims=" %%a in ('%GET_GIT_SHA1%') do @set GITVERSION_SHA1=%%a
for /f "delims=" %%a in ('git rev-list HEAD --count') do @set GITVERSION_REV=%%a
ECHO Will build using GIT Revision: [%GITVERSION_REV%.%GITVERSION_SHA1%]

View File

@ -108,7 +108,7 @@ git submodule update
set GITVERSION_SHA1=.
set GITVERSION_REV=.
set GET_GIT_SHA1="git log -1 --format=%%h"
set GET_GIT_SHA1="git log -1 --format=%%h --abbrev=7"
for /f "delims=" %%a in ('%GET_GIT_SHA1%') do @set GITVERSION_SHA1=%%a
for /f "delims=" %%a in ('git rev-list HEAD --count') do @set GITVERSION_REV=%%a
ECHO Will build using GIT Revision: [%GITVERSION_REV%.%GITVERSION_SHA1%]

View File

@ -85,18 +85,18 @@ ECHO --------------------------------
Echo Updating Code from GIT to latest Revision...
cd ..\..\
set GIT_NORM_BRANCH=.
for /f "delims=" %%a in ('git branch ^| findstr /rc:"^\* (detached"') do @set GIT_NORM_BRANCH=%%a
for /f "delims=" %%a in ('git branch ^| findstr /rc:"^\*[^(]*([^) d]*[ ]*detached"') do @set GIT_NORM_BRANCH=%%a
if "%GIT_NORM_BRANCH%" == "." git pull
cd data\glest_game
set GIT_NORM_BRANCH=.
for /f "delims=" %%a in ('git branch ^| findstr /rc:"^\* (detached"') do @set GIT_NORM_BRANCH=%%a
for /f "delims=" %%a in ('git branch ^| findstr /rc:"^\*[^(]*([^) d]*[ ]*detached"') do @set GIT_NORM_BRANCH=%%a
if "%GIT_NORM_BRANCH%" == "." git pull
cd ..\..\
git submodule update
set GITVERSION_SHA1=.
set GITVERSION_REV=.
set GET_GIT_SHA1="git log -1 --format=%%h"
set GET_GIT_SHA1="git log -1 --format=%%h --abbrev=7"
for /f "delims=" %%a in ('%GET_GIT_SHA1%') do @set GITVERSION_SHA1=%%a
for /f "delims=" %%a in ('git rev-list HEAD --count') do @set GITVERSION_REV=%%a
ECHO Will build using GIT Revision: [%GITVERSION_REV%.%GITVERSION_SHA1%]
@ -166,5 +166,6 @@ rem if not "%2" == "rebuild" msbuild %msBuildMaxCPU% /v:q /p:TrackFileAccess=fal
rem if not "%2" == "rebuild" msbuild %msBuildMaxCPU% /v:q /p:TrackFileAccess=false;VCTargetsPath=%MSBUILD_PATH_MG_x64%;Configuration=%MSBUILD_CONFIG%;Platform=x64;PlatformToolset=v140 /m Glest_vc2015.sln
if not "%2" == "rebuild" msbuild %msBuildMaxCPU% /v:q /p:VCTargetsPath=%MSBUILD_PATH_MG_x64%;Configuration=%MSBUILD_CONFIG%;Platform=x64;PlatformToolset=v140 /m Glest_vc2015.sln
ECHO ... End.
rem pause execution so we can see the output before the batch file exits
if not "%1" == "nopause" pause

View File

@ -79,18 +79,18 @@ ECHO --------------------------------
Echo Updating Code from GIT to latest Revision...
cd ..\..\
set GIT_NORM_BRANCH=.
for /f "delims=" %%a in ('git branch ^| findstr /rc:"^\* (detached"') do @set GIT_NORM_BRANCH=%%a
for /f "delims=" %%a in ('git branch ^| findstr /rc:"^\*[^(]*([^) d]*[ ]*detached"') do @set GIT_NORM_BRANCH=%%a
if "%GIT_NORM_BRANCH%" == "." git pull
cd data\glest_game
set GIT_NORM_BRANCH=.
for /f "delims=" %%a in ('git branch ^| findstr /rc:"^\* (detached"') do @set GIT_NORM_BRANCH=%%a
for /f "delims=" %%a in ('git branch ^| findstr /rc:"^\*[^(]*([^) d]*[ ]*detached"') do @set GIT_NORM_BRANCH=%%a
if "%GIT_NORM_BRANCH%" == "." git pull
cd ..\..\
git submodule update
set GITVERSION_SHA1=.
set GITVERSION_REV=.
set GET_GIT_SHA1="git log -1 --format=%%h"
set GET_GIT_SHA1="git log -1 --format=%%h --abbrev=7"
for /f "delims=" %%a in ('%GET_GIT_SHA1%') do @set GITVERSION_SHA1=%%a
for /f "delims=" %%a in ('git rev-list HEAD --count') do @set GITVERSION_REV=%%a
ECHO Will build using GIT Revision: [%GITVERSION_REV%.%GITVERSION_SHA1%]
@ -160,5 +160,6 @@ rem if not "%2" == "rebuild" msbuild %msBuildMaxCPU% /v:q /p:TrackFileAccess=fal
rem if not "%2" == "rebuild" msbuild %msBuildMaxCPU% /v:q /p:TrackFileAccess=false;VCTargetsPath=%MSBUILD_PATH_MG_x64%;Configuration=Release;Platform=Win32;PlatformToolset=v140 /m Glest_vc2015.sln
if not "%2" == "rebuild" msbuild %msBuildMaxCPU% /v:q /p:VCTargetsPath=%MSBUILD_PATH_MG_x64%;Configuration=Release;Platform=Win32;PlatformToolset=v140 /m Glest_vc2015.sln
ECHO ... End.
rem pause execution so we can see the output before the batch file exits
if not "%1" == "nopause" pause

View File

@ -59,7 +59,7 @@ rem pause
set GITVERSION_SHA1=.
set GITVERSION_REV=.
set GET_GIT_SHA1="git log -1 --format=%%h"
set GET_GIT_SHA1="git log -1 --format=%%h --abbrev=7"
for /f "delims=" %%a in ('%GET_GIT_SHA1%') do @set GITVERSION_SHA1=%%a
for /f "delims=" %%a in ('git rev-list HEAD --count') do @set GITVERSION_REV=%%a

View File

@ -60,6 +60,7 @@ FontMenuNormalPrefix=-*-arial-*-r-*-*-
FontMenuVeryBigBaseSize=25
FontSizeAdjustment=0
FONT_HEIGHT_TEXT=yW
InternetGamesBlockScenario=lobby_access
Lang=english
MaxLights=3
Masterserver=http://master.megaglest.org/

View File

@ -6,8 +6,15 @@ ECHO Changing to build folder [%~dp0] p1 [%1] p2 [%2]
rem pause
cd /d "%~dp0"
set CUR_DIR=%~dp0
set RELEASENAME=megaglest-standalone-data
set PROJDIR=..\..\
set REPODIR=%~dp0\..\..\
set PATH=%path%;%~dp0.\
set mg_version=
for /f "tokens=2 delims= " %%i in ('.\megaglest.exe --version') do call :mgver %%i
if exist ".\megaglest.exe" for /f "tokens=2 delims= " %%i in ('.\megaglest.exe --version') do call :mgver %%i
if exist "%REPODIR%data\glest_game\megaglest.exe" for /f "tokens=2 delims= " %%i in ('%REPODIR%data\glest_game\megaglest.exe --version') do call :mgver %%i
goto got_ver
:mgver
@ -27,12 +34,8 @@ exit /B 0
:got_ver
echo [%mg_version%]
set RELEASENAME=megaglest-standalone-data
set PACKAGE=%RELEASENAME%-%mg_version%.7z
set RELEASEDIR=release-data\%RELEASENAME%-%mg_version%
set PROJDIR=..\..\
set REPODIR=%~dp0\..\..\
set PATH=%path%;%~dp0.\
rem to debug creating the archive only
rem goto make_archive
@ -47,56 +50,56 @@ echo Copying data ...
mkdir %RELEASEDIR%\data\
cd /d %RELEASEDIR%\data\
echo GIT ARCHIVE data ...
git archive --remote %REPODIR%\data\glest_game\ HEAD:data | tar -x
git archive --format=tar --remote %REPODIR%\data\glest_game\ HEAD:data | %CUR_DIR%\tar.exe -xf -
cd /d "%~dp0"
rem pause
mkdir %RELEASEDIR%\docs\
cd /d %RELEASEDIR%\docs\
echo GIT ARCHIVE docs ...
git archive --remote %REPODIR%/data/glest_game/ HEAD:docs | tar -x
git archive --format=tar --remote %REPODIR%/data/glest_game/ HEAD:docs | %CUR_DIR%\tar.exe -xf -
cd /d "%~dp0"
cd /d %RELEASEDIR%\docs\
echo GIT ARCHIVE CHANGELOG.txt ...
git archive --remote %REPODIR% HEAD:docs/ CHANGELOG.txt | tar -x
git archive --format=tar --remote %REPODIR% HEAD:docs/ CHANGELOG.txt | %CUR_DIR%\tar.exe -xf -
cd /d "%~dp0"
rem pause
cd /d %RELEASEDIR%\docs\
echo GIT ARCHIVE README.txt ...
git archive --remote %REPODIR% HEAD:docs/ README.txt | tar -x
git archive --format=tar --remote %REPODIR% HEAD:docs/ README.txt | %CUR_DIR%\tar.exe -xf -
cd /d "%~dp0"
rem pause
mkdir %RELEASEDIR%\maps\
cd /d %RELEASEDIR%\maps\
echo GIT ARCHIVE maps ...
git archive --remote %REPODIR%/data/glest_game/ HEAD:maps | tar -x
git archive --format=tar --remote %REPODIR%/data/glest_game/ HEAD:maps | %CUR_DIR%\tar.exe -xf -
cd /d "%~dp0"
mkdir %RELEASEDIR%\scenarios\
cd /d %RELEASEDIR%\scenarios\
echo GIT ARCHIVE scenarios ...
git archive --remote %REPODIR%/data/glest_game/ HEAD:scenarios | tar -x
git archive --format=tar --remote %REPODIR%/data/glest_game/ HEAD:scenarios | %CUR_DIR%\tar.exe -xf -
cd /d "%~dp0"
mkdir %RELEASEDIR%\techs\
cd /d %RELEASEDIR%\techs\
echo GIT ARCHIVE techs ...
git archive --remote %REPODIR%/data/glest_game/ HEAD:techs | tar -x
git archive --format=tar --remote %REPODIR%/data/glest_game/ HEAD:techs | %CUR_DIR%\tar.exe -xf -
cd /d "%~dp0"
mkdir %RELEASEDIR%\tilesets\
cd /d %RELEASEDIR%\tilesets\
echo GIT ARCHIVE tilesets ...
git archive --remote %REPODIR%/data/glest_game/ HEAD:tilesets | tar -x
git archive --format=tar --remote %REPODIR%/data/glest_game/ HEAD:tilesets | %CUR_DIR%\tar.exe -xf -
cd /d "%~dp0"
mkdir %RELEASEDIR%\tutorials\
cd /d %RELEASEDIR%\tutorials\
echo GIT ARCHIVE tutorials ...
git archive --remote %REPODIR%/data/glest_game/ HEAD:tutorials | tar -x
git archive --format=tar --remote %REPODIR%/data/glest_game/ HEAD:tutorials | %CUR_DIR%\tar.exe -xf -
cd /d "%~dp0"
rem START

View File

@ -224,6 +224,7 @@
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">
@ -260,6 +261,7 @@
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -297,6 +299,7 @@
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">
@ -334,6 +337,7 @@
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NO_STREFLOP|Win32'">
@ -363,6 +367,7 @@
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NO_STREFLOP|x64'">
@ -391,6 +396,7 @@
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -223,6 +223,7 @@
<DataExecutionPrevention>
</DataExecutionPrevention>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">
@ -258,6 +259,7 @@
<DataExecutionPrevention>
</DataExecutionPrevention>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -295,6 +297,7 @@
</DataExecutionPrevention>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<IgnoreSpecificDefaultLibraries>;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">
@ -332,6 +335,7 @@
</DataExecutionPrevention>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<IgnoreSpecificDefaultLibraries>;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NO_STREFLOP|Win32'">
@ -361,6 +365,7 @@
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<TargetMachine>MachineX86</TargetMachine>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NO_STREFLOP|x64'">
@ -389,6 +394,7 @@
<SubSystem>Windows</SubSystem>
<OptimizeReferences>true</OptimizeReferences>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -286,6 +286,7 @@
<IgnoreAllDefaultLibraries>
</IgnoreAllDefaultLibraries>
<Profile>true</Profile>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|Win32'">
@ -336,6 +337,7 @@
</ShowProgress>
<IgnoreAllDefaultLibraries>
</IgnoreAllDefaultLibraries>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
@ -387,6 +389,7 @@
<IgnoreAllDefaultLibraries>
</IgnoreAllDefaultLibraries>
<Profile>true</Profile>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_WITHOUT_STREFLOP|x64'">
@ -437,6 +440,7 @@
</ShowProgress>
<IgnoreAllDefaultLibraries>
</IgnoreAllDefaultLibraries>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NO_STREFLOP|Win32'">
@ -477,6 +481,7 @@
<DataExecutionPrevention>
</DataExecutionPrevention>
<TargetMachine>NotSet</TargetMachine>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release_NO_STREFLOP|x64'">
@ -516,6 +521,7 @@
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
</DataExecutionPrevention>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
</ItemDefinitionGroup>
<ItemGroup>

View File

@ -232,6 +232,7 @@
<AdditionalLibraryDirectories>../../../source/windows_deps_2015/lib;../../../build/$(Configuration)/libglest;../../../source/shared_lib/sources/streflop/libstreflop;$(DXSDK_DIR)/lib/x86;../../../source/windows_deps_2015/Microsoft DirectX SDK %28November 2007%29/Lib/x86;../../../source/windows_deps_2015/cppunit/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>dsound.lib;dxguid.lib;glew32s.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;opengl32.lib;glu32.lib;wsock32.lib;libglest.lib;mmc.lib;lua.lib;xerces-c_static_3.lib;Dbghelp.lib;libpng16.lib;jpeg.lib;zlibstat.lib;sdl2.lib;sdl2main.lib;winmm.lib;openal32.lib;iphlpapi.lib;libstreflop.lib;libcurl.lib;ws2_32.lib;libircclient.lib;freetype244MT.lib;ftgl_static.lib;libeay32.lib;ssleay32.lib;crash_generation_client.lib;exception_handler.lib;common.lib;processor_bits.lib;cppunit.lib;version.lib;imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libcmtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<PostBuildEvent>
<Command>$(OutDir)\megaglest_tests.exe</Command>
@ -263,6 +264,7 @@
<AdditionalLibraryDirectories>../../../source/windows_deps_2015/lib;../../../build/$(Configuration)/libglest;../../../source/shared_lib/sources/streflop/libstreflop;$(DXSDK_DIR)/lib/x86;../../../source/windows_deps_2015/Microsoft DirectX SDK %28November 2007%29/Lib/x86;../../../source/windows_deps_2015/cppunit/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>dsound.lib;dxguid.lib;glew32s.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;opengl32.lib;glu32.lib;wsock32.lib;libglest.lib;mmc.lib;lua.lib;xerces-c_static_3.lib;Dbghelp.lib;libpng15.lib;jpeg.lib;zlibstat.lib;sdl.lib;sdlmain.lib;winmm.lib;openal32.lib;iphlpapi.lib;libstreflop.lib;libcurl.lib;ws2_32.lib;libircclient.lib;freetype244MT.lib;ftgl_static.lib;libeay32.lib;ssleay32.lib;crash_generation_client.lib;exception_handler.lib;common.lib;processor_bits.lib;cppunit.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libcmtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<PostBuildEvent>
<Command>$(OutDir)\megaglest_tests.exe</Command>
@ -294,6 +296,7 @@
<AdditionalLibraryDirectories>../../../source/windows_deps_2015/lib;../../../build/$(Configuration)/libglest;../../../source/shared_lib/sources/streflop/libstreflop;$(DXSDK_DIR)/lib/x86;../../../source/windows_deps_2015/Microsoft DirectX SDK %28November 2007%29/Lib/x86;../../../source/windows_deps_2015/cppunit/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>dsound.lib;dxguid.lib;glew32s.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;opengl32.lib;glu32.lib;wsock32.lib;libglest.lib;mmc.lib;lua.lib;xerces-c_static_3.lib;Dbghelp.lib;libpng15.lib;jpeg.lib;zlibstat.lib;sdl.lib;sdlmain.lib;winmm.lib;openal32.lib;iphlpapi.lib;libstreflop.lib;libcurl.lib;ws2_32.lib;libircclient.lib;freetype244MT.lib;ftgl_static.lib;libeay32.lib;ssleay32.lib;crash_generation_client.lib;exception_handler.lib;common.lib;processor_bits.lib;cppunit.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>libcmtd.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<PostBuildEvent>
<Command>$(OutDir)\megaglest_tests.exe</Command>
@ -328,6 +331,7 @@
<AdditionalLibraryDirectories>../../../source/windows_deps_2015/lib;../../../build/$(Configuration)/libglest;$(DXSDK_DIR)/lib/x64;../../../source/windows_deps_2015/Microsoft DirectX SDK %28November 2007%29/Lib/x64;../../../source/windows_deps_2015/cppunit/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>dsound.lib;dxguid.lib;glew32s.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;opengl32.lib;glu32.lib;wsock32.lib;libglest.lib;mmc.lib;lua.lib;xerces-c_static_3.lib;Dbghelp.lib;libpng16.lib;jpeg.lib;zlibstat.lib;sdl2.lib;sdl2main.lib;winmm.lib;openal64.lib;iphlpapi.lib;libcurl.lib;ws2_32.lib;libircclient.lib;freetype244MT.lib;ftgl_static.lib;cppunit.lib;version.lib;imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<PostBuildEvent>
<Command>$(OutDir)\$(TargetName)$(TargetExt)</Command>
@ -362,6 +366,7 @@
<AdditionalLibraryDirectories>../../../source/windows_deps_2015/lib;../../../build/$(Configuration)/libglest;$(DXSDK_DIR)/lib/x64;../../../source/windows_deps_2015/Microsoft DirectX SDK %28November 2007%29/Lib/x64;../../../source/windows_deps_2015/cppunit/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>dsound.lib;dxguid.lib;glew32s.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;opengl32.lib;glu32.lib;wsock32.lib;libglest.lib;mmc.lib;lua.lib;xerces-c_static_3.lib;Dbghelp.lib;libpng16.lib;jpeg.lib;zlibstat.lib;sdl2.lib;sdl2main.lib;winmm.lib;openal64.lib;iphlpapi.lib;libcurl.lib;ws2_32.lib;libircclient.lib;freetype244MT.lib;ftgl_static.lib;cppunit.lib;libeay32.lib;ssleay32.lib;version.lib;imm32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<PostBuildEvent>
<Command>$(OutDir)\$(TargetName)$(TargetExt)</Command>
@ -396,6 +401,7 @@
<AdditionalLibraryDirectories>../../../source/windows_deps_2015/lib;../../../build/$(Configuration)/libglest;$(DXSDK_DIR)/lib/x64;../../../source/windows_deps_2015/Microsoft DirectX SDK %28November 2007%29/Lib/x64;../../../source/windows_deps_2015/cppunit/lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>dsound.lib;dxguid.lib;glew32s.lib;libogg_static.lib;libvorbis_static.lib;libvorbisfile_static.lib;opengl32.lib;glu32.lib;wsock32.lib;libglest.lib;mmc.lib;lua.lib;xerces-c_static_3.lib;Dbghelp.lib;libpng15.lib;jpeg.lib;zlibstat.lib;sdl.lib;sdlmain.lib;winmm.lib;openal64.lib;iphlpapi.lib;libcurl.lib;ws2_32.lib;libircclient.lib;freetype244MT.lib;ftgl_static.lib;cppunit.lib;%(AdditionalDependencies)</AdditionalDependencies>
<IgnoreSpecificDefaultLibraries>;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<PostBuildEvent>
<Command>$(OutDir)\$(TargetName)$(TargetExt)</Command>

View File

@ -49,6 +49,39 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER)
MESSAGE(STATUS " wxWidgets: ${wxWidgets_INCLUDE_DIRS} ;/; ${wxWidgets_LIBRARIES}")
ENDIF()
find_package(PkgConfig REQUIRED)
IF(FORCE_STREFLOP_SOFTWRAPPER)
pkg_search_module(STREFLOP streflop-soft)
ELSE()
IF(HAS_SSE_EXTENSIONS AND NOT ${FORCE_MAX_SSE_LEVEL} MATCHES "0")
pkg_search_module(STREFLOP streflop-sse)
ELSE()
IF(HAS_X87_SUPPORT)
pkg_search_module(STREFLOP streflop-x87)
ELSE()
pkg_search_module(STREFLOP streflop-soft)
ENDIF()
ENDIF()
ENDIF()
IF(NOT STREFLOP_FOUND)
pkg_search_module(STREFLOP streflop)
ENDIF()
MESSAGE(STATUS "Search for Library STREFLOP result = ${STREFLOP_FOUND} libs: ${STREFLOP_LIBRARIES} include dirs: ${STREFLOP_INCLUDE_DIRS}")
IF(FORCE_EMBEDDED_LIBS)
SET(STREFLOP_FOUND OFF)
MESSAGE(STATUS "FORCING USE of EMBEDDED Libraries...")
ENDIF()
IF(WANT_USE_STREFLOP)
IF(STREFLOP_FOUND)
INCLUDE_DIRECTORIES(${STREFLOP_INCLUDE_DIRS} ${STREFLOP_INCLUDE_DIRS}/streflop)
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${STREFLOP_LIBRARIES})
ADD_DEFINITIONS("-DUSE_STREFLOP_PKG")
ENDIF()
ENDIF()
IF(WIN32)
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${PROJECT_SOURCE_DIR}/source/win32_deps/wxWidgets-2.8.10/lib/libwx_mswu-2.8-i586-mingw32msvc.dll.a)
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${PROJECT_SOURCE_DIR}/source/win32_deps/wxWidgets-2.8.10/lib/libwx_mswu_gl-2.8-i586-mingw32msvc.dll.a)
@ -107,7 +140,7 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER)
${GLEST_MAIN_INCLUDE_ROOT}global
${GLEST_MAIN_INCLUDE_ROOT}sound)
IF(WANT_USE_STREFLOP)
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
SET(GLEST_LIB_INCLUDE_DIRS
${GLEST_LIB_INCLUDE_DIRS}
${GLEST_LIB_INCLUDE_ROOT}streflop)
@ -157,7 +190,7 @@ IF(BUILD_MEGAGLEST_MODEL_VIEWER)
ADD_EXECUTABLE(${TARGET_NAME} ${MG_SOURCE_FILES} ${MG_INCLUDE_FILES})
IF(WANT_USE_STREFLOP)
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
TARGET_LINK_LIBRARIES(${TARGET_NAME} streflop)
ENDIF()

View File

@ -56,7 +56,7 @@ const char *folderDelimiter = "/";
//int GameConstants::updateFps= 40;
//int GameConstants::cameraFps= 100;
const string g3dviewerVersionString= "v3.12.0";
const string g3dviewerVersionString= "v3.13.0";
// Because g3d should always support alpha transparency
string fileFormat = "png";
@ -455,7 +455,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
auto_ptr<wchar_t> wstr(Ansi2WideString(appPath.c_str()));
wstring launchApp = wstring(wstr.get()) + L" \"%1\"";
DWORD len = (DWORD)launchApp.length() + 1;
DWORD len = (launchApp.size() + 1) * sizeof(wchar_t);
RegSetValueEx(keyHandle, NULL, 0, REG_SZ, (PBYTE)launchApp.c_str(), len);
RegCloseKey(keyHandle);
@ -463,7 +463,7 @@ MainWindow::MainWindow( std::pair<string,vector<string> > unitToLoad,
RegCreateKeyEx(HKEY_CURRENT_USER,subKey.c_str(),0, NULL, 0, KEY_ALL_ACCESS, NULL, &keyHandle, &dwDisposition);
//Set the value.
launchApp = L"megaglest.g3d";
len = (DWORD)launchApp.length() + 1;
len = (launchApp.size() + 1) * sizeof(wchar_t);
RegSetValueEx(keyHandle, NULL, 0, REG_SZ, (PBYTE)launchApp.c_str(), len);
RegCloseKey(keyHandle);

View File

@ -139,11 +139,44 @@ IF(BUILD_MEGAGLEST)
ENDIF()
ENDIF()
find_package(PkgConfig REQUIRED)
IF(FORCE_STREFLOP_SOFTWRAPPER)
pkg_search_module(STREFLOP streflop-soft)
ELSE()
IF(HAS_SSE_EXTENSIONS AND NOT ${FORCE_MAX_SSE_LEVEL} MATCHES "0")
pkg_search_module(STREFLOP streflop-sse)
ELSE()
IF(HAS_X87_SUPPORT)
pkg_search_module(STREFLOP streflop-x87)
ELSE()
pkg_search_module(STREFLOP streflop-soft)
ENDIF()
ENDIF()
ENDIF()
IF(NOT STREFLOP_FOUND)
pkg_search_module(STREFLOP streflop)
ENDIF()
MESSAGE(STATUS "Search for Library STREFLOP result = ${STREFLOP_FOUND} libs: ${STREFLOP_LIBRARIES} include dirs: ${STREFLOP_INCLUDE_DIRS}")
IF(FORCE_EMBEDDED_LIBS)
SET(STREFLOP_FOUND OFF)
MESSAGE(STATUS "FORCING USE of EMBEDDED Libraries...")
ENDIF()
IF(WANT_USE_STREFLOP)
IF(STREFLOP_FOUND)
INCLUDE_DIRECTORIES(${STREFLOP_INCLUDE_DIRS} ${STREFLOP_INCLUDE_DIRS}/streflop)
SET(EXTERNAL_LIBS ${EXTERNAL_LIBS} ${STREFLOP_LIBRARIES})
ADD_DEFINITIONS("-DUSE_STREFLOP_PKG")
ENDIF()
ENDIF()
#########################################################################################
# megaglest game
SET(DIRS_WITH_SRC
ai
ai
facilities
game
global
@ -174,7 +207,7 @@ IF(BUILD_MEGAGLEST)
${GLEST_LIB_INCLUDE_ROOT}lua
${GLEST_LIB_INCLUDE_ROOT}map)
IF(WANT_USE_STREFLOP)
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
SET(GLEST_LIB_INCLUDE_DIRS
${GLEST_LIB_INCLUDE_DIRS}
${GLEST_LIB_INCLUDE_ROOT}streflop
@ -241,7 +274,7 @@ IF(BUILD_MEGAGLEST)
ADD_EXECUTABLE(${TARGET_NAME} ${MG_SOURCE_FILES} ${MG_INCLUDE_FILES})
SET(MG_STREFLOP "")
IF(WANT_USE_STREFLOP)
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
SET(MG_STREFLOP "streflop")
ENDIF()
@ -262,7 +295,7 @@ IF(BUILD_MEGAGLEST)
TARGET_LINK_LIBRARIES(${TARGET_NAME} stdc++ gcc odbc32 wsock32 winspool winmm shell32 comctl32 ctl3d32 advapi32 wsock32 opengl32 glu32 ole32 oleaut32 uuid mingw32 ddraw dsound dxguid ws2_32 iphlpapi wsock32 libogg libvorbis libvorbisfile zlib jpeg libpng xerces-c2_8_0 OpenAL32 libcurl winmm gdi32 opengl32 glu32 ${SDL_VERSION_NAME} ${SDL_VERSION_NAME}main lua5.1 ${MG_STREFLOP} libmegaglest stdc++ moldname mingwex msvcrt user32 kernel32)
ENDIF()
IF(NOT WIN32)
IF(WANT_USE_STREFLOP)
IF(WANT_USE_STREFLOP AND NOT STREFLOP_FOUND)
TARGET_LINK_LIBRARIES(${TARGET_NAME} ${MG_STREFLOP})
ENDIF()
TARGET_LINK_LIBRARIES(${TARGET_NAME} libmegaglest)
@ -329,16 +362,16 @@ IF(BUILD_MEGAGLEST)
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH})
ELSEIF(UNIX AND APPLE)
INSTALL(FILES
"${PROJECT_SOURCE_DIR}/mk/macosx/glest.ini"
"${PROJECT_SOURCE_DIR}/mk/macos/glest.ini"
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH})
IF(WANT_SINGLE_INSTALL_DIRECTORY AND EXISTS "${PROJECT_SOURCE_DIR}/mk/macosx/p7zip/")
IF(WANT_SINGLE_INSTALL_DIRECTORY AND EXISTS "${PROJECT_SOURCE_DIR}/mk/macos/p7zip/")
INSTALL(DIRECTORY
"${PROJECT_SOURCE_DIR}/mk/macosx/p7zip"
"${PROJECT_SOURCE_DIR}/mk/macos/p7zip"
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH})
ENDIF()
IF(WANT_SINGLE_INSTALL_DIRECTORY AND EXISTS "${PROJECT_SOURCE_DIR}/mk/macosx/lib/")
IF(WANT_SINGLE_INSTALL_DIRECTORY AND EXISTS "${PROJECT_SOURCE_DIR}/mk/macos/lib/")
INSTALL(DIRECTORY
"${PROJECT_SOURCE_DIR}/mk/macosx/lib/"
"${PROJECT_SOURCE_DIR}/mk/macos/lib/"
DESTINATION "${MEGAGLEST_DATA_INSTALL_PATH}/../../Frameworks/")
ENDIF()
ENDIF()
@ -348,7 +381,7 @@ IF(BUILD_MEGAGLEST)
DESTINATION ${MEGAGLEST_DATA_INSTALL_PATH})
IF(UNIX AND APPLE AND NOT WANT_SINGLE_INSTALL_DIRECTORY)
INSTALL(FILES
"${PROJECT_SOURCE_DIR}/mk/macosx/bundle_resources/MegaGlest.icns"
"${PROJECT_SOURCE_DIR}/mk/macos/bundle_resources/MegaGlest.icns"
DESTINATION ${MEGAGLEST_ICON_INSTALL_PATH})
ENDIF()
ENDIF()

View File

@ -329,6 +329,14 @@ Ai::~Ai() {
aiInterface = NULL;
}
RandomGen* Ai::getRandom() {
// if(Thread::isCurrentThreadMainThread() == false) {
// throw megaglest_runtime_error("Invalid access to AI random from outside main thread current id = " +
// intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId()));
// }
return &random;
}
void Ai::update() {
Chrono chrono;
@ -451,7 +459,8 @@ float Ai::getRatioOfClass(UnitClass uc,UnitClass *additionalUnitClassToExcludeFr
return 0;
}
else {
return static_cast<float>(getCountOfClass(uc,additionalUnitClassToExcludeFromCount)) / aiInterface->getMyUnitCount();
//return static_cast<float>(getCountOfClass(uc,additionalUnitClassToExcludeFromCount)) / aiInterface->getMyUnitCount();
return truncateDecimal<float>(static_cast<float>(getCountOfClass(uc,additionalUnitClassToExcludeFromCount)) / aiInterface->getMyUnitCount(),6);
}
}
@ -654,7 +663,13 @@ bool Ai::findPosForBuilding(const UnitType* building, const Vec2i &searchPos, Ve
for(int i=searchPos.x - currRadius; i < searchPos.x + currRadius; ++i) {
for(int j=searchPos.y - currRadius; j < searchPos.y + currRadius; ++j) {
outPos= Vec2i(i, j);
if(aiInterface->isFreeCells(outPos - Vec2i(minBuildSpacing), building->getSize() + minBuildSpacing * 2, fLand)) {
if(aiInterface->isFreeCells(outPos - Vec2i(minBuildSpacing), building->getAiBuildSize() + minBuildSpacing * 2, fLand)) {
int aiBuildSizeDiff= building->getAiBuildSize()- building->getSize();
if( aiBuildSizeDiff>0){
int halfSize=aiBuildSizeDiff/2;
outPos.x+=halfSize;
outPos.y+=halfSize;
}
return true;
}
}

View File

@ -198,7 +198,7 @@ public:
//state requests
AiInterface *getAiInterface() const {return aiInterface;}
RandomGen* getRandom() {return &random;}
RandomGen* getRandom();
int getCountOfType(const UnitType *ut);
int getMinWarriors() const { return minWarriors; }

View File

@ -857,7 +857,10 @@ void AiRuleProduce::produceGenericNew(const ProduceTask *pt) {
//for each unit, produce it if possible
for(int i = 0; i < aiInterface->getMyUnitCount(); ++i) {
if(aiInterface->getMyUnit(i)->getCurrCommand()!=NULL && aiInterface->getMyUnit(i)->getCurrCommand()->getCommandType()->getClass()==ccBuild){
//skip this units as it is currently building something
continue;
}
//for each command
const UnitType *ut= aiInterface->getMyUnit(i)->getType();
@ -1059,7 +1062,10 @@ void AiRuleProduce::produceGeneric(const ProduceTask *pt) {
//for each unit, produce it if possible
for(int i = 0; i < aiInterface->getMyUnitCount(); ++i) {
if(aiInterface->getMyUnit(i)->getCurrCommand()!=NULL && aiInterface->getMyUnit(i)->getCurrCommand()->getCommandType()->getClass()==ccBuild){
//skip this units as it is currently building something
continue;
}
//for each command
const UnitType *ut= aiInterface->getMyUnit(i)->getType();
for(int j = 0; j < ut->getCommandTypeCount(); ++j) {
@ -1144,7 +1150,11 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
const CommandType *ctypeForCostCheck = NULL;
//for each unit
for(int i=0; i<aiInterface->getMyUnitCount(); ++i){
//don't use units which are currently building
if(aiInterface->getMyUnit(i)->getCurrCommand()!=NULL && aiInterface->getMyUnit(i)->getCurrCommand()->getCommandType()->getClass()==ccBuild){
//skip this units as it is currently building something
continue;
}
//for each command
const UnitType *ut= aiInterface->getMyUnit(i)->getType();
for(int j=0; j<ut->getCommandTypeCount(); ++j){
@ -1208,7 +1218,10 @@ void AiRuleProduce::produceSpecific(const ProduceTask *pt){
//for each unit
for(int i=0; i<aiInterface->getMyUnitCount(); ++i){
if(aiInterface->getMyUnit(i)->getCurrCommand()!=NULL && aiInterface->getMyUnit(i)->getCurrCommand()->getCommandType()->getClass()==ccBuild){
//skip this units as it is currently building something
continue;
}
//for each command
const UnitType *ut= aiInterface->getMyUnit(i)->getType();
for(int j=0; j<ut->getCommandTypeCount(); ++j){

View File

@ -51,8 +51,9 @@ PathFinder::PathFinder() {
}
int PathFinder::getPathFindExtendRefreshNodeCount(FactionState &faction) {
int refreshNodeCount = faction.random.randRange(PathFinder::pathFindExtendRefreshNodeCountMin,PathFinder::pathFindExtendRefreshNodeCountMax);
return refreshNodeCount;
//int refreshNodeCount = faction.random.randRange(PathFinder::pathFindExtendRefreshNodeCountMin,PathFinder::pathFindExtendRefreshNodeCountMax);
//return refreshNodeCount;
return PathFinder::pathFindExtendRefreshNodeCountMin;
}
PathFinder::PathFinder(const Map *map) {
@ -202,11 +203,19 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
if(map->canMove(unit, unit->getPos(), pos)) {
if(frameIndex < 0) {
unit->setTargetPos(pos);
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"map->canMove to pos [%s] from [%s]",pos.getString().c_str(),unit->getPos().getString().c_str());
snprintf(szBuf,8096,"#1 map->canMove to pos [%s] from [%s]",pos.getString().c_str(),unit->getPos().getString().c_str());
unit->logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,szBuf);
}
unit->setTargetPos(pos,frameIndex < 0);
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"#2 map->canMove to pos [%s] from [%s]",pos.getString().c_str(),unit->getPos().getString().c_str());
unit->logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,szBuf);
}
@ -222,7 +231,7 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
if(map->canMove(unit, unit->getPos(), pos)) {
if(frameIndex < 0) {
advPath->pop();
unit->setTargetPos(pos);
unit->setTargetPos(pos,frameIndex < 0);
}
return tsMoving;
@ -321,10 +330,29 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
int factionIndex = unit->getFactionIndex();
FactionState &faction = factions.getFactionState(factionIndex);
int tryRadius = faction.random.randRange(0,1);
//if(Thread::isCurrentThreadMainThread() == false) {
// throw megaglest_runtime_error("#2 Invalid access to FactionState random from outside main thread current id = " +
// intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId()));
//}
int tryRadius = faction.random.randRange(1,2);
//int tryRadius = faction.random.IRandomX(1,2);
//int tryRadius = 1;
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In astar bailout() tryRadius %d",tryRadius);
if(frameIndex >= 0) {
unit->logSynchDataThreaded(__FILE__,__LINE__,szBuf);
}
else {
unit->logSynchData(__FILE__,__LINE__,szBuf);
}
}
// Try to bail out up to PathFinder::pathFindBailoutRadius cells away
if(tryRadius > 0) {
if(tryRadius == 2) {
for(int bailoutX = -PathFinder::pathFindBailoutRadius; bailoutX <= PathFinder::pathFindBailoutRadius && ts == tsBlocked; ++bailoutX) {
for(int bailoutY = -PathFinder::pathFindBailoutRadius; bailoutY <= PathFinder::pathFindBailoutRadius && ts == tsBlocked; ++bailoutY) {
const Vec2i newFinalPos = finalPos + Vec2i(bailoutX,bailoutY);
@ -413,7 +441,7 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
if(map->canMove(unit, unit->getPos(), pos)) {
if(frameIndex < 0) {
unit->setTargetPos(pos);
unit->setTargetPos(pos,frameIndex < 0);
}
}
else {
@ -438,7 +466,7 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
if(map->canMove(unit, unit->getPos(), pos)) {
if(frameIndex < 0) {
advPath->pop();
unit->setTargetPos(pos);
unit->setTargetPos(pos,frameIndex < 0);
}
}
else {
@ -594,11 +622,11 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
}
unit->setUsePathfinderExtendedMaxNodes(false);
// if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
// char szBuf[8096]="";
// snprintf(szBuf,8096,"return factions[unitFactionIndex].precachedTravelState[unit->getId()];");
// unit->logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,szBuf);
// }
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"return factions[unitFactionIndex].precachedTravelState[unit->getId()];");
unit->logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,szBuf);
}
return faction.precachedTravelState[unit->getId()];
}
@ -638,7 +666,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
const Vec2i unitPos = unit->getPos();
const Vec2i finalPos= computeNearestFreePos(unit, targetPos);
float dist= unitPos.dist(finalPos);
float dist = unitPos.dist(finalPos);
faction.useMaxNodeCount = PathFinder::pathFindNodesMax;
@ -808,9 +836,9 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
if(nodeLimitReached == true) {
if(faction.closedNodesList.empty() == false) {
float bestHeuristic = faction.closedNodesList.begin()->first;
float bestHeuristic = truncateDecimal<float>(faction.closedNodesList.begin()->first,6);
if(lastNode != NULL && bestHeuristic < lastNode->heuristic) {
lastNode= faction.closedNodesList.begin()->second[0];
lastNode= faction.closedNodesList.begin()->second.front();
}
}
}
@ -889,7 +917,6 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
if(minorDebugPathfinder) printf("nodePos [%s]\n",nodePos.getString().c_str());
if(frameIndex >= 0) {
faction.precachedPath[unit->getId()].push_back(nodePos);
}
else {
@ -903,19 +930,37 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled == true && chrono.getMillis() > 4) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis());
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
char szBuf[8096]="";
string pathToTake = "";
for(int i = 0; i < path->getQueueCount(); ++i) {
Vec2i &pos = path->getQueue()[i];
if(pathToTake != "") {
pathToTake += ", ";
if(frameIndex < 0) {
vector<Vec2i> pathQueue = path->getQueue();
for(unsigned int index = 0; index < pathQueue.size(); ++index) {
Vec2i &pos = pathQueue[index];
if(pathToTake != "") {
pathToTake += ", ";
}
pathToTake += pos.getString();
}
}
else {
for(unsigned int index = 0; index < faction.precachedPath[unit->getId()].size(); ++index) {
Vec2i &pos = faction.precachedPath[unit->getId()][index];
if(pathToTake != "") {
pathToTake += ", ";
}
pathToTake += pos.getString();
}
pathToTake += pos.getString();
}
unit->logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,szBuf);
snprintf(szBuf,8096,"Path for unit to take = %s",pathToTake.c_str());
if(frameIndex < 0) {
unit->logSynchData(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,szBuf);
}
else {
unit->logSynchDataThreaded(extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,szBuf);
}
}
if(SystemFlags::getSystemSettingType(SystemFlags::debugPathFinder).enabled == true) {
@ -976,25 +1021,24 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
void PathFinder::processNearestFreePos(const Vec2i &finalPos, int i, int j, int size, Field field, int teamIndex,Vec2i unitPos, Vec2i &nearestPos, float &nearestDist) {
try {
Vec2i currPos= finalPos + Vec2i(i, j);
Vec2i currPos= finalPos + Vec2i(i, j);
if(map->isAproxFreeCells(currPos, size, field, teamIndex)) {
float dist= currPos.dist(finalPos);
if(map->isAproxFreeCells(currPos, size, field, teamIndex)) {
float dist = currPos.dist(finalPos);
//if nearer from finalPos
if(dist < nearestDist){
nearestPos= currPos;
nearestDist= dist;
}
//if the distance is the same compare distance to unit
else if(dist == nearestDist){
if(currPos.dist(unitPos) < nearestPos.dist(unitPos)) {
nearestPos= currPos;
//if nearer from finalPos
if(dist < nearestDist){
nearestPos = currPos;
nearestDist = dist;
}
//if the distance is the same compare distance to unit
else if(dist == nearestDist){
if(currPos.dist(unitPos) < nearestPos.dist(unitPos)) {
nearestPos = currPos;
}
}
}
}
}
catch(const exception &ex) {
SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what());
@ -1034,7 +1078,7 @@ Vec2i PathFinder::computeNearestFreePos(const Unit *unit, const Vec2i &finalPos)
Vec2i unitPos= unit->getPosNotThreadSafe();
nearestPos= unitPos;
float nearestDist= unitPos.dist(finalPos);
float nearestDist = unitPos.dist(finalPos);
for(int i= -maxFreeSearchRadius; i <= maxFreeSearchRadius; ++i) {
for(int j= -maxFreeSearchRadius; j <= maxFreeSearchRadius; ++j) {

View File

@ -24,7 +24,7 @@
#include "skill_type.h"
#include "map.h"
#include "unit.h"
//#include "randomc.h"
#include "leak_dumper.h"
using std::vector;
@ -90,15 +90,16 @@ public:
protected:
Mutex *factionMutexPrecache;
public:
FactionState() :
FactionState(int factionIndex) :
//factionMutexPrecache(new Mutex) {
factionMutexPrecache(NULL) {
factionMutexPrecache(NULL) { //, random(factionIndex) {
openPosList.clear();
openNodesList.clear();
closedNodesList.clear();
nodePool.clear();
nodePoolCount = 0;
this->factionIndex = factionIndex;
useMaxNodeCount = 0;
precachedTravelState.clear();
@ -119,7 +120,9 @@ public:
std::vector<Node> nodePool;
int nodePoolCount;
int factionIndex;
RandomGen random;
//CRandomMersenne random;
int useMaxNodeCount;
std::map<int,TravelState> precachedTravelState;
@ -133,7 +136,7 @@ public:
void init() {
for(int index = 0; index < GameConstants::maxPlayers; ++index) {
factions.push_back(new FactionState());
factions.push_back(new FactionState(index));
}
}
@ -224,6 +227,7 @@ private:
}
Vec2i computeNearestFreePos(const Unit *unit, const Vec2i &targetPos);
inline static float heuristic(const Vec2i &pos, const Vec2i &finalPos) {
return pos.dist(finalPos);
}
@ -240,29 +244,44 @@ private:
throw megaglest_runtime_error("openNodesList.empty() == true");
}
Node *result = faction.openNodesList.begin()->second[0];
Node *result = faction.openNodesList.begin()->second.front();
faction.openNodesList.begin()->second.erase(faction.openNodesList.begin()->second.begin());
if(faction.openNodesList.begin()->second.size() == 0) {
if(faction.openNodesList.begin()->second.empty()) {
faction.openNodesList.erase(faction.openNodesList.begin());
}
return result;
}
inline bool processNode(Unit *unit, Node *node,const Vec2i finalPos,
int i, int j, bool &nodeLimitReached,int maxNodeCount) {
int x, int y, bool &nodeLimitReached,int maxNodeCount) {
bool result = false;
Vec2i sucPos= node->pos + Vec2i(i, j);
Vec2i sucPos= node->pos + Vec2i(x, y);
int unitFactionIndex = unit->getFactionIndex();
FactionState &faction = factions.getFactionState(unitFactionIndex);
if(openPos(sucPos, faction) == false &&
canUnitMoveSoon(unit, node->pos, sucPos) == true) {
bool foundOpenPosForPos = openPos(sucPos, faction);
bool allowUnitMoveSoon = canUnitMoveSoon(unit, node->pos, sucPos);
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In processNode() nodeLimitReached %d unitFactionIndex %d foundOpenPosForPos %d allowUnitMoveSoon %d maxNodeCount %d node->pos = %s finalPos = %s sucPos = %s faction.openPosList.size() %ld closedNodesList.size() %ld",
nodeLimitReached,unitFactionIndex,foundOpenPosForPos, allowUnitMoveSoon, maxNodeCount,node->pos.getString().c_str(),finalPos.getString().c_str(),sucPos.getString().c_str(),faction.openPosList.size(),faction.closedNodesList.size());
if(Thread::isCurrentThreadMainThread() == false) {
unit->logSynchDataThreaded(__FILE__,__LINE__,szBuf);
}
else {
unit->logSynchData(__FILE__,__LINE__,szBuf);
}
}
if(foundOpenPosForPos == false && allowUnitMoveSoon) {
//if node is not open and canMove then generate another node
Node *sucNode= newNode(faction,maxNodeCount);
if(sucNode != NULL) {
sucNode->pos= sucPos;
sucNode->heuristic= heuristic(sucNode->pos, finalPos);
sucNode->heuristic = heuristic(sucNode->pos, finalPos);
sucNode->prev= node;
sucNode->next= NULL;
sucNode->exploredCell = map->getSurfaceCell(
@ -274,6 +293,20 @@ private:
faction.openPosList[sucNode->pos] = true;
result = true;
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In processNode() sucPos = %s",sucPos.getString().c_str());
if(Thread::isCurrentThreadMainThread() == false) {
unit->logSynchDataThreaded(__FILE__,__LINE__,szBuf);
}
else {
unit->logSynchData(__FILE__,__LINE__,szBuf);
}
}
}
else {
nodeLimitReached= true;
@ -287,7 +320,7 @@ private:
Field field, int teamIndex,Vec2i unitPos, Vec2i &nearestPos, float &nearestDist);
int getPathFindExtendRefreshNodeCount(FactionState &faction);
inline bool canUnitMoveSoon(const Unit *unit, const Vec2i &pos1, const Vec2i &pos2) {
inline bool canUnitMoveSoon(Unit *unit, const Vec2i &pos1, const Vec2i &pos2) {
bool result = map->aproxCanMoveSoon(unit, pos1, pos2);
return result;
}
@ -298,15 +331,58 @@ private:
std::map<Vec2i,Vec2i> cameFrom, std::map<std::pair<Vec2i,Vec2i> ,
bool> canAddNode, Unit *& unit, int & maxNodeCount, int curFrameIndex) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In doAStarPathSearch() nodeLimitReached %d whileLoopCount %d unitFactionIndex %d pathFound %d maxNodeCount %d",
nodeLimitReached,whileLoopCount,unitFactionIndex,pathFound, maxNodeCount);
if(curFrameIndex >= 0) {
unit->logSynchDataThreaded(__FILE__,__LINE__,szBuf);
}
else {
unit->logSynchData(__FILE__,__LINE__,szBuf);
}
}
FactionState &faction = factions.getFactionState(unitFactionIndex);
while(nodeLimitReached == false) {
whileLoopCount++;
if(faction.openNodesList.empty() == true) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In doAStarPathSearch() nodeLimitReached %d whileLoopCount %d unitFactionIndex %d pathFound %d maxNodeCount %d",
nodeLimitReached,whileLoopCount,unitFactionIndex,pathFound, maxNodeCount);
if(curFrameIndex >= 0) {
unit->logSynchDataThreaded(__FILE__,__LINE__,szBuf);
}
else {
unit->logSynchData(__FILE__,__LINE__,szBuf);
}
}
pathFound = false;
break;
}
node = minHeuristicFastLookup(faction);
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In doAStarPathSearch() nodeLimitReached %d whileLoopCount %d unitFactionIndex %d pathFound %d maxNodeCount %d node->pos = %s finalPos = %s node->exploredCell = %d",
nodeLimitReached,whileLoopCount,unitFactionIndex,pathFound, maxNodeCount,node->pos.getString().c_str(),finalPos.getString().c_str(),node->exploredCell);
if(curFrameIndex >= 0) {
unit->logSynchDataThreaded(__FILE__,__LINE__,szBuf);
}
else {
unit->logSynchData(__FILE__,__LINE__,szBuf);
}
}
if(node->pos == finalPos || node->exploredCell == false) {
pathFound = true;
break;
@ -321,8 +397,30 @@ private:
int failureCount = 0;
int cellCount = 0;
int tryDirection = faction.random.randRange(0, 3);
if(tryDirection == 3) {
// if(Thread::isCurrentThreadMainThread() == false) {
// throw megaglest_runtime_error("#1 Invalid access to FactionState random from outside main thread current id = " +
// intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId()));
// }
//int tryDirection = 1;
//int tryDirection = faction.random.IRandomX(1, 4);
int tryDirection = faction.random.randRange(1, 4);
//int tryDirection = unit->getRandom(true)->randRange(1, 4);
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In doAStarPathSearch() tryDirection %d",tryDirection);
if(curFrameIndex >= 0) {
unit->logSynchDataThreaded(__FILE__,__LINE__,szBuf);
}
else {
unit->logSynchData(__FILE__,__LINE__,szBuf);
}
}
if(tryDirection == 4) {
for(int i = 1;i >= -1 && nodeLimitReached == false;--i) {
for(int j = -1;j <= 1 && nodeLimitReached == false;++j) {
if(processNode(unit, node, finalPos, i, j, nodeLimitReached, maxNodeCount) == false) {
@ -332,7 +430,7 @@ private:
}
}
}
else if(tryDirection == 2) {
else if(tryDirection == 3) {
for(int i = -1;i <= 1 && nodeLimitReached == false;++i) {
for(int j = 1;j >= -1 && nodeLimitReached == false;--j) {
if(processNode(unit, node, finalPos, i, j, nodeLimitReached, maxNodeCount) == false) {
@ -342,7 +440,7 @@ private:
}
}
}
else if(tryDirection == 1) {
else if(tryDirection == 2) {
for(int i = -1;i <= 1 && nodeLimitReached == false;++i) {
for(int j = -1;j <= 1 && nodeLimitReached == false;++j) {
if(processNode(unit, node, finalPos, i, j, nodeLimitReached, maxNodeCount) == false) {
@ -363,6 +461,21 @@ private:
}
}
}
if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true &&
SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynchMax).enabled == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In doAStarPathSearch() nodeLimitReached %d whileLoopCount %d unitFactionIndex %d pathFound %d maxNodeCount %d",
nodeLimitReached,whileLoopCount,unitFactionIndex,pathFound, maxNodeCount);
if(curFrameIndex >= 0) {
unit->logSynchDataThreaded(__FILE__,__LINE__,szBuf);
}
else {
unit->logSynchData(__FILE__,__LINE__,szBuf);
}
}
}
};

View File

@ -19,6 +19,8 @@
#include "util.h"
#include "conversion.h"
#include "lang.h"
#include "gen_uuid.h"
//#include <cxxabi.h>
#include "leak_dumper.h"
using namespace std;
@ -39,11 +41,23 @@ Vec3f GraphicComponent::customTextColor = Vec3f(1.0,1.0,1.0);
std::map<std::string, std::map<std::string, GraphicComponent *> > GraphicComponent::registeredGraphicComponentList;
GraphicComponent::GraphicComponent(std::string containerName, std::string objName) {
instanceName = "";
if(objName != "") {
GraphicComponent::GraphicComponent(std::string containerName, std::string objName, bool registerControl) {
this->containerName = containerName;
this->instanceName = "";
if(containerName == "" || objName == "") {
//char szBuf[8096]="";
//snprintf(szBuf,8096,"Control not properly registered Container [%s] Control [%s]\n",containerName.c_str(),objName.c_str());
//throw megaglest_runtime_error(szBuf);
}
if(objName != "" && registerControl) {
registerGraphicComponent(containerName,objName);
}
else {
this->instanceName = objName;
}
this->fontCallbackName = objName + "_" + getNewUUD();
CoreData::getInstance().registerFontChangedCallback(this->getFontCallbackName(), this);
enabled = true;
editable = true;
visible = true;
@ -57,6 +71,16 @@ GraphicComponent::GraphicComponent(std::string containerName, std::string objNam
textNativeTranslation = "";
}
string GraphicComponent::getNewUUD() {
char uuid_str[38];
get_uuid_string(uuid_str,sizeof(uuid_str));
return string(uuid_str);
}
GraphicComponent::~GraphicComponent() {
CoreData::getInstance().unRegisterFontChangedCallback(this->getFontCallbackName());
}
void GraphicComponent::clearRegisteredComponents(std::string containerName) {
if(containerName == "") {
GraphicComponent::registeredGraphicComponentList.clear();
@ -80,12 +104,46 @@ void GraphicComponent::clearRegisterGraphicComponent(std::string containerName,
}
void GraphicComponent::registerGraphicComponent(std::string containerName, std::string objName) {
instanceName = objName;
registeredGraphicComponentList[containerName][objName] = this;
// unregistered old name if we have been renamed
if(this->getInstanceName() != "") {
//printf("RENAME Register Callback detected calling: Control old [%s] new [%s]\n",this->getInstanceName().c_str(),objName.c_str());
clearRegisterGraphicComponent(this->containerName, this->getInstanceName());
}
else {
//printf("NEW Register Callback detected calling: Control container [%s] name [%s]\n",containerName.c_str(),objName.c_str());
}
if(containerName == "" || objName == "") {
//char szBuf[8096]="";
//snprintf(szBuf,8096,"Control not properly registered Container [%s] Control [%s]\n",this->containerName.c_str(),objName.c_str());
//throw megaglest_runtime_error(szBuf);
}
this->containerName = containerName;
this->instanceName = objName;
registeredGraphicComponentList[containerName][objName] = this;
//SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] registered [%s] [%s] count = %d\n",__FILE__,__FUNCTION__,__LINE__,containerName.c_str(),instanceName.c_str(),registeredGraphicComponentList[containerName].size());
}
void GraphicComponent::registerGraphicComponentOnlyFontCallbacks(std::string containerName, std::string objName) {
if(this->getInstanceName() != "") {
//printf("(FONT ONLY) RENAME Register Callback detected calling: Control old [%s] new [%s]\n",this->getInstanceName().c_str(),objName.c_str());
clearRegisterGraphicComponent(this->containerName, this->getInstanceName());
}
else {
//printf("(FONT ONLY) NEW Register Callback detected calling: Control container [%s] name [%s]\n",containerName.c_str(),objName.c_str());
}
if(containerName == "" || objName == "") {
//char szBuf[8096]="";
//snprintf(szBuf,8096,"Control not properly registered Container [%s] Control [%s]\n",this->containerName.c_str(),objName.c_str());
//throw megaglest_runtime_error(szBuf);
}
this->containerName = containerName;
this->instanceName = objName;
}
GraphicComponent * GraphicComponent::findRegisteredComponent(std::string containerName, std::string objName) {
GraphicComponent *result = NULL;
@ -136,8 +194,6 @@ void GraphicComponent::applyCustomProperties(std::string containerName) {
ctl->w = config.getInt(containerName + "_" + iterFind2->first + "_w_" + languageToken, intToStr(ctl->w).c_str());
ctl->h = config.getInt(containerName + "_" + iterFind2->first + "_h_" + languageToken, intToStr(ctl->h).c_str());
ctl->visible = config.getBool(containerName + "_" + iterFind2->first + "_visible_" + languageToken,boolToStr(ctl->visible).c_str());
//}
}
}
}
@ -208,9 +264,51 @@ bool GraphicComponent::saveCustomProperties(std::string containerName) {
return savedChange;
}
void GraphicComponent::setFont(Font2D *font) {
this->font = font;
if (this->font != NULL) {
this->font2DUniqueId = font->getFontUniqueId();
}
else {
this->font2DUniqueId = "";
}
}
void GraphicComponent::setFont3D(Font3D *font) {
this->font3D = font;
if (this->font3D != NULL) {
this->font3DUniqueId = font->getFontUniqueId();
}
else {
this->font3DUniqueId = "";
}
}
void GraphicComponent::FontChangedCallback(std::string fontUniqueId, Font *font) {
//printf("In FontChanged for [%s] font [%p] Control 2D [%s] 3D [%s]\n", fontUniqueId.c_str(),font,this->font2DUniqueId.c_str(),this->font3DUniqueId.c_str());
if (fontUniqueId != "") {
if (fontUniqueId == this->font2DUniqueId) {
if (font != NULL) {
this->font = (Font2D *)font;
}
else {
this->font = NULL;
}
}
else if (fontUniqueId == this->font3DUniqueId) {
if (font != NULL) {
this->font3D = (Font3D *)font;
}
else {
this->font3D = NULL;
}
}
}
}
void GraphicComponent::reloadFonts() {
font= CoreData::getInstance().getMenuFontNormal();
font3D= CoreData::getInstance().getMenuFontNormal3D();
setFont(CoreData::getInstance().getMenuFontNormal());
setFont3D(CoreData::getInstance().getMenuFontNormal3D());
}
void GraphicComponent::reloadFontsForRegisterGraphicComponents(std::string containerName) {
@ -272,7 +370,8 @@ void GraphicComponent::resetFade(){
const int GraphicLabel::defH= 20;
const int GraphicLabel::defW= 70;
GraphicLabel::GraphicLabel() {
GraphicLabel::GraphicLabel(std::string containerName, std::string objName, bool registerControl) :
GraphicComponent(containerName, objName, registerControl) {
centered = false;
wordWrap = false;
centeredW = -1;
@ -339,7 +438,9 @@ void GraphicLabel::setCenteredH(bool centered) {
const int GraphicButton::defH= 22;
const int GraphicButton::defW= 90;
GraphicButton::GraphicButton(std::string containerName, std::string objName) : GraphicComponent(containerName,objName) {
GraphicButton::GraphicButton(std::string containerName, std::string objName, bool registerControl) :
GraphicComponent(containerName,objName,registerControl) {
lighted = false;
alwaysLighted = false;
useCustomTexture = false;
@ -369,7 +470,8 @@ const int GraphicListBox::defH= 22;
const int GraphicListBox::defW= 140;
GraphicListBox::GraphicListBox(std::string containerName, std::string objName)
: GraphicComponent(containerName, objName), graphButton1(), graphButton2() {
: GraphicComponent(containerName, objName), graphButton1(containerName, objName + "_button1"),
graphButton2(containerName, objName + "_button2") {
selectedItemIndex = 0;
lighted = false;
leftControlled = false;
@ -439,14 +541,6 @@ void GraphicListBox::setLeftControlled(bool leftControlled) {
graphButton1.setW(graphButton1.getW()-4);
graphButton2.setY(graphButton2.getY()+2);
graphButton1.setY(graphButton1.getY()+2);
// graphButton2.setX(x);
// graphButton2.setH(graphButton2.getH()/2);
// graphButton2.setW(graphButton2.getW()/2);
// graphButton1.setH(graphButton1.getH()/2);
// graphButton1.setW(graphButton1.getW()/2);
// graphButton2.setY(graphButton2.getY()+graphButton1.getH());
}
else {
graphButton2.setX(x+w-graphButton2.getW()+4);
@ -456,14 +550,6 @@ void GraphicListBox::setLeftControlled(bool leftControlled) {
graphButton1.setW(graphButton1.getW()+4);
graphButton2.setY(graphButton2.getY()-2);
graphButton1.setY(graphButton1.getY()-2);
// graphButton2.setY(graphButton2.getY()-graphButton1.getH());
// graphButton2.setH(graphButton2.getH()*2);
// graphButton2.setW(graphButton2.getW()*2);
// graphButton1.setH(graphButton1.getH()*2);
// graphButton1.setW(graphButton1.getW()*2);
// graphButton2.setX(x+w-graphButton2.getW());
}
}
}
@ -622,13 +708,12 @@ const int GraphicMessageBox::defH= 280;
const int GraphicMessageBox::defW= 350;
GraphicMessageBox::GraphicMessageBox(std::string containerName, std::string objName) :
GraphicComponent(containerName, objName){
GraphicComponent(containerName, objName) {
header= "";
autoWordWrap=true;
}
GraphicMessageBox::~GraphicMessageBox(){
//remove buttons
removeButtons();
}
@ -650,10 +735,10 @@ void GraphicMessageBox::init(const string &button1Str, int newWidth, int newHeig
addButton(button1Str);
}
void GraphicMessageBox::init(int newWidth, int newHeight){
font= CoreData::getInstance().getMenuFontNormal();
font3D= CoreData::getInstance().getMenuFontNormal3D();
void GraphicMessageBox::init(int newWidth, int newHeight) {
setFont(CoreData::getInstance().getMenuFontNormal());
setFont3D(CoreData::getInstance().getMenuFontNormal3D());
h= (newHeight >= 0 ? newHeight : defH);
w= (newWidth >= 0 ? newWidth : defW);
@ -664,7 +749,7 @@ void GraphicMessageBox::init(int newWidth, int newHeight){
}
void GraphicMessageBox::addButton(const string &buttonStr, int width, int height){
GraphicButton *newButton= new GraphicButton();
GraphicButton *newButton= new GraphicButton(containerName, instanceName + "_Button_" + buttonStr);
newButton->init(0, 0);
newButton->setText(buttonStr);
if(width != -1){
@ -956,7 +1041,9 @@ void GraphicScrollBar::arrangeComponents(vector<GraphicComponent *> &gcs) {
const int PopupMenu::defH= 240;
const int PopupMenu::defW= 350;
PopupMenu::PopupMenu() {
PopupMenu::PopupMenu(std::string containerName, std::string objName) : GraphicComponent(containerName, objName, false) {
registerGraphicComponentOnlyFontCallbacks(containerName,objName);
h= defH;
w= defW;
}
@ -968,8 +1055,8 @@ PopupMenu::~PopupMenu() {
void PopupMenu::init(string menuHeader,std::vector<string> menuItems) {
header = menuHeader;
font= CoreData::getInstance().getMenuFontNormal();
font3D= CoreData::getInstance().getMenuFontNormal3D();
setFont(CoreData::getInstance().getMenuFontNormal());
setFont3D(CoreData::getInstance().getMenuFontNormal3D());
buttons.clear();
@ -1018,7 +1105,8 @@ void PopupMenu::init(string menuHeader,std::vector<string> menuItems) {
}
for(unsigned int i = 0; i < menuItems.size(); ++i) {
GraphicButton button;
GraphicButton button(containerName, instanceName + "_Popup_Button_" + menuItems[i],false);
button.registerGraphicComponentOnlyFontCallbacks(containerName, instanceName + "_Popup_Button_" + menuItems[i]);
button.init(x+(w-maxButtonWidth)/2, yStartOffset - (i*(textHeight + textHeightSpacing)));
button.setText(menuItems[i]);
button.setW(maxButtonWidth);

View File

@ -44,7 +44,7 @@ class GraphicComponent;
// OpenGL renderer GUI components
// ===========================================================
class GraphicComponent {
class GraphicComponent : public FontChangedCallbackInterface {
public:
static const float animSpeed;
static const float fadeSpeed;
@ -57,6 +57,8 @@ protected:
string textNativeTranslation;
Font2D *font;
Font3D *font3D;
string font2DUniqueId;
string font3DUniqueId;
bool enabled;
bool editable;
bool visible;
@ -65,11 +67,16 @@ protected:
static float fade;
static Vec3f customTextColor;
string containerName;
string instanceName;
string fontCallbackName;
string getNewUUD();
virtual void FontChangedCallback(std::string fontUniqueId, Font *font);
public:
GraphicComponent(std::string containerName="", std::string objName="");
virtual ~GraphicComponent(){}
GraphicComponent(std::string containerName="", std::string objName="", bool registerControl=true);
virtual ~GraphicComponent();
static void setCustomTextColor(Vec3f value) { customTextColor = value; }
static Vec3f getCustomTextColor() { return customTextColor; }
@ -78,6 +85,7 @@ public:
static void clearRegisterGraphicComponent(std::string containerName, std::string objName);
static void clearRegisterGraphicComponent(std::string containerName, std::vector<std::string> objNameList);
virtual void registerGraphicComponent(std::string containerName, std::string objName);
virtual void registerGraphicComponentOnlyFontCallbacks(std::string containerName, std::string objName);
static GraphicComponent * findRegisteredComponent(std::string containerName, std::string objName);
static void applyAllCustomProperties(std::string containerName);
virtual void applyCustomProperties(std::string containerName);
@ -87,7 +95,9 @@ public:
virtual void init(int x, int y, int w, int h);
string getContainerName() const { return containerName; }
string getInstanceName() const { return instanceName; }
string getFontCallbackName() const { return fontCallbackName; }
void setInstanceName(string value) { instanceName = value; }
virtual int getX() const {return x;}
@ -108,8 +118,8 @@ public:
virtual void setH(int h) {this->h= h;}
virtual void setText(const string &text) {this->text= text;}
virtual void setTextNativeTranslation(const string &text) {this->textNativeTranslation= text;}
virtual void setFont(Font2D *font) {this->font= font;}
virtual void setFont3D(Font3D *font) {this->font3D= font;}
virtual void setFont(Font2D *font);
virtual void setFont3D(Font3D *font);
virtual void setEnabled(bool enabled) {this->enabled= enabled;}
virtual void setEditable(bool editable) {this->editable= editable;}
virtual void setVisible(bool value) {this->visible = value;}
@ -154,7 +164,7 @@ private:
Texture2D *texture;
public:
GraphicLabel();
GraphicLabel(std::string containerName="", std::string objName="", bool registerControl=true);
void init(int x, int y, int w=defW, int h=defH, bool centered= false, Vec3f textColor=GraphicComponent::customTextColor, bool wordWrap=false);
virtual bool mouseMove(int x, int y);
@ -218,7 +228,7 @@ private:
Texture *customTexture;
public:
GraphicButton(std::string containerName="", std::string objName="");
GraphicButton(std::string containerName="", std::string objName="", bool registerControl=true);
void init(int x, int y, int w=defW, int h=defH);
bool getUseCustomTexture() const { return useCustomTexture; }
@ -437,8 +447,8 @@ private:
string header;
public:
PopupMenu();
~PopupMenu();
PopupMenu(std::string containerName="", std::string objName="");
virtual ~PopupMenu();
void init(string menuHeader, std::vector<string> menuItems);
std::vector<GraphicButton> & getMenuItems() {return buttons;}

View File

@ -30,22 +30,20 @@ namespace Glest { namespace Game {
const char *mailString = " http://bugs.megaglest.org";
// !! Use minor versions !! Only major and minor version control compatibility!
// typical version numbers look like this: v3.11-beta1.0 v3.12-dev v3.12.0
// don't forget to update source/version.txt
const string glestVersionString = "v3.12.0";
const string lastCompatibleSaveGameVersionString = "v3.9.0";
// typical version numbers look like this: v3.13-beta1.0 v3.12-dev v3.12.1
// don't forget to update file: source/version.txt
const string glestVersionString = "v3.13.0";
const string lastCompatibleSaveGameVersionString = "v3.11.1";
#if defined(GITVERSION)
const string GIT_RawRev = string(GITVERSION);
const string GIT_Rev = string("Rev: ") + string(GITVERSION);
#elif defined(GITVERSIONHEADER)
#include "gitversion.h"
const string GIT_RawRev = string(GITVERSION);
const string GIT_Rev = string("Rev: ") + string(GITVERSION);
#else
const string GIT_RawRev = "$5419.034576d$";
const string GIT_Rev = "$Rev$";
#if defined(GITVERSIONHEADER)
#include "gitversion.h"
#endif
#if defined(GITVERSION) || defined(GITVERSIONHEADER)
const string GIT_RawRev = string(GITVERSION);
#else
const string GIT_RawRev = "$5604.3a5d459$";
#endif
const string GIT_Rev = string("Rev: ") + string(GIT_RawRev);
string getRAWGITRevisionString() {
return GIT_RawRev;
@ -73,7 +71,7 @@ string getPlatformTypeNameString() {
platform = "OpenBSD";
#elif defined(__APPLE__)
platform = "MacOSX";
platform = "MacOS";
#elif defined(_AIX)
platform = "AIX";
#elif defined(__ANDROID__)
@ -214,7 +212,7 @@ string getAboutString1(int i) {
case 0: return "MegaGlest " + glestVersionString + " (" + "Shared Library " + sharedLibVersionString + ")";
case 1: return GIT_Rev;
case 2: return "Copyright 2001-2010 The Glest Team";
case 3: return "Copyright 2010-2016 The MegaGlest Team";
case 3: return "Copyright 2010-2017 The MegaGlest Team";
}
return "";
}

View File

@ -38,7 +38,7 @@ const int Logger::logLineCount= 15;
// ===================== PUBLIC ========================
Logger::Logger() {
Logger::Logger() : buttonCancel("Logger","buttonCancel"), buttonNextHint("Logger","buttonCancel") {
progress = 0;
string logs_path = getGameReadWritePath(GameConstants::path_logs_CacheLookupKey);
if(logs_path != "") {

View File

@ -490,7 +490,7 @@ void ChatManager::updateNetwork() {
if(msg.chatText.find(playerName) != string::npos){
CoreData &coreData= CoreData::getInstance();
SoundRenderer &soundRenderer= SoundRenderer::getInstance();
soundRenderer.playFx(coreData.getHighlightSound());
soundRenderer.playFx(coreData.getHighlightSound(),true);
}
console->addLine(msg.chatText.substr(1,msg.chatText.size()), true, msg.chatPlayerIndex,Vec3f(1.f, 1.f, 1.f),teamMode);
}

View File

@ -19,6 +19,7 @@
#include "core_data.h"
#include <stdexcept>
#include "network_manager.h"
#include "gen_uuid.h"
#include "leak_dumper.h"
using namespace std;
@ -30,7 +31,10 @@ namespace Glest{ namespace Game{
// =====================================================
Console::Console() {
//config
registerGraphicComponent("Console", "Generic-Console");
this->fontCallbackName = getInstanceName() + "_" + getNewUUD();
CoreData::getInstance().registerFontChangedCallback(this->getFontCallbackName(), this);
maxLines = Config::getInstance().getInt("ConsoleMaxLines");
maxStoredLines = Config::getInstance().getInt("ConsoleMaxLinesStored");
timeout = Config::getInstance().getInt("ConsoleTimeout");
@ -38,15 +42,71 @@ Console::Console() {
xPos=20;
yPos=20;
lineHeight=Config::getInstance().getInt("FontConsoleBaseSize","18")+2;
font=CoreData::getInstance().getConsoleFont();
font3D=CoreData::getInstance().getConsoleFont3D();
setFont(CoreData::getInstance().getConsoleFont());
setFont3D(CoreData::getInstance().getConsoleFont3D());
stringToHighlight="";
onlyChatMessagesInStoredLines=true;
}
string Console::getNewUUD() {
char uuid_str[38];
get_uuid_string(uuid_str,sizeof(uuid_str));
return string(uuid_str);
}
Console::~Console() {
CoreData::getInstance().unRegisterFontChangedCallback(this->getFontCallbackName());
}
void Console::setFont(Font2D *font) {
this->font = font;
if (this->font != NULL) {
this->font2DUniqueId = font->getFontUniqueId();
}
else {
this->font2DUniqueId = "";
}
}
void Console::setFont3D(Font3D *font) {
this->font3D = font;
if (this->font3D != NULL) {
this->font3DUniqueId = font->getFontUniqueId();
}
else {
this->font3DUniqueId = "";
}
}
void Console::registerGraphicComponent(std::string containerName, std::string objName) {
this->instanceName = objName;
}
void Console::FontChangedCallback(std::string fontUniqueId, Font *font) {
if (fontUniqueId != "") {
if (fontUniqueId == this->font2DUniqueId) {
if (font != NULL) {
this->font = (Font2D *)font;
}
else {
this->font = NULL;
}
}
else if (fontUniqueId == this->font3DUniqueId) {
if (font != NULL) {
this->font3D = (Font3D *)font;
}
else {
this->font3D = NULL;
}
}
}
}
void Console::resetFonts() {
font=CoreData::getInstance().getConsoleFont();
font3D=CoreData::getInstance().getConsoleFont3D();
setFont(CoreData::getInstance().getConsoleFont());
setFont3D(CoreData::getInstance().getConsoleFont3D());
}
void Console::addStdMessage(const string &s,bool clearOtherLines) {

View File

@ -32,8 +32,10 @@ using namespace std;
namespace Glest { namespace Game {
using Shared::Graphics::Font;
using Shared::Graphics::Font2D;
using Shared::Graphics::Font3D;
using Shared::Graphics::FontChangedCallbackInterface;
using Shared::Graphics::Vec3f;
// =====================================================
// class Console
@ -51,7 +53,7 @@ public:
bool teamMode;
};
class Console {
class Console: public FontChangedCallbackInterface {
private:
static const int consoleLines= 5;
@ -75,10 +77,25 @@ private:
int lineHeight;
Font2D *font;
Font3D *font3D;
string font2DUniqueId;
string font3DUniqueId;
bool onlyChatMessagesInStoredLines;
string instanceName;
string fontCallbackName;
string getNewUUD();
public:
Console();
virtual ~Console();
void registerGraphicComponent(std::string containerName, std::string objName);
string getInstanceName() const { return instanceName; }
void setInstanceName(string value) { instanceName = value; }
string getFontCallbackName() const { return fontCallbackName; }
int getStoredLineCount() const {return (int)storedLines.size();}
int getLineCount() const {return (int)lines.size();}
@ -93,8 +110,8 @@ public:
void setLineHeight(int lineHeight) {this->lineHeight= lineHeight;}
Font2D *getFont() const {return font;}
Font3D *getFont3D() const {return font3D;}
void setFont(Font2D *font) {this->font= font;}
void setFont3D(Font3D *font) {this->font3D= font;}
void setFont(Font2D *font);
void setFont3D(Font3D *font);
string getStringToHighlight() const { return stringToHighlight;}
void setStringToHighlight(string stringToHighlight) { this->stringToHighlight = stringToHighlight;}
void resetFonts();
@ -116,6 +133,8 @@ public:
void addLine(string line, bool playSound, Vec3f textColor) { addLine(line,playSound,"",textColor,false); }
void update();
bool isEmpty();
virtual void FontChangedCallback(std::string fontUniqueId, Font *font);
};
}}//end namespace

View File

@ -1122,8 +1122,6 @@ void Game::load(int loadTypes) {
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
set<string> factions;
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
for ( int i=0; i < gameSettings.getFactionCount(); ++i ) {
factions.insert(gameSettings.getFactionTypeName(i));
}
@ -2683,9 +2681,7 @@ void Game::update() {
renderer.endScenario();
world.clearTileset();
this->setGameSettings(&gameSettings);
this->load(lgt_FactionPreview | lgt_TileSet | lgt_Map | lgt_Scenario);
try {
world.init(this, gameSettings.getDefaultUnits(),false);
}
@ -3101,7 +3097,7 @@ void Game::addOrReplaceInHighlightedCells(MarkedCell mc){
//printf("faction [%p][%s]\n",faction,(faction != NULL ? faction->getType()->getName().c_str() : ""));
if((faction == NULL) ||
(faction->getTeam() == getWorld()->getThisFaction()->getTeam())) {
soundRenderer.playFx(coreData.getMarkerSound());
soundRenderer.playFx(coreData.getMarkerSound(),true);
}
}
}
@ -3341,7 +3337,7 @@ bool Game::addUnitToSelection(Unit *unit) {
try {
Selection *selection= gui.getSelectionPtr();
if(selection != NULL) {
result = selection->select(unit);
result = selection->select(unit,true);
}
}
catch(const exception &ex) {
@ -4717,27 +4713,27 @@ void Game::keyDown(SDL_KeyboardEvent key) {
switch (healthbarMode) {
case hbvUndefined:
healthbarMode=hbvOff;
console.addLine(lang.getString("Healthbar")+": "+lang.getString("HealthbarsOff"));
console.addLine(lang.getString("Healthbar2")+": "+lang.getString("HealthbarsOff"));
break;
case hbvOff:
healthbarMode=hbvAlways;
console.addLine(lang.getString("Healthbar")+": "+lang.getString("HealthbarsAlways"));
console.addLine(lang.getString("Healthbar2")+": "+lang.getString("HealthbarsAlways"));
break;
case hbvAlways:
healthbarMode=hbvIfNeeded;
console.addLine(lang.getString("Healthbar")+": "+lang.getString("HealthbarsIfNeeded"));
console.addLine(lang.getString("Healthbar2")+": "+lang.getString("HealthbarsIfNeeded"));
break;
case hbvIfNeeded:
healthbarMode=hbvSelected;
console.addLine(lang.getString("Healthbar")+": "+lang.getString("HealthbarsSelected"));
console.addLine(lang.getString("Healthbar2")+": "+lang.getString("HealthbarsSelected"));
break;
case hbvSelected:
healthbarMode=hbvSelected | hbvIfNeeded;
console.addLine(lang.getString("Healthbar")+": "+lang.getString("HealthbarsSelectedOrNeeded"));
console.addLine(lang.getString("Healthbar2")+": "+lang.getString("HealthbarsSelectedOrNeeded"));
break;
case (hbvSelected | hbvIfNeeded):
healthbarMode=hbvUndefined;
console.addLine(lang.getString("Healthbar")+": "+lang.getString("HealthbarsFactionDefault"));
console.addLine(lang.getString("Healthbar2")+": "+lang.getString("HealthbarsFactionDefault"));
break;
default:
printf("In [%s::%s Line: %d] Toggle Healthbars Hotkey - Invalid Value. Setting to default.\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__);
@ -5295,13 +5291,6 @@ void Game::render3d(){
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] renderFps = %d took msecs: %lld [renderUnits]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
// renderTeamColorPlane
if((renderExtraTeamColor&renderTeamColorPlaneBit)>0){
renderer.renderTeamColorPlane();
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] renderFps = %d took msecs: %lld [renderObjects]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
}
//water
renderer.renderWater();
renderer.renderWaterEffects();
@ -5323,6 +5312,13 @@ void Game::render3d(){
renderer.renderHealthBars(healthbarMode);
}
// renderTeamColorPlane
if((renderExtraTeamColor&renderTeamColorPlaneBit)>0){
renderer.renderTeamColorPlane();
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] renderFps = %d took msecs: %lld [renderObjects]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,renderFps,chrono.getMillis());
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) chrono.start();
}
//mouse 3d
renderer.renderMouse3d();
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] renderFps = %d took msecs: %lld [renderMouse3d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,renderFps,chrono.getMillis());

View File

@ -243,6 +243,7 @@ public:
GameSettings *getGameSettings() {return &gameSettings;}
void setGameSettings(GameSettings *settings) { gameSettings = *settings;}
const GameSettings *getReadOnlyGameSettings() const {return &gameSettings;}
void setQuitPendingIndicator() { quitPendingIndicator = true;}
const GameCamera *getGameCamera() const {return &gameCamera;}
GameCamera *getGameCameraPtr() {return &gameCamera;}

View File

@ -108,7 +108,7 @@ private:
int factionCount;
int teams[GameConstants::maxPlayers];
int startLocationIndex[GameConstants::maxPlayers];
int mapFilterIndex;
int mapFilter;
int fallbackCpuMultiplier;
bool defaultUnits;
@ -147,7 +147,7 @@ public:
defaultUnits=false;
defaultResources=false;
defaultVictoryConditions=false;
mapFilterIndex = 0;
mapFilter = 0;
factionCount = 0;
thisFactionIndex = 0;
fogOfWar = true;
@ -373,7 +373,7 @@ public:
return -1;
}
int getMapFilterIndex() const {return mapFilterIndex;}
int getMapFilter() const {return mapFilter;}
bool getDefaultUnits() const {return defaultUnits;}
bool getDefaultResources() const {return defaultResources;}
@ -516,7 +516,7 @@ public:
this->startLocationIndex[factionIndex]= startLocationIndex;
}
void setMapFilterIndex(int mapFilterIndex) {this->mapFilterIndex=mapFilterIndex;}
void setMapFilter(int mapFilter) {this->mapFilter=mapFilter;}
void setDefaultUnits(bool defaultUnits) {this->defaultUnits= defaultUnits;}
void setDefaultResources(bool defaultResources) {this->defaultResources= defaultResources;}
@ -561,7 +561,7 @@ public:
result += "Game ID = " + gameUUID + "\n";
result += "gameName = " + gameName + "\n";
result += "description = " + description + "\n";
result += "mapFilterIndex = " + intToStr(mapFilterIndex) + "\n";
result += "mapFilterIndex = " + intToStr(mapFilter) + "\n";
result += "map = " + map + "\n";
result += "tileset = " + tileset + "\n";
result += "tech = " + tech + "\n";
@ -700,7 +700,7 @@ public:
}
// int mapFilterIndex;
gameSettingsNode->addAttribute("mapFilterIndex",intToStr(mapFilterIndex), mapTagReplacements);
gameSettingsNode->addAttribute("mapFilterIndex",intToStr(mapFilter), mapTagReplacements);
//
//
// bool defaultUnits;
@ -847,7 +847,7 @@ public:
}
// int mapFilterIndex;
mapFilterIndex = gameSettingsNode->getAttribute("mapFilterIndex")->getIntValue();
mapFilter = gameSettingsNode->getAttribute("mapFilterIndex")->getIntValue();
//
//
// bool defaultUnits;

File diff suppressed because it is too large Load Diff

View File

@ -26,6 +26,7 @@
#include "xml_parser.h"
#include "randomgen.h"
#include "leak_dumper.h"
#include "platform_util.h"
using std::string;
using std::list;
@ -35,6 +36,7 @@ using Shared::Lua::LuaHandle;
using Shared::Xml::XmlNode;
using Shared::Util::RandomGen;
namespace Glest{ namespace Game{
class World;
@ -168,6 +170,7 @@ private:
MessageQueue messageQueue;
GraphicMessageBox messageBox;
string displayText;
int errorCount;
//last created unit
string lastCreatedUnitName;
@ -429,6 +432,8 @@ private:
ControlType getFactionPlayerType(int factionIndex);
// -----------------------------------------------------------------------
static void error(LuaHandle* luaHandle, const megaglest_runtime_error *mgErr, const char* file, const char* function, int line);
//callbacks, commands
static int networkShowMessageForFaction(LuaHandle* luaHandle);
static int networkShowMessageForTeam(LuaHandle* luaHandle);

View File

@ -1154,8 +1154,36 @@ bool CoreData::hasBattleEndVideoFilename(bool won) const {
return result;
}
void CoreData::registerFontChangedCallback(std::string entityName, FontChangedCallbackInterface *cb) {
if(entityName == "") {
printf("Register Font Callback detected a blank entityName!\n");
throw megaglest_runtime_error("Register Font Callback detected a blank entityName!");
}
if (entityName != "") {
registeredFontChangedCallbacks[entityName].push_back(cb);
}
}
void CoreData::unRegisterFontChangedCallback(std::string entityName) {
if (entityName == "") {
printf("UnRegister Font Callback detected a blank entityName!\n");
throw megaglest_runtime_error("UnRegister Font Callback detected a blank entityName!");
}
if(entityName != "") {
registeredFontChangedCallbacks.erase(entityName);
}
}
void CoreData::triggerFontChangedCallbacks(std::string fontUniqueId, Font *font) {
for (std::map<std::string, std::vector<FontChangedCallbackInterface *> >::const_iterator iterMap =
registeredFontChangedCallbacks.begin();
iterMap != registeredFontChangedCallbacks.end(); iterMap++) {
for (unsigned int index = 0; index < iterMap->second.size(); ++index) {
//printf("Font Callback detected calling: Control [%s] for Font: [%s] value [%p]\n",iterMap->first.c_str(),fontUniqueId.c_str(),font);
FontChangedCallbackInterface *cb = iterMap->second[index];
cb->FontChangedCallback(fontUniqueId, font);
}
}
}
void CoreData::loadFonts() {
Renderer &renderer= Renderer::getInstance();
Lang &lang= Lang::getInstance();
//display font
@ -1174,32 +1202,10 @@ void CoreData::loadFonts() {
if(lang.hasString("FontDisplayBaseSize") == true) {
displayFontSize = computeFontSize(strToInt(lang.getString("FontDisplayBaseSize")));
}
string displayFontName = displayFontNamePrefix + intToStr(displayFontSize) + displayFontNamePostfix;
if(displayFont) {
renderer.endFont(displayFont, rsGlobal);
displayFont=NULL;
}
if(Renderer::renderText3DEnabled == false) {
displayFont= renderer.newFont(rsGlobal);
if(displayFont) {
displayFont->setType(displayFontName,config.getString("FontDisplay",""),config.getString("FontDisplayFamily",""));
displayFont->setSize(displayFontSize);
}
}
if(displayFont3D) {
renderer.endFont(displayFont3D, rsGlobal);
displayFont3D=NULL;
}
if(Renderer::renderText3DEnabled == true) {
displayFont3D= renderer.newFont3D(rsGlobal);
if(displayFont3D) {
displayFont3D->setType(displayFontName,config.getString("FontDisplay",""),config.getString("FontDisplayFamily",""));
displayFont3D->setSize(displayFontSize);
}
}
displayFont = loadFont<Font2D>(displayFont, displayFontName, displayFontSize, "FontDisplay", "FontDisplayFamily", "displayFont");
displayFont3D = loadFont<Font3D>(displayFont3D, displayFontName, displayFontSize, "FontDisplay", "FontDisplayFamily", "displayFont3D");
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontName = [%s] displayFontSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontName.c_str(),displayFontSize);
@ -1217,40 +1223,16 @@ void CoreData::loadFonts() {
if(lang.hasString("FontDisplaySmallBaseSize") == true) {
displayFontNameSmallSize = computeFontSize(strToInt(lang.getString("FontDisplaySmallBaseSize")));
}
string displayFontNameSmall = displayFontNameSmallPrefix + intToStr(displayFontNameSmallSize) + displayFontNameSmallPostfix;
if(displayFontSmall) {
renderer.endFont(displayFontSmall, rsGlobal);
displayFontSmall=NULL;
}
if(Renderer::renderText3DEnabled == false) {
displayFontSmall= renderer.newFont(rsGlobal);
if(displayFontSmall) {
displayFontSmall->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""),config.getString("FontSmallDisplayFamily",""));
displayFontSmall->setSize(displayFontNameSmallSize);
}
}
if(displayFontSmall3D) {
renderer.endFont(displayFontSmall3D, rsGlobal);
displayFontSmall3D=NULL;
}
if(Renderer::renderText3DEnabled == true) {
displayFontSmall3D= renderer.newFont3D(rsGlobal);
if(displayFontSmall3D) {
displayFontSmall3D->setType(displayFontNameSmall,config.getString("FontSmallDisplay",""),config.getString("FontSmallDisplayFamily",""));
displayFontSmall3D->setSize(displayFontNameSmallSize);
}
}
displayFontSmall = loadFont<Font2D>(displayFontSmall, displayFontNameSmall, displayFontNameSmallSize, "FontSmallDisplay", "FontSmallDisplayFamily", "displayFontSmall");
displayFontSmall3D = loadFont<Font3D>(displayFontSmall3D, displayFontNameSmall, displayFontNameSmallSize, "FontSmallDisplay", "FontSmallDisplayFamily", "displayFontSmall3D");
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] displayFontSmallName = [%s] displayFontSmallNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,displayFontNameSmall.c_str(),displayFontNameSmallSize);
string menuFontNameNormalPrefix = config.getString("FontMenuNormalPrefix");
string menuFontNameNormalPostfix = config.getString("FontMenuNormalPostfix");
int menuFontNameNormalSize = computeFontSize(config.getInt("FontMenuNormalBaseSize"));
//printf("#1 menuFontNameNormalSize = %d\n",menuFontNameNormalSize);
if(lang.hasString("FontMenuNormalPrefix") == true) {
menuFontNameNormalPrefix = lang.getString("FontMenuNormalPrefix");
}
@ -1259,36 +1241,11 @@ void CoreData::loadFonts() {
}
if(lang.hasString("FontMenuNormalBaseSize") == true) {
menuFontNameNormalSize = computeFontSize(strToInt(lang.getString("FontMenuNormalBaseSize")));
//printf("#2 menuFontNameNormalSize = %d\n",menuFontNameNormalSize);
}
string menuFontNameNormal= menuFontNameNormalPrefix + intToStr(menuFontNameNormalSize) + menuFontNameNormalPostfix;
if(menuFontNormal) {
renderer.endFont(menuFontNormal, rsGlobal);
menuFontNormal=NULL;
}
if(Renderer::renderText3DEnabled == false) {
menuFontNormal= renderer.newFont(rsGlobal);
if(menuFontNormal) {
menuFontNormal->setType(menuFontNameNormal,config.getString("FontMenuNormal",""),config.getString("FontMenuNormalFamily",""));
menuFontNormal->setSize(menuFontNameNormalSize);
menuFontNormal->setWidth(Font::wBold);
}
}
if(menuFontNormal3D) {
renderer.endFont(menuFontNormal3D, rsGlobal);
menuFontNormal3D=NULL;
}
if(Renderer::renderText3DEnabled == true) {
menuFontNormal3D= renderer.newFont3D(rsGlobal);
if(menuFontNormal3D) {
menuFontNormal3D->setType(menuFontNameNormal,config.getString("FontMenuNormal",""),config.getString("FontMenuNormalFamily",""));
menuFontNormal3D->setSize(menuFontNameNormalSize);
menuFontNormal3D->setWidth(Font::wBold);
}
}
menuFontNormal = loadFont<Font2D>(menuFontNormal, menuFontNameNormal, menuFontNameNormalSize, "FontMenuNormal", "FontMenuNormalFamily", "menuFontNormal");
menuFontNormal3D = loadFont<Font3D>(menuFontNormal3D, menuFontNameNormal, menuFontNameNormalSize, "FontMenuNormal", "FontMenuNormalFamily", "menuFontNormal3D");
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNormalName = [%s] menuFontNormalNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameNormal.c_str(),menuFontNameNormalSize);
@ -1305,32 +1262,10 @@ void CoreData::loadFonts() {
if(lang.hasString("FontMenuBigBaseSize") == true) {
menuFontNameBigSize = computeFontSize(strToInt(lang.getString("FontMenuBigBaseSize")));
}
string menuFontNameBig= menuFontNameBigPrefix+intToStr(menuFontNameBigSize)+menuFontNameBigPostfix;
if(menuFontBig) {
renderer.endFont(menuFontBig, rsGlobal);
menuFontBig=NULL;
}
if(Renderer::renderText3DEnabled == false) {
menuFontBig= renderer.newFont(rsGlobal);
if(menuFontBig) {
menuFontBig->setType(menuFontNameBig,config.getString("FontMenuBig",""),config.getString("FontMenuBigFamily",""));
menuFontBig->setSize(menuFontNameBigSize);
}
}
if(menuFontBig3D) {
renderer.endFont(menuFontBig3D, rsGlobal);
menuFontBig3D=NULL;
}
if(Renderer::renderText3DEnabled == true) {
menuFontBig3D= renderer.newFont3D(rsGlobal);
if(menuFontBig3D) {
menuFontBig3D->setType(menuFontNameBig,config.getString("FontMenuBig",""),config.getString("FontMenuBigFamily",""));
menuFontBig3D->setSize(menuFontNameBigSize);
}
}
menuFontBig = loadFont<Font2D>(menuFontBig, menuFontNameBig, menuFontNameBigSize, "FontMenuBig", "FontMenuBigFamily", "menuFontBig");
menuFontBig3D = loadFont<Font3D>(menuFontBig3D, menuFontNameBig, menuFontNameBigSize, "FontMenuBig", "FontMenuBigFamily", "menuFontBig3D");
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNameBig = [%s] menuFontNameBigSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameBig.c_str(),menuFontNameBigSize);
@ -1347,32 +1282,10 @@ void CoreData::loadFonts() {
if(lang.hasString("FontMenuVeryBigBaseSize") == true) {
menuFontNameVeryBigSize = computeFontSize(strToInt(lang.getString("FontMenuVeryBigBaseSize")));
}
string menuFontNameVeryBig= menuFontNameVeryBigPrefix + intToStr(menuFontNameVeryBigSize) + menuFontNameVeryBigPostfix;
if(menuFontVeryBig) {
renderer.endFont(menuFontVeryBig, rsGlobal);
menuFontVeryBig=NULL;
}
if(Renderer::renderText3DEnabled == false) {
menuFontVeryBig= renderer.newFont(rsGlobal);
if(menuFontVeryBig) {
menuFontVeryBig->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""),config.getString("FontMenuVeryBigFamily",""));
menuFontVeryBig->setSize(menuFontNameVeryBigSize);
}
}
if(menuFontVeryBig3D) {
renderer.endFont(menuFontVeryBig3D, rsGlobal);
menuFontVeryBig3D=NULL;
}
if(Renderer::renderText3DEnabled == true) {
menuFontVeryBig3D= renderer.newFont3D(rsGlobal);
if(menuFontVeryBig3D) {
menuFontVeryBig3D->setType(menuFontNameVeryBig,config.getString("FontMenuVeryBig",""),config.getString("FontMenuVeryBigFamily",""));
menuFontVeryBig3D->setSize(menuFontNameVeryBigSize);
}
}
menuFontVeryBig = loadFont<Font2D>(menuFontVeryBig, menuFontNameVeryBig, menuFontNameVeryBigSize, "FontMenuVeryBig", "FontMenuVeryBigFamily", "menuFontVeryBig");
menuFontVeryBig3D = loadFont<Font3D>(menuFontVeryBig3D, menuFontNameVeryBig, menuFontNameVeryBigSize, "FontMenuVeryBig", "FontMenuVeryBigFamily", "menuFontVeryBig3D");
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] menuFontNameVeryBig = [%s] menuFontNameVeryBigSize = %d\n",__FILE__,__FUNCTION__,__LINE__,menuFontNameVeryBig.c_str(),menuFontNameVeryBigSize);
@ -1390,36 +1303,41 @@ void CoreData::loadFonts() {
if(lang.hasString("FontConsoleBaseSize") == true) {
consoleFontNameSize = computeFontSize(strToInt(lang.getString("FontConsoleBaseSize")));
}
string consoleFontName= consoleFontNamePrefix + intToStr(consoleFontNameSize) + consoleFontNamePostfix;
if(consoleFont) {
renderer.endFont(consoleFont, rsGlobal);
consoleFont=NULL;
}
if(Renderer::renderText3DEnabled == false) {
consoleFont= renderer.newFont(rsGlobal);
if(consoleFont) {
consoleFont->setType(consoleFontName,config.getString("FontConsole",""),config.getString("FontConsoleFamily",""));
consoleFont->setSize(consoleFontNameSize);
}
}
if(consoleFont3D) {
renderer.endFont(consoleFont3D, rsGlobal);
consoleFont3D=NULL;
}
if(Renderer::renderText3DEnabled == true) {
consoleFont3D= renderer.newFont3D(rsGlobal);
if(consoleFont3D) {
consoleFont3D->setType(consoleFontName,config.getString("FontConsole",""),config.getString("FontConsoleFamily",""));
consoleFont3D->setSize(consoleFontNameSize);
}
}
consoleFont = loadFont<Font2D>(consoleFont, consoleFontName, consoleFontNameSize, "FontConsole", "FontConsoleFamily", "consoleFont");
consoleFont3D = loadFont<Font3D>(consoleFont3D, consoleFontName, consoleFontNameSize, "FontConsole", "FontConsoleFamily", "consoleFont3D");
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] consoleFontName = [%s] consoleFontNameSize = %d\n",__FILE__,__FUNCTION__,__LINE__,consoleFontName.c_str(),consoleFontNameSize);
}
template<typename T> T * CoreData::loadFont(Font *menuFont, string menuFontName,
int menuFontNameSize, string fontType, string fontTypeFamily, string fontUniqueKey) {
Renderer &renderer= Renderer::getInstance();
if(menuFont) {
string fontUniqueId = menuFont->getFontUniqueId();
renderer.endFont(menuFont, rsGlobal);
menuFont = NULL;
triggerFontChangedCallbacks(fontUniqueId, menuFont);
}
if(Renderer::renderText3DEnabled == false) {
menuFont = renderer.newFont(rsGlobal);
}
else {
menuFont = renderer.newFont3D(rsGlobal);
}
if(menuFont) {
Config &config= Config::getInstance();
menuFont->setType(menuFontName,config.getString(fontType,""),config.getString(fontTypeFamily,""));
menuFont->setSize(menuFontNameSize);
menuFont->setWidth(Font::wBold);
menuFont->setFontUniqueId(fontUniqueKey);
triggerFontChangedCallbacks(menuFont->getFontUniqueId(), menuFont);
}
return (T *)menuFont;
}
int CoreData::computeFontSize(int size) {
int rs = size;
Config &config= Config::getInstance();
@ -1437,7 +1355,7 @@ int CoreData::computeFontSize(int size) {
rs= 10;
}
}
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fontsize orginal %d calculated:%d \n",__FILE__,__FUNCTION__,__LINE__,size,rs);
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fontsize original %d calculated:%d \n",__FILE__,__FUNCTION__,__LINE__,size,rs);
return rs;
}
@ -1462,7 +1380,7 @@ void CoreData::saveGameSettingsToFile(std::string fileName, GameSettings *gameSe
#endif
saveGameFile << "Description=" << gameSettings->getDescription() << std::endl;
saveGameFile << "MapFilterIndex=" << Shared::PlatformByteOrder::toCommonEndian(gameSettings->getMapFilterIndex()) << std::endl;
saveGameFile << "MapFilterIndex=" << Shared::PlatformByteOrder::toCommonEndian(gameSettings->getMapFilter()) << std::endl;
saveGameFile << "Map=" << gameSettings->getMap() << std::endl;
saveGameFile << "Tileset=" << gameSettings->getTileset() << std::endl;
saveGameFile << "TechTree=" << gameSettings->getTech() << std::endl;
@ -1533,7 +1451,7 @@ bool CoreData::loadGameSettingsFromFile(std::string fileName, GameSettings *game
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] fileName = [%s]\n",__FILE__,__FUNCTION__,__LINE__,fileName.c_str());
gameSettings->setMapFilterIndex(properties.getInt("MapFilterIndex","0"));
gameSettings->setMapFilter(properties.getInt("MapFilterIndex","0"));
gameSettings->setDescription(properties.getString("Description"));
gameSettings->setMap(properties.getString("Map"));
gameSettings->setTileset(properties.getString("Tileset"));

View File

@ -28,11 +28,14 @@ namespace Glest{ namespace Game{
using ::Shared::Graphics::Texture2D;
using ::Shared::Graphics::Texture3D;
using ::Shared::Graphics::Font;
using ::Shared::Graphics::Font2D;
using ::Shared::Graphics::Font3D;
using ::Shared::Graphics::FontChangedCallbackInterface;
using ::Shared::Sound::StrSound;
using ::Shared::Sound::StaticSound;
// =====================================================
// class CoreData
//
@ -111,6 +114,7 @@ private:
string battleEndLoseVideoFilenameFallback;
string battleEndLoseMusicFilename;
std::map<std::string,std::vector<FontChangedCallbackInterface *> > registeredFontChangedCallbacks;
public:
enum TextureSystemType {
@ -232,6 +236,8 @@ public:
void saveGameSettingsToFile(std::string fileName, GameSettings *gameSettings,int advancedIndex=0);
bool loadGameSettingsFromFile(std::string fileName, GameSettings *gameSettings);
void registerFontChangedCallback(std::string entityName, FontChangedCallbackInterface *cb);
void unRegisterFontChangedCallback(std::string entityName);
private:
CoreData();
@ -256,6 +262,9 @@ private:
void loadWaterSoundsIfRequired();
void loadMusicIfRequired();
void triggerFontChangedCallbacks(std::string fontUniqueId, Font *font);
template<typename T> T * loadFont(Font *menuFontNormal, string menuFontNameNormal, int menuFontNameNormalSize, string fontType, string fontTypeFamily, string fontUniqueKey);
};
}} //end namespace

View File

@ -2706,13 +2706,13 @@ void Renderer::renderSelectionQuad() {
Vec2i computeCenteredPos(const string &text, Font2D *font, int x, int y) {
if(font == NULL) {
//abort();
throw megaglest_runtime_error("font == NULL (1)");
throw megaglest_runtime_error("font == NULL (1) text = " + text);
}
const Metrics &metrics= Metrics::getInstance();
FontMetrics *fontMetrics= font->getMetrics();
if(fontMetrics == NULL) {
throw megaglest_runtime_error("fontMetrics == NULL (1)");
throw megaglest_runtime_error("fontMetrics == NULL (1) text = " + text);
}
int virtualX = (fontMetrics->getTextWidth(text) > 0 ? static_cast<int>(fontMetrics->getTextWidth(text)/2.f) : 5);
@ -2729,13 +2729,13 @@ Vec2i computeCenteredPos(const string &text, Font2D *font, int x, int y) {
Vec2i computeCenteredPos(const string &text, Font3D *font, int x, int y) {
if(font == NULL) {
throw megaglest_runtime_error("font == NULL (2)");
throw megaglest_runtime_error("font == NULL (2) text = " + text);
}
const Metrics &metrics= Metrics::getInstance();
FontMetrics *fontMetrics= font->getMetrics();
if(fontMetrics == NULL) {
throw megaglest_runtime_error("fontMetrics == NULL (2)");
throw megaglest_runtime_error("fontMetrics == NULL (2) text = " + text);
}
int virtualX = (fontMetrics->getTextWidth(text) > 0 ? static_cast<int>(fontMetrics->getTextWidth(text) / 2.f) : 5);
@ -2861,10 +2861,12 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
if(centeredW == true) {
if(font == NULL) {
//abort();
throw megaglest_runtime_error("font == NULL (5)");
throw megaglest_runtime_error("font == NULL (5) text = " + text);
}
else if(font->getTextHandler() == NULL) {
throw megaglest_runtime_error("font->getTextHandler() == NULL (5)");
char szBuf[8096] = "";
snprintf(szBuf, 8096, "font->getTextHandler() == NULL(5) text = [%s] FontPtr = [%p]\n", text.c_str(),font);
throw megaglest_runtime_error(szBuf);
}
float lineWidth = (font->getTextHandler()->Advance(text.c_str()) * ::Shared::Graphics::Font::scaleFontValue);
@ -2875,10 +2877,10 @@ Vec2f Renderer::getCentered3DPos(const string &text, Font3D *font, Vec2f &pos, i
if(centeredH) {
if(font == NULL) {
throw megaglest_runtime_error("font == NULL (6)");
throw megaglest_runtime_error("font == NULL (6) text = " + text);
}
else if(font->getTextHandler() == NULL) {
throw megaglest_runtime_error("font->getTextHandler() == NULL (6)");
throw megaglest_runtime_error("font->getTextHandler() == NULL (6) text = " + text);
}
//const Metrics &metrics= Metrics::getInstance();
@ -3080,7 +3082,7 @@ void Renderer::renderTextShadow3D(const string &text, Font3D *font,const Vec4f &
}
if(font == NULL) {
throw megaglest_runtime_error("font == NULL (3)");
throw megaglest_runtime_error("font == NULL (3) text = " + text);
}
glPushAttrib(GL_CURRENT_BIT);
@ -3108,7 +3110,7 @@ void Renderer::renderTextShadow(const string &text, Font2D *font,const Vec4f &co
}
if(font == NULL) {
throw megaglest_runtime_error("font == NULL (4)");
throw megaglest_runtime_error("font == NULL (4) text = " + text);
}
glPushAttrib(GL_CURRENT_BIT);
@ -3246,6 +3248,7 @@ void Renderer::renderLabel(GraphicLabel *label,const Vec4f *color) {
if(label->getVisible() == false) {
return;
}
try {
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
@ -3314,6 +3317,16 @@ void Renderer::renderLabel(GraphicLabel *label,const Vec4f *color) {
}
}
glPopAttrib();
}
catch(const exception &e) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nError [%s] For Control [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),label->getInstanceName().c_str());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
throw megaglest_runtime_error(szBuf);
}
}
void Renderer::renderButton(GraphicButton *button, const Vec4f *fontColorOverride, bool *lightedOverride) {
@ -3325,6 +3338,12 @@ void Renderer::renderButton(GraphicButton *button, const Vec4f *fontColorOverrid
return;
}
try {
//char szBuf[8096]="";
//snprintf(szBuf,8096,"In [%s::%s Line: %d]\n For Control container [%s] name [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,button->getContainerName().c_str(), button->getInstanceName().c_str());
//printf(szBuf);
int x= button->getX();
int y= button->getY();
int h= button->getH();
@ -3452,6 +3471,15 @@ void Renderer::renderButton(GraphicButton *button, const Vec4f *fontColorOverrid
}
glPopAttrib();
}
catch(const exception &e) {
char szBuf[8096]="";
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nError [%s] For Control container [%s] name [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,e.what(),button->getContainerName().c_str(), button->getInstanceName().c_str());
SystemFlags::OutputDebug(SystemFlags::debugError,szBuf);
if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,szBuf);
throw megaglest_runtime_error(szBuf);
}
}
void Renderer::renderCheckBox(const GraphicCheckBox *box) {
@ -3772,7 +3800,8 @@ void Renderer::renderListBox(GraphicListBox *listBox) {
glPushAttrib(GL_ENABLE_BIT);
glEnable(GL_BLEND);
GraphicLabel label;
GraphicLabel label("ListBox_render_label","label",false);
//label.setInstanceName("ListBox_render_label");
if(listBox->getLeftControlled()==true){
label.init(listBox->getX()+listBox->getButton1()->getW()+listBox->getButton2()->getW()+2, listBox->getY(), listBox->getW(), listBox->getH(), false,listBox->getTextColor());
}
@ -5212,9 +5241,11 @@ void Renderer::renderTeamColorPlane(){
for(int visibleUnitIndex = 0;
visibleUnitIndex < (int)qCache.visibleQuadUnitList.size(); ++visibleUnitIndex){
Unit *unit = qCache.visibleQuadUnitList[visibleUnitIndex];
Vec3f currVec= unit->getCurrVectorFlat();
renderTeamColorEffect(currVec,visibleUnitIndex,unit->getType()->getSize(),
unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0),texture);
if( unit->isAlive()){
Vec3f currVec= unit->getCurrVectorFlat();
renderTeamColorEffect(currVec,visibleUnitIndex,unit->getType()->getSize(),
unit->getFaction()->getTexture()->getPixmapConst()->getPixel3f(0,0),texture);
}
}
glDisable(GL_COLOR_MATERIAL);
glPopAttrib();
@ -9297,10 +9328,24 @@ VisibleQuadContainerCache & Renderer::getQuadCache( bool updateOnDirtyFrame,
}
}
else {
SurfaceCell *sc = map->getSurfaceCell(pos);
bool insideQuad = false;
// 2 as last param for CubeInFrustum to get rid of annoying black squares
bool insideQuad = CubeInFrustum(quadCache.frustumData, sc->getVertex().x, sc->getVertex().y, sc->getVertex().z, 2);
if( !insideQuad) {
SurfaceCell *sc = map->getSurfaceCell(pos.x, pos.y);
insideQuad = CubeInFrustum(quadCache.frustumData, sc->getVertex().x, sc->getVertex().y, sc->getVertex().z, 0);
}
if( !insideQuad) {
SurfaceCell *sc = map->getSurfaceCell(pos.x+1, pos.y);
insideQuad = CubeInFrustum(quadCache.frustumData, sc->getVertex().x, sc->getVertex().y, sc->getVertex().z, 0);
}
if( !insideQuad) {
SurfaceCell *sc = map->getSurfaceCell(pos.x, pos.y+1);
insideQuad = CubeInFrustum(quadCache.frustumData, sc->getVertex().x, sc->getVertex().y, sc->getVertex().z, 0);
}
if( !insideQuad) {
SurfaceCell *sc = map->getSurfaceCell(pos.x+1, pos.y+1);
insideQuad = CubeInFrustum(quadCache.frustumData, sc->getVertex().x, sc->getVertex().y, sc->getVertex().z, 0);
}
if(insideQuad == true) {
quadCache.visibleScaledCellList.push_back(pos);

View File

@ -165,6 +165,15 @@ Object *Gui::getHighlightedResourceObject() const{
return NULL;
}
else {
if(world == NULL) {
throw megaglest_runtime_error("world == NULL");
}
if(world->getMap() == NULL) {
throw megaglest_runtime_error("world->getMap() == NULL");
}
if(world->getMap()->getSurfaceCell(highlightedResourceObjectPos) == NULL) {
throw megaglest_runtime_error("world->getMap()->getSurfaceCell(highlightedResourceObjectPos) == NULL");
}
return world->getMap()->getSurfaceCell(highlightedResourceObjectPos)->getObject();
}
}
@ -588,7 +597,7 @@ void Gui::selectInterestingUnit(InterestingUnitType iut) {
if(previousFound == true) {
if(unit->isInteresting(iut)) {
selection.select(unit);
selection.select(unit,false);
break;
}
}
@ -605,7 +614,7 @@ void Gui::selectInterestingUnit(InterestingUnitType iut) {
Unit* unit = thisFaction->getUnit(index);
if(unit->isInteresting(iut)) {
selection.select(unit);
selection.select(unit,false);
break;
}
}
@ -829,7 +838,17 @@ void Gui::computeInfoString(int posDisplay){
if(unit->getFaction()->isUnitLocked(bct->getBuilding(posDisplay))){
display.setInfoText(lang.getString("LockedByScenario")+"\n\n"+bct->getBuilding(posDisplay)->getReqDesc(game->showTranslatedTechTree()));
} else {
display.setInfoText(bct->getBuilding(posDisplay)->getReqDesc(game->showTranslatedTechTree()));
bool translatedValue= game->showTranslatedTechTree();
const UnitType *building=bct->getBuilding(posDisplay);
string str= lang.getString("BuildSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(bct->getBuildSkillType()->getSpeed())+"\n";
str+=""+Lang::getInstance().getString("TimeSteps",(translatedValue == true ? "" : "english"))+": "+intToStr(building->getProductionTime())+"\n";
int64 speed=bct->getBuildSkillType()->getSpeed()+bct->getBuildSkillType()->getTotalSpeed(unit->getTotalUpgrade());
int64 time=building->getProductionTime();
int64 seconds=time*100/speed;
str+=""+Lang::getInstance().getString("Time",(translatedValue == true ? "" : "english"))+": "+intToStr(seconds);
str+="\n\n";
str+=building->getReqDesc(translatedValue);
display.setInfoText(str);
}
}
}
@ -1137,7 +1156,7 @@ void Gui::computeSelected(bool doubleClick, bool force){
for(int i=0; i<world->getFaction(factionIndex)->getUnitCount(); ++i){
Unit *unit= world->getFaction(factionIndex)->getUnit(i);
if(unit->getPos().dist(refUnit->getPosNotThreadSafe())<doubleClickSelectionRadius &&
unit->getType()==refUnit->getType())
unit->getType()==refUnit->getType() && unit->isOperative()==refUnit->isOperative() )
{
units.push_back(unit);
}
@ -1154,7 +1173,7 @@ void Gui::computeSelected(bool doubleClick, bool force){
if(!controlDown){
//if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] about to call selection.select(units)\n",__FILE__,__FUNCTION__,__LINE__);
selection.select(units);
selection.select(units,shiftDown);
if(!selection.isEmpty()){
selectedResourceObject=NULL;
}
@ -1176,6 +1195,19 @@ bool Gui::computeTarget(const Vec2i &screenPos, Vec2i &targetPos, const Unit *&t
if(uc.empty() == false){
targetUnit= getRelevantObjectFromSelection(&uc);
targetPos= targetUnit->getPosNotThreadSafe();
// we need to respect cellmaps. Searching for a cell which is really occupied
int size=targetUnit->getType()->getSize();
bool foundUnit=false;
for ( int x= 0;x<size;++x){
for ( int y= 0;y<size;++y){
if(world->getMap()->getCell(Vec2i(targetPos.x+x,targetPos.y+y))->getUnit(targetUnit->getType()->getField())==targetUnit){
targetPos=Vec2i(targetPos.x+x,targetPos.y+y);
foundUnit=true;
break;
}
}
if(foundUnit) break;
}
highlightedUnitId=targetUnit->getId();
getHighlightedUnit()->resetHighlight();
return true;

View File

@ -51,7 +51,7 @@ bool Selection::canSelectUnitFactionCheck(const Unit *unit) const {
return true;
}
bool Selection::select(Unit *unit) {
bool Selection::select(Unit *unit, bool addToSelection) {
bool result = false;
if((int)selectedUnits.size() >= Config::getInstance().getInt("MaxUnitSelectCount",intToStr(maxUnits).c_str())) {
return result;
@ -81,6 +81,22 @@ bool Selection::select(Unit *unit) {
return false;
}
//check if multitypesel
if(selectedUnits.size() > 0) {
bool isUnifromSelectOK = ( selectedUnits.front()->getType() == unit->getType() && unit->isOperative() == selectedUnits.front()->isOperative());
if(selectedUnits.front()->getType()->getUniformSelect() == true && !isUnifromSelectOK ) {
if(addToSelection)
return false;
else
clear();
}
if (unit->getType()->getUniformSelect() == true
&& !isUnifromSelectOK ) {
return false;
}
}
//check if enemy
if(canSelectUnitFactionCheck(unit) == false && isEmpty() == false) {
return false;
@ -125,11 +141,11 @@ bool Selection::select(Unit *unit) {
return result;
}
void Selection::select(const UnitContainer &units){
void Selection::select(const UnitContainer &units, bool addToSelection){
//add units to gui
for(UnitIterator it = units.begin(); it != units.end(); ++it) {
select(*it);
select(*it,addToSelection);
}
}
@ -270,6 +286,21 @@ bool Selection::addUnitToGroup(int groupIndex,Unit *unit) {
}
}
// check for uniformselect units
if((int)groups[groupIndex].size()>0 ) {
Unit* unitInGroup=groups[groupIndex][0];
if( unit->getType()->getUniformSelect() || unitInGroup->getType()->getUniformSelect() ) {
if( unit->isOperative() != unitInGroup->isOperative()) {
//dont add units that are not in same operative state
return false;
}
if( unitInGroup->getType() != unit->getType()){
//dont add another unit to a group of uniform selection units
return false;
}
}
}
if(unit != NULL && !groupIsFull) {
groups[groupIndex].push_back(unit);
return true;
@ -309,7 +340,7 @@ void Selection::recallGroup(int groupIndex,bool clearSelection){
clear();
}
for(int i = 0; i < (int)groups[groupIndex].size(); ++i) {
select(groups[groupIndex][i]);
select(groups[groupIndex][i],!clearSelection);
}
}

View File

@ -68,8 +68,8 @@ public:
void init(Gui *gui, int factionIndex, int teamIndex, bool allowSharedTeamUnits);
virtual ~Selection();
bool select(Unit *unit);
void select(const UnitContainer &units);
bool select(Unit *unit, bool addToSelection);
void select(const UnitContainer &units, bool addToSelection);
void unSelect(const UnitContainer &units);
void unSelect(int unitIndex);
void clear();

View File

@ -73,6 +73,16 @@ BattleEnd::BattleEnd(Program *program, const Stats *stats,ProgramState *originSt
SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s %d]\n",__FILE__,__FUNCTION__,__LINE__);
if(stats->getVictory(stats->getThisFactionIndex())==true){
if (Config::getInstance().getString("InternetGamesBlockScenario", "") != ""
&& Config::getInstance().getBool("InternetGamesAllowed", "false") == false) {
if(Config::getInstance().getString("InternetGamesBlockScenario")==gameSettings->getScenario()){
Config::getInstance().setBool("InternetGamesAllowed",true);
Config::getInstance().save();
}
}
}
initBackgroundVideo();
initBackgroundMusic();
@ -714,7 +724,7 @@ void BattleEnd::render() {
renderer.renderButton(&buttonExit);
//exit message box
if(mainMessageBox.getEnabled()){
if(mainMessageBox.getEnabled() && renderToTextureCount < 300){
renderer.renderMessageBox(&mainMessageBox);
}
@ -748,7 +758,7 @@ void BattleEnd::keyDown(SDL_KeyboardEvent key){
}
else {
Lang &lang= Lang::getInstance();
showMessageBox(lang.getString("ExitGameMenu?"), "", true);
showMessageBox(lang.getString("ExitToRootMenu"), "", true);
}
}
else if(isKeyPressed(SDLK_RETURN,key) && mainMessageBox.getEnabled()) {

View File

@ -126,6 +126,9 @@ static Program *mainProgram = NULL;
static FileCRCPreCacheThread *preCacheThread = NULL;
#ifdef WIN32
static string runtimeErrorMsg = "";
// keeps in scope for duration of the application
//SocketManager *winSockManager = NULL;
#endif
#ifdef HAVE_GOOGLE_BREAKPAD
@ -683,7 +686,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
}
catch(const exception &e) {
printf("\n=====================================\n");
printf("\n** Already in error handler exiting errror rendering, msg [%s]\n",e.what());
printf("\n** Already in error handler exiting error rendering, msg [%s]\n",e.what());
fflush(stdout);
break;
}
@ -703,7 +706,7 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
}
catch(const exception &e) {
printf("\n=====================================\n");
printf("\n** Already in error handler exiting errror rendering, msg [%s]\n",e.what());
printf("\n** Already in error handler exiting error rendering, msg [%s]\n",e.what());
fflush(stdout);
break;
}
@ -813,8 +816,9 @@ void stackdumper(unsigned int type, EXCEPTION_POINTERS *ep, bool fatalExit) {
// class MainWindow
// =====================================================
MainWindow::MainWindow(Program *program) : WindowGl() {
MainWindow::MainWindow(Program *program) : WindowGl(), popupMenu("MainWindow", "popupMenu") {
this->program= program;
//this->popupMenu.registerGraphicComponentOnlyFontCallbacks("MainWindow", "popupMenu");
this->popupMenu.setEnabled(false);
this->popupMenu.setVisible(false);
this->triggerLanguageToggle = false;
@ -4129,6 +4133,7 @@ int glestMain(int argc, char** argv) {
#endif
Thread::setMainThreadId();
// printf("START ALLOC char 200\n");
//char *ptr = new char[200];
// printf("END ALLOC char 200\n");
@ -4245,9 +4250,9 @@ int glestMain(int argc, char** argv) {
#ifdef WIN32
SocketManager winSockManager;
#endif
//#ifdef WIN32
//SocketManager winSockManager;
//#endif
bool haveSpecialOutputCommandLineOption = false;
@ -4614,6 +4619,14 @@ int glestMain(int argc, char** argv) {
removeFile(binaryNameOld);
}
string netInterfaces = config.getString("NetworkInterfaces","");
if(netInterfaces != "") {
//printf("Using network interfaces: %s\n",netInterfaces.c_str());
std::vector<std::string> intfList;
Tokenize(netInterfaces,intfList,",");
Socket::setIntfTypes(intfList);
}
if(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_USE_PORTS]) == true) {
int foundParamIndIndex = -1;
hasCommandArgument(argc, argv,string(GAME_ARGS[GAME_ARG_USE_PORTS]) + string("="),&foundParamIndIndex);
@ -5934,6 +5947,7 @@ void EnableCrashingOnCrashes() {
#endif
int glestMainSEHWrapper(int argc, char** argv) {
#ifdef WIN32_STACK_TRACE
//printf("Hooking up WIN32_STACK_TRACE...\n");
__try {
@ -5953,14 +5967,21 @@ __try {
#endif
initSpecialStrings();
int result = 0;
IRCThread::setGlobalCacheContainerName(GameConstants::ircClientCacheLookupKey);
int result = glestMain(argc, argv);
result = glestMain(argc, argv);
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
cleanupProcessObjects();
if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__);
#ifdef WIN32
//delete winSockManager;
//winSockManager = NULL;
#endif
if(sdl_quitCalled == false) {
sdl_quitCalled = true;
SDL_Quit();
@ -6027,6 +6048,11 @@ int glestMainWrapper(int argc, char** argv) {
//#endif
#endif
#ifdef WIN32
//winSockManager = new SocketManager();
SocketManager winSockManager;
#endif
int result = glestMainSEHWrapper(argc, argv);
return result;
}

View File

@ -123,6 +123,7 @@ void ProgramState::mouseMove(int x, int y, const MouseState *mouseState) {
Program::ShowMessageProgramState::ShowMessageProgramState(Program *program, const char *msg) :
ProgramState(program) {
userWantsExit = false;
msgBox.registerGraphicComponent("ShowMessageProgramState", "msgBox");
msgBox.init("Ok");
if(msg) {
@ -180,7 +181,7 @@ void Program::ShowMessageProgramState::update() {
bool Program::rendererInitOk = false;
bool Program::tryingRendererInit = false;
Program::Program() {
Program::Program() : msgBox("Program", "msgBox") {
//this->masterserverMode = false;
this->window = NULL;
this->shutdownApplicationEnabled = false;
@ -193,6 +194,7 @@ Program::Program() {
//mesage box
Lang &lang= Lang::getInstance();
//msgBox.registerGraphicComponent("Program", "msgBox");
msgBox.init(lang.getString("Ok"));
msgBox.setEnabled(false);
}
@ -706,6 +708,7 @@ void Program::setState(ProgramState *programStateNew, bool cleanupOldState) {
try {
Game *game = dynamic_cast<Game *>(programStateNew);
Renderer &renderer= Renderer::getInstance();
game->setQuitPendingIndicator();// by this the world is no more updated
renderer.initGame(game,game->getGameCameraPtr());
}
catch(megaglest_runtime_error& ex2) {

Some files were not shown because too many files have changed in this diff Show More