forked from github/server
parent
dd85b9b6a0
commit
478ee8d153
|
@ -2567,14 +2567,7 @@ renumber_factions(void)
|
||||||
for (rp=renum;rp;rp=rp->next) {
|
for (rp=renum;rp;rp=rp->next) {
|
||||||
f = rp->faction;
|
f = rp->faction;
|
||||||
a_remove(&f->attribs, rp->attrib);
|
a_remove(&f->attribs, rp->attrib);
|
||||||
if (f->subscription) {
|
renumber_faction(f, rp->want);
|
||||||
sql_print(("UPDATE subscriptions set faction='%s' where id=%u;\n",
|
|
||||||
itoa36(rp->want), f->subscription));
|
|
||||||
}
|
|
||||||
funhash(f);
|
|
||||||
f->no = rp->want;
|
|
||||||
fhash(f);
|
|
||||||
fset(f, FFL_NEWID);
|
|
||||||
}
|
}
|
||||||
while (renum) {
|
while (renum) {
|
||||||
rp = renum->next;
|
rp = renum->next;
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
#include <util/resolve.h>
|
#include <util/resolve.h>
|
||||||
#include <util/rng.h>
|
#include <util/rng.h>
|
||||||
#include <util/storage.h>
|
#include <util/storage.h>
|
||||||
|
#include <util/sql.h>
|
||||||
#include <util/variant.h>
|
#include <util/variant.h>
|
||||||
#include <util/unicode.h>
|
#include <util/unicode.h>
|
||||||
#include <attributes/otherfaction.h>
|
#include <attributes/otherfaction.h>
|
||||||
|
@ -324,6 +325,18 @@ set_alliance(faction * a, faction * b, int status)
|
||||||
(*sfp)->status |= status;
|
(*sfp)->status |= status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void renumber_faction(faction * f, int no)
|
||||||
|
{
|
||||||
|
if (f->subscription) {
|
||||||
|
sql_print(("UPDATE subscriptions set faction='%s' where id=%u;\n",
|
||||||
|
itoa36(no), f->subscription));
|
||||||
|
}
|
||||||
|
funhash(f);
|
||||||
|
f->no = no;
|
||||||
|
fhash(f);
|
||||||
|
fset(f, FFL_NEWID);
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef SMART_INTERVALS
|
#ifdef SMART_INTERVALS
|
||||||
void
|
void
|
||||||
update_interval(struct faction * f, struct region * r)
|
update_interval(struct faction * f, struct region * r)
|
||||||
|
|
|
@ -141,6 +141,7 @@ extern void remove_enemy(struct faction * f, struct faction * enemy);
|
||||||
extern void write_faction_reference(const struct faction * f, struct storage * store);
|
extern void write_faction_reference(const struct faction * f, struct storage * store);
|
||||||
extern int read_faction_reference(struct faction ** f, struct storage * store);
|
extern int read_faction_reference(struct faction ** f, struct storage * store);
|
||||||
|
|
||||||
|
void renumber_faction(faction * f, int no);
|
||||||
|
|
||||||
#ifdef SMART_INTERVALS
|
#ifdef SMART_INTERVALS
|
||||||
extern void update_interval(struct faction * f, struct region * r);
|
extern void update_interval(struct faction * f, struct region * r);
|
||||||
|
|
|
@ -46,6 +46,8 @@ extern void rsf(FILE * F, char *s, size_t len);
|
||||||
#define IO_BINARY 0x04
|
#define IO_BINARY 0x04
|
||||||
#define IO_TEXT 0x08
|
#define IO_TEXT 0x08
|
||||||
|
|
||||||
|
#define IO_DEFAULT IO_BINARY
|
||||||
|
|
||||||
/* Versionsänderungen: */
|
/* Versionsänderungen: */
|
||||||
extern int data_version;
|
extern int data_version;
|
||||||
extern const char *xmlfile;
|
extern const char *xmlfile;
|
||||||
|
|
|
@ -730,7 +730,7 @@ handlekey(state * st, int c)
|
||||||
if (strlen(datafile)>0) {
|
if (strlen(datafile)>0) {
|
||||||
create_backup(datafile);
|
create_backup(datafile);
|
||||||
remove_empty_units();
|
remove_empty_units();
|
||||||
writegame(datafile, IO_TEXT);
|
writegame(datafile, IO_DEFAULT);
|
||||||
st->modified = 0;
|
st->modified = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -297,6 +297,12 @@ faction_countheroes(const faction& f)
|
||||||
return countheroes(&f);
|
return countheroes(&f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
faction_renumber(faction& f, int no)
|
||||||
|
{
|
||||||
|
renumber_faction(&f, no);
|
||||||
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
faction_maxheroes(const faction& f)
|
faction_maxheroes(const faction& f)
|
||||||
{
|
{
|
||||||
|
@ -342,6 +348,7 @@ bind_faction(lua_State * L)
|
||||||
.property("y", &faction_getorigin_y, &faction_setorigin_y)
|
.property("y", &faction_getorigin_y, &faction_setorigin_y)
|
||||||
//.property("origin", &faction_getorigin, &faction_setorigin, pure_out_value(_2) + pure_out_value(_3), copy)
|
//.property("origin", &faction_getorigin, &faction_setorigin, pure_out_value(_2) + pure_out_value(_3), copy)
|
||||||
|
|
||||||
|
.def("renum", &faction_renumber)
|
||||||
.def("add_notice", &faction_addnotice)
|
.def("add_notice", &faction_addnotice)
|
||||||
.property("password", &faction_get_passw, &faction_set_passw)
|
.property("password", &faction_get_passw, &faction_set_passw)
|
||||||
.property("info", &faction_get_banner, &faction_set_banner)
|
.property("info", &faction_get_banner, &faction_set_banner)
|
||||||
|
|
|
@ -22,7 +22,7 @@ print(elapsed)
|
||||||
-- bin1: 18.953
|
-- bin1: 18.953
|
||||||
f = get_faction(0)
|
f = get_faction(0)
|
||||||
|
|
||||||
renumber(f, 666)
|
--renumber(f, 666)
|
||||||
--write_game("566.dat", "binary")
|
--write_game("566.dat", "binary")
|
||||||
|
|
||||||
io.stdin:read("*line")
|
--io.stdin:read("*line")
|
||||||
|
|
Loading…
Reference in New Issue