这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ set(CYTHON_MIN_VERSION 0.25)
foreach(pol
CMP0067 # honor language standard in try_compile()
CMP0071 # enable automoc for generated files
CMP0072 # prefers GLVND by default FindOpenGL
)
if (POLICY ${pol})
cmake_policy(SET ${pol} NEW)
Expand Down
38 changes: 19 additions & 19 deletions buildsystem/HandleCXXOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -90,36 +90,36 @@ set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-DNDEBUG")

# If CXX_OPTIMIZATION_LEVEL was not provided, default to auto
if(${CXX_OPTIMIZATION_LEVEL} STREQUAL "")
if("${CXX_OPTIMIZATION_LEVEL}" STREQUAL "")
set(CXX_OPTIMIZATION_LEVEL "auto")
endif()

if(${CXX_OPTIMIZATION_LEVEL} STREQUAL "auto")
if("${CXX_OPTIMIZATION_LEVEL}" STREQUAL "auto")
if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
set(${CXX_OPTIMIZATION_LEVEL} "g")
set(CXX_OPTIMIZATION_LEVEL "g")
else()
set(${CXX_OPTIMIZATION_LEVEL} "3")
set(CXX_OPTIMIZATION_LEVEL "3")
endif()
endif()

if(${CXX_OPTIMIZATION_LEVEL} STREQUAL "0")
if("${CXX_OPTIMIZATION_LEVEL}" STREQUAL "0")
set_cxx_optimize_flags("-O0")
elseif(${CXX_OPTIMIZATION_LEVEL} STREQUAL "1")
elseif("${CXX_OPTIMIZATION_LEVEL}" STREQUAL "1")
set_cxx_optimize_flags("-O1")
elseif(${CXX_OPTIMIZATION_LEVEL} STREQUAL "2")
elseif("${CXX_OPTIMIZATION_LEVEL}" STREQUAL "2")
set_cxx_optimize_flags("-O2")
elseif(${CXX_OPTIMIZATION_LEVEL} STREQUAL "3")
elseif("${CXX_OPTIMIZATION_LEVEL}" STREQUAL "3")
set_cxx_optimize_flags("-O3")
elseif(${CXX_OPTIMIZATION_LEVEL} STREQUAL "g")
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
elseif("${CXX_OPTIMIZATION_LEVEL}" STREQUAL "g")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set_cxx_optimize_flags("-Og")
else()
set_cxx_optimize_flags("-O0")
endif()
elseif(${CXX_OPTIMIZATION_LEVEL} STREQUAL "max")
elseif("${CXX_OPTIMIZATION_LEVEL}" STREQUAL "max")
set_cxx_optimize_flags("-O3 -march=native")

if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
include(ProcessorCount)
ProcessorCount(N)
if(NOT N EQUAL 0)
Expand All @@ -136,29 +136,29 @@ if(NOT CXX_SANITIZE_MODE)
set(CXX_SANITIZE_MODE "none")
endif()

if (${CXX_SANITIZE_MODE} STREQUAL "none")
if("${CXX_SANITIZE_MODE}" STREQUAL "none")
# Do nothing
if(${CXX_SANITIZE_FATAL})
if("${CXX_SANITIZE_FATAL}")
message(WARNING "CXX_SANITIZE_FATAL is only valid when CXX_SANITIZE_MODE is not none")
endif()
else()
set_compiler_flags("CXX" "-fno-omit-frame-pointer")
if(${CXX_SANITIZE_FATAL} AND ${CMAKE_CXX_COMPILER_ID} MATCHES "Clang")
if("${CXX_SANITIZE_FATAL}" AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang")
set_compiler_flags("CXX" "-fno-sanitize-recover")
endif()

if (${CXX_SANITIZE_MODE} STREQUAL "yes")
if("${CXX_SANITIZE_MODE}" STREQUAL "yes")
set_compiler_flags("CXX" "-fsanitize=address")
set_compiler_flags("CXX" "-fsanitize=undefined")
elseif(${CXX_SANITIZE_MODE} STREQUAL "mem")
elseif("${CXX_SANITIZE_MODE}" STREQUAL "mem")
if(NOT APPLE)
set_compiler_flags("CXX" "-fsanitize=memory")
endif()
elseif(${CXX_SANITIZE_MODE} STREQUAL "thread")
elseif("${CXX_SANITIZE_MODE}" STREQUAL "thread")
if(NOT APPLE)
set_compiler_flags("CXX" "-fsanitize=thread")
endif()
if(${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
set_compiler_flags("CXX" "-fPIC")
set_compiler_flags("CXX" "-pie")
endif()
Expand Down
2 changes: 1 addition & 1 deletion copying.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ _the openage authors_ are:
| Rafael X. Morales Georgi | chocoladisco | chocoladisco à gmail dawt com |
| Marcel Schneider | schnema123 | marcelschneider5 à outlook dawt de |
| Samuel Grigolato | samuelgrigolato | samuel dawt grigolato à gmail dawt com |
| Andrew Thompson           | mrwerdo331@me.com | mrwerdo331 à me dawt com |
| Andrew Thompson | mrwerdo | mrwerdo331 à me dawt com |
| Benedikt Freisen | roybaer | b dawt freisen à gmx dawt net |
| Finn Günther | Kawzeg | kawzeg à gmail dawt com |
| Akshit Sharma | akshit-sharma | akshit9sharma à gmail dawt com |
Expand Down
7 changes: 0 additions & 7 deletions dist/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,3 @@ Contains files useful for package distribution.

The [openage.desktop](openage.desktop) file can be found in this directory and will be installed at
`/usr/share/applications/openage.desktop`.

## Desktop icon

In lieu of a logo/icon for openage a cropped version of [assets/gaben.png](/assets/gaben.png) is
created instead. See [assets/CMakeLists.txt](/assets/CMakeLists.txt) for details on how the icon
is generated. The final icon will be installed at `/usr/share/pixmaps/openage.png` via
`make install`.
6 changes: 4 additions & 2 deletions doc/build_instructions/arch_linux.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# Prerequisite steps for Arch Linux users

> NOTE: [aur](https://aur.archlinux.org/packages/openage-git/) exists, to install via **yaourt** run `yaourt -S openage-git`.
> NOTE: `openage` is packaged in the [AUR](https://aur.archlinux.org/packages/openage-git/)!

This command should provide required packages for Arch Linux installation:

`sudo pacman -S --needed python python-jinja python-pillow python-numpy python-pygments cython libepoxy libogg libpng ttf-dejavu freetype2 fontconfig harfbuzz cmake sdl2 sdl2_image opusfile opus python-pylint qt5-declarative qt5-quickcontrols`
`sudo pacman -S --needed eigen python python-jinja python-pillow python-numpy python-pygments cython libepoxy libogg libpng ttf-dejavu freetype2 fontconfig harfbuzz cmake sdl2 sdl2_image opusfile opus python-pylint qt5-declarative qt5-quickcontrols`

If you don't have a compiler installed, you can select between these commands to install it:
- `sudo pacman -S --needed gcc`
- `sudo pacman -S --needed clang`

You can install both compilers and select the one to be used by `./configure`.

You will also need [nyan](https://github.com/SFTtech/nyan/blob/master/doc/building.md) and its dependencies.
2 changes: 1 addition & 1 deletion doc/build_instructions/debian.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Prerequisite steps for Debian Sid users

- `sudo apt-get update`
- `sudo apt-get install cmake libfreetype6-dev python3-dev python3-pip libepoxy-dev libsdl2-dev libsdl2-image-dev libopusfile-dev libfontconfig1-dev libharfbuzz-dev libpng-dev opus-tools python3-pil python3-numpy python3-pygments qtdeclarative5-dev qml-module-qtquick-controls cython3 python3-jinja2`
- `sudo apt-get install cmake cython3 libeigen3-dev libepoxy-dev libfontconfig1-dev libfreetype6-dev libharfbuzz-dev libogg-dev libopus-dev libopusfile-dev libpng-dev libsdl2-dev libsdl2-image-dev python3-dev python3-jinja2 python3-numpy python3-pil python3-pip python3-pygments qml-module-qtquick-controls qtdeclarative5-dev`

You will also need [nyan](https://github.com/SFTtech/nyan/blob/master/doc/building.md) and its dependencies.
2 changes: 1 addition & 1 deletion doc/build_instructions/fedora.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@

Run the following command:

`sudo dnf install cmake gcc-c++ clang SDL2-devel SDL2_image-devel python3-Cython python3-devel python3-numpy python3-pillow python3-pygments libepoxy-devel libogg-devel libopusenc-devel python3-jinja2 libpng-devel opusfile-devel fontconfig-devel harfbuzz-devel qt5-qtdeclarative-devel qt5-qtquickcontrols`
`sudo dnf install clang cmake eigen3-devel fontconfig-devel gcc-c harfbuzz-devel libepoxy-devel libogg-devel libopusenc-devel libpng-devel opusfile-devel python3-Cython python3-devel python3-jinja2 python3-numpy python3-pillow python3-pygments SDL2-devel SDL2_image-devel++ qt5-qtdeclarative-devel qt5-qtquickcontrols`

You will also need [nyan](https://github.com/SFTtech/nyan/blob/master/doc/building.md) and its dependencies.
6 changes: 3 additions & 3 deletions doc/build_instructions/freebsd.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

This command should provide required packages for FreeBSD installation:

`sudo pkg install python py-pillow py-numpy py-pygments cython harfbuzz cmake sdl2 sdl2_image opusfile opus-tools png pylint qt5`
`sudo pkg install cmake cython eigen3 harfbuzz opus-tools opusfile png py-numpy py-pillow py-pygments pylint python qt5 sdl2 sdl2_image`

You will also need [nyan](https://github.com/SFTtech/nyan/blob/master/doc/building.md) and its dependencies.

clang is the base compiler however, it is possible to use either any version of gcc>=7 or any other version of clang present in pkg:
`clang` is the base compiler however, it is possible to use either any version of `gcc>=7` or any other version of `clang` present in `pkg`:
- `sudo pkg install gcc`

Select the one to be used by `./configure`.
Select the one to be used by `./configure --help`.
2 changes: 1 addition & 1 deletion doc/build_instructions/gentoo.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@ If you want to install the latest git version:
=games-strategy/openage-9999::sft **
```

Beware, the git version does not do automatic updates.
Beware, the git version does **not** do automatic updates.
You have to explicitly "reinstall" openage or use `app-portage/smart-live-rebuild`.
2 changes: 1 addition & 1 deletion doc/build_instructions/opensuse_13.2.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ if all packages can be installed.

- `zypper addrepo http://download.opensuse.org/repositories/devel:languages:python3/openSUSE_13.2/devel:languages:python3.repo`
- `zypper refresh`
- `zypper install --no-recommends cmake doxygen fontconfig-devel harfbuzz-devel gcc49-c++ graphviz libpng-devel libSDL2-devel libSDL2_image-devel libfreetype6 libepoxy-devel libogg-devel libopus-devel opusfile-devel pkgconfig python3-Cython python3-Jinja2 python3-Pillow python3-Pygments python3-devel libqt5-qtdeclarative-devel libqt5-qtquickcontrols`
- `zypper install --no-recommends cmake doxygen eigen3-devel fontconfig-devel gcc49-c graphviz++ harfbuzz-devel libSDL2-devel libSDL2_image-devel libepoxy-devel libfreetype6 libogg-devel libopus-devel libpng-devel libqt5-qtdeclarative-devel libqt5-qtquickcontrols opusfile-devel pkgconfig python3-Cython python3-Jinja2 python3-Pillow python3-Pygments python3-devel`

You will also need [nyan](https://github.com/SFTtech/nyan/blob/master/doc/building.md) and its dependencies.
2 changes: 1 addition & 1 deletion doc/build_instructions/opensuse_tumbleweed.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Prerequisite steps for openSUSE users (openSUSE Tumbleweed)

- `zypper install --no-recommends cmake doxygen fontconfig-devel harfbuzz-devel gcc-c++ graphviz libpng-devel libSDL2-devel libSDL2_image-devel libfreetype6 libepoxy-devel libogg-devel libopus-devel opusfile-devel pkgconfig python3-Cython python3-Jinja2 python3-Pillow python3-Pygments python3-devel libqt5-qtdeclarative-devel libqt5-qtquickcontrols`
- `zypper install --no-recommends cmake doxygen eigen3-devel fontconfig-devel gcc-c graphviz++ harfbuzz-devel libSDL2-devel libSDL2_image-devel libepoxy-devel libfreetype6 libogg-devel libopus-devel libpng-devel libqt5-qtdeclarative-devel libqt5-qtquickcontrols opusfile-devel pkgconfig python3-Cython python3-Jinja2 python3-Pillow python3-Pygments python3-devel`

You will also need [nyan](https://github.com/SFTtech/nyan/blob/master/doc/building.md) and its dependencies.
3 changes: 1 addition & 2 deletions doc/build_instructions/ubuntu.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Prerequisite steps for Ubuntu users (Ubuntu 18.04)

- `sudo apt-get update`
- `sudo apt-get install cmake libfreetype6-dev python3-dev python3-pip libepoxy-dev libsdl2-dev libsdl2-image-dev libopusfile-dev libfontconfig1-dev libharfbuzz-dev libogg-dev libopus-dev libpng-dev python3-pil python3-numpy python3-pygments python3-jinja2 qtdeclarative5-dev qml-module-qtquick-controls`
- `pip3 install cython`
- `sudo apt-get install cmake cython3 libeigen3-dev libepoxy-dev libfontconfig1-dev libfreetype6-dev libharfbuzz-dev libogg-dev libopus-dev libopusfile-dev libpng-dev libsdl2-dev libsdl2-image-dev python3-dev python3-jinja2 python3-numpy python3-pil python3-pip python3-pygments qml-module-qtquick-controls qtdeclarative5-dev`

You will also need [nyan](https://github.com/SFTtech/nyan/blob/master/doc/building.md) and its dependencies.
2 changes: 1 addition & 1 deletion doc/build_instructions/windows_msvc.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
### vcpkg packages
Set up [vcpkg](https://github.com/Microsoft/vcpkg#quick-start). Open a command prompt at `<vcpkg directory>`

vcpkg install dirent libepoxy fontconfig freetype harfbuzz libogg opus opusfile qt5-base qt5-declarative qt5-quickcontrols sdl2 sdl2-image libpng
vcpkg install dirent eigen3 fontconfig freetype harfbuzz libepoxy libogg libpng opus opusfile qt5-base qt5-declarative qt5-quickcontrols sdl2 sdl2-image

_Note:_ The `qt5` port in vcpkg has been split into multiple packages, build times are acceptable now.
If you want, you can still use [the prebuilt version](https://www.qt.io/download-open-source/) instead.
Expand Down
14 changes: 8 additions & 6 deletions doc/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,30 @@ Dependency list:
C cmake >=3.1.0
A numpy
A python imaging library (PIL) -> pillow
CR opengl >=2.1
CR opengl >=3.3
CR libepoxy
CR libpng
R dejavu font
CR eigen >=3
CR freetype2
CR fontconfig
CR harfbuzz >= 1.0.0
CR harfbuzz >=1.0.0
CR nyan (https://github.com/SFTtech/nyan)
CR O ncurses
C jinja2
CR sdl2
CR sdl2_image
CR opusfile
CRA libopus
CRA libogg
S pycodestyle (or pep8 (deprecated))
CRA opus
CRA ogg
S pycodestyle
C pygments
S pylint
CR qt5 >=5.5 (Core, Quick, QuickControls modules)
CR O vulkan

A An installed version of any of the following (wine is your friend).
Other versions _might_ work; setup disk support will be added soon:
Other versions _might_ work:

- Age of Empires II: The Conquerors Patch 1.0c
- Age of Empires II: Forgotten Empires
Expand Down
14 changes: 10 additions & 4 deletions libopenage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,16 +216,14 @@ endif()

if(WANT_OPENGL AND OPENGL_FOUND)
have_config_option(opengl OPENGL true)
include_directories(${OPENGL_INCLUDE_DIR})
target_link_libraries(libopenage PRIVATE ${OPENGL_LIBRARY})
target_link_libraries(libopenage PRIVATE OpenGL::GL)
else()
have_config_option(opengl OPENGL false)
endif()

if(WANT_VULKAN AND VULKAN_FOUND)
have_config_option(vulkan VULKAN true)
include_directories(${Vulkan_INCLUDE_DIRS})
target_link_libraries(libopenage PRIVATE ${Vulkan_LIBRARIES})
target_link_libraries(libopenage PRIVATE Vulkan::Vulkan)
else()
have_config_option(vulkan VULKAN false)
endif()
Expand All @@ -241,6 +239,12 @@ get_config_option_string()
configure_file(config.h.in ${CMAKE_CURRENT_SOURCE_DIR}/config.h)
configure_file(config.cpp.in ${CMAKE_CURRENT_SOURCE_DIR}/config.cpp)

configure_file(
"${CMAKE_SOURCE_DIR}/openage/config.py.in"
"${CMAKE_SOURCE_DIR}/openage/config.py"
)


##################################################
# platform specifics
if(APPLE)
Expand Down Expand Up @@ -327,8 +331,10 @@ pxdgen(
add_subdirectory("audio")
add_subdirectory("console")
add_subdirectory("coord")
add_subdirectory("curve")
add_subdirectory("cvar")
add_subdirectory("datastructure")
add_subdirectory("event")
add_subdirectory("gui")
add_subdirectory("error")
add_subdirectory("gamestate")
Expand Down
14 changes: 14 additions & 0 deletions libopenage/curve/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
add_sources(libopenage
continuous.cpp
curve.cpp
discrete.cpp
iterator.cpp
keyframe_container.cpp
map.cpp
map_filter_iterator.cpp
queue.cpp
queue_filter_iterator.cpp
value_container.cpp
)

add_subdirectory("tests")
9 changes: 9 additions & 0 deletions libopenage/curve/continuous.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2017-2018 the openage authors. See copying.md for legal info.

#include "continuous.h"

namespace openage::curve {

// This file is intended to be empty

} // openage::curve
63 changes: 63 additions & 0 deletions libopenage/curve/continuous.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// Copyright 2017-2018 the openage authors. See copying.md for legal info.

#pragma once

#include <type_traits>

#include "value_container.h"
#include "../log/log.h"

namespace openage::curve {


/**
* Continuous Datatype.
* Stores a value container with continuous access.
* The bound template type T has to implement `operator+(T)` and
* `operator*(time_t)`.
*/
template<typename T>
class Continuous : public ValueContainer<T> {
public:
using ValueContainer<T>::ValueContainer;
/**
* will interpolate between the keyframes linearly based on the time.
*/
T get(const time_t &) const override;
};



template <typename T>
T Continuous<T>::get(const time_t &time) const {
const auto &e = this->container.last(time, this->last_element);
this->last_element = e;

auto nxt = e;
++nxt;

time_t diff_time = 0;

auto offset = time - e->time;

// If we do not have a next (buffer underrun!!) we assign values
if (nxt == this->container.end()) {
// log::log(WARN << "Continuous buffer underrun. This might be bad! Assuming constant.");
} else {
diff_time = nxt->time - e->time;
}

if (nxt == this->container.end() // use the last curve value
|| offset == 0 // values equal -> don't need to interpolate
|| diff_time == 0) { // values at the same time -> division-by-zero-error

return e->value;
} else {
// Interpolation between time(now) and time(next) that has elapsed
double elapsed_frac = offset.to_double() / diff_time.to_double();

return e->value + (nxt->value - e->value) * elapsed_frac;
}
}

} // openage::curve
9 changes: 9 additions & 0 deletions libopenage/curve/curve.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright 2017-2018 the openage authors. See copying.md for legal info.

#include "curve.h"

namespace openage::curve {

// This file is intended to be empty

} // openage::curve
Loading