(market_init): New.

(start_server): Call it.  Move initialization stuff to it, with error
checking added.
(market_update): Internal linkage.
This commit is contained in:
Markus Armbruster 2007-01-16 20:22:06 +00:00
parent 02584d8a50
commit f41e44fb74
3 changed files with 14 additions and 7 deletions

View file

@ -47,7 +47,7 @@ void mobility_init(void);
/* thread entry points */ /* thread entry points */
void delete_lostitems(void *); void delete_lostitems(void *);
void market_update(void *); void market_init(void);
void mobility_check(void *); void mobility_check(void *);
void player_kill_idle(void *); void player_kill_idle(void *);
void update_main(void); void update_main(void);

View file

@ -333,11 +333,7 @@ start_server(int flags)
"MobilityCheck", "Writes the timestamp file", 0); "MobilityCheck", "Writes the timestamp file", 0);
} }
if (opt_MARKET) { market_init();
empth_create(PP_TIMESTAMP, market_update, (50 * 1024), flags,
"MarketUpdate", "Updates the market", 0);
}
update_init(); update_init();
} }

View file

@ -35,6 +35,7 @@
#include "empthread.h" #include "empthread.h"
#include "file.h" #include "file.h"
#include "optlist.h"
#include "player.h" #include "player.h"
#include "prototypes.h" #include "prototypes.h"
#include "server.h" #include "server.h"
@ -64,7 +65,7 @@ check_all_markets(void *unused)
} }
/*ARGSUSED*/ /*ARGSUSED*/
void static void
market_update(void *unused) market_update(void *unused)
{ {
time_t now; time_t now;
@ -85,3 +86,13 @@ market_update(void *unused)
} }
/*NOTREACHED*/ /*NOTREACHED*/
} }
void
market_init(void)
{
if (!opt_MARKET)
return;
if (!empth_create(PP_TIMESTAMP, market_update, 50 * 1024, 0,
"MarketUpdate", "Updates the market", NULL))
exit_nomem();
}