aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Vance <nathav63@gmail.com>2015-03-19 22:11:22 -0400
committerNathan Vance <nathav63@gmail.com>2015-03-19 22:11:22 -0400
commitad802570d327a7751296285bde645c2bbb2ccf1c (patch)
treee3686589e12b175433f5ae669b11a00dbae48825
parentui and trading bug fixes (diff)
download7w-ad802570d327a7751296285bde645c2bbb2ccf1c.tar.gz
7w-ad802570d327a7751296285bde645c2bbb2ccf1c.tar.bz2
7w-ad802570d327a7751296285bde645c2bbb2ccf1c.zip
started thinking about ai trading
-rw-r--r--ai_trade.c13
-rw-r--r--trade.c11
2 files changed, 24 insertions, 0 deletions
diff --git a/ai_trade.c b/ai_trade.c
new file mode 100644
index 0000000..e5aef1e
--- /dev/null
+++ b/ai_trade.c
@@ -0,0 +1,13 @@
+#include "7w.h"
+
+int data_getgold(int p);
+int get_trade(int player, int type, int direction);
+int data_canafford(int p, int era, int card);
+void trade_clear(int player);
+
+int ai_trade(int player, int *cost)
+{
+ while(data_getgold(player) > 1) {
+ //finish trade_set and this
+ }
+}
diff --git a/trade.c b/trade.c
index 002dcac..4299bb8 100644
--- a/trade.c
+++ b/trade.c
@@ -51,6 +51,17 @@ void trade_clear(int player)
tradebuffer[i][j] = 0;
}
+void trade_set(int player, int **trade)
+{
+ trade_clear(player);
+ int i, j;
+ for(i = 0; i < 3; i++) {
+ for(j = 0; j < GOLD; j++) {
+ tradebuffer[i][j] = trade[i][j];
+ }
+ }
+}
+
//gold amounts relative to player
void trade_addgold(int player, int amnt, int direction)
{
bgstack15