| Rules Applied | JavaKeywordRule | app0.txt | PPspaceRule | PPifdefRule | PPifndefRule | PPRule | PPdefineRule.DefineReplacementRule | MissingFunctionTypeRule | snippets0b.txt | TypedefRule.DefineReplacementRule | FunctionPointerReferenceRule | MissingReturnRule | ArrayDeclaration0Rule | AddBracesRule | LabelRemoverRule | VoidArgumentRule | voidstarsnippet.txt | ConflictingVariableDeclarationRule | StaticVariablesRule | StaticFunctionsRule | ShorthandOperatorsRule | snippets0f.txt | readline2.lsnippet | promptAndRead.lsnippet | ArrayDeclarationRule | StringRule | ZeroComparisonRule | DeclarationAssignmentRule | PointerRule | ForceToBooleanRule | snippets1.txt | snippets2.txt | snippets2a.txt | snippets3.txt | ElseIfRule | SignalRule | PrintfRule | stdin.txt | IOExceptionRule | UninitializedVariableRule | InsertClassRule | ImportRule | (Final Version) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| JavaKeywordRule app0.txt PPspaceRule PPifdefRule PPifndefRule PPRule PPdefineRule.DefineReplacementRule MissingFunctionTypeRule snippets0b.txt TypedefRule.DefineReplacementRule FunctionPointerReferenceRule MissingReturnRule ArrayDeclaration0Rule AddBracesRule LabelRemoverRule VoidArgumentRule voidstarsnippet.txt ConflictingVariableDeclarationRule StaticVariablesRule StaticFunctionsRule ShorthandOperatorsRule snippets0f.txt readline2.lsnippet promptAndRead.lsnippet ArrayDeclarationRule StringRule ZeroComparisonRule DeclarationAssignmentRule PointerRule ForceToBooleanRule snippets1.txt snippets2.txt snippets2a.txt snippets3.txt ElseIfRule SignalRule PrintfRule stdin.txt IOExceptionRule UninitializedVariableRule InsertClassRule ImportRule final | #ifndef lint static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93"; #endif # include "monop.ext" # include | #ifndef lint static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93"; #endif # include "monop.ext" # include | #ifndef lint static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93"; #endif #include "monop.ext" #include | #ifndef lint static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93"; #endif #include "monop.ext" #include | #if !defined(lint) static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93"; #endif #include "monop.ext" #include | static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
getYesOrNo(register char * prompt, void * = 0) {
regint answerIndex;
for (;;) if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) return answerIndex;
else ( * functions[answerIndex - 2]) ();
}
void notify1(void * = 0) {
if (currentPlayer->money < 0) printf("That leaves you $%d in debt\n", - currentPlayer->money);
else if (currentPlayer->money == 0) printf("that leaves you broke\n");
else if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = TRUE;
}
}
void nextPlayer(void) {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
getInteger(register char * prompt) {
regint num;
regchar * sp;
char buf[257];
for (;;) {
inter:for (;;) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) if ( * sp == - 1) continue;
break;
}
if (sp == buf) continue;
for (sp = buf;isspace( * sp);sp++) continue;
for (;isdigit( * sp);sp++) num = num * 10 + * sp - '0';
if ( * sp == '\n') return num;
else printf("I can't understand that\n");
}
}
void initializeOwnerList(int playerIndex) {
regint num;
reg MON * originalMonopoly;
reg OWN * propertyList;
OWN * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) num++;
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) isMonopoly(originalMonopoly, playerIndex);
else isNotMonopoly(originalMonopoly);
break;
}
}
}
void isMonopoly(register MON * monopoly, int playerIndex) {
regchar * sp;
regint i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = TRUE;
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(register MON * monopoly) {
regchar * sp;
regint i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = FALSE;
monopoly->name = monopoly->lowercaseColor;
}
void printHoldings(void) {
printHoldings(currentPlayerNumber);
}
void promptAndPrintHoldings(void) {
regint playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) printHoldings(playerIndex);
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) exit(0);
}
| static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
getYesOrNo(register char * prompt, void * = 0) {
register int answerIndex;
for (;;) if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) return answerIndex;
else ( * functions[answerIndex - 2]) ();
}
void notify1(void * = 0) {
if (currentPlayer->money < 0) printf("That leaves you $%d in debt\n", - currentPlayer->money);
else if (currentPlayer->money == 0) printf("that leaves you broke\n");
else if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
void nextPlayer(void) {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
getInteger(register char * prompt) {
register int num;
register char * sp;
char buf[257];
for (;;) {
inter:for (;;) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) if ( * sp == - 1) continue;
break;
}
if (sp == buf) continue;
for (sp = buf;isspace( * sp);sp++) continue;
for (;isdigit( * sp);sp++) num = num * 10 + * sp - '0';
if ( * sp == '\n') return num;
else printf("I can't understand that\n");
}
}
void initializeOwnerList(int playerIndex) {
register int num;
register MON * originalMonopoly;
register OWN * propertyList;
OWN * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) num++;
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) isMonopoly(originalMonopoly, playerIndex);
else isNotMonopoly(originalMonopoly);
break;
}
}
}
void isMonopoly(register MON * monopoly, int playerIndex) {
register char * sp;
register int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = true;
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(register MON * monopoly) {
register char * sp;
register int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = false;
monopoly->name = monopoly->lowercaseColor;
}
void printHoldings(void) {
printHoldings(currentPlayerNumber);
}
void promptAndPrintHoldings(void) {
register int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) printHoldings(playerIndex);
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) exit(0);
}
| static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(register char * prompt, void * = 0) {
register int answerIndex;
for (;;) if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) return answerIndex;
else ( * functions[answerIndex - 2]) ();
}
void notify1(void * = 0) {
if (currentPlayer->money < 0) printf("That leaves you $%d in debt\n", - currentPlayer->money);
else if (currentPlayer->money == 0) printf("that leaves you broke\n");
else if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
void nextPlayer(void) {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
int getInteger(register char * prompt) {
register int num;
register char * sp;
char buf[257];
for (;;) {
inter:for (;;) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) if ( * sp == - 1) continue;
break;
}
if (sp == buf) continue;
for (sp = buf;isspace( * sp);sp++) continue;
for (;isdigit( * sp);sp++) num = num * 10 + * sp - '0';
if ( * sp == '\n') return num;
else printf("I can't understand that\n");
}
}
void initializeOwnerList(int playerIndex) {
register int num;
register MON * originalMonopoly;
register OWN * propertyList;
OWN * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) num++;
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) isMonopoly(originalMonopoly, playerIndex);
else isNotMonopoly(originalMonopoly);
break;
}
}
}
void isMonopoly(register MON * monopoly, int playerIndex) {
register char * sp;
register int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = true;
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(register MON * monopoly) {
register char * sp;
register int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = false;
monopoly->name = monopoly->lowercaseColor;
}
void printHoldings(void) {
printHoldings(currentPlayerNumber);
}
void promptAndPrintHoldings(void) {
register int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) printHoldings(playerIndex);
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) exit(0);
}
| static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(char * prompt, void * = 0) {
int answerIndex;
while (true) if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) return answerIndex;
else ( * functions[answerIndex - 2]) ();
}
void notify1(void * = 0) {
if (currentPlayer->money < 0) printf("That leaves you $%d in debt\n", - currentPlayer->money);
else if (currentPlayer->money == 0) printf("that leaves you broke\n");
else if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
void nextPlayer(void) {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
int getInteger(char * prompt) {
int num;
char * sp;
char buf[257];
while (true) {
inter:while (true) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) if ( * sp == - 1) continue;
break;
}
if (sp == buf) continue;
for (sp = buf;isspace( * sp);sp++) continue;
for (;isdigit( * sp);sp++) num = num * 10 + * sp - '0';
if ( * sp == '\n') return num;
else printf("I can't understand that\n");
}
}
void initializeOwnerList(int playerIndex) {
int num;
MON * originalMonopoly;
OWN * propertyList;
OWN * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) num++;
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) isMonopoly(originalMonopoly, playerIndex);
else isNotMonopoly(originalMonopoly);
break;
}
}
}
void isMonopoly(MON * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = true;
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(MON * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = false;
monopoly->name = monopoly->lowercaseColor;
}
void printHoldings(void) {
printHoldings(currentPlayerNumber);
}
void promptAndPrintHoldings(void) {
int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) printHoldings(playerIndex);
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) exit(0);
}
| static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(char * prompt, void * = 0) {
int answerIndex;
while (true) if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) return answerIndex;
else ( * functions[answerIndex - 2]) ();
}
void notify1(void * = 0) {
if (currentPlayer->money < 0) printf("That leaves you $%d in debt\n", - currentPlayer->money);
else if (currentPlayer->money == 0) printf("that leaves you broke\n");
else if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
void nextPlayer(void) {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
int getInteger(char * prompt) {
int num;
char * sp;
char buf[257];
while (true) {
inter:while (true) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) if ( * sp == - 1) continue;
break;
}
if (sp == buf) continue;
for (sp = buf;isspace( * sp);sp++) continue;
for (;isdigit( * sp);sp++) num = num * 10 + * sp - '0';
if ( * sp == '\n') return num;
else printf("I can't understand that\n");
}
}
void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList;
OwnedPropertyList * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) num++;
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) isMonopoly(originalMonopoly, playerIndex);
else isNotMonopoly(originalMonopoly);
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = true;
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = false;
monopoly->name = monopoly->lowercaseColor;
}
void printHoldings(void) {
printHoldings(currentPlayerNumber);
}
void promptAndPrintHoldings(void) {
int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) printHoldings(playerIndex);
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) exit(0);
}
| static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(char * prompt, void * = 0) {
int answerIndex;
while (true) if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) return answerIndex;
else Invoker.invoke(functions[answerIndex - 2]) }
void notify1(void * = 0) {
if (currentPlayer->money < 0) printf("That leaves you $%d in debt\n", - currentPlayer->money);
else if (currentPlayer->money == 0) printf("that leaves you broke\n");
else if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
void nextPlayer(void) {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
int getInteger(char * prompt) {
int num;
char * sp;
char buf[257];
while (true) {
inter:while (true) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) if ( * sp == - 1) continue;
break;
}
if (sp == buf) continue;
for (sp = buf;isspace( * sp);sp++) continue;
for (;isdigit( * sp);sp++) num = num * 10 + * sp - '0';
if ( * sp == '\n') return num;
else printf("I can't understand that\n");
}
}
void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList;
OwnedPropertyList * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) num++;
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) isMonopoly(originalMonopoly, playerIndex);
else isNotMonopoly(originalMonopoly);
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = true;
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = false;
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings(void) {
printHoldings(currentPlayerNumber);
}
public static void promptAndPrintHoldings(void) {
int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) printHoldings(playerIndex);
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) exit(0);
}
| static char sccsid[] = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(char * prompt, void * = 0) {
int answerIndex;
while (true) if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) return answerIndex;
return else Invoker.invoke(functions[answerIndex - 2]) }
void notify1(void * = 0) {
if (currentPlayer->money < 0) printf("That leaves you $%d in debt\n", - currentPlayer->money);
else if (currentPlayer->money == 0) printf("that leaves you broke\n");
else if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
void nextPlayer(void) {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
int getInteger(char * prompt) {
int num;
char * sp;
char buf[257];
while (true) {
inter:while (true) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) if ( * sp == - 1) continue;
break;
}
if (sp == buf) continue;
for (sp = buf;isspace( * sp);sp++) continue;
for (;isdigit( * sp);sp++) num = num * 10 + * sp - '0';
if ( * sp == '\n') return num;
else printf("I can't understand that\n");
}
}
void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList;
OwnedPropertyList * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) num++;
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) isMonopoly(originalMonopoly, playerIndex);
else isNotMonopoly(originalMonopoly);
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = true;
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = false;
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings(void) {
printHoldings(currentPlayerNumber);
}
public static void promptAndPrintHoldings(void) {
int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) printHoldings(playerIndex);
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) exit(0);
}
| static char[] sccsid = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(char * prompt, void * = 0) {
int answerIndex;
while (true) if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) return answerIndex;
return else Invoker.invoke(functions[answerIndex - 2]) }
void notify1(void * = 0) {
if (currentPlayer->money < 0) printf("That leaves you $%d in debt\n", - currentPlayer->money);
else if (currentPlayer->money == 0) printf("that leaves you broke\n");
else if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
void nextPlayer(void) {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
int getInteger(char * prompt) {
int num;
char * sp;
char[257] buf;
while (true) {
inter:while (true) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) if ( * sp == - 1) continue;
break;
}
if (sp == buf) continue;
for (sp = buf;isspace( * sp);sp++) continue;
for (;isdigit( * sp);sp++) num = num * 10 + * sp - '0';
if ( * sp == '\n') return num;
else printf("I can't understand that\n");
}
}
void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList;
OwnedPropertyList * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) num++;
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) isMonopoly(originalMonopoly, playerIndex);
else isNotMonopoly(originalMonopoly);
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = true;
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) monopoly->squares[i]->description->isMonopoly = false;
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings(void) {
printHoldings(currentPlayerNumber);
}
public static void promptAndPrintHoldings(void) {
int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) printHoldings(playerIndex);
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) exit(0);
}
| static char[] sccsid = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(char * prompt, void * = 0) {
int answerIndex;
while (true) {
if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) {
return answerIndex;
}
}
return else {
Invoker.invoke(functions[answerIndex - 2]) }
}
void notify1(void * = 0) {
if (currentPlayer->money < 0) {
printf("That leaves you $%d in debt\n", - currentPlayer->money);
}
else {
if (currentPlayer->money == 0) {
printf("that leaves you broke\n");
}
else {
if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
}
}
void nextPlayer(void) {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
int getInteger(char * prompt) {
int num;
char * sp;
char[257] buf;
while (true) {
inter:while (true) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) {
if ( * sp == - 1) {
continue;
}
}
break;
}
if (sp == buf) {
continue;
}
for (sp = buf;isspace( * sp);sp++) {
continue;
}
for (;isdigit( * sp);sp++) {
num = num * 10 + * sp - '0';
}
if ( * sp == '\n') {
return num;
}
else {
printf("I can't understand that\n");
}
}
}
void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList;
OwnedPropertyList * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) {
num++;
}
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) {
isMonopoly(originalMonopoly, playerIndex);
}
else {
isNotMonopoly(originalMonopoly);
}
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = true;
}
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = false;
}
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings(void) {
printHoldings(currentPlayerNumber);
}
public static void promptAndPrintHoldings(void) {
int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) {
printHoldings(playerIndex);
}
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) {
exit(0);
}
}
| static char[] sccsid = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(char * prompt, void * = 0) {
int answerIndex;
while (true) {
if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) {
return answerIndex;
}
}
return else {
Invoker.invoke(functions[answerIndex - 2]) }
}
void notify1(void * = 0) {
if (currentPlayer->money < 0) {
printf("That leaves you $%d in debt\n", - currentPlayer->money);
}
else {
if (currentPlayer->money == 0) {
printf("that leaves you broke\n");
}
else {
if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
}
}
void nextPlayer(void) {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
int getInteger(char * prompt) {
int num;
char * sp;
char[257] buf;
while (true) {
while (true) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) {
if ( * sp == - 1) {
continue;
}
}
break;
}
if (sp == buf) {
continue;
}
for (sp = buf;isspace( * sp);sp++) {
continue;
}
for (;isdigit( * sp);sp++) {
num = num * 10 + * sp - '0';
}
if ( * sp == '\n') {
return num;
}
else {
printf("I can't understand that\n");
}
}
}
void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList;
OwnedPropertyList * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) {
num++;
}
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) {
isMonopoly(originalMonopoly, playerIndex);
}
else {
isNotMonopoly(originalMonopoly);
}
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = true;
}
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = false;
}
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings(void) {
printHoldings(currentPlayerNumber);
}
public static void promptAndPrintHoldings(void) {
int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) {
printHoldings(playerIndex);
}
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) {
exit(0);
}
}
| static char[] sccsid = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(char * prompt) {
int answerIndex;
while (true) {
if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) {
return answerIndex;
}
}
return else {
Invoker.invoke(functions[answerIndex - 2]) }
}
void notify1() {
if (currentPlayer->money < 0) {
printf("That leaves you $%d in debt\n", - currentPlayer->money);
}
else {
if (currentPlayer->money == 0) {
printf("that leaves you broke\n");
}
else {
if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
}
}
void nextPlayer(void) {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
int getInteger(char * prompt) {
int num;
char * sp;
char[257] buf;
while (true) {
while (true) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) {
if ( * sp == - 1) {
continue;
}
}
break;
}
if (sp == buf) {
continue;
}
for (sp = buf;isspace( * sp);sp++) {
continue;
}
for (;isdigit( * sp);sp++) {
num = num * 10 + * sp - '0';
}
if ( * sp == '\n') {
return num;
}
else {
printf("I can't understand that\n");
}
}
}
void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList;
OwnedPropertyList * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) {
num++;
}
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) {
isMonopoly(originalMonopoly, playerIndex);
}
else {
isNotMonopoly(originalMonopoly);
}
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = true;
}
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = false;
}
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings(void) {
printHoldings(currentPlayerNumber);
}
public static void promptAndPrintHoldings(void) {
int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) {
printHoldings(playerIndex);
}
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) {
exit(0);
}
}
| static char[] sccsid = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(char * prompt) {
int answerIndex;
while (true) {
if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) {
return answerIndex;
}
}
return else {
Invoker.invoke(functions[answerIndex - 2]) }
}
void notify1() {
if (currentPlayer->money < 0) {
printf("That leaves you $%d in debt\n", - currentPlayer->money);
}
else {
if (currentPlayer->money == 0) {
printf("that leaves you broke\n");
}
else {
if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
}
}
void nextPlayer() {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
int getInteger(char * prompt) {
int num;
char * sp;
char[257] buf;
while (true) {
while (true) {
printf(prompt);
num = 0;
for (sp = buf;( * sp = getchar()) != '\n';sp++) {
if ( * sp == - 1) {
continue;
}
}
break;
}
if (sp == buf) {
continue;
}
for (sp = buf;isspace( * sp);sp++) {
continue;
}
for (;isdigit( * sp);sp++) {
num = num * 10 + * sp - '0';
}
if ( * sp == '\n') {
return num;
}
else {
printf("I can't understand that\n");
}
}
}
void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList;
OwnedPropertyList * original_ownedPropertyList;
propertyList = players[playerIndex].ownedPropertyList;
while (propertyList) {
switch (propertyList->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList && propertyList->square1->type == TYPE_UTIL;propertyList = propertyList->next) {
num++;
}
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList && propertyList->square1->type == TYPE_RAILROAD;propertyList = propertyList->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList;
num = 0;
while (propertyList && propertyList->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList = propertyList->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("orig_op->next = %d\n", propertyList->next);
printf("orig_op->sqr->desc = %d\n", propertyList->square1->description);
printf("op = %d\n", propertyList);
printf("op->sqr->type = %d (PRPTY)\n", propertyList->square1->type);
printf("op->next = %d\n", propertyList->next);
printf("op->sqr->desc = %d\n", propertyList->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) {
isMonopoly(originalMonopoly, playerIndex);
}
else {
isNotMonopoly(originalMonopoly);
}
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = true;
}
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = false;
}
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings() {
printHoldings(currentPlayerNumber);
}
public static void promptAndPrintHoldings() {
int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) {
printHoldings(playerIndex);
}
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) {
exit(0);
}
}
| static char[] sccsid = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(char * prompt) {
int answerIndex;
while (true) {
if ((answerIndex = getinp(prompt, yesNoChoices)) < 2) {
return answerIndex;
}
}
return else {
Invoker.invoke(functions[answerIndex - 2]) }
}
void notify1() {
if (currentPlayer->money < 0) {
printf("That leaves you $%d in debt\n", - currentPlayer->money);
}
else {
if (currentPlayer->money == 0) {
printf("that leaves you broke\n");
}
else {
if (fixing &&!moneyStatusGiven && currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
moneyStatusGiven = true;
}
}
}
}
void nextPlayer() {
currentPlayerNumber =++currentPlayerNumber % numberOfPlayers;
currentPlayer = & players[currentPlayerNumber];
numberOfDoubles = 0;
}
int getInteger(char * prompt) {
int num;
char * sp;
char[257] buf1;
while (true) {
while (true) {
printf(prompt);
num = 0;
for (sp = buf1;( * sp = getchar()) != '\n';sp++) {
if ( * sp == - 1) {
continue;
}
}
break;
}
if (sp == buf1) {
continue;
}
for (sp = buf1;isspace( * sp);sp++) {
continue;
}
for (;isdigit( * sp);sp++) {
num = num * 10 + * sp - '0';
}
if ( * sp == '\n') {
return num;
}
else {
printf("I can't understand that\n");
}
}
}
void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList4;
OwnedPropertyList * original_ownedPropertyList;
propertyList4 = players[playerIndex].ownedPropertyList;
while (propertyList4) {
switch (propertyList4->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_UTIL;propertyList4 = propertyList4->next) {
num++;
}
players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_RAILROAD;propertyList4 = propertyList4->next) {
num++;
}
players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList4->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList4;
num = 0;
while (propertyList4 && propertyList4->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList4 = propertyList4->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("orig_op->next = %d\n", propertyList4->next);
printf("orig_op->sqr->desc = %d\n", propertyList4->square1->description);
printf("op = %d\n", propertyList4);
printf("op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("op->next = %d\n", propertyList4->next);
printf("op->sqr->desc = %d\n", propertyList4->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) {
isMonopoly(originalMonopoly, playerIndex);
}
else {
isNotMonopoly(originalMonopoly);
}
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = true;
}
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = false;
}
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings() {
printHoldings(currentPlayerNumber);
}
public static void promptAndPrintHoldings() {
int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", playerNames)) < numberOfPlayers) {
printHoldings(playerIndex);
}
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) {
exit(0);
}
}
| static char[] sccsid = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
int getYesOrNo(char * prompt) {
int answerIndex;
while (true) {
if ((answerIndex = getinp(prompt, Monop.yesNoChoices)) < 2) {
return answerIndex;
}
}
return else {
Invoker.invoke(Monop.functions[answerIndex - 2]) }
}
void notify1() {
if (Monop.currentPlayer->money < 0) {
printf("That leaves you $%d in debt\n", - Monop.currentPlayer->money);
}
else {
if (Monop.currentPlayer->money == 0) {
printf("that leaves you broke\n");
}
else {
if (Monop.fixing &&!Monop.moneyStatusGiven && Monop.currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
Monop.moneyStatusGiven = true;
}
}
}
}
void nextPlayer() {
Monop.currentPlayerNumber =++Monop.currentPlayerNumber % Monop.numberOfPlayers;
Monop.currentPlayer = & Monop.players[Monop.currentPlayerNumber];
Monop.numberOfDoubles = 0;
}
int getInteger(char * prompt) {
int num;
char * sp;
char[257] buf1;
while (true) {
while (true) {
printf(prompt);
num = 0;
for (sp = buf1;( * sp = getchar()) != '\n';sp++) {
if ( * sp == - 1) {
continue;
}
}
break;
}
if (sp == buf1) {
continue;
}
for (sp = buf1;isspace( * sp);sp++) {
continue;
}
for (;isdigit( * sp);sp++) {
num = num * 10 + * sp - '0';
}
if ( * sp == '\n') {
return num;
}
else {
printf("I can't understand that\n");
}
}
}
void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList4;
OwnedPropertyList * original_ownedPropertyList;
propertyList4 = Monop.players[playerIndex].ownedPropertyList;
while (propertyList4) {
switch (propertyList4->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_UTIL;propertyList4 = propertyList4->next) {
num++;
}
Monop.players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_RAILROAD;propertyList4 = propertyList4->next) {
num++;
}
Monop.players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList4->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList4;
num = 0;
while (propertyList4 && propertyList4->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList4 = propertyList4->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("orig_op->next = %d\n", propertyList4->next);
printf("orig_op->sqr->desc = %d\n", propertyList4->square1->description);
printf("op = %d\n", propertyList4);
printf("op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("op->next = %d\n", propertyList4->next);
printf("op->sqr->desc = %d\n", propertyList4->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) {
isMonopoly(originalMonopoly, playerIndex);
}
else {
isNotMonopoly(originalMonopoly);
}
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = true;
}
monopoly->name = monopoly->uppercaseColor;
}
void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = false;
}
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings() {
printHoldings(Monop.currentPlayerNumber);
}
public static void promptAndPrintHoldings() {
int playerIndex;
while ((playerIndex = getinp("Whose holdings do you want to see? ", Monop.playerNames)) < Monop.numberOfPlayers) {
printHoldings(playerIndex);
}
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) {
exit(0);
}
}
| static char[] sccsid = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
static int getYesOrNo(char * prompt) {
int answerIndex;
while (true) {
if ((answerIndex = GetInput.getinp(prompt, Monop.yesNoChoices)) < 2) {
return answerIndex;
}
}
return else {
Invoker.invoke(Monop.functions[answerIndex - 2]) }
}
static void notify1() {
if (Monop.currentPlayer->money < 0) {
printf("That leaves you $%d in debt\n", - Monop.currentPlayer->money);
}
else {
if (Monop.currentPlayer->money == 0) {
printf("that leaves you broke\n");
}
else {
if (Monop.fixing &&!Monop.moneyStatusGiven && Monop.currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
Monop.moneyStatusGiven = true;
}
}
}
}
static void nextPlayer() {
Monop.currentPlayerNumber =++Monop.currentPlayerNumber % Monop.numberOfPlayers;
Monop.currentPlayer = & Monop.players[Monop.currentPlayerNumber];
Monop.numberOfDoubles = 0;
}
static int getInteger(char * prompt) {
int num;
char * sp;
char[257] buf1;
while (true) {
while (true) {
printf(prompt);
num = 0;
for (sp = buf1;( * sp = getchar()) != '\n';sp++) {
if ( * sp == - 1) {
continue;
}
}
break;
}
if (sp == buf1) {
continue;
}
for (sp = buf1;isspace( * sp);sp++) {
continue;
}
for (;isdigit( * sp);sp++) {
num = num * 10 + * sp - '0';
}
if ( * sp == '\n') {
return num;
}
else {
printf("I can't understand that\n");
}
}
}
static void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList4;
OwnedPropertyList * original_ownedPropertyList;
propertyList4 = Monop.players[playerIndex].ownedPropertyList;
while (propertyList4) {
switch (propertyList4->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_UTIL;propertyList4 = propertyList4->next) {
num++;
}
Monop.players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_RAILROAD;propertyList4 = propertyList4->next) {
num++;
}
Monop.players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList4->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList4;
num = 0;
while (propertyList4 && propertyList4->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList4 = propertyList4->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
Print.printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("orig_op->next = %d\n", propertyList4->next);
printf("orig_op->sqr->desc = %d\n", propertyList4->square1->description);
printf("op = %d\n", propertyList4);
printf("op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("op->next = %d\n", propertyList4->next);
printf("op->sqr->desc = %d\n", propertyList4->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) {
isMonopoly(originalMonopoly, playerIndex);
}
else {
isNotMonopoly(originalMonopoly);
}
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = true;
}
monopoly->name = monopoly->uppercaseColor;
}
static void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = false;
}
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings() {
Print.printHoldings(Monop.currentPlayerNumber);
}
public static void promptAndPrintHoldings() {
int playerIndex;
while ((playerIndex = GetInput.getinp("Whose holdings do you want to see? ", Monop.playerNames)) < Monop.numberOfPlayers) {
Print.printHoldings(playerIndex);
}
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) {
exit(0);
}
}
| static char[] sccsid = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
static int getYesOrNo(char * prompt) {
int answerIndex;
while (true) {
if ((answerIndex = GetInput.getinp(prompt, Monop.yesNoChoices)) < 2) {
return answerIndex;
}
}
return else {
Invoker.invoke(Monop.functions[answerIndex - 2]) }
}
static void notify1() {
if (Monop.currentPlayer->money < 0) {
printf("That leaves you $%d in debt\n", - Monop.currentPlayer->money);
}
else {
if (Monop.currentPlayer->money == 0) {
printf("that leaves you broke\n");
}
else {
if (Monop.fixing &&!Monop.moneyStatusGiven && Monop.currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
Monop.moneyStatusGiven = true;
}
}
}
}
static void nextPlayer() {
Monop.currentPlayerNumber =++Monop.currentPlayerNumber % Monop.numberOfPlayers;
Monop.currentPlayer = & Monop.players[Monop.currentPlayerNumber];
Monop.numberOfDoubles = 0;
}
static int getInteger(char * prompt) {
int num;
char * sp;
char[257] buf1;
while (true) {
while (true) {
printf(prompt);
num = 0;
for (sp = buf1;( * sp = getchar()) != '\n';sp++) {
if ( * sp == - 1) {
continue;
}
}
break;
}
if (sp == buf1) {
continue;
}
for (sp = buf1;isspace( * sp);sp++) {
continue;
}
for (;isdigit( * sp);sp++) {
num *= 10 + * sp - '0';
}
if ( * sp == '\n') {
return num;
}
else {
printf("I can't understand that\n");
}
}
}
static void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList4;
OwnedPropertyList * original_ownedPropertyList;
propertyList4 = Monop.players[playerIndex].ownedPropertyList;
while (propertyList4) {
switch (propertyList4->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_UTIL;propertyList4 = propertyList4->next) {
num++;
}
Monop.players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_RAILROAD;propertyList4 = propertyList4->next) {
num++;
}
Monop.players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList4->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList4;
num = 0;
while (propertyList4 && propertyList4->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList4 = propertyList4->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
Print.printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("orig_op->next = %d\n", propertyList4->next);
printf("orig_op->sqr->desc = %d\n", propertyList4->square1->description);
printf("op = %d\n", propertyList4);
printf("op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("op->next = %d\n", propertyList4->next);
printf("op->sqr->desc = %d\n", propertyList4->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) {
isMonopoly(originalMonopoly, playerIndex);
}
else {
isNotMonopoly(originalMonopoly);
}
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = true;
}
monopoly->name = monopoly->uppercaseColor;
}
static void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = false;
}
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings() {
Print.printHoldings(Monop.currentPlayerNumber);
}
public static void promptAndPrintHoldings() {
int playerIndex;
while ((playerIndex = GetInput.getinp("Whose holdings do you want to see? ", Monop.playerNames)) < Monop.numberOfPlayers) {
Print.printHoldings(playerIndex);
}
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) {
exit(0);
}
}
| static char[] sccsid = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
static int getYesOrNo(char * prompt) {
int answerIndex;
while (true) {
answerIndex = GetInput.getinp(prompt, Monop.yesNoChoices);
if (answerIndex < 2) {
return answerIndex;
}
}
return else {
Invoker.invoke(Monop.functions[answerIndex - 2]) }
}
static void notify1() {
if (Monop.currentPlayer->money < 0) {
printf("That leaves you $%d in debt\n", - Monop.currentPlayer->money);
}
else {
if (Monop.currentPlayer->money == 0) {
printf("that leaves you broke\n");
}
else {
if (Monop.fixing &&!Monop.moneyStatusGiven && Monop.currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
Monop.moneyStatusGiven = true;
}
}
}
}
static void nextPlayer() {
Monop.currentPlayerNumber =++Monop.currentPlayerNumber % Monop.numberOfPlayers;
Monop.currentPlayer = & Monop.players[Monop.currentPlayerNumber];
Monop.numberOfDoubles = 0;
}
static int getInteger(char * prompt) {
int num;
char * sp;
char[257] buf1;
while (true) {
while (true) {
printf(prompt);
num = 0;
for (sp = buf1;( * sp = getchar()) != '\n';sp++) {
if ( * sp == - 1) {
continue;
}
}
break;
}
if (sp == buf1) {
continue;
}
for (sp = buf1;isspace( * sp);sp++) {
continue;
}
for (;isdigit( * sp);sp++) {
num *= 10 + * sp - '0';
}
if ( * sp == '\n') {
return num;
}
else {
printf("I can't understand that\n");
}
}
}
static void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList4;
OwnedPropertyList * original_ownedPropertyList;
propertyList4 = Monop.players[playerIndex].ownedPropertyList;
while (propertyList4) {
switch (propertyList4->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_UTIL;propertyList4 = propertyList4->next) {
num++;
}
Monop.players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_RAILROAD;propertyList4 = propertyList4->next) {
num++;
}
Monop.players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList4->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList4;
num = 0;
while (propertyList4 && propertyList4->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList4 = propertyList4->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
Print.printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("orig_op->next = %d\n", propertyList4->next);
printf("orig_op->sqr->desc = %d\n", propertyList4->square1->description);
printf("op = %d\n", propertyList4);
printf("op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("op->next = %d\n", propertyList4->next);
printf("op->sqr->desc = %d\n", propertyList4->square1->description);
printf("num = %d\n", num);
}
if (num == originalMonopoly->housesInMonopoly) {
isMonopoly(originalMonopoly, playerIndex);
}
else {
isNotMonopoly(originalMonopoly);
}
break;
}
}
}
void isMonopoly(Monopoly * monopoly, int playerIndex) {
char * sp;
int i;
monopoly->owner = playerIndex;
monopoly->numberOfOwners = monopoly->housesInMonopoly;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = true;
}
monopoly->name = monopoly->uppercaseColor;
}
static void isNotMonopoly(Monopoly * monopoly) {
char * sp;
int i;
monopoly->owner = - 1;
for (i = 0;i < monopoly->housesInMonopoly;i++) {
monopoly->squares[i]->description->isMonopoly = false;
}
monopoly->name = monopoly->lowercaseColor;
}
public static void printHoldings() {
Print.printHoldings(Monop.currentPlayerNumber);
}
public static void promptAndPrintHoldings() {
int playerIndex;
while ((playerIndex = GetInput.getinp("Whose holdings do you want to see? ", Monop.playerNames)) < Monop.numberOfPlayers) {
Print.printHoldings(playerIndex);
}
}
void sigquit(int sig) {
quit_confirm();
signal(SIGINT, sigquit);
}
public static void quit_confirm() {
putchar('\n');
if (getYesOrNo("Do you all really want to quit? ") == 0) {
exit(0);
}
}
| static char[] sccsid = "@(#)misc.c 5.6 (Berkeley) 3/25/93";
static int getYesOrNo(char * prompt) {
int answerIndex;
while (true) {
answerIndex = GetInput.getinp(prompt, Monop.yesNoChoices);
if (answerIndex < 2) {
return answerIndex;
}
}
return else {
Invoker.invoke(Monop.functions[answerIndex - 2]) }
}
static void notify1() {
if (Monop.currentPlayer->money < 0) {
printf("That leaves you $%d in debt\n", - Monop.currentPlayer->money);
}
else {
if (Monop.currentPlayer->money == 0) {
printf("that leaves you broke\n");
}
else {
if (Monop.fixing &&!Monop.moneyStatusGiven && Monop.currentPlayer->money > 0) {
printf("-- You are now Solvent ---\n");
Monop.moneyStatusGiven = true;
}
}
}
}
static void nextPlayer() {
Monop.currentPlayerNumber =++Monop.currentPlayerNumber % Monop.numberOfPlayers;
Monop.currentPlayer = & Monop.players[Monop.currentPlayerNumber];
Monop.numberOfDoubles = 0;
}
static int getInteger(char * prompt) {
int num;
char * sp;
char[257] buf1;
while (true) {
while (true) {
printf(prompt);
num = 0;
buf1 = stdin.readLine();
break;
}
if (sp == buf1) {
continue;
}
for (sp = buf1;isspace( * sp);sp++) {
continue;
}
for (;isdigit( * sp);sp++) {
num *= 10 + * sp - '0';
}
if ( * sp == '\n') {
return num;
}
else {
printf("I can't understand that\n");
}
}
}
static void initializeOwnerList(int playerIndex) {
int num;
Monopoly * originalMonopoly;
OwnedPropertyList * propertyList4;
OwnedPropertyList * original_ownedPropertyList;
propertyList4 = Monop.players[playerIndex].ownedPropertyList;
while (propertyList4) {
switch (propertyList4->square1->type) {
case TYPE_UTIL:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_UTIL;propertyList4 = propertyList4->next) {
num++;
}
Monop.players[playerIndex].utilitiesCount = num;
break;
case TYPE_RAILROAD:
for (num = 0;propertyList4 && propertyList4->square1->type == TYPE_RAILROAD;propertyList4 = propertyList4->next) {
num++;
}
Monop.players[playerIndex].railroadCardCount = num;
break;
case TYPE_PROPERTY:
originalMonopoly = propertyList4->square1->description->monopolyDescription;
original_ownedPropertyList = propertyList4;
num = 0;
while (propertyList4 && propertyList4->square1->description->monopolyDescription == originalMonopoly) {
num++;
propertyList4 = propertyList4->next;
}
if (originalMonopoly == 0) {
printf("panic: bad monopoly descriptor: orig = %d\n", originalMonopoly);
printf("player # %d\n", playerIndex + 1);
Print.printHoldings(playerIndex);
printf("orig_op = %d\n", original_ownedPropertyList);
printf("orig_op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("orig_op->next = %d\n", propertyList4->next);
printf("orig_op->sqr->desc = %d\n", propertyList4->square1->description);
printf("op = %d\n", propertyList4);
printf("op->sqr->type = %d (PRPTY)\n", propertyList4->square1->type);
printf("op->next = %d\n", propertyList4->next);
printf("op->sqr->desc = %d\n", propertyList4->square1->description);
printf("num = %d\n", num);
}
if (num == origin |