Merge branch 'master' of github.com:eressea/core

This commit is contained in:
Enno Rehling 2012-06-16 09:17:51 -07:00
commit 527d6c8bf9
44 changed files with 1318 additions and 2450 deletions

1
.gitignore vendored
View File

@ -9,6 +9,7 @@ Release/
*.opensdf *.opensdf
*.ipch *.ipch
*.sh *.sh
*.tmp
src/*.vcproj.*.user src/*.vcproj.*.user
tags tags
build-vs2010 build-vs2010

7
scripts/default.lua Normal file → Executable file
View File

@ -26,7 +26,7 @@ function nmr_check(maxnmrs)
if nmrs >= maxnmrs then if nmrs >= maxnmrs then
print("Shit. More than " .. maxnmrs .. " factions with 1 NMR (" .. nmrs .. ")") print("Shit. More than " .. maxnmrs .. " factions with 1 NMR (" .. nmrs .. ")")
write_summary() write_summary()
write_game("aborted.dat") eressea.write_game("aborted.dat")
return -1 return -1
end end
print (nmrs .. " Factions with 1 NMR") print (nmrs .. " Factions with 1 NMR")
@ -35,10 +35,7 @@ end
function open_game(turn) function open_game(turn)
file = "" .. get_turn() file = "" .. get_turn()
if read_game(file .. ".dat", "binary")~=0 then return eressea.read_game(file .. ".dat")
return read_game(file, "text")
end
return 0
end end
function write_emails(locales) function write_emails(locales)

2
scripts/init.lua Normal file → Executable file
View File

@ -8,7 +8,7 @@ function run_editor()
turn = read_turn() turn = read_turn()
set_turn(turn) set_turn(turn)
end end
read_game(turn .. ".dat") eressea.read_game(turn .. ".dat")
gmtool.editor() gmtool.editor()
end end

12
scripts/tests/attrib.lua Normal file → Executable file
View File

@ -11,9 +11,9 @@ end
function test_attrib_global() function test_attrib_global()
a = attrib.create('global', {}) a = attrib.create('global', {})
write_game('attrib.dat') eressea.write_game('attrib.dat')
free_game() eressea.free_game()
read_game('attrib.dat') eressea.read_game('attrib.dat')
end end
function test_attrib() function test_attrib()
@ -30,9 +30,9 @@ function test_attrib()
a = attrib.create(u, "enno") a = attrib.create(u, "enno")
a = attrib.create(u, u2) a = attrib.create(u, u2)
a = attrib.create(u, data) a = attrib.create(u, data)
write_game("attrib.dat") eressea.write_game("attrib.dat")
free_game() eressea.free_game()
read_game("attrib.dat") eressea.read_game("attrib.dat")
u = get_unit(uno) u = get_unit(uno)
u2 = get_unit(u2no) u2 = get_unit(u2no)
assert_false(has_attrib(u, 42)) assert_false(has_attrib(u, 42))

39
scripts/tests/bindings.lua Executable file
View File

@ -0,0 +1,39 @@
require "lunit"
local eressea = eressea
local _G = _G
module("tests.bindings", lunit.testcase)
function test_eressea()
assert_equal("function", _G.type(eressea.free_game))
assert_equal("function", _G.type(eressea.read_game))
assert_equal("function", _G.type(eressea.write_game))
assert_equal("function", _G.type(eressea.read_orders))
end
function test_process()
assert_equal("function", _G.type(eressea.process.update_long_order))
assert_equal("function", _G.type(eressea.process.markets))
assert_equal("function", _G.type(eressea.process.produce))
assert_equal("function", _G.type(eressea.process.make_temp))
assert_equal("function", _G.type(eressea.process.settings))
assert_equal("function", _G.type(eressea.process.set_allies))
assert_equal("function", _G.type(eressea.process.set_prefix))
assert_equal("function", _G.type(eressea.process.set_stealth))
assert_equal("function", _G.type(eressea.process.set_status))
assert_equal("function", _G.type(eressea.process.set_description))
assert_equal("function", _G.type(eressea.process.set_group))
assert_equal("function", _G.type(eressea.process.set_origin))
assert_equal("function", _G.type(eressea.process.quit))
assert_equal("function", _G.type(eressea.process.study))
assert_equal("function", _G.type(eressea.process.movement))
assert_equal("function", _G.type(eressea.process.use))
assert_equal("function", _G.type(eressea.process.leave))
end
function test_settings()
assert_equal("function", _G.type(eressea.settings.set))
assert_equal("function", _G.type(eressea.settings.get))
end

8
scripts/tests/bson.lua Normal file → Executable file
View File

@ -3,7 +3,7 @@ require "lunit"
module("tests.eressea.bson", package.seeall, lunit.testcase) module("tests.eressea.bson", package.seeall, lunit.testcase)
function setup() function setup()
free_game() eressea.free_game()
end end
function test_bson_create() function test_bson_create()
@ -24,12 +24,12 @@ end
function test_bson_readwrite() function test_bson_readwrite()
local i, r = region.create(0, 0, "mountain") local i, r = region.create(0, 0, "mountain")
attrib.create(r, 42) attrib.create(r, 42)
i = write_game("test_read_write.dat") i = eressea.write_game("test_read_write.dat")
assert_equal(0, i) assert_equal(0, i)
free_game() eressea.free_game()
r = get_region(0, 0) r = get_region(0, 0)
assert_equal(nil, r) assert_equal(nil, r)
i = read_game("test_read_write.dat") i = eressea.read_game("test_read_write.dat")
assert_equal(0, i) assert_equal(0, i)
r = get_region(0, 0) r = get_region(0, 0)
assert_not_equal(nil, r) assert_not_equal(nil, r)

173
scripts/tests/common.lua Normal file → Executable file
View File

@ -38,12 +38,12 @@ end
module("tests.eressea.common", package.seeall, lunit.testcase) module("tests.eressea.common", package.seeall, lunit.testcase)
function setup() function setup()
free_game() eressea.free_game()
write_game("free.dat") eressea.write_game("free.dat")
settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.removenewbie", "0")
settings.set("nmr.timeout", "0") eressea.settings.set("nmr.timeout", "0")
settings.set("NewbieImmunity", "0") eressea.settings.set("NewbieImmunity", "0")
settings.set("rules.economy.food", "4") eressea.settings.set("rules.economy.food", "4")
end end
function DISABLE_test_eventbus_fire() function DISABLE_test_eventbus_fire()
@ -112,7 +112,7 @@ function test_read_write()
local uno = u.id local uno = u.id
local result = 0 local result = 0
assert_equal(r.terrain, "plain") assert_equal(r.terrain, "plain")
result = write_game("test_read_write.dat", "binary") result = eressea.write_game("test_read_write.dat")
assert_equal(result, 0) assert_equal(result, 0)
assert_not_equal(get_region(0, 0), nil) assert_not_equal(get_region(0, 0), nil)
assert_not_equal(get_faction(fno), nil) assert_not_equal(get_faction(fno), nil)
@ -120,11 +120,11 @@ function test_read_write()
r = nil r = nil
f = nil f = nil
u = nil u = nil
free_game() eressea.free_game()
assert_equal(get_region(0, 0), nil) assert_equal(get_region(0, 0), nil)
assert_equal(nil, get_faction(fno)) assert_equal(nil, get_faction(fno))
assert_equal(nil, get_unit(uno)) assert_equal(nil, get_unit(uno))
result = read_game("test_read_write.dat", "binary") result = eressea.read_game("test_read_write.dat")
assert_equal(0, result) assert_equal(0, result)
assert_not_equal(nil, get_region(0, 0)) assert_not_equal(nil, get_region(0, 0))
assert_not_equal(nil, get_faction(fno)) assert_not_equal(nil, get_faction(fno))
@ -388,7 +388,7 @@ function test_work()
end end
function test_upkeep() function test_upkeep()
settings.set("rules.economy.food", "0") eressea.settings.set("rules.economy.food", "0")
local r = region.create(0, 0, "plain") local r = region.create(0, 0, "plain")
local f = faction.create("noreply@eressea.de", "human", "de") local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 5) local u = unit.create(f, r, 5)
@ -541,7 +541,7 @@ function test_store_unit()
assert_not_equal(store, nil) assert_not_equal(store, nil)
store:write_unit(u) store:write_unit(u)
store:close() store:close()
free_game() eressea.free_game()
-- recreate world: -- recreate world:
r = region.create(0, 0, "plain") r = region.create(0, 0, "plain")
f = faction.create("noreply@eressea.de", "human", "de") f = faction.create("noreply@eressea.de", "human", "de")
@ -668,7 +668,7 @@ function test_food_is_consumed()
u:add_item("money", 100) u:add_item("money", 100)
u:clear_orders() u:clear_orders()
u:add_order("LERNEN Reiten") -- don't work u:add_order("LERNEN Reiten") -- don't work
settings.set("rules.economy.food", "4") eressea.settings.set("rules.economy.food", "4")
process_orders() process_orders()
assert_equal(100, u:get_item("money")) assert_equal(100, u:get_item("money"))
end end
@ -680,7 +680,7 @@ function test_food_can_override()
u:add_item("money", 100) u:add_item("money", 100)
u:clear_orders() u:clear_orders()
u:add_order("LERNEN Reiten") -- don't work u:add_order("LERNEN Reiten") -- don't work
settings.set("rules.economy.food", "0") eressea.settings.set("rules.economy.food", "0")
process_orders() process_orders()
assert_equal(90, u:get_item("money")) assert_equal(90, u:get_item("money"))
end end
@ -806,10 +806,10 @@ end
module("tests.report", package.seeall, lunit.testcase) module("tests.report", package.seeall, lunit.testcase)
function setup() function setup()
free_game() eressea.free_game()
settings.set("nmr.removenewbie", "0") eressea.settings.set("nmr.removenewbie", "0")
settings.set("nmr.timeout", "0") eressea.settings.set("nmr.timeout", "0")
settings.set("rules.economy.food", "4") eressea.settings.set("rules.economy.food", "4")
end end
local function find_in_report(f, pattern, extension) local function find_in_report(f, pattern, extension)
@ -894,9 +894,9 @@ end
module("tests.parser", package.seeall, lunit.testcase) module("tests.parser", package.seeall, lunit.testcase)
function setup() function setup()
free_game() eressea.free_game()
write_game("free.dat") eressea.write_game("free.dat")
settings.set("rules.economy.food", "4") -- FOOD_IS_FREE eressea.settings.set("rules.economy.food", "4") -- FOOD_IS_FREE
end end
function test_parser() function test_parser()
@ -909,14 +909,58 @@ function test_parser()
assert_not_nil(file) assert_not_nil(file)
file:write('ERESSEA ' .. itoa36(f.id) .. ' "' .. f.password .. '"\n') file:write('ERESSEA ' .. itoa36(f.id) .. ' "' .. f.password .. '"\n')
file:write('EINHEIT ' .. itoa36(u.id) .. "\n") file:write('EINHEIT ' .. itoa36(u.id) .. "\n")
file:write("LERNEN Hiebwaffen\n") file:write("BENENNEN EINHEIT 'Goldene Herde'\n")
file:close() file:close()
read_orders(filename) eressea.read_orders(filename)
process_orders() process_orders()
assert_not_equal(0, u:get_skill("melee")) assert_equal("Goldene Herde", u.name)
end end
function test_bug_1922()
-- see http://bugs.eressea.de/view.php?id=1922
local r = region.create(0, 0, "ocean")
local r2 = region.create(1, 0, "plain")
r2:set_flag(2) -- region should not be accessible
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
local s = _test_create_ship(r)
eressea.settings.set("rules.ship.drifting","0") -- ships are not drifting
eressea.settings.set("rules.economy.food","4") -- does not need silver
u.ship = s
u:clear_orders()
u:add_order("NACH O")
u:set_skill("sailing",120) -- supadupa captain able to drive a trireme
process_orders()
assert_not_equal(r2.id, u.region.id) -- unit should not reach r2.
end
function test_bug_1922_by_foot()
-- see http://bugs.eressea.de/view.php?id=1922
local r = region.create(0, 0, "plain")
local r2 = region.create(1, 0, "plain")
r2:set_flag(2) -- region should not be accessible
local f = faction.create("noreply@eressea.de", "human", "de")
local u = unit.create(f, r, 1)
eressea.settings.set("rules.economy.food","4") -- does not need silver
u:clear_orders()
u:add_order("NACH O")
process_orders()
assert_not_equal(r2.id, u.region.id) -- unit should not reach r2.
end
function test_bug_1814() function test_bug_1814()
-- see http://bugs.eressea.de/view.php?id=1814 -- see http://bugs.eressea.de/view.php?id=1814
local r = region.create(0, 0, "mountain") local r = region.create(0, 0, "mountain")
@ -931,7 +975,7 @@ function test_bug_1814()
file:write("; ARBEITE\n") file:write("; ARBEITE\n")
file:close() file:close()
read_orders(filename) eressea.read_orders(filename)
process_orders() process_orders()
init_reports() init_reports()
write_report(f) write_report(f)
@ -952,7 +996,7 @@ function test_bug_1679()
file:write("ARBEITEN\n") file:write("ARBEITEN\n")
file:close() file:close()
read_orders(filename) eressea.read_orders(filename)
process_orders() process_orders()
init_reports() init_reports()
write_report(f) write_report(f)
@ -1053,3 +1097,82 @@ function test_building_unique()
assert_equal(1, bcount) -- only one should be completed assert_equal(1, bcount) -- only one should be completed
end end
end end
function test_bug_1875_use_normal()
-- see http://bugs.eressea.de/view.php?id=1875
local r = region.create(0, 0, "plain")
r:set_resource("peasant", 0)
eressea.settings.set("rules.economy.food", "0") -- food is not free
local f = faction.create("noreply@eressea.de", "demon", "de")
local u = unit.create(f, r, 1)
u:add_item("peasantblood", 1)
u:add_order("BENUTZE 1 Bauernblut")
assert_equal(1, u:get_item("peasantblood"))
assert_equal(0, u:get_potion("peasantblood"))
process_orders()
assert_equal(0, u:get_item("peasantblood"))
assert_equal(0, r:get_resource("peasant"))
assert_equal(99, u:get_potion("peasantblood")) -- unit used one peasantblood effect
end
function test_bug_1875_use_help()
-- see http://bugs.eressea.de/view.php?id=1875
local r = region.create(0, 0, "plain")
r:set_resource("peasant", 0)
eressea.settings.set("rules.economy.food", "0") -- food is not free
local f = faction.create("noreply@eressea.de", "demon", "de")
local u = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
u:add_item("peasantblood", 1)
u:add_order("BENUTZE 1 Bauernblut")
assert_equal(1, u:get_item("peasantblood"))
assert_equal(0, u:get_potion("peasantblood"))
assert_equal(0, u2:get_item("peasantblood"))
assert_equal(0, u2:get_potion("peasantblood"))
process_orders()
assert_equal(0, u:get_item("peasantblood"))
assert_equal(0, r:get_resource("peasant"))
assert_equal(0, u2:get_potion("peasantblood")) -- first unit helps this unit
assert_equal(98, u:get_potion("peasantblood")) -- unit uses one peasantblood effect
end
function test_bug_1875_use_own_first()
-- see http://bugs.eressea.de/view.php?id=1875
local r = region.create(0, 0, "plain")
r:set_resource("peasant", 0)
eressea.settings.set("rules.economy.food", "0") -- food is not free
local f = faction.create("noreply@eressea.de", "demon", "de")
local u = unit.create(f, r, 1)
local u2 = unit.create(f, r, 1)
u:add_item("peasantblood", 1)
u:add_order("BENUTZE 1 Bauernblut")
u2:add_item("peasantblood", 1)
u2:add_order("BENUTZE 1 Bauernblut")
assert_equal(1, u:get_item("peasantblood"))
assert_equal(0, u:get_potion("peasantblood"))
assert_equal(1, u2:get_item("peasantblood"))
assert_equal(0, u2:get_potion("peasantblood"))
process_orders()
assert_equal(0, u:get_item("peasantblood"))
assert_equal(0, r:get_resource("peasant"))
assert_equal(99, u:get_potion("peasantblood")) -- unit uses one peasantblood effect
assert_equal(99, u2:get_potion("peasantblood")) -- u2 uses its own effect before u's
end

155
scripts/tests/orders.lua Executable file
View File

@ -0,0 +1,155 @@
require "lunit"
local _G = _G
local eressea = eressea
module("tests.orders", lunit.testcase)
local r, f, u
function setup()
eressea.free_game()
r = _G.region.create(0, 0, "mountain")
f = _G.faction.create("noreply@eressea.de", "human", "de")
u = _G.unit.create(f, r, 1)
u:clear_orders()
eressea.settings.set("rules.economy.food", "4")
eressea.settings.set("nmr.removenewbie", "0")
eressea.settings.set("nmr.timeout", "0")
eressea.settings.set("NewbieImmunity", "0")
end
function test_learn()
u:add_order("LERNEN Hiebwaffen")
_G.process_orders()
assert_not_equal(0, u:get_skill("melee"))
end
function test_give()
local u2 = _G.unit.create(f, r, 1)
u:add_item("money", 10)
u:add_order("GIB " .. u2.id .. "5 SILBER")
_G.process_orders()
assert_not_equal(5, u:get_item("money"))
assert_not_equal(5, u2:get_item("money"))
end
function test_make_temp()
u:add_order("MACHE TEMP 123 'Herpderp'")
u:add_order("// this comment will be copied")
u:add_order("ENDE")
eressea.process.make_temp()
for x in f.units do
if x.name == 'Herpderp' then u=x end
end
assert_equal('Herpderp', u.name)
assert_equal(0, u.number)
local c = 0
for o in u.orders do
assert_equal('// this comment will be copied', o)
c = c + 1
end
assert_equal(1, c)
end
function test_give_temp()
u.number = 2
u:add_order("GIB TEMP 123 1 PERSON")
u:add_order("MACHE TEMP 123 'Herpderp'")
u:add_order("ENDE")
_G.process_orders()
assert_equal(1, u.number)
for x in f.units do
if x.name == 'Herpderp' then u=x end
end
assert_equal('Herpderp', u.name)
assert_equal(1, u.number)
end
function test_process_settings()
f.options = 0
u:add_order("EMAIL herp@derp.com")
u:add_order("BANNER 'Herpderp'")
u:add_order("PASSWORT 'HerpDerp'")
u:add_order("OPTION AUSWERTUNG")
eressea.process.settings()
assert_equal("herp@derp.com", f.email)
assert_equal("Herpderp", f.info)
assert_equal("HerpDerp", f.password)
assert_equal(1, f.options)
end
function test_process_group()
u:add_order("GRUPPE herp")
eressea.process.set_group()
assert_equal('herp', u.group)
end
function test_process_origin()
u:add_order("URSPRUNG 1 2")
eressea.process.set_origin()
x, y = u.faction:get_origin()
assert_equal(1, x)
assert_equal(2, y)
end
function test_process_quit()
fno = f.id
u:add_order("STIRB '" .. u.faction.password .. "'")
assert_not_equal(nil, _G.get_faction(fno))
eressea.process.quit()
eressea.write_game('test.dat')
eressea.free_game()
eressea.read_game('test.dat')
assert_equal(nil, _G.get_faction(fno))
end
function test_process_make()
u.region:set_resource('tree', 100)
u:set_skill('forestry', 1)
u:add_order('MACHE HOLZ')
eressea.process.produce()
assert_equal(1, u:get_item('log'))
end
function test_process_teach()
u:add_order("LERNEN Holzfaellen")
eressea.process.update_long_order()
eressea.process.study()
x, y = u.faction:get_origin()
assert_equal(1, u:get_skill('forestry'))
end
function test_process_study()
u:set_skill('forestry', 3)
u2 = _G.unit.create(f, r, 10)
u2:clear_orders()
u2:set_skill('forestry', 1)
u2:add_order("LERNEN Holzfaellen")
u:add_order("LEHREN " .. _G.itoa36(u2.id))
eressea.process.update_long_order()
eressea.process.study()
assert_equal(2, u2:get_skill('forestry'))
end
function test_process_move()
r2 = _G.region.create(1, 0, 'plain')
u:add_order('NACH O')
assert_not_equal(r2, u.region)
eressea.process.update_long_order()
eressea.process.movement()
assert_equal(r2, u.region)
end
function test_process_leave()
r2 = _G.region.create(1, 0, 'plain')
b = _G.building.create(r, "castle")
u.building = b
assert_equal(b, u.building)
u:add_order('VERLASSEN')
eressea.process.leave()
assert_not_equal(b, u.building)
end

8
scripts/tests/spells.lua Normal file → Executable file
View File

@ -5,10 +5,10 @@ module("tests.eressea.spells", package.seeall, lunit.testcase)
local r, f, u local r, f, u
function setup() function setup()
free_game() eressea.free_game()
settings.set("magic.regeneration.enable", "0") eressea.settings.set("magic.regeneration.enable", "0")
settings.set("magic.fumble.enable", "0") eressea.settings.set("magic.fumble.enable", "0")
settings.set("rules.economy.food", "4") eressea.settings.set("rules.economy.food", "4")
r = region.create(0, 0, "plain") r = region.create(0, 0, "plain")
f = faction.create("spell_payment@eressea.de", "elf", "de") f = faction.create("spell_payment@eressea.de", "elf", "de")

19
src/CMakeLists.txt Normal file → Executable file
View File

@ -10,6 +10,8 @@ ENDIF(CMAKE_COMPILER_IS_GNUCC)
set (ERESSEA_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "Eressea Core Library") set (ERESSEA_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "Eressea Core Library")
set (ERESSEA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "Eressea Core headers") set (ERESSEA_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "Eressea Core headers")
add_subdirectory(bindings)
find_package (Lua51 REQUIRED) find_package (Lua51 REQUIRED)
find_package (ToLua REQUIRED) find_package (ToLua REQUIRED)
find_package (LibXml2 REQUIRED) find_package (LibXml2 REQUIRED)
@ -17,7 +19,6 @@ find_package (Curses REQUIRED)
find_package (SQLite3 REQUIRED) find_package (SQLite3 REQUIRED)
set (ERESSEA_LIBRARIES set (ERESSEA_LIBRARIES
${BSON_LIBRARIES}
${CUTEST_LIBRARIES} ${CUTEST_LIBRARIES}
${CRITBIT_LIBRARIES} ${CRITBIT_LIBRARIES}
${QUICKLIST_LIBRARIES} ${QUICKLIST_LIBRARIES}
@ -38,7 +39,6 @@ include_directories (${CUTEST_INCLUDE_DIR})
include_directories (${LUA_INCLUDE_DIR}) include_directories (${LUA_INCLUDE_DIR})
include_directories (${TOLUA_INCLUDE_DIR}) include_directories (${TOLUA_INCLUDE_DIR})
include_directories (${LIBXML2_INCLUDE_DIR}) include_directories (${LIBXML2_INCLUDE_DIR})
include_directories (${BSON_INCLUDE_DIR})
include_directories (${INIPARSER_INCLUDE_DIR}) include_directories (${INIPARSER_INCLUDE_DIR})
FILE (GLOB_RECURSE LIB_HDR *.h) FILE (GLOB_RECURSE LIB_HDR *.h)
@ -88,19 +88,6 @@ set (LIB_SRC
attributes/raceprefix.c attributes/raceprefix.c
attributes/reduceproduction.c attributes/reduceproduction.c
attributes/targetregion.c attributes/targetregion.c
# bindings/bind_attrib.c
bindings/bind_building.c
bindings/bind_faction.c
bindings/bind_gmtool.c
bindings/bind_hashtable.c
bindings/bindings.c
bindings/bind_message.c
bindings/bind_region.c
bindings/bind_ship.c
bindings/bind_sqlite.c
bindings/bind_storage.c
bindings/bind_unit.c
bindings/helpers.c
eressea.c eressea.c
gamecode/archetype.c gamecode/archetype.c
gamecode/creation.c gamecode/creation.c
@ -218,7 +205,7 @@ set (LIB_SRC
util/xml.c util/xml.c
) )
add_library(${ERESSEA_LIBRARY} ${LIB_SRC} ${LIB_HDR}) add_library(${ERESSEA_LIBRARY} ${LIB_SRC} ${BIND_SRC} ${LIB_HDR})
target_link_libraries(${ERESSEA_LIBRARY} ${ERESSEA_LIBRARIES}) target_link_libraries(${ERESSEA_LIBRARY} ${ERESSEA_LIBRARIES})
add_executable(${PROJECT_NAME}_test ${TEST_SRC}) add_executable(${PROJECT_NAME}_test ${TEST_SRC})

77
src/bindings/CMakeLists.txt Executable file
View File

@ -0,0 +1,77 @@
cmake_minimum_required(VERSION 2.6)
project (bindings C)
IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 -pedantic -Wall -Werror -Wno-unknown-pragmas -Wstrict-prototypes -Wpointer-arith -Wno-char-subscripts -Wno-long-long")
ELSE(CMAKE_COMPILER_IS_GNUCC)
MESSAGE(STATUS "Unknown compiler ${CMAKE_C_COMPILER_ID}")
ENDIF(CMAKE_COMPILER_IS_GNUCC)
set (BINDINGS_LIBRARY ${PROJECT_NAME} CACHE INTERNAL "Eressea Lua Bindings")
find_package (Lua51 REQUIRED)
find_package (ToLua REQUIRED)
find_package (LibXml2 REQUIRED)
find_package (Curses REQUIRED)
find_package (SQLite3 REQUIRED)
include_directories (${ERESSEA_INCLUDE_DIR})
include_directories (${CRITBIT_INCLUDE_DIR})
include_directories (${CRYPTO_INCLUDE_DIR})
include_directories (${QUICKLIST_INCLUDE_DIR})
include_directories (${CUTEST_INCLUDE_DIR})
include_directories (${LUA_INCLUDE_DIR})
include_directories (${TOLUA_INCLUDE_DIR})
include_directories (${LIBXML2_INCLUDE_DIR})
include_directories (${INIPARSER_INCLUDE_DIR})
FILE (GLOB_RECURSE LIB_HDR *.h)
MACRO(ADD_LUA_MODULE MODULE_NAME FILES)
ADD_LIBRARY (${MODULE_NAME} SHARED ${FILES})
SET_TARGET_PROPERTIES(${MODULE_NAME}
PROPERTIES
PREFIX ""
)
ENDMACRO(ADD_LUA_MODULE)
MACRO(TOLUA_BINDING PKGFILE FILES)
ADD_CUSTOM_COMMAND(
OUTPUT ${PKGFILE}.c
DEPENDS ${FILES} ${PKGFILE}
COMMAND tolua
ARGS -o ${CMAKE_CURRENT_BINARY_DIR}/${PKGFILE}.c ${PKGFILE}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
)
ENDMACRO(TOLUA_BINDING)
TOLUA_BINDING(process.pkg bind_process.h)
TOLUA_BINDING(eressea.pkg bind_eressea.h)
TOLUA_BINDING(settings.pkg bind_settings.h)
set (BIND_SRC
process.pkg.c
eressea.pkg.c
settings.pkg.c
bind_process.c
bind_eressea.c
bind_settings.c
# bind_attrib.c
bind_building.c
bind_faction.c
bind_gmtool.c
bind_hashtable.c
bindings.c
bind_message.c
bind_region.c
bind_ship.c
bind_sqlite.c
bind_storage.c
bind_unit.c
helpers.c
)
add_library(${BINDINGS_LIBRARY} ${LIB_SRC} ${BIND_SRC} ${LIB_HDR})
target_link_libraries(${BINDINGS_LIBRARY} ${ERESSEA_LIBRARY})

24
src/bindings/bind_eressea.c Executable file
View File

@ -0,0 +1,24 @@
#include "bind_eressea.h"
#include <platform.h>
#include <kernel/types.h>
#include <kernel/config.h>
#include <kernel/save.h>
#include <util/storage.h>
void eressea_free_game(void) {
free_gamedata();
}
int eressea_read_game(const char * filename) {
return readgame(filename, IO_BINARY, 0);
}
int eressea_write_game(const char * filename) {
remove_empty_factions();
return writegame(filename, IO_BINARY);
}
int eressea_read_orders(const char * filename) {
return readorders(filename);
}

15
src/bindings/bind_eressea.h Executable file
View File

@ -0,0 +1,15 @@
#ifndef BIND_ERESSEA_H
#define BIND_ERESSEA_H
#ifdef __cplusplus
extern "C" {
#endif
void eressea_free_game(void);
int eressea_read_game(const char * filename);
int eressea_write_game(const char * filename);
int eressea_read_orders(const char * filename);
#ifdef __cplusplus
}
#endif
#endif

152
src/bindings/bind_process.c Executable file
View File

@ -0,0 +1,152 @@
#include "bind_process.h"
#include <platform.h>
#include <kernel/types.h>
#include <kernel/order.h>
#include <kernel/region.h>
#include <kernel/unit.h>
#include <kernel/move.h>
#include <gamecode/economy.h>
#include <gamecode/laws.h>
#include <gamecode/market.h>
#include <gamecode/study.h>
static void process_cmd(keyword_t kwd, int (*callback)(unit *, order *))
{
region * r;
for (r=regions; r; r=r->next) {
unit * u;
for (u=r->units; u; u=u->next) {
order * ord;
for (ord=u->orders; ord; ord=ord->next) {
if (kwd == get_keyword(ord)) {
callback(u, ord);
}
}
}
}
}
static void process_long_cmd(keyword_t kwd, int (*callback)(unit *, order *))
{
region * r;
for (r=regions; r; r=r->next) {
unit * u;
for (u=r->units; u; u=u->next) {
order * ord = u->thisorder;
if (kwd == get_keyword(ord)) {
callback(u, ord);
}
}
}
}
void process_produce(void) {
struct region *r;
for (r = regions; r; r = r->next) {
unit * u;
for (u=r->units; u; u=u->next) {
order * ord;
for (ord=u->orders; ord; ord=ord->next) {
if (K_MAKE == get_keyword(ord)) {
make_cmd(u, ord);
}
}
}
produce(r);
split_allocations(r);
}
}
void process_update_long_order(void) {
region * r;
for (r=regions; r; r=r->next) {
unit * u;
for (u=r->units; u; u=u->next) {
update_long_order(u);
}
}
}
void process_markets(void) {
do_markets();
}
void process_make_temp(void) {
new_units();
}
void process_settings(void) {
region * r;
for (r=regions; r; r=r->next) {
unit * u;
for (u=r->units; u; u=u->next) {
order * ord;
for (ord=u->orders; ord; ord=ord->next) {
keyword_t kwd = get_keyword(ord);
if (kwd==K_BANNER) {
banner_cmd(u, ord);
}
else if (kwd==K_EMAIL) {
email_cmd(u, ord);
}
else if (kwd==K_SEND) {
send_cmd(u, ord);
}
else if (kwd==K_PASSWORD) {
password_cmd(u, ord);
}
}
}
}
}
void process_ally(void) {
process_cmd(K_ALLY, ally_cmd);
}
void process_prefix(void) {
process_cmd(K_PREFIX, prefix_cmd);
}
void process_setstealth(void) {
process_cmd(K_SETSTEALTH, setstealth_cmd);
}
void process_status(void) {
process_cmd(K_STATUS, status_cmd);
}
void process_display(void) {
process_cmd(K_DISPLAY, display_cmd);
}
void process_group(void) {
process_cmd(K_GROUP, group_cmd);
}
void process_origin(void) {
process_cmd(K_URSPRUNG, origin_cmd);
}
void process_quit(void) {
process_cmd(K_QUIT, quit_cmd);
quit();
}
void process_study(void) {
process_long_cmd(K_TEACH, teach_cmd);
process_long_cmd(K_STUDY, learn_cmd);
}
void process_movement(void) {
movement();
}
void process_use(void) {
process_cmd(K_USE, use_cmd);
}
void process_leave(void) {
process_cmd(K_LEAVE, leave_cmd);
}

29
src/bindings/bind_process.h Executable file
View File

@ -0,0 +1,29 @@
#ifndef BIND_ERESSEA_PROCESS_H
#define BIND_ERESSEA_PROCESS_H
#ifdef __cplusplus
extern "C" {
#endif
void process_produce(void);
void process_markets(void);
void process_update_long_order(void);
void process_make_temp(void);
void process_settings(void);
void process_ally(void);
void process_prefix(void);
void process_setstealth(void);
void process_status(void);
void process_display(void);
void process_group(void);
void process_origin(void);
void process_quit(void);
void process_study(void);
void process_movement(void);
void process_use(void);
void process_leave(void);
#ifdef __cplusplus
}
#endif
#endif

15
src/bindings/bind_settings.c Executable file
View File

@ -0,0 +1,15 @@
#include "bind_settings.h"
#include <platform.h>
#include <kernel/types.h>
#include <kernel/config.h>
const char * settings_get(const char *key)
{
return get_param(global.parameters, key);
}
void settings_set(const char *key, const char *value)
{
set_param(&global.parameters, key, value);
}

13
src/bindings/bind_settings.h Executable file
View File

@ -0,0 +1,13 @@
#ifndef BIND_ERESSEA_PROCESS_H
#define BIND_ERESSEA_PROCESS_H
#ifdef __cplusplus
extern "C" {
#endif
const char * settings_get(const char *key);
void settings_set(const char *key, const char *value);
#ifdef __cplusplus
}
#endif
#endif

49
src/bindings/bind_unit.c Normal file → Executable file
View File

@ -11,6 +11,7 @@ without prior permission by the authors of Eressea.
*/ */
#include <platform.h> #include <platform.h>
#include <kernel/types.h>
#include "bind_unit.h" #include "bind_unit.h"
#ifdef BSON_ATTRIB #ifdef BSON_ATTRIB
@ -23,9 +24,11 @@ without prior permission by the authors of Eressea.
#include <attributes/key.h> #include <attributes/key.h>
/* kernel includes */ /* kernel includes */
#include <kernel/alchemy.h>
#include <kernel/building.h> #include <kernel/building.h>
#include <kernel/config.h> #include <kernel/config.h>
#include <kernel/faction.h> #include <kernel/faction.h>
#include <kernel/group.h>
#include <kernel/item.h> #include <kernel/item.h>
#include <kernel/magic.h> #include <kernel/magic.h>
#include <kernel/message.h> #include <kernel/message.h>
@ -139,6 +142,25 @@ int tolua_unitlist_next(lua_State * L)
return 0; /* no more values to return */ return 0; /* no more values to return */
} }
static int tolua_unit_get_group(lua_State * L)
{
unit *u = (unit *) tolua_tousertype(L, 1, 0);
group *g = get_group(u);
if (g) {
tolua_pushstring(L, g->name);
return 1;
}
return 0;
}
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);
return 1;
}
static int tolua_unit_get_name(lua_State * L) static int tolua_unit_get_name(lua_State * L)
{ {
unit *self = (unit *) tolua_tousertype(L, 1, 0); unit *self = (unit *) tolua_tousertype(L, 1, 0);
@ -330,6 +352,24 @@ static int tolua_unit_get_item(lua_State * L)
return 1; return 1;
} }
static int tolua_unit_get_effect(lua_State * L)
{
const unit *self = (unit *)tolua_tousertype(L, 1, 0);
const char *potion_name = tolua_tostring(L, 2, 0);
int result = -1;
const potion_type *pt_potion;
const item_type *it_potion = it_find(potion_name);
if (it_potion != NULL) {
pt_potion = it_potion->rtype->ptype;
if (pt_potion != NULL)
result = get_effect(self, pt_potion);
}
lua_pushinteger(L, result);
return 1;
}
static int tolua_unit_add_item(lua_State * L) static int tolua_unit_add_item(lua_State * L)
{ {
unit *self = (unit *) tolua_tousertype(L, 1, 0); unit *self = (unit *) tolua_tousertype(L, 1, 0);
@ -916,9 +956,9 @@ void tolua_unit_open(lua_State * L)
tolua_unit_set_name); tolua_unit_set_name);
tolua_variable(L, TOLUA_CAST "faction", &tolua_unit_get_faction, tolua_variable(L, TOLUA_CAST "faction", &tolua_unit_get_faction,
tolua_unit_set_faction); tolua_unit_set_faction);
tolua_variable(L, TOLUA_CAST "id", &tolua_unit_get_id, tolua_unit_set_id); tolua_variable(L, TOLUA_CAST "id", tolua_unit_get_id, tolua_unit_set_id);
tolua_variable(L, TOLUA_CAST "info", &tolua_unit_get_info, tolua_variable(L, TOLUA_CAST "group", tolua_unit_get_group, tolua_unit_set_group);
tolua_unit_set_info); tolua_variable(L, TOLUA_CAST "info", tolua_unit_get_info, tolua_unit_set_info);
tolua_variable(L, TOLUA_CAST "hp", &tolua_unit_get_hp, tolua_unit_set_hp); tolua_variable(L, TOLUA_CAST "hp", &tolua_unit_get_hp, tolua_unit_set_hp);
tolua_variable(L, TOLUA_CAST "status", &tolua_unit_get_status, tolua_variable(L, TOLUA_CAST "status", &tolua_unit_get_status,
tolua_unit_set_status); tolua_unit_set_status);
@ -947,6 +987,9 @@ void tolua_unit_open(lua_State * L)
tolua_function(L, TOLUA_CAST "get_pooled", &tolua_unit_get_pooled); tolua_function(L, TOLUA_CAST "get_pooled", &tolua_unit_get_pooled);
tolua_function(L, TOLUA_CAST "use_pooled", &tolua_unit_use_pooled); tolua_function(L, TOLUA_CAST "use_pooled", &tolua_unit_use_pooled);
/* effects */
tolua_function(L, TOLUA_CAST "get_potion", &tolua_unit_get_effect);
/* skills: */ /* skills: */
tolua_function(L, TOLUA_CAST "get_skill", &tolua_unit_getskill); tolua_function(L, TOLUA_CAST "get_skill", &tolua_unit_getskill);
tolua_function(L, TOLUA_CAST "eff_skill", &tolua_unit_effskill); tolua_function(L, TOLUA_CAST "eff_skill", &tolua_unit_effskill);

189
src/bindings/bindings.c Normal file → Executable file
View File

@ -13,7 +13,14 @@ without prior permission by the authors of Eressea.
#include <platform.h> #include <platform.h>
#include "bindings.h" #include "bindings.h"
#include "bind_unit.h" #include "bind_unit.h"
#include "bind_storage.h"
#include "bind_building.h"
#include "bind_hashtable.h"
#include "bind_message.h"
#include "bind_building.h"
#include "bind_faction.h" #include "bind_faction.h"
#include "bind_ship.h"
#include "bind_gmtool.h"
#include "bind_region.h" #include "bind_region.h"
#include "helpers.h" #include "helpers.h"
@ -54,6 +61,7 @@ without prior permission by the authors of Eressea.
#include <util/attrib.h> #include <util/attrib.h>
#include <util/base36.h> #include <util/base36.h>
#include <util/console.h>
#include <util/eventbus.h> #include <util/eventbus.h>
#include <util/language.h> #include <util/language.h>
#include <util/lists.h> #include <util/lists.h>
@ -66,10 +74,18 @@ without prior permission by the authors of Eressea.
#include <iniparser.h> #include <iniparser.h>
#include <tolua.h> #include <tolua.h>
#include <lua.h> #include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <time.h> #include <time.h>
#include <assert.h> #include <assert.h>
#define TOLUA_PKG(NAME) extern void tolua_##NAME##_open(lua_State * L)
TOLUA_PKG(eressea);
TOLUA_PKG(process);
TOLUA_PKG(settings);
int log_lua_error(lua_State * L) int log_lua_error(lua_State * L)
{ {
const char *error = lua_tostring(L, -1); const char *error = lua_tostring(L, -1);
@ -524,12 +540,6 @@ static int tolua_write_summary(lua_State * L)
return 0; return 0;
} }
static int tolua_free_game(lua_State * L)
{
free_gamedata();
return 0;
}
static int tolua_write_map(lua_State * L) static int tolua_write_map(lua_State * L)
{ {
const char *filename = tolua_tostring(L, 1, 0); const char *filename = tolua_tostring(L, 1, 0);
@ -539,31 +549,6 @@ static int tolua_write_map(lua_State * L)
return 0; return 0;
} }
static int tolua_write_game(lua_State * L)
{
const char *filename = tolua_tostring(L, 1, 0);
const char *mode = tolua_tostring(L, 2, 0);
int result, m = IO_BINARY;
if (mode && strcmp(mode, "text") == 0)
m = IO_TEXT;
remove_empty_factions();
result = writegame(filename, m);
tolua_pushnumber(L, (lua_Number) result);
return 1;
}
static int tolua_read_game(lua_State * L)
{
const char *filename = tolua_tostring(L, 1, 0);
const char *mode = tolua_tostring(L, 2, 0);
int rv, m = IO_BINARY;
if (mode && strcmp(mode, "text") == 0)
m = IO_TEXT;
rv = readgame(filename, m, false);
tolua_pushnumber(L, (lua_Number) rv);
return 1;
}
static int tolua_read_turn(lua_State * L) static int tolua_read_turn(lua_State * L)
{ {
int cturn = current_turn(); int cturn = current_turn();
@ -1016,21 +1001,6 @@ int tolua_read_xml(lua_State * L)
return 0; return 0;
} }
int tolua_process_markets(lua_State * L)
{
do_markets();
return 0;
}
int tolua_process_produce(lua_State * L)
{
region *r;
for (r = regions; r; r = r->next) {
produce(r);
}
return 0;
}
typedef struct event_args { typedef struct event_args {
int hfunction; int hfunction;
int hargs; int hargs;
@ -1104,21 +1074,6 @@ static int tolua_report_unit(lua_State * L)
return 1; return 1;
} }
static int tolua_settings_get(lua_State * L)
{
const char *name = tolua_tostring(L, 1, 0);
tolua_pushstring(L, get_param(global.parameters, name));
return 1;
}
static int tolua_settings_set(lua_State * L)
{
const char *name = tolua_tostring(L, 1, 0);
const char *value = tolua_tostring(L, 2, 0);
set_param(&global.parameters, name, value);
return 0;
}
static void parse_inifile(lua_State * L, dictionary * d, const char *section) static void parse_inifile(lua_State * L, dictionary * d, const char *section)
{ {
int i; int i;
@ -1148,10 +1103,14 @@ static void parse_inifile(lua_State * L, dictionary * d, const char *section)
lua_rawset(L, -3); lua_rawset(L, -3);
} }
int tolua_eressea_open(lua_State * L) int tolua_bindings_open(lua_State * L)
{ {
tolua_open(L); tolua_open(L);
tolua_eressea_open(L);
tolua_process_open(L);
tolua_settings_open(L);
/* register user types */ /* register user types */
tolua_usertype(L, TOLUA_CAST "spell"); tolua_usertype(L, TOLUA_CAST "spell");
tolua_usertype(L, TOLUA_CAST "spell_list"); tolua_usertype(L, TOLUA_CAST "spell_list");
@ -1163,12 +1122,6 @@ int tolua_eressea_open(lua_State * L)
tolua_module(L, NULL, 0); tolua_module(L, NULL, 0);
tolua_beginmodule(L, NULL); tolua_beginmodule(L, NULL);
{ {
tolua_module(L, "process", 0);
tolua_beginmodule(L, "process");
{
tolua_function(L, "markets", &tolua_process_markets);
tolua_function(L, "produce", &tolua_process_produce);
} tolua_endmodule(L);
tolua_cclass(L, TOLUA_CAST "alliance", TOLUA_CAST "alliance", tolua_cclass(L, TOLUA_CAST "alliance", TOLUA_CAST "alliance",
TOLUA_CAST "", NULL); TOLUA_CAST "", NULL);
tolua_beginmodule(L, TOLUA_CAST "alliance"); tolua_beginmodule(L, TOLUA_CAST "alliance");
@ -1198,12 +1151,6 @@ int tolua_eressea_open(lua_State * L)
tolua_function(L, TOLUA_CAST "register", &tolua_eventbus_register); tolua_function(L, TOLUA_CAST "register", &tolua_eventbus_register);
tolua_function(L, TOLUA_CAST "fire", &tolua_eventbus_fire); tolua_function(L, TOLUA_CAST "fire", &tolua_eventbus_fire);
} tolua_endmodule(L); } tolua_endmodule(L);
tolua_module(L, TOLUA_CAST "settings", 1);
tolua_beginmodule(L, TOLUA_CAST "settings");
{
tolua_function(L, TOLUA_CAST "set", &tolua_settings_set);
tolua_function(L, TOLUA_CAST "get", &tolua_settings_get);
} tolua_endmodule(L);
tolua_module(L, TOLUA_CAST "report", 1); tolua_module(L, TOLUA_CAST "report", 1);
tolua_beginmodule(L, TOLUA_CAST "report"); tolua_beginmodule(L, TOLUA_CAST "report");
{ {
@ -1230,9 +1177,6 @@ int tolua_eressea_open(lua_State * L)
tolua_function(L, TOLUA_CAST "factions", tolua_get_factions); tolua_function(L, TOLUA_CAST "factions", tolua_get_factions);
tolua_function(L, TOLUA_CAST "regions", tolua_get_regions); tolua_function(L, TOLUA_CAST "regions", tolua_get_regions);
tolua_function(L, TOLUA_CAST "read_turn", tolua_read_turn); tolua_function(L, TOLUA_CAST "read_turn", tolua_read_turn);
tolua_function(L, TOLUA_CAST "read_game", tolua_read_game);
tolua_function(L, TOLUA_CAST "write_game", tolua_write_game);
tolua_function(L, TOLUA_CAST "free_game", tolua_free_game);
tolua_function(L, TOLUA_CAST "write_map", &tolua_write_map); tolua_function(L, TOLUA_CAST "write_map", &tolua_write_map);
tolua_function(L, TOLUA_CAST "read_orders", tolua_read_orders); tolua_function(L, TOLUA_CAST "read_orders", tolua_read_orders);
tolua_function(L, TOLUA_CAST "process_orders", tolua_process_orders); tolua_function(L, TOLUA_CAST "process_orders", tolua_process_orders);
@ -1279,3 +1223,94 @@ int tolua_eressea_open(lua_State * L)
} tolua_endmodule(L); } tolua_endmodule(L);
return 1; return 1;
} }
static const struct {
const char *name;
int (*func) (lua_State *);
} lualibs[] = {
{
"", luaopen_base}, {
LUA_TABLIBNAME, luaopen_table}, {
LUA_IOLIBNAME, luaopen_io}, {
LUA_STRLIBNAME, luaopen_string}, {
LUA_MATHLIBNAME, luaopen_math}, {
LUA_LOADLIBNAME, luaopen_package}, {
LUA_DBLIBNAME, luaopen_debug},
#if LUA_VERSION_NUM>=501
{
LUA_OSLIBNAME, luaopen_os},
#endif
{
NULL, NULL}
};
static void openlibs(lua_State * L)
{
int i;
for (i = 0; lualibs[i].func; ++i) {
lua_pushcfunction(L, lualibs[i].func);
lua_pushstring(L, lualibs[i].name);
lua_call(L, 1, 0);
}
}
void lua_done(lua_State * L) {
lua_close(L);
}
lua_State *lua_init(void) {
lua_State *L = lua_open();
openlibs(L);
#ifdef BINDINGS_TOLUA
register_tolua_helpers();
tolua_bindings_open(L);
tolua_eressea_open(L);
tolua_sqlite_open(L);
tolua_unit_open(L);
tolua_building_open(L);
tolua_ship_open(L);
tolua_region_open(L);
tolua_faction_open(L);
#ifdef BSON_ATTRIB
tolua_attrib_open(L);
#endif
tolua_unit_open(L);
tolua_message_open(L);
tolua_hashtable_open(L);
tolua_gmtool_open(L);
tolua_storage_open(L);
#endif
return L;
}
int eressea_run(lua_State *L, const char *luafile, const char *entry_point)
{
int err;
global.vm_state = L;
/* run the main script */
if (luafile) {
log_debug("executing script %s\n", luafile);
lua_getglobal(L, "dofile");
lua_pushstring(L, luafile);
err = lua_pcall(L, 1, 0, 0);
if (err != 0) {
log_lua_error(L);
abort();
return err;
}
}
if (entry_point) {
lua_getglobal(L, entry_point);
err = lua_pcall(L, 0, 1, 0);
if (err != 0) {
log_lua_error(L);
abort();
return err;
}
} else {
err = lua_console(L);
}
return err;
}

7
src/bindings/bindings.h Normal file → Executable file
View File

@ -18,7 +18,7 @@ extern "C" {
struct quicklist; struct quicklist;
int tolua_sqlite_open(struct lua_State *L); int tolua_sqlite_open(struct lua_State *L);
int tolua_eressea_open(struct lua_State *L); int tolua_bindings_open(struct lua_State *L);
int tolua_spelllist_next(struct lua_State *L); int tolua_spelllist_next(struct lua_State *L);
int tolua_itemlist_next(struct lua_State *L); int tolua_itemlist_next(struct lua_State *L);
int tolua_orderlist_next(struct lua_State *L); int tolua_orderlist_next(struct lua_State *L);
@ -26,6 +26,11 @@ extern "C" {
const char *elem_type, struct quicklist *list); const char *elem_type, struct quicklist *list);
int log_lua_error(struct lua_State *L); int log_lua_error(struct lua_State *L);
void lua_done(struct lua_State *L);
struct lua_State *lua_init(void);
int eressea_run(struct lua_State *L, const char *luafile, const char *entry_point);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

8
src/bindings/eressea.pkg Executable file
View File

@ -0,0 +1,8 @@
$#include <bindings/bind_eressea.h>
module eressea {
void eressea_free_game @ free_game(void);
int eressea_read_game @ read_game(const char * filename);
int eressea_write_game @ write_game(const char * filename);
int eressea_read_orders @ read_orders(const char * filename);
}

23
src/bindings/process.pkg Executable file
View File

@ -0,0 +1,23 @@
$#include <bindings/bind_process.h>
module eressea {
module process {
void process_update_long_order @ update_long_order(void);
void process_markets @ markets(void); /* operate the e3 markets */
void process_produce @ produce(void); /* MAKE+BUY/SELL/ENTERTAIN/WORK/TAX/STEAL/SPY/SABOTAGE/PLANT/BREED/RESEARCH */
void process_make_temp @ make_temp(void); /* MAKE TEMP */
void process_settings @ settings(void); /* EMAIL/PASSWORD/BANNER/OPTION */
void process_ally @ set_allies(void); /* HELP */
void process_prefix @ set_prefix(void); /* PREFIX */
void process_setstealth @ set_stealth(void); /* STEALTH */
void process_status @ set_status(void); /* STATUS */
void process_display @ set_description(void); /* DESCRIBE */
void process_group @ set_group(void); /* GROUP */
void process_origin @ set_origin(void); /* ORIGIN */
void process_quit @ quit(void); /* QUIT */
void process_study @ study(void); /* LEARN/TEACH */
void process_movement @ movement(void); /* MOVE/FOLLOW/ROUTE */
void process_use @ use(void); /* USE */
void process_leave @ leave(void); /* LEAVE */
}
}

8
src/bindings/settings.pkg Executable file
View File

@ -0,0 +1,8 @@
$#include <bindings/bind_settings.h>
module eressea {
module settings {
void settings_set @ set(const char *key, const char *value);
const char * settings_get @ get(const char *key);
}
}

134
src/eressea.c Normal file → Executable file
View File

@ -3,30 +3,8 @@
#include "eressea.h" #include "eressea.h"
#include <kernel/config.h> #include <kernel/config.h>
#include <util/console.h>
#include <util/log.h> #include <util/log.h>
/* lua includes */
#ifdef BINDINGS_TOLUA
#include <lua.h>
#include <lualib.h>
#include <lauxlib.h>
#include <bindings/bindings.h>
#include <bindings/helpers.h>
#ifdef BSON_ATTRIB
# include <bindings/bind_attrib.h>
#endif
#include <bindings/bind_building.h>
#include <bindings/bind_faction.h>
#include <bindings/bind_gmtool.h>
#include <bindings/bind_hashtable.h>
#include <bindings/bind_message.h>
#include <bindings/bind_region.h>
#include <bindings/bind_ship.h>
#include <bindings/bind_storage.h>
#include <bindings/bind_unit.h>
#endif /* BINDINGS_TOLUA */
#if MUSEUM_MODULE #if MUSEUM_MODULE
#include <modules/museum.h> #include <modules/museum.h>
#endif #endif
@ -52,68 +30,7 @@
#include <items/itemtypes.h> #include <items/itemtypes.h>
#include <attributes/attributes.h> #include <attributes/attributes.h>
static const struct { void game_done(void)
const char *name;
int (*func) (lua_State *);
} lualibs[] = {
{
"", luaopen_base}, {
LUA_TABLIBNAME, luaopen_table}, {
LUA_IOLIBNAME, luaopen_io}, {
LUA_STRLIBNAME, luaopen_string}, {
LUA_MATHLIBNAME, luaopen_math}, {
LUA_LOADLIBNAME, luaopen_package}, {
LUA_DBLIBNAME, luaopen_debug},
#if LUA_VERSION_NUM>=501
{
LUA_OSLIBNAME, luaopen_os},
#endif
{
NULL, NULL}
};
static void openlibs(lua_State * L)
{
int i;
for (i = 0; lualibs[i].func; ++i) {
lua_pushcfunction(L, lualibs[i].func);
lua_pushstring(L, lualibs[i].name);
lua_call(L, 1, 0);
}
}
static void lua_done(lua_State * L)
{
lua_close(L);
}
static lua_State *lua_init(void)
{
lua_State *L = lua_open();
openlibs(L);
#ifdef BINDINGS_TOLUA
register_tolua_helpers();
tolua_eressea_open(L);
tolua_sqlite_open(L);
tolua_unit_open(L);
tolua_building_open(L);
tolua_ship_open(L);
tolua_region_open(L);
tolua_faction_open(L);
#ifdef BSON_ATTRIB
tolua_attrib_open(L);
#endif
tolua_unit_open(L);
tolua_message_open(L);
tolua_hashtable_open(L);
tolua_gmtool_open(L);
tolua_storage_open(L);
#endif
return L;
}
static void game_done(void)
{ {
#ifdef CLEANUP_CODE #ifdef CLEANUP_CODE
/* Diese Routine enfernt allen allokierten Speicher wieder. Das ist nur /* Diese Routine enfernt allen allokierten Speicher wieder. Das ist nur
@ -129,10 +46,12 @@ static void game_done(void)
#endif #endif
calendar_cleanup(); calendar_cleanup();
#endif #endif
kernel_done();
} }
static void game_init(void) void game_init(void)
{ {
kernel_init();
register_triggers(); register_triggers();
register_xmas(); register_xmas();
@ -165,48 +84,3 @@ static void game_init(void)
register_gmcmd(); register_gmcmd();
} }
int eressea_init(void)
{
global.vm_state = lua_init();
kernel_init();
game_init();
return 0;
}
void eressea_done(void)
{
game_done();
kernel_done();
lua_done((lua_State *) global.vm_state);
}
int eressea_run(const char *luafile, const char *entry_point)
{
int err;
lua_State *L = (lua_State *) global.vm_state;
/* run the main script */
if (luafile) {
lua_getglobal(L, "dofile");
lua_pushstring(L, luafile);
err = lua_pcall(L, 1, 0, 0);
if (err != 0) {
log_lua_error(L);
abort();
return err;
}
}
if (entry_point) {
lua_getglobal(L, entry_point);
err = lua_pcall(L, 0, 1, 0);
if (err != 0) {
log_lua_error(L);
abort();
return err;
}
} else {
err = lua_console(L);
}
return err;
}

5
src/eressea.h Normal file → Executable file
View File

@ -4,9 +4,8 @@
extern "C" { extern "C" {
#endif #endif
int eressea_init(void); void game_init(void);
void eressea_done(void); void game_done(void);
int eressea_run(const char *luafile, const char *entry_point);
#ifdef __cplusplus #ifdef __cplusplus
} }

View File

@ -1,135 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{1E8BFF9E-3044-0742-992F-C5765B80FE65}</ProjectGuid>
<RootNamespace>gamecode</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;../../external;../../external/lua/src;../../external/tolua/include;..\..\external\pdcurses;..\..\external\libxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Lib>
<OutputFile>$(OutDir)gamecode.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<AdditionalIncludeDirectories>.;../../external;../../external/lua/src;../../external/tolua/include;..\..\external\pdcurses;..\..\external\libxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Lib>
<OutputFile>$(OutDir)gamecode.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="gamecode\archetype.c" />
<ClCompile Include="gamecode\creation.c" />
<ClCompile Include="gamecode\creport.c" />
<ClCompile Include="gamecode\economy.c" />
<ClCompile Include="eressea.c" />
<ClCompile Include="gamecode\economy_test.c" />
<ClCompile Include="gamecode\give.c" />
<ClCompile Include="gamecode\xmlreport.c" />
<ClCompile Include="gmtool.c" />
<ClCompile Include="gamecode\items.c" />
<ClCompile Include="gamecode\laws.c" />
<ClCompile Include="gamecode\laws_test.c" />
<ClCompile Include="gamecode\market.c" />
<ClCompile Include="gamecode\market_test.c" />
<ClCompile Include="gamecode\monster.c" />
<ClCompile Include="gamecode\randenc.c" />
<ClCompile Include="gamecode\report.c" />
<ClCompile Include="gamecode\spy.c" />
<ClCompile Include="gamecode\study.c" />
<ClCompile Include="gamecode\summary.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="gamecode\archetype.h" />
<ClInclude Include="gamecode\creation.h" />
<ClInclude Include="gamecode\creport.h" />
<ClInclude Include="gamecode\economy.h" />
<ClInclude Include="eressea.h" />
<ClInclude Include="gamecode\give.h" />
<ClInclude Include="gamecode\xmlreport.h" />
<ClInclude Include="gmtool.h" />
<ClInclude Include="gmtool_structs.h" />
<ClInclude Include="gamecode\items.h" />
<ClInclude Include="gamecode\laws.h" />
<ClInclude Include="gamecode\market.h" />
<ClInclude Include="gamecode\monster.h" />
<ClInclude Include="gamecode\randenc.h" />
<ClInclude Include="gamecode\report.h" />
<ClInclude Include="settings.h" />
<ClInclude Include="gamecode\spy.h" />
<ClInclude Include="gamecode\study.h" />
<ClInclude Include="gamecode\summary.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,134 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{d83e7c3e-0495-4145-86ea-a86b7d4d405b}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{7553a025-8a64-4b5a-90cb-a2eeae9190d3}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="gamecode\archetype.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\creation.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\creport.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\economy.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="eressea.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\give.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gmtool.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\items.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\laws.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\laws_test.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\market.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\market_test.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\monster.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\randenc.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\report.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\spy.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\study.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\summary.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\xmlreport.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="gamecode\economy_test.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="gamecode\archetype.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\creation.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\creport.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\economy.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="eressea.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\give.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gmtool.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gmtool_structs.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\items.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\laws.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\market.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\monster.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\randenc.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\report.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="settings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\spy.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\study.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\summary.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="gamecode\xmlreport.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

412
src/gamecode/laws.c Normal file → Executable file
View File

@ -333,20 +333,27 @@ void get_food(region * r)
*/ */
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
if (u->race == new_race[RC_DAEMON]) { if (u->race == new_race[RC_DAEMON]) {
unit *donor = r->units;
int hungry = u->number; int hungry = u->number;
while (donor != NULL && hungry > 0) { /* use peasantblood before eating the peasants themselves */
/* always start with the first known unit that may have some blood */ static const struct potion_type *pt_blood;
static const struct potion_type *pt_blood; if (pt_blood == NULL) {
if (pt_blood == NULL) { const item_type *it_blood = it_find("peasantblood");
const item_type *it_blood = it_find("peasantblood"); if (it_blood)
if (it_blood) pt_blood = it_blood->rtype->ptype;
pt_blood = it_blood->rtype->ptype; }
} if (pt_blood != NULL) {
if (pt_blood != NULL) { /* always start with the unit itself, then the first known unit that may have some blood */
unit *donor = u;
while (donor != NULL && hungry > 0) {
int blut = get_effect(donor, pt_blood);
blut = MIN(blut, hungry);
change_effect(donor, pt_blood, -blut);
hungry -= blut;
if (donor == u)
donor = r->units;
while (donor != NULL) { while (donor != NULL) {
if (donor->race == new_race[RC_DAEMON]) { if (donor->race == new_race[RC_DAEMON] && donor!=u) {
if (get_effect(donor, pt_blood)) { if (get_effect(donor, pt_blood)) {
/* if he's in our faction, drain him: */ /* if he's in our faction, drain him: */
if (donor->faction == u->faction) if (donor->faction == u->faction)
@ -355,14 +362,9 @@ void get_food(region * r)
} }
donor = donor->next; donor = donor->next;
} }
if (donor != NULL) {
int blut = get_effect(donor, pt_blood);
blut = MIN(blut, hungry);
change_effect(donor, pt_blood, -blut);
hungry -= blut;
}
} }
} }
/* remaining demons feed on peasants */
if (pl == NULL || !fval(pl, PFL_NOFEED)) { if (pl == NULL || !fval(pl, PFL_NOFEED)) {
if (peasantfood >= hungry) { if (peasantfood >= hungry) {
peasantfood -= hungry; peasantfood -= hungry;
@ -377,15 +379,9 @@ void get_food(region * r)
demon_hunger = get_param_int(global.parameters, "hunger.demons", 0); demon_hunger = get_param_int(global.parameters, "hunger.demons", 0);
} }
if (demon_hunger == 0) { if (demon_hunger == 0) {
/* nicht gefütterte dämonen hungern */ /* demons who don't feed are hungry */
#ifdef PEASANT_HUNGRY_DAEMONS_HAVE_FULL_SKILLS
/* wdw special rule */
hunger(hungry, u);
#else
if (hunger(hungry, u)) if (hunger(hungry, u))
fset(u, UFL_HUNGER); fset(u, UFL_HUNGER);
#endif
/* used to be: hunger(hungry, u); */
} else { } else {
/* no damage, but set the hungry-flag */ /* no damage, but set the hungry-flag */
fset(u, UFL_HUNGER); fset(u, UFL_HUNGER);
@ -1067,6 +1063,112 @@ static void transfer_faction(faction * f, faction * f2)
} }
} }
/* test if the unit can slip through a siege undetected.
* returns 0 if siege is successful, or 1 if the building is either
* not besieged or the unit can slip through the siege due to better stealth.
*/
static int slipthru(const region * r, const unit * u, const building * b)
{
unit *u2;
int n, o;
/* b ist die burg, in die man hinein oder aus der man heraus will. */
if (b == NULL || b->besieged < b->size * SIEGEFACTOR) {
return 1;
}
/* u wird am hinein- oder herausschluepfen gehindert, wenn STEALTH <=
* OBSERVATION +2 der belagerer u2 ist */
n = eff_skill(u, SK_STEALTH, r);
for (u2 = r->units; u2; u2 = u2->next) {
if (usiege(u2) == b) {
if (invisible(u, u2) >= u->number)
continue;
o = eff_skill(u2, SK_PERCEPTION, r);
if (o + 2 >= n) {
return 0; /* entdeckt! */
}
}
}
return 1;
}
int can_contact(const region * r, const unit * u, const unit * u2) {
/* hier geht es nur um die belagerung von burgen */
if (u->building == u2->building) {
return 1;
}
/* unit u is trying to contact u2 - unasked for contact. wenn u oder u2
* nicht in einer burg ist, oder die burg nicht belagert ist, ist
* slipthru () == 1. ansonsten ist es nur 1, wenn man die belagerer */
if (slipthru(u->region, u, u->building) && slipthru(u->region, u2, u2->building)) {
return 1;
}
return (alliedunit(u, u2->faction, HELP_GIVE));
}
void contact_cmd(unit * u, order * ord, int final)
{
/* unit u kontaktiert unit u2. Dies setzt den contact einfach auf 1 -
* ein richtiger toggle ist (noch?) nicht noetig. die region als
* parameter ist nur deswegen wichtig, weil er an getunit ()
* weitergegeben wird. dies wird fuer das auffinden von tempunits in
* getnewunit () verwendet! */
unit *u2;
region *r = u->region;
init_tokens(ord);
skip_token();
u2 = getunitg(r, u->faction);
if (u2 != NULL) {
if (!can_contact(r, u, u2)) {
if (final) {
cmistake(u, u->thisorder, 23, MSG_EVENT);
}
return;
}
usetcontact(u, u2);
}
}
int leave_cmd(unit * u, struct order *ord)
{
region *r = u->region;
if (fval(u, UFL_ENTER)) {
/* if we just entered this round, then we don't leave again */
return 0;
}
if (fval(r->terrain, SEA_REGION) && u->ship) {
if (!fval(u->race, RCF_SWIM)) {
cmistake(u, ord, 11, MSG_MOVE);
return 0;
}
if (has_horses(u)) {
cmistake(u, ord, 231, MSG_MOVE);
return 0;
}
}
if (!slipthru(r, u, u->building)) {
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder, "entrance_besieged",
"building", u->building));
} else {
leave(u, true);
}
return 0;
}
static int restart_cmd(unit * u, struct order *ord) static int restart_cmd(unit * u, struct order *ord)
{ {
init_tokens(ord); init_tokens(ord);
@ -1121,7 +1223,7 @@ static boolean EnhancedQuit(void)
return value; return value;
} }
static int quit_cmd(unit * u, struct order *ord) int quit_cmd(unit * u, struct order *ord)
{ {
faction *f = u->faction; faction *f = u->faction;
const char *passwd; const char *passwd;
@ -1163,7 +1265,231 @@ static int quit_cmd(unit * u, struct order *ord)
return 0; return 0;
} }
static void quit(void) static boolean mayenter(region * r, unit * u, building * b)
{
unit *u2;
if (fval(b, BLD_UNGUARDED))
return true;
u2 = building_owner(b);
if (u2 == NULL || ucontact(u2, u)
|| alliedunit(u2, u->faction, HELP_GUARD))
return true;
return false;
}
static int mayboard(const unit * u, ship * sh)
{
unit *u2 = ship_owner(sh);
return (!u2 || ucontact(u2, u) || alliedunit(u2, u->faction, HELP_GUARD));
}
static boolean CheckOverload(void)
{
static int value = -1;
if (value < 0) {
value = get_param_int(global.parameters, "rules.check_overload", 0);
}
return value;
}
int enter_ship(unit * u, struct order *ord, int id, int report)
{
region *r = u->region;
ship *sh;
/* Muß abgefangen werden, sonst könnten Schwimmer an
* Bord von Schiffen an Land gelangen. */
if (!fval(u->race, RCF_CANSAIL) || (!fval(u->race, RCF_WALK)
&& !fval(u->race, RCF_FLY))) {
cmistake(u, ord, 233, MSG_MOVE);
return 0;
}
sh = findship(id);
if (sh == NULL || sh->region != r) {
if (report)
cmistake(u, ord, 20, MSG_MOVE);
return 0;
}
if (sh == u->ship) {
return 1;
}
if (!mayboard(u, sh)) {
if (report)
cmistake(u, ord, 34, MSG_MOVE);
return 0;
}
if (CheckOverload()) {
int sweight, scabins;
int mweight = shipcapacity(sh);
int mcabins = sh->type->cabins;
if (mweight > 0) {
getshipweight(sh, &sweight, &scabins);
sweight += weight(u);
if (mcabins) {
int pweight = u->number * u->race->weight;
/* weight goes into number of cabins, not cargo */
scabins += pweight;
sweight -= pweight;
}
if (sweight > mweight || (mcabins && (scabins > mcabins))) {
if (report)
cmistake(u, ord, 34, MSG_MOVE);
return 0;
}
}
}
if (leave(u, 0)) {
u_set_ship(u, sh);
fset(u, UFL_ENTER);
}
return 1;
}
int enter_building(unit * u, order * ord, int id, int report)
{
region *r = u->region;
building *b;
/* Schwimmer können keine Gebäude betreten, außer diese sind
* auf dem Ozean */
if (!fval(u->race, RCF_WALK) && !fval(u->race, RCF_FLY)) {
if (!fval(r->terrain, SEA_REGION)) {
if (report) {
cmistake(u, ord, 232, MSG_MOVE);
}
return 0;
}
}
b = findbuilding(id);
if (b == NULL || b->region != r) {
if (report) {
cmistake(u, ord, 6, MSG_MOVE);
}
return 0;
}
if (!mayenter(r, u, b)) {
if (report) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "entrance_denied",
"building", b));
}
return 0;
}
if (!slipthru(r, u, b)) {
if (report) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "entrance_besieged",
"building", b));
}
return 0;
}
if (leave(u, 0)) {
fset(u, UFL_ENTER);
u_set_building(u, b);
return 1;
}
return 0;
}
static void do_misc(region * r, int is_final_attempt)
{
unit **uptr, *uc;
for (uc = r->units; uc; uc = uc->next) {
order *ord;
for (ord = uc->orders; ord; ord = ord->next) {
keyword_t kwd = get_keyword(ord);
if (kwd == K_CONTACT) {
contact_cmd(uc, ord, is_final_attempt);
}
}
}
for (uptr = &r->units; *uptr;) {
unit *u = *uptr;
order **ordp = &u->orders;
while (*ordp) {
order *ord = *ordp;
if (get_keyword(ord) == K_ENTER) {
param_t p;
int id;
unit *ulast = NULL;
const char * s;
init_tokens(ord);
skip_token();
s = getstrtoken();
p = findparam_ex(s, u->faction->locale);
id = getid();
switch (p) {
case P_BUILDING:
case P_GEBAEUDE:
if (u->building && u->building->no == id)
break;
if (enter_building(u, ord, id, is_final_attempt)) {
unit *ub;
for (ub = u; ub; ub = ub->next) {
if (ub->building == u->building) {
ulast = ub;
}
}
}
break;
case P_SHIP:
if (u->ship && u->ship->no == id)
break;
if (enter_ship(u, ord, id, is_final_attempt)) {
unit *ub;
ulast = u;
for (ub = u; ub; ub = ub->next) {
if (ub->ship == u->ship) {
ulast = ub;
}
}
}
break;
default:
if (is_final_attempt) {
cmistake(u, ord, 79, MSG_MOVE);
}
}
if (ulast != NULL) {
/* Wenn wir hier angekommen sind, war der Befehl
* erfolgreich und wir löschen ihn, damit er im
* zweiten Versuch nicht nochmal ausgeführt wird. */
*ordp = ord->next;
ord->next = NULL;
free_order(ord);
if (ulast != u) {
/* put u behind ulast so it's the last unit in the building */
*uptr = u->next;
u->next = ulast->next;
ulast->next = u;
}
break;
}
}
if (*ordp == ord)
ordp = &ord->next;
}
if (*uptr == u)
uptr = &u->next;
}
}
void quit(void)
{ {
faction **fptr = &factions; faction **fptr = &factions;
while (*fptr) { while (*fptr) {
@ -1310,7 +1636,7 @@ static void parse_restart(void)
/* HELFE partei [<ALLES | SILBER | GIB | KAEMPFE | WAHRNEHMUNG>] [NICHT] */ /* HELFE partei [<ALLES | SILBER | GIB | KAEMPFE | WAHRNEHMUNG>] [NICHT] */
static int ally_cmd(unit * u, struct order *ord) int ally_cmd(unit * u, struct order *ord)
{ {
ally *sf, **sfp; ally *sf, **sfp;
faction *f; faction *f;
@ -1465,7 +1791,7 @@ static void init_prefixnames(void)
} }
} }
static int prefix_cmd(unit * u, struct order *ord) int prefix_cmd(unit * u, struct order *ord)
{ {
attrib **ap; attrib **ap;
const char *s; const char *s;
@ -1527,7 +1853,7 @@ static cmp_building_cb get_cmp_region_owner(void)
} }
} }
static int display_cmd(unit * u, struct order *ord) int display_cmd(unit * u, struct order *ord)
{ {
char **s = NULL; char **s = NULL;
const char *str; const char *str;
@ -1693,7 +2019,7 @@ rename_building(unit * u, order * ord, building * b, const char *name)
return rename_cmd(u, ord, &b->name, name); return rename_cmd(u, ord, &b->name, name);
} }
static int name_cmd(unit * u, struct order *ord) int name_cmd(struct unit *u, struct order *ord)
{ {
building *b = u->building; building *b = u->building;
region *r = u->region; region *r = u->region;
@ -2111,7 +2437,7 @@ static int mail_cmd(unit * u, struct order *ord)
/* ------------------------------------------------------------- */ /* ------------------------------------------------------------- */
static int banner_cmd(unit * u, struct order *ord) int banner_cmd(unit * u, struct order *ord)
{ {
init_tokens(ord); init_tokens(ord);
skip_token(); skip_token();
@ -2124,7 +2450,7 @@ static int banner_cmd(unit * u, struct order *ord)
return 0; return 0;
} }
static int email_cmd(unit * u, struct order *ord) int email_cmd(unit * u, struct order *ord)
{ {
const char *s; const char *s;
@ -2146,7 +2472,7 @@ static int email_cmd(unit * u, struct order *ord)
return 0; return 0;
} }
static int password_cmd(unit * u, struct order *ord) int password_cmd(unit * u, struct order *ord)
{ {
char pwbuf[32]; char pwbuf[32];
int i; int i;
@ -2186,7 +2512,7 @@ static int password_cmd(unit * u, struct order *ord)
return 0; return 0;
} }
static int send_cmd(unit * u, struct order *ord) int send_cmd(unit * u, struct order *ord)
{ {
const char *s; const char *s;
int option; int option;
@ -2520,7 +2846,7 @@ static int promotion_cmd(unit * u, struct order *ord)
return 0; return 0;
} }
static int group_cmd(unit * u, struct order *ord) int group_cmd(unit * u, struct order *ord)
{ {
const char *s; const char *s;
@ -2532,7 +2858,7 @@ static int group_cmd(unit * u, struct order *ord)
return 0; return 0;
} }
static int origin_cmd(unit * u, struct order *ord) int origin_cmd(unit * u, struct order *ord)
{ {
short px, py; short px, py;
@ -2576,7 +2902,7 @@ static int reshow_cmd(unit * u, struct order *ord)
return 0; return 0;
} }
static int status_cmd(unit * u, struct order *ord) int status_cmd(unit * u, struct order *ord)
{ {
const char *param; const char *param;
@ -3295,7 +3621,7 @@ int checkunitnumber(const faction * f, int add)
return 0; return 0;
} }
static void new_units(void) void new_units(void)
{ {
region *r; region *r;
unit *u, *u2; unit *u, *u2;
@ -3433,7 +3759,7 @@ void check_long_orders(unit * u)
} }
} }
static void setdefaults(unit * u) void update_long_order(unit * u)
{ {
order *ord; order *ord;
boolean trade = false; boolean trade = false;
@ -3781,7 +4107,7 @@ static void age_factions(void)
} }
} }
static int use_cmd(unit * u, struct order *ord) int use_cmd(unit * u, struct order *ord)
{ {
const char *t; const char *t;
int n, err = ENOITEM; int n, err = ENOITEM;
@ -4050,7 +4376,7 @@ void process(void)
cmistake(u, ord, 224, MSG_MAGIC); cmistake(u, ord, 224, MSG_MAGIC);
ord = NULL; ord = NULL;
} else if (fval(u, UFL_LONGACTION)) { } else if (fval(u, UFL_LONGACTION)) {
/* this message was already given in laws.setdefaults /* this message was already given in laws.update_long_order
cmistake(u, ord, 52, MSG_PRODUCE); cmistake(u, ord, 52, MSG_PRODUCE);
*/ */
ord = NULL; ord = NULL;
@ -4160,8 +4486,8 @@ void init_processor(void)
add_proc_global(p, &new_units, "Neue Einheiten erschaffen"); add_proc_global(p, &new_units, "Neue Einheiten erschaffen");
p += 10; p += 10;
add_proc_unit(p, &setdefaults, "Default-Befehle"); add_proc_unit(p, update_long_order, "Langen Befehl aktualisieren");
add_proc_order(p, K_BANNER, &banner_cmd, 0, NULL); add_proc_order(p, K_BANNER, banner_cmd, 0, NULL);
add_proc_order(p, K_EMAIL, &email_cmd, 0, NULL); add_proc_order(p, K_EMAIL, &email_cmd, 0, NULL);
add_proc_order(p, K_PASSWORD, &password_cmd, 0, NULL); add_proc_order(p, K_PASSWORD, &password_cmd, 0, NULL);
add_proc_order(p, K_SEND, &send_cmd, 0, NULL); add_proc_order(p, K_SEND, &send_cmd, 0, NULL);

24
src/gamecode/laws.h Normal file → Executable file
View File

@ -37,6 +37,7 @@ extern "C" {
boolean renamed_building(const struct building * b); boolean renamed_building(const struct building * b);
int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name); int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name);
void get_food(struct region * r); void get_food(struct region * r);
extern int can_contact(const struct region *r, const struct unit *u, const struct unit *u2);
/* eressea-specific. put somewhere else, please. */ /* eressea-specific. put somewhere else, please. */
void processorders(void); void processorders(void);
@ -45,6 +46,29 @@ extern "C" {
extern int dropouts[2]; extern int dropouts[2];
extern int *age; extern int *age;
extern int enter_building(struct unit *u, struct order *ord, int id, int report);
extern int enter_ship(struct unit *u, struct order *ord, int id, int report);
extern void contact_cmd(struct unit *u, struct order *ord, int final);
extern void new_units(void);
extern void quit(void);
extern void update_long_order(struct unit *u);
extern int password_cmd(struct unit *u, struct order *ord);
extern int banner_cmd(struct unit *u, struct order *ord);
extern int email_cmd(struct unit *u, struct order *ord);
extern int send_cmd(struct unit *u, struct order *ord);
extern int ally_cmd(struct unit* u, struct order *ord);
extern int prefix_cmd(struct unit *u, struct order *ord);
extern int setstealth_cmd(struct unit *u, struct order *ord);
extern int status_cmd(struct unit *u, struct order *ord);
extern int display_cmd(struct unit *u, struct order *ord);
extern int group_cmd(struct unit *u, struct order *ord);
extern int origin_cmd(struct unit *u, struct order *ord);
extern int quit_cmd(struct unit *u, struct order *ord);
extern int name_cmd(struct unit *u, struct order *ord);
extern int use_cmd(struct unit *u, struct order *ord);
extern int leave_cmd(struct unit *u, struct order *ord);
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1181,8 +1181,8 @@ static void rotting_herbs(void)
for (r = regions; r; r = r->next) { for (r = regions; r; r = r->next) {
unit *u; unit *u;
for (u = r->units; u; u = u->next) { for (u = r->units; u; u = u->next) {
item **itmp = &u->items, *hbag = item **itmp = &u->items;
*i_find(itmp, olditemtype[I_SACK_OF_CONSERVATION]); item *hbag = *i_find(itmp, olditemtype[I_SACK_OF_CONSERVATION]);
int rot_chance = rule_rot; int rot_chance = rule_rot;
if (hbag) if (hbag)

View File

@ -19,9 +19,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#include <platform.h> #include <platform.h>
#include <kernel/config.h> #include <kernel/config.h>
#include "spy.h" #include "spy.h"
#include "laws.h"
/* kernel includes */ /* kernel includes */
#include <kernel/build.h>
#include <kernel/reports.h> #include <kernel/reports.h>
#include <kernel/item.h> #include <kernel/item.h>
#include <kernel/faction.h> #include <kernel/faction.h>

View File

@ -1,297 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}</ProjectGuid>
<RootNamespace>kernel</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;..\..\external;..\..\external\libxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Lib>
<OutputFile>$(OutDir)kernel.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<AdditionalIncludeDirectories>.;..\..\external;..\..\external\libxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Lib>
<OutputFile>$(OutDir)kernel.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="kernel\alchemy.c" />
<ClCompile Include="kernel\alliance.c" />
<ClCompile Include="kernel\battle.c" />
<ClCompile Include="kernel\battle_test.c" />
<ClCompile Include="kernel\binarystore.c" />
<ClCompile Include="kernel\build.c" />
<ClCompile Include="kernel\building.c" />
<ClCompile Include="kernel\building_test.c" />
<ClCompile Include="kernel\calendar.c" />
<ClCompile Include="kernel\command.c" />
<ClCompile Include="kernel\config.c" />
<ClCompile Include="kernel\connection.c" />
<ClCompile Include="kernel\curse.c" />
<ClCompile Include="kernel\equipment.c" />
<ClCompile Include="kernel\equipment_test.c" />
<ClCompile Include="kernel\faction.c" />
<ClCompile Include="kernel\group.c" />
<ClCompile Include="kernel\item.c" />
<ClCompile Include="kernel\item_test.c" />
<ClCompile Include="kernel\magic.c" />
<ClCompile Include="kernel\magic_test.c" />
<ClCompile Include="kernel\message.c" />
<ClCompile Include="kernel\move.c" />
<ClCompile Include="kernel\move_test.c" />
<ClCompile Include="kernel\names.c" />
<ClCompile Include="kernel\order.c" />
<ClCompile Include="kernel\pathfinder.c" />
<ClCompile Include="kernel\plane.c" />
<ClCompile Include="kernel\player.c" />
<ClCompile Include="kernel\pool.c" />
<ClCompile Include="kernel\pool_test.c" />
<ClCompile Include="kernel\race.c" />
<ClCompile Include="kernel\region.c" />
<ClCompile Include="kernel\reports.c" />
<ClCompile Include="kernel\reports_test.c" />
<ClCompile Include="kernel\resources.c" />
<ClCompile Include="kernel\save.c" />
<ClCompile Include="kernel\ship.c" />
<ClCompile Include="kernel\ship_test.c" />
<ClCompile Include="kernel\skill.c" />
<ClCompile Include="kernel\spell.c" />
<ClCompile Include="kernel\spellbook.c" />
<ClCompile Include="kernel\spellbook_test.c" />
<ClCompile Include="kernel\spell_test.c" />
<ClCompile Include="kernel\sqlite.c" />
<ClCompile Include="kernel\teleport.c" />
<ClCompile Include="kernel\terrain.c" />
<ClCompile Include="kernel\textstore.c" />
<ClCompile Include="kernel\unit.c" />
<ClCompile Include="kernel\xmlreader.c" />
<ClCompile Include="triggers\changefaction.c" />
<ClCompile Include="triggers\changerace.c" />
<ClCompile Include="triggers\clonedied.c" />
<ClCompile Include="triggers\createcurse.c" />
<ClCompile Include="triggers\createunit.c" />
<ClCompile Include="triggers\gate.c" />
<ClCompile Include="triggers\giveitem.c" />
<ClCompile Include="triggers\killunit.c" />
<ClCompile Include="triggers\removecurse.c" />
<ClCompile Include="triggers\shock.c" />
<ClCompile Include="triggers\timeout.c" />
<ClCompile Include="triggers\triggers.c" />
<ClCompile Include="triggers\unguard.c" />
<ClCompile Include="triggers\unitmessage.c" />
<ClCompile Include="items\artrewards.c" />
<ClCompile Include="items\demonseye.c" />
<ClCompile Include="items\itemtypes.c" />
<ClCompile Include="items\phoenixcompass.c" />
<ClCompile Include="items\seed.c" />
<ClCompile Include="items\speedsail.c" />
<ClCompile Include="items\weapons.c" />
<ClCompile Include="items\xerewards.c" />
<ClCompile Include="modules\arena.c" />
<ClCompile Include="modules\autoseed.c" />
<ClCompile Include="modules\dungeon.c" />
<ClCompile Include="modules\gmcmd.c" />
<ClCompile Include="modules\museum.c" />
<ClCompile Include="modules\score.c" />
<ClCompile Include="modules\weather.c" />
<ClCompile Include="modules\wormhole.c" />
<ClCompile Include="modules\xecmd.c" />
<ClCompile Include="modules\xmas.c" />
<ClCompile Include="attributes\alliance.c" />
<ClCompile Include="attributes\attributes.c" />
<ClCompile Include="attributes\fleechance.c" />
<ClCompile Include="attributes\follow.c" />
<ClCompile Include="attributes\giveitem.c" />
<ClCompile Include="attributes\gm.c" />
<ClCompile Include="attributes\hate.c" />
<ClCompile Include="attributes\iceberg.c" />
<ClCompile Include="attributes\key.c" />
<ClCompile Include="attributes\matmod.c" />
<ClCompile Include="attributes\moved.c" />
<ClCompile Include="attributes\movement.c" />
<ClCompile Include="attributes\object.c" />
<ClCompile Include="attributes\orcification.c" />
<ClCompile Include="attributes\otherfaction.c" />
<ClCompile Include="attributes\overrideroads.c" />
<ClCompile Include="attributes\racename.c" />
<ClCompile Include="attributes\raceprefix.c" />
<ClCompile Include="attributes\reduceproduction.c" />
<ClCompile Include="attributes\targetregion.c" />
<ClCompile Include="kernel\curse_test.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="kernel\alchemy.h" />
<ClInclude Include="kernel\alliance.h" />
<ClInclude Include="kernel\battle.h" />
<ClInclude Include="kernel\binarystore.h" />
<ClInclude Include="kernel\build.h" />
<ClInclude Include="kernel\building.h" />
<ClInclude Include="kernel\calendar.h" />
<ClInclude Include="kernel\command.h" />
<ClInclude Include="kernel\config.h" />
<ClInclude Include="kernel\connection.h" />
<ClInclude Include="kernel\curse.h" />
<ClInclude Include="kernel\equipment.h" />
<ClInclude Include="kernel\faction.h" />
<ClInclude Include="kernel\group.h" />
<ClInclude Include="kernel\item.h" />
<ClInclude Include="kernel\magic.h" />
<ClInclude Include="kernel\message.h" />
<ClInclude Include="kernel\move.h" />
<ClInclude Include="kernel\names.h" />
<ClInclude Include="kernel\objtypes.h" />
<ClInclude Include="kernel\order.h" />
<ClInclude Include="kernel\pathfinder.h" />
<ClInclude Include="kernel\plane.h" />
<ClInclude Include="kernel\player.h" />
<ClInclude Include="kernel\pool.h" />
<ClInclude Include="kernel\race.h" />
<ClInclude Include="kernel\region.h" />
<ClInclude Include="kernel\render.h" />
<ClInclude Include="kernel\reports.h" />
<ClInclude Include="kernel\resources.h" />
<ClInclude Include="kernel\save.h" />
<ClInclude Include="kernel\ship.h" />
<ClInclude Include="kernel\skill.h" />
<ClInclude Include="kernel\spell.h" />
<ClInclude Include="kernel\spellbook.h" />
<ClInclude Include="kernel\spellid.h" />
<ClInclude Include="kernel\teleport.h" />
<ClInclude Include="kernel\terrain.h" />
<ClInclude Include="kernel\terrainid.h" />
<ClInclude Include="kernel\textstore.h" />
<ClInclude Include="kernel\types.h" />
<ClInclude Include="kernel\unit.h" />
<ClInclude Include="kernel\version.h" />
<ClInclude Include="kernel\xmlkernel.h" />
<ClInclude Include="kernel\xmlreader.h" />
<ClInclude Include="triggers\changefaction.h" />
<ClInclude Include="triggers\changerace.h" />
<ClInclude Include="triggers\clonedied.h" />
<ClInclude Include="triggers\createcurse.h" />
<ClInclude Include="triggers\createunit.h" />
<ClInclude Include="triggers\gate.h" />
<ClInclude Include="triggers\giveitem.h" />
<ClInclude Include="triggers\killunit.h" />
<ClInclude Include="triggers\removecurse.h" />
<ClInclude Include="triggers\shock.h" />
<ClInclude Include="triggers\timeout.h" />
<ClInclude Include="triggers\triggers.h" />
<ClInclude Include="triggers\unguard.h" />
<ClInclude Include="triggers\unitmessage.h" />
<ClInclude Include="items\artrewards.h" />
<ClInclude Include="items\demonseye.h" />
<ClInclude Include="items\itemtypes.h" />
<ClInclude Include="items\phoenixcompass.h" />
<ClInclude Include="items\seed.h" />
<ClInclude Include="items\speedsail.h" />
<ClInclude Include="items\weapons.h" />
<ClInclude Include="items\xerewards.h" />
<ClInclude Include="modules\arena.h" />
<ClInclude Include="modules\autoseed.h" />
<ClInclude Include="modules\dungeon.h" />
<ClInclude Include="modules\gmcmd.h" />
<ClInclude Include="modules\museum.h" />
<ClInclude Include="modules\score.h" />
<ClInclude Include="modules\weather.h" />
<ClInclude Include="modules\wormhole.h" />
<ClInclude Include="modules\xecmd.h" />
<ClInclude Include="modules\xmas.h" />
<ClInclude Include="attributes\aggressive.h" />
<ClInclude Include="attributes\alliance.h" />
<ClInclude Include="attributes\attributes.h" />
<ClInclude Include="attributes\fleechance.h" />
<ClInclude Include="attributes\follow.h" />
<ClInclude Include="attributes\giveitem.h" />
<ClInclude Include="attributes\gm.h" />
<ClInclude Include="attributes\hate.h" />
<ClInclude Include="attributes\iceberg.h" />
<ClInclude Include="attributes\key.h" />
<ClInclude Include="attributes\matmod.h" />
<ClInclude Include="attributes\moved.h" />
<ClInclude Include="attributes\movement.h" />
<ClInclude Include="attributes\object.h" />
<ClInclude Include="attributes\orcification.h" />
<ClInclude Include="attributes\otherfaction.h" />
<ClInclude Include="attributes\overrideroads.h" />
<ClInclude Include="attributes\racename.h" />
<ClInclude Include="attributes\raceprefix.h" />
<ClInclude Include="attributes\reduceproduction.h" />
<ClInclude Include="attributes\targetregion.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,625 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="kernel">
<UniqueIdentifier>{0d7b749c-a7f2-4791-b356-6ae450020131}</UniqueIdentifier>
</Filter>
<Filter Include="triggers">
<UniqueIdentifier>{0ebbe376-a35f-44f6-97c6-9b449a839ddb}</UniqueIdentifier>
</Filter>
<Filter Include="items">
<UniqueIdentifier>{0f293992-e32e-49fb-a5f2-74686b0d042e}</UniqueIdentifier>
</Filter>
<Filter Include="modules">
<UniqueIdentifier>{e12969f3-9de3-4f65-812d-1e120875a15c}</UniqueIdentifier>
</Filter>
<Filter Include="attributes">
<UniqueIdentifier>{c10dd4f8-3a6a-470b-8a04-bb652854e228}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="kernel\alchemy.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\alliance.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\battle.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\binarystore.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\build.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\building.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\calendar.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\command.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\config.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\connection.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\curse.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\equipment.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\faction.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\group.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\item.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\magic.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\message.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\move.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\names.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\order.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\pathfinder.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\plane.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\player.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\pool.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\race.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\region.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\reports.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\resources.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\save.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\ship.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\skill.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\spell.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\sqlite.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\teleport.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\terrain.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\textstore.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\unit.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\xmlreader.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="triggers\changefaction.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\changerace.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\clonedied.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\createcurse.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\createunit.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\gate.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\giveitem.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\killunit.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\removecurse.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\shock.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\timeout.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\triggers.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\unguard.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="triggers\unitmessage.c">
<Filter>triggers</Filter>
</ClCompile>
<ClCompile Include="items\artrewards.c">
<Filter>items</Filter>
</ClCompile>
<ClCompile Include="items\demonseye.c">
<Filter>items</Filter>
</ClCompile>
<ClCompile Include="items\itemtypes.c">
<Filter>items</Filter>
</ClCompile>
<ClCompile Include="items\phoenixcompass.c">
<Filter>items</Filter>
</ClCompile>
<ClCompile Include="items\seed.c">
<Filter>items</Filter>
</ClCompile>
<ClCompile Include="items\speedsail.c">
<Filter>items</Filter>
</ClCompile>
<ClCompile Include="items\weapons.c">
<Filter>items</Filter>
</ClCompile>
<ClCompile Include="items\xerewards.c">
<Filter>items</Filter>
</ClCompile>
<ClCompile Include="modules\arena.c">
<Filter>modules</Filter>
</ClCompile>
<ClCompile Include="modules\autoseed.c">
<Filter>modules</Filter>
</ClCompile>
<ClCompile Include="modules\dungeon.c">
<Filter>modules</Filter>
</ClCompile>
<ClCompile Include="modules\gmcmd.c">
<Filter>modules</Filter>
</ClCompile>
<ClCompile Include="modules\museum.c">
<Filter>modules</Filter>
</ClCompile>
<ClCompile Include="modules\score.c">
<Filter>modules</Filter>
</ClCompile>
<ClCompile Include="modules\weather.c">
<Filter>modules</Filter>
</ClCompile>
<ClCompile Include="modules\wormhole.c">
<Filter>modules</Filter>
</ClCompile>
<ClCompile Include="modules\xecmd.c">
<Filter>modules</Filter>
</ClCompile>
<ClCompile Include="modules\xmas.c">
<Filter>modules</Filter>
</ClCompile>
<ClCompile Include="attributes\alliance.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\attributes.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\fleechance.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\follow.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\giveitem.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\gm.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\hate.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\iceberg.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\key.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\matmod.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\moved.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\movement.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\object.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\orcification.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\otherfaction.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\overrideroads.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\racename.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\raceprefix.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\reduceproduction.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="attributes\targetregion.c">
<Filter>attributes</Filter>
</ClCompile>
<ClCompile Include="kernel\curse_test.c" />
<ClCompile Include="kernel\move_test.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\battle_test.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\spell_test.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\ship_test.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\reports_test.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\building_test.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\item_test.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\magic_test.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\spellbook.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\spellbook_test.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\equipment_test.c">
<Filter>kernel</Filter>
</ClCompile>
<ClCompile Include="kernel\pool_test.c">
<Filter>kernel</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="kernel\alchemy.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\alliance.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\battle.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\binarystore.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\build.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\building.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\calendar.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\command.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\config.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\connection.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\curse.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\equipment.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\faction.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\group.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\item.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\magic.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\message.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\move.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\names.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\objtypes.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\order.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\pathfinder.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\plane.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\player.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\pool.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\race.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\region.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\render.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\reports.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\resources.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\save.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\ship.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\skill.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\spell.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\spellid.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\teleport.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\terrain.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\terrainid.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\textstore.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\types.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\unit.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\version.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\xmlkernel.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="kernel\xmlreader.h">
<Filter>kernel</Filter>
</ClInclude>
<ClInclude Include="triggers\changefaction.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\changerace.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\clonedied.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\createcurse.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\createunit.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\gate.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\giveitem.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\killunit.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\removecurse.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\shock.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\timeout.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\triggers.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\unguard.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="triggers\unitmessage.h">
<Filter>triggers</Filter>
</ClInclude>
<ClInclude Include="items\artrewards.h">
<Filter>items</Filter>
</ClInclude>
<ClInclude Include="items\demonseye.h">
<Filter>items</Filter>
</ClInclude>
<ClInclude Include="items\itemtypes.h">
<Filter>items</Filter>
</ClInclude>
<ClInclude Include="items\phoenixcompass.h">
<Filter>items</Filter>
</ClInclude>
<ClInclude Include="items\seed.h">
<Filter>items</Filter>
</ClInclude>
<ClInclude Include="items\speedsail.h">
<Filter>items</Filter>
</ClInclude>
<ClInclude Include="items\weapons.h">
<Filter>items</Filter>
</ClInclude>
<ClInclude Include="items\xerewards.h">
<Filter>items</Filter>
</ClInclude>
<ClInclude Include="modules\arena.h">
<Filter>modules</Filter>
</ClInclude>
<ClInclude Include="modules\autoseed.h">
<Filter>modules</Filter>
</ClInclude>
<ClInclude Include="modules\dungeon.h">
<Filter>modules</Filter>
</ClInclude>
<ClInclude Include="modules\gmcmd.h">
<Filter>modules</Filter>
</ClInclude>
<ClInclude Include="modules\museum.h">
<Filter>modules</Filter>
</ClInclude>
<ClInclude Include="modules\score.h">
<Filter>modules</Filter>
</ClInclude>
<ClInclude Include="modules\weather.h">
<Filter>modules</Filter>
</ClInclude>
<ClInclude Include="modules\wormhole.h">
<Filter>modules</Filter>
</ClInclude>
<ClInclude Include="modules\xecmd.h">
<Filter>modules</Filter>
</ClInclude>
<ClInclude Include="modules\xmas.h">
<Filter>modules</Filter>
</ClInclude>
<ClInclude Include="attributes\aggressive.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\alliance.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\attributes.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\fleechance.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\follow.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\giveitem.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\gm.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\hate.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\iceberg.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\key.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\matmod.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\moved.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\movement.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\object.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\orcification.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\otherfaction.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\overrideroads.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\racename.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\raceprefix.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\reduceproduction.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="attributes\targetregion.h">
<Filter>attributes</Filter>
</ClInclude>
<ClInclude Include="kernel\spellbook.h">
<Filter>kernel</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -18,6 +18,7 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#ifndef H_KRNL_ALCHEMY_H #ifndef H_KRNL_ALCHEMY_H
#define H_KRNL_ALCHEMY_H #define H_KRNL_ALCHEMY_H
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
@ -56,6 +57,7 @@ extern "C" {
int amount, struct order *); int amount, struct order *);
extern void init_potions(void); extern void init_potions(void);
extern int get_effect(const struct unit *u, const struct potion_type *effect); extern int get_effect(const struct unit *u, const struct potion_type *effect);
extern int change_effect(struct unit *u, const struct potion_type *effect, extern int change_effect(struct unit *u, const struct potion_type *effect,
int value); int value);

View File

@ -69,99 +69,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
/* Name, MaxGroesse, MinBauTalent, Kapazitaet, {Eisen, Holz, Stein, BauSilber, /* Name, MaxGroesse, MinBauTalent, Kapazitaet, {Eisen, Holz, Stein, BauSilber,
* Laen, Mallorn}, UnterSilber, UnterSpezialTyp, UnterSpezial */ * Laen, Mallorn}, UnterSilber, UnterSpezialTyp, UnterSpezial */
static boolean CheckOverload(void)
{
static int value = -1;
if (value < 0) {
value = get_param_int(global.parameters, "rules.check_overload", 0);
}
return value;
}
/* test if the unit can slip through a siege undetected.
* returns 0 if siege is successful, or 1 if the building is either
* not besieged or the unit can slip through the siege due to better stealth.
*/
static int slipthru(const region * r, const unit * u, const building * b)
{
unit *u2;
int n, o;
/* b ist die burg, in die man hinein oder aus der man heraus will. */
if (b == NULL || b->besieged < b->size * SIEGEFACTOR) {
return 1;
}
/* u wird am hinein- oder herausschluepfen gehindert, wenn STEALTH <=
* OBSERVATION +2 der belagerer u2 ist */
n = eff_skill(u, SK_STEALTH, r);
for (u2 = r->units; u2; u2 = u2->next) {
if (usiege(u2) == b) {
if (invisible(u, u2) >= u->number)
continue;
o = eff_skill(u2, SK_PERCEPTION, r);
if (o + 2 >= n) {
return 0; /* entdeckt! */
}
}
}
return 1;
}
int can_contact(const region * r, const unit * u, const unit * u2)
{
/* hier geht es nur um die belagerung von burgen */
if (u->building == u2->building) {
return 1;
}
/* unit u is trying to contact u2 - unasked for contact. wenn u oder u2
* nicht in einer burg ist, oder die burg nicht belagert ist, ist
* slipthru () == 1. ansonsten ist es nur 1, wenn man die belagerer */
if (slipthru(u->region, u, u->building) && slipthru(u->region, u2, u2->building)) {
return 1;
}
return (alliedunit(u, u2->faction, HELP_GIVE));
}
static void contact_cmd(unit * u, order * ord, int final)
{
/* unit u kontaktiert unit u2. Dies setzt den contact einfach auf 1 -
* ein richtiger toggle ist (noch?) nicht noetig. die region als
* parameter ist nur deswegen wichtig, weil er an getunit ()
* weitergegeben wird. dies wird fuer das auffinden von tempunits in
* getnewunit () verwendet! */
unit *u2;
region *r = u->region;
init_tokens(ord);
skip_token();
u2 = getunitg(r, u->faction);
if (u2 != NULL) {
if (!can_contact(r, u, u2)) {
if (final)
cmistake(u, u->thisorder, 23, MSG_EVENT);
return;
}
usetcontact(u, u2);
}
}
/* ------------------------------------------------------------- */
/* ------------------------------------------------------------- */
/* ------------------------------------------------------------- */
struct building *getbuilding(const struct region *r) struct building *getbuilding(const struct region *r)
{ {
building *b = findbuilding(getid()); building *b = findbuilding(getid());
@ -1152,246 +1059,3 @@ void continue_ship(region * r, unit * u, int want)
build_ship(u, sh, want); build_ship(u, sh, want);
} }
/* ------------------------------------------------------------- */
static boolean mayenter(region * r, unit * u, building * b)
{
unit *u2;
if (fval(b, BLD_UNGUARDED))
return true;
u2 = building_owner(b);
if (u2 == NULL || ucontact(u2, u)
|| alliedunit(u2, u->faction, HELP_GUARD))
return true;
return false;
}
static int mayboard(const unit * u, ship * sh)
{
unit *u2 = ship_owner(sh);
return (!u2 || ucontact(u2, u) || alliedunit(u2, u->faction, HELP_GUARD));
}
int leave_cmd(unit * u, struct order *ord)
{
region *r = u->region;
if (fval(u, UFL_ENTER)) {
/* if we just entered this round, then we don't leave again */
return 0;
}
if (fval(r->terrain, SEA_REGION) && u->ship) {
if (!fval(u->race, RCF_SWIM)) {
cmistake(u, ord, 11, MSG_MOVE);
return 0;
}
if (has_horses(u)) {
cmistake(u, ord, 231, MSG_MOVE);
return 0;
}
}
if (!slipthru(r, u, u->building)) {
ADDMSG(&u->faction->msgs, msg_feedback(u, u->thisorder, "entrance_besieged",
"building", u->building));
} else {
leave(u, true);
}
return 0;
}
static boolean enter_ship(unit * u, struct order *ord, int id, boolean report)
{
region *r = u->region;
ship *sh;
/* Muß abgefangen werden, sonst könnten Schwimmer an
* Bord von Schiffen an Land gelangen. */
if (!fval(u->race, RCF_CANSAIL) || (!fval(u->race, RCF_WALK)
&& !fval(u->race, RCF_FLY))) {
cmistake(u, ord, 233, MSG_MOVE);
return false;
}
sh = findship(id);
if (sh == NULL || sh->region != r) {
if (report)
cmistake(u, ord, 20, MSG_MOVE);
return false;
}
if (sh == u->ship)
return true;
if (!mayboard(u, sh)) {
if (report)
cmistake(u, ord, 34, MSG_MOVE);
return false;
}
if (CheckOverload()) {
int sweight, scabins;
int mweight = shipcapacity(sh);
int mcabins = sh->type->cabins;
if (mweight > 0) {
getshipweight(sh, &sweight, &scabins);
sweight += weight(u);
if (mcabins) {
int pweight = u->number * u->race->weight;
/* weight goes into number of cabins, not cargo */
scabins += pweight;
sweight -= pweight;
}
if (sweight > mweight || (mcabins && (scabins > mcabins))) {
if (report)
cmistake(u, ord, 34, MSG_MOVE);
return false;
}
}
}
if (leave(u, false)) {
u_set_ship(u, sh);
fset(u, UFL_ENTER);
}
return true;
}
static boolean enter_building(unit * u, order * ord, int id, boolean report)
{
region *r = u->region;
building *b;
/* Schwimmer können keine Gebäude betreten, außer diese sind
* auf dem Ozean */
if (!fval(u->race, RCF_WALK) && !fval(u->race, RCF_FLY)) {
if (!fval(r->terrain, SEA_REGION)) {
if (report) {
cmistake(u, ord, 232, MSG_MOVE);
}
return false;
}
}
b = findbuilding(id);
if (b == NULL || b->region != r) {
if (report) {
cmistake(u, ord, 6, MSG_MOVE);
}
return false;
}
if (!mayenter(r, u, b)) {
if (report) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "entrance_denied",
"building", b));
}
return false;
}
if (!slipthru(r, u, b)) {
if (report) {
ADDMSG(&u->faction->msgs, msg_feedback(u, ord, "entrance_besieged",
"building", b));
}
return false;
}
if (leave(u, false)) {
fset(u, UFL_ENTER);
u_set_building(u, b);
return true;
}
return false;
}
void do_misc(region * r, int is_final_attempt)
{
unit **uptr, *uc;
for (uc = r->units; uc; uc = uc->next) {
order *ord;
for (ord = uc->orders; ord; ord = ord->next) {
keyword_t kwd = get_keyword(ord);
if (kwd == K_CONTACT) {
contact_cmd(uc, ord, is_final_attempt);
}
}
}
for (uptr = &r->units; *uptr;) {
unit *u = *uptr;
order **ordp = &u->orders;
while (*ordp) {
order *ord = *ordp;
if (get_keyword(ord) == K_ENTER) {
param_t p;
int id;
unit *ulast = NULL;
const char * s;
init_tokens(ord);
skip_token();
s = getstrtoken();
p = findparam_ex(s, u->faction->locale);
id = getid();
switch (p) {
case P_BUILDING:
case P_GEBAEUDE:
if (u->building && u->building->no == id)
break;
if (enter_building(u, ord, id, is_final_attempt)) {
unit *ub;
for (ub = u; ub; ub = ub->next) {
if (ub->building == u->building) {
ulast = ub;
}
}
}
break;
case P_SHIP:
if (u->ship && u->ship->no == id)
break;
if (enter_ship(u, ord, id, is_final_attempt)) {
unit *ub;
ulast = u;
for (ub = u; ub; ub = ub->next) {
if (ub->ship == u->ship) {
ulast = ub;
}
}
}
break;
default:
if (is_final_attempt) {
cmistake(u, ord, 79, MSG_MOVE);
}
}
if (ulast != NULL) {
/* Wenn wir hier angekommen sind, war der Befehl
* erfolgreich und wir löschen ihn, damit er im
* zweiten Versuch nicht nochmal ausgeführt wird. */
*ordp = ord->next;
ord->next = NULL;
free_order(ord);
if (ulast != u) {
/* put u behind ulast so it's the last unit in the building */
*uptr = u->next;
u->next = ulast->next;
ulast->next = u;
}
break;
}
}
if (*ordp == ord)
ordp = &ord->next;
}
if (*uptr == u)
uptr = &u->next;
}
}

View File

@ -64,9 +64,6 @@ extern "C" {
extern int destroy_cmd(struct unit *u, struct order *ord); extern int destroy_cmd(struct unit *u, struct order *ord);
extern int leave_cmd(struct unit *u, struct order *ord); extern int leave_cmd(struct unit *u, struct order *ord);
extern int can_contact(const struct region *r, const struct unit *u,
const struct unit *u2);
void do_siege(struct region *r); void do_siege(struct region *r);
void build_road(struct region *r, struct unit *u, int size, direction_t d); void build_road(struct region *r, struct unit *u, int size, direction_t d);
void create_ship(struct region *r, struct unit *u, void create_ship(struct region *r, struct unit *u,
@ -76,8 +73,6 @@ extern "C" {
struct building *getbuilding(const struct region *r); struct building *getbuilding(const struct region *r);
struct ship *getship(const struct region *r); struct ship *getship(const struct region *r);
void do_misc(struct region *r, int is_final_attempt);
void reportevent(struct region *r, char *s); void reportevent(struct region *r, char *s);
void shash(struct ship *sh); void shash(struct ship *sh);

15
src/kernel/faction.c Normal file → Executable file
View File

@ -284,19 +284,22 @@ void destroyfaction(faction * f)
unit *u = f->units; unit *u = f->units;
faction *ff; faction *ff;
if (!f->alive) if (!f->alive) {
return; return;
}
fset(f, FFL_QUIT); fset(f, FFL_QUIT);
spellbook_clear(f->spellbook); if (f->spellbook) {
free(f->spellbook); spellbook_clear(f->spellbook);
f->spellbook = 0; free(f->spellbook);
f->spellbook = 0;
}
while (f->battles) { while (f->battles) {
struct bmsg *bm = f->battles; struct bmsg *bm = f->battles;
f->battles = bm->next; f->battles = bm->next;
if (bm->msgs) if (bm->msgs) {
free_messagelist(bm->msgs); free_messagelist(bm->msgs);
}
free(bm); free(bm);
} }

11
src/kernel/group.c Normal file → Executable file
View File

@ -136,6 +136,17 @@ void free_group(group * g)
free(g); free(g);
} }
group * get_group(const struct unit *u)
{
if (fval(u, UFL_GROUP)) {
attrib * a = a_find(u->attribs, &at_group);
if (a) {
return (group *) a->data.v;
}
}
return 0;
}
void set_group(struct unit *u, struct group *g) void set_group(struct unit *u, struct group *g)
{ {
attrib *a = NULL; attrib *a = NULL;

1
src/kernel/group.h Normal file → Executable file
View File

@ -40,6 +40,7 @@ extern "C" {
extern struct attrib_type at_group; /* attribute for units assigned to a group */ extern struct attrib_type at_group; /* attribute for units assigned to a group */
extern boolean join_group(struct unit *u, const char *name); extern boolean join_group(struct unit *u, const char *name);
extern void set_group(struct unit *u, struct group *g); extern void set_group(struct unit *u, struct group *g);
extern struct group * get_group(const struct unit *u);
extern void free_group(struct group *g); extern void free_group(struct group *g);
extern void write_groups(struct storage *F, struct group *g); extern void write_groups(struct storage *F, struct group *g);

View File

@ -704,6 +704,7 @@ static float damage_drift(void)
static void drifting_ships(region * r) static void drifting_ships(region * r)
{ {
direction_t d; direction_t d;
if (get_param_int(global.parameters, "rules.ship.drifting", 1)==0) return;
if (fval(r->terrain, SEA_REGION)) { if (fval(r->terrain, SEA_REGION)) {
ship **shp = &r->ships; ship **shp = &r->ships;
@ -1718,7 +1719,7 @@ sail(unit * u, order * ord, boolean move_on_land, region_list ** routep)
assert(sh == u->ship || !"ship has sunk, but we didn't notice it"); assert(sh == u->ship || !"ship has sunk, but we didn't notice it");
if (fval(next_point->terrain, FORBIDDEN_REGION)) { if (fval(next_point->terrain, FORBIDDEN_REGION)||fval(next_point,RF_BLOCKED)) {
ADDMSG(&f->msgs, msg_message("sailforbidden", ADDMSG(&f->msgs, msg_message("sailforbidden",
"ship region", sh, next_point)); "ship region", sh, next_point));
break; break;

View File

@ -1,121 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{75501170-51C2-E641-BA8B-EDC008184192}</ProjectGuid>
<RootNamespace>lua-bindings</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;../../external;../../external/lua/src;../../external/tolua/include;..\..\external\pdcurses;..\..\external\libxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Lib>
<OutputFile>$(OutDir)lua-bindings.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<AdditionalIncludeDirectories>.;../../external;../../external/lua/src;../../external/tolua/include;..\..\external\pdcurses;..\..\external\libxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Lib>
<OutputFile>$(OutDir)lua-bindings.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="bindings\bind_attrib.c" />
<ClCompile Include="bindings\bind_building.c" />
<ClCompile Include="bindings\bind_faction.c" />
<ClCompile Include="bindings\bind_gmtool.c" />
<ClCompile Include="bindings\bind_hashtable.c" />
<ClCompile Include="bindings\bind_message.c" />
<ClCompile Include="bindings\bind_region.c" />
<ClCompile Include="bindings\bind_ship.c" />
<ClCompile Include="bindings\bind_sqlite.c" />
<ClCompile Include="bindings\bind_storage.c" />
<ClCompile Include="bindings\bind_unit.c" />
<ClCompile Include="bindings\bindings.c" />
<ClCompile Include="bindings\helpers.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="bindings\bind_attrib.h" />
<ClInclude Include="bindings\bind_building.h" />
<ClInclude Include="bindings\bind_faction.h" />
<ClInclude Include="bindings\bind_gmtool.h" />
<ClInclude Include="bindings\bind_hashtable.h" />
<ClInclude Include="bindings\bind_message.h" />
<ClInclude Include="bindings\bind_region.h" />
<ClInclude Include="bindings\bind_ship.h" />
<ClInclude Include="bindings\bind_storage.h" />
<ClInclude Include="bindings\bind_unit.h" />
<ClInclude Include="bindings\bindings.h" />
<ClInclude Include="bindings\helpers.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,92 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{1a17299b-610f-40df-864f-84b37b67ebe7}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{5135c52b-b087-4aab-8d89-2b06da54e8e7}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="bindings\bind_attrib.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\bind_building.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\bind_faction.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\bind_gmtool.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\bind_hashtable.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\bind_message.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\bind_region.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\bind_ship.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\bind_sqlite.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\bind_storage.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\bind_unit.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\bindings.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="bindings\helpers.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="bindings\bind_attrib.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bindings\bind_building.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bindings\bind_faction.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bindings\bind_gmtool.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bindings\bind_hashtable.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bindings\bind_message.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bindings\bind_region.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bindings\bind_ship.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bindings\bind_storage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bindings\bind_unit.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bindings\bindings.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="bindings\helpers.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

View File

@ -1,162 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}</ProjectGuid>
<RootNamespace>util</RootNamespace>
<Keyword>Win32Proj</Keyword>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<CharacterSet>MultiByte</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</OutDir>
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(Configuration)\$(ProjectName)\</IntDir>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<AdditionalOptions>/MP %(AdditionalOptions)</AdditionalOptions>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>.;../../external;../../external/lua/src;../../external/pdcurses;..\..\external\libxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<TreatWarningAsError>true</TreatWarningAsError>
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Lib>
<OutputFile>$(OutDir)util.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<Optimization>Full</Optimization>
<AdditionalIncludeDirectories>.;../../external;../../external/lua/src;../../external/pdcurses;..\..\external\libxml2\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<FunctionLevelLinking>true</FunctionLevelLinking>
<PrecompiledHeader>
</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<DebugInformationFormat>
</DebugInformationFormat>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>WIN32;_CRT_SECURE_NO_DEPRECATE;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>..;.;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ResourceCompile>
<Lib>
<OutputFile>$(OutDir)util.lib</OutputFile>
</Lib>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="util\attrib.h" />
<ClInclude Include="util\base36.h" />
<ClInclude Include="util\bsdstring.h" />
<ClInclude Include="util\console.h" />
<ClInclude Include="util\critbit.h" />
<ClInclude Include="util\crmessage.h" />
<ClInclude Include="util\event.h" />
<ClInclude Include="util\eventbus.h" />
<ClInclude Include="util\filereader.h" />
<ClInclude Include="util\functions.h" />
<ClInclude Include="util\goodies.h" />
<ClInclude Include="util\language.h" />
<ClInclude Include="util\language_struct.h" />
<ClInclude Include="util\listbox.h" />
<ClInclude Include="util\lists.h" />
<ClInclude Include="util\log.h" />
<ClInclude Include="util\message.h" />
<ClInclude Include="util\nrmessage.h" />
<ClInclude Include="util\nrmessage_struct.h" />
<ClInclude Include="util\os.h" />
<ClInclude Include="util\parser.h" />
<ClInclude Include="util\quicklist.h" />
<ClInclude Include="util\rand.h" />
<ClInclude Include="util\resolve.h" />
<ClInclude Include="util\rng.h" />
<ClInclude Include="util\sql.h" />
<ClInclude Include="util\storage.h" />
<ClInclude Include="util\translation.h" />
<ClInclude Include="util\umlaut.h" />
<ClInclude Include="util\unicode.h" />
<ClInclude Include="util\variant.h" />
<ClInclude Include="util\xml.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="util\attrib.c" />
<ClCompile Include="util\base36.c" />
<ClCompile Include="util\base36_test.c" />
<ClCompile Include="util\bsdstring.c" />
<ClCompile Include="util\bsdstring_test.c" />
<ClCompile Include="util\console.c" />
<ClCompile Include="util\critbit.c" />
<ClCompile Include="util\crmessage.c" />
<ClCompile Include="util\dice.c" />
<ClCompile Include="util\event.c" />
<ClCompile Include="util\eventbus.c" />
<ClCompile Include="util\filereader.c" />
<ClCompile Include="util\functions.c" />
<ClCompile Include="util\functions_test.c" />
<ClCompile Include="util\goodies.c" />
<ClCompile Include="util\language.c" />
<ClCompile Include="util\listbox.c" />
<ClCompile Include="util\lists.c" />
<ClCompile Include="util\log.c" />
<ClCompile Include="util\message.c" />
<ClCompile Include="util\nrmessage.c" />
<ClCompile Include="util\os.c" />
<ClCompile Include="util\parser.c" />
<ClCompile Include="util\quicklist.c" />
<ClCompile Include="util\quicklist_test.c" />
<ClCompile Include="util\rand.c" />
<ClCompile Include="util\resolve.c" />
<ClCompile Include="util\sql.c" />
<ClCompile Include="util\strings.c" />
<ClCompile Include="util\translation.c" />
<ClCompile Include="util\umlaut.c" />
<ClCompile Include="util\umlaut_test.c" />
<ClCompile Include="util\unicode.c" />
<ClCompile Include="util\xml.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -1,215 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Header Files">
<UniqueIdentifier>{93caffaa-508e-4e78-b1ba-5a8d6aa4ab9a}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Source Files">
<UniqueIdentifier>{77dd9146-7564-475b-a364-b1610046b1bb}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="util\attrib.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\base36.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\bsdstring.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\console.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\crmessage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\event.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\eventbus.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\filereader.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\functions.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\goodies.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\language.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\language_struct.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\listbox.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\lists.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\log.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\message.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\nrmessage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\nrmessage_struct.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\parser.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\rand.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\resolve.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\rng.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\sql.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\storage.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\translation.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\umlaut.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\unicode.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\variant.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\xml.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\quicklist.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\os.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="util\critbit.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="util\attrib.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\base36.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\base36_test.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\bsdstring.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\console.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\crmessage.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\dice.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\event.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\eventbus.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\filereader.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\functions.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\goodies.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\language.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\listbox.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\lists.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\log.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\message.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\nrmessage.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\parser.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\rand.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\resolve.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\sql.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\strings.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\translation.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\umlaut.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\unicode.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\xml.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\quicklist.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\quicklist_test.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\os.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\critbit.c">
<Filter>Header Files</Filter>
</ClCompile>
<ClCompile Include="util\functions_test.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\umlaut_test.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="util\bsdstring_test.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>