diff -X freeciv/diff_ignore -Nurd freeciv/common/packets.c freeciv.patched/common/packets.c --- freeciv/common/packets.c Mon Feb 5 17:05:47 2001 +++ freeciv.patched/common/packets.c Tue Feb 6 00:12:05 2001 @@ -1186,9 +1186,10 @@ may want to remove the 'struct connection *pc' argument (?) */ static unsigned char *put_worklist(unsigned char *buffer, const struct worklist *pwl, - struct connection *pc, int real_wl) + struct connection *pc, int real_wl) { - int i; + int i, has_cap = (pc && has_capability("worklist_true_ids", + pc->capability)); buffer = put_uint8(buffer, pwl->is_valid); if (real_wl) @@ -1196,22 +1197,23 @@ else buffer = put_string(buffer, "\0"); for (i = 0; i < MAX_LEN_WORKLIST; i++) { -/* when removing "worklist_true_ids" capability, - leave only the code from the *else* clause (send untranslated values) */ -if (pc && !has_capability("worklist_true_ids", pc->capability)) { - if (pwl->wlefs[i] == WEF_END) { - buffer = put_uint16(buffer, 284); - } else if (pwl->wlefs[i] == WEF_UNIT) { - buffer = put_uint16(buffer, pwl->wlids[i] + 68); - } else { - buffer = put_uint16(buffer, pwl->wlids[i]); - } -} else { /* the following is the code to leave when removing "worklist_true_ids" */ - buffer = put_uint8(buffer, pwl->wlefs[i]); - buffer = put_uint8(buffer, pwl->wlids[i]); -} + /* when removing "worklist_true_ids" capability, leave only the + code from the *else* clause (send untranslated values) */ + if (!has_cap) { + if (pwl->wlefs[i] == WEF_END) { + buffer = put_uint16(buffer, 284); + } else if (pwl->wlefs[i] == WEF_UNIT) { + buffer = put_uint16(buffer, pwl->wlids[i] + 68); + } else { + buffer = put_uint16(buffer, pwl->wlids[i]); + } + } else { + /* the following is the code to leave when removing + "worklist_true_ids" */ + buffer = put_uint8(buffer, pwl->wlefs[i]); + buffer = put_uint8(buffer, pwl->wlids[i]); + } } - return buffer; } @@ -1221,35 +1223,39 @@ /* when removing "worklist_true_ids" capability, may want to remove the 'struct connection *pc' argument (?) */ static void iget_worklist(struct pack_iter *piter, struct worklist *pwl, - struct connection *pc) + struct connection *pc) { - int i; + int i, has_cap = (pc && has_capability("worklist_true_ids", + pc->capability)); iget_uint8(piter, &pwl->is_valid); iget_string(piter, pwl->name, MAX_LEN_NAME); for (i = 0; i < MAX_LEN_WORKLIST; i++) { -/* when removing "worklist_true_ids" capability, - leave only the code from the *else* clause (receive untranslated values) */ -if (pc && !has_capability("worklist_true_ids", pc->capability)) { - int val; - iget_uint16(piter, &val); - if (val == 284) { - pwl->wlefs[i] = WEF_END; - pwl->wlids[i] = 0; - } else if (val >= 68) { - pwl->wlefs[i] = WEF_UNIT; - pwl->wlids[i] = val - 68; - } else { - pwl->wlefs[i] = WEF_IMPR; - pwl->wlids[i] = val; - } -} else { /* the following is the code to leave when removing "worklist_true_ids" */ - iget_uint8(piter, (int*)&pwl->wlefs[i]); - iget_uint8(piter, &pwl->wlids[i]); -} + /* when removing "worklist_true_ids" capability, leave only the + code from the *else* clause (receive untranslated values) */ + if (!has_cap) { + int val; + + iget_uint16(piter, &val); + if (val == 284) { + pwl->wlefs[i] = WEF_END; + pwl->wlids[i] = 0; + } else if (val >= 68) { + pwl->wlefs[i] = WEF_UNIT; + pwl->wlids[i] = val - 68; + } else { + pwl->wlefs[i] = WEF_IMPR; + pwl->wlids[i] = val; + } + } else { + /* the following is the code to leave when removing + "worklist_true_ids" */ + iget_uint8(piter, (int *) &pwl->wlefs[i]); + iget_uint8(piter, &pwl->wlids[i]); + } } } - + /************************************************************************* ... **************************************************************************/