aboutsummaryrefslogtreecommitdiffstats
path: root/FICS
diff options
context:
space:
mode:
Diffstat (limited to 'FICS')
-rw-r--r--FICS/playerdb.c180
1 files changed, 106 insertions, 74 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c
index bc0f939..4436923 100644
--- a/FICS/playerdb.c
+++ b/FICS/playerdb.c
@@ -1586,86 +1586,118 @@ PUBLIC int player_decline_offers(int p, int p1, int offerType)
}
-PUBLIC int player_withdraw_offers(int p, int p1, int offerType)
-{
- int offer;
- int type, p2;
- int count = 0;
- int part, p2part;
- char *pName = parray[p].name, *p2Name;
+PUBLIC int
+player_withdraw_offers(int p, int p1, int offerType)
+{
+ char *pName = parray[p].name;
+ char *p2Name;
+ int count = 0;
+ int offer;
+ int part, p2part;
+ int type, p2;
+
+ // First get rid of bughouse offers from partner.
+
+ if ((offerType == PEND_MATCH || offerType == PEND_ALL) &&
+ parray[p].partner >= 0 &&
+ parray[parray[p].partner].partner == p) {
+ count += player_withdraw_offers(parray[p].partner, p1,
+ PEND_BUGHOUSE);
+ }
- /* First get rid of bughouse offers from partner. */
- if ((offerType == PEND_MATCH || offerType == PEND_ALL)
- && parray[p].partner >= 0 && parray[parray[p].partner].partner == p)
- count += player_withdraw_offers(parray[p].partner, p1, PEND_BUGHOUSE);
+ while ((offer = player_find_pendto(p, p1, offerType)) >= 0) {
+ type = parray[p].p_to_list[offer].type;
+ p2 = parray[p].p_to_list[offer].whoto;
+ p2Name = parray[p2].name;
+ part = parray[p].partner;
+
+ if (part >= 0 && parray[part].partner != p)
+ part = -1;
+
+ p2part = parray[p2].partner;
+
+ if (p2part >= 0 && parray[p2part].partner != p2)
+ p2part = -1;
+
+ switch (type) {
+ case PEND_MATCH:
+ pprintf_prompt(p2, "\n%s withdraws the match offer.\n",
+ pName);
+ pprintf(p, "You withdraw the match offer to %s.\n",
+ p2Name);
+
+ if (!strcmp(parray[p].p_to_list[offer].char2,
+ "bughouse")) {
+ if (part >= 0) {
+ pprintf_prompt(part, "Your partner "
+ "withdraws the bughouse offer to "
+ "%s.\n", parray[p2].name);
+ }
+ if (p2part >= 0) {
+ pprintf_prompt(p2part, "%s withdraws "
+ "the bughouse offer to your "
+ "partner.\n", parray[p].name);
+ }
+ }
- while ((offer = player_find_pendto(p, p1, offerType)) >= 0) {
- type = parray[p].p_to_list[offer].type;
- p2 = parray[p].p_to_list[offer].whoto;
- p2Name = parray[p2].name;
+ break;
+ case PEND_DRAW:
+ pprintf_prompt(p2, "\n%s withdraws draw request.\n",
+ pName);
+ pprintf(p, "You withdraw the draw request to %s.\n",
+ p2Name);
+ break;
+ case PEND_PAUSE:
+ pprintf_prompt(p2, "\n%s withdraws pause request.\n",
+ pName);
+ pprintf(p, "You withdraw the pause request to %s.\n",
+ p2Name);
+ break;
+ case PEND_ABORT:
+ pprintf_prompt(p2, "\n%s withdraws abort request.\n",
+ pName);
+ pprintf(p, "You withdraw the abort request to %s.\n",
+ p2Name);
+ break;
+ case PEND_TAKEBACK:
+ pprintf_prompt(p2, "\n%s withdraws the takeback "
+ "request.\n", pName);
+ pprintf(p, "You withdraw the takeback request to %s.\n",
+ p2Name);
+ break;
+ case PEND_ADJOURN:
+ pprintf_prompt(p2, "\n%s withdraws the adjourn request."
+ "\n", pName);
+ pprintf(p, "You withdraw the adjourn request to %s.\n",
+ p2Name);
+ break;
+ case PEND_SWITCH:
+ pprintf_prompt(p2, "\n%s withdraws the switch sides "
+ "request.\n", pName);
+ pprintf(p, "You withdraw the switch sides request to "
+ "%s.\n", p2Name);
+ break;
+ case PEND_SIMUL:
+ pprintf_prompt(p2, "\n%s withdraws the simul offer.\n",
+ pName);
+ pprintf(p, "You withdraw the simul offer to %s.\n",
+ p2Name);
+ break;
+ case PEND_PARTNER:
+ pprintf_prompt(p2, "\n%s withdraws partnership request."
+ "\n", pName);
+ pprintf(p, "You withdraw the partnership request to %s."
+ "\n", p2Name);
+ break;
+ } /* switch */
- part = parray[p].partner;
- if (part >= 0 && parray[part].partner != p)
- part = -1;
- p2part = parray[p2].partner;
- if (p2part >= 0 && parray[p2part].partner != p2)
- p2part = -1;
+ player_remove_request(p, p2, type);
+ count++;
+ } /* while */
- switch (type) {
- case PEND_MATCH:
- pprintf_prompt(p2, "\n%s withdraws the match offer.\n", pName);
- pprintf(p, "You withdraw the match offer to %s.\n", p2Name);
- if (!strcmp(parray[p].p_to_list[offer].char2, "bughouse")) {
- if (part >= 0)
- pprintf_prompt(part,
- "Your partner withdraws the bughouse offer to %s.\n",
- parray[p2].name);
- if (p2part >= 0)
- pprintf_prompt(p2part,
- "%s withdraws the bughouse offer to your partner.\n",
- parray[p].name);
- }
- break;
- case PEND_DRAW:
- pprintf_prompt(p2, "\n%s withdraws draw request.\n", pName);
- pprintf(p, "You withdraw the draw request to %s.\n", p2Name);
- break;
- case PEND_PAUSE:
- pprintf_prompt(p2, "\n%s withdraws pause request.\n", pName);
- pprintf(p, "You withdraw the pause request to %s.\n", p2Name);
- break;
- case PEND_ABORT:
- pprintf_prompt(p2, "\n%s withdraws abort request.\n", pName);
- pprintf(p, "You withdraw the abort request to %s.\n", p2Name);
- break;
- case PEND_TAKEBACK:
- pprintf_prompt(p2, "\n%s withdraws the takeback request.\n", pName);
- pprintf(p, "You withdraw the takeback request to %s.\n", p2Name);
- break;
- case PEND_ADJOURN:
- pprintf_prompt(p2, "\n%s withdraws the adjourn request.\n", pName);
- pprintf(p, "You withdraw the adjourn request to %s.\n", p2Name);
- break;
- case PEND_SWITCH:
- pprintf_prompt(p2, "\n%s withdraws the switch sides request.\n", pName);
- pprintf(p, "You withdraw the switch sides request to %s.\n", p2Name);
- break;
- case PEND_SIMUL:
- pprintf_prompt(p2, "\n%s withdraws the simul offer.\n", pName);
- pprintf(p, "You withdraw the simul offer to %s.\n", p2Name);
- break;
- case PEND_PARTNER:
- pprintf_prompt(p2, "\n%s withdraws partnership request.\n", pName);
- pprintf(p, "You withdraw the partnership request to %s.\n", p2Name);
- break;
- }
- player_remove_request(p, p2, type);
- count++;
- }
- return count;
+ return count;
}
-
PUBLIC int
player_is_observe(int p, int g)
{