-/* src/server/things.c */
+/* src/server/things.c
+ *
+ * This file is part of PlomRogue. PlomRogue is licensed under the GPL version 3
+ * or any later version. For details on its copyright, license, and warranties,
+ * see the file NOTICE in the root directory of the PlomRogue source package.
+ */
#define _POSIX_C_SOURCE 200809L /* strdup() */
#include "things.h"
#include "../common/yx_uint8.h" /* yx_uint8 */
#include "cleanup.h" /* set_cleanup_flag() */
#include "hardcoded_strings.h" /* s */
-#include "map.h" /* is_passable() */
#include "rrand.h" /* rrand() */
#include "thing_actions.h" /* actor_wait */
#include "world.h" /* world */
-#include "yx_uint8.h" /* yx_uint8_cmp() */
struct yx_uint8 pos;
while (1)
{
- char * err = "Space to put thing on too hard to find."
- "Map too small?";
+ char * err="Space to put thing on too hard to find. Map too small?";
uint16_t i_pos = 0;
- for (pos.y = pos.x = 0; 0 == is_passable(pos); i_pos++)
+ for (pos.y = pos.x = 0;
+ '.' != world.map.cells[pos.y * world.map.length + pos.x];
+ i_pos++)
{
exit_err(UINT16_MAX == i_pos, err);
pos.y = rrand() % world.map.length;
uint8_t clear = 1;
for (t = world.things; t; t = t->next)
{
- if (yx_uint8_cmp(&pos, &t->pos) && 0 != t->lifepoints)
+ if (0 != t->lifepoints && pos.y==t->pos.y && pos.x==t->pos.x)
{
clear = 0;
break;