| Rules Applied | JavaKeywordRule | app0.txt | PPspaceRule | PPifndefRule | PPRule | PPdefineRule.DefineReplacementRule | MissingFunctionTypeRule | snippets0.txt | snippets0b.txt | TypedefRule.DefineReplacementRule | OneDeclarationPerLineRule | ConflictingFileAndVariableRule | SizeofRule | ArrayDeclaration0Rule | AddBracesRule | voidstarsnippet.txt | ConflictingVariableDeclarationRule | StaticVariablesRule | StaticFunctionsRule | pointercast.txt | CharToShortRule | ArrayDeclarationRule | StringRule | allocsnippet1.txt | MallocRule | ZeroComparisonRule | ZeroAssignmentRule | DeclarationAssignmentRule | PointerRule | ArrayIndexRule | ForceToBooleanRule | ForceToBoolean2Rule | snippets1.txt | snippets2.txt | snippets3.txt | ElseIfRule | PrintfRule | SprintfRule | StaticLocalVariablesRule | UninitializedVariableRule | InsertClassRule | (Final Version) | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| JavaKeywordRule app0.txt PPspaceRule PPifndefRule PPRule PPdefineRule.DefineReplacementRule MissingFunctionTypeRule snippets0.txt snippets0b.txt TypedefRule.DefineReplacementRule OneDeclarationPerLineRule ConflictingFileAndVariableRule SizeofRule ArrayDeclaration0Rule AddBracesRule voidstarsnippet.txt ConflictingVariableDeclarationRule StaticVariablesRule StaticFunctionsRule pointercast.txt CharToShortRule ArrayDeclarationRule StringRule allocsnippet1.txt MallocRule ZeroComparisonRule ZeroAssignmentRule DeclarationAssignmentRule PointerRule ArrayIndexRule ForceToBooleanRule ForceToBoolean2Rule snippets1.txt snippets2.txt snippets3.txt ElseIfRule PrintfRule SprintfRule StaticLocalVariablesRule UninitializedVariableRule InsertClassRule final | #ifndef lint
static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
#endif
# include "monop.ext"
void buy(register int player, register SQUARE * sqrp) {
trading = FALSE;
sqrp->owner = player;
add_list(player, & (play[player].own_list) , cur_p->loc);
}
void add_list(int plr, OWN * * head, int op_sqr) {
regint val;
reg OWN * tp,
* last_tp;
MON * mp;
OWN * op;
op = (OWN * ) calloc(1, sizeof (OWN));
op->sqr = & board[op_sqr];
val = value(op->sqr);
last_tp = NULL;
for (tp = * head;tp && value(tp->sqr) < val;tp = tp->next) if (val == value(tp->sqr)) {
cfree(op);
return;
}
else last_tp = tp;
op->next = tp;
if (last_tp != NULL) last_tp->next = op;
else * head = op;
if (!trading) set_ownlist(plr);
}
void del_list(int plr, OWN * * head, char op_sqr) {
regint i;
reg OWN * op,
* last_op;
switch (board[op_sqr].type) {
case PRPTY:
board[op_sqr].desc->mon_desc->num_own--;
break;
case RR:
play[plr].num_rr--;
break;
case UTIL:
play[plr].num_util--;
break;
}
last_op = NULL;
for (op = * head;op;op = op->next) if (op->sqr == & board[op_sqr]) break;
else last_op = op;
if (last_op == NULL) * head = op->next;
else {
last_op->next = op->next;
cfree(op);
}
}
value(register SQUARE * sqp) {
regint sqr;
sqr = sqnum(sqp);
switch (sqp->type) {
case SAFE:
return 0;
default :
return 1;
case UTIL:
if (sqr == 12) return 2;
else return 3;
case RR:
return 4 + sqr / 10;
case PRPTY:
return 8 + (sqp->desc) - prop;
}
}
void bid(void) {
static bool in[MAX_PL];
regint i,
num_in,
cur_max;
char buf[80];
int cur_bid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < num_play;i++) in[i] = TRUE;
i = - 1;
cur_max = 0;
num_in = num_play;
while (num_in > 1 || (cur_max == 0 && num_in > 0)) {
i =++i % num_play;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", name_list[i]);
cur_bid = get_int(buf);
if (cur_bid == 0) {
in[i] = FALSE;
if (--num_in == 0) break;
}
else if (cur_bid <= cur_max) {
printf("You must bid higher than %d to stay in\n", cur_max);
printf("(bid of 0 drops you out)\n");
}
}
while (cur_bid != 0 && cur_bid <= cur_max);
cur_max = (cur_bid ? cur_bid:cur_max);
}
}
if (cur_max != 0) {
while (!in[i]) i =++i % num_play;
printf("It goes to %s (%d) for $%d\n", play[i].name, i + 1, cur_max);
buy(i, & board[cur_p->loc]);
play[i].money -= cur_max;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
prop_worth(register PLAY * plp) {
reg OWN * op;
regint worth;
worth = 0;
for (op = plp->own_list;op;op = op->next) {
if (op->sqr->type == PRPTY && op->sqr->desc->monop) worth += op->sqr->desc->mon_desc->h_cost * 50 * op->sqr->desc->houses;
worth += op->sqr->cost;
}
return worth;
}
| #ifndef lint
static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
#endif
# include "monop.ext"
void buy(register int currentPlayerNumber, register SQUARE * square) {
trading = FALSE;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OWN * * head, int op_sqr) {
regint val;
reg OWN * tempProperty,
* lastTempProperty;
MON * monopoly;
OWN * propertyList;
propertyList = (OWN * ) calloc(1, sizeof (OWN));
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = NULL;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != NULL) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OWN * * head, char op_sqr) {
regint i;
reg OWN * propertyList,
* last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = NULL;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == NULL) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
sortValue(register SQUARE * square) {
regint square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static bool in[MAX_PLAYERS];
regint i,
housesInMonopoly,
currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = TRUE;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = FALSE;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
getPropertyWorth(register PLAY * player) {
reg OWN * propertyList;
regint worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| #ifndef lint
static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
#endif
#include "monop.ext"
void buy(register int currentPlayerNumber, register SQUARE * square) {
trading = FALSE;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OWN * * head, int op_sqr) {
regint val;
reg OWN * tempProperty,
* lastTempProperty;
MON * monopoly;
OWN * propertyList;
propertyList = (OWN * ) calloc(1, sizeof (OWN));
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = NULL;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != NULL) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OWN * * head, char op_sqr) {
regint i;
reg OWN * propertyList,
* last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = NULL;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == NULL) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
sortValue(register SQUARE * square) {
regint square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static bool in[MAX_PLAYERS];
regint i,
housesInMonopoly,
currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = TRUE;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = FALSE;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
getPropertyWorth(register PLAY * player) {
reg OWN * propertyList;
regint worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| #if !defined(lint)
static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
#endif
#include "monop.ext"
void buy(register int currentPlayerNumber, register SQUARE * square) {
trading = FALSE;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OWN * * head, int op_sqr) {
regint val;
reg OWN * tempProperty,
* lastTempProperty;
MON * monopoly;
OWN * propertyList;
propertyList = (OWN * ) calloc(1, sizeof (OWN));
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = NULL;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != NULL) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OWN * * head, char op_sqr) {
regint i;
reg OWN * propertyList,
* last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = NULL;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == NULL) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
sortValue(register SQUARE * square) {
regint square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static bool in[MAX_PLAYERS];
regint i,
housesInMonopoly,
currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = TRUE;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = FALSE;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
getPropertyWorth(register PLAY * player) {
reg OWN * propertyList;
regint worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(register int currentPlayerNumber, register SQUARE * square) {
trading = FALSE;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OWN * * head, int op_sqr) {
regint val;
reg OWN * tempProperty,
* lastTempProperty;
MON * monopoly;
OWN * propertyList;
propertyList = (OWN * ) calloc(1, sizeof (OWN));
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = NULL;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != NULL) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OWN * * head, char op_sqr) {
regint i;
reg OWN * propertyList,
* last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = NULL;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == NULL) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
sortValue(register SQUARE * square) {
regint square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static bool in[MAX_PLAYERS];
regint i,
housesInMonopoly,
currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = TRUE;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = FALSE;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
getPropertyWorth(register PLAY * player) {
reg OWN * propertyList;
regint worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(register int currentPlayerNumber, register SQUARE * square) {
trading = false;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OWN * * head, int op_sqr) {
register int val;
register OWN * tempProperty,
* lastTempProperty;
MON * monopoly;
OWN * propertyList;
propertyList = (OWN * ) calloc(1, sizeof (OWN));
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = NULL;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != NULL) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OWN * * head, char op_sqr) {
register int i;
register OWN * propertyList,
* last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = NULL;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == NULL) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
sortValue(register SQUARE * square) {
register int square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static boolean in[MAX_PLAYERS];
register int i,
housesInMonopoly,
currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = true;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
getPropertyWorth(register PLAY * player) {
register OWN * propertyList;
register int worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(register int currentPlayerNumber, register SQUARE * square) {
trading = false;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OWN * * head, int op_sqr) {
register int val;
register OWN * tempProperty,
* lastTempProperty;
MON * monopoly;
OWN * propertyList;
propertyList = (OWN * ) calloc(1, sizeof (OWN));
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = NULL;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != NULL) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OWN * * head, char op_sqr) {
register int i;
register OWN * propertyList,
* last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = NULL;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == NULL) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
int sortValue(register SQUARE * square) {
register int square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static boolean in[MAX_PLAYERS];
register int i,
housesInMonopoly,
currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = true;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
int getPropertyWorth(register PLAY * player) {
register OWN * propertyList;
register int worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(register int currentPlayerNumber, register SQUARE * square) {
trading = false;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OWN * * head, int op_sqr) {
register int val;
register OWN * tempProperty,
* lastTempProperty;
MON * monopoly;
OWN * propertyList;
propertyList = (OWN * ) calloc(1, sizeof (OWN));
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != 0) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OWN * * head, char op_sqr) {
register int i;
register OWN * propertyList,
* last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == 0) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
int sortValue(register SQUARE * square) {
register int square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static boolean in[MAX_PLAYERS];
register int i,
housesInMonopoly,
currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = true;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
int getPropertyWorth(register PLAY * player) {
register OWN * propertyList;
register int worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(int currentPlayerNumber, SQUARE * square) {
trading = false;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OWN * * head, int op_sqr) {
int val;
OWN * tempProperty,
* lastTempProperty;
MON * monopoly;
OWN * propertyList;
propertyList = (OWN * ) calloc(1, sizeof (OWN));
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != 0) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OWN * * head, char op_sqr) {
int i;
OWN * propertyList,
* last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == 0) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
int sortValue(SQUARE * square) {
int square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static boolean in[MAX_PLAYERS];
int i,
housesInMonopoly,
currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = true;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
int getPropertyWorth(PLAY * player) {
OWN * propertyList;
int worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(int currentPlayerNumber, Square * square) {
trading = false;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty,
* lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList;
propertyList = (OwnedPropertyList * ) calloc(1, sizeof (OwnedPropertyList));
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != 0) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OwnedPropertyList * * head, char op_sqr) {
int i;
OwnedPropertyList * propertyList,
* last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == 0) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
int sortValue(Square * square) {
int square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static boolean in[MAX_PLAYERS];
int i,
housesInMonopoly,
currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = true;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList;
int worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(int currentPlayerNumber, Square * square) {
trading = false;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList;
propertyList = (OwnedPropertyList * ) calloc(1, sizeof (OwnedPropertyList));
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != 0) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OwnedPropertyList * * head, char op_sqr) {
int i;
OwnedPropertyList * propertyList;
OwnedPropertyList * last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == 0) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
int sortValue(Square * square) {
int square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static boolean in[MAX_PLAYERS];
int i;
int housesInMonopoly;
int currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = true;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList;
int worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(int currentPlayerNumber, Square * square) {
trading = false;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList;
propertyList = (ownedPropertyList * ) calloc(1, sizeof (ownedPropertyList));
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != 0) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OwnedPropertyList * * head, char op_sqr) {
int i;
OwnedPropertyList * propertyList;
OwnedPropertyList * last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == 0) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
int sortValue(Square * square) {
int square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static boolean in[MAX_PLAYERS];
int i;
int housesInMonopoly;
int currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = true;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList;
int worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| static char sccsid[] = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(int currentPlayerNumber, Square * square) {
trading = false;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList;
propertyList = (ownedPropertyList * ) calloc(1, sizeof ());
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != 0) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OwnedPropertyList * * head, char op_sqr) {
int i;
OwnedPropertyList * propertyList;
OwnedPropertyList * last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == 0) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
int sortValue(Square * square) {
int square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static boolean in[MAX_PLAYERS];
int i;
int housesInMonopoly;
int currentMax;
char buf[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = true;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList;
int worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| static char[] sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(int currentPlayerNumber, Square * square) {
trading = false;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList;
propertyList = (ownedPropertyList * ) calloc(1, sizeof ());
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else lastTempProperty = tempProperty;
propertyList->next = tempProperty;
if (lastTempProperty != 0) lastTempProperty->next = propertyList;
else * head = propertyList;
if (!trading) initializeOwnerList(player);
}
void deleteFromPropertyList(int player, OwnedPropertyList * * head, char op_sqr) {
int i;
OwnedPropertyList * propertyList;
OwnedPropertyList * last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList = * head;propertyList;propertyList = propertyList->next) if (propertyList->square1 == & board[op_sqr]) break;
else last_op = propertyList;
if (last_op == 0) * head = propertyList->next;
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
int sortValue(Square * square) {
int square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) return 2;
else return 3;
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static boolean[MAX_PLAYERS] in;
int i;
int housesInMonopoly;
int currentMax;
char[80] buf;
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) in[i] = true;
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly == 0) break;
}
else if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) i =++i % numberOfPlayers;
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else printf("Nobody seems to want it, so we'll leave it for later\n");
}
int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList;
int worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
worth += propertyList->square1->cost;
}
return worth;
}
| static char[] sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(int currentPlayerNumber, Square * square) {
trading = false;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList;
propertyList = (ownedPropertyList * ) calloc(1, sizeof ());
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList->next = tempProperty;
if (lastTempProperty != 0) {
lastTempProperty->next = propertyList;
}
else {
* head = propertyList;
}
if (!trading) {
initializeOwnerList(player);
}
}
void deleteFromPropertyList(int player, OwnedPropertyList * * head, char op_sqr) {
int i;
OwnedPropertyList * propertyList;
OwnedPropertyList * last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList = * head;propertyList;propertyList = propertyList->next) {
if (propertyList->square1 == & board[op_sqr]) {
break;
}
else {
last_op = propertyList;
}
}
if (last_op == 0) {
* head = propertyList->next;
}
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
int sortValue(Square * square) {
int square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid(void) {
static boolean[MAX_PLAYERS] in;
int i;
int housesInMonopoly;
int currentMax;
char[80] buf;
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
(void) sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList;
int worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) {
worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
}
worth += propertyList->square1->cost;
}
return worth;
}
| static char[] sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(int currentPlayerNumber, Square * square) {
trading = false;
square->owner = currentPlayerNumber;
addToPropertyList(currentPlayerNumber, & (players[currentPlayerNumber].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList;
propertyList = (ownedPropertyList * ) calloc(1, sizeof ());
propertyList->square1 = & board[op_sqr];
val = sortValue(propertyList->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList->next = tempProperty;
if (lastTempProperty != 0) {
lastTempProperty->next = propertyList;
}
else {
* head = propertyList;
}
if (!trading) {
initializeOwnerList(player);
}
}
void deleteFromPropertyList(int player, OwnedPropertyList * * head, char op_sqr) {
int i;
OwnedPropertyList * propertyList;
OwnedPropertyList * last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList = * head;propertyList;propertyList = propertyList->next) {
if (propertyList->square1 == & board[op_sqr]) {
break;
}
else {
last_op = propertyList;
}
}
if (last_op == 0) {
* head = propertyList->next;
}
else {
last_op->next = propertyList->next;
cfree(propertyList);
}
}
int sortValue(Square * square) {
int square1;
square1 = getSquareIndex(square);
switch (square->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square1 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square1 / 10;
case TYPE_PROPERTY:
return 8 + (square->description) - properties;
}
}
void bid() {
static boolean[MAX_PLAYERS] in;
int i;
int housesInMonopoly;
int currentMax;
char[80] buf;
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly = numberOfPlayers;
while (housesInMonopoly > 1 || (currentMax == 0 && housesInMonopoly > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
sprintf(buf, "%s: ", playerNames[i]);
currentBid = getInteger(buf);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList;
int worth;
worth = 0;
for (propertyList = player->ownedPropertyList;propertyList;propertyList = propertyList->next) {
if (propertyList->square1->type == TYPE_PROPERTY && propertyList->square1->description->isMonopoly) {
worth += propertyList->square1->description->monopolyDescription->houseCost * 50 * propertyList->square1->description->houseCount;
}
worth += propertyList->square1->cost;
}
return worth;
}
| static char[] sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(int currentPlayerNumber1, Square * square5) {
trading = false;
square5->owner = currentPlayerNumber1;
addToPropertyList(currentPlayerNumber1, & (players[currentPlayerNumber1].ownedPropertyList) , currentPlayer->location);
}
void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList8;
propertyList8 = (ownedPropertyList * ) calloc(1, sizeof ());
propertyList8->square1 = & board[op_sqr];
val = sortValue(propertyList8->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList8);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList8->next = tempProperty;
if (lastTempProperty != 0) {
lastTempProperty->next = propertyList8;
}
else {
* head = propertyList8;
}
if (!trading) {
initializeOwnerList(player);
}
}
void deleteFromPropertyList(int player, OwnedPropertyList * * head, char op_sqr) {
int i;
OwnedPropertyList * propertyList9;
OwnedPropertyList * last_op;
switch (board[op_sqr].type) {
case TYPE_PROPERTY:
board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
players[player].railroadCardCount--;
break;
case TYPE_UTIL:
players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList9 = * head;propertyList9;propertyList9 = propertyList9->next) {
if (propertyList9->square1 == & board[op_sqr]) {
break;
}
else {
last_op = propertyList9;
}
}
if (last_op == 0) {
* head = propertyList9->next;
}
else {
last_op->next = propertyList9->next;
cfree(propertyList9);
}
}
int sortValue(Square * square6) {
int square11;
square11 = getSquareIndex(square6);
switch (square6->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square11 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square11 / 10;
case TYPE_PROPERTY:
return 8 + (square6->description) - properties;
}
}
void bid() {
static boolean[MAX_PLAYERS] in;
int i;
int housesInMonopoly1;
int currentMax;
char[80] buf3;
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly1 = numberOfPlayers;
while (housesInMonopoly1 > 1 || (currentMax == 0 && housesInMonopoly1 > 0)) {
i =++i % numberOfPlayers;
if (in[i]) {
do {
sprintf(buf3, "%s: ", playerNames[i]);
currentBid = getInteger(buf3);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly1 == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", players[i].name, i + 1, currentMax);
buy(i, & board[currentPlayer->location]);
players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList10;
int worth;
worth = 0;
for (propertyList10 = player->ownedPropertyList;propertyList10;propertyList10 = propertyList10->next) {
if (propertyList10->square1->type == TYPE_PROPERTY && propertyList10->square1->description->isMonopoly) {
worth += propertyList10->square1->description->monopolyDescription->houseCost * 50 * propertyList10->square1->description->houseCount;
}
worth += propertyList10->square1->cost;
}
return worth;
}
| static char[] sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
void buy(int currentPlayerNumber1, Square * square5) {
Monop.trading = false;
square5->owner = currentPlayerNumber1;
addToPropertyList(currentPlayerNumber1, & (Monop.players[currentPlayerNumber1].ownedPropertyList) , Monop.currentPlayer->location);
}
void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList8;
propertyList8 = (Player.ownedPropertyList * ) calloc(1, sizeof ());
propertyList8->square1 = & Monop.board[op_sqr];
val = sortValue(propertyList8->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList8);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList8->next = tempProperty;
if (lastTempProperty != 0) {
lastTempProperty->next = propertyList8;
}
else {
* head = propertyList8;
}
if (!Monop.trading) {
initializeOwnerList(player);
}
}
void deleteFromPropertyList(int player, OwnedPropertyList * * head, char op_sqr) {
int i;
OwnedPropertyList * propertyList9;
OwnedPropertyList * last_op;
switch (Monop.board[op_sqr].type) {
case TYPE_PROPERTY:
Monop.board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
Monop.players[player].railroadCardCount--;
break;
case TYPE_UTIL:
Monop.players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList9 = * head;propertyList9;propertyList9 = propertyList9->next) {
if (propertyList9->square1 == & Monop.board[op_sqr]) {
break;
}
else {
last_op = propertyList9;
}
}
if (last_op == 0) {
* head = propertyList9->next;
}
else {
last_op->next = propertyList9->next;
cfree(propertyList9);
}
}
int sortValue(Square * square6) {
int square11;
square11 = getSquareIndex(square6);
switch (square6->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square11 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square11 / 10;
case TYPE_PROPERTY:
return 8 + (square6->description) - Monop.properties;
}
}
void bid() {
static boolean[MAX_PLAYERS] in;
int i;
int housesInMonopoly1;
int currentMax;
char[80] buf3;
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < Monop.numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly1 = Monop.numberOfPlayers;
while (housesInMonopoly1 > 1 || (currentMax == 0 && housesInMonopoly1 > 0)) {
i =++i % Monop.numberOfPlayers;
if (in[i]) {
do {
sprintf(buf3, "%s: ", Monop.playerNames[i]);
currentBid = getInteger(buf3);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly1 == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % Monop.numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", Monop.players[i].name, i + 1, currentMax);
buy(i, & Monop.board[Monop.currentPlayer->location]);
Monop.players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList10;
int worth;
worth = 0;
for (propertyList10 = player->ownedPropertyList;propertyList10;propertyList10 = propertyList10->next) {
if (propertyList10->square1->type == TYPE_PROPERTY && propertyList10->square1->description->isMonopoly) {
worth += propertyList10->square1->description->monopolyDescription->houseCost * 50 * propertyList10->square1->description->houseCount;
}
worth += propertyList10->square1->cost;
}
return worth;
}
| static char[] sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
static void buy(int currentPlayerNumber1, Square * square5) {
Monop.trading = false;
square5->owner = currentPlayerNumber1;
addToPropertyList(currentPlayerNumber1, & (Monop.players[currentPlayerNumber1].ownedPropertyList) , Monop.currentPlayer->location);
}
static void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList8;
propertyList8 = (Player.ownedPropertyList * ) calloc(1, sizeof ());
propertyList8->square1 = & Monop.board[op_sqr];
val = sortValue(propertyList8->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList8);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList8->next = tempProperty;
if (lastTempProperty != 0) {
lastTempProperty->next = propertyList8;
}
else {
* head = propertyList8;
}
if (!Monop.trading) {
Misc.initializeOwnerList(player);
}
}
static void deleteFromPropertyList(int player, OwnedPropertyList * * head, char op_sqr) {
int i;
OwnedPropertyList * propertyList9;
OwnedPropertyList * last_op;
switch (Monop.board[op_sqr].type) {
case TYPE_PROPERTY:
Monop.board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
Monop.players[player].railroadCardCount--;
break;
case TYPE_UTIL:
Monop.players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList9 = * head;propertyList9;propertyList9 = propertyList9->next) {
if (propertyList9->square1 == & Monop.board[op_sqr]) {
break;
}
else {
last_op = propertyList9;
}
}
if (last_op == 0) {
* head = propertyList9->next;
}
else {
last_op->next = propertyList9->next;
cfree(propertyList9);
}
}
int sortValue(Square * square6) {
int square11;
square11 = getSquareIndex(square6);
switch (square6->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square11 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square11 / 10;
case TYPE_PROPERTY:
return 8 + (square6->description) - Monop.properties;
}
}
static void bid() {
static boolean[MAX_PLAYERS] in;
int i;
int housesInMonopoly1;
int currentMax;
char[80] buf3;
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < Monop.numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly1 = Monop.numberOfPlayers;
while (housesInMonopoly1 > 1 || (currentMax == 0 && housesInMonopoly1 > 0)) {
i =++i % Monop.numberOfPlayers;
if (in[i]) {
do {
sprintf(buf3, "%s: ", Monop.playerNames[i]);
currentBid = Misc.getInteger(buf3);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly1 == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % Monop.numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", Monop.players[i].name, i + 1, currentMax);
buy(i, & Monop.board[Monop.currentPlayer->location]);
Monop.players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
static int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList10;
int worth;
worth = 0;
for (propertyList10 = player->ownedPropertyList;propertyList10;propertyList10 = propertyList10->next) {
if (propertyList10->square1->type == TYPE_PROPERTY && propertyList10->square1->description->isMonopoly) {
worth += propertyList10->square1->description->monopolyDescription->houseCost * 50 * propertyList10->square1->description->houseCount;
}
worth += propertyList10->square1->cost;
}
return worth;
}
| static char[] sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
static void buy(int currentPlayerNumber1, Square * square5) {
Monop.trading = false;
square5->owner = currentPlayerNumber1;
addToPropertyList(currentPlayerNumber1, & (Monop.players[currentPlayerNumber1].ownedPropertyList) , Monop.currentPlayer->location);
}
static void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList8;
propertyList8 = (Player.ownedPropertyList) calloc(1, sizeof ());
propertyList8->square1 = & Monop.board[op_sqr];
val = sortValue(propertyList8->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList8);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList8->next = tempProperty;
if (lastTempProperty != 0) {
lastTempProperty->next = propertyList8;
}
else {
* head = propertyList8;
}
if (!Monop.trading) {
Misc.initializeOwnerList(player);
}
}
static void deleteFromPropertyList(int player, OwnedPropertyList * * head, char op_sqr) {
int i;
OwnedPropertyList * propertyList9;
OwnedPropertyList * last_op;
switch (Monop.board[op_sqr].type) {
case TYPE_PROPERTY:
Monop.board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
Monop.players[player].railroadCardCount--;
break;
case TYPE_UTIL:
Monop.players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList9 = * head;propertyList9;propertyList9 = propertyList9->next) {
if (propertyList9->square1 == & Monop.board[op_sqr]) {
break;
}
else {
last_op = propertyList9;
}
}
if (last_op == 0) {
* head = propertyList9->next;
}
else {
last_op->next = propertyList9->next;
cfree(propertyList9);
}
}
int sortValue(Square * square6) {
int square11;
square11 = getSquareIndex(square6);
switch (square6->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square11 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square11 / 10;
case TYPE_PROPERTY:
return 8 + (square6->description) - Monop.properties;
}
}
static void bid() {
static boolean[MAX_PLAYERS] in;
int i;
int housesInMonopoly1;
int currentMax;
char[80] buf3;
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < Monop.numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly1 = Monop.numberOfPlayers;
while (housesInMonopoly1 > 1 || (currentMax == 0 && housesInMonopoly1 > 0)) {
i =++i % Monop.numberOfPlayers;
if (in[i]) {
do {
sprintf(buf3, "%s: ", Monop.playerNames[i]);
currentBid = Misc.getInteger(buf3);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly1 == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % Monop.numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", Monop.players[i].name, i + 1, currentMax);
buy(i, & Monop.board[Monop.currentPlayer->location]);
Monop.players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
static int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList10;
int worth;
worth = 0;
for (propertyList10 = player->ownedPropertyList;propertyList10;propertyList10 = propertyList10->next) {
if (propertyList10->square1->type == TYPE_PROPERTY && propertyList10->square1->description->isMonopoly) {
worth += propertyList10->square1->description->monopolyDescription->houseCost * 50 * propertyList10->square1->description->houseCount;
}
worth += propertyList10->square1->cost;
}
return worth;
}
| static char[] sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
static void buy(int currentPlayerNumber1, Square * square5) {
Monop.trading = false;
square5->owner = currentPlayerNumber1;
addToPropertyList(currentPlayerNumber1, & (Monop.players[currentPlayerNumber1].ownedPropertyList) , Monop.currentPlayer->location);
}
static void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList8;
propertyList8 = (Player.ownedPropertyList) calloc(1, sizeof ());
propertyList8->square1 = & Monop.board[op_sqr];
val = sortValue(propertyList8->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList8);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList8->next = tempProperty;
if (lastTempProperty != 0) {
lastTempProperty->next = propertyList8;
}
else {
* head = propertyList8;
}
if (!Monop.trading) {
Misc.initializeOwnerList(player);
}
}
static void deleteFromPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int i;
OwnedPropertyList * propertyList9;
OwnedPropertyList * last_op;
switch (Monop.board[op_sqr].type) {
case TYPE_PROPERTY:
Monop.board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
Monop.players[player].railroadCardCount--;
break;
case TYPE_UTIL:
Monop.players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList9 = * head;propertyList9;propertyList9 = propertyList9->next) {
if (propertyList9->square1 == & Monop.board[op_sqr]) {
break;
}
else {
last_op = propertyList9;
}
}
if (last_op == 0) {
* head = propertyList9->next;
}
else {
last_op->next = propertyList9->next;
cfree(propertyList9);
}
}
int sortValue(Square * square6) {
int square11;
square11 = getSquareIndex(square6);
switch (square6->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square11 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square11 / 10;
case TYPE_PROPERTY:
return 8 + (square6->description) - Monop.properties;
}
}
static void bid() {
static boolean[MAX_PLAYERS] in;
int i;
int housesInMonopoly1;
int currentMax;
char[80] buf3;
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < Monop.numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly1 = Monop.numberOfPlayers;
while (housesInMonopoly1 > 1 || (currentMax == 0 && housesInMonopoly1 > 0)) {
i =++i % Monop.numberOfPlayers;
if (in[i]) {
do {
sprintf(buf3, "%s: ", Monop.playerNames[i]);
currentBid = Misc.getInteger(buf3);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly1 == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % Monop.numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", Monop.players[i].name, i + 1, currentMax);
buy(i, & Monop.board[Monop.currentPlayer->location]);
Monop.players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
static int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList10;
int worth;
worth = 0;
for (propertyList10 = player->ownedPropertyList;propertyList10;propertyList10 = propertyList10->next) {
if (propertyList10->square1->type == TYPE_PROPERTY && propertyList10->square1->description->isMonopoly) {
worth += propertyList10->square1->description->monopolyDescription->houseCost * 50 * propertyList10->square1->description->houseCount;
}
worth += propertyList10->square1->cost;
}
return worth;
}
| static char[] sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
static void buy(int currentPlayerNumber1, Square * square5) {
Monop.trading = false;
square5->owner = currentPlayerNumber1;
addToPropertyList(currentPlayerNumber1, & (Monop.players[currentPlayerNumber1].ownedPropertyList) , Monop.currentPlayer->location);
}
static void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList8;
propertyList8 = (Player.ownedPropertyList) calloc(1, sizeof ());
propertyList8->square1 = & Monop.board[op_sqr];
val = sortValue(propertyList8->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList8);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList8->next = tempProperty;
if (lastTempProperty != 0) {
lastTempProperty->next = propertyList8;
}
else {
* head = propertyList8;
}
if (!Monop.trading) {
Misc.initializeOwnerList(player);
}
}
static void deleteFromPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int i;
OwnedPropertyList * propertyList9;
OwnedPropertyList * last_op;
switch (Monop.board[op_sqr].type) {
case TYPE_PROPERTY:
Monop.board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
Monop.players[player].railroadCardCount--;
break;
case TYPE_UTIL:
Monop.players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList9 = * head;propertyList9;propertyList9 = propertyList9->next) {
if (propertyList9->square1 == & Monop.board[op_sqr]) {
break;
}
else {
last_op = propertyList9;
}
}
if (last_op == 0) {
* head = propertyList9->next;
}
else {
last_op->next = propertyList9->next;
cfree(propertyList9);
}
}
int sortValue(Square * square6) {
int square11;
square11 = getSquareIndex(square6);
switch (square6->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square11 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square11 / 10;
case TYPE_PROPERTY:
return 8 + (square6->description) - Monop.properties;
}
}
static void bid() {
static boolean[] in = new boolean[MAX_PLAYERS];
int i;
int housesInMonopoly1;
int currentMax;
char[] buf3 = new char[80];
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < Monop.numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly1 = Monop.numberOfPlayers;
while (housesInMonopoly1 > 1 || (currentMax == 0 && housesInMonopoly1 > 0)) {
i =++i % Monop.numberOfPlayers;
if (in[i]) {
do {
sprintf(buf3, "%s: ", Monop.playerNames[i]);
currentBid = Misc.getInteger(buf3);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly1 == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % Monop.numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", Monop.players[i].name, i + 1, currentMax);
buy(i, & Monop.board[Monop.currentPlayer->location]);
Monop.players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
static int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList10;
int worth;
worth = 0;
for (propertyList10 = player->ownedPropertyList;propertyList10;propertyList10 = propertyList10->next) {
if (propertyList10->square1->type == TYPE_PROPERTY && propertyList10->square1->description->isMonopoly) {
worth += propertyList10->square1->description->monopolyDescription->houseCost * 50 * propertyList10->square1->description->houseCount;
}
worth += propertyList10->square1->cost;
}
return worth;
}
| static String sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
static void buy(int currentPlayerNumber1, Square * square5) {
Monop.trading = false;
square5->owner = currentPlayerNumber1;
addToPropertyList(currentPlayerNumber1, & (Monop.players[currentPlayerNumber1].ownedPropertyList) , Monop.currentPlayer->location);
}
static void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList8;
propertyList8 = (Player.ownedPropertyList) calloc(1, sizeof ());
propertyList8->square1 = & Monop.board[op_sqr];
val = sortValue(propertyList8->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList8);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList8->next = tempProperty;
if (lastTempProperty != 0) {
lastTempProperty->next = propertyList8;
}
else {
* head = propertyList8;
}
if (!Monop.trading) {
Misc.initializeOwnerList(player);
}
}
static void deleteFromPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int i;
OwnedPropertyList * propertyList9;
OwnedPropertyList * last_op;
switch (Monop.board[op_sqr].type) {
case TYPE_PROPERTY:
Monop.board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
Monop.players[player].railroadCardCount--;
break;
case TYPE_UTIL:
Monop.players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList9 = * head;propertyList9;propertyList9 = propertyList9->next) {
if (propertyList9->square1 == & Monop.board[op_sqr]) {
break;
}
else {
last_op = propertyList9;
}
}
if (last_op == 0) {
* head = propertyList9->next;
}
else {
last_op->next = propertyList9->next;
cfree(propertyList9);
}
}
int sortValue(Square * square6) {
int square11;
square11 = getSquareIndex(square6);
switch (square6->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square11 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square11 / 10;
case TYPE_PROPERTY:
return 8 + (square6->description) - Monop.properties;
}
}
static void bid() {
static boolean[] in = new boolean[MAX_PLAYERS];
int i;
int housesInMonopoly1;
int currentMax;
String buf3 = new String();
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < Monop.numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly1 = Monop.numberOfPlayers;
while (housesInMonopoly1 > 1 || (currentMax == 0 && housesInMonopoly1 > 0)) {
i =++i % Monop.numberOfPlayers;
if (in[i]) {
do {
sprintf(buf3, "%s: ", Monop.playerNames[i]);
currentBid = Misc.getInteger(buf3);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly1 == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % Monop.numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", Monop.players[i].name, i + 1, currentMax);
buy(i, & Monop.board[Monop.currentPlayer->location]);
Monop.players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
static int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList10;
int worth;
worth = 0;
for (propertyList10 = player->ownedPropertyList;propertyList10;propertyList10 = propertyList10->next) {
if (propertyList10->square1->type == TYPE_PROPERTY && propertyList10->square1->description->isMonopoly) {
worth += propertyList10->square1->description->monopolyDescription->houseCost * 50 * propertyList10->square1->description->houseCount;
}
worth += propertyList10->square1->cost;
}
return worth;
}
| static String sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
static void buy(int currentPlayerNumber1, Square * square5) {
Monop.trading = false;
square5->owner = currentPlayerNumber1;
addToPropertyList(currentPlayerNumber1, & (Monop.players[currentPlayerNumber1].ownedPropertyList) , Monop.currentPlayer->location);
}
static void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList8;
propertyList8 = (Player.ownedPropertyList) malloc(sizeof ());
propertyList8->square1 = & Monop.board[op_sqr];
val = sortValue(propertyList8->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList8);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList8->next = tempProperty;
if (lastTempProperty != 0) {
lastTempProperty->next = propertyList8;
}
else {
* head = propertyList8;
}
if (!Monop.trading) {
Misc.initializeOwnerList(player);
}
}
static void deleteFromPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int i;
OwnedPropertyList * propertyList9;
OwnedPropertyList * last_op;
switch (Monop.board[op_sqr].type) {
case TYPE_PROPERTY:
Monop.board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
Monop.players[player].railroadCardCount--;
break;
case TYPE_UTIL:
Monop.players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList9 = * head;propertyList9;propertyList9 = propertyList9->next) {
if (propertyList9->square1 == & Monop.board[op_sqr]) {
break;
}
else {
last_op = propertyList9;
}
}
if (last_op == 0) {
* head = propertyList9->next;
}
else {
last_op->next = propertyList9->next;
cfree(propertyList9);
}
}
int sortValue(Square * square6) {
int square11;
square11 = getSquareIndex(square6);
switch (square6->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square11 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square11 / 10;
case TYPE_PROPERTY:
return 8 + (square6->description) - Monop.properties;
}
}
static void bid() {
static boolean[] in = new boolean[MAX_PLAYERS];
int i;
int housesInMonopoly1;
int currentMax;
String buf3 = new String();
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < Monop.numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly1 = Monop.numberOfPlayers;
while (housesInMonopoly1 > 1 || (currentMax == 0 && housesInMonopoly1 > 0)) {
i =++i % Monop.numberOfPlayers;
if (in[i]) {
do {
sprintf(buf3, "%s: ", Monop.playerNames[i]);
currentBid = Misc.getInteger(buf3);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly1 == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % Monop.numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", Monop.players[i].name, i + 1, currentMax);
buy(i, & Monop.board[Monop.currentPlayer->location]);
Monop.players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
static int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList10;
int worth;
worth = 0;
for (propertyList10 = player->ownedPropertyList;propertyList10;propertyList10 = propertyList10->next) {
if (propertyList10->square1->type == TYPE_PROPERTY && propertyList10->square1->description->isMonopoly) {
worth += propertyList10->square1->description->monopolyDescription->houseCost * 50 * propertyList10->square1->description->houseCount;
}
worth += propertyList10->square1->cost;
}
return worth;
}
| static String sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
static void buy(int currentPlayerNumber1, Square * square5) {
Monop.trading = false;
square5->owner = currentPlayerNumber1;
addToPropertyList(currentPlayerNumber1, & (Monop.players[currentPlayerNumber1].ownedPropertyList) , Monop.currentPlayer->location);
}
static void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList8;
propertyList8 = new OwnedPropertyList();
propertyList8->square1 = & Monop.board[op_sqr];
val = sortValue(propertyList8->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList8);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList8->next = tempProperty;
if (lastTempProperty != 0) {
lastTempProperty->next = propertyList8;
}
else {
* head = propertyList8;
}
if (!Monop.trading) {
Misc.initializeOwnerList(player);
}
}
static void deleteFromPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int i;
OwnedPropertyList * propertyList9;
OwnedPropertyList * last_op;
switch (Monop.board[op_sqr].type) {
case TYPE_PROPERTY:
Monop.board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
Monop.players[player].railroadCardCount--;
break;
case TYPE_UTIL:
Monop.players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList9 = * head;propertyList9;propertyList9 = propertyList9->next) {
if (propertyList9->square1 == & Monop.board[op_sqr]) {
break;
}
else {
last_op = propertyList9;
}
}
if (last_op == 0) {
* head = propertyList9->next;
}
else {
last_op->next = propertyList9->next;
cfree(propertyList9);
}
}
int sortValue(Square * square6) {
int square11;
square11 = getSquareIndex(square6);
switch (square6->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square11 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square11 / 10;
case TYPE_PROPERTY:
return 8 + (square6->description) - Monop.properties;
}
}
static void bid() {
static boolean[] in = new boolean[MAX_PLAYERS];
int i;
int housesInMonopoly1;
int currentMax;
String buf3 = new String();
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < Monop.numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly1 = Monop.numberOfPlayers;
while (housesInMonopoly1 > 1 || (currentMax == 0 && housesInMonopoly1 > 0)) {
i =++i % Monop.numberOfPlayers;
if (in[i]) {
do {
sprintf(buf3, "%s: ", Monop.playerNames[i]);
currentBid = Misc.getInteger(buf3);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly1 == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % Monop.numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", Monop.players[i].name, i + 1, currentMax);
buy(i, & Monop.board[Monop.currentPlayer->location]);
Monop.players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
static int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList10;
int worth;
worth = 0;
for (propertyList10 = player->ownedPropertyList;propertyList10;propertyList10 = propertyList10->next) {
if (propertyList10->square1->type == TYPE_PROPERTY && propertyList10->square1->description->isMonopoly) {
worth += propertyList10->square1->description->monopolyDescription->houseCost * 50 * propertyList10->square1->description->houseCount;
}
worth += propertyList10->square1->cost;
}
return worth;
}
| static String sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
static void buy(int currentPlayerNumber1, Square * square5) {
Monop.trading = false;
square5->owner = currentPlayerNumber1;
addToPropertyList(currentPlayerNumber1, & (Monop.players[currentPlayerNumber1].ownedPropertyList) , Monop.currentPlayer->location);
}
static void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList8;
propertyList8 = new OwnedPropertyList();
propertyList8->square1 = & Monop.board[op_sqr];
val = sortValue(propertyList8->square1);
lastTempProperty = 0;
for (tempProperty = * head;tempProperty && sortValue(tempProperty->square1) < val;tempProperty = tempProperty->next) {
if (val == sortValue(tempProperty->square1)) {
cfree(propertyList8);
return;
}
else {
lastTempProperty = tempProperty;
}
}
propertyList8->next = tempProperty;
if (lastTempProperty != null) {
lastTempProperty->next = propertyList8;
}
else {
* head = propertyList8;
}
if (!Monop.trading) {
Misc.initializeOwnerList(player);
}
}
static void deleteFromPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int i;
OwnedPropertyList * propertyList9;
OwnedPropertyList * last_op;
switch (Monop.board[op_sqr].type) {
case TYPE_PROPERTY:
Monop.board[op_sqr].description->monopolyDescription->numberOfOwners--;
break;
case TYPE_RAILROAD:
Monop.players[player].railroadCardCount--;
break;
case TYPE_UTIL:
Monop.players[player].utilitiesCount--;
break;
}
last_op = 0;
for (propertyList9 = * head;propertyList9;propertyList9 = propertyList9->next) {
if (propertyList9->square1 == & Monop.board[op_sqr]) {
break;
}
else {
last_op = propertyList9;
}
}
if (last_op == null) {
* head = propertyList9->next;
}
else {
last_op->next = propertyList9->next;
cfree(propertyList9);
}
}
int sortValue(Square * square6) {
int square11;
square11 = getSquareIndex(square6);
switch (square6->type) {
case TYPE_SAFE:
return 0;
default :
return 1;
case TYPE_UTIL:
if (square11 == 12) {
return 2;
}
else {
return 3;
}
case TYPE_RAILROAD:
return 4 + square11 / 10;
case TYPE_PROPERTY:
return 8 + (square6->description) - Monop.properties;
}
}
static void bid() {
static boolean[] in = new boolean[MAX_PLAYERS];
int i;
int housesInMonopoly1;
int currentMax;
String buf3 = new String();
int currentBid;
printf("\nSo it goes up for auction. Type your bid after your name\n");
for (i = 0;i < Monop.numberOfPlayers;i++) {
in[i] = true;
}
i = - 1;
currentMax = 0;
housesInMonopoly1 = Monop.numberOfPlayers;
while (housesInMonopoly1 > 1 || (currentMax == 0 && housesInMonopoly1 > 0)) {
i =++i % Monop.numberOfPlayers;
if (in[i]) {
do {
sprintf(buf3, "%s: ", Monop.playerNames[i]);
currentBid = Misc.getInteger(buf3);
if (currentBid == 0) {
in[i] = false;
if (--housesInMonopoly1 == 0) {
break;
}
}
else {
if (currentBid <= currentMax) {
printf("You must bid higher than %d to stay in\n", currentMax);
printf("(bid of 0 drops you out)\n");
}
}
}
while (currentBid != 0 && currentBid <= currentMax);
currentMax = (currentBid ? currentBid:currentMax);
}
}
if (currentMax != 0) {
while (!in[i]) {
i =++i % Monop.numberOfPlayers;
}
printf("It goes to %s (%d) for $%d\n", Monop.players[i].name, i + 1, currentMax);
buy(i, & Monop.board[Monop.currentPlayer->location]);
Monop.players[i].money -= currentMax;
}
else {
printf("Nobody seems to want it, so we'll leave it for later\n");
}
}
static int getPropertyWorth(Player * player) {
OwnedPropertyList * propertyList10;
int worth;
worth = 0;
for (propertyList10 = player->ownedPropertyList;propertyList10;propertyList10 = propertyList10->next) {
if (propertyList10->square1->type == TYPE_PROPERTY && propertyList10->square1->description->isMonopoly) {
worth += propertyList10->square1->description->monopolyDescription->houseCost * 50 * propertyList10->square1->description->houseCount;
}
worth += propertyList10->square1->cost;
}
return worth;
}
| static String sccsid = "@(#)prop.c 5.6 (Berkeley) 6/1/90";
static void buy(int currentPlayerNumber1, Square * square5) {
Monop.trading = false;
square5->owner = currentPlayerNumber1;
addToPropertyList(currentPlayerNumber1, & (Monop.players[currentPlayerNumber1].ownedPropertyList) , Monop.currentPlayer->location);
}
static void addToPropertyList(int player, OwnedPropertyList * * head, int op_sqr) {
int val;
OwnedPropertyList * tempProperty;
OwnedPropertyList * lastTempProperty;
Monopoly * monopoly;
OwnedPropertyList * propertyList8;
propertyList8 = new OwnedPropertyList();
propertyList8->square1 = & Monop.board[op_sqr];
val = sortValue(propertyList8->square1);
lastTempProperty = null;
for (tempProperty = * head;temp |