forked from github/server
some minor cleanup in laws.h
This commit is contained in:
parent
9f2d2e0f92
commit
526c561b90
4 changed files with 17 additions and 18 deletions
|
@ -68,6 +68,7 @@ without prior permission by the authors of Eressea.
|
||||||
#include <quicklist.h>
|
#include <quicklist.h>
|
||||||
#include <util/rand.h>
|
#include <util/rand.h>
|
||||||
#include <util/rng.h>
|
#include <util/rng.h>
|
||||||
|
#include <util/xml.h>
|
||||||
|
|
||||||
#include <storage.h>
|
#include <storage.h>
|
||||||
|
|
||||||
|
@ -1001,6 +1002,21 @@ static int tolua_get_spells(lua_State * L)
|
||||||
return tolua_quicklist_push(L, "spell_list", "spell", spells);
|
return tolua_quicklist_push(L, "spell_list", "spell", spells);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int init_data(const char *filename, const char *catalog)
|
||||||
|
{
|
||||||
|
int l;
|
||||||
|
l = read_xml(filename, catalog);
|
||||||
|
reset_locales();
|
||||||
|
if (l) {
|
||||||
|
return l;
|
||||||
|
}
|
||||||
|
if (turn < 0) {
|
||||||
|
turn = first_turn;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int tolua_read_xml(lua_State * L)
|
int tolua_read_xml(lua_State * L)
|
||||||
{
|
{
|
||||||
const char *filename = tolua_tostring(L, 1, "config.xml");
|
const char *filename = tolua_tostring(L, 1, "config.xml");
|
||||||
|
|
15
src/laws.c
15
src/laws.c
|
@ -83,7 +83,6 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||||
#include <util/umlaut.h>
|
#include <util/umlaut.h>
|
||||||
#include <util/message.h>
|
#include <util/message.h>
|
||||||
#include <util/rng.h>
|
#include <util/rng.h>
|
||||||
#include <util/xml.h>
|
|
||||||
|
|
||||||
#include <attributes/otherfaction.h>
|
#include <attributes/otherfaction.h>
|
||||||
|
|
||||||
|
@ -4557,17 +4556,3 @@ void update_subscriptions(void)
|
||||||
}
|
}
|
||||||
fclose(F);
|
fclose(F);
|
||||||
}
|
}
|
||||||
|
|
||||||
int init_data(const char *filename, const char *catalog)
|
|
||||||
{
|
|
||||||
int l;
|
|
||||||
l = read_xml(filename, catalog);
|
|
||||||
reset_locales();
|
|
||||||
if (l) {
|
|
||||||
return l;
|
|
||||||
}
|
|
||||||
if (turn < 0) {
|
|
||||||
turn = first_turn;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
|
@ -24,13 +24,10 @@ extern "C" {
|
||||||
|
|
||||||
extern int writepasswd(void);
|
extern int writepasswd(void);
|
||||||
void demographics(void);
|
void demographics(void);
|
||||||
void last_orders(void);
|
|
||||||
void find_address(void);
|
|
||||||
void update_guards(void);
|
void update_guards(void);
|
||||||
void update_subscriptions(void);
|
void update_subscriptions(void);
|
||||||
void deliverMail(struct faction *f, struct region *r, struct unit *u,
|
void deliverMail(struct faction *f, struct region *r, struct unit *u,
|
||||||
const char *s, struct unit *receiver);
|
const char *s, struct unit *receiver);
|
||||||
int init_data(const char *filename, const char *catalog);
|
|
||||||
|
|
||||||
bool renamed_building(const struct building * b);
|
bool renamed_building(const struct building * b);
|
||||||
int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name);
|
int rename_building(struct unit * u, struct order * ord, struct building * b, const char *name);
|
||||||
|
|
|
@ -57,6 +57,7 @@ static void test_rename_building(CuTest * tc)
|
||||||
|
|
||||||
rename_building(u, NULL, b, "Villa Nagel");
|
rename_building(u, NULL, b, "Villa Nagel");
|
||||||
CuAssertStrEquals(tc, "Villa Nagel", b->name);
|
CuAssertStrEquals(tc, "Villa Nagel", b->name);
|
||||||
|
CuAssertTrue(tc, renamed_building(b));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_rename_building_twice(CuTest * tc)
|
static void test_rename_building_twice(CuTest * tc)
|
||||||
|
|
Loading…
Reference in a new issue