Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 41713
Collapse All | Expand All

(-)xfreecell.orig/card.cpp (-1 / +1 lines)
Lines 119-125 Link Here
119
    int oldy = y();
119
    int oldy = y();
120
    int newx = dest_x;
120
    int newx = dest_x;
121
    int newy = dest_y;
121
    int newy = dest_y;
122
    int steps = max(abs(oldx - newx), abs(oldy - newy)) / Option::speedup();
122
    int steps = std::max(abs(oldx - newx), abs(oldy - newy)) / Option::speedup();
123
    float curx = (float) oldx;
123
    float curx = (float) oldx;
124
    float cury = (float) oldy;
124
    float cury = (float) oldy;
125
125
(-)xfreecell.orig/freecell.cpp (-2 / +2 lines)
Lines 64-70 Link Here
64
static GameNumberManager* gnManager; 
64
static GameNumberManager* gnManager; 
65
static const int PathLength = 256;
65
static const int PathLength = 256;
66
static char msNumbersPath[PathLength] = "\0";;
66
static char msNumbersPath[PathLength] = "\0";;
67
static const char defaultMSNumbersPath[] = "/usr/local/lib/xfreecell/MSNumbers";
67
static const char defaultMSNumbersPath[] = "/usr/share/xfreecell/MSNumbers";
68
68
69
// ##### Functions declarations #####
69
// ##### Functions declarations #####
70
static void adjustSubwindow(NSWindow*);
70
static void adjustSubwindow(NSWindow*);
Lines 603-609 Link Here
603
void readMSNumbersPath()
603
void readMSNumbersPath()
604
{
604
{
605
  char* home = getenv("HOME");
605
  char* home = getenv("HOME");
606
  string saveFile;
606
  std::string saveFile;
607
607
608
  if (home == NULL) {
608
  if (home == NULL) {
609
    fprintf(stderr, "Cannot get $HOME. Assuming I am at home directory now.\n");
609
    fprintf(stderr, "Cannot get $HOME. Assuming I am at home directory now.\n");
(-)xfreecell.orig/gnmanager.cpp (-3 / +3 lines)
Lines 16-22 Link Here
16
GameNumberManager::GameNumberManager()
16
GameNumberManager::GameNumberManager()
17
{
17
{
18
  char* home = getenv("HOME");
18
  char* home = getenv("HOME");
19
  string directory;
19
  std::string directory;
20
20
21
  if (home == NULL) {
21
  if (home == NULL) {
22
    fprintf(stderr, "Cannot get $HOME. Assuming I am at home directory now.\n");
22
    fprintf(stderr, "Cannot get $HOME. Assuming I am at home directory now.\n");
Lines 143-149 Link Here
143
  readFile(msLostGameFile, &msLostGames);
143
  readFile(msLostGameFile, &msLostGames);
144
}
144
}
145
145
146
void GameNumberManager::readFile(const string& file, hash_set<int>* hs)
146
void GameNumberManager::readFile(const std::string& file, hash_set<int>* hs)
147
{
147
{
148
  FILE* fp = fopen(file.c_str(), "r");
148
  FILE* fp = fopen(file.c_str(), "r");
149
  char line[lineLength];
149
  char line[lineLength];
Lines 169-175 Link Here
169
  writeFile(msLostGameFile, &msLostGames);
169
  writeFile(msLostGameFile, &msLostGames);
170
}
170
}
171
171
172
void GameNumberManager::writeFile(const string& file, hash_set<int>* hs)
172
void GameNumberManager::writeFile(const std::string& file, hash_set<int>* hs)
173
{
173
{
174
  FILE* fp = fopen(file.c_str(), "w+");
174
  FILE* fp = fopen(file.c_str(), "w+");
175
175
(-)xfreecell.orig/gnmanager.h (-4 / +10 lines)
Lines 2-8 Link Here
2
#define GNManager_H
2
#define GNManager_H
3
3
4
#include <string>
4
#include <string>
5
6
#if __GNUG__ < 3
5
#include <hash_set>
7
#include <hash_set>
8
#else
9
#include <ext/hash_set>
10
using __gnu_cxx::hash_set;
11
#endif
6
12
7
class GameNumberManager {
13
class GameNumberManager {
8
public:
14
public:
Lines 20-34 Link Here
20
  bool alreadyLost(int);
26
  bool alreadyLost(int);
21
27
22
  void readFiles();
28
  void readFiles();
23
  void readFile(const string&, hash_set<int>*);
29
  void readFile(const std::string&, hash_set<int>*);
24
  void writeFile(const string&, hash_set<int>*);
30
  void writeFile(const std::string&, hash_set<int>*);
25
31
26
  string lostGameFile, wonGameFile;
32
  std::string lostGameFile, wonGameFile;
27
  
33
  
28
  hash_set<int> wonGames;
34
  hash_set<int> wonGames;
29
  hash_set<int> lostGames;
35
  hash_set<int> lostGames;
30
36
31
  string msLostGameFile, msWonGameFile;
37
  std::string msLostGameFile, msWonGameFile;
32
38
33
  hash_set<int> msWonGames;
39
  hash_set<int> msWonGames;
34
  hash_set<int> msLostGames;
40
  hash_set<int> msLostGames;
(-)xfreecell.orig/makefile (-8 / +9 lines)
Lines 1-13 Link Here
1
OBJECTS=card.o freecell.o option.o stack.o subwindows.o undo.o util.o gnmanager.o random.o
1
OBJECTS=card.o freecell.o option.o stack.o subwindows.o undo.o util.o gnmanager.o random.o
2
CC=g++
2
CC=$(cxx)
3
CFLAGS=-g -Wall -DSHAPE -DBOGUSRANDOM
3
CFLAGS=$(cxxflags) -Wall -DSHAPE -DBOGUSRANDOM
4
LDFLAGS=$(ldflags)
4
LIBS=-lm -L. -lns -L/usr/X11R6/lib -lXext -lX11
5
LIBS=-lm -L. -lns -L/usr/X11R6/lib -lXext -lX11
5
STATICDIR=xfreecell-static
6
STATICDIR=xfreecell-static
6
DOCS=README CHANGES mshuffle.txt xfreecell.6
7
DOCS=README CHANGES mshuffle.txt xfreecell.6
7
LIBDIR=/usr/local/lib/xfreecell
8
LIBDIR=/usr/local/lib/xfreecell
8
9
9
all: $(OBJECTS) lib
10
all: $(OBJECTS) lib
10
	$(CC) -o xfreecell $(CFLAGS) $(OBJECTS) $(LIBS)
11
	$(CC) -o xfreecell $(LDFLAGS) $(OBJECTS) $(LIBS)
11
12
12
static: $(OBJECTS) lib
13
static: $(OBJECTS) lib
13
	$(CC) -o xfreecell -static $(CFLAGS) $(OBJECTS) $(LIBS)
14
	$(CC) -o xfreecell -static $(CFLAGS) $(OBJECTS) $(LIBS)
Lines 25-37 Link Here
25
26
26
clean:
27
clean:
27
	rm -f *~ *.o a.out xfreecell libns.a
28
	rm -f *~ *.o a.out xfreecell libns.a
28
	make -C widget clean
29
	$(MAKE) -C widget clean
29
30
30
lib:
31
lib:
31
	make -C widget lib
32
	$(MAKE) -C widget lib
32
33
33
install: all
34
install: all
34
	install xfreecell $(DESTDIR)/usr/local/bin
35
	install xfreecell $(DESTDIR)/usr/bin
35
	install xfreecell.6 $(DESTDIR)/usr/local/man/man6
36
	install xfreecell.6 $(DESTDIR)/usr/share/man/man6
36
#	install -d $(LIBDIR)
37
#	install -d $(LIBDIR)
37
#	install ms-compatible/MSNumbers $(DESTDIR)/usr/local/lib/xfreecell
38
#	install ms-compatible/MSNumbers $(DESTDIR)/usr/share/xfreecell
(-)xfreecell.orig/option.h (-1 / +1 lines)
Lines 22-28 Link Here
22
  void readPrefs();
22
  void readPrefs();
23
  void writePrefs();
23
  void writePrefs();
24
24
25
  string saveFile;
25
  std::string saveFile;
26
26
27
  static int _speedup;
27
  static int _speedup;
28
  static bool _queryWindow;
28
  static bool _queryWindow;
(-)xfreecell.orig/stack.h (-1 / +1 lines)
Lines 28-34 Link Here
28
  int _next_x, _next_y;
28
  int _next_x, _next_y;
29
29
30
private:
30
private:
31
  vector<Card*> _cards;
31
  std::vector<Card*> _cards;
32
};
32
};
33
33
34
class PlayStack : public Stack {
34
class PlayStack : public Stack {
(-)xfreecell.orig/subwindows.h (-1 / +1 lines)
Lines 76-82 Link Here
76
  int _undos;
76
  int _undos;
77
  int _totalScore;
77
  int _totalScore;
78
78
79
  string saveFile;
79
  std::string saveFile;
80
80
81
  bool exitPressed;
81
  bool exitPressed;
82
82
(-)xfreecell.orig/undo.cpp (-1 / +1 lines)
Lines 22-28 Link Here
22
  c->moveToStack(from, false, false);
22
  c->moveToStack(from, false, false);
23
}
23
}
24
24
25
stack<Move> moves;
25
std::stack<Move> moves;
26
26
27
void undoClearMoves()
27
void undoClearMoves()
28
{
28
{
(-)xfreecell.orig/widget/container.cpp (-5 / +5 lines)
Lines 61-78 Link Here
61
61
62
void NSContainer::remove(NSComponent* nsc)
62
void NSContainer::remove(NSComponent* nsc)
63
{
63
{
64
  vector<NSComponent*>::iterator iter;
64
  std::vector<NSComponent*>::iterator iter;
65
  for (iter = nscVec.begin(); iter != nscVec.end(); iter++) 
65
  for (iter = nscVec.begin(); iter != nscVec.end(); iter++) 
66
    if (*iter == nsc) nscVec.erase(iter);
66
    if (*iter == nsc) nscVec.erase(iter);
67
}
67
}
68
68
69
void NSContainer::hremove(NSComponent* nsc)
69
void NSContainer::hremove(NSComponent* nsc)
70
{
70
{
71
  vector<NSComponent*>::iterator iter;
71
  std::vector<NSComponent*>::iterator iter;
72
  for (iter = nscVec.begin(); iter != nscVec.end(); iter++) {
72
  for (iter = nscVec.begin(); iter != nscVec.end(); iter++) {
73
    if (*iter == nsc) {
73
    if (*iter == nsc) {
74
      int w = (*iter)->width() + _neighborGap;
74
      int w = (*iter)->width() + _neighborGap;
75
      vector<NSComponent*>::iterator iter2 = iter + 1;
75
      std::vector<NSComponent*>::iterator iter2 = iter + 1;
76
      if (nscVec.size() == 0) {
76
      if (nscVec.size() == 0) {
77
	_width = 0; _height = 0;
77
	_width = 0; _height = 0;
78
      } else {
78
      } else {
Lines 87-97 Link Here
87
87
88
void NSContainer::vremove(NSComponent* nsc)
88
void NSContainer::vremove(NSComponent* nsc)
89
{
89
{
90
  vector<NSComponent*>::iterator iter;
90
  std::vector<NSComponent*>::iterator iter;
91
  for (iter = nscVec.begin(); iter != nscVec.end(); iter++) {
91
  for (iter = nscVec.begin(); iter != nscVec.end(); iter++) {
92
    if (*iter == nsc) {
92
    if (*iter == nsc) {
93
      int h = (*iter)->height() + _neighborGap;
93
      int h = (*iter)->height() + _neighborGap;
94
      vector<NSComponent*>::iterator iter2 = iter + 1;
94
      std::vector<NSComponent*>::iterator iter2 = iter + 1;
95
      if (nscVec.size() == 0) {
95
      if (nscVec.size() == 0) {
96
	_width = 0; _height = 0;
96
	_width = 0; _height = 0;
97
      } else {
97
      } else {
(-)xfreecell.orig/widget/makefile (-2 / +2 lines)
Lines 1-7 Link Here
1
OBJECTS=window.o plate.o string.o button.o label.o textfield.o container.o frame.o util.o scrollbar.o font.o main.o
1
OBJECTS=window.o plate.o string.o button.o label.o textfield.o container.o frame.o util.o scrollbar.o font.o main.o
2
#C=/usr/local/gcc-2.8.1/bin/g++
2
#C=/usr/local/gcc-2.8.1/bin/g++
3
CC=g++
3
CC=$(cxx)
4
CFLAGS=-g -Wall
4
CFLAGS=$(cxxflags) -Wall
5
LIBS=-L/usr/X11R6/lib -lX11
5
LIBS=-L/usr/X11R6/lib -lX11
6
LIBNAME=libns.a
6
LIBNAME=libns.a
7
7
(-)xfreecell.orig/widget/textfield.cpp (+1 lines)
Lines 1-3 Link Here
1
#include <cctype>
1
#include "widget.h"
2
#include "widget.h"
2
3
3
GC NSTextField::gc;
4
GC NSTextField::gc;
(-)xfreecell.orig/widget/widget.h (-4 / +4 lines)
Lines 114-120 Link Here
114
    Elt(NSWindow* nw, Window w) { nswindow = nw; window = w; }
114
    Elt(NSWindow* nw, Window w) { nswindow = nw; window = w; }
115
  };
115
  };
116
116
117
  static vector<Elt> eltVector;
117
  static std::vector<Elt> eltVector;
118
  static void eraseWindow(Window);
118
  static void eraseWindow(Window);
119
  static void registerWindow(NSWindow*, Window);
119
  static void registerWindow(NSWindow*, Window);
120
};
120
};
Lines 171-177 Link Here
171
  void fontWindowHeight(unsigned int);
171
  void fontWindowHeight(unsigned int);
172
  void resizable(bool arg) { _resizable = arg; }
172
  void resizable(bool arg) { _resizable = arg; }
173
173
174
  string _label;
174
  std::string _label;
175
private:
175
private:
176
  static const int fontGap = 4;
176
  static const int fontGap = 4;
177
  static XFontStruct* fontStruct;
177
  static XFontStruct* fontStruct;
Lines 272-278 Link Here
272
  static unsigned int charWidth, charHeight;
272
  static unsigned int charWidth, charHeight;
273
273
274
  unsigned int maxCharNum;
274
  unsigned int maxCharNum;
275
  string _str;
275
  std::string _str;
276
  unsigned int cursorPos;
276
  unsigned int cursorPos;
277
  unsigned int strStart;
277
  unsigned int strStart;
278
  bool cursorOnTF;
278
  bool cursorOnTF;
Lines 327-333 Link Here
327
  unsigned int _vGap, _hGap, _neighborGap;
327
  unsigned int _vGap, _hGap, _neighborGap;
328
  Window _parentWindow;
328
  Window _parentWindow;
329
329
330
  vector<NSComponent*> nscVec;
330
  std::vector<NSComponent*> nscVec;
331
};
331
};
332
332
333
// ##### NSHContainer #####
333
// ##### NSHContainer #####
(-)xfreecell.orig/widget/window.cpp (-7 / +7 lines)
Lines 2-8 Link Here
2
2
3
bool NSWindow::windowInitialized = false;
3
bool NSWindow::windowInitialized = false;
4
Window NSWindow::_root;
4
Window NSWindow::_root;
5
vector<NSWindow::Elt> NSWindow::eltVector;
5
std::vector<NSWindow::Elt> NSWindow::eltVector;
6
6
7
NSWindow::NSWindow(bool create, Window w, int x, int y, unsigned int width, unsigned int height, 
7
NSWindow::NSWindow(bool create, Window w, int x, int y, unsigned int width, unsigned int height, 
8
		   unsigned int borderWidth, unsigned long border, unsigned long bg)
8
		   unsigned int borderWidth, unsigned long border, unsigned long bg)
Lines 86-93 Link Here
86
86
87
void NSWindow::registerWindow(NSWindow* nsw, Window w)
87
void NSWindow::registerWindow(NSWindow* nsw, Window w)
88
{
88
{
89
  vector<Elt>::iterator begin = eltVector.begin();
89
  std::vector<Elt>::iterator begin = eltVector.begin();
90
  vector<Elt>::iterator end = eltVector.end();
90
  std::vector<Elt>::iterator end = eltVector.end();
91
  Elt elt(nsw, w);
91
  Elt elt(nsw, w);
92
92
93
  if (eltVector.size() == 0 || w > eltVector.back().window) {
93
  if (eltVector.size() == 0 || w > eltVector.back().window) {
Lines 95-101 Link Here
95
    return;
95
    return;
96
  }
96
  }
97
97
98
  for (vector<Elt>::iterator iter = begin; iter != end; iter++)
98
  for (std::vector<Elt>::iterator iter = begin; iter != end; iter++)
99
    if ((*iter).window > w)
99
    if ((*iter).window > w)
100
      eltVector.insert(iter, elt);
100
      eltVector.insert(iter, elt);
101
  
101
  
Lines 104-112 Link Here
104
104
105
void NSWindow::eraseWindow(Window w)
105
void NSWindow::eraseWindow(Window w)
106
{
106
{
107
  vector<Elt>::iterator begin = eltVector.begin();
107
  std::vector<Elt>::iterator begin = eltVector.begin();
108
  vector<Elt>::iterator end = eltVector.end();
108
  std::vector<Elt>::iterator end = eltVector.end();
109
  vector<Elt>::iterator iter;
109
  std::vector<Elt>::iterator iter;
110
110
111
  for (iter = begin; iter != end; iter++) {
111
  for (iter = begin; iter != end; iter++) {
112
    if ((*iter).window == w) eltVector.erase(iter);
112
    if ((*iter).window == w) eltVector.erase(iter);

Return to bug 41713