Merge remote-tracking branch 'eressea/develop'

This commit is contained in:
CTD 2015-10-01 09:10:01 +02:00
commit e13d90f357
47 changed files with 476 additions and 335 deletions

View File

@ -5,12 +5,12 @@
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="config:///core/"
uriStartString="config://core/"
rewritePrefix="../../res/core/" />
<rewriteURI
uriStartString="config:///game/"
uriStartString="config://game/"
rewritePrefix="../../res/eressea/" />
<rewriteURI
uriStartString="config:///default/"
uriStartString="config://default/"
rewritePrefix="../../res/" />
</catalog>

View File

@ -1,36 +1,36 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config:///core/messages.xml"/>
<xi:include href="config://core/messages.xml"/>
<!-- Localization -->
<xi:include href="config:///core/de/strings.xml"/>
<xi:include href="config:///core/en/strings.xml"/>
<xi:include href="config:///game/spellinfo.xml" />
<xi:include href="config://core/de/strings.xml"/>
<xi:include href="config://core/en/strings.xml"/>
<xi:include href="config://game/spellinfo.xml" />
<xi:include href="config:///core/common/items.xml" />
<xi:include href="config:///core/common/armor.xml" />
<xi:include href="config:///core/common/weapons.xml" />
<xi:include href="config:///core/common/resources.xml" />
<xi:include href="config:///core/common/luxuries.xml" />
<xi:include href="config:///core/common/herbs.xml" />
<xi:include href="config:///core/common/potions.xml" />
<xi:include href="config:///core/spoils.xml"/>
<xi:include href="config:///game/races.xml"/>
<xi:include href="config:///core/prefixes.xml"/>
<xi:include href="config:///core/ships.xml"/>
<xi:include href="config:///core/common/buildings.xml"/>
<xi:include href="config:///game/familiars.xml"/>
<xi:include href="config:///core/terrains.xml"/>
<xi:include href="config:///game/terrains.xml"/>
<xi:include href="config:///game/artrewards.xml"/>
<xi:include href="config:///game/buildings.xml"/>
<xi:include href="config:///core/calendar.xml"/>
<xi:include href="config://core/common/items.xml" />
<xi:include href="config://core/common/armor.xml" />
<xi:include href="config://core/common/weapons.xml" />
<xi:include href="config://core/common/resources.xml" />
<xi:include href="config://core/common/luxuries.xml" />
<xi:include href="config://core/common/herbs.xml" />
<xi:include href="config://core/common/potions.xml" />
<xi:include href="config://core/spoils.xml"/>
<xi:include href="config://game/races.xml"/>
<xi:include href="config://core/prefixes.xml"/>
<xi:include href="config://core/ships.xml"/>
<xi:include href="config://core/common/buildings.xml"/>
<xi:include href="config://game/familiars.xml"/>
<xi:include href="config://core/terrains.xml"/>
<xi:include href="config://game/terrains.xml"/>
<xi:include href="config://game/artrewards.xml"/>
<xi:include href="config://game/buildings.xml"/>
<xi:include href="config://core/calendar.xml"/>
<calendar name="secondage" newyear="month_1" start="184"/>
<xi:include href="config:///game/equipment.xml"/>
<xi:include href="config:///game/items.xml"/>
<xi:include href="config:///game/spells.xml"/>
<xi:include href="config:///game/strings.xml"/>
<xi:include href="config:///default/adamantium.xml"/>
<xi:include href="config://game/equipment.xml"/>
<xi:include href="config://game/items.xml"/>
<xi:include href="config://game/spells.xml"/>
<xi:include href="config://game/strings.xml"/>
<xi:include href="config://default/adamantium.xml"/>
<equipment>
<set name="first_unit">
<item name="conquesttoken" amount="1"/>
@ -43,11 +43,11 @@
</set>
</equipment>
<xi:include href="config:///default/names-undead.xml"/>
<xi:include href="config:///default/names-skeletons.xml"/>
<xi:include href="config:///default/names-zombies.xml"/>
<xi:include href="config:///default/names-ghouls.xml"/>
<xi:include href="config:///default/names-dragons.xml"/>
<xi:include href="config://default/names-undead.xml"/>
<xi:include href="config://default/names-skeletons.xml"/>
<xi:include href="config://default/names-zombies.xml"/>
<xi:include href="config://default/names-ghouls.xml"/>
<xi:include href="config://default/names-dragons.xml"/>
<game name="Eressea">
<!-- Game specific settings -->
@ -93,6 +93,9 @@
<param name="GiveRestriction" value="3"/>
<param name="hunger.long" value="1"/>
<param name="init_spells" value="0"/>
<param name="world.era" value="2"/>
<param name="seed.population.min" value="8"/>
<param name="seed.population.max" value="8"/>
<param name="rules.reserve.twophase" value="1"/>
<param name="rules.owners.force_leave" value="1"/>
<param name="rules.give.max_men" value="-1"/>

View File

@ -5,12 +5,12 @@
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="config:///core/"
uriStartString="config://core/"
rewritePrefix="../../res/core/" />
<rewriteURI
uriStartString="config:///game/"
uriStartString="config://game/"
rewritePrefix="../../res/e3a/" />
<rewriteURI
uriStartString="config:///default/"
uriStartString="config://default/"
rewritePrefix="../../res/" />
</catalog>

View File

@ -1,32 +1,32 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config:///core/messages.xml"/>
<xi:include href="config:///core/de/strings.xml"/>
<xi:include href="config:///core/en/strings.xml"/>
<xi:include href="config:///core/common/items.xml"/>
<xi:include href="config:///core/common/herbs.xml" />
<xi:include href="config:///core/spoils.xml"/>
<xi:include href="config:///core/prefixes.xml"/>
<xi:include href="config:///core/common/buildings.xml"/>
<xi:include href="config:///game/familiars.xml"/>
<xi:include href="config://core/messages.xml"/>
<xi:include href="config://core/de/strings.xml"/>
<xi:include href="config://core/en/strings.xml"/>
<xi:include href="config://core/common/items.xml"/>
<xi:include href="config://core/common/herbs.xml" />
<xi:include href="config://core/spoils.xml"/>
<xi:include href="config://core/prefixes.xml"/>
<xi:include href="config://core/common/buildings.xml"/>
<xi:include href="config://game/familiars.xml"/>
<xi:include href="config:///default/adamantium.xml" />
<xi:include href="config://default/adamantium.xml" />
<xi:include href="config:///game/ships.xml"/>
<xi:include href="config:///game/shipnames.xml"/>
<xi:include href="config:///game/terrains.xml"/>
<xi:include href="config:///core/calendar.xml"/>
<xi:include href="config:///game/items.xml" />
<xi:include href="config:///game/strings.xml"/>
<xi:include href="config:///game/messages.xml"/>
<xi:include href="config:///game/races.xml"/>
<xi:include href="config:///game/buildings.xml"/>
<xi:include href="config:///game/equipment.xml"/>
<xi:include href="config:///game/spells.xml"/>
<xi:include href="config:///game/luxuries.xml" />
<xi:include href="config:///game/weapons.xml" />
<xi:include href="config:///game/armor.xml" />
<xi:include href="config:///game/resources.xml" />
<xi:include href="config://game/ships.xml"/>
<xi:include href="config://game/shipnames.xml"/>
<xi:include href="config://game/terrains.xml"/>
<xi:include href="config://core/calendar.xml"/>
<xi:include href="config://game/items.xml" />
<xi:include href="config://game/strings.xml"/>
<xi:include href="config://game/messages.xml"/>
<xi:include href="config://game/races.xml"/>
<xi:include href="config://game/buildings.xml"/>
<xi:include href="config://game/equipment.xml"/>
<xi:include href="config://game/spells.xml"/>
<xi:include href="config://game/luxuries.xml" />
<xi:include href="config://game/weapons.xml" />
<xi:include href="config://game/armor.xml" />
<xi:include href="config://game/resources.xml" />
<calendar name="thirdage" newyear="month_1" start="1"/>
@ -39,11 +39,11 @@
</set>
</equipment>
<xi:include href="config:///default/names-undead.xml"/>
<xi:include href="config:///default/names-skeletons.xml"/>
<xi:include href="config:///default/names-zombies.xml"/>
<xi:include href="config:///default/names-ghouls.xml"/>
<xi:include href="config:///default/names-dragons.xml"/>
<xi:include href="config://default/names-undead.xml"/>
<xi:include href="config://default/names-skeletons.xml"/>
<xi:include href="config://default/names-zombies.xml"/>
<xi:include href="config://default/names-ghouls.xml"/>
<xi:include href="config://default/names-dragons.xml"/>
<game name="E3">
<!-- Game specific settings -->
@ -116,6 +116,8 @@
<param name="study.expensivemigrants" value="1"/>
<param name="study.speedup" value="2"/>
<param name="world.era" value="3"/>
<param name="seed.population.min" value="8"/>
<param name="seed.population.max" value="8"/>
<param name="rules.migrants" value="0"/>
<param name="rules.reserve.twophase" value="1"/>
<param name="rules.owners.force_leave" value="1"/>

View File

@ -5,12 +5,12 @@
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="config:///core/"
uriStartString="config://core/"
rewritePrefix="../../res/core/" />
<rewriteURI
uriStartString="config:///game/"
uriStartString="config://game/"
rewritePrefix="../../res/e3a/" />
<rewriteURI
uriStartString="config:///default/"
uriStartString="config://default/"
rewritePrefix="../../res/" />
</catalog>

View File

@ -1,32 +1,32 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config:///core/messages.xml"/>
<xi:include href="config:///core/de/strings.xml"/>
<xi:include href="config:///core/en/strings.xml"/>
<xi:include href="config:///core/common/items.xml"/>
<xi:include href="config:///core/common/herbs.xml" />
<xi:include href="config:///core/spoils.xml"/>
<xi:include href="config:///core/prefixes.xml"/>
<xi:include href="config:///core/common/buildings.xml"/>
<xi:include href="config:///game/familiars.xml"/>
<xi:include href="config://core/messages.xml"/>
<xi:include href="config://core/de/strings.xml"/>
<xi:include href="config://core/en/strings.xml"/>
<xi:include href="config://core/common/items.xml"/>
<xi:include href="config://core/common/herbs.xml" />
<xi:include href="config://core/spoils.xml"/>
<xi:include href="config://core/prefixes.xml"/>
<xi:include href="config://core/common/buildings.xml"/>
<xi:include href="config://game/familiars.xml"/>
<xi:include href="config:///default/adamantium.xml" />
<xi:include href="config://default/adamantium.xml" />
<xi:include href="config:///game/ships.xml"/>
<xi:include href="config:///game/shipnames.xml"/>
<xi:include href="config:///game/terrains.xml"/>
<xi:include href="config:///core/calendar.xml"/>
<xi:include href="config:///game/items.xml" />
<xi:include href="config:///game/strings.xml"/>
<xi:include href="config:///game/messages.xml"/>
<xi:include href="config:///game/races.xml"/>
<xi:include href="config:///game/buildings.xml"/>
<xi:include href="config:///game/equipment.xml"/>
<xi:include href="config:///game/spells.xml"/>
<xi:include href="config:///game/luxuries.xml" />
<xi:include href="config:///game/weapons.xml" />
<xi:include href="config:///game/armor.xml" />
<xi:include href="config:///game/resources.xml" />
<xi:include href="config://game/ships.xml"/>
<xi:include href="config://game/shipnames.xml"/>
<xi:include href="config://game/terrains.xml"/>
<xi:include href="config://core/calendar.xml"/>
<xi:include href="config://game/items.xml" />
<xi:include href="config://game/strings.xml"/>
<xi:include href="config://game/messages.xml"/>
<xi:include href="config://game/races.xml"/>
<xi:include href="config://game/buildings.xml"/>
<xi:include href="config://game/equipment.xml"/>
<xi:include href="config://game/spells.xml"/>
<xi:include href="config://game/luxuries.xml" />
<xi:include href="config://game/weapons.xml" />
<xi:include href="config://game/armor.xml" />
<xi:include href="config://game/resources.xml" />
<calendar name="thirdage" newyear="month_1" start="1"/>
@ -39,11 +39,11 @@
</set>
</equipment>
<xi:include href="config:///default/names-undead.xml"/>
<xi:include href="config:///default/names-skeletons.xml"/>
<xi:include href="config:///default/names-zombies.xml"/>
<xi:include href="config:///default/names-ghouls.xml"/>
<xi:include href="config:///default/names-dragons.xml"/>
<xi:include href="config://default/names-undead.xml"/>
<xi:include href="config://default/names-skeletons.xml"/>
<xi:include href="config://default/names-zombies.xml"/>
<xi:include href="config://default/names-ghouls.xml"/>
<xi:include href="config://default/names-dragons.xml"/>
<game name="Deveron">
<!-- Game specific settings -->

View File

@ -2,12 +2,12 @@
<resources xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- this file contains a lot of armor -->
<xi:include href="eressea:///core/armor/plate.xml"/>
<xi:include href="eressea:///core/armor/chainmail.xml"/>
<xi:include href="eressea:///core/armor/laenmail.xml"/>
<xi:include href="eressea:///core/armor/laenshield.xml"/>
<xi:include href="eressea:///core/armor/rustychainmail.xml"/>
<xi:include href="eressea:///core/armor/rustyshield.xml"/>
<xi:include href="eressea:///core/armor/shield.xml"/>
<xi:include href="eressea://core/armor/plate.xml"/>
<xi:include href="eressea://core/armor/chainmail.xml"/>
<xi:include href="eressea://core/armor/laenmail.xml"/>
<xi:include href="eressea://core/armor/laenshield.xml"/>
<xi:include href="eressea://core/armor/rustychainmail.xml"/>
<xi:include href="eressea://core/armor/rustyshield.xml"/>
<xi:include href="eressea://core/armor/shield.xml"/>
</resources>

View File

@ -275,11 +275,6 @@
</string>
</namespace>
<string name="Tresen">
<text locale="de">Tresen</text>
<text locale="en">counter</text>
</string>
<string name="wenige">
<text locale="de">wenige</text>
<text locale="en">few</text>

View File

@ -1,7 +1,7 @@
<?xml version="1.0"?>
<buildings xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config:///default/buildings/castle-2.xml" />
<xi:include href="config://default/buildings/castle-2.xml" />
<building name="watch" capacity="1" maxsize="10">
<function name="name" value="fort_name"/>

View File

@ -3,10 +3,10 @@
<!-- begin main races -->
<xi:include href="config:///default/races/goblin-3.xml"/>
<xi:include href="config:///default/races/wyrm.xml"/>
<xi:include href="config:///default/races/dragon.xml"/>
<xi:include href="config:///default/races/youngdragon.xml"/>
<xi:include href="config://default/races/goblin-3.xml"/>
<xi:include href="config://default/races/wyrm.xml"/>
<xi:include href="config://default/races/dragon.xml"/>
<xi:include href="config://default/races/youngdragon.xml"/>
<race name="lynx" magres="0.000000" maxaura="0.000000" regaura="0.000000" weight="500" capacity="540" speed="1.0" hp="20" damage="2d3" unarmedattack="0" unarmeddefense="0" attackmodifier="4" defensemodifier="5" walk="yes" teach="no" getitem="yes">
<ai splitsize="99999"/>

View File

@ -2,13 +2,13 @@
<resources xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- this file contains resources that can be mined in some way (anything with a resourcelimit) -->
<xi:include href="config:///core/resources/cart.xml"/>
<xi:include href="config:///core/resources/horse.xml"/>
<xi:include href="config:///core/resources/hp.xml"/>
<xi:include href="config:///core/resources/laen.xml"/>
<xi:include href="config:///core/resources/log.xml"/>
<xi:include href="config:///core/resources/mallorn.xml"/>
<xi:include href="config:///core/resources/peasant.xml"/>
<xi:include href="config://core/resources/cart.xml"/>
<xi:include href="config://core/resources/horse.xml"/>
<xi:include href="config://core/resources/hp.xml"/>
<xi:include href="config://core/resources/laen.xml"/>
<xi:include href="config://core/resources/log.xml"/>
<xi:include href="config://core/resources/mallorn.xml"/>
<xi:include href="config://core/resources/peasant.xml"/>
<xi:include href="resources/iron.xml"/>
<xi:include href="resources/mallornseed.xml"/>
<xi:include href="resources/seed.xml"/>

View File

@ -1,25 +1,25 @@
<?xml version="1.0"?>
<resources xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="config:///core/weapons/axe.xml"/>
<xi:include href="config:///core/weapons/bow.xml"/>
<xi:include href="config:///core/weapons/catapult.xml"/>
<xi:include href="config:///core/weapons/lance.xml"/>
<xi:include href="config:///core/weapons/mallornbow.xml"/>
<xi:include href="config:///core/weapons/mallornspear.xml"/>
<xi:include href="config:///core/weapons/rep_crossbow.xml"/>
<xi:include href="config:///core/weapons/runesword.xml"/>
<xi:include href="config:///core/weapons/rustyaxe.xml"/>
<xi:include href="config:///core/weapons/rustysword.xml"/>
<xi:include href="config:///core/weapons/spear.xml"/>
<xi:include href="config:///core/weapons/sword.xml"/>
<xi:include href="config:///core/weapons/firesword.xml"/>
<xi:include href="config:///game/weapons/crossbow.xml"/>
<xi:include href="config:///game/weapons/greatbow.xml"/>
<xi:include href="config:///game/weapons/greatsword.xml"/>
<xi:include href="config:///game/weapons/halberd.xml"/>
<xi:include href="config:///game/weapons/laensword.xml"/>
<xi:include href="config:///game/weapons/mallorncrossbow.xml"/>
<xi:include href="config:///game/weapons/mallornlance.xml"/>
<xi:include href="config:///game/weapons/rustygreatsword.xml"/>
<xi:include href="config:///game/weapons/rustyhalberd.xml"/>
<xi:include href="config://core/weapons/axe.xml"/>
<xi:include href="config://core/weapons/bow.xml"/>
<xi:include href="config://core/weapons/catapult.xml"/>
<xi:include href="config://core/weapons/lance.xml"/>
<xi:include href="config://core/weapons/mallornbow.xml"/>
<xi:include href="config://core/weapons/mallornspear.xml"/>
<xi:include href="config://core/weapons/rep_crossbow.xml"/>
<xi:include href="config://core/weapons/runesword.xml"/>
<xi:include href="config://core/weapons/rustyaxe.xml"/>
<xi:include href="config://core/weapons/rustysword.xml"/>
<xi:include href="config://core/weapons/spear.xml"/>
<xi:include href="config://core/weapons/sword.xml"/>
<xi:include href="config://core/weapons/firesword.xml"/>
<xi:include href="config://game/weapons/crossbow.xml"/>
<xi:include href="config://game/weapons/greatbow.xml"/>
<xi:include href="config://game/weapons/greatsword.xml"/>
<xi:include href="config://game/weapons/halberd.xml"/>
<xi:include href="config://game/weapons/laensword.xml"/>
<xi:include href="config://game/weapons/mallorncrossbow.xml"/>
<xi:include href="config://game/weapons/mallornlance.xml"/>
<xi:include href="config://game/weapons/rustygreatsword.xml"/>
<xi:include href="config://game/weapons/rustyhalberd.xml"/>
</resources>

View File

@ -1,25 +1,25 @@
<?xml version="1.0"?>
<resources xmlns:xi="http://www.w3.org/2001/XInclude">
<!-- this file contains a lot of weapons -->
<xi:include href="eressea:///core/weapons/axe.xml"/>
<xi:include href="eressea:///core/weapons/bow.xml"/>
<xi:include href="eressea:///core/weapons/catapult.xml"/>
<xi:include href="eressea:///core/weapons/crossbow.xml"/>
<xi:include href="eressea:///core/weapons/firesword.xml"/>
<xi:include href="eressea:///core/weapons/greatbow.xml"/>
<xi:include href="eressea:///core/weapons/greatsword.xml"/>
<xi:include href="eressea:///core/weapons/halberd.xml"/>
<xi:include href="eressea:///core/weapons/laensword.xml"/>
<xi:include href="eressea:///core/weapons/lance.xml"/>
<xi:include href="eressea:///core/weapons/mallornbow.xml"/>
<xi:include href="eressea:///core/weapons/mallorncrossbow.xml"/>
<xi:include href="eressea:///core/weapons/mallornlance.xml"/>
<xi:include href="eressea:///core/weapons/mallornspear.xml"/>
<xi:include href="eressea:///core/weapons/runesword.xml"/>
<xi:include href="eressea:///core/weapons/rustyaxe.xml"/>
<xi:include href="eressea:///core/weapons/rustygreatsword.xml"/>
<xi:include href="eressea:///core/weapons/rustyhalberd.xml"/>
<xi:include href="eressea:///core/weapons/rustysword.xml"/>
<xi:include href="eressea:///core/weapons/spear.xml"/>
<xi:include href="eressea:///core/weapons/sword.xml"/>
<xi:include href="eressea://core/weapons/axe.xml"/>
<xi:include href="eressea://core/weapons/bow.xml"/>
<xi:include href="eressea://core/weapons/catapult.xml"/>
<xi:include href="eressea://core/weapons/crossbow.xml"/>
<xi:include href="eressea://core/weapons/firesword.xml"/>
<xi:include href="eressea://core/weapons/greatbow.xml"/>
<xi:include href="eressea://core/weapons/greatsword.xml"/>
<xi:include href="eressea://core/weapons/halberd.xml"/>
<xi:include href="eressea://core/weapons/laensword.xml"/>
<xi:include href="eressea://core/weapons/lance.xml"/>
<xi:include href="eressea://core/weapons/mallornbow.xml"/>
<xi:include href="eressea://core/weapons/mallorncrossbow.xml"/>
<xi:include href="eressea://core/weapons/mallornlance.xml"/>
<xi:include href="eressea://core/weapons/mallornspear.xml"/>
<xi:include href="eressea://core/weapons/runesword.xml"/>
<xi:include href="eressea://core/weapons/rustyaxe.xml"/>
<xi:include href="eressea://core/weapons/rustygreatsword.xml"/>
<xi:include href="eressea://core/weapons/rustyhalberd.xml"/>
<xi:include href="eressea://core/weapons/rustysword.xml"/>
<xi:include href="eressea://core/weapons/spear.xml"/>
<xi:include href="eressea://core/weapons/sword.xml"/>
</resources>

View File

@ -12,26 +12,31 @@ include_directories (${LUA_INCLUDE_DIR})
include_directories (${BSON_INCLUDE_DIR})
include_directories (${INIPARSER_INCLUDE_DIR})
IF(CMAKE_COMPILER_IS_GNUCC)
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
if (GCC_VERSION VERSION_GREATER 4.9)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-conversion")
endif()
IF(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_CLANG)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wconversion -Wno-sign-conversion")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wsign-compare -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-error=unused-but-set-variable")
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -DHAVE__BOOL")
elseif(MSVC)
ELSEIF(MSVC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /Wall /WX /MP")
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")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE
"${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:libcmt.lib /NODEFAULTLIB:libcd.lib /NODEFAULTLIB:libcmtd.lib /NODEFAULTLIB:msvcrtd.lib")
ELSE(CMAKE_COMPILER_IS_GNUCC)
MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
ELSE()
MESSAGE(STATUS "unknown compiler ${CMAKE_C_COMPILER_ID}")
ENDIF()
IF(CMAKE_COMPILER_IS_CLANG)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wtautological-compare -Weverything")
MESSAGE(STATUS "compiler is clang: ${CMAKE_C_COMPILER_ID}")
ELSEIF(CMAKE_COMPILER_IS_GCC)
EXECUTE_PROCESS(COMMAND ${CMAKE_C_COMPILER} -dumpversion
OUTPUT_VARIABLE GCC_VERSION)
IF (GCC_VERSION VERSION_GREATER 4.9)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wfloat-conversion")
ENDIF()
ENDIF(CMAKE_COMPILER_IS_CLANG)
add_subdirectory(util)
add_subdirectory(kernel)

View File

@ -431,7 +431,7 @@ static int get_row(const side * s, int row, const side * vs)
return result;
}
int get_unitrow(const fighter * af, const side * vs)
static int get_unitrow(const fighter * af, const side * vs)
{
int row = statusrow(af->status);
if (vs == NULL) {
@ -3661,6 +3661,24 @@ static void free_fighter(fighter * fig)
}
static void battle_free(battle * b) {
side *s;
assert(b);
for (s = b->sides; s != b->sides + b->nsides; ++s) {
fighter *fnext = s->fighters;
while (fnext) {
fighter *fig = fnext;
fnext = fig->next;
free_fighter(fig);
free(fig);
}
free_side(s);
}
free(b);
}
void free_battle(battle * b)
{
int max_fac_no = 0;
@ -3740,7 +3758,7 @@ static int battle_report(battle * b)
char buffer[32];
if (komma) {
bytes = strlcpy(bufp, ", ", size);
strlcpy(bufp, ", ", size);
if (wrptr(&bufp, &size, bytes) != 0)
WARN_STATIC_BUFFER();
}
@ -4295,21 +4313,3 @@ void do_battle(region * r)
}
}
void battle_free(battle * b) {
side *s;
assert(b);
for (s = b->sides; s != b->sides + b->nsides; ++s) {
fighter *fnext = s->fighters;
while (fnext) {
fighter *fig = fnext;
fnext = fig->next;
free_fighter(fig);
free(fig);
}
free_side(s);
}
free(b);
}

View File

@ -225,8 +225,6 @@ extern "C" {
extern const troop no_troop;
/* BEGIN battle interface */
void battle_init(battle * b);
void battle_free(battle * b);
side * find_side(battle * b, const struct faction * f, const struct group * g, unsigned int flags, const struct faction * stealthfaction);
side * get_side(battle * b, const struct unit * u);
fighter * get_fighter(battle * b, const struct unit * u);
@ -251,11 +249,10 @@ extern "C" {
extern int hits(troop at, troop dt, weapon * awp);
extern void damage_building(struct battle *b, struct building *bldg,
int damage_abs);
extern struct quicklist *fighters(struct battle *b, const struct side *vs,
struct quicklist *fighters(struct battle *b, const struct side *vs,
int minrow, int maxrow, int mask);
extern int count_allies(const struct side *as, int minrow, int maxrow,
int count_allies(const struct side *as, int minrow, int maxrow,
int select, int allytype);
extern int get_unitrow(const struct fighter *af, const struct side *vs);
extern bool helping(const struct side *as, const struct side *ds);
extern void rmfighter(fighter * df, int i);
extern struct fighter *select_corpse(struct battle *b, struct fighter *af);

View File

@ -114,7 +114,7 @@ static int tolua_building_set_name(lua_State * L)
static int tolua_building_get_size(lua_State * L)
{
building *self = (building *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, self->size);
lua_pushinteger(L, self->size);
return 1;
}
@ -145,7 +145,7 @@ static int tolua_building_get_units(lua_State * L)
static int tolua_building_get_id(lua_State * L)
{
building *self = (building *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->no);
lua_pushinteger(L, self->no);
return 1;
}

View File

@ -47,7 +47,7 @@ static int tolua_dict_get(lua_State * L)
lua_pushnil(L);
break;
case TINTEGER:
lua_pushnumber(L, (lua_Number)val.i);
lua_pushinteger(L, val.i);
break;
case TREAL:
lua_pushnumber(L, (lua_Number)val.f);

View File

@ -77,35 +77,35 @@ int tolua_faction_add_item(lua_State * L)
result = i ? i->number : 0;
} /* if (itype!=NULL) */
}
lua_pushnumber(L, result);
lua_pushinteger(L, result);
return 1;
}
static int tolua_faction_get_maxheroes(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)maxheroes(self));
lua_pushinteger(L, maxheroes(self));
return 1;
}
static int tolua_faction_get_heroes(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)countheroes(self));
lua_pushinteger(L, countheroes(self));
return 1;
}
static int tolua_faction_get_score(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->score);
lua_pushinteger(L, self->score);
return 1;
}
static int tolua_faction_get_id(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->no);
lua_pushinteger(L, self->no);
return 1;
}
@ -148,7 +148,7 @@ static int tolua_faction_set_magic(lua_State * L)
static int tolua_faction_get_age(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->age);
lua_pushinteger(L, self->age);
return 1;
}
@ -163,7 +163,7 @@ static int tolua_faction_set_age(lua_State * L)
static int tolua_faction_get_flags(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->flags);
lua_pushinteger(L, self->flags);
return 1;
}
@ -178,7 +178,7 @@ static int tolua_faction_set_flags(lua_State * L)
static int tolua_faction_get_options(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->options);
lua_pushinteger(L, self->options);
return 1;
}
@ -193,7 +193,7 @@ static int tolua_faction_set_options(lua_State * L)
static int tolua_faction_get_lastturn(lua_State * L)
{
faction *self = (faction *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->lastorders);
lua_pushinteger(L, self->lastorders);
return 1;
}
@ -245,7 +245,7 @@ static int tolua_faction_get_policy(lua_State * L)
}
}
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -283,8 +283,8 @@ static int tolua_faction_normalize(lua_State * L)
int nx = r->x, ny = r->y;
pnormalize(&nx, &ny, pl);
adjust_coordinates(f, &nx, &ny, pl);
tolua_pushnumber(L, (lua_Number)nx);
tolua_pushnumber(L, (lua_Number)ny);
lua_pushinteger(L, nx);
lua_pushinteger(L, ny);
return 2;
}
return 0;
@ -319,8 +319,8 @@ static int tolua_faction_get_origin(lua_State * L)
y = 0;
}
tolua_pushnumber(L, (lua_Number)x);
tolua_pushnumber(L, (lua_Number)y);
lua_pushinteger(L, x);
lua_pushinteger(L, y);
return 2;
}
@ -443,7 +443,7 @@ static int tolua_faction_set_name(lua_State * L)
static int tolua_faction_get_uid(lua_State * L)
{
faction *f = (faction *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, f->subscription);
lua_pushinteger(L, f->subscription);
return 1;
}

View File

@ -152,8 +152,8 @@ static int tolua_make_island(lua_State * L)
int s = (int)tolua_tonumber(L, 3, 0);
int n = (int)tolua_tonumber(L, 4, s / 3);
n = build_island_e3(x, y, n, s);
tolua_pushnumber(L, n);
n = build_island_e3(NULL, x, y, n, s);
lua_pushinteger(L, n);
return 1;
}
@ -166,8 +166,8 @@ static void lua_paint_info(struct window *wnd, const struct state *st)
int nx = st->cursor.x, ny = st->cursor.y;
pnormalize(&nx, &ny, st->cursor.pl);
lua_rawgeti(L, LUA_REGISTRYINDEX, paint_handle);
tolua_pushnumber(L, nx);
tolua_pushnumber(L, ny);
lua_pushinteger(L, nx);
lua_pushinteger(L, ny);
if (lua_pcall(L, 2, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
log_error("paint function failed: %s\n", error);

View File

@ -214,7 +214,7 @@ static int tolua_msg_set_string(lua_State * L)
const char *param = tolua_tostring(L, 2, 0);
const char *value = tolua_tostring(L, 3, 0);
int result = msg_set_string(lmsg, param, value);
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -224,7 +224,7 @@ static int tolua_msg_set_int(lua_State * L)
const char *param = tolua_tostring(L, 2, 0);
int value = (int)tolua_tonumber(L, 3, 0);
int result = msg_set_int(lmsg, param, value);
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -234,7 +234,7 @@ static int tolua_msg_set_resource(lua_State * L)
const char *param = tolua_tostring(L, 2, 0);
const char *value = tolua_tostring(L, 3, 0);
int result = msg_set_resource(lmsg, param, value);
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -244,7 +244,7 @@ static int tolua_msg_set_unit(lua_State * L)
const char *param = tolua_tostring(L, 2, 0);
unit *value = (unit *)tolua_tousertype(L, 3, 0);
int result = msg_set_unit(lmsg, param, value);
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -254,7 +254,7 @@ static int tolua_msg_set_region(lua_State * L)
const char *param = tolua_tostring(L, 2, 0);
region *value = (region *)tolua_tousertype(L, 3, 0);
int result = msg_set_region(lmsg, param, value);
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -270,7 +270,7 @@ static int tolua_msg_set(lua_State * L)
else if (tolua_isusertype(L, 3, TOLUA_CAST "unit", 0, &err)) {
return tolua_msg_set_unit(L);
}
tolua_pushnumber(L, (lua_Number)-1);
lua_pushinteger(L, -1);
return 1;
}
@ -279,7 +279,7 @@ static int tolua_msg_send_region(lua_State * L)
lua_message *lmsg = (lua_message *)tolua_tousertype(L, 1, 0);
region *r = (region *)tolua_tousertype(L, 2, 0);
int result = msg_send_region(lmsg, r);
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -293,7 +293,7 @@ static int tolua_msg_report_action(lua_State * L)
lmsg->msg = msg_create(lmsg->mtype, lmsg->args);
}
result = report_action(r, u, lmsg->msg, flags);
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -303,7 +303,7 @@ static int tolua_msg_send_faction(lua_State * L)
faction *f = (faction *)tolua_tousertype(L, 2, 0);
if (f && lmsg) {
int result = msg_send_faction(lmsg, f);
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
return 0;

View File

@ -21,7 +21,7 @@ static int tolua_levitate_ship(lua_State * L)
float power = (float)tolua_tonumber(L, 3, 0);
int duration = (int)tolua_tonumber(L, 4, 0);
int cno = levitate_ship(sh, mage, power, duration);
tolua_pushnumber(L, (lua_Number)cno);
lua_pushinteger(L, cno);
return 1;
}

View File

@ -62,7 +62,7 @@ int tolua_regionlist_next(lua_State * L)
static int tolua_region_get_id(lua_State * L)
{
region *self = (region *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->uid);
lua_pushinteger(L, self->uid);
return 1;
}
@ -85,14 +85,14 @@ static int tolua_region_set_blocked(lua_State * L)
static int tolua_region_get_x(lua_State * L)
{
region *self = (region *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->x);
lua_pushinteger(L, self->x);
return 1;
}
static int tolua_region_get_y(lua_State * L)
{
region *self = (region *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->y);
lua_pushinteger(L, self->y);
return 1;
}
@ -199,7 +199,7 @@ static int tolua_region_set_name(lua_State * L)
static int tolua_region_get_morale(lua_State * L)
{
region *r = (region *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, region_get_morale(r));
lua_pushinteger(L, region_get_morale(r));
return 1;
}
@ -323,7 +323,7 @@ static int tolua_region_get_resourcelevel(lua_State * L)
const rawmaterial *rm;
for (rm = r->resources; rm; rm = rm->next) {
if (rm->type->rtype == rtype) {
tolua_pushnumber(L, (lua_Number)rm->level);
lua_pushinteger(L, rm->level);
return 1;
}
}
@ -389,7 +389,7 @@ static int tolua_region_get_resource(lua_State * L)
}
}
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -524,7 +524,7 @@ static int tolua_region_get_age(lua_State * L)
region *self = (region *)tolua_tousertype(L, 1, 0);
if (self) {
lua_pushnumber(L, self->age);
lua_pushinteger(L, self->age);
return 1;
}
return 0;
@ -613,7 +613,7 @@ static int tolua_plane_set_name(lua_State * L)
static int tolua_plane_get_id(lua_State * L)
{
plane *self = (plane *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->id);
lua_pushinteger(L, self->id);
return 1;
}
@ -623,8 +623,8 @@ static int tolua_plane_normalize(lua_State * L)
int x = (int)tolua_tonumber(L, 2, 0);
int y = (int)tolua_tonumber(L, 3, 0);
pnormalize(&x, &y, self);
tolua_pushnumber(L, (lua_Number)x);
tolua_pushnumber(L, (lua_Number)y);
lua_pushinteger(L, x);
lua_pushinteger(L, y);
return 2;
}
@ -638,8 +638,8 @@ static int tolua_plane_tostring(lua_State * L)
static int tolua_plane_get_size(lua_State * L)
{
plane *pl = (plane *)tolua_tousertype(L, 1, 0);
lua_pushnumber(L, plane_width(pl));
lua_pushnumber(L, plane_height(pl));
lua_pushinteger(L, plane_width(pl));
lua_pushinteger(L, plane_height(pl));
return 2;
}
@ -657,7 +657,7 @@ static int tolua_distance(lua_State * L)
pnormalize(&x1, &y1, pl);
pnormalize(&x2, &y2, pl);
result = koor_distance(x1, y1, x2, y2);
lua_pushnumber(L, result);
lua_pushinteger(L, result);
return 1;
}

View File

@ -45,7 +45,7 @@ int tolua_shiplist_next(lua_State * L)
static int tolua_ship_get_id(lua_State * L)
{
ship *self = (ship *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->no);
lua_pushinteger(L, self->no);
return 1;
}
@ -152,7 +152,7 @@ tolua_ship_tostring(lua_State * L)
static int tolua_ship_get_flags(lua_State * L)
{
ship *self = (ship *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->flags);
lua_pushinteger(L, self->flags);
return 1;
}
@ -179,7 +179,7 @@ static int tolua_ship_get_coast(lua_State * L)
{
ship *self = (ship *)tolua_tousertype(L, 1, 0);
if (self->coast) {
tolua_pushnumber(L, self->coast);
lua_pushinteger(L, self->coast);
return 1;
}
return 0;

View File

@ -44,7 +44,7 @@ static int tolua_db_execute(lua_State * L)
int res = sqlite3_exec(db, sql, 0, 0, 0);
tolua_pushnumber(L, (LUA_NUMBER)res);
lua_pushinteger(L, res);
return 1;
}

View File

@ -77,7 +77,7 @@ static int tolua_storage_read_float(lua_State * L)
gamedata *data = (gamedata *)tolua_tousertype(L, 1, 0);
float num;
READ_FLT(data->store, &num);
tolua_pushnumber(L, (lua_Number)num);
lua_pushnumber(L, num);
return 1;
}
@ -86,7 +86,7 @@ static int tolua_storage_read_int(lua_State * L)
gamedata *data = (gamedata *)tolua_tousertype(L, 1, 0);
int num;
READ_INT(data->store, &num);
tolua_pushnumber(L, (lua_Number)num);
lua_pushinteger(L, num);
return 1;
}

View File

@ -160,7 +160,7 @@ static int tolua_unit_set_group(lua_State * L)
{
unit *self = (unit *)tolua_tousertype(L, 1, 0);
int result = join_group(self, tolua_tostring(L, 2, 0));
tolua_pushnumber(L, result);
lua_pushinteger(L, result);
return 1;
}

View File

@ -123,7 +123,7 @@ static int tolua_quicklist_iter(lua_State * L)
void *data = ql_get(ql, index);
tolua_pushusertype(L, data, TOLUA_CAST type);
ql_advance(qlp, &index, 1);
tolua_pushnumber(L, index);
lua_pushinteger(L, index);
lua_replace(L, lua_upvalueindex(2));
return 1;
}
@ -139,7 +139,7 @@ int tolua_quicklist_push(struct lua_State *L, const char *list_type,
*qlist_ptr = list;
luaL_getmetatable(L, list_type);
lua_setmetatable(L, -2);
lua_pushnumber(L, 0);
lua_pushinteger(L, 0);
lua_pushstring(L, elem_type);
lua_pushcclosure(L, tolua_quicklist_iter, 3); /* OBS: this closure has multiple upvalues (list, index, type_name) */
}
@ -219,7 +219,7 @@ static int tolua_setkey(lua_State * L)
static int tolua_rng_int(lua_State * L)
{
lua_pushnumber(L, (lua_Number)rng_int());
lua_pushinteger(L, rng_int());
return 1;
}
@ -227,7 +227,7 @@ static int tolua_read_orders(lua_State * L)
{
const char *filename = tolua_tostring(L, 1, 0);
int result = readorders(filename);
lua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -282,14 +282,14 @@ static int tolua_set_turn(lua_State * L)
static int tolua_get_turn(lua_State * L)
{
tolua_pushnumber(L, (lua_Number)turn);
lua_pushinteger(L, turn);
return 1;
}
static int tolua_atoi36(lua_State * L)
{
const char *s = tolua_tostring(L, 1, 0);
tolua_pushnumber(L, (lua_Number)atoi36(s));
lua_pushinteger(L, atoi36(s));
return 1;
}
@ -303,7 +303,7 @@ static int tolua_itoa36(lua_State * L)
static int tolua_dice_rand(lua_State * L)
{
const char *s = tolua_tostring(L, 1, 0);
tolua_pushnumber(L, dice_rand(s));
lua_pushinteger(L, dice_rand(s));
return 1;
}
@ -320,7 +320,7 @@ static int tolua_addequipment(lua_State * L)
result = 0;
}
}
lua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -426,7 +426,7 @@ static int tolua_get_nmrs(lua_State * L)
}
result = nmrs[n];
}
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -451,7 +451,7 @@ static int tolua_equipment_setitem(lua_State * L)
result = 0;
}
}
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -465,7 +465,7 @@ static int tolua_spawn_braineaters(lua_State * L)
static int tolua_init_reports(lua_State * L)
{
int result = init_reports();
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -475,7 +475,7 @@ static int tolua_write_report(lua_State * L)
if (f) {
time_t ltime = time(0);
int result = write_reports(f, ltime);
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
}
else {
tolua_pushstring(L, "function expects a faction, got nil");
@ -488,7 +488,7 @@ static int tolua_write_reports(lua_State * L)
int result;
init_reports();
result = reports();
tolua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 1;
}
@ -534,7 +534,7 @@ static int tolua_process_orders(lua_State * L)
static int tolua_write_passwords(lua_State * L)
{
int result = writepasswd();
lua_pushnumber(L, (lua_Number)result);
lua_pushinteger(L, result);
return 0;
}
@ -568,7 +568,7 @@ static int tolua_write_map(lua_State * L)
static int tolua_read_turn(lua_State * L)
{
int cturn = current_turn();
tolua_pushnumber(L, (lua_Number)cturn);
lua_pushinteger(L, cturn);
return 1;
}
@ -661,7 +661,7 @@ static int tolua_get_alliance_factions(lua_State * L)
static int tolua_get_alliance_id(lua_State * L)
{
alliance *self = (alliance *)tolua_tousertype(L, 1, 0);
tolua_pushnumber(L, (lua_Number)self->id);
lua_pushinteger(L, self->id);
return 1;
}
@ -982,7 +982,7 @@ static int tolua_get_spell_school(lua_State * L)
static int tolua_get_spell_level(lua_State * L)
{
spell *self = (spell *) tolua_tousertype(L, 1, 0);
lua_pushnumber(L, self->level);
lua_pushinteger(L, self->level);
return 1;
}
#endif
@ -1069,7 +1069,7 @@ static void parse_inifile(lua_State * L, dictionary * d, const char *section)
tolua_pushstring(L, str_value);
}
else {
tolua_pushnumber(L, num_value);
lua_pushnumber(L, num_value);
}
lua_rawset(L, -3);
}

View File

@ -1500,7 +1500,7 @@ report_computer(const char *filename, report_context * ctx, const char *charset)
FILE *F = fopen(filename, "wt");
if (era < 0) {
era = get_param_int(global.parameters, "world.era", 2);
era = get_param_int(global.parameters, "world.era", 1);
}
if (F == NULL) {
perror(filename);

View File

@ -401,7 +401,7 @@ message * disband_men(int n, unit * u, struct order *ord) {
void give_unit(unit * u, unit * u2, order * ord)
{
region *r = u->region;
int n = u->number;
int maxt = max_transfers();
if (!rule_transfermen() && u->faction != u2->faction) {
cmistake(u, ord, 74, MSG_COMMERCE);
@ -472,9 +472,11 @@ void give_unit(unit * u, unit * u2, order * ord)
cmistake(u, ord, 105, MSG_COMMERCE);
return;
}
if (u2->faction->newbies + n > max_transfers()) {
cmistake(u, ord, 129, MSG_COMMERCE);
return;
if (maxt >= 0 && u->faction != u2->faction) {
if (u2->faction->newbies + u->number > maxt) {
cmistake(u, ord, 129, MSG_COMMERCE);
return;
}
}
if (u_race(u) != u2->faction->race) {
if (u2->faction->race != get_race(RC_HUMAN)) {
@ -510,9 +512,9 @@ void give_unit(unit * u, unit * u2, order * ord)
cmistake(u, ord, 156, MSG_COMMERCE);
return;
}
add_give(u, u2, n, n, get_resourcetype(R_PERSON), ord, 0);
add_give(u, u2, u->number, u->number, get_resourcetype(R_PERSON), ord, 0);
u_setfaction(u, u2->faction);
u2->faction->newbies += n;
u2->faction->newbies += u->number;
}
bool can_give_to(unit *u, unit *u2) {

View File

@ -3,6 +3,7 @@
#include "give.h"
#include "economy.h"
#include <kernel/ally.h>
#include <kernel/config.h>
#include <kernel/item.h>
#include <kernel/terrain.h>
@ -34,6 +35,10 @@ static void setup_give(struct give *env) {
env->dst = env->f2 ? test_create_unit(env->f2, env->r) : 0;
env->itype = it_get_or_create(rt_get_or_create("money"));
env->itype->flags |= ITF_HERB;
if (env->f1 && env->f2) {
ally * al = ally_add(&env->f2->allies, env->f1);
al->status = HELP_GIVE;
}
}
static void test_give_unit_to_peasants(CuTest * tc) {
@ -49,6 +54,25 @@ static void test_give_unit_to_peasants(CuTest * tc) {
test_cleanup();
}
static void test_give_unit(CuTest * tc) {
struct give env;
test_cleanup();
env.f1 = test_create_faction(0);
env.f2 = test_create_faction(0);
setup_give(&env);
env.r->terrain = test_create_terrain("ocean", SEA_REGION);
set_param(&global.parameters, "rules.give.max_men", "0");
give_unit(env.src, env.dst, NULL);
CuAssertPtrEquals(tc, env.f1, env.src->faction);
CuAssertIntEquals(tc, 0, env.f2->newbies);
set_param(&global.parameters, "rules.give.max_men", "-1");
give_unit(env.src, env.dst, NULL);
CuAssertPtrEquals(tc, env.f2, env.src->faction);
CuAssertIntEquals(tc, 1, env.f2->newbies);
CuAssertPtrEquals(tc, 0, env.f1->units);
test_cleanup();
}
static void test_give_unit_in_ocean(CuTest * tc) {
struct give env;
test_cleanup();
@ -284,6 +308,7 @@ CuSuite *get_give_suite(void)
SUITE_ADD_TEST(suite, test_give_men_other_faction);
SUITE_ADD_TEST(suite, test_give_men_requires_contact);
SUITE_ADD_TEST(suite, test_give_men_not_to_self);
SUITE_ADD_TEST(suite, test_give_unit);
SUITE_ADD_TEST(suite, test_give_unit_in_ocean);
SUITE_ADD_TEST(suite, test_give_unit_to_peasants);
SUITE_ADD_TEST(suite, test_give_peasants);

View File

@ -65,6 +65,7 @@
static int g_quit;
int force_color = 0;
newfaction * new_players = 0;
state *current_state = NULL;
@ -793,7 +794,7 @@ static void handlekey(state * st, int c)
region *r;
char sbuffer[80];
static char kbuffer[80];
int n, nx, ny;
int n, nx, ny, minpop, maxpop;
switch (c) {
case FAST_RIGHT:
@ -846,12 +847,20 @@ static void handlekey(state * st, int c)
loaddata(st);
break;
case 'B':
/*
make_block(st->cursor.x, st->cursor.y, 6, select_terrain(st, NULL));
*/
if (!new_players) {
sprintf(sbuffer, "%s/newfactions", basepath());
new_players = read_newfactions(sbuffer);
}
cnormalize(&st->cursor, &nx, &ny);
n = rng_int() % 8 + 8;
build_island_e3(nx, ny, n, n * 3);
minpop = get_param_int(global.parameters, "seed.population.min", 8);
maxpop = get_param_int(global.parameters, "seed.population.max", minpop);
if (maxpop > minpop) {
n = rng_int() % (maxpop - minpop) + minpop;
}
else {
n = minpop;
}
build_island_e3(&new_players, nx, ny, n, n * 3);
st->modified = 1;
st->wnd_info->update |= 1;
st->wnd_status->update |= 1;
@ -1052,8 +1061,11 @@ static void handlekey(state * st, int c)
tag_region(st->selected, nx, ny);
break;
case 'A':
sprintf(sbuffer, "%s/newfactions", basepath());
seed_players(sbuffer, false);
if (!new_players) {
sprintf(sbuffer, "%s/newfactions", basepath());
new_players = read_newfactions(sbuffer);
}
seed_players(&new_players, false);
st->wnd_map->update |= 1;
break;
case '/':
@ -1332,15 +1344,14 @@ const char *prompt)
return buffer[0] != 0;
}
void seed_players(const char *filename, bool new_island)
void seed_players(newfaction **players, bool new_island)
{
newfaction *players = read_newfactions(filename);
if (players != NULL) {
while (players) {
int n = listlen(players);
if (players) {
while (*players) {
int n = listlen(*players);
int k = (n + ISLANDSIZE - 1) / ISLANDSIZE;
k = n / k;
n = autoseed(&players, k, new_island ? 0 : TURNS_PER_ISLAND);
n = autoseed(players, k, new_island ? 0 : TURNS_PER_ISLAND);
if (n == 0) {
break;
}

View File

@ -20,6 +20,7 @@ extern "C" {
struct state;
struct region;
struct terrain_type;
struct newfaction;
int gmmain(int argc, char *argv[]);
int curses_readline(struct lua_State *L, char *buffer, size_t size,
@ -35,7 +36,7 @@ extern "C" {
void state_close(struct state *);
void make_block(int x, int y, int radius, const struct terrain_type *terrain);
void seed_players(const char *filename, bool new_island);
void seed_players(struct newfaction **players, bool new_island);
#ifdef __cplusplus
}

View File

@ -58,7 +58,7 @@ lua_giveitem(unit * s, unit * d, const item_type * itype, int n, struct order *o
tolua_pushusertype(L, s, TOLUA_CAST "unit");
tolua_pushusertype(L, d, TOLUA_CAST "unit");
tolua_pushstring(L, iname);
tolua_pushnumber(L, (lua_Number)n);
lua_pushinteger(L, n);
if (lua_pcall(L, 4, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
@ -121,7 +121,7 @@ produce_resource(region * r, const resource_type * rtype, int norders)
lua_getglobal(L, fname);
if (lua_isfunction(L, -1)) {
tolua_pushusertype(L, (void *)r, TOLUA_CAST "region");
tolua_pushnumber(L, (lua_Number)norders);
lua_pushinteger(L, norders);
if (lua_pcall(L, 2, 0, 0) != 0) {
const char *error = lua_tostring(L, -1);
@ -177,8 +177,8 @@ static int lua_callspell(castorder * co)
int nparam = 4;
tolua_pushusertype(L, r, TOLUA_CAST "region");
tolua_pushusertype(L, caster, TOLUA_CAST "unit");
tolua_pushnumber(L, (lua_Number)co->level);
tolua_pushnumber(L, (lua_Number)co->force);
lua_pushinteger(L, co->level);
lua_pushnumber(L, co->force);
if (co->sp->parameter && co->par->length) {
const char *synp = co->sp->parameter;
int i = 0;
@ -267,7 +267,7 @@ lua_changeresource(unit * u, const struct resource_type *rtype, int delta)
lua_getglobal(L, fname);
if (lua_isfunction(L, -1)) {
tolua_pushusertype(L, u, TOLUA_CAST "unit");
tolua_pushnumber(L, (lua_Number)delta);
lua_pushinteger(L, delta);
if (lua_pcall(L, 2, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
@ -363,7 +363,7 @@ lua_wage(const region * r, const faction * f, const race * rc, int in_turn)
tolua_pushusertype(L, (void *)r, TOLUA_CAST "region");
tolua_pushusertype(L, (void *)f, TOLUA_CAST "faction");
tolua_pushstring(L, rc ? rc->_name : 0);
tolua_pushnumber(L, (lua_Number)in_turn);
lua_pushinteger(L, in_turn);
if (lua_pcall(L, 3, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
@ -416,7 +416,7 @@ static double lua_building_taxes(building * b, int level)
lua_getglobal(L, fname);
if (lua_isfunction(L, -1)) {
tolua_pushusertype(L, (void *)b, TOLUA_CAST "building");
tolua_pushnumber(L, level);
lua_pushinteger(L, level);
if (lua_pcall(L, 2, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);
@ -508,7 +508,7 @@ struct order *ord)
lua_getglobal(L, fname);
if (lua_isfunction(L, -1)) {
tolua_pushusertype(L, (void *)u, TOLUA_CAST "unit");
tolua_pushnumber(L, (lua_Number)amount);
lua_pushinteger(L, amount);
if (lua_pcall(L, 2, 1, 0) != 0) {
const char *error = lua_tostring(L, -1);

View File

@ -1,15 +1,27 @@
#include <platform.h>
#include "types.h"
#include "curse.h"
#include <kernel/config.h>
#include <kernel/region.h>
#include <kernel/unit.h>
#include <kernel/version.h>
#include <util/attrib.h>
#include <util/message.h>
#include <binarystore.h>
#include <filestream.h>
#include <memstream.h>
#include <storage.h>
#include <stream.h>
#include <tests.h>
#include "curse.h"
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <CuTest.h>
static void test_curse(CuTest * tc)
{
attrib *attrs = NULL;
@ -83,6 +95,58 @@ static void test_bad_dreams(CuTest *tc) {
test_cleanup();
}
static void test_memstream(CuTest *tc) {
storage store;
stream out = { 0 };
char buf[1024];
int val=0;
mstream_init(&out);
binstore_init(&store, &out);
store.handle.data = &out;
WRITE_INT(&store, 999999);
WRITE_TOK(&store, "fortytwo");
WRITE_INT(&store, 42);
out.api->rewind(out.handle);
READ_INT(&store, &val);
READ_TOK(&store, buf, 1024);
CuAssertIntEquals(tc, 999999, val);
CuAssertStrEquals(tc, "fortytwo", buf);
READ_INT(&store, &val);
CuAssertIntEquals(tc, 42, val);
mstream_done(&out);
}
static void test_write_flag(CuTest *tc) {
curse_fixture fix;
storage store;
char buf[1024];
stream out = { 0 };
size_t len;
mstream_init(&out);
binstore_init(&store, &out);
store.handle.data = &out;
setup_curse(&fix, "gbdream");
fix.c->flags = 42 | CURSE_ISNEW;
curse_write(fix.r->attribs, fix.r, &store);
out.api->rewind(out.handle);
len = out.api->read(out.handle, buf, sizeof(buf));
buf[len] = '\0';
out.api->rewind(out.handle);
curse_read(fix.r->attribs, fix.r, &store);
CuAssertIntEquals(tc, 42 | CURSE_ISNEW, ((curse *) fix.r->attribs->data.v)->flags);
global.data_version = RELEASE_VERSION;
CuAssertIntEquals(tc, RELEASE_VERSION, global.data_version);
mstream_done(&out);
binstore_done(&store);
test_cleanup();
}
CuSuite *get_curse_suite(void)
{
CuSuite *suite = CuSuiteNew();
@ -91,5 +155,7 @@ CuSuite *get_curse_suite(void)
SUITE_ADD_TEST(suite, test_magicstreet_warning);
SUITE_ADD_TEST(suite, test_good_dreams);
SUITE_ADD_TEST(suite, test_bad_dreams);
SUITE_ADD_TEST(suite, test_memstream);
SUITE_ADD_TEST(suite, test_write_flag);
return suite;
}

View File

@ -956,8 +956,10 @@ void setluxuries(region * r, const luxury_type * sale)
assert(r->land);
if (r->land->demands)
if (r->land->demands) {
freelist(r->land->demands);
r->land->demands = 0;
}
for (ltype = luxurytypes; ltype; ltype = ltype->next) {
struct demand *dmd = malloc(sizeof(struct demand));

View File

@ -1724,6 +1724,7 @@ int writegame(const char *filename)
gdata.store = &store;
gdata.encoding = enc_gamedata;
gdata.version = RELEASE_VERSION;
global.data_version = RELEASE_VERSION;
n = STREAM_VERSION;
fwrite(&gdata.version, sizeof(int), 1, F);
fwrite(&n, sizeof(int), 1, F);

View File

@ -31,6 +31,10 @@ without prior permission by the authors of Eressea.
#include "vortex.h"
#if SCORE_MODULE
#include <modules/score.h>
#endif
/* util includes */
#include <util/attrib.h>
#include <util/bsdstring.h>
@ -766,9 +770,6 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
itype->weight = xml_ivalue(node, "weight", 0);
itype->capacity = xml_ivalue(node, "capacity", 0);
itype->flags |= flags;
#if SCORE_MODULE
itype->score = xml_ivalue(node, "score", 0);
#endif
/* reading item/construction */
xpath->node = node;
@ -855,6 +856,10 @@ static item_type *xml_readitem(xmlXPathContextPtr xpath, resource_type * rtype)
}
xmlFree(propValue);
}
#if SCORE_MODULE
itype->score = xml_ivalue(node, "score", 0);
if (!itype->score) itype->score = default_score(itype);
#endif
xmlXPathFreeObject(result);
return itype;

View File

@ -696,12 +696,11 @@ static void test_reserve_self(CuTest *tc) {
static void statistic_test(CuTest *tc, int peasants, int luck, int maxp,
double variance, int min_value, int max_value) {
int effect, i;
for (i = 0; i < 1000; ++i) {
effect = peasant_luck_effect(peasants, luck, maxp, variance);
CuAssertTrue(tc, min_value <= effect);
CuAssertTrue(tc, max_value >= effect);
}
int effect;
effect = peasant_luck_effect(peasants, luck, maxp, variance);
CuAssertTrue(tc, min_value <= effect);
CuAssertTrue(tc, max_value >= effect);
}
static void test_peasant_luck_effect(CuTest *tc) {
@ -713,6 +712,10 @@ static void test_peasant_luck_effect(CuTest *tc) {
statistic_test(tc, 100, 0, 1000, 0, 0, 0);
statistic_test(tc, 100, 2, 1000, 0, 1, 1);
/*
statistic_test(tc, 1000, 400, 1000, 0, (int)(400 * 10 * 0.001 * .75),
(int)(400 * 10 * 0.001 * .75));
*/
statistic_test(tc, 1000, 400, 1000, 0, 3, 3);
statistic_test(tc, 1000, 1000, 2000, .5, 1, 501);

View File

@ -282,7 +282,6 @@ int main(int argc, char **argv)
int err = 0;
lua_State *L;
setup_signal_handler();
/* parse args once to read config file location */
if (parse_args(argc, argv, &err) != 0) {
return err;

View File

@ -904,10 +904,9 @@ static void smooth_island(region_list * island)
}
}
static void starting_region(region * r, region * rn[])
static void starting_region(newfaction ** players, region * r, region * rn[])
{
int n;
oceans_around(r, rn);
freset(r, RF_MARK);
for (n = 0; n != MAXDIRECTIONS; ++n) {
@ -915,11 +914,19 @@ static void starting_region(region * r, region * rn[])
}
terraform_region(r, newterrain(T_PLAIN));
prepare_starting_region(r);
addplayer(r, addfaction("enno@eressea.de", itoa36(rng_int()), races, default_locale, 0));
if (players && *players) {
newfaction *nf = *players;
const struct race *rc = nf->race ? nf->race : races;
const struct locale *lang = nf->lang ? nf->lang : default_locale;
const char * passwd = nf->password ? nf->password : itoa36(rng_int());
addplayer(r, addfaction(nf->email, passwd, rc, lang, 0));
*players = nf->next;
free_newfaction(nf);
}
}
/* E3A island generation */
int build_island_e3(int x, int y, int numfactions, int minsize)
int build_island_e3(newfaction ** players, int x, int y, int numfactions, int minsize)
{
#define MIN_QUALITY 1000
int nfactions = 0;
@ -961,8 +968,8 @@ int build_island_e3(int x, int y, int numfactions, int minsize)
get_neighbours(r, rn);
q = region_quality(r, rn);
if (q >= MIN_QUALITY && nfactions < numfactions) {
starting_region(r, rn);
if (q >= MIN_QUALITY && nfactions < numfactions && *players) {
starting_region(players, r, rn);
minq = _min(minq, q);
maxq = _max(maxq, q);
++nfactions;
@ -976,8 +983,8 @@ int build_island_e3(int x, int y, int numfactions, int minsize)
region *rn[MAXDIRECTIONS];
get_neighbours(r, rn);
q = region_quality(r, rn);
if (q >= MIN_QUALITY * 4 / 3 && nfactions < numfactions) {
starting_region(r, rn);
if (q >= MIN_QUALITY * 4 / 3 && nfactions < numfactions && *players) {
starting_region(players, r, rn);
minq = _min(minq, q);
maxq = _max(maxq, q);
++nfactions;

View File

@ -40,7 +40,7 @@ extern "C" {
*terrains[], int distribution[], int size);
extern int seed_adamantium(struct region *r, int base);
extern int build_island_e3(int x, int y, int numfactions, int minsize);
extern int build_island_e3(newfaction **players, int x, int y, int numfactions, int minsize);
#ifdef __cplusplus
}

View File

@ -24,6 +24,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* kernel includes */
#include <kernel/alliance.h>
#include <kernel/building.h>
#include <kernel/build.h>
#include <kernel/faction.h>
#include <kernel/item.h>
#include <kernel/race.h>
@ -214,4 +215,20 @@ void score(void)
}
}
int default_score(const item_type *itype) {
int result = 0;
if (itype->construction) {
requirement *req = itype->construction->materials;
while (req->number) {
int score = req->rtype->itype ? req->rtype->itype->score : 10;
result += score * req->number * 2;
++req;
}
}
else {
result = 10;
}
return result;
}
#endif

View File

@ -26,8 +26,11 @@ extern "C" {
#error "must define SCORE_MODULE to use this module"
#endif
extern void score(void);
extern int average_score_of_age(int age, int a);
struct item_type;
void score(void);
int average_score_of_age(int age, int a);
int default_score(const struct item_type *itype);
#ifdef __cplusplus
}

View File

@ -357,7 +357,8 @@ static const char *dracoid_name(const unit * u)
static char name[NAMESIZE + 1]; // FIXME: static return value
int mid_syllabels;
u = u;
/* ignore u */
u = 0;
/* Wieviele Mittelteile? */
mid_syllabels = rng_int() % 4;

View File

@ -12,10 +12,6 @@ int wrptr(char **ptr, size_t * size, size_t bytes)
if (bytes == 0) {
return 0;
}
if (bytes < 0) {
*size = 0;
return EINVAL;
}
if (bytes <= *size) {
*ptr += bytes;
*size -= bytes;
@ -24,7 +20,7 @@ int wrptr(char **ptr, size_t * size, size_t bytes)
*ptr += *size;
*size = 0;
return ENAMETOOLONG;
return ERANGE;
}
#ifndef HAVE_STRLCPY

@ -1 +1 @@
Subproject commit 48768e4bef7ff28365487e047d3b910127c716d0
Subproject commit 2bcd3b1e64764321773672333bd133a61b35b840