From: Christian Heller Date: Sun, 8 Mar 2015 16:10:49 +0000 (+0100) Subject: Server/C: In actor_pick(), pick highest ID'd item in stack of many. X-Git-Tag: tce~363 X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/do_tasks?a=commitdiff_plain;h=57ec5003ecb7f83f97b5599588440454a319f323;p=plomrogue Server/C: In actor_pick(), pick highest ID'd item in stack of many. --- diff --git a/src/server/thing_actions.c b/src/server/thing_actions.c index 2a682c2..c9e8ddb 100644 --- a/src/server/thing_actions.c +++ b/src/server/thing_actions.c @@ -270,11 +270,16 @@ extern void actor_pick(struct Thing * t) { struct Thing * picked = NULL; struct Thing * t_i; + uint8_t highest_id = 0; for (t_i = world.things; t_i; t_i = t_i->next) { if (t_i != t && t_i->pos.y == t->pos.y && t_i->pos.x == t->pos.x) { - picked = t_i; + if (t_i->id >= highest_id) /* With several Things to pick, */ + { /* pick the one with the highest ID. */ + highest_id = t_i->id; + picked = t_i; + } } } if (picked)