forked from github/server
leak: free special directions.
This commit is contained in:
parent
4bb6d503ea
commit
6d1fe2842a
|
@ -0,0 +1,21 @@
|
|||
local modules = {}
|
||||
|
||||
function add_module(pkg)
|
||||
table.insert(modules, pkg)
|
||||
end
|
||||
|
||||
local pkg = {}
|
||||
|
||||
function pkg.init()
|
||||
for k, v in ipairs(modules) do
|
||||
if v.init then v.init() end
|
||||
end
|
||||
end
|
||||
|
||||
function pkg.update()
|
||||
for k, v in ipairs(modules) do
|
||||
if v.update then v.update() end
|
||||
end
|
||||
end
|
||||
|
||||
return pkg
|
|
@ -2,6 +2,17 @@
|
|||
#include "settings.h"
|
||||
#include "eressea.h"
|
||||
|
||||
#include "calendar.h"
|
||||
#include "chaos.h"
|
||||
#include "items.h"
|
||||
#include "creport.h"
|
||||
#include "report.h"
|
||||
#include "names.h"
|
||||
#include "reports.h"
|
||||
#include "spells.h"
|
||||
#include "vortex.h"
|
||||
#include "wormhole.h"
|
||||
|
||||
#include <kernel/config.h>
|
||||
#include <util/log.h>
|
||||
|
||||
|
@ -25,16 +36,6 @@
|
|||
#include <util/message.h>
|
||||
#include <races/races.h>
|
||||
|
||||
#include "calendar.h"
|
||||
#include "chaos.h"
|
||||
#include "items.h"
|
||||
#include "creport.h"
|
||||
#include "report.h"
|
||||
#include "names.h"
|
||||
#include "reports.h"
|
||||
#include "spells.h"
|
||||
#include "wormhole.h"
|
||||
|
||||
void game_done(void)
|
||||
{
|
||||
#ifdef CLEANUP_CODE
|
||||
|
@ -53,6 +54,7 @@ void game_done(void)
|
|||
calendar_cleanup();
|
||||
free_functions();
|
||||
free_config();
|
||||
free_special_directions();
|
||||
free_locales();
|
||||
kernel_done();
|
||||
}
|
||||
|
|
|
@ -329,8 +329,9 @@ sc_mage *get_mage(const unit * u)
|
|||
{
|
||||
if (has_skill(u, SK_MAGIC)) {
|
||||
attrib *a = a_find(u->attribs, &at_mage);
|
||||
if (a)
|
||||
return a->data.v;
|
||||
if (a) {
|
||||
return (sc_mage *)a->data.v;
|
||||
}
|
||||
}
|
||||
return (sc_mage *)NULL;
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "prefix.h"
|
||||
#include "reports.h"
|
||||
#include "calendar.h"
|
||||
#include "vortex.h"
|
||||
|
||||
#include <kernel/config.h>
|
||||
#include <kernel/alliance.h>
|
||||
|
@ -209,6 +210,7 @@ static void test_reset(void) {
|
|||
default_locale = 0;
|
||||
calendar_cleanup();
|
||||
close_orders();
|
||||
free_special_directions();
|
||||
free_locales();
|
||||
free_spells();
|
||||
free_buildingtypes();
|
||||
|
|
10
src/vortex.c
10
src/vortex.c
|
@ -26,6 +26,16 @@ typedef struct dir_lookup {
|
|||
|
||||
static dir_lookup *dir_name_lookup;
|
||||
|
||||
void free_special_directions(void)
|
||||
{
|
||||
while (dir_name_lookup) {
|
||||
dir_lookup *dl = dir_name_lookup;
|
||||
dir_name_lookup = dl->next;
|
||||
free(dl->name);
|
||||
free(dl);
|
||||
}
|
||||
}
|
||||
|
||||
void register_special_direction(struct locale *lang, const char *name)
|
||||
{
|
||||
const char *token = locale_string(lang, name, false);
|
||||
|
|
|
@ -26,6 +26,8 @@ extern "C" {
|
|||
struct region *find_special_direction(const struct region *r,
|
||||
const char *token);
|
||||
void register_special_direction(struct locale *lang, const char *name);
|
||||
void free_special_directions(void);
|
||||
|
||||
struct spec_direction *special_direction(const struct region * from,
|
||||
const struct region * to);
|
||||
struct attrib *create_special_direction(struct region *r, struct region *rt,
|
||||
|
|
Loading…
Reference in New Issue