forked from github/server
reorganized directory structure.
flattening the directory structure, moving some modules to the src/ directory. making stealth a separate file, under test. more tests for some stuff.
This commit is contained in:
parent
d435c13bfc
commit
a9a0455207
58 changed files with 4686 additions and 4560 deletions
|
@ -55,8 +55,10 @@ INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/include)
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AUTOCONF")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AUTOCONF")
|
||||||
|
|
||||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
IF(CMAKE_COMPILER_IS_GNUCC)
|
||||||
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL")
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL")
|
||||||
elseif(MSVC)
|
elseif(MSVC)
|
||||||
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4 /WX /MP")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_DEBUG
|
set(CMAKE_EXE_LINKER_FLAGS_DEBUG
|
||||||
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrt.lib")
|
"${CMAKE_EXE_LINKER_FLAGS_DEBUG} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrt.lib")
|
||||||
set(CMAKE_EXE_LINKER_FLAGS_RELEASE
|
set(CMAKE_EXE_LINKER_FLAGS_RELEASE
|
||||||
|
|
2
critbit
2
critbit
|
@ -1 +1 @@
|
||||||
Subproject commit 4ab2cfe0a6dd6d57ebb460f9b824f68dba50b7de
|
Subproject commit 26c635d81a6cf783ccd9d4200d85b4d1327ef200
|
|
@ -1,14 +1,6 @@
|
||||||
cmake_minimum_required(VERSION 2.6)
|
cmake_minimum_required(VERSION 2.6)
|
||||||
project (server C)
|
project (server C)
|
||||||
|
|
||||||
IF(CMAKE_COMPILER_IS_GNUCC)
|
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
|
|
||||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL")
|
|
||||||
ELSEIF(MSVC)
|
|
||||||
ELSE(CMAKE_COMPILER_IS_GNUCC)
|
|
||||||
MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}")
|
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCC)
|
|
||||||
|
|
||||||
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
|
include_directories (${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
include_directories (${CRITBIT_INCLUDE_DIR})
|
include_directories (${CRITBIT_INCLUDE_DIR})
|
||||||
include_directories (${CJSON_INCLUDE_DIR})
|
include_directories (${CJSON_INCLUDE_DIR})
|
||||||
|
@ -58,6 +50,12 @@ TOLUA_BINDING(settings.pkg bind_settings.h)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
set (ERESSEA_SRC
|
set (ERESSEA_SRC
|
||||||
|
move.c
|
||||||
|
battle.c
|
||||||
|
alchemy.c
|
||||||
|
stealth.c
|
||||||
|
names.c
|
||||||
|
reports.c
|
||||||
eressea.c
|
eressea.c
|
||||||
callback.c
|
callback.c
|
||||||
direction.c
|
direction.c
|
||||||
|
@ -141,7 +139,11 @@ target_link_libraries(eressea
|
||||||
set(TESTS_SRC
|
set(TESTS_SRC
|
||||||
test_eressea.c
|
test_eressea.c
|
||||||
tests.c
|
tests.c
|
||||||
|
battle.test.c
|
||||||
tests.test.c
|
tests.test.c
|
||||||
|
reports.test.c
|
||||||
|
stealth.test.c
|
||||||
|
move.test.c
|
||||||
callback.test.c
|
callback.test.c
|
||||||
direction.test.c
|
direction.test.c
|
||||||
keyword.test.c
|
keyword.test.c
|
||||||
|
|
|
@ -19,18 +19,18 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include "alchemy.h"
|
#include "alchemy.h"
|
||||||
|
|
||||||
#include "item.h"
|
|
||||||
#include "faction.h"
|
|
||||||
#include "messages.h"
|
|
||||||
#include "build.h"
|
|
||||||
#include "magic.h"
|
|
||||||
#include "region.h"
|
|
||||||
#include "pool.h"
|
|
||||||
#include "race.h"
|
|
||||||
#include "unit.h"
|
|
||||||
#include "skill.h"
|
|
||||||
#include "move.h"
|
#include "move.h"
|
||||||
|
#include "skill.h"
|
||||||
|
|
||||||
|
#include <kernel/item.h>
|
||||||
|
#include <kernel/faction.h>
|
||||||
|
#include <kernel/messages.h>
|
||||||
|
#include <kernel/build.h>
|
||||||
|
#include <kernel/magic.h>
|
||||||
|
#include <kernel/region.h>
|
||||||
|
#include <kernel/pool.h>
|
||||||
|
#include <kernel/race.h>
|
||||||
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
4342
src/battle.c
Normal file
4342
src/battle.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -1,13 +1,15 @@
|
||||||
#include <kernel/types.h>
|
#include <kernel/types.h>
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
|
|
||||||
#include "battle.h"
|
#include "battle.h"
|
||||||
#include "building.h"
|
|
||||||
#include "faction.h"
|
|
||||||
#include "item.h"
|
|
||||||
#include "race.h"
|
|
||||||
#include "region.h"
|
|
||||||
#include "skill.h"
|
#include "skill.h"
|
||||||
#include "unit.h"
|
|
||||||
|
#include <kernel/building.h>
|
||||||
|
#include <kernel/faction.h>
|
||||||
|
#include <kernel/item.h>
|
||||||
|
#include <kernel/race.h>
|
||||||
|
#include <kernel/region.h>
|
||||||
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
#include <CuTest.h>
|
#include <CuTest.h>
|
||||||
#include "tests.h"
|
#include "tests.h"
|
|
@ -1,11 +1,12 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
|
|
||||||
|
#include <spells/spells.h>
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
|
|
@ -6,11 +6,11 @@
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/battle.h>
|
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/move.h>
|
#include "battle.h"
|
||||||
|
#include "move.h"
|
||||||
#include "economy.h"
|
#include "economy.h"
|
||||||
#include "laws.h"
|
#include "laws.h"
|
||||||
#include "market.h"
|
#include "market.h"
|
||||||
|
|
|
@ -14,9 +14,10 @@ without prior permission by the authors of Eressea.
|
||||||
#include "bind_ship.h"
|
#include "bind_ship.h"
|
||||||
#include "bind_unit.h"
|
#include "bind_unit.h"
|
||||||
|
|
||||||
|
#include "move.h"
|
||||||
|
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/build.h>
|
#include <kernel/build.h>
|
||||||
|
|
||||||
|
|
|
@ -17,14 +17,15 @@ without prior permission by the authors of Eressea.
|
||||||
#ifdef BSON_ATTRIB
|
#ifdef BSON_ATTRIB
|
||||||
# include "bind_attrib.h"
|
# include "bind_attrib.h"
|
||||||
#endif
|
#endif
|
||||||
|
#include "alchemy.h"
|
||||||
#include "bindings.h"
|
#include "bindings.h"
|
||||||
|
#include "move.h"
|
||||||
|
|
||||||
/* attributes includes */
|
/* attributes includes */
|
||||||
#include <attributes/racename.h>
|
#include <attributes/racename.h>
|
||||||
#include <attributes/key.h>
|
#include <attributes/key.h>
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/alchemy.h>
|
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
|
@ -32,7 +33,6 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
|
|
|
@ -24,6 +24,7 @@ without prior permission by the authors of Eressea.
|
||||||
#include "bind_region.h"
|
#include "bind_region.h"
|
||||||
#include "helpers.h"
|
#include "helpers.h"
|
||||||
#include "console.h"
|
#include "console.h"
|
||||||
|
#include "reports.h"
|
||||||
|
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
|
|
||||||
|
@ -36,7 +37,6 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
|
|
|
@ -20,9 +20,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include "creation.h"
|
#include "creation.h"
|
||||||
#include "monster.h"
|
#include "monster.h"
|
||||||
|
#include "alchemy.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/alchemy.h>
|
|
||||||
#include <kernel/build.h>
|
#include <kernel/build.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
|
|
|
@ -30,9 +30,12 @@ without prior permission by the authors of Eressea.
|
||||||
/* gamecode includes */
|
/* gamecode includes */
|
||||||
#include "laws.h"
|
#include "laws.h"
|
||||||
#include "economy.h"
|
#include "economy.h"
|
||||||
|
#include "stealth.h"
|
||||||
|
#include "move.h"
|
||||||
|
#include "reports.h"
|
||||||
|
#include "alchemy.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/alchemy.h>
|
|
||||||
#include <kernel/alliance.h>
|
#include <kernel/alliance.h>
|
||||||
#include <kernel/ally.h>
|
#include <kernel/ally.h>
|
||||||
#include <kernel/connection.h>
|
#include <kernel/connection.h>
|
||||||
|
@ -42,12 +45,10 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/group.h>
|
#include <kernel/group.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/resources.h>
|
#include <kernel/resources.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
|
|
|
@ -22,14 +22,16 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/types.h>
|
#include <kernel/types.h>
|
||||||
#include "economy.h"
|
#include "economy.h"
|
||||||
|
|
||||||
|
#include "alchemy.h"
|
||||||
#include "direction.h"
|
#include "direction.h"
|
||||||
#include "give.h"
|
#include "give.h"
|
||||||
#include "laws.h"
|
#include "laws.h"
|
||||||
#include "randenc.h"
|
#include "randenc.h"
|
||||||
#include "spy.h"
|
#include "spy.h"
|
||||||
|
#include "move.h"
|
||||||
|
#include "reports.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/alchemy.h>
|
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/calendar.h>
|
#include <kernel/calendar.h>
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
|
@ -38,13 +40,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/resources.h>
|
#include <kernel/resources.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
|
|
|
@ -14,10 +14,7 @@
|
||||||
#include <triggers/triggers.h>
|
#include <triggers/triggers.h>
|
||||||
#include <util/language.h>
|
#include <util/language.h>
|
||||||
#include <kernel/xmlreader.h>
|
#include <kernel/xmlreader.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/names.h>
|
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <modules/wormhole.h>
|
#include <modules/wormhole.h>
|
||||||
#include <modules/gmcmd.h>
|
#include <modules/gmcmd.h>
|
||||||
|
@ -27,6 +24,7 @@
|
||||||
#include "report.h"
|
#include "report.h"
|
||||||
#include "items.h"
|
#include "items.h"
|
||||||
#include "creport.h"
|
#include "creport.h"
|
||||||
|
#include "names.h"
|
||||||
|
|
||||||
void game_done(void)
|
void game_done(void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,7 +26,6 @@
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/names.h>
|
|
||||||
#include <kernel/teleport.h>
|
#include <kernel/teleport.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
#include "items.h"
|
#include "items.h"
|
||||||
|
|
||||||
#include "study.h"
|
#include "study.h"
|
||||||
|
#include "move.h"
|
||||||
|
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
|
@ -10,7 +11,6 @@
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
|
|
|
@ -24,12 +24,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
#include <move.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
#include <util/log.h>
|
#include <util/log.h>
|
||||||
|
|
|
@ -19,13 +19,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include "weapons.h"
|
#include "weapons.h"
|
||||||
|
#include "battle.h"
|
||||||
|
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/build.h>
|
#include <kernel/build.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/battle.h>
|
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
|
|
|
@ -9,27 +9,22 @@ save.test.c
|
||||||
ship.test.c
|
ship.test.c
|
||||||
spell.test.c
|
spell.test.c
|
||||||
ally.test.c
|
ally.test.c
|
||||||
battle.test.c
|
|
||||||
building.test.c
|
building.test.c
|
||||||
magic.test.c
|
magic.test.c
|
||||||
equipment.test.c
|
equipment.test.c
|
||||||
curse.test.c
|
curse.test.c
|
||||||
item.test.c
|
item.test.c
|
||||||
move.test.c
|
|
||||||
order.test.c
|
order.test.c
|
||||||
pool.test.c
|
pool.test.c
|
||||||
race.test.c
|
race.test.c
|
||||||
reports.test.c
|
|
||||||
spellbook.test.c
|
spellbook.test.c
|
||||||
curse.test.c
|
curse.test.c
|
||||||
jsonconf.test.c
|
jsonconf.test.c
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(_FILES
|
SET(_FILES
|
||||||
alchemy.c
|
|
||||||
alliance.c
|
alliance.c
|
||||||
ally.c
|
ally.c
|
||||||
battle.c
|
|
||||||
build.c
|
build.c
|
||||||
building.c
|
building.c
|
||||||
calendar.c
|
calendar.c
|
||||||
|
@ -43,15 +38,12 @@ group.c
|
||||||
item.c
|
item.c
|
||||||
magic.c
|
magic.c
|
||||||
messages.c
|
messages.c
|
||||||
move.c
|
|
||||||
names.c
|
|
||||||
order.c
|
order.c
|
||||||
pathfinder.c
|
pathfinder.c
|
||||||
plane.c
|
plane.c
|
||||||
pool.c
|
pool.c
|
||||||
race.c
|
race.c
|
||||||
region.c
|
region.c
|
||||||
reports.c
|
|
||||||
resources.c
|
resources.c
|
||||||
save.c
|
save.c
|
||||||
ship.c
|
ship.c
|
||||||
|
|
4280
src/kernel/battle.c
4280
src/kernel/battle.c
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,6 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include <kernel/alchemy.h>
|
#include "alchemy.h"
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
#include "build.h"
|
#include "build.h"
|
||||||
#include "order.h"
|
#include "order.h"
|
||||||
|
|
|
@ -27,7 +27,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "alliance.h"
|
#include "alliance.h"
|
||||||
#include "ally.h"
|
#include "ally.h"
|
||||||
#include "alchemy.h"
|
#include "alchemy.h"
|
||||||
#include "battle.h"
|
|
||||||
#include "connection.h"
|
#include "connection.h"
|
||||||
#include "building.h"
|
#include "building.h"
|
||||||
#include "calendar.h"
|
#include "calendar.h"
|
||||||
|
@ -40,7 +39,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "magic.h"
|
#include "magic.h"
|
||||||
#include "messages.h"
|
#include "messages.h"
|
||||||
#include "move.h"
|
#include "move.h"
|
||||||
#include "names.h"
|
|
||||||
#include "objtypes.h"
|
#include "objtypes.h"
|
||||||
#include "order.h"
|
#include "order.h"
|
||||||
#include "plane.h"
|
#include "plane.h"
|
||||||
|
@ -76,6 +74,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <util/umlaut.h>
|
#include <util/umlaut.h>
|
||||||
#include <util/xml.h>
|
#include <util/xml.h>
|
||||||
|
|
||||||
|
#include <stealth.h>
|
||||||
|
|
||||||
#ifdef USE_LIBXML2
|
#ifdef USE_LIBXML2
|
||||||
/* libxml includes */
|
/* libxml includes */
|
||||||
#include <libxml/tree.h>
|
#include <libxml/tree.h>
|
||||||
|
@ -669,23 +669,6 @@ region *findunitregion(const unit * su)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
int eff_stealth(const unit * u, const region * r)
|
|
||||||
{
|
|
||||||
int e = 0;
|
|
||||||
|
|
||||||
/* Auf Schiffen keine Tarnung! */
|
|
||||||
if (!u->ship && skill_enabled(SK_STEALTH)) {
|
|
||||||
e = eff_skill(u, SK_STEALTH, r);
|
|
||||||
|
|
||||||
if (fval(u, UFL_STEALTH)) {
|
|
||||||
int es = u_geteffstealth(u);
|
|
||||||
if (es >= 0 && es < e)
|
|
||||||
return es;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return e;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool unit_has_cursed_item(unit * u)
|
bool unit_has_cursed_item(unit * u)
|
||||||
{
|
{
|
||||||
item *itm = u->items;
|
item *itm = u->items;
|
||||||
|
|
|
@ -251,7 +251,6 @@ extern "C" {
|
||||||
bool has_limited_skills(const struct unit *u);
|
bool has_limited_skills(const struct unit *u);
|
||||||
const struct race *findrace(const char *, const struct locale *);
|
const struct race *findrace(const char *, const struct locale *);
|
||||||
|
|
||||||
int eff_stealth(const struct unit *u, const struct region *r);
|
|
||||||
int ispresent(const struct faction *f, const struct region *r);
|
int ispresent(const struct faction *f, const struct region *r);
|
||||||
|
|
||||||
int check_option(struct faction *f, int option);
|
int check_option(struct faction *f, int option);
|
||||||
|
|
|
@ -56,6 +56,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <util/rng.h>
|
#include <util/rng.h>
|
||||||
#include <util/variant.h>
|
#include <util/variant.h>
|
||||||
|
|
||||||
|
#include <stealth.h>
|
||||||
|
|
||||||
#include <storage.h>
|
#include <storage.h>
|
||||||
|
|
||||||
/* libc includes */
|
/* libc includes */
|
||||||
|
@ -683,44 +685,6 @@ variant read_unit_reference(struct storage * store)
|
||||||
return var;
|
return var;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib_type at_stealth = {
|
|
||||||
"stealth", NULL, NULL, NULL, a_writeint, a_readint
|
|
||||||
};
|
|
||||||
|
|
||||||
void u_seteffstealth(unit * u, int value)
|
|
||||||
{
|
|
||||||
if (skill_enabled(SK_STEALTH)) {
|
|
||||||
attrib *a = NULL;
|
|
||||||
if (fval(u, UFL_STEALTH)) {
|
|
||||||
a = a_find(u->attribs, &at_stealth);
|
|
||||||
}
|
|
||||||
if (value < 0) {
|
|
||||||
if (a != NULL) {
|
|
||||||
freset(u, UFL_STEALTH);
|
|
||||||
a_remove(&u->attribs, a);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (a == NULL) {
|
|
||||||
a = a_add(&u->attribs, a_new(&at_stealth));
|
|
||||||
fset(u, UFL_STEALTH);
|
|
||||||
}
|
|
||||||
a->data.i = value;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int u_geteffstealth(const struct unit *u)
|
|
||||||
{
|
|
||||||
if (skill_enabled(SK_STEALTH)) {
|
|
||||||
if (fval(u, UFL_STEALTH)) {
|
|
||||||
attrib *a = a_find(u->attribs, &at_stealth);
|
|
||||||
if (a != NULL)
|
|
||||||
return a->data.i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
int get_level(const unit * u, skill_t id)
|
int get_level(const unit * u, skill_t id)
|
||||||
{
|
{
|
||||||
if (skill_enabled(id)) {
|
if (skill_enabled(id)) {
|
||||||
|
@ -1495,7 +1459,6 @@ unit *create_unit(region * r, faction * f, int number, const struct race *urace,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
u_seteffstealth(u, -1);
|
|
||||||
u_setrace(u, urace);
|
u_setrace(u, urace);
|
||||||
u->irace = NULL;
|
u->irace = NULL;
|
||||||
|
|
||||||
|
|
|
@ -125,10 +125,6 @@ extern "C" {
|
||||||
|
|
||||||
int ualias(const struct unit *u);
|
int ualias(const struct unit *u);
|
||||||
|
|
||||||
extern struct attrib_type at_stealth;
|
|
||||||
|
|
||||||
void u_seteffstealth(struct unit *u, int value);
|
|
||||||
int u_geteffstealth(const struct unit *u);
|
|
||||||
const struct race *u_irace(const struct unit *u);
|
const struct race *u_irace(const struct unit *u);
|
||||||
const struct race *u_race(const struct unit *u);
|
const struct race *u_race(const struct unit *u);
|
||||||
void u_setrace(struct unit *u, const struct race *);
|
void u_setrace(struct unit *u, const struct race *);
|
||||||
|
|
|
@ -31,12 +31,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "study.h"
|
#include "study.h"
|
||||||
#include "market.h"
|
#include "market.h"
|
||||||
#include "keyword.h"
|
#include "keyword.h"
|
||||||
|
#include "move.h"
|
||||||
|
#include "battle.h"
|
||||||
|
#include "alchemy.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/alchemy.h>
|
|
||||||
#include <kernel/alliance.h>
|
#include <kernel/alliance.h>
|
||||||
#include <kernel/ally.h>
|
#include <kernel/ally.h>
|
||||||
#include <kernel/battle.h>
|
|
||||||
#include <kernel/connection.h>
|
#include <kernel/connection.h>
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
|
@ -46,7 +47,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
|
|
|
@ -34,17 +34,17 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
#include <move.h>
|
||||||
|
|
||||||
/* util include */
|
/* util include */
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
#include <util/base36.h>
|
#include <util/base36.h>
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
|
|
|
@ -28,7 +28,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/connection.h>
|
#include <kernel/connection.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
|
@ -38,6 +37,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
|
|
||||||
|
#include <move.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
#include <util/base36.h>
|
#include <util/base36.h>
|
||||||
|
|
|
@ -18,11 +18,12 @@
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
#include <move.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
#include <util/base36.h>
|
#include <util/base36.h>
|
||||||
|
|
|
@ -23,6 +23,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
/* gamecode includes */
|
/* gamecode includes */
|
||||||
#include "economy.h"
|
#include "economy.h"
|
||||||
#include "give.h"
|
#include "give.h"
|
||||||
|
#include "move.h"
|
||||||
|
|
||||||
/* triggers includes */
|
/* triggers includes */
|
||||||
#include <triggers/removecurse.h>
|
#include <triggers/removecurse.h>
|
||||||
|
@ -37,14 +38,11 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/names.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/pathfinder.h>
|
#include <kernel/pathfinder.h>
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
|
@ -40,18 +40,17 @@
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/names.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/pathfinder.h>
|
#include <kernel/pathfinder.h>
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
#include <move.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
#include <util/base36.h>
|
#include <util/base36.h>
|
||||||
|
|
|
@ -20,31 +20,32 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include "move.h"
|
#include "move.h"
|
||||||
|
|
||||||
#include "alchemy.h"
|
|
||||||
#include "connection.h"
|
|
||||||
#include "build.h"
|
|
||||||
#include "building.h"
|
|
||||||
#include "calendar.h"
|
|
||||||
#include "curse.h"
|
|
||||||
#include "direction.h"
|
|
||||||
#include "faction.h"
|
|
||||||
#include "item.h"
|
|
||||||
#include "magic.h"
|
|
||||||
#include "messages.h"
|
|
||||||
#include "order.h"
|
|
||||||
#include "plane.h"
|
|
||||||
#include "race.h"
|
|
||||||
#include "region.h"
|
|
||||||
#include "render.h"
|
|
||||||
#include "reports.h"
|
#include "reports.h"
|
||||||
#include "save.h"
|
#include "alchemy.h"
|
||||||
#include "ship.h"
|
|
||||||
|
#include <kernel/build.h>
|
||||||
|
#include <kernel/building.h>
|
||||||
|
#include <kernel/calendar.h>
|
||||||
|
#include <kernel/connection.h>
|
||||||
|
#include <kernel/curse.h>
|
||||||
|
#include <kernel/faction.h>
|
||||||
|
#include <kernel/item.h>
|
||||||
|
#include <kernel/magic.h>
|
||||||
|
#include <kernel/messages.h>
|
||||||
|
#include <kernel/order.h>
|
||||||
|
#include <kernel/plane.h>
|
||||||
|
#include <kernel/race.h>
|
||||||
|
#include <kernel/region.h>
|
||||||
|
#include <kernel/render.h>
|
||||||
|
#include <kernel/save.h>
|
||||||
|
#include <kernel/ship.h>
|
||||||
|
#include <kernel/teleport.h>
|
||||||
|
#include <kernel/terrain.h>
|
||||||
|
#include <kernel/terrainid.h>
|
||||||
|
#include <kernel/unit.h>
|
||||||
|
|
||||||
|
#include "direction.h"
|
||||||
#include "skill.h"
|
#include "skill.h"
|
||||||
#include "terrain.h"
|
|
||||||
#include "terrainid.h"
|
|
||||||
#include "teleport.h"
|
|
||||||
#include "unit.h"
|
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
|
@ -58,6 +59,8 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <util/rand.h>
|
#include <util/rand.h>
|
||||||
#include <util/rng.h>
|
#include <util/rng.h>
|
||||||
|
|
||||||
|
#include <stealth.h>
|
||||||
|
|
||||||
#include <storage.h>
|
#include <storage.h>
|
||||||
|
|
||||||
/* attributes includes */
|
/* attributes includes */
|
|
@ -1,8 +1,8 @@
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include "move.h"
|
||||||
|
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
|
@ -21,13 +21,13 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "names.h"
|
#include "names.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include "unit.h"
|
#include <kernel/unit.h>
|
||||||
#include "region.h"
|
#include <kernel/region.h>
|
||||||
#include "faction.h"
|
#include <kernel/faction.h>
|
||||||
#include "magic.h"
|
#include <kernel/magic.h>
|
||||||
#include "race.h"
|
#include <kernel/race.h>
|
||||||
#include "terrain.h"
|
#include <kernel/terrain.h>
|
||||||
#include "terrainid.h"
|
#include <kernel/terrainid.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/base36.h>
|
#include <util/base36.h>
|
|
@ -22,10 +22,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
#include "economy.h"
|
#include "economy.h"
|
||||||
#include "monster.h"
|
#include "monster.h"
|
||||||
|
#include "move.h"
|
||||||
|
#include "alchemy.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/alchemy.h>
|
|
||||||
#include <kernel/battle.h>
|
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
#include <kernel/equipment.h>
|
#include <kernel/equipment.h>
|
||||||
|
@ -33,8 +33,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/names.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
|
|
|
@ -21,6 +21,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
|
|
||||||
|
#include "reports.h"
|
||||||
/* modules includes */
|
/* modules includes */
|
||||||
#include <modules/score.h>
|
#include <modules/score.h>
|
||||||
|
|
||||||
|
@ -35,9 +36,10 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include "economy.h"
|
#include "economy.h"
|
||||||
#include "monster.h"
|
#include "monster.h"
|
||||||
#include "laws.h"
|
#include "laws.h"
|
||||||
|
#include "move.h"
|
||||||
|
#include "alchemy.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/alchemy.h>
|
|
||||||
#include <kernel/ally.h>
|
#include <kernel/ally.h>
|
||||||
#include <kernel/connection.h>
|
#include <kernel/connection.h>
|
||||||
#include <kernel/build.h>
|
#include <kernel/build.h>
|
||||||
|
@ -48,7 +50,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/group.h>
|
#include <kernel/group.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/objtypes.h>
|
#include <kernel/objtypes.h>
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
|
@ -56,7 +57,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/render.h>
|
#include <kernel/render.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/resources.h>
|
#include <kernel/resources.h>
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
|
|
|
@ -29,7 +29,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/group.h>
|
#include <kernel/group.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
|
@ -66,6 +65,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <attributes/otherfaction.h>
|
#include <attributes/otherfaction.h>
|
||||||
#include <attributes/racename.h>
|
#include <attributes/racename.h>
|
||||||
|
|
||||||
|
#include "move.h"
|
||||||
|
#include "stealth.h"
|
||||||
|
|
||||||
bool nocr = false;
|
bool nocr = false;
|
||||||
bool nonr = false;
|
bool nonr = false;
|
||||||
bool noreports = false;
|
bool noreports = false;
|
||||||
|
@ -200,37 +202,6 @@ const char **name, const char **basename, int *number, bool singular)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int *nmrs = NULL;
|
|
||||||
|
|
||||||
int update_nmrs(void)
|
|
||||||
{
|
|
||||||
int i, newplayers = 0;
|
|
||||||
faction *f;
|
|
||||||
int turn = global.data_turn;
|
|
||||||
|
|
||||||
if (nmrs == NULL)
|
|
||||||
nmrs = malloc(sizeof(int) * (NMRTimeout() + 1));
|
|
||||||
for (i = 0; i <= NMRTimeout(); ++i) {
|
|
||||||
nmrs[i] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (f = factions; f; f = f->next) {
|
|
||||||
if (fval(f, FFL_ISNEW)) {
|
|
||||||
++newplayers;
|
|
||||||
}
|
|
||||||
else if (!is_monsters(f) && f->alive) {
|
|
||||||
int nmr = turn - f->lastorders + 1;
|
|
||||||
if (nmr < 0 || nmr > NMRTimeout()) {
|
|
||||||
log_error("faction %s has %d NMRS\n", factionid(f), nmr);
|
|
||||||
nmr = _max(0, nmr);
|
|
||||||
nmr = _min(nmr, NMRTimeout());
|
|
||||||
}
|
|
||||||
++nmrs[nmr];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return newplayers;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define ORDERS_IN_NR 1
|
#define ORDERS_IN_NR 1
|
||||||
static size_t buforder(char *bufp, size_t size, const order * ord, int mode)
|
static size_t buforder(char *bufp, size_t size, const order * ord, int mode)
|
||||||
{
|
{
|
||||||
|
@ -2379,54 +2350,6 @@ static void log_orders(const struct message *msg)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int report_action(region * r, unit * actor, message * msg, int flags)
|
|
||||||
{
|
|
||||||
int result = 0;
|
|
||||||
unit *u;
|
|
||||||
int view = flags & (ACTION_CANSEE | ACTION_CANNOTSEE);
|
|
||||||
|
|
||||||
/* melden, 1x pro Partei */
|
|
||||||
if (flags & ACTION_RESET) {
|
|
||||||
freset(actor->faction, FFL_SELECT);
|
|
||||||
for (u = r->units; u; u = u->next)
|
|
||||||
freset(u->faction, FFL_SELECT);
|
|
||||||
}
|
|
||||||
if (view) {
|
|
||||||
for (u = r->units; u; u = u->next) {
|
|
||||||
if (!fval(u->faction, FFL_SELECT)) {
|
|
||||||
bool show = u->faction == actor->faction;
|
|
||||||
fset(u->faction, FFL_SELECT);
|
|
||||||
if (view == ACTION_CANSEE) {
|
|
||||||
/* Bei Fernzaubern sieht nur die eigene Partei den Magier */
|
|
||||||
show = show || (r == actor->region
|
|
||||||
&& cansee(u->faction, r, actor, 0));
|
|
||||||
}
|
|
||||||
else if (view == ACTION_CANNOTSEE) {
|
|
||||||
show = !show && !(r == actor->region
|
|
||||||
&& cansee(u->faction, r, actor, 0));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
/* the unliely (or lazy) case */
|
|
||||||
show = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (show) {
|
|
||||||
r_addmessage(r, u->faction, msg);
|
|
||||||
}
|
|
||||||
else { /* Partei des Magiers, sieht diesen immer */
|
|
||||||
result = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
/* Ist niemand von der Partei des Magiers in der Region, dem Magier
|
|
||||||
* nochmal gesondert melden */
|
|
||||||
if ((flags & ACTION_CANSEE) && !fval(actor->faction, FFL_SELECT)) {
|
|
||||||
add_message(&actor->faction->msgs, msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
void register_reports(void)
|
void register_reports(void)
|
||||||
{
|
{
|
||||||
/* register datatypes for the different message objects */
|
/* register datatypes for the different message objects */
|
|
@ -20,7 +20,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#define H_KRNL_REPORTS
|
#define H_KRNL_REPORTS
|
||||||
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "objtypes.h"
|
#include <kernel/objtypes.h>
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
@ -112,9 +112,6 @@ extern "C" {
|
||||||
|
|
||||||
void register_reports(void);
|
void register_reports(void);
|
||||||
|
|
||||||
int update_nmrs(void);
|
|
||||||
int *nmrs;
|
|
||||||
|
|
||||||
struct message *msg_curse(const struct curse *c, const void *obj,
|
struct message *msg_curse(const struct curse *c, const void *obj,
|
||||||
objtype_t typ, int slef);
|
objtype_t typ, int slef);
|
||||||
|
|
||||||
|
@ -141,12 +138,6 @@ extern "C" {
|
||||||
const char **rcillusion);
|
const char **rcillusion);
|
||||||
|
|
||||||
void add_seen_faction(struct faction *self, struct faction *seen);
|
void add_seen_faction(struct faction *self, struct faction *seen);
|
||||||
#define ACTION_RESET 0x01 /* reset the one-time-flag FFL_SELECT (on first pass) */
|
|
||||||
#define ACTION_CANSEE 0x02 /* to people who can see the actor */
|
|
||||||
#define ACTION_CANNOTSEE 0x04 /* to people who can not see the actor */
|
|
||||||
int report_action(struct region *r, struct unit *actor,
|
|
||||||
struct message *msg, int flags);
|
|
||||||
|
|
||||||
size_t f_regionid(const struct region *r, const struct faction *f,
|
size_t f_regionid(const struct region *r, const struct faction *f,
|
||||||
char *buffer, size_t size);
|
char *buffer, size_t size);
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
#include <platform.h>
|
#include <config.h>
|
||||||
|
#include <kernel/types.h>
|
||||||
|
#include "reports.h"
|
||||||
|
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/ship.h>
|
#include <kernel/ship.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
|
@ -15,7 +15,6 @@
|
||||||
#include "combatspells.h"
|
#include "combatspells.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/battle.h>
|
|
||||||
#include <kernel/build.h>
|
#include <kernel/build.h>
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
|
@ -27,12 +26,14 @@
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/unit.h>
|
#include <kernel/unit.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/spell.h>
|
#include <kernel/spell.h>
|
||||||
#include <kernel/spellid.h>
|
#include <kernel/spellid.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
|
|
||||||
|
#include <battle.h>
|
||||||
|
#include <move.h>
|
||||||
|
|
||||||
/* util includes */
|
/* util includes */
|
||||||
#include <util/attrib.h>
|
#include <util/attrib.h>
|
||||||
#include <util/base36.h>
|
#include <util/base36.h>
|
||||||
|
|
|
@ -28,13 +28,11 @@
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
#include <kernel/battle.h> /* fuer lovar */
|
|
||||||
#include <kernel/connection.h>
|
#include <kernel/connection.h>
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
#include <kernel/spellid.h>
|
#include <kernel/spellid.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
|
@ -333,6 +331,54 @@ static int break_curse(attrib ** alist, int cast_level, float force, curse * c)
|
||||||
return succ;
|
return succ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int report_action(region * r, unit * actor, message * msg, int flags)
|
||||||
|
{
|
||||||
|
int result = 0;
|
||||||
|
unit *u;
|
||||||
|
int view = flags & (ACTION_CANSEE | ACTION_CANNOTSEE);
|
||||||
|
|
||||||
|
/* melden, 1x pro Partei */
|
||||||
|
if (flags & ACTION_RESET) {
|
||||||
|
freset(actor->faction, FFL_SELECT);
|
||||||
|
for (u = r->units; u; u = u->next)
|
||||||
|
freset(u->faction, FFL_SELECT);
|
||||||
|
}
|
||||||
|
if (view) {
|
||||||
|
for (u = r->units; u; u = u->next) {
|
||||||
|
if (!fval(u->faction, FFL_SELECT)) {
|
||||||
|
bool show = u->faction == actor->faction;
|
||||||
|
fset(u->faction, FFL_SELECT);
|
||||||
|
if (view == ACTION_CANSEE) {
|
||||||
|
/* Bei Fernzaubern sieht nur die eigene Partei den Magier */
|
||||||
|
show = show || (r == actor->region
|
||||||
|
&& cansee(u->faction, r, actor, 0));
|
||||||
|
}
|
||||||
|
else if (view == ACTION_CANNOTSEE) {
|
||||||
|
show = !show && !(r == actor->region
|
||||||
|
&& cansee(u->faction, r, actor, 0));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
/* the unliely (or lazy) case */
|
||||||
|
show = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (show) {
|
||||||
|
r_addmessage(r, u->faction, msg);
|
||||||
|
}
|
||||||
|
else { /* Partei des Magiers, sieht diesen immer */
|
||||||
|
result = 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* Ist niemand von der Partei des Magiers in der Region, dem Magier
|
||||||
|
* nochmal gesondert melden */
|
||||||
|
if ((flags & ACTION_CANSEE) && !fval(actor->faction, FFL_SELECT)) {
|
||||||
|
add_message(&actor->faction->msgs, msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------- */
|
/* ------------------------------------------------------------- */
|
||||||
/* Report a spell's effect to the units in the region.
|
/* Report a spell's effect to the units in the region.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -21,11 +21,16 @@ extern "C" {
|
||||||
struct ship;
|
struct ship;
|
||||||
struct curse;
|
struct curse;
|
||||||
struct unit;
|
struct unit;
|
||||||
|
struct message;
|
||||||
|
|
||||||
extern void register_spells(void);
|
void register_spells(void);
|
||||||
|
|
||||||
void set_spelldata(struct spell *sp);
|
void set_spelldata(struct spell *sp);
|
||||||
|
|
||||||
|
#define ACTION_RESET 0x01 /* reset the one-time-flag FFL_SELECT (on first pass) */
|
||||||
|
#define ACTION_CANSEE 0x02 /* to people who can see the actor */
|
||||||
|
#define ACTION_CANNOTSEE 0x04 /* to people who can not see the actor */
|
||||||
|
int report_action(struct region *r, struct unit *actor, struct message *msg, int flags);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -20,14 +20,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include "spy.h"
|
#include "spy.h"
|
||||||
#include "laws.h"
|
#include "laws.h"
|
||||||
|
#include "stealth.h"
|
||||||
|
#include "move.h"
|
||||||
|
#include "reports.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
|
|
64
src/stealth.c
Normal file
64
src/stealth.c
Normal file
|
@ -0,0 +1,64 @@
|
||||||
|
#include <config.h>
|
||||||
|
#include <platform.h>
|
||||||
|
#include "stealth.h"
|
||||||
|
#include <kernel/unit.h>
|
||||||
|
#include <kernel/region.h>
|
||||||
|
#include <kernel/save.h>
|
||||||
|
#include <util/attrib.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
attrib_type at_stealth = {
|
||||||
|
"stealth", NULL, NULL, NULL, a_writeint, a_readint
|
||||||
|
};
|
||||||
|
|
||||||
|
void u_seteffstealth(unit * u, int value)
|
||||||
|
{
|
||||||
|
if (skill_enabled(SK_STEALTH)) {
|
||||||
|
attrib *a = NULL;
|
||||||
|
if (u->flags & UFL_STEALTH) {
|
||||||
|
a = a_find(u->attribs, &at_stealth);
|
||||||
|
}
|
||||||
|
if (value < 0) {
|
||||||
|
if (a != NULL) {
|
||||||
|
u->flags &= ~UFL_STEALTH;
|
||||||
|
a_remove(&u->attribs, a);
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (a == NULL) {
|
||||||
|
a = a_add(&u->attribs, a_new(&at_stealth));
|
||||||
|
u->flags |= UFL_STEALTH;
|
||||||
|
}
|
||||||
|
a->data.i = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int u_geteffstealth(const unit *u)
|
||||||
|
{
|
||||||
|
if (skill_enabled(SK_STEALTH)) {
|
||||||
|
if (u->flags & UFL_STEALTH) {
|
||||||
|
attrib *a = a_find(u->attribs, &at_stealth);
|
||||||
|
if (a != NULL)
|
||||||
|
return a->data.i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int eff_stealth(const unit * u, const region * r)
|
||||||
|
{
|
||||||
|
int e = 0;
|
||||||
|
|
||||||
|
/* Auf Schiffen keine Tarnung! */
|
||||||
|
if (!u->ship && skill_enabled(SK_STEALTH)) {
|
||||||
|
e = eff_skill(u, SK_STEALTH, r);
|
||||||
|
|
||||||
|
if (u->flags & UFL_STEALTH) {
|
||||||
|
int es = u_geteffstealth(u);
|
||||||
|
if (es >= 0 && es < e)
|
||||||
|
return es;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return e;
|
||||||
|
}
|
19
src/stealth.h
Normal file
19
src/stealth.h
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
#ifndef STEALTH_H
|
||||||
|
#define STEALTH_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
struct unit;
|
||||||
|
struct region;
|
||||||
|
extern struct attrib_type at_stealth;
|
||||||
|
int eff_stealth(const struct unit *u, const struct region *r);
|
||||||
|
void u_seteffstealth(struct unit *u, int value);
|
||||||
|
int u_geteffstealth(const struct unit *u);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
40
src/stealth.test.c
Normal file
40
src/stealth.test.c
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#include <platform.h>
|
||||||
|
|
||||||
|
#include "stealth.h"
|
||||||
|
|
||||||
|
#include <kernel/unit.h>
|
||||||
|
#include <kernel/region.h>
|
||||||
|
|
||||||
|
#include <CuTest.h>
|
||||||
|
#include <tests.h>
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
|
void test_stealth(CuTest *tc) {
|
||||||
|
unit *u;
|
||||||
|
|
||||||
|
test_cleanup();
|
||||||
|
test_create_world();
|
||||||
|
u = test_create_unit(test_create_faction(test_create_race("human")), findregion(0, 0));
|
||||||
|
set_level(u, SK_STEALTH, 2);
|
||||||
|
CuAssertIntEquals(tc, -1, u_geteffstealth(u));
|
||||||
|
CuAssertIntEquals(tc, 2, eff_stealth(u, u->region));
|
||||||
|
u_seteffstealth(u, 3);
|
||||||
|
CuAssertIntEquals(tc, 3, u_geteffstealth(u));
|
||||||
|
CuAssertIntEquals(tc, 2, eff_stealth(u, u->region));
|
||||||
|
u_seteffstealth(u, 1);
|
||||||
|
CuAssertIntEquals(tc, 1, u_geteffstealth(u));
|
||||||
|
CuAssertIntEquals(tc, 1, eff_stealth(u, u->region));
|
||||||
|
u_seteffstealth(u, -1);
|
||||||
|
CuAssertIntEquals(tc, -1, u_geteffstealth(u));
|
||||||
|
CuAssertIntEquals(tc, 2, eff_stealth(u, u->region));
|
||||||
|
test_cleanup();
|
||||||
|
}
|
||||||
|
|
||||||
|
CuSuite *get_stealth_suite(void)
|
||||||
|
{
|
||||||
|
CuSuite *suite = CuSuiteNew();
|
||||||
|
SUITE_ADD_TEST(suite, test_stealth);
|
||||||
|
return suite;
|
||||||
|
}
|
|
@ -22,15 +22,15 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <platform.h>
|
#include <platform.h>
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
#include "study.h"
|
#include "study.h"
|
||||||
|
#include "move.h"
|
||||||
|
#include "alchemy.h"
|
||||||
|
|
||||||
#include <kernel/alchemy.h>
|
|
||||||
#include <kernel/building.h>
|
#include <kernel/building.h>
|
||||||
#include <kernel/curse.h>
|
#include <kernel/curse.h>
|
||||||
#include <kernel/faction.h>
|
#include <kernel/faction.h>
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/pool.h>
|
#include <kernel/pool.h>
|
||||||
|
|
|
@ -13,7 +13,6 @@
|
||||||
#include <kernel/config.h>
|
#include <kernel/config.h>
|
||||||
|
|
||||||
#include "summary.h"
|
#include "summary.h"
|
||||||
|
|
||||||
#include "laws.h"
|
#include "laws.h"
|
||||||
|
|
||||||
#include <kernel/alliance.h>
|
#include <kernel/alliance.h>
|
||||||
|
@ -22,7 +21,6 @@
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
#include <kernel/region.h>
|
#include <kernel/region.h>
|
||||||
#include <kernel/reports.h>
|
|
||||||
#include <kernel/save.h>
|
#include <kernel/save.h>
|
||||||
#include <kernel/terrain.h>
|
#include <kernel/terrain.h>
|
||||||
#include <kernel/terrainid.h>
|
#include <kernel/terrainid.h>
|
||||||
|
@ -71,6 +69,38 @@ typedef struct summary {
|
||||||
} *languages;
|
} *languages;
|
||||||
} summary;
|
} summary;
|
||||||
|
|
||||||
|
|
||||||
|
int *nmrs = NULL;
|
||||||
|
|
||||||
|
int update_nmrs(void)
|
||||||
|
{
|
||||||
|
int i, newplayers = 0;
|
||||||
|
faction *f;
|
||||||
|
int turn = global.data_turn;
|
||||||
|
|
||||||
|
if (nmrs == NULL)
|
||||||
|
nmrs = malloc(sizeof(int) * (NMRTimeout() + 1));
|
||||||
|
for (i = 0; i <= NMRTimeout(); ++i) {
|
||||||
|
nmrs[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (f = factions; f; f = f->next) {
|
||||||
|
if (fval(f, FFL_ISNEW)) {
|
||||||
|
++newplayers;
|
||||||
|
}
|
||||||
|
else if (!is_monsters(f) && f->alive) {
|
||||||
|
int nmr = turn - f->lastorders + 1;
|
||||||
|
if (nmr < 0 || nmr > NMRTimeout()) {
|
||||||
|
log_error("faction %s has %d NMRS\n", factionid(f), nmr);
|
||||||
|
nmr = _max(0, nmr);
|
||||||
|
nmr = _min(nmr, NMRTimeout());
|
||||||
|
}
|
||||||
|
++nmrs[nmr];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newplayers;
|
||||||
|
}
|
||||||
|
|
||||||
static char *pcomp(double i, double j)
|
static char *pcomp(double i, double j)
|
||||||
{
|
{
|
||||||
static char buf[32];
|
static char buf[32];
|
||||||
|
|
|
@ -16,9 +16,13 @@ extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct summary;
|
struct summary;
|
||||||
extern void report_summary(struct summary *n, struct summary *o,
|
|
||||||
bool full);
|
void report_summary(struct summary *n, struct summary *o, bool full);
|
||||||
extern struct summary *make_summary(void);
|
struct summary *make_summary(void);
|
||||||
|
|
||||||
|
int update_nmrs(void);
|
||||||
|
extern int* nmrs;
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,6 +54,7 @@ int RunAllTests(void)
|
||||||
ADD_TESTS(suite, battle);
|
ADD_TESTS(suite, battle);
|
||||||
ADD_TESTS(suite, ally);
|
ADD_TESTS(suite, ally);
|
||||||
/* gamecode */
|
/* gamecode */
|
||||||
|
ADD_TESTS(suite, stealth);
|
||||||
ADD_TESTS(suite, market);
|
ADD_TESTS(suite, market);
|
||||||
ADD_TESTS(suite, laws);
|
ADD_TESTS(suite, laws);
|
||||||
ADD_TESTS(suite, economy);
|
ADD_TESTS(suite, economy);
|
||||||
|
|
|
@ -27,6 +27,7 @@ without prior permission by the authors of Eressea.
|
||||||
/* gamecode includes */
|
/* gamecode includes */
|
||||||
#include "laws.h"
|
#include "laws.h"
|
||||||
#include "economy.h"
|
#include "economy.h"
|
||||||
|
#include "move.h"
|
||||||
|
|
||||||
/* kernel includes */
|
/* kernel includes */
|
||||||
#include <kernel/alchemy.h>
|
#include <kernel/alchemy.h>
|
||||||
|
@ -40,7 +41,6 @@ without prior permission by the authors of Eressea.
|
||||||
#include <kernel/item.h>
|
#include <kernel/item.h>
|
||||||
#include <kernel/magic.h>
|
#include <kernel/magic.h>
|
||||||
#include <kernel/messages.h>
|
#include <kernel/messages.h>
|
||||||
#include <kernel/move.h>
|
|
||||||
#include <kernel/order.h>
|
#include <kernel/order.h>
|
||||||
#include <kernel/plane.h>
|
#include <kernel/plane.h>
|
||||||
#include <kernel/race.h>
|
#include <kernel/race.h>
|
||||||
|
|
Loading…
Reference in a new issue