aboutsummaryrefslogtreecommitdiff
path: root/src/world.h
blob: 50f9769bcc8e32bf3a83c54f1cc10c16b2d23911 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*
 *   NetCosm - a MUD server
 *   Copyright (C) 2016 Franklin Wei
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation, either version 3 of the License, or
 *   (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *   GNU General Public License for more details.
 *
 *   You should have received a copy of the GNU General Public License
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#pragma once

#include "globals.h"

#include "obj.h"
#include "room.h"
#include "verb.h"

/* the world module MUST define all of the following: */

/* verb classes */
extern const struct verb_class_t netcosm_verb_classes[];
extern const size_t netcosm_verb_classes_sz;

/* object classes */
extern const struct obj_class_t netcosm_obj_classes[];
extern const size_t netcosm_obj_classes_sz;

/* rooms */
extern const struct roomdata_t netcosm_world[];
extern const size_t netcosm_world_sz;

extern const char *netcosm_world_name;

/*** loads the world into RAM for the first time, resets the game state ***/
void world_init(const struct roomdata_t *data, size_t sz, const char *name);

void world_save(const char *fname);

/* loads the world from disk */
bool world_load(const char *fname, const struct roomdata_t *data, size_t data_sz, const char *world_name);

/** global verbs **/
bool world_verb_add(struct verb_t*);
bool world_verb_del(struct verb_t*);

/* gets the map of global verbs */
void *world_verb_map(void);

void world_free(void);

/* this goes in world_ and not room_ */
struct room_t *room_get(room_id id);

room_id room_get_id(const char *uniq_id);