forked from github/server
remov e the old recycling quota, it was always 0.5 everywhere, and a
silly feature..
This commit is contained in:
parent
54a3c2e070
commit
ee1d97df19
|
@ -66,10 +66,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <attributes/matmod.h>
|
#include <attributes/matmod.h>
|
||||||
#include <attributes/alliance.h>
|
#include <attributes/alliance.h>
|
||||||
|
|
||||||
#define STONERECYCLE 50
|
|
||||||
/* Name, MaxGroesse, MinBauTalent, Kapazitaet, {Eisen, Holz, Stein, BauSilber,
|
|
||||||
* Laen, Mallorn}, UnterSilber, UnterSpezialTyp, UnterSpezial */
|
|
||||||
|
|
||||||
struct building *getbuilding(const struct region *r)
|
struct building *getbuilding(const struct region *r)
|
||||||
{
|
{
|
||||||
building *b = findbuilding(getid());
|
building *b = findbuilding(getid());
|
||||||
|
@ -240,7 +236,7 @@ int destroy_cmd(unit * u, struct order *ord)
|
||||||
int c;
|
int c;
|
||||||
for (c = 0; con->materials[c].number; ++c) {
|
for (c = 0; con->materials[c].number; ++c) {
|
||||||
const requirement *rq = con->materials + c;
|
const requirement *rq = con->materials + c;
|
||||||
int recycle = (int)(rq->recycle * rq->number * size / con->reqsize);
|
int recycle = (rq->number * size / con->reqsize)/2;
|
||||||
if (recycle) {
|
if (recycle) {
|
||||||
change_resource(u, rq->rtype, recycle);
|
change_resource(u, rq->rtype, recycle);
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,6 @@ extern "C" {
|
||||||
typedef struct requirement {
|
typedef struct requirement {
|
||||||
const struct resource_type *rtype;
|
const struct resource_type *rtype;
|
||||||
int number;
|
int number;
|
||||||
double recycle; /* recycling quota */
|
|
||||||
} requirement;
|
} requirement;
|
||||||
|
|
||||||
typedef struct construction {
|
typedef struct construction {
|
||||||
|
|
|
@ -75,7 +75,6 @@ static void json_requirements(cJSON *json, requirement **matp) {
|
||||||
requirement *mat = calloc(sizeof(requirement), 1+cJSON_GetArraySize(json));
|
requirement *mat = calloc(sizeof(requirement), 1+cJSON_GetArraySize(json));
|
||||||
for (i=0,child=json->child;child;child=child->next,++i) {
|
for (i=0,child=json->child;child;child=child->next,++i) {
|
||||||
mat[i].number = child->valueint;
|
mat[i].number = child->valueint;
|
||||||
mat[i].recycle = 0.5f;
|
|
||||||
mat[i].rtype = rt_get_or_create(child->string);
|
mat[i].rtype = rt_get_or_create(child->string);
|
||||||
}
|
}
|
||||||
*matp = mat;
|
*matp = mat;
|
||||||
|
|
|
@ -204,7 +204,6 @@ static void test_buildings(CuTest * tc)
|
||||||
CuAssertPtrNotNull(tc, bt->construction);
|
CuAssertPtrNotNull(tc, bt->construction);
|
||||||
CuAssertPtrNotNull(tc, bt->construction->materials);
|
CuAssertPtrNotNull(tc, bt->construction->materials);
|
||||||
CuAssertIntEquals(tc, 2, bt->construction->materials[0].number);
|
CuAssertIntEquals(tc, 2, bt->construction->materials[0].number);
|
||||||
CuAssertDblEquals(tc, 0.5f, bt->construction->materials[0].recycle, 0.0f);
|
|
||||||
CuAssertPtrEquals(tc, (void *)get_resourcetype(R_STONE), (void *)bt->construction->materials[0].rtype);
|
CuAssertPtrEquals(tc, (void *)get_resourcetype(R_STONE), (void *)bt->construction->materials[0].rtype);
|
||||||
CuAssertIntEquals(tc, 1, bt->construction->materials[1].number);
|
CuAssertIntEquals(tc, 1, bt->construction->materials[1].number);
|
||||||
CuAssertPtrEquals(tc, (void *)get_resourcetype(R_IRON), (void *)bt->construction->materials[1].rtype);
|
CuAssertPtrEquals(tc, (void *)get_resourcetype(R_IRON), (void *)bt->construction->materials[1].rtype);
|
||||||
|
|
|
@ -122,7 +122,6 @@ xml_readrequirements(xmlNodePtr * nodeTab, int nodeNr, requirement ** reqArray)
|
||||||
xmlChar *propValue;
|
xmlChar *propValue;
|
||||||
|
|
||||||
radd->number = xml_ivalue(node, "quantity", 1);
|
radd->number = xml_ivalue(node, "quantity", 1);
|
||||||
radd->recycle = xml_fvalue(node, "recycle", 0.5);
|
|
||||||
|
|
||||||
propValue = xmlGetProp(node, BAD_CAST "type");
|
propValue = xmlGetProp(node, BAD_CAST "type");
|
||||||
radd->rtype = rt_get_or_create((const char *)propValue);
|
radd->rtype = rt_get_or_create((const char *)propValue);
|
||||||
|
|
Loading…
Reference in New Issue