LIFEPOINTS 3
CORPSE_ID 5
CONSUMABLE 0
+START_NUMBER 9
A line of "OBJECT" followed by a number starts it, and the number sets the
object type's internal id. The number after "CONSUMABLE" defines the object
hitpoints drop to zero if they start out as inanimate (what is not implemented
yet: or if they are inanimate, but are otherwise crushed). Note that the
"CORPSE_ID" must match the id of an object type defined in the file (before or
-after, it may even be the same).
+after, it may even be the same). "START_NUMBER" sets the number of objects that
+are to appear of the given type on the map on game start.
All these definition block members must be present within their blocks, but only
"ACTION" / "OBJECT" / "MAP_TYPE" must be positioned at their respective blocks'
LIFEPOINTS 5
CORPSE_ID 5
CONSUMABLE 0
+START_NUMBER 1
OBJECT 1
NAME ANT
LIFEPOINTS 1
CORPSE_ID 4
CONSUMABLE 0
+START_NUMBER 27
OBJECT 2
NAME ZOMBIE
LIFEPOINTS 3
CORPSE_ID 5
CONSUMABLE 0
+START_NUMBER 9
OBJECT 3
NAME SHOGGOTH
LIFEPOINTS 9
CORPSE_ID 6
CONSUMABLE 0
+START_NUMBER 3
OBJECT 4
NAME DIRT
LIFEPOINTS 0
CORPSE_ID 4
CONSUMABLE 0
+START_NUMBER 9
OBJECT 5
NAME SKELETON
LIFEPOINTS 0
CORPSE_ID 4
CONSUMABLE 0
+START_NUMBER 9
OBJECT 6
NAME 'MAGIC MEAT'
LIFEPOINTS 0
CORPSE_ID 4
CONSUMABLE 3
+START_NUMBER 1
SYMBOL_SET = 0x08,
LIFEPOINTS_SET = 0x10,
CONSUMABLE_SET = 0x20,
+ START_N_SET = 0x40,
READY_ACT = NAME_SET | EFFORT_SET,
READY_OBJ = NAME_SET | CORPSE_ID_SET | SYMBOL_SET | LIFEPOINTS_SET
- | CONSUMABLE_SET,
+ | CONSUMABLE_SET | START_N_SET,
READY_MAP = HEIGHT_SET | WIDTH_SET | ORTH_SET | DIAG_SET
};
SYMBOL_SET, 'c', (char *) &mod->char_on_map)
|| parse_val(token0, token1, "EFFORT", action_flags,
EFFORT_SET, '8', (char *) &moa->effort)
+ || parse_val(token0, token1, "START_NUMBER", object_flags,
+ START_N_SET, '8', (char *) &mod->start_n)
|| parse_val(token0, token1, "LIFEPOINTS", object_flags,
LIFEPOINTS_SET, '8', (char *) &mod->lifepoints)
|| parse_val(token0, token1, "CONSUMABLE", object_flags,
#include "../common/try_malloc.h" /* try_malloc() */
#include "cleanup.h" /* set_cleanup_flag() */
#include "map.h" /* init_map() */
-#include "map_objects.h" /* free_map_objects(), add_map_objects() */
-#include "rrand.h" /* rrand() */
+#include "map_objects.h" /* MapObjDef, free_map_objects(), add_map_objects() */
#include "run.h" /* obey_msg(), io_loop() */
#include "world.h" /* global world */
free_map_objects(world.map_objs);
world.last_update_turn = 0;
init_map();
- add_map_objects(0, 1);
- add_map_objects(1, 1 + rrand() % 27);
- add_map_objects(2, 1 + rrand() % 9);
- add_map_objects(3, 1 + rrand() % 3);
- add_map_objects(4, 1 + rrand() % 3);
- add_map_objects(5, 1 + rrand() % 3);
+ struct MapObjDef * mod;
+ for (mod = world.map_obj_defs; NULL != mod; mod = mod->next)
+ {
+ add_map_objects(mod->id, mod->start_n);
+ }
set_cleanup_flag(CLEANUP_MAP_OBJECTS);
if (world.turn)
{
* Map object (action) definitions read in from server config directory are not
* affected. world.last_update_turn is set to 0 and world.turn to 1, so that
* io_round()'s criteria for updating the output file are triggered even when
- * this function is called during a round 1. How many map objects of what type
- * id are generated on the map is currently hard-coded.
+ * this function is called during a round 1.
*/
extern void remake_world(uint32_t seed);
uint8_t corpse_id; /* type to change map object into upon destruction */
uint8_t lifepoints; /* default start value for map object's .lifepoints */
uint8_t consumable; /* can be eaten if !0, for so much hitpoint win */
+ uint8_t start_n; /* how many of these does the map start with? */
};