From 14715f093e2dce9598e9e3f8e9e2e672d85fcb48 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 4 Jan 2004 22:29:33 +0000 Subject: [PATCH] =?UTF-8?q?Die=20Sache=20mit=20dem=20last=20turn=20ist=20j?= =?UTF-8?q?etzt=20ordentlich=20gemacht,=20und=20vom=20turn=20im=20datenfil?= =?UTF-8?q?e=20abh=C3=A4ngig,=20nicht=20mehr=20davon,=20wie=20turn=20selbs?= =?UTF-8?q?t=20gesetzt=20ist.=20Au=C3=9Ferdem=20geht=20der=20lua-Kram=20je?= =?UTF-8?q?tzt=20auch,=20wenn=20ALLIANCES=20nicht=20defined=20ist,=20was?= =?UTF-8?q?=20wichtig=20ist=20wenn=20ich=20mal=20das=20regul=C3=A4re=20Ere?= =?UTF-8?q?ssea=20umstellen=20sollte.=20Und=20ein=20separates=20Projekt=20?= =?UTF-8?q?f=C3=BCr=20Server=20mit=20und=20ohne=20lua=20gibt's=20f=C3=BCr?= =?UTF-8?q?=20Visual=20Studio=20jetzt=20auch=20noch.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/gamecode/economy.c | 24 -- src/common/kernel/eressea.h | 1 + src/common/kernel/race.c | 2 - src/common/kernel/race.h | 2 - src/common/kernel/save.c | 4 +- src/common/modules/modules.vcproj | 18 ++ src/eressea.sln | 42 ++++ src/eressea/eressea-lua.vcproj | 399 ++++++++++++++++++++++++++++++ src/eressea/eressea.vcproj | 129 +--------- src/eressea/lua/alliance.cpp | 3 + src/eressea/lua/faction.cpp | 10 +- src/eressea/server.cpp | 2 + 12 files changed, 475 insertions(+), 161 deletions(-) create mode 100644 src/eressea/eressea-lua.vcproj diff --git a/src/common/gamecode/economy.c b/src/common/gamecode/economy.c index 3d542db32..1f8051a87 100644 --- a/src/common/gamecode/economy.c +++ b/src/common/gamecode/economy.c @@ -133,27 +133,7 @@ scramble(void *data, int n, size_t width) memcpy((char*)data+k*width, temp, width); } } -#if 0 -#define MAX 6 -int oi[MAX]; -void -test_scramble(void) -{ - int i; - for (i=0;i!=MAX;++i) { - oi[i] = i; - } - scramble(oi, MAX, sizeof(int)); - for (i=0;i!=MAX;++i) { - int j; - for (j=0;j!=MAX;++j) { - if (oi[j]==i) break; - } - assert(j!=MAX); - } -} -#endif static void expandorders(region * r, request * requests) { @@ -190,15 +170,11 @@ expandorders(region * r, request * requests) } else { oa = NULL; } -#if 0 - freelist(requests); -#else while (requests) { request * o = requests->next; free(requests); requests = o; } -#endif } /* ------------------------------------------------------------- */ diff --git a/src/common/kernel/eressea.h b/src/common/kernel/eressea.h index 5456e5153..03015fa66 100644 --- a/src/common/kernel/eressea.h +++ b/src/common/kernel/eressea.h @@ -1155,6 +1155,7 @@ typedef struct settings { unsigned int maxunits; struct attrib *attribs; unsigned int data_version; + unsigned int data_turn; boolean disabled[MAXKEYWORDS]; struct param * parameters; } settings; diff --git a/src/common/kernel/race.c b/src/common/kernel/race.c index c7db3e395..e76ce44b7 100644 --- a/src/common/kernel/race.c +++ b/src/common/kernel/race.c @@ -193,13 +193,11 @@ set_show_item(faction *f, item_t i) a->data.v = (void*)olditemtype[i]; } -#ifdef NEW_STARTEQUIPMENT static item * equipment; void add_equipment(const item_type * itype, int number) { if (itype!=NULL) i_change(&equipment, itype, number); } -#endif void give_starting_equipment(struct region *r, struct unit *u) diff --git a/src/common/kernel/race.h b/src/common/kernel/race.h index 3b5c76485..0ea6a10db 100644 --- a/src/common/kernel/race.h +++ b/src/common/kernel/race.h @@ -167,9 +167,7 @@ extern int read_race_reference(const struct race ** rp, FILE * F); extern const char * raceprefix(const struct unit *u); -#ifdef NEW_STARTEQUIPMENT extern void add_equipment(const struct item_type * itype, int number); -#endif extern void give_starting_equipment(struct region *r, struct unit *u); #ifdef __cplusplus diff --git a/src/common/kernel/save.c b/src/common/kernel/save.c index 35bf6ccb6..9ffd3ce8b 100644 --- a/src/common/kernel/save.c +++ b/src/common/kernel/save.c @@ -574,7 +574,7 @@ factionorders(void) /* TODO: +1 ist ein Workaround, weil turn erst in process_orders * incrementiert wird. */ - f->lastorders = turn+1; + f->lastorders = global.data_turn+1; } else log_warning(("Befehle für die ungültige Partei %s\n", fid)); @@ -894,7 +894,7 @@ readgame(const char * filename, int backup) exit(-1); } #endif - turn = ri(F); + global.data_turn = turn = ri(F); /* read_dynamictypes(); */ /* max_unique_id = */ ri(F); nextborder = ri(F); diff --git a/src/common/modules/modules.vcproj b/src/common/modules/modules.vcproj index 70eb79716..ac0b7d0ce 100644 --- a/src/common/modules/modules.vcproj +++ b/src/common/modules/modules.vcproj @@ -145,12 +145,30 @@ + + + + + + + + + + + + diff --git a/src/eressea.sln b/src/eressea.sln index 50d9167e1..3fe246fb9 100644 --- a/src/eressea.sln +++ b/src/eressea.sln @@ -60,54 +60,96 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "util", "common\util\util.vc ProjectSection(ProjectDependencies) = postProject EndProjectSection EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "eressea-lua", "eressea\eressea-lua.vcproj", "{749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}" + ProjectSection(ProjectDependencies) = postProject + {C14E3D2B-8189-4570-A4E3-9010C873E4FD} = {C14E3D2B-8189-4570-A4E3-9010C873E4FD} + {79659D44-EC28-42B9-9475-6C0D62D0AAE0} = {79659D44-EC28-42B9-9475-6C0D62D0AAE0} + {EF495253-2EEC-4F83-B6C0-D651F88B2198} = {EF495253-2EEC-4F83-B6C0-D651F88B2198} + {1D80D05F-BCF5-4971-8F06-D9581FD3B1F4} = {1D80D05F-BCF5-4971-8F06-D9581FD3B1F4} + {601CF164-F483-4DE7-8014-64BDD30680B5} = {601CF164-F483-4DE7-8014-64BDD30680B5} + {EDB0DE67-8215-4AF7-ACA1-F23CB11FF211} = {EDB0DE67-8215-4AF7-ACA1-F23CB11FF211} + {0EE778AB-8445-40DB-8F65-6BE378A91B97} = {0EE778AB-8445-40DB-8F65-6BE378A91B97} + {330712B5-8B27-4B17-B3CF-7A02CC0F93C3} = {330712B5-8B27-4B17-B3CF-7A02CC0F93C3} + {4C837BEC-A428-4287-84B3-8F8F9DE7FA00} = {4C837BEC-A428-4287-84B3-8F8F9DE7FA00} + EndProjectSection +EndProject Global GlobalSection(SolutionConfiguration) = preSolution Debug = Debug + Profile = Profile Release = Release EndGlobalSection GlobalSection(ProjectConfiguration) = postSolution {330712B5-8B27-4B17-B3CF-7A02CC0F93C3}.Debug.ActiveCfg = Debug|Win32 {330712B5-8B27-4B17-B3CF-7A02CC0F93C3}.Debug.Build.0 = Debug|Win32 + {330712B5-8B27-4B17-B3CF-7A02CC0F93C3}.Profile.ActiveCfg = Release|Win32 + {330712B5-8B27-4B17-B3CF-7A02CC0F93C3}.Profile.Build.0 = Release|Win32 {330712B5-8B27-4B17-B3CF-7A02CC0F93C3}.Release.ActiveCfg = Release|Win32 {330712B5-8B27-4B17-B3CF-7A02CC0F93C3}.Release.Build.0 = Release|Win32 {B859D542-781E-4647-BCAB-3FE5ED077366}.Debug.ActiveCfg = Debug|Win32 {B859D542-781E-4647-BCAB-3FE5ED077366}.Debug.Build.0 = Debug|Win32 + {B859D542-781E-4647-BCAB-3FE5ED077366}.Profile.ActiveCfg = Profile|Win32 + {B859D542-781E-4647-BCAB-3FE5ED077366}.Profile.Build.0 = Profile|Win32 {B859D542-781E-4647-BCAB-3FE5ED077366}.Release.ActiveCfg = Release|Win32 {B859D542-781E-4647-BCAB-3FE5ED077366}.Release.Build.0 = Release|Win32 {79659D44-EC28-42B9-9475-6C0D62D0AAE0}.Debug.ActiveCfg = Debug|Win32 {79659D44-EC28-42B9-9475-6C0D62D0AAE0}.Debug.Build.0 = Debug|Win32 + {79659D44-EC28-42B9-9475-6C0D62D0AAE0}.Profile.ActiveCfg = Profile|Win32 + {79659D44-EC28-42B9-9475-6C0D62D0AAE0}.Profile.Build.0 = Profile|Win32 {79659D44-EC28-42B9-9475-6C0D62D0AAE0}.Release.ActiveCfg = Release|Win32 {79659D44-EC28-42B9-9475-6C0D62D0AAE0}.Release.Build.0 = Release|Win32 {C14E3D2B-8189-4570-A4E3-9010C873E4FD}.Debug.ActiveCfg = Debug|Win32 {C14E3D2B-8189-4570-A4E3-9010C873E4FD}.Debug.Build.0 = Debug|Win32 + {C14E3D2B-8189-4570-A4E3-9010C873E4FD}.Profile.ActiveCfg = Debug|Win32 + {C14E3D2B-8189-4570-A4E3-9010C873E4FD}.Profile.Build.0 = Debug|Win32 {C14E3D2B-8189-4570-A4E3-9010C873E4FD}.Release.ActiveCfg = Release|Win32 {C14E3D2B-8189-4570-A4E3-9010C873E4FD}.Release.Build.0 = Release|Win32 {EDB0DE67-8215-4AF7-ACA1-F23CB11FF211}.Debug.ActiveCfg = Debug|Win32 {EDB0DE67-8215-4AF7-ACA1-F23CB11FF211}.Debug.Build.0 = Debug|Win32 + {EDB0DE67-8215-4AF7-ACA1-F23CB11FF211}.Profile.ActiveCfg = Profile|Win32 + {EDB0DE67-8215-4AF7-ACA1-F23CB11FF211}.Profile.Build.0 = Profile|Win32 {EDB0DE67-8215-4AF7-ACA1-F23CB11FF211}.Release.ActiveCfg = Release|Win32 {EDB0DE67-8215-4AF7-ACA1-F23CB11FF211}.Release.Build.0 = Release|Win32 {17F83AAB-352D-4F68-ADA6-09F36D86826F}.Debug.ActiveCfg = Debug|Win32 + {17F83AAB-352D-4F68-ADA6-09F36D86826F}.Profile.ActiveCfg = Debug|Win32 + {17F83AAB-352D-4F68-ADA6-09F36D86826F}.Profile.Build.0 = Debug|Win32 {17F83AAB-352D-4F68-ADA6-09F36D86826F}.Release.ActiveCfg = Release|Win32 {601CF164-F483-4DE7-8014-64BDD30680B5}.Debug.ActiveCfg = Debug|Win32 {601CF164-F483-4DE7-8014-64BDD30680B5}.Debug.Build.0 = Debug|Win32 + {601CF164-F483-4DE7-8014-64BDD30680B5}.Profile.ActiveCfg = Release|Win32 + {601CF164-F483-4DE7-8014-64BDD30680B5}.Profile.Build.0 = Release|Win32 {601CF164-F483-4DE7-8014-64BDD30680B5}.Release.ActiveCfg = Release|Win32 {601CF164-F483-4DE7-8014-64BDD30680B5}.Release.Build.0 = Release|Win32 {4C837BEC-A428-4287-84B3-8F8F9DE7FA00}.Debug.ActiveCfg = Debug|Win32 {4C837BEC-A428-4287-84B3-8F8F9DE7FA00}.Debug.Build.0 = Debug|Win32 + {4C837BEC-A428-4287-84B3-8F8F9DE7FA00}.Profile.ActiveCfg = Release|Win32 + {4C837BEC-A428-4287-84B3-8F8F9DE7FA00}.Profile.Build.0 = Release|Win32 {4C837BEC-A428-4287-84B3-8F8F9DE7FA00}.Release.ActiveCfg = Release|Win32 {4C837BEC-A428-4287-84B3-8F8F9DE7FA00}.Release.Build.0 = Release|Win32 {0EE778AB-8445-40DB-8F65-6BE378A91B97}.Debug.ActiveCfg = Debug|Win32 {0EE778AB-8445-40DB-8F65-6BE378A91B97}.Debug.Build.0 = Debug|Win32 + {0EE778AB-8445-40DB-8F65-6BE378A91B97}.Profile.ActiveCfg = Debug|Win32 + {0EE778AB-8445-40DB-8F65-6BE378A91B97}.Profile.Build.0 = Debug|Win32 {0EE778AB-8445-40DB-8F65-6BE378A91B97}.Release.ActiveCfg = Release|Win32 {0EE778AB-8445-40DB-8F65-6BE378A91B97}.Release.Build.0 = Release|Win32 {EF495253-2EEC-4F83-B6C0-D651F88B2198}.Debug.ActiveCfg = Debug|Win32 {EF495253-2EEC-4F83-B6C0-D651F88B2198}.Debug.Build.0 = Debug|Win32 + {EF495253-2EEC-4F83-B6C0-D651F88B2198}.Profile.ActiveCfg = Release|Win32 + {EF495253-2EEC-4F83-B6C0-D651F88B2198}.Profile.Build.0 = Release|Win32 {EF495253-2EEC-4F83-B6C0-D651F88B2198}.Release.ActiveCfg = Release|Win32 {EF495253-2EEC-4F83-B6C0-D651F88B2198}.Release.Build.0 = Release|Win32 {1D80D05F-BCF5-4971-8F06-D9581FD3B1F4}.Debug.ActiveCfg = Debug|Win32 {1D80D05F-BCF5-4971-8F06-D9581FD3B1F4}.Debug.Build.0 = Debug|Win32 + {1D80D05F-BCF5-4971-8F06-D9581FD3B1F4}.Profile.ActiveCfg = Profile|Win32 + {1D80D05F-BCF5-4971-8F06-D9581FD3B1F4}.Profile.Build.0 = Profile|Win32 {1D80D05F-BCF5-4971-8F06-D9581FD3B1F4}.Release.ActiveCfg = Release|Win32 {1D80D05F-BCF5-4971-8F06-D9581FD3B1F4}.Release.Build.0 = Release|Win32 + {749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Debug.ActiveCfg = Debug|Win32 + {749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Debug.Build.0 = Debug|Win32 + {749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Profile.ActiveCfg = Profile|Win32 + {749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Profile.Build.0 = Profile|Win32 + {749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Release.ActiveCfg = Release|Win32 + {749A2F7C-B9C3-4CEB-B1B2-1D4587E68719}.Release.Build.0 = Release|Win32 EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution EndGlobalSection diff --git a/src/eressea/eressea-lua.vcproj b/src/eressea/eressea-lua.vcproj new file mode 100644 index 000000000..94a8c81c5 --- /dev/null +++ b/src/eressea/eressea-lua.vcproj @@ -0,0 +1,399 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/eressea/eressea.vcproj b/src/eressea/eressea.vcproj index 417e13f76..7231508f2 100644 --- a/src/eressea/eressea.vcproj +++ b/src/eressea/eressea.vcproj @@ -215,127 +215,6 @@ RelativePath="..\todo.txt"> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + RelativePath=".\main.c"> diff --git a/src/eressea/lua/alliance.cpp b/src/eressea/lua/alliance.cpp index 14f3b9002..7b715ac74 100644 --- a/src/eressea/lua/alliance.cpp +++ b/src/eressea/lua/alliance.cpp @@ -1,5 +1,7 @@ #include #include + +#ifdef ALLIANCES #include "list.h" // kernel includes @@ -51,3 +53,4 @@ bind_alliance(lua_State * L) .property("factions", &alliance_factions, return_stl_iterator) ]; } +#endif diff --git a/src/eressea/lua/faction.cpp b/src/eressea/lua/faction.cpp index dc53c8030..1528c52a8 100644 --- a/src/eressea/lua/faction.cpp +++ b/src/eressea/lua/faction.cpp @@ -5,7 +5,9 @@ // kernel includes #include #include -#include +#ifdef ALLIANCES +# include +#endif // lua includes #include @@ -43,6 +45,7 @@ faction_units(const faction& f) return eressea::list(f.units); } +#ifdef ALLIANCES static void faction_setalliance(faction& f, alliance * team) { @@ -54,8 +57,7 @@ faction_getalliance(const faction& f) { return f.alliance; } - - +#endif void bind_faction(lua_State * L) @@ -73,6 +75,8 @@ bind_faction(lua_State * L) .def_readwrite("subscription", &faction::subscription) .def_readwrite("lastturn", &faction::lastorders) .property("units", &faction_units, return_stl_iterator) +#ifdef ALLIANCES .property("alliance", &faction_getalliance, &faction_setalliance) +#endif ]; } diff --git a/src/eressea/server.cpp b/src/eressea/server.cpp index 42c362ad8..c35a453da 100644 --- a/src/eressea/server.cpp +++ b/src/eressea/server.cpp @@ -326,7 +326,9 @@ lua_init(void) luaopen_io(luaState); luabind::open(luaState); bind_eressea(luaState); +#ifdef ALLIANCES bind_alliance(luaState); +#endif bind_region(luaState); bind_faction(luaState); bind_unit(luaState);