X-Git-Url: https://plomlompom.com/repos/foo.html?a=blobdiff_plain;ds=sidebyside;f=src%2Fserver%2Fio.c;h=0f65cea8c5e36060fa094af9eccd2f03629412b8;hb=49ffd1e026de8e5175dbe52a24584fb00d9340aa;hp=947c1468b48711d998e875bb76924e6a0da3d03d;hpb=3cb6ed6453b22eba62f7c9186790813b0abebeb9;p=plomrogue
diff --git a/src/server/io.c b/src/server/io.c
index 947c146..0f65cea 100644
--- a/src/server/io.c
+++ b/src/server/io.c
@@ -59,7 +59,9 @@ static void write_value_as_line(uint32_t value, FILE * file);
static void write_inventory(struct Thing * player, FILE * file);
/* Return map cells sequence as visible to the "player", with invisible cells as
- * whitespace. Super-impose over visible map cells things positioned there.
+ * whitespace. Super-impose over visible map cells things positioned there,
+ * with animate things overwriting inanimate things, and inanimate consumable
+ * things overwriting inanimate non-consumable things.
*/
static char * build_visible_map(struct Thing * player);
@@ -314,20 +316,22 @@ static char * build_visible_map(struct Thing * player)
}
}
struct Thing * t;
- struct ThingType * tt;
char c;
uint8_t i;
- for (i = 0; i < 2; i++)
+ for (i = 0; i < 3; i++)
{
for (t = world.things; t != 0; t = t->next)
{
- if ( 'v'==player->fov_map[t->pos.y*world.map.length+t->pos.x]
- && ( (0 == i && 0 == t->lifepoints)
- || (1 == i && 0 < t->lifepoints)))
+ if ('v' == player->fov_map[t->pos.y*world.map.length+t->pos.x])
{
- tt = get_thing_type(t->type);
- c = tt->char_on_map;
- visible_map[t->pos.y * world.map.length + t->pos.x] = c;
+ struct ThingType * tt = get_thing_type(t->type);
+ if ( (0 == i && !t->lifepoints && !tt->consumable)
+ || (1 == i && !t->lifepoints && tt->consumable)
+ || (2 == i && t->lifepoints))
+ {
+ c = tt->char_on_map;
+ visible_map[t->pos.y * world.map.length + t->pos.x] = c;
+ }
}
}
}
@@ -354,7 +358,7 @@ static void write_map(struct Thing * player, FILE * file)
{
for (x = 0; x < world.map.length; x++)
{
- try_fputc(player->mem_map[y * world.map.length + x], file, __func__);
+ try_fputc(player->mem_map[y*world.map.length+x], file, __func__);
}
try_fputc('\n', file, __func__);
}