removing the core directory (moving to res and scripts).

it's from when open-source Eressea was limited, and we no longer need the separation.
JSON configuration for ship flags.
This commit is contained in:
Enno Rehling 2014-07-28 14:27:30 +02:00
parent 44c89e26ec
commit bd2809a975
79 changed files with 318 additions and 161 deletions

View File

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

View File

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

View File

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

16
core/.gitignore vendored
View File

@ -1,16 +0,0 @@
bin/
Debug/
Release/
*~
*.user
*.pdb
*.suo
*.sdf
*.opensdf
*.ipch
*.sh
*.tmp
src/*.vcproj.*.user
tags
build-vs2010
config

View File

@ -1,15 +0,0 @@
Copyright (c) 1998-2010, Enno Rehling <enno@eressea.de>
Katja Zedel <katze@felidae.kn-bremen.de
Christian Schlittchen <corwin@amber.kn-bremen.de>
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

View File

@ -1,10 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE catalog
PUBLIC "-//OASIS/DTD Entity Resolution XML Catalog V1.0//EN"
"http://www.oasis-open.org/committees/entity/release/1.0/catalog.dtd">
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog">
<rewriteURI
uriStartString="eressea:///core/"
rewritePrefix="../core/res/" />
</catalog>

View File

@ -1,110 +0,0 @@
<?xml version="1.0"?>
<eressea xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="eressea:///core/messages.xml"/>
<!-- Localization -->
<xi:include href="eressea:///core/de/strings.xml"/>
<xi:include href="eressea:///core/en/strings.xml"/>
<xi:include href="eressea:///core/prefixes.xml"/>
<xi:include href="eressea:///core/calendar.xml"/>
<calendar name="secondage" newyear="month_1" start="0" />
<xi:include href="eressea:///core/common/resources.xml"/>
<xi:include href="eressea:///core/common/items.xml" />
<xi:include href="eressea:///core/common/potions.xml" />
<xi:include href="armor.xml" />
<xi:include href="weapons.xml" />
<xi:include href="items.xml" />
<xi:include href="races.xml"/>
<!-- <xi:include href="ships.xml"/> -->
<xi:include href="eressea:///core/ships.xml"/>
<xi:include href="buildings.xml"/>
<xi:include href="eressea:///core/common/buildings.xml"/>
<xi:include href="eressea:///core/spells.xml"/>
<xi:include href="terrains.xml"/>
<equipment>
<set name="first_unit">
<!-- this is given to a faction's first unit -->
<item name="log" amount="30"/>
<item name="stone" amount="30"/>
<item name="money" amount="4200"/>
</set>
<set name="new_faction">
<!-- this goes into the faction's global pool -->
<item name="sword" amount="1"/>
</set>
</equipment>
<game name="Demonstration">
<!-- Game specific settings -->
<order name="GM" disable="yes"/>
<order name="SPIONIEREN" disable="yes"/>
<skill name="espionage" enable="false"/>
<skill name="alchemy" enable="true"/>
<skill name="armorer" enable="true"/>
<skill name="bow" enable="true"/>
<skill name="building" enable="true"/>
<skill name="cartmaking" enable="true"/>
<skill name="catapult" enable="true"/>
<skill name="crossbow" enable="true"/>
<skill name="entertainment" enable="true"/>
<skill name="espionage" enable="true"/>
<skill name="forestry" enable="true"/>
<skill name="herbalism" enable="true"/>
<skill name="magic" enable="true"/>
<skill name="melee" enable="true"/>
<skill name="mining" enable="true"/>
<skill name="perception" enable="true"/>
<skill name="polearm" enable="true"/>
<skill name="quarrying" enable="true"/>
<skill name="riding" enable="true"/>
<skill name="roadwork" enable="true"/>
<skill name="sailing" enable="true"/>
<skill name="shipcraft" enable="true"/>
<skill name="stamina" enable="true"/>
<skill name="stealth" enable="true"/>
<skill name="tactics" enable="true"/>
<skill name="taxation" enable="true"/>
<skill name="trade" enable="true"/>
<skill name="training" enable="true"/>
<skill name="unarmed" enable="true"/>
<skill name="weaponsmithing" enable="true"/>
<param name="NewbieImmunity" value="8"/>
<param name="entertain.base" value="0"/>
<param name="entertain.perlevel" value="20"/>
<param name="nmr.timeout" value="4"/>
<param name="nmr.removenewbie" value="2"/>
<param name="GiveRestriction" value="3"/>
<param name="hunger.long" value="1"/>
<param name="rules.limit.faction" value="500"/>
<param name="modules.astralspace" value="0"/>
<param name="modules.wormholes" value="0"/>
<param name="modules.markets" value="0"/>
</game>
<strings>
<string name="mailto">
<text locale="de">arda-server@example.com</text>
<text locale="en">arda-server@example.com</text>
</string>
<string name="newbie_info_1">
<text locale="de">Bitte denke daran, deine Befehle mit dem Betreff
ERESSEA BEFEHLE an arda-server@example.com zu senden.</text>
<text locale="en">Remember to send your orders to
arda-server@example.com with the subject ERESSEA ORDERS.</text>
</string>
<string name="mailcmd">
<text locale="de">ARDA BEFEHLE</text>
<text locale="en">ARDA ORDERS</text>
</string>
<string name="defaultorder">
<text locale="de">ARBEITEN</text>
<text locale="en">WORK</text>
</string>
</strings>
</eressea>

View File

@ -210,7 +210,10 @@ static void json_terrain(cJSON *json, terrain_type *ter) {
static void json_building(cJSON *json, building_type *bt) { static void json_building(cJSON *json, building_type *bt) {
cJSON *child; cJSON *child;
if (json->type!=cJSON_Object) { const char *flags[] = {
"nodestroy", "nobuild", "unique", "decay", "dynamic", "magic", "oneperturn", "namechange", 0
};
if (json->type != cJSON_Object) {
log_error_n("building %s is not a json object: %d", json->string, json->type); log_error_n("building %s is not a json object: %d", json->string, json->type);
return; return;
} }
@ -223,6 +226,9 @@ static void json_building(cJSON *json, building_type *bt) {
else if (strcmp(child->string, "maintenance") == 0) { else if (strcmp(child->string, "maintenance") == 0) {
json_maintenance(child, &bt->maintenance); json_maintenance(child, &bt->maintenance);
} }
else if (strcmp(child->string, "flags") == 0) {
json_flags(child, flags);
}
break; break;
case cJSON_Object: case cJSON_Object:
if (strcmp(child->string, "construction")==0) { if (strcmp(child->string, "construction")==0) {

View File

@ -111,7 +111,7 @@ static char* get_command(const order *ord, char *sbuffer, size_t size) {
const struct locale *lang = ORD_LOCALE(ord); const struct locale *lang = ORD_LOCALE(ord);
if (size > 0) { if (size > 0) {
const char *str = (const char *)LOC(lang, keyword(kwd)); const char *str = (const char *)LOC(lang, keyword(kwd));
assert(str); assert(str);
if (text) --size; if (text) --size;
bytes = (int)strlcpy(bufp, str, size); bytes = (int)strlcpy(bufp, str, size);
if (wrptr(&bufp, &size, bytes) != 0) WARN_STATIC_BUFFER(); if (wrptr(&bufp, &size, bytes) != 0) WARN_STATIC_BUFFER();

View File

@ -261,7 +261,7 @@ const char *raceprefix(const unit * u)
const char *racename(const struct locale *loc, const unit * u, const race * rc) const char *racename(const struct locale *loc, const unit * u, const race * rc)
{ {
const char *prefix = raceprefix(u); const char *str, *prefix = raceprefix(u);
if (prefix != NULL) { if (prefix != NULL) {
static char lbuf[80]; static char lbuf[80];
@ -283,7 +283,8 @@ const char *racename(const struct locale *loc, const unit * u, const race * rc)
return lbuf; return lbuf;
} }
return LOC(loc, rc_name(rc, u->number != 1)); str = LOC(loc, rc_name(rc, u->number != 1));
return str ? str : rc->_name[0];
} }
int int

View File

@ -201,9 +201,6 @@ int fix_demand(region * rd)
} }
for (rl = rlist; rl; rl = rl->next) { for (rl = rlist; rl; rl = rl->next) {
region *r = rl->data; region *r = rl->data;
if (!fval(r, RF_CHAOTIC)) {
log_debug("fixing demand in %s\n", regionname(r, NULL));
}
sale = mlux[rng_int() % maxlux]; sale = mlux[rng_int() % maxlux];
if (sale) if (sale)
setluxuries(r, sale); setluxuries(r, sale);

36
src/tools/atoi36.c Normal file
View File

@ -0,0 +1,36 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2001 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#include <base36.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
int i = 1, reverse = 0;
if (strstr(argv[0], "itoa36"))
reverse = 1;
if (argc > 1) {
if (strcmp(argv[1], "-r") == 0) {
i = 2;
reverse = 1;
}
}
for (; i != argc; ++i) {
if (reverse) {
printf("%s -> %s\n", argv[i], itoa36(atoi(argv[i])));
} else
printf("%s -> %d\n", argv[i], atoi36(argv[i]));
}
return 0;
}

24
src/tools/gethash.c Normal file
View File

@ -0,0 +1,24 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
int main(int argc, char **argv)
{
char key[4];
char code[4];
char result[4];
int a, i, rot;
for (a = 1; a < argc; ++a) {
const char *str = argv[a];
size_t len = strlen(str);
str = str + len - 6;
memcpy(key, str, 3);
memcpy(code, str + 3, 3);
result[3] = key[3] = code[3] = 0;
rot = atoi(key);
for (i = 0; i != 3; ++i)
result[(i + rot) % 3] = ((code[i] + 10 - key[i]) % 10) + '0';
printf("%s %s\n", argv[a], result);
}
return 0;
}

244
src/tools/namegen.c Normal file
View File

@ -0,0 +1,244 @@
/* vi: set ts=2:
+-------------------+ Christian Schlittchen <corwin@amber.kn-bremen.de>
| | Enno Rehling <enno@eressea.de>
| Eressea PBEM host | Katja Zedel <katze@felidae.kn-bremen.de>
| (c) 1998 - 2001 | Henning Peters <faroul@beyond.kn-bremen.de>
| | Ingo Wilken <Ingo.Wilken@informatik.uni-oldenburg.de>
+-------------------+ Stefan Reich <reich@halbling.de>
This program may not be used, modified or distributed
without prior permission by the authors of Eressea.
*/
#include <stdio.h>
#include <config.h>
#include <eressea.h>
static char *dwarf_syllable1[] = {
"B", "D", "F", "G", "Gl", "H", "K", "L", "M", "N", "R", "S", "T", "Th", "V",
};
static char *dwarf_syllable2[] = {
"a", "e", "i", "o", "oi", "u",
};
static char *dwarf_syllable3[] = {
"bur", "fur", "gan", "gnus", "gnar", "li", "lin", "lir", "mli", "nar", "nus",
"rin", "ran", "sin", "sil", "sur",
};
static char *elf_syllable1[] = {
"Al", "An", "Bal", "Bel", "Cal", "Cel", "El", "Elr", "Elv", "Eow", "Ear", "F",
"Fal", "Fel", "Fin", "G", "Gal", "Gel", "Gl", "Is", "Lan", "Leg", "Lom",
"N", "Nal", "Nel", "S", "Sal", "Sel", "T", "Tal", "Tel", "Thr", "Tin",
};
static char *elf_syllable2[] = {
"a", "adrie", "ara", "e", "ebri", "ele", "ere", "i", "io", "ithra", "ilma",
"il-Ga", "ili", "o", "orfi", "u", "y",
};
static char *elf_syllable3[] = {
"l", "las", "lad", "ldor", "ldur", "linde", "lith", "mir", "n", "nd", "ndel",
"ndil", "ndir", "nduil", "ng", "mbor", "r", "rith", "ril", "riand", "rion",
"s", "thien", "viel", "wen", "wyn",
};
static char *gnome_syllable1[] = {
"Aar", "An", "Ar", "As", "C", "H", "Han", "Har", "Hel", "Iir", "J", "Jan",
"Jar", "K", "L", "M", "Mar", "N", "Nik", "Os", "Ol", "P", "R", "S", "Sam",
"San", "T", "Ter", "Tom", "Ul", "V", "W", "Y",
};
static char *gnome_syllable2[] = {
"a", "aa", "ai", "e", "ei", "i", "o", "uo", "u", "uu",
};
static char *gnome_syllable3[] = {
"ron", "re", "la", "ki", "kseli", "ksi", "ku", "ja", "ta", "na", "namari",
"neli", "nika", "nikki", "nu", "nukka", "ka", "ko", "li", "kki", "rik",
"po", "to", "pekka", "rjaana", "rjatta", "rjukka", "la", "lla", "lli", "mo",
"nni",
};
static char *hobbit_syllable1[] = {
"B", "Ber", "Br", "D", "Der", "Dr", "F", "Fr", "G", "H", "L", "Ler", "M",
"Mer", "N", "P", "Pr", "Per", "R", "S", "T", "W",
};
static char *hobbit_syllable2[] = {
"a", "e", "i", "ia", "o", "oi", "u",
};
static char *hobbit_syllable3[] = {
"bo", "ck", "decan", "degar", "do", "doc", "go", "grin", "lba", "lbo", "lda",
"ldo", "lla", "ll", "lo", "m", "mwise", "nac", "noc", "nwise", "p", "ppin",
"pper", "tho", "to",
};
static char *human_syllable1[] = {
"Ab", "Ac", "Ad", "Af", "Agr", "Ast", "As", "Al", "Adw", "Adr", "Ar", "B",
"Br", "C", "Cr", "Ch", "Cad", "D", "Dr", "Dw", "Ed", "Eth", "Et", "Er",
"El", "Eow", "F", "Fr", "G", "Gr", "Gw", "Gal", "Gl", "H", "Ha", "Ib",
"Jer", "K", "Ka", "Ked", "L", "Loth", "Lar", "Leg", "M", "Mir", "N", "Nyd",
"Ol", "Oc", "On", "P", "Pr", "R", "Rh", "S", "Sev", "T", "Tr", "Th", "V",
"Y", "Z", "W", "Wic",
};
static char *human_syllable2[] = {
"a", "ae", "au", "ao", "are", "ale", "ali", "ay", "ardo", "e", "ei", "ea",
"eri", "era", "ela", "eli", "enda", "erra", "i", "ia", "ie", "ire", "ira",
"ila", "ili", "ira", "igo", "o", "oa", "oi", "oe", "ore", "u", "y",
};
static char *human_syllable3[] = {
"a", "and", "b", "bwyn", "baen", "bard", "c", "ctred", "cred", "ch", "can",
"d", "dan", "don", "der", "dric", "dfrid", "dus", "f", "g", "gord", "gan",
"l", "li", "lgrin", "lin", "lith", "lath", "loth", "ld", "ldric", "ldan",
"m", "mas", "mos", "mar", "mond", "n", "nydd", "nidd", "nnon", "nwan",
"nyth", "nad", "nn", "nnor", "nd", "p", "r", "ron", "rd", "s", "sh", "seth",
"sean", "t", "th", "tha", "tlan", "trem", "tram", "v", "vudd", "w", "wan",
"win", "wyn", "wyr", "wyr", "wyth",
};
static char *orc_syllable1[] = {
"B", "Er", "G", "Gr", "H", "P", "Pr", "R", "V", "Vr", "T", "Tr", "M", "Dr",
};
static char *orc_syllable2[] = {
"a", "i", "o", "oo", "u", "ui",
};
static char *orc_syllable3[] = {
"dash", "dish", "dush", "gar", "gor", "gdush", "lo", "gdish", "k", "lg",
"nak", "rag", "rbag", "rg", "rk", "ng", "nk", "rt", "ol", "urk", "shnak",
"mog", "mak", "rak",
};
static char *entish_syllable1[] = {
"Baum", "Wurzel", "Rinden", "Ast", "Blatt",
};
static char *entish_syllable2[] = {
"-",
};
static char *entish_syllable3[] = {
"Hüter", "Pflanzer", "Hirte", "Wächter", "Wachser", "Beschützer",
};
static char *cthuloid_syllable1[] = {
"Cth", "Az", "Fth", "Ts", "Xo", "Q'N", "R'L", "Ghata", "L", "Zz", "Fl", "Cl",
"S", "Y",
};
static char *cthuloid_syllable2[] = {
"nar", "loi", "ul", "lu", "noth", "thon", "ath", "'N", "rhy", "oth", "aza",
"agn", "oa", "og",
};
static char *cthuloid_syllable3[] = {
"l", "a", "u", "oa", "oggua", "oth", "ath", "aggua", "lu", "lo", "loth",
"lotha", "agn", "axl",
};
static char *create_random_name(race_t race)
{
static char name[64];
switch (race) {
case RC_DWARF:
strcpy(name,
dwarf_syllable1[rng_int() % (sizeof(dwarf_syllable1) /
sizeof(char *))]);
strcat(name,
dwarf_syllable2[rand() % (sizeof(dwarf_syllable2) / sizeof(char *))]);
strcat(name,
dwarf_syllable3[rand() % (sizeof(dwarf_syllable3) / sizeof(char *))]);
break;
case RC_ELF:
strcpy(name,
elf_syllable1[rand() % (sizeof(elf_syllable1) / sizeof(char *))]);
strcat(name,
elf_syllable2[rand() % (sizeof(elf_syllable2) / sizeof(char *))]);
strcat(name,
elf_syllable3[rand() % (sizeof(elf_syllable3) / sizeof(char *))]);
break;
/*
case RACE_GNOME:
strcpy(name, gnome_syllable1[rand()%(sizeof(gnome_syllable1) / sizeof(char*))]);
strcat(name, gnome_syllable2[rand()%(sizeof(gnome_syllable2) / sizeof(char*))]);
strcat(name, gnome_syllable3[rand()%(sizeof(gnome_syllable3) / sizeof(char*))]);
break;
*/
case RC_HALFLING:
strcpy(name,
hobbit_syllable1[rand() % (sizeof(hobbit_syllable1) / sizeof(char *))]);
strcat(name,
hobbit_syllable2[rand() % (sizeof(hobbit_syllable2) / sizeof(char *))]);
strcat(name,
hobbit_syllable3[rand() % (sizeof(hobbit_syllable3) / sizeof(char *))]);
break;
case RC_HUMAN:
case RC_AQUARIAN:
case RC_CAT:
strcpy(name,
human_syllable1[rand() % (sizeof(human_syllable1) / sizeof(char *))]);
strcat(name,
human_syllable2[rand() % (sizeof(human_syllable2) / sizeof(char *))]);
strcat(name,
human_syllable3[rand() % (sizeof(human_syllable3) / sizeof(char *))]);
break;
case RC_ORC:
case RC_TROLL:
case RC_GOBLIN:
strcpy(name,
orc_syllable1[rand() % (sizeof(orc_syllable1) / sizeof(char *))]);
strcat(name,
orc_syllable2[rand() % (sizeof(orc_syllable2) / sizeof(char *))]);
strcat(name,
orc_syllable3[rand() % (sizeof(orc_syllable3) / sizeof(char *))]);
break;
/*
case RC_TREEMAN:
strcpy(name, entish_syllable1[rand()%(sizeof(entish_syllable1) / sizeof(char*))]);
strcat(name, entish_syllable2[rand()%(sizeof(entish_syllable2) / sizeof(char*))]);
strcat(name, entish_syllable3[rand()%(sizeof(entish_syllable3) / sizeof(char*))]);
break;
*/
case RC_DAEMON:
case RC_INSECT:
strcpy(name,
cthuloid_syllable1[rand() % (sizeof(cthuloid_syllable1) /
sizeof(char *))]);
strcat(name,
cthuloid_syllable2[rand() % (sizeof(cthuloid_syllable2) /
sizeof(char *))]);
strcat(name,
cthuloid_syllable3[rand() % (sizeof(cthuloid_syllable3) /
sizeof(char *))]);
break;
default:
name[0] = 0;
break;
}
return name;
}
int main(void)
{
race_t race;
for (race = 0; race < 11; race++) {
int i;
printf("%d:", (int)race);
for (i = 0; i < 20; i++) {
printf(" %s", create_random_name(race));
}
printf("\n");
}
return 0;
}