aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2016-02-07 17:56:45 -0500
committerNathan Vance <nathav63@gmail.com>2016-02-07 17:56:45 -0500
commit5ff076c4e040563be94726ba8104444713c8a546 (patch)
tree09fb2a7349804f1cd6f30c4b7846a7669c5022c9
parentUpdated to work with gcc 5.X (diff)
download7w-5ff076c4e040563be94726ba8104444713c8a546.tar.gz
7w-5ff076c4e040563be94726ba8104444713c8a546.tar.bz2
7w-5ff076c4e040563be94726ba8104444713c8a546.zip
Bug fixes dealing with colorHEADmaster
-rw-r--r--ai_trade.c9
-rw-r--r--cards.c5
-rw-r--r--color.c31
-rw-r--r--io.c14
4 files changed, 39 insertions, 20 deletions
diff --git a/ai_trade.c b/ai_trade.c
index d20d05d..b255988 100644
--- a/ai_trade.c
+++ b/ai_trade.c
@@ -2,13 +2,14 @@
/*
A brief note on why we have separated the functionality of trade.c and ai_trade.c in regards to gold transfer:
- This class is designed for the sole purpose of analyzing potential transactions without committing to any. Therefore, such handy methods as trade_commit are not used.
+ This class is designed for the sole purpose of analyzing potential transactions without committing to any.
+ Therefore, such handy methods as trade_commit are not used.
*/
static int bestCost[3];
static int baseCost[NUMRESOURCES];
-void ai_cleartrade(int trade[3][GOLD]) {
+void clearTrade(int trade[3][GOLD]) {
int i, j;
for (i = 0; i < 3; i++) {
bestCost[i] = 0;
@@ -87,11 +88,11 @@ int* ai_trade(int player, int era, int card, int ret[3]) {
int i;
for (i = 0; i < 3; i++)
ret[i] = 0;
- ai_cleartrade(trade);
+ clearTrade(trade);
cards_getcost(era, card, baseCost);
recurse(ret, 0, trade, player, era, card);
restoreCost(ret);
- ai_cleartrade(trade);
+ clearTrade(trade);
trade_set(player, trade);
return ret;
}
diff --git a/cards.c b/cards.c
index b7d86f1..8994156 100644
--- a/cards.c
+++ b/cards.c
@@ -537,7 +537,8 @@ void cards_init() {
cards_setcost(2, 25, WOOD, 2);
cards_setcost(2, 25, ORE, 2);
cards_setcost(2, 25, CLOTH, 1);
- cards_setmessage(2, 25, "Counts as either a compass, gear or tablet.");
+ cards_setmessage(2, 25,
+ "Counts as either a compass, gear or tablet.");
cards_setname(2, 25, "Scientists Guild", GUILD);
cards_setcost(2, 26, WOOD, 3);
@@ -650,7 +651,7 @@ void cards_init() {
cards_setcost(7, 6, ORE, 2);
cards_setcost(7, 6, CLOTH, 1);
cards_setmessage(7, 6,
- "Can copy one Guild card build by an adjacent player.");
+ "Can copy one Guild card built by an adjacent player.");
cards_setname(8, 0, "The Mausoleum of Halicarnassus", CLOTH);
cards_setcost(8, 1, CLAY, 2);
diff --git a/color.c b/color.c
index 1ddae81..94025ed 100644
--- a/color.c
+++ b/color.c
@@ -1,15 +1,22 @@
#include "7w.h"
-int gettypecolor(int type)
-{
- switch(type) {
- case RESOURCE: return COLORRESOURCE;
- case INDUSTRY: return COLORINDUSTRY;
- case STRUCTURE: return COLORSTRUCTURE;
- case COMMERCIAL: return COLORCOMMERCIAL;
- case MILITARY: return COLORMILITARY;
- case SCIENTIFIC: return COLORSCIENTIFIC;
- case GUILD: return COLORGUILD;
- default: return 0;
- }
+int gettypecolor(int type) {
+ switch (type) {
+ case RESOURCE:
+ return COLORRESOURCE;
+ case INDUSTRY:
+ return COLORINDUSTRY;
+ case STRUCTURE:
+ return COLORSTRUCTURE;
+ case COMMERCIAL:
+ return COLORCOMMERCIAL;
+ case MILITARY:
+ return COLORMILITARY;
+ case SCIENTIFIC:
+ return COLORSCIENTIFIC;
+ case GUILD:
+ return COLORGUILD;
+ default:
+ return 0;
+ }
}
diff --git a/io.c b/io.c
index 0f39881..e7d99ac 100644
--- a/io.c
+++ b/io.c
@@ -50,6 +50,14 @@ int io_getkey() {
}
}
+static void turn_off_attributes() {
+ int i;
+ for(i = 31; i <= 38; i++)
+ attroff(COLOR_PAIR(i));
+ attroff(A_BLINK);
+ attroff(A_REVERSE);
+}
+
void io_clearscreen() {
clear();
}
@@ -59,7 +67,8 @@ void io_printname(int x, int y, int era, int card) {
attron(COLOR_PAIR(gettypecolor(cards_gettype(era, card))));
char array[40];
printw("%-23s", cards_getname(era, card, array));
- attrset(A_NORMAL);
+ //attrset(A_NORMAL);
+ turn_off_attributes();
printw(" #");
}
@@ -227,5 +236,6 @@ void io_printplain(int x, int y, char *s) {
void io_printcolor(int x, int y, int color, char *s) {
attron(COLOR_PAIR(color));
io_printplain(x, y, s);
- attrset(A_NORMAL);
+ //attrset(A_NORMAL);
+ turn_off_attributes();
}
bgstack15