forked from github/server
define core plain and ocean in JSON for E2.
This commit is contained in:
parent
a582c69523
commit
9df5799efd
2 changed files with 62 additions and 15 deletions
|
@ -2,6 +2,47 @@
|
||||||
"include": [
|
"include": [
|
||||||
"keywords.json"
|
"keywords.json"
|
||||||
],
|
],
|
||||||
|
"terrains": {
|
||||||
|
"ocean": {
|
||||||
|
"size": 100,
|
||||||
|
"flags": [ "swim", "sea", "sail", "fly" ]
|
||||||
|
},
|
||||||
|
"plain": {
|
||||||
|
"size": 10000,
|
||||||
|
"herbs": [ "h0", "h1", "h2", "h3", "h4", "h5" ],
|
||||||
|
"seed": 3,
|
||||||
|
"road": 50,
|
||||||
|
"flags": [ "land", "walk", "sail", "fly" ],
|
||||||
|
"production": {
|
||||||
|
"iron": {
|
||||||
|
"chance": 0.1,
|
||||||
|
"base": "5d8",
|
||||||
|
"div": "2d20+10",
|
||||||
|
"level": "2d4-1"
|
||||||
|
},
|
||||||
|
"stone": {
|
||||||
|
"chance": 0.15,
|
||||||
|
"base": "5d8",
|
||||||
|
"div": "2d30+20",
|
||||||
|
"level": "1d4"
|
||||||
|
},
|
||||||
|
"laen": {
|
||||||
|
"chance": 0.01,
|
||||||
|
"base": "1d4",
|
||||||
|
"div": "2d20+50",
|
||||||
|
"level": "1d4"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"default": {
|
||||||
|
"size": 0,
|
||||||
|
"herbs": [],
|
||||||
|
"seed": 0,
|
||||||
|
"road": 0,
|
||||||
|
"flags": [ "land", "walk", "sail", "fly" ],
|
||||||
|
"production": {}
|
||||||
|
}
|
||||||
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
"game.id": 2,
|
"game.id": 2,
|
||||||
"game.name": "Eressea",
|
"game.name": "Eressea",
|
||||||
|
|
|
@ -229,7 +229,9 @@ static void json_terrain(cJSON *json, terrain_type *ter) {
|
||||||
case cJSON_Object:
|
case cJSON_Object:
|
||||||
if (strcmp(child->string, "production") == 0) {
|
if (strcmp(child->string, "production") == 0) {
|
||||||
cJSON *entry;
|
cJSON *entry;
|
||||||
int n, size = cJSON_GetArraySize(child);
|
int size = cJSON_GetArraySize(child);
|
||||||
|
if (size > 0) {
|
||||||
|
int n;
|
||||||
ter->production = (terrain_production *)calloc(size + 1, sizeof(terrain_production));
|
ter->production = (terrain_production *)calloc(size + 1, sizeof(terrain_production));
|
||||||
ter->production[size].type = 0;
|
ter->production[size].type = 0;
|
||||||
for (n = 0, entry = child->child; entry; entry = entry->next, ++n) {
|
for (n = 0, entry = child->child; entry; entry = entry->next, ++n) {
|
||||||
|
@ -242,6 +244,7 @@ static void json_terrain(cJSON *json, terrain_type *ter) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
log_error("terrain %s contains unknown attribute %s", json->string, child->string);
|
log_error("terrain %s contains unknown attribute %s", json->string, child->string);
|
||||||
}
|
}
|
||||||
|
@ -255,13 +258,16 @@ static void json_terrain(cJSON *json, terrain_type *ter) {
|
||||||
}
|
}
|
||||||
else if (strcmp(child->string, "herbs") == 0) {
|
else if (strcmp(child->string, "herbs") == 0) {
|
||||||
cJSON *entry;
|
cJSON *entry;
|
||||||
int n, size = cJSON_GetArraySize(child);
|
int size = cJSON_GetArraySize(child);
|
||||||
|
if (size > 0) {
|
||||||
|
int n;
|
||||||
ter->herbs = malloc(sizeof(const item_type *) * (size + 1));
|
ter->herbs = malloc(sizeof(const item_type *) * (size + 1));
|
||||||
ter->herbs[size] = 0;
|
ter->herbs[size] = 0;
|
||||||
for (n = 0, entry = child->child; entry; entry = entry->next) {
|
for (n = 0, entry = child->child; entry; entry = entry->next) {
|
||||||
ter->herbs[n++] = it_get_or_create(rt_get_or_create(entry->valuestring));
|
ter->herbs[n++] = it_get_or_create(rt_get_or_create(entry->valuestring));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
log_error("terrain %s contains unknown attribute %s", json->string, child->string);
|
log_error("terrain %s contains unknown attribute %s", json->string, child->string);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue