summarylogtreecommitdiffstats
path: root/patch.diff
blob: b50871d3a8299bc7ae4cfacee12e6f7885df9fcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
diff -r ebe03b0eb26e Makefile
--- a/Makefile	Sun Aug 30 13:36:36 2015 +0200
+++ b/Makefile	Sun Aug 30 13:53:48 2015 +0200
@@ -1,59 +1,75 @@
-BIN=megacorp
-CC=g++
-FLAGS=-W -Wall -pedantic -gstabs+ -O3
-RELEASEFLAGS=-O3 -s
-OBJS=slot.o tile.o bag.o player.o company.o board.o game.o ai.o tools.o
-
-all: $(BIN)
-
-$(BIN): $(OBJS) main.o ui.text.o
-	$(CC) $(FLAGS) -s $(OBJS) main.o ui.text.o -o $(BIN)
-
-train: $(OBJS) chromosome.o train.o ui.silent.o
-	$(CC) $(FLAGS) $(OBJS) chromosome.o train.o ui.silent.o -o train
-
-train.o: train.cpp chromosome.h game.h
-	$(CC) $(FLAGS) train.cpp -c
-
-chromosome.o: chromosome.cpp chromosome.h
-	$(CC) $(FLAGS) chromosome.cpp -c
-
-main.o: main.cpp game.h tools.h globals.h
-	$(CC) $(FLAGS) main.cpp -c
-
-game.o: game.cpp game.h globals.h board.h player.h company.h bag.h
-	$(CC) $(FLAGS) game.cpp -c
-	
-ai.o: ai.cpp game.h globals.h board.h player.h company.h bag.h
-	$(CC) $(FLAGS) ai.cpp -c
-
-company.o: company.cpp company.h globals.h
-	$(CC) $(FLAGS) company.cpp -c
-
-player.o: player.cpp player.h tile.h globals.h
-	$(CC) $(FLAGS) player.cpp -c
-
-board.o: board.cpp board.h slot.h tile.h globals.h player.h company.h
-	$(CC) $(FLAGS) board.cpp -c
-
-bag.o: bag.cpp bag.h tile.h globals.h
-	$(CC) $(FLAGS) bag.cpp -c
-
-tile.o: tile.cpp tile.h
-	$(CC) $(FLAGS) tile.cpp -c
-
-slot.o: slot.cpp slot.h company.h
-	$(CC) $(FLAGS) slot.cpp -c
-
-tools.o: tools.cpp tools.h
-	$(CC) $(FLAGS) tools.cpp -c
-	
-ui.text.o: ui.text.cpp game.h tools.h
-	$(CC) $(FLAGS) ui.text.cpp -c
-	
-ui.silent.o: ui.text.cpp game.h tools.h
-	$(CC) $(FLAGS) ui.silent.cpp -c
-
-clean:
-	rm *.o
-	rm *.exe
+BIN=megacorp
+CC=g++
+FLAGS=-W -Wall -pedantic -gstabs+ -O3
+RELEASEFLAGS=-O3 -s
+OBJS=slot.o tile.o bag.o player.o company.o board.o game.o ai.o tools.o
+RM=rm -f
+
+MKDIR=mkdir -p
+CP=cp -p
+
+.PHONY: all clean install install.train
+
+all: $(BIN)
+
+$(BIN): $(OBJS) main.o ui.text.o
+	$(CC) $(FLAGS) -s $(OBJS) main.o ui.text.o -o $(BIN)
+
+train: $(OBJS) chromosome.o train.o ui.silent.o
+	$(CC) $(FLAGS) $(OBJS) chromosome.o train.o ui.silent.o -o train
+
+train.o: train.cpp chromosome.h game.h
+	$(CC) $(FLAGS) train.cpp -c
+
+chromosome.o: chromosome.cpp chromosome.h
+	$(CC) $(FLAGS) chromosome.cpp -c
+
+main.o: main.cpp game.h tools.h globals.h
+	$(CC) $(FLAGS) main.cpp -c
+
+game.o: game.cpp game.h globals.h board.h player.h company.h bag.h
+	$(CC) $(FLAGS) game.cpp -c
+
+ai.o: ai.cpp game.h globals.h board.h player.h company.h bag.h
+	$(CC) $(FLAGS) ai.cpp -c
+
+company.o: company.cpp company.h globals.h
+	$(CC) $(FLAGS) company.cpp -c
+
+player.o: player.cpp player.h tile.h globals.h
+	$(CC) $(FLAGS) player.cpp -c
+
+board.o: board.cpp board.h slot.h tile.h globals.h player.h company.h
+	$(CC) $(FLAGS) board.cpp -c
+
+bag.o: bag.cpp bag.h tile.h globals.h
+	$(CC) $(FLAGS) bag.cpp -c
+
+tile.o: tile.cpp tile.h
+	$(CC) $(FLAGS) tile.cpp -c
+
+slot.o: slot.cpp slot.h company.h
+	$(CC) $(FLAGS) slot.cpp -c
+
+tools.o: tools.cpp tools.h
+	$(CC) $(FLAGS) tools.cpp -c
+
+ui.text.o: ui.text.cpp game.h tools.h
+	$(CC) $(FLAGS) ui.text.cpp -c
+
+ui.silent.o: ui.text.cpp game.h tools.h
+	$(CC) $(FLAGS) ui.silent.cpp -c
+
+clean:
+	$(RM) *.o
+	$(RM) train $(BIN)
+
+install: megacorp INSTRUCTIONS
+	$(MKDIR) $(DESTDIR)/usr/bin
+	$(CP) megacorp $(DESTDIR)/usr/bin/
+	$(MKDIR) $(DESTDIR)/usr/share/megacorp
+	$(CP) INSTRUCTIONS $(DESTDIR)/usr/share/megacorp/
+
+install.train: train
+	$(MKDIR) $(DESTDIR)/usr/bin
+	$(CP) train $(DESTDIR)/usr/bin/
diff -r ebe03b0eb26e tools.cpp
--- a/tools.cpp	Sun Aug 30 13:36:36 2015 +0200
+++ b/tools.cpp	Sun Aug 30 13:53:48 2015 +0200
@@ -18,6 +18,8 @@
  * Boston, MA  02111-1307  USA                                          *
  ************************************************************************/
 
+#include <stdlib.h>
+
 #include "tools.h"
 
 using namespace std;
diff -r ebe03b0eb26e ui.silent.cpp
--- a/ui.silent.cpp	Sun Aug 30 13:36:36 2015 +0200
+++ b/ui.silent.cpp	Sun Aug 30 13:53:48 2015 +0200
@@ -23,9 +23,8 @@
  *   Displays the board, players, and companies.  Optimized for at      *
  *   least 25 rows and 80 columns.                                      *
  ************************************************************************/
-void Game::printInfo( bool showTiles )
+void Game::printInfo( bool )
 {
-    showTiles = false;
 }
 
 /************************************************************************
@@ -49,9 +48,8 @@
  *   is true, the tiles that player 'turn' has in his/her hand is also  *
  *   displayed (if any of those tiles are on the row being printed)     *
  ************************************************************************/
-void Board::displayRow( unsigned int row, bool showTiles, Player *turn ) const
+void Board::displayRow( unsigned int, bool, Player * ) const
 {
-    row = 0; showTiles = false; turn = NULL;
 }
 
 void Game::displayMessages( )
@@ -65,9 +63,8 @@
     return options[0];
 }
 
-unsigned int getValidInteger( unsigned int min, unsigned int max, string prompt )
+unsigned int getValidInteger( unsigned int min, unsigned int, string )
 {
-	max = 0; prompt = "";
     return min;
 }
 
diff -r ebe03b0eb26e ui.text.cpp
--- a/ui.text.cpp	Sun Aug 30 13:36:36 2015 +0200
+++ b/ui.text.cpp	Sun Aug 30 13:53:48 2015 +0200
@@ -345,7 +345,7 @@
 	ifstream in;
     char str[80];
 
-    in.open( "./INSTRUCTIONS");
+    in.open( "/usr/share/megacorp/INSTRUCTIONS");
     if ( !in ) {
         cout << "Can't find instructions file.\n";
         cout << "Make sure the file INSTRUCTIONS is in the same"