forked from github/server
sql fixes? race update
This commit is contained in:
parent
61b0c7228a
commit
1b6a6d9bd1
|
@ -3632,9 +3632,9 @@ age_factions(void)
|
||||||
|
|
||||||
for (f = factions; f; f = f->next) {
|
for (f = factions; f; f = f->next) {
|
||||||
++f->age;
|
++f->age;
|
||||||
if (f->age < NewbieImmunity()) {
|
if (f->age+1 < NewbieImmunity()) {
|
||||||
ADDMSG(&f->msgs, msg_message("newbieimmunity", "turns",
|
ADDMSG(&f->msgs, msg_message("newbieimmunity", "turns",
|
||||||
NewbieImmunity() - f->age));
|
NewbieImmunity() - f->age - 1));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2364,7 +2364,7 @@ static double horsebonus(const unit * u)
|
||||||
it_charger = it_find("charger");
|
it_charger = it_find("charger");
|
||||||
}
|
}
|
||||||
|
|
||||||
while (itm) {
|
for (;itm;itm=itm->next) {
|
||||||
if (itm->type->flags&ITF_ANIMAL) {
|
if (itm->type->flags&ITF_ANIMAL) {
|
||||||
if (itm->type==it_elvenhorse) n3 +=itm->number;
|
if (itm->type==it_elvenhorse) n3 +=itm->number;
|
||||||
else if (itm->type==it_charger) n2 +=itm->number;
|
else if (itm->type==it_charger) n2 +=itm->number;
|
||||||
|
|
|
@ -236,6 +236,7 @@ db_update_scores(sqlite3 * db, boolean force)
|
||||||
const char * sql_upd = "UPDATE score set value=? WHERE faction_id=? AND turn=?";
|
const char * sql_upd = "UPDATE score set value=? WHERE faction_id=? AND turn=?";
|
||||||
sqlite3_stmt * stmt_upd = stmt_cache_get(db, sql_upd);
|
sqlite3_stmt * stmt_upd = stmt_cache_get(db, sql_upd);
|
||||||
faction * f;
|
faction * f;
|
||||||
|
sqlite3_exec(db, "BEGIN", 0, 0, 0);
|
||||||
for (f=factions;f;f=f->next) {
|
for (f=factions;f;f=f->next) {
|
||||||
int res;
|
int res;
|
||||||
sqlite3_bind_int(stmt_ins, 1, f->score);
|
sqlite3_bind_int(stmt_ins, 1, f->score);
|
||||||
|
@ -249,8 +250,8 @@ db_update_scores(sqlite3 * db, boolean force)
|
||||||
res = sqlite3_step(stmt_upd);
|
res = sqlite3_step(stmt_upd);
|
||||||
sqlite3_reset(stmt_upd);
|
sqlite3_reset(stmt_upd);
|
||||||
}
|
}
|
||||||
SQL_EXPECT(res, SQLITE_DONE);
|
|
||||||
sqlite3_reset(stmt_ins);
|
sqlite3_reset(stmt_ins);
|
||||||
}
|
}
|
||||||
|
sqlite3_exec(db, "COMMIT", 0, 0, 0);
|
||||||
return SQLITE_OK;
|
return SQLITE_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
<skill name="taxation" enable="false"/>
|
<skill name="taxation" enable="false"/>
|
||||||
<skill name="trade" enable="false"/>
|
<skill name="trade" enable="false"/>
|
||||||
|
|
||||||
<param name="NewbieImmunity" value="8"/>
|
<param name="NewbieImmunity" value="9"/> <!-- ends after turn 9 -->
|
||||||
|
|
||||||
<param name="modules.astralspace" value="0"/>
|
<param name="modules.astralspace" value="0"/>
|
||||||
<param name="modules.wormholes" value="0"/>
|
<param name="modules.wormholes" value="0"/>
|
||||||
|
|
|
@ -197,6 +197,7 @@ function process(orders)
|
||||||
|
|
||||||
-- use newfactions file to place out new players
|
-- use newfactions file to place out new players
|
||||||
-- autoseed(basepath .. "/newfactions", false)
|
-- autoseed(basepath .. "/newfactions", false)
|
||||||
|
read_xml(resourcepath.."/e3a-update.xml")
|
||||||
|
|
||||||
write_files(locales)
|
write_files(locales)
|
||||||
write_statistics()
|
write_statistics()
|
||||||
|
@ -211,6 +212,11 @@ end
|
||||||
--
|
--
|
||||||
-- main body of script
|
-- main body of script
|
||||||
--
|
--
|
||||||
|
function dbupdate()
|
||||||
|
edb = db.open(basepath.."/eressea.db")
|
||||||
|
edb:update_factions()
|
||||||
|
edb:update_scores()
|
||||||
|
end
|
||||||
|
|
||||||
-- orderfile: contains the name of the orders.
|
-- orderfile: contains the name of the orders.
|
||||||
load_scripts()
|
load_scripts()
|
||||||
|
@ -218,4 +224,5 @@ if orderfile==nil then
|
||||||
print "you must specify an orderfile"
|
print "you must specify an orderfile"
|
||||||
else
|
else
|
||||||
process(orderfile)
|
process(orderfile)
|
||||||
|
dbupdate()
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue