X-Git-Url: https://plomlompom.com/repos/?a=blobdiff_plain;f=src%2Fserver%2Fio.c;h=f6d6928a2f9e4b9ff1dfeb89f58049c31877427c;hb=535abca0a52631cd3f32aa8a8fb4012aa380e4df;hp=62284153ace342dd035d72b0c258df60df3e5e50;hpb=1cb57a35a3b3cc4ec8870531ca254a655c0bdda2;p=plomrogue diff --git a/src/server/io.c b/src/server/io.c index 6228415..f6d6928 100644 --- a/src/server/io.c +++ b/src/server/io.c @@ -19,7 +19,6 @@ #include "cleanup.h" /* set_cleanup_flag() */ #include "field_of_view.h" /* VISIBLE */ #include "hardcoded_strings.h" /* s */ -#include "map.h" /* yx_to_map_pos() */ #include "things.h" /* Thing, ThingType, ThingAction, get_thing_type(), * get_player() */ @@ -108,7 +107,7 @@ static void write_thing(FILE * file, struct Thing * t) { write_thing(file, o); } - write_key_value(file, s[S_CMD_THING], t->id); + write_key_value(file, s[S_CMD_T_ID], t->id); write_key_value(file, s[S_CMD_T_TYPE], t->type); write_key_value(file, s[S_CMD_T_POSY], t->pos.y); write_key_value(file, s[S_CMD_T_POSX], t->pos.x); @@ -277,13 +276,14 @@ static char * build_visible_map(struct Thing * player) { for (t = world.things; t != 0; t = t->next) { - if ( player->fov_map[yx_to_map_pos(&t->pos)] & VISIBLE + if ( ( player->fov_map[t->pos.y * world.map.length +t->pos.x] + & VISIBLE) && ( (0 == i && 0 == t->lifepoints) || (1 == i && 0 < t->lifepoints))) { tt = get_thing_type(t->type); c = tt->char_on_map; - visible_map[yx_to_map_pos(&t->pos)] = c; + visible_map[t->pos.y * world.map.length + t->pos.x] = c; } } } @@ -346,7 +346,7 @@ extern void save_world() struct ThingAction * ta; for (ta = world.thing_actions; ta; ta = ta->next) { - write_key_value(file, s[S_CMD_THINGACTION], ta->id); + write_key_value(file, s[S_CMD_TA_ID], ta->id); write_key_value(file, s[S_CMD_TA_EFFORT], ta->effort); write_key_string(file, s[S_CMD_TA_NAME], ta->name); try_fputc('\n', file, __func__); @@ -354,7 +354,7 @@ extern void save_world() struct ThingType * tt; for (tt = world.thing_types; tt; tt = tt->next) { - write_key_value(file, s[S_CMD_THINGTYPE], tt->id); + write_key_value(file, s[S_CMD_TT_ID], tt->id); write_key_value(file, s[S_CMD_TT_STARTN], tt->start_n); write_key_value(file, s[S_CMD_TT_HP], tt->lifepoints); int test = fprintf(file, "%s %c\n", s[S_CMD_TT_SYMB], tt->char_on_map); @@ -365,7 +365,7 @@ extern void save_world() } for (tt = world.thing_types; tt; tt = tt->next) { - write_key_value(file, s[S_CMD_THINGTYPE], tt->id); + write_key_value(file, s[S_CMD_TT_ID], tt->id); write_key_value(file, s[S_CMD_TT_CORPS], tt->corpse_id); } try_fputc('\n', file, __func__);