forked from github/server
Merge branch 'develop' of github.com:eressea/server into develop
This commit is contained in:
commit
5667b6dc8c
|
@ -8,6 +8,11 @@ project (eressea-server C)
|
|||
|
||||
|
||||
enable_testing()
|
||||
find_package (LibXml2)
|
||||
find_package (SQLite3)
|
||||
find_package (Curses)
|
||||
find_package (Lua REQUIRED)
|
||||
find_package (ToLua REQUIRED)
|
||||
|
||||
INCLUDE (CheckIncludeFiles)
|
||||
INCLUDE (CheckSymbolExists)
|
||||
|
@ -57,13 +62,6 @@ CONFIGURE_FILE (
|
|||
INCLUDE_DIRECTORIES (${CMAKE_BINARY_DIR}/include)
|
||||
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DUSE_AUTOCONF")
|
||||
|
||||
|
||||
find_package (LibXml2)
|
||||
find_package (SQLite3)
|
||||
find_package (Curses)
|
||||
find_package (Lua REQUIRED)
|
||||
find_package (ToLua REQUIRED)
|
||||
|
||||
add_subdirectory (cutest)
|
||||
add_subdirectory (crypto)
|
||||
add_subdirectory (cJSON)
|
||||
|
@ -75,4 +73,4 @@ add_subdirectory (src eressea)
|
|||
install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.xml")
|
||||
install(DIRECTORY res conf DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.json")
|
||||
install(DIRECTORY scripts DESTINATION ${CMAKE_INSTALL_PREFIX} FILES_MATCHING PATTERN "*.lua")
|
||||
|
||||
install(DIRECTORY share DESTINATION ${CMAKE_INSTALL_PREFIX})
|
||||
|
|
2
cmake
2
cmake
|
@ -1 +1 @@
|
|||
Subproject commit cd779ba36efb4045a040af170588a8dfe496d7b9
|
||||
Subproject commit ce0a1c882fa44b882c29cc8c68012295328dc352
|
|
@ -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>
|
||||
|
|
|
@ -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 -->
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 -->
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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 -->
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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"/>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
1
s/build
1
s/build
|
@ -6,6 +6,7 @@ done
|
|||
|
||||
[ -z $BUILD ] && BUILD=Debug
|
||||
MACHINE=`uname -m`
|
||||
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
|
||||
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
||||
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
|
||||
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
|
||||
|
|
16
s/cmake-init
16
s/cmake-init
|
@ -10,6 +10,7 @@ done
|
|||
|
||||
[ -z $BUILD ] && BUILD=Debug
|
||||
MACHINE=`uname -m`
|
||||
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
|
||||
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
||||
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
|
||||
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
|
||||
|
@ -33,7 +34,20 @@ if [ -d $HOME/usr ]; then
|
|||
PREFIX_PATH=$HOME/usr:$HOME/usr/local:$PREFIX_PATH
|
||||
fi
|
||||
|
||||
cmake .. \
|
||||
if [ -z $PC_LUA ] && [ -e /opt/include/lua.h ]; then
|
||||
PC_LUA=/opt/include
|
||||
fi
|
||||
if [ -z $PC_TOLUA ] && [ -e /opt/include/tolua.h ]; then
|
||||
PC_TOLUA=/opt/include
|
||||
fi
|
||||
if [ ! -z $PC_TOLUA ]; then
|
||||
PC_ARGS="$PC_ARGS -DPC_TOLUA_INCLUDEDIR=$PC_TOLUA/include -DPC_TOLUA_LIBDIR=$PC_TOLUA/lib"
|
||||
fi
|
||||
if [ ! -z $PC_LUA ]; then
|
||||
PC_ARGS="$PC_ARGS -DPC_LUA_INCLUDEDIR=$PC_LUA/include -DPC_LUA_LIBDIR=$PC_LUA/lib"
|
||||
fi
|
||||
|
||||
cmake .. $PC_ARGS \
|
||||
-DCMAKE_MODULE_PATH=$PWD/../cmake/Modules \
|
||||
-DCMAKE_BUILD_TYPE=$BUILD \
|
||||
-DCMAKE_LIBRARY_PATH=$LIBRARY_PATH \
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
ROOT=$(pwd)
|
||||
while [ ! -d $ROOT/.git ]; do
|
||||
ROOT=$(dirname $ROOT)
|
||||
if [ "$ROOT" == "/" ; then
|
||||
if [ "/" = "$ROOT" ]; then
|
||||
echo "could not find root, are you in the git repository?"
|
||||
exit
|
||||
fi
|
||||
|
@ -25,4 +25,8 @@ programs="create-orders backup-eressea run-turn"
|
|||
for prg in ${programs} ; do
|
||||
install -v $ROOT/process/$prg $DEST/bin/
|
||||
done
|
||||
crontab $ROOT/process/cron/crontab
|
||||
|
||||
# install crontab, but only on the eressea server:
|
||||
HOST=`hostname`
|
||||
|
||||
[ "gruenbaer" = "$HOST" ] && crontab $ROOT/process/cron/crontab
|
||||
|
|
14
s/preview
14
s/preview
|
@ -1,5 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
MACHINE=`uname -m`
|
||||
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
|
||||
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
||||
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
|
||||
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
|
||||
BUILD="build-$MACHINE-$CC-Debug"
|
||||
|
||||
function usage() {
|
||||
cat <<HEREDOC
|
||||
usage: $0 [-t <turn>] [-g <game>] [-f <file>] command [args]
|
||||
|
@ -80,10 +87,11 @@ ln -f $LIVE/data/$turn.dat data/
|
|||
rm -rf reports
|
||||
mkdir -p reports
|
||||
|
||||
SERVER="$SOURCE/build-x86_64-gcc-Debug/eressea/eressea"
|
||||
SUPP="$SOURCE/share/ubuntu-12_04.supp"
|
||||
SERVER="$SOURCE/$BUILD/eressea/eressea"
|
||||
VALGRIND=$(which valgrind)
|
||||
if [ ! -z $VALGRIND ]; then
|
||||
SERVER="$VALGRIND --leak-check=no $SERVER"
|
||||
SERVER="$VALGRIND --suppressions=$SUPP --error-exitcode=1 --leak-check=no $SERVER"
|
||||
fi
|
||||
$SERVER -v$verbose -t$turn -re$game $SOURCE/scripts/run-turn.lua
|
||||
let turn=$turn+1
|
||||
|
@ -147,7 +155,7 @@ case "$1" in
|
|||
;;
|
||||
"run")
|
||||
if [ $turn -eq 0 ]; then
|
||||
[ -f $LIVE/turn ] || abort "missing turn file, and no turn specified"
|
||||
[ -f $LIVE/turn ] || abort "missing turn file in $LIVE, and no turn specified"
|
||||
let turn=$(cat $LIVE/turn)-1
|
||||
fi
|
||||
run
|
||||
|
|
|
@ -7,6 +7,7 @@ while [ ! -d $ROOT/.git ]; do
|
|||
done
|
||||
|
||||
MACHINE=`uname -m`
|
||||
[ -z "$CC" ] && [ ! -z `which clang` ] && CC="clang"
|
||||
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
||||
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
|
||||
[ -z "$CC" ] && [ ! -z `which cc` ] && CC="cc"
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
set -e
|
||||
ROOT=`pwd`
|
||||
SUPP=../share/ubuntu-12_04.supp
|
||||
MACHINE=`uname -m`
|
||||
[ -z "$CC" ] && [ ! -z `which gcc` ] && CC="gcc"
|
||||
[ -z "$CC" ] && [ ! -z `which tcc` ] && CC="tcc"
|
||||
|
@ -23,9 +24,15 @@ make
|
|||
}
|
||||
|
||||
test_valgrind_report () {
|
||||
cd tests
|
||||
cd $ROOT/tests
|
||||
ln -sf ../scripts/config.lua
|
||||
valgrind --suppressions=ubuntu-12_04.supp --error-exitcode=1 $BUILD/eressea/eressea -v0 -t184 ../scripts/reports.lua
|
||||
valgrind --suppressions=$SUPP --error-exitcode=1 $BUILD/eressea/eressea -v0 -t184 ../scripts/reports.lua
|
||||
}
|
||||
|
||||
test_valgrind_turn () {
|
||||
cd $ROOT/tests
|
||||
ln -sf ../scripts/config.lua
|
||||
valgrind --suppressions=$SUPP --error-exitcode=1 $BUILD/eressea/eressea -v0 -t184 ../scripts/run-turn.lua
|
||||
}
|
||||
|
||||
test_unittests() {
|
||||
|
@ -34,7 +41,7 @@ $BUILD/eressea/test_eressea
|
|||
|
||||
cleanup() {
|
||||
cd $ROOT/tests
|
||||
rm -rf reports score eressea.log* config.lua
|
||||
rm -rf reports score eressea.log* config.lua data/185.dat datum passwd parteien parteien.full turn
|
||||
}
|
||||
|
||||
test_server() {
|
||||
|
@ -59,5 +66,6 @@ build
|
|||
test_unittests
|
||||
test_server
|
||||
test_valgrind_report
|
||||
test_valgrind_turn
|
||||
|
||||
cleanup
|
||||
|
|
|
@ -36,4 +36,3 @@ function test_read_ship()
|
|||
s = ship.create(nil, "boat")
|
||||
assert_not_nil(s)
|
||||
end
|
||||
|
||||
|
|
|
@ -7,3 +7,4 @@ require 'tests.pool'
|
|||
require 'tests.regions'
|
||||
require 'tests.settings'
|
||||
require 'tests.study'
|
||||
require 'tests.laws'
|
||||
|
|
|
@ -0,0 +1,114 @@
|
|||
require "lunit"
|
||||
|
||||
module("tests.laws", package.seeall, lunit.testcase)
|
||||
|
||||
function setup()
|
||||
eressea.free_game()
|
||||
conf = [[{
|
||||
"races": {
|
||||
"human" : {}
|
||||
},
|
||||
"terrains" : {
|
||||
"plain": { "flags" : [ "land", "walk", "sail" ] }
|
||||
},
|
||||
"keywords" : {
|
||||
"de": {
|
||||
"attack" : "ATTACKIERE",
|
||||
"maketemp" : "MACHETEMP",
|
||||
"end" : "ENDE",
|
||||
"recruit" : "REKRUTIERE"
|
||||
}
|
||||
},
|
||||
"buildings" : {
|
||||
"castle" : {}
|
||||
}
|
||||
}]]
|
||||
|
||||
eressea.config.reset()
|
||||
eressea.config.parse(conf)
|
||||
end
|
||||
|
||||
function test_force_leave_on()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f1 = faction.create("owner@eressea.de")
|
||||
local f2 = faction.create("guest@eressea.de")
|
||||
local u1 = unit.create(f1, r, 1)
|
||||
local u2 = unit.create(f2, r, 1)
|
||||
local b1 = building.create(r, "castle")
|
||||
u1.building = b1
|
||||
u2.building = b1
|
||||
eressea.settings.set("rules.owners.force_leave", "2")
|
||||
process_orders()
|
||||
assert_equal(b1, u1.building)
|
||||
assert_equal(nil, u2.building)
|
||||
end
|
||||
|
||||
function test_force_leave_off()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f1 = faction.create("owner@eressea.de")
|
||||
local f2 = faction.create("guest@eressea.de")
|
||||
local u1 = unit.create(f1, r, 1)
|
||||
local u2 = unit.create(f2, r, 1)
|
||||
local b1 = building.create(r, "castle")
|
||||
u1.building = b1
|
||||
u2.building = b1
|
||||
eressea.settings.set("rules.owners.force_leave", "0")
|
||||
process_orders()
|
||||
assert_equal(b1, u1.building)
|
||||
assert_equal(b1, u2.building)
|
||||
end
|
||||
|
||||
function test_make_temp()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f1 = faction.create("owner@eressea.de", "human", "de")
|
||||
local u1 = unit.create(f1, r, 10)
|
||||
local u, u2
|
||||
|
||||
u1.building = building.create(r, "castle")
|
||||
u1.status = 1
|
||||
u1:clear_orders()
|
||||
u1:add_order("MACHETEMP 1 Hodor")
|
||||
u1:add_order("REKRUTIERE 1")
|
||||
u1:add_order("ENDE")
|
||||
process_orders()
|
||||
for u in r.units do
|
||||
if u~=u1 then
|
||||
u2 = u
|
||||
break
|
||||
end
|
||||
end
|
||||
assert_not_equal(nil, u2)
|
||||
assert_not_equal(nil, u2.building)
|
||||
assert_equal(1, u2.number)
|
||||
assert_equal(1, u2.status)
|
||||
assert_equal("Hodor", u2.name)
|
||||
end
|
||||
|
||||
function test_force_leave_postcombat()
|
||||
local r = region.create(0, 0, "plain")
|
||||
local f1 = faction.create("owner@eressea.de", "human", "de")
|
||||
local f2 = faction.create("guest@eressea.de", "human", "de")
|
||||
local u1 = unit.create(f1, r, 10)
|
||||
local u2 = unit.create(f2, r, 10)
|
||||
local u, u3
|
||||
local b1 = building.create(r, "castle")
|
||||
u1.building = b1
|
||||
u2.building = b1
|
||||
eressea.settings.set("rules.owners.force_leave", "1")
|
||||
u1:clear_orders()
|
||||
u1:add_order("ATTACKIERE " .. itoa36(u2.id))
|
||||
u2:clear_orders()
|
||||
u2:add_order("MACHETEMP 2 Hodor")
|
||||
u2:add_order("REKRUTIERE 1")
|
||||
u2:add_order("ENDE")
|
||||
process_orders()
|
||||
for u in r.units do
|
||||
if u~=u1 and u~=u2 then
|
||||
u3 = u
|
||||
break
|
||||
end
|
||||
end
|
||||
assert_not_equal(nil, u3)
|
||||
assert_equal(nil, u3.building)
|
||||
assert_equal(1, u3.number)
|
||||
end
|
|
@ -1,3 +1,4 @@
|
|||
# old zlib version
|
||||
{
|
||||
zlib1g-dev-1:1.2.3.4.dfsg
|
||||
Memcheck:Cond
|
||||
|
@ -14,3 +15,23 @@
|
|||
fun:read_xml
|
||||
fun:init_data
|
||||
}
|
||||
|
||||
# https://sourceware.org/bugzilla/show_bug.cgi?id=14404
|
||||
{
|
||||
glibc-bug-14404-1
|
||||
Memcheck:Addr8
|
||||
fun:__GI___strncasecmp_l
|
||||
fun:____strtod_l_internal
|
||||
}
|
||||
{
|
||||
glibc-bug-14404-2
|
||||
Memcheck:Cond
|
||||
fun:__GI___strncasecmp_l
|
||||
fun:____strtod_l_internal
|
||||
}
|
||||
{
|
||||
glibc-bug-14404-3
|
||||
Memcheck:Value8
|
||||
fun:__GI___strncasecmp_l
|
||||
fun:____strtod_l_internal
|
||||
}
|
52
src/battle.c
52
src/battle.c
|
@ -901,7 +901,9 @@ static void rmtroop(troop dt)
|
|||
rmfighter(df, 1);
|
||||
|
||||
assert(dt.index >= 0 && dt.index < df->unit->number);
|
||||
if (dt.index!=df->alive-df->removed) {
|
||||
df->person[dt.index] = df->person[df->alive - df->removed];
|
||||
}
|
||||
if (df->removed) {
|
||||
df->person[df->alive - df->removed] = df->person[df->alive];
|
||||
}
|
||||
|
@ -3944,7 +3946,6 @@ static bool start_battle(region * r, battle ** bp)
|
|||
unit *u;
|
||||
bool fighting = false;
|
||||
|
||||
/* list_foreach geht nicht, wegen flucht */
|
||||
for (u = r->units; u != NULL; u = u->next) {
|
||||
if (fval(u, UFL_LONGACTION))
|
||||
continue;
|
||||
|
@ -4234,6 +4235,52 @@ static void battle_flee(battle * b)
|
|||
}
|
||||
}
|
||||
|
||||
static bool is_enemy(battle *b, unit *u1, unit *u2) {
|
||||
if (u1->faction != u2->faction) {
|
||||
if (b) {
|
||||
side *es, *s1 = 0, *s2 = 0;
|
||||
for (es = b->sides; es != b->sides + b->nsides; ++es) {
|
||||
if (!s1 && es->faction == u1->faction) s1 = es;
|
||||
else if (!s2 && es->faction == u2->faction) s2 = es;
|
||||
if (s1 && s2) break;
|
||||
}
|
||||
return enemy(s1, s2);
|
||||
}
|
||||
else {
|
||||
return !help_enter(u1, u2);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void force_leave(region *r, battle *b) {
|
||||
unit *u;
|
||||
|
||||
for (u = r->units; u; u = u->next) {
|
||||
unit *uo = NULL;
|
||||
if (u->building) {
|
||||
uo = building_owner(u->building);
|
||||
}
|
||||
if (u->ship && r->land) {
|
||||
uo = ship_owner(u->ship);
|
||||
}
|
||||
if (uo && is_enemy(b, uo, u)) {
|
||||
message *msg = NULL;
|
||||
if (u->building) {
|
||||
msg = msg_message("force_leave_building", "unit owner building", u, uo, u->building);
|
||||
}
|
||||
else {
|
||||
msg = msg_message("force_leave_ship", "unit owner ship", u, uo, u->ship);
|
||||
}
|
||||
if (msg) {
|
||||
ADDMSG(&u->faction->msgs, msg);
|
||||
}
|
||||
leave(u, false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void do_battle(region * r)
|
||||
{
|
||||
battle *b = NULL;
|
||||
|
@ -4305,6 +4352,9 @@ void do_battle(region * r)
|
|||
|
||||
/* Auswirkungen berechnen: */
|
||||
aftermath(b);
|
||||
if (rule_force_leave(FORCE_LEAVE_POSTCOMBAT)) {
|
||||
force_leave(b->region, b);
|
||||
}
|
||||
/* Hier ist das Gefecht beendet, und wir können die
|
||||
* Hilfsstrukturen * wieder löschen: */
|
||||
|
||||
|
|
|
@ -270,6 +270,7 @@ extern "C" {
|
|||
const struct group * g, unsigned int flags,
|
||||
const struct faction * stealthfaction);
|
||||
int skilldiff(troop at, troop dt, int dist);
|
||||
void force_leave(struct region *r, struct battle *b);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ without prior permission by the authors of Eressea.
|
|||
#include <kernel/building.h>
|
||||
#include <kernel/region.h>
|
||||
|
||||
#include <util/log.h>
|
||||
#include <util/language.h>
|
||||
|
||||
#include <tolua.h>
|
||||
|
@ -114,7 +115,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 +146,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;
|
||||
}
|
||||
|
||||
|
@ -190,6 +191,12 @@ static int tolua_building_create(lua_State * L)
|
|||
{
|
||||
region *r = (region *)tolua_tousertype(L, 1, 0);
|
||||
const char *bname = tolua_tostring(L, 2, 0);
|
||||
if (!r) {
|
||||
log_error("building.create expects a region as argument 1");
|
||||
}
|
||||
if (!bname) {
|
||||
log_error("building.create expects a name as argument 2");
|
||||
}
|
||||
if (bname) {
|
||||
const building_type *btype = bt_find(bname);
|
||||
if (btype) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ static int tolua_make_island(lua_State * L)
|
|||
int n = (int)tolua_tonumber(L, 4, s / 3);
|
||||
|
||||
n = build_island_e3(NULL, x, y, n, s);
|
||||
tolua_pushnumber(L, n);
|
||||
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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -991,7 +991,7 @@ void init_locale(struct locale *lang)
|
|||
addtoken(tokens, name, var);
|
||||
}
|
||||
else {
|
||||
log_error("no translation for magic school %s in locale %s", tok, locale_name(lang));
|
||||
log_warning("no translation for magic school %s in locale %s", tok, locale_name(lang));
|
||||
}
|
||||
tok = strtok(NULL, " ");
|
||||
}
|
||||
|
|
|
@ -183,6 +183,7 @@ race *rc_get_or_create(const char *zName)
|
|||
rc->recruit_multi = 1.0F;
|
||||
rc->regaura = 1.0F;
|
||||
rc->speed = 1.0F;
|
||||
rc->battle_flags = BF_CANATTACK;
|
||||
if (strchr(zName, ' ') != NULL) {
|
||||
log_error("race '%s' has an invalid name. remove spaces\n", zName);
|
||||
assert(strchr(zName, ' ') == NULL);
|
||||
|
|
|
@ -618,13 +618,13 @@ unit *read_unit(struct gamedata *data)
|
|||
}
|
||||
|
||||
READ_STR(data->store, obuf, sizeof(obuf));
|
||||
u->_name = _strdup(obuf);
|
||||
u->_name = obuf[0] ? _strdup(obuf) : 0;
|
||||
if (lomem) {
|
||||
READ_STR(data->store, NULL, 0);
|
||||
}
|
||||
else {
|
||||
READ_STR(data->store, obuf, sizeof(obuf));
|
||||
u->display = _strdup(obuf);
|
||||
u->display = obuf[0] ? _strdup(obuf) : 0;
|
||||
}
|
||||
READ_INT(data->store, &number);
|
||||
set_number(u, number);
|
||||
|
|
|
@ -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;
|
||||
|
@ -1721,7 +1726,7 @@ static int parse_races(xmlDocPtr doc)
|
|||
if (xml_bvalue(node, "resistpierce", false))
|
||||
rc->battle_flags |= BF_RES_PIERCE;
|
||||
if (xml_bvalue(node, "canattack", true))
|
||||
rc->battle_flags |= BF_CANATTACK;
|
||||
rc->battle_flags |= BF_CANATTACK; // TODO: invert this flag, so rc_get_or_create gets simpler
|
||||
|
||||
for (child = node->children; child; child = child->next) {
|
||||
if (strcmp((const char *)child->name, "ai") == 0) {
|
||||
|
|
49
src/laws.c
49
src/laws.c
|
@ -3346,7 +3346,7 @@ void new_units(void)
|
|||
}
|
||||
u2 = create_unit(r, u->faction, 0, u->faction->race, alias, name, u);
|
||||
if (name != NULL)
|
||||
free(name);
|
||||
free(name); // TODO: use a buffer on the stack instead?
|
||||
fset(u2, UFL_ISNEW);
|
||||
|
||||
a_add(&u2->attribs, a_new(&at_alias))->data.i = alias;
|
||||
|
@ -4307,34 +4307,17 @@ static void enter_2(region * r)
|
|||
do_enter(r, 1);
|
||||
}
|
||||
|
||||
static bool help_enter(unit *uo, unit *u) {
|
||||
bool help_enter(unit *uo, unit *u) {
|
||||
return uo->faction == u->faction || alliedunit(uo, u->faction, HELP_GUARD);
|
||||
}
|
||||
|
||||
void force_leave(region *r) {
|
||||
unit *u;
|
||||
for (u = r->units; u; u = u->next) {
|
||||
unit *uo = NULL;
|
||||
if (u->building) {
|
||||
uo = building_owner(u->building);
|
||||
}
|
||||
if (u->ship && r->land) {
|
||||
uo = ship_owner(u->ship);
|
||||
}
|
||||
if (uo && !help_enter(uo, u)) {
|
||||
message *msg = NULL;
|
||||
if (u->building) {
|
||||
msg = msg_message("force_leave_building", "unit owner building", u, uo, u->building);
|
||||
}
|
||||
else {
|
||||
msg = msg_message("force_leave_ship", "unit owner ship", u, uo, u->ship);
|
||||
}
|
||||
if (msg) {
|
||||
ADDMSG(&u->faction->msgs, msg);
|
||||
}
|
||||
leave(u, false);
|
||||
}
|
||||
static void do_force_leave(region *r) {
|
||||
force_leave(r, NULL);
|
||||
}
|
||||
|
||||
bool rule_force_leave(int flags) {
|
||||
int rules = get_param_int(global.parameters, "rules.owners.force_leave", 0);
|
||||
return (rules&flags) == flags;
|
||||
}
|
||||
|
||||
static void maintain_buildings_1(region * r)
|
||||
|
@ -4373,6 +4356,12 @@ void init_processor(void)
|
|||
{
|
||||
int p;
|
||||
|
||||
while (processors) {
|
||||
processor * next = processors->next;
|
||||
free(processors);
|
||||
processors = next;
|
||||
}
|
||||
|
||||
p = 10;
|
||||
add_proc_global(p, new_units, "Neue Einheiten erschaffen");
|
||||
|
||||
|
@ -4438,8 +4427,8 @@ void init_processor(void)
|
|||
add_proc_unit(p, follow_unit, "Folge auf Einheiten setzen");
|
||||
|
||||
p += 10; /* rest rng again before economics */
|
||||
if (get_param_int(global.parameters, "rules.owners.force_leave", 0)) {
|
||||
add_proc_region(p, force_leave, "kick non-allies out of buildings/ships");
|
||||
if (rule_force_leave(FORCE_LEAVE_ALL)) {
|
||||
add_proc_region(p, do_force_leave, "kick non-allies out of buildings/ships");
|
||||
}
|
||||
add_proc_region(p, economics, "Zerstoeren, Geben, Rekrutieren, Vergessen");
|
||||
add_proc_order(p, K_PROMOTION, promotion_cmd, 0, "Heldenbefoerderung");
|
||||
|
@ -4523,12 +4512,8 @@ void init_processor(void)
|
|||
|
||||
void processorders(void)
|
||||
{
|
||||
static int init = 0;
|
||||
|
||||
if (!init) {
|
||||
init_processor();
|
||||
init = 1;
|
||||
}
|
||||
|
||||
update_spells();
|
||||
process();
|
||||
/*************************************************/
|
||||
|
|
|
@ -105,9 +105,13 @@ extern "C" {
|
|||
bool seefaction(const struct faction *f, const struct region *r,
|
||||
const struct unit *u, int modifier);
|
||||
int armedmen(const struct unit *u, bool siege_weapons);
|
||||
void force_leave(struct region *r);
|
||||
int peasant_luck_effect(int peasants, int luck, int maxp, double variance);
|
||||
|
||||
#define FORCE_LEAVE_POSTCOMBAT 1
|
||||
#define FORCE_LEAVE_ALL 2
|
||||
bool rule_force_leave(int flag);
|
||||
bool help_enter(struct unit *uo, struct unit *u);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#include <platform.h>
|
||||
#include "laws.h"
|
||||
#include "battle.h"
|
||||
|
||||
#include <kernel/ally.h>
|
||||
#include <kernel/config.h>
|
||||
|
@ -230,6 +231,21 @@ static void test_display_cmd(CuTest *tc) {
|
|||
test_cleanup();
|
||||
}
|
||||
|
||||
static void test_rule_force_leave(CuTest *tc) {
|
||||
set_param(&global.parameters, "rules.owners.force_leave", "0");
|
||||
CuAssertIntEquals(tc, false, rule_force_leave(FORCE_LEAVE_ALL));
|
||||
CuAssertIntEquals(tc, false, rule_force_leave(FORCE_LEAVE_POSTCOMBAT));
|
||||
set_param(&global.parameters, "rules.owners.force_leave", "1");
|
||||
CuAssertIntEquals(tc, false, rule_force_leave(FORCE_LEAVE_ALL));
|
||||
CuAssertIntEquals(tc, true, rule_force_leave(FORCE_LEAVE_POSTCOMBAT));
|
||||
set_param(&global.parameters, "rules.owners.force_leave", "2");
|
||||
CuAssertIntEquals(tc, true, rule_force_leave(FORCE_LEAVE_ALL));
|
||||
CuAssertIntEquals(tc, false, rule_force_leave(FORCE_LEAVE_POSTCOMBAT));
|
||||
set_param(&global.parameters, "rules.owners.force_leave", "3");
|
||||
CuAssertIntEquals(tc, true, rule_force_leave(FORCE_LEAVE_ALL));
|
||||
CuAssertIntEquals(tc, true, rule_force_leave(FORCE_LEAVE_POSTCOMBAT));
|
||||
}
|
||||
|
||||
static void test_force_leave_buildings(CuTest *tc) {
|
||||
ally *al;
|
||||
region *r;
|
||||
|
@ -246,8 +262,8 @@ static void test_force_leave_buildings(CuTest *tc) {
|
|||
building_set_owner(u1);
|
||||
u_set_building(u2, b);
|
||||
u_set_building(u3, b);
|
||||
force_leave(r);
|
||||
CuAssertPtrEquals_Msg(tc, "owner should not be forecd to leave", b, u1->building);
|
||||
force_leave(r, NULL);
|
||||
CuAssertPtrEquals_Msg(tc, "owner should not be forced to leave", b, u1->building);
|
||||
CuAssertPtrEquals_Msg(tc, "same faction should not be forced to leave", b, u2->building);
|
||||
CuAssertPtrEquals_Msg(tc, "non-allies should be forced to leave", NULL, u3->building);
|
||||
msg = test_get_last_message(u3->faction->msgs);
|
||||
|
@ -256,7 +272,7 @@ static void test_force_leave_buildings(CuTest *tc) {
|
|||
u_set_building(u3, b);
|
||||
al = ally_add(&u1->faction->allies, u3->faction);
|
||||
al->status = HELP_GUARD;
|
||||
force_leave(r);
|
||||
force_leave(r, NULL);
|
||||
CuAssertPtrEquals_Msg(tc, "allies should not be forced to leave", b, u3->building);
|
||||
test_cleanup();
|
||||
}
|
||||
|
@ -274,7 +290,7 @@ static void test_force_leave_ships(CuTest *tc) {
|
|||
u_set_ship(u1, sh);
|
||||
u_set_ship(u2, sh);
|
||||
ship_set_owner(u1);
|
||||
force_leave(r);
|
||||
force_leave(r, NULL);
|
||||
CuAssertPtrEquals_Msg(tc, "non-allies should be forced to leave", NULL, u2->ship);
|
||||
msg = test_get_last_message(u2->faction->msgs);
|
||||
CuAssertStrEquals(tc, "force_leave_ship", test_get_messagetype(msg));
|
||||
|
@ -293,7 +309,7 @@ static void test_force_leave_ships_on_ocean(CuTest *tc) {
|
|||
u_set_ship(u1, sh);
|
||||
u_set_ship(u2, sh);
|
||||
ship_set_owner(u1);
|
||||
force_leave(r);
|
||||
force_leave(r, NULL);
|
||||
CuAssertPtrEquals_Msg(tc, "no forcing out of ships on oceans", sh, u2->ship);
|
||||
test_cleanup();
|
||||
}
|
||||
|
@ -779,6 +795,7 @@ CuSuite *get_laws_suite(void)
|
|||
SUITE_ADD_TEST(suite, test_enter_building);
|
||||
SUITE_ADD_TEST(suite, test_enter_ship);
|
||||
SUITE_ADD_TEST(suite, test_display_cmd);
|
||||
SUITE_ADD_TEST(suite, test_rule_force_leave);
|
||||
SUITE_ADD_TEST(suite, test_force_leave_buildings);
|
||||
SUITE_ADD_TEST(suite, test_force_leave_ships);
|
||||
SUITE_ADD_TEST(suite, test_force_leave_ships_on_ocean);
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -114,8 +114,18 @@ const char *combatstatus[] = {
|
|||
const char *report_kampfstatus(const unit * u, const struct locale *lang)
|
||||
{
|
||||
static char fsbuf[64]; // FIXME: static return value
|
||||
const char * status = LOC(lang, combatstatus[u->status]);
|
||||
|
||||
strlcpy(fsbuf, LOC(lang, combatstatus[u->status]), sizeof(fsbuf));
|
||||
if (!status) {
|
||||
const char *lname = locale_name(lang);
|
||||
struct locale *wloc = get_or_create_locale(lname);
|
||||
log_error("no translation for combat status %s in %s", combatstatus[u->status], lname);
|
||||
locale_setstring(wloc, combatstatus[u->status], combatstatus[u->status]);
|
||||
strlcpy(fsbuf, combatstatus[u->status], sizeof(fsbuf));
|
||||
}
|
||||
else {
|
||||
strlcpy(fsbuf, status, sizeof(fsbuf));
|
||||
}
|
||||
if (fval(u, UFL_NOAID)) {
|
||||
strcat(fsbuf, ", ");
|
||||
strcat(fsbuf, LOC(lang, "status_noaid"));
|
||||
|
|
|
@ -31,6 +31,7 @@ size_t strlcpy(char *dst, const char *src, size_t siz)
|
|||
register const char *s = src;
|
||||
register size_t n = siz;
|
||||
|
||||
assert(src && dst);
|
||||
/* Copy as many bytes as will fit */
|
||||
if (n != 0 && --n != 0) {
|
||||
do {
|
||||
|
|
Loading…
Reference in New Issue