From 65c5b0a1387a5346566feac1b36a6780dc394994 Mon Sep 17 00:00:00 2001 From: Enno Rehling Date: Sun, 21 Feb 2010 01:32:27 +0000 Subject: [PATCH] skeleton structure for a basic server. which isn't the eressea server, because it has different C code. because the spells are not in there. --- src/basic/basic.sln | 47 +++++ src/basic/build.vcproj | 276 ++++++++++++++++++++++++++++++ src/basic/main.c | 6 + src/basic/server.c | 2 + src/common/bindings/bind_gmtool.c | 1 - src/common/build/curses.c | 1 - src/common/editing.c | 65 ------- src/common/editing.h | 19 -- src/common/gamecode.vcproj | 20 +++ src/common/gmtool.c | 43 ++++- src/common/gmtool.h | 15 +- src/common/lua-bindings.vcproj | 55 ++---- src/common/server.vcproj | 218 ----------------------- src/common/util.vcproj | 16 ++ src/external/external.vcproj | 55 ++---- 15 files changed, 438 insertions(+), 401 deletions(-) create mode 100644 src/basic/basic.sln create mode 100644 src/basic/build.vcproj create mode 100644 src/basic/main.c create mode 100644 src/basic/server.c delete mode 100644 src/common/editing.c delete mode 100644 src/common/editing.h delete mode 100644 src/common/server.vcproj diff --git a/src/basic/basic.sln b/src/basic/basic.sln new file mode 100644 index 000000000..99755e6e0 --- /dev/null +++ b/src/basic/basic.sln @@ -0,0 +1,47 @@ +Microsoft Visual Studio Solution File, Format Version 9.00 +# Visual Studio 2005 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "kernel", "..\common\kernel.vcproj", "{6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gamecode", "..\common\gamecode.vcproj", "{1E8BFF9E-3044-0742-992F-C5765B80FE65}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "util", "..\common\util.vcproj", "{F70CFB27-8A2F-E447-B452-4E1C590EDA6D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lua-bindings", "..\common\lua-bindings.vcproj", "{75501170-51C2-E641-BA8B-EDC008184192}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "external", "..\external\external.vcproj", "{F9AE4586-8F65-486B-9666-744839E40A54}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "build", "build.vcproj", "{4A17DAEE-2261-4E2C-96F6-BA4132A09551}" +EndProject +Global + GlobalSection(SubversionScc) = preSolution + Svn-Managed = True + Manager = AnkhSVN - Subversion Support for Visual Studio + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Debug|Win32.ActiveCfg = Debug|Win32 + {6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Release|Win32.ActiveCfg = Release|Win32 + {6F104C0A-DDF5-A34B-A89C-0DC278DCEF6D}.Release|Win32.Build.0 = Release|Win32 + {1E8BFF9E-3044-0742-992F-C5765B80FE65}.Debug|Win32.ActiveCfg = Debug|Win32 + {1E8BFF9E-3044-0742-992F-C5765B80FE65}.Release|Win32.ActiveCfg = Release|Win32 + {1E8BFF9E-3044-0742-992F-C5765B80FE65}.Release|Win32.Build.0 = Release|Win32 + {F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Debug|Win32.ActiveCfg = Debug|Win32 + {F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Release|Win32.ActiveCfg = Release|Win32 + {F70CFB27-8A2F-E447-B452-4E1C590EDA6D}.Release|Win32.Build.0 = Release|Win32 + {75501170-51C2-E641-BA8B-EDC008184192}.Debug|Win32.ActiveCfg = Debug|Win32 + {75501170-51C2-E641-BA8B-EDC008184192}.Release|Win32.ActiveCfg = Release|Win32 + {75501170-51C2-E641-BA8B-EDC008184192}.Release|Win32.Build.0 = Release|Win32 + {F9AE4586-8F65-486B-9666-744839E40A54}.Debug|Win32.ActiveCfg = Debug|Win32 + {F9AE4586-8F65-486B-9666-744839E40A54}.Release|Win32.ActiveCfg = Release|Win32 + {F9AE4586-8F65-486B-9666-744839E40A54}.Release|Win32.Build.0 = Release|Win32 + {4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Debug|Win32.ActiveCfg = Debug|Win32 + {4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Debug|Win32.Build.0 = Debug|Win32 + {4A17DAEE-2261-4E2C-96F6-BA4132A09551}.Release|Win32.ActiveCfg = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/src/basic/build.vcproj b/src/basic/build.vcproj new file mode 100644 index 000000000..c130acf59 --- /dev/null +++ b/src/basic/build.vcproj @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/basic/main.c b/src/basic/main.c new file mode 100644 index 000000000..bf13b20d0 --- /dev/null +++ b/src/basic/main.c @@ -0,0 +1,6 @@ +#include + +int main(int argc, char ** argv) +{ + return 0; +} diff --git a/src/basic/server.c b/src/basic/server.c new file mode 100644 index 000000000..b6d606005 --- /dev/null +++ b/src/basic/server.c @@ -0,0 +1,2 @@ +#include "stdafx.h" +#include "main.c" diff --git a/src/common/bindings/bind_gmtool.c b/src/common/bindings/bind_gmtool.c index 3385b66c7..b8f6d8445 100644 --- a/src/common/bindings/bind_gmtool.c +++ b/src/common/bindings/bind_gmtool.c @@ -4,7 +4,6 @@ #include "bind_gmtool.h" #include "../gmtool.h" #include "../gmtool_structs.h" -#include #include #include diff --git a/src/common/build/curses.c b/src/common/build/curses.c index 588e24944..c2c21fb77 100644 --- a/src/common/build/curses.c +++ b/src/common/build/curses.c @@ -4,4 +4,3 @@ #include #include -#include diff --git a/src/common/editing.c b/src/common/editing.c deleted file mode 100644 index 0ffc33ab2..000000000 --- a/src/common/editing.c +++ /dev/null @@ -1,65 +0,0 @@ -/* vi: set ts=2: - * +-------------------+ Christian Schlittchen - * | | Enno Rehling - * | Eressea PBEM host | Katja Zedel - * | (c) 1998 - 2006 | - * | | This program may not be used, modified or distributed - * +-------------------+ without prior permission by the authors of Eressea. - * - */ - -#include -#include -#include "editing.h" - -#include -#include -#include -#include -#include - -void -seed_players(const char * filename, boolean new_island) -{ - newfaction * players = read_newfactions(filename); - if (players!=NULL) { - while (players) { - int n = listlen(players); - int k = (n+ISLANDSIZE-1)/ISLANDSIZE; - k = n / k; - n = autoseed(&players, k, new_island?0:TURNS_PER_ISLAND); - if (n==0) { - break; - } - } - } -} - -void -make_block(int x, int y, int radius, const struct terrain_type * terrain) -{ - int cx, cy; - region *r; - plane * pl = findplane(x, y); - - if (terrain==NULL) return; - - for (cx = x - radius; cx != x+radius; ++cx) { - for (cy = y - radius; cy != y+radius; ++cy) { - int nx = cx, ny = cy; - pnormalize(&nx, &ny, pl); - if (koor_distance(nx, ny, x, y) < radius) { - if (!findregion(nx, ny)) { - r = new_region(nx, ny, pl, 0); - terraform_region(r, terrain); - } - } - } - } -} - -void -make_island(int x, int y, int size) -{ - /* region_list * island; */ -} diff --git a/src/common/editing.h b/src/common/editing.h deleted file mode 100644 index 1aad76790..000000000 --- a/src/common/editing.h +++ /dev/null @@ -1,19 +0,0 @@ -/* vi: set ts=2: - * +-------------------+ Christian Schlittchen - * | | Enno Rehling - * | Eressea PBEM host | Katja Zedel - * | (c) 1998 - 2006 | - * | | This program may not be used, modified or distributed - * +-------------------+ without prior permission by the authors of Eressea. - * - */ - -#ifndef GM_EDITING -#define GM_EDITING - -struct terrain_type; -extern void make_block(int x, int y, int radius, const struct terrain_type * terrain); -extern void make_island(int x, int y, int size); -extern void seed_players(const char * filename, boolean new_island); - -#endif /* GM_EDITING */ diff --git a/src/common/gamecode.vcproj b/src/common/gamecode.vcproj index 17e7570fb..f198fb2b5 100644 --- a/src/common/gamecode.vcproj +++ b/src/common/gamecode.vcproj @@ -330,6 +330,26 @@ > + + + + + + + + + + diff --git a/src/common/gmtool.c b/src/common/gmtool.c index 17e3cdf56..4d718b307 100644 --- a/src/common/gmtool.c +++ b/src/common/gmtool.c @@ -15,7 +15,6 @@ #include "gmtool.h" #include "gmtool_structs.h" -#include "editing.h" #include #include @@ -54,6 +53,7 @@ #include #include +#include #include #include #include @@ -1259,3 +1259,44 @@ curses_readline(struct lua_State * L, char * buffer, size_t size, const char * p askstring(hstatus, prompt, buffer, size); return buffer[0]!=0; } + + +void +seed_players(const char * filename, boolean new_island) +{ + newfaction * players = read_newfactions(filename); + if (players!=NULL) { + while (players) { + int n = listlen(players); + int k = (n+ISLANDSIZE-1)/ISLANDSIZE; + k = n / k; + n = autoseed(&players, k, new_island?0:TURNS_PER_ISLAND); + if (n==0) { + break; + } + } + } +} + +void +make_block(int x, int y, int radius, const struct terrain_type * terrain) +{ + int cx, cy; + region *r; + plane * pl = findplane(x, y); + + if (terrain==NULL) return; + + for (cx = x - radius; cx != x+radius; ++cx) { + for (cy = y - radius; cy != y+radius; ++cy) { + int nx = cx, ny = cy; + pnormalize(&nx, &ny, pl); + if (koor_distance(nx, ny, x, y) < radius) { + if (!findregion(nx, ny)) { + r = new_region(nx, ny, pl, 0); + terraform_region(r, terrain); + } + } + } + } +} diff --git a/src/common/gmtool.h b/src/common/gmtool.h index daa99f27b..1912e03ee 100644 --- a/src/common/gmtool.h +++ b/src/common/gmtool.h @@ -19,18 +19,21 @@ extern "C" { struct state; struct region; - extern int gmmain(int argc, char *argv[]); - extern int curses_readline(struct lua_State * L, char * buffer, size_t size, const char * prompt); + int gmmain(int argc, char *argv[]); + int curses_readline(struct lua_State * L, char * buffer, size_t size, const char * prompt); - extern void highlight_region(struct region *r, int on); - extern void select_coordinate(struct selection * selected, int x, int y, int on); - extern void run_mapper(void); + void highlight_region(struct region *r, int on); + void select_coordinate(struct selection * selected, int x, int y, int on); + void run_mapper(void); - extern int force_color; + int force_color; struct state * state_open(void); void state_close(struct state * ); + void make_block(int x, int y, int radius, const struct terrain_type * terrain); + void seed_players(const char * filename, boolean new_island); + #ifdef __cplusplus } #endif diff --git a/src/common/lua-bindings.vcproj b/src/common/lua-bindings.vcproj index 7f294d7a2..402507b04 100644 --- a/src/common/lua-bindings.vcproj +++ b/src/common/lua-bindings.vcproj @@ -17,9 +17,9 @@ - @@ -91,21 +80,15 @@ - - - @@ -175,12 +146,6 @@ - - diff --git a/src/common/server.vcproj b/src/common/server.vcproj deleted file mode 100644 index 3ba94ac39..000000000 --- a/src/common/server.vcproj +++ /dev/null @@ -1,218 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/src/common/util.vcproj b/src/common/util.vcproj index 28a92ce00..74e41fce1 100644 --- a/src/common/util.vcproj +++ b/src/common/util.vcproj @@ -174,6 +174,10 @@ RelativePath=".\util\bsdstring.h" > + + @@ -210,6 +214,10 @@ RelativePath=".\util\language_struct.h" > + + @@ -299,6 +307,10 @@ RelativePath=".\util\bsdstring.c" > + + @@ -335,6 +347,10 @@ RelativePath=".\util\language.c" > + + diff --git a/src/external/external.vcproj b/src/external/external.vcproj index 305534095..b13d25bb4 100644 --- a/src/external/external.vcproj +++ b/src/external/external.vcproj @@ -17,9 +17,9 @@ - @@ -91,21 +80,15 @@ - - - @@ -175,12 +146,6 @@ - -