View | Details | Raw Unified | Return to bug 172010
Collapse All | Expand All

(-)games/xevil/Makefile (-26 / +26 lines)
Lines 1-47 Link Here
1
# New ports collection makefile for:   xevil
1
# Created by: G_ran Runfeldt <goranrunfeldt@home.se>
2
# Date created:        7 November 2000
3
# Whom:    G_ran Runfeldt <goranrunfeldt@home.se>
4
#
5
# $FreeBSD: ports/games/xevil/Makefile,v 1.24 2010/06/03 15:54:28 pav Exp $
2
# $FreeBSD: ports/games/xevil/Makefile,v 1.24 2010/06/03 15:54:28 pav Exp $
6
#
7
3
8
PORTNAME=	xevil
4
PORTNAME=	xevil
9
PORTVERSION=	2.02.r2
5
PORTVERSION=	2.02.r2
10
PORTREVISION=	2
6
PORTREVISION=	2
11
CATEGORIES=	games
7
CATEGORIES=	games
12
MASTER_SITES=	http://www.xevil.com/download/stable/
8
MASTER_SITES=	SF/${PORTNAME}.mirror \
13
DISTNAME=	xevilsrc${PORTVERSION:S/.r/r/}
9
		http://www.xevil.com/download/stable/
10
DISTNAME=	${PORTNAME}src${PORTVERSION:S/.r/r/}
14
11
15
MAINTAINER=	ports@FreeBSD.org
12
MAINTAINER=	ports@FreeBSD.org
16
COMMENT=	A fast-action, networked, anti-social, kill-everything game
13
COMMENT=	A fast-action, networked, anti-social, kill-everything game
17
14
18
USE_ZIP=	yes
15
LICENSE=	GPLv2 # (or later)
19
USE_XORG=	xpm
20
USE_DOS2UNIX= makefile config.mk cmn/makefile cmn/*.cpp cmn/*.h x11/makefile x11/*.cpp
21
MAKEFILE=	makefile
22
ALL_TARGET=	freebsd
23
MAKE_JOBS_UNSAFE=	yes
24
25
.include <bsd.port.pre.mk>
26
16
27
# I'm not sure if this should be here
17
OPTIONS_DEFINE=	DOCS
28
.if (${MACHINE} == "alpha")
29
CFLAGS+="-DXEVIL_KEYSET=UIalpha"
30
.endif
31
18
32
pre-extract:
19
NO_WRKSUBDIR=	yes
33
	@${MKDIR} ${WRKDIR}/${DISTNAME}
34
20
35
do-extract:
21
USE_ZIP=	yes
36
	@${UNZIP_CMD} ${EXTRACT_BEFORE_ARGS} ${DISTDIR}/${DISTFILES} -d ${WRKSRC}
22
USE_XORG=	xpm
23
USE_DOS2UNIX=	*.cpp *.h config.mk makefile
24
MAKEFILE=	makefile
25
MAKE_ARGS=	DEPTH="${WRKSRC}"
26
ALL_TARGET=	${OPSYS:L}
27
MAKE_JOBS_SAFE=	yes
28
29
PORTDOCS=	*
30
PLIST_FILES=	bin/${PORTNAME}
31
32
.include <bsd.port.options.mk>
33
34
post-patch:
35
	@${FIND} ${WRKSRC} -name "*.xpm" | ${XARGS} ${REINPLACE_CMD} -e \
36
		's|^static char|static const char|'
37
37
38
do-install:
38
do-install:
39
	${INSTALL_PROGRAM} ${WRKSRC}/x11/FREEBSD/xevil ${PREFIX}/bin/xevil
39
	${INSTALL_PROGRAM} ${WRKSRC}/x11/${OPSYS:U}/${PORTNAME} ${PREFIX}/bin
40
.if !defined(NOPORTDOCS)
40
.if ${PORT_OPTIONS:MDOCS}
41
	@${MKDIR} ${DOCSDIR}
41
	@${MKDIR} ${DOCSDIR}
42
	${INSTALL_DATA} ${WRKSRC}/readme.txt ${DOCSDIR}
42
	${INSTALL_DATA} ${WRKSRC}/readme.txt ${DOCSDIR}
43
	@${MKDIR} ${DOCSDIR}/instructions
43
	@${MKDIR} ${DOCSDIR}/instructions
44
	${INSTALL_DATA} ${WRKSRC}/instructions/* ${DOCSDIR}/instructions
44
	${INSTALL_DATA} ${WRKSRC}/instructions/* ${DOCSDIR}/instructions
45
.endif
45
.endif
46
46
47
.include <bsd.port.post.mk>
47
.include <bsd.port.mk>
(-)games/xevil/files/patch-ad (-3 / +19 lines)
Lines 1-6 Link Here
1
--- makefile.orig	Sun Mar 23 00:09:08 2003
1
--- makefile.orig	2012-05-27 06:39:04.000000000 +0900
2
+++ makefile	Sun May 18 12:05:08 2003
2
+++ makefile	2012-05-27 06:42:04.000000000 +0900
3
@@ -63,11 +63,6 @@
3
@@ -42,9 +42,9 @@
4
 	$(OBJ_DIR)/ui_cmn.o $(OBJ_DIR)/l_agreement_dlg.o $(OBJ_DIR)/viewport.o
5
 
6
 
7
-xevil: $(OBJ_DIR)/xevil $(OBJ_DIR)/xevil$(VERSION).$(PCKG_NAME).tar.Z
8
+#xevil: $(OBJ_DIR)/xevil $(OBJ_DIR)/xevil$(VERSION).$(PCKG_NAME).tar.Z
9
 #xevil: $(OBJ_DIR)/xevil$(VERSION).$(PCKG_NAME).tar.Z
10
-#xevil: $(OBJ_DIR)/xevil
11
+xevil: $(OBJ_DIR)/xevil
12
 
13
 
14
 # Build the xevil executable.  
15
@@ -59,15 +59,9 @@
16
 	cd $(DEPTH)/cmn; $(MAKE)
17
 	cd $(DEPTH)/x11; $(MAKE)
18
 	$(CC) $(LINK_FLAGS) $(LINK_OPT) $(LIBS_DIRS) -o $(OBJ_DIR)/xevil $(ALL_OBJS) $(LIBS)
19
-	$(STRIP) $(OBJ_DIR)/xevil
4
 
20
 
5
 # Could also include serverping in the distribution
21
 # Could also include serverping in the distribution
6
 $(OBJ_DIR)/xevil$(VERSION).$(PCKG_NAME).tar.Z::
22
 $(OBJ_DIR)/xevil$(VERSION).$(PCKG_NAME).tar.Z::
(-)games/xevil/files/patch-cmn::actual.cpp (-7 / +194 lines)
Lines 1-21 Link Here
1
--- cmn/actual.cpp.orig	2000-01-19 12:54:36.000000000 +0100
1
--- cmn/actual.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ cmn/actual.cpp	2007-07-31 15:47:25.000000000 +0200
2
+++ cmn/actual.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -32,7 +32,8 @@
3
@@ -32,7 +32,7 @@
4
 
4
 
5
 // Include Files
5
 // Include Files
6
 #if X11
6
 #if X11
7
-#include <strstream.h>
7
-#include <strstream.h>
8
+#include <strstream>
8
+#include <sstream>
9
+using namespace std;
10
 #endif
9
 #endif
11
 #if WIN32
10
 #if WIN32
12
 #include <strstrea.h>
11
 #include <strstrea.h>
13
@@ -1534,7 +1535,7 @@
12
@@ -122,6 +122,7 @@
13
 #include "bitmaps/yeti/yeti.bitmaps"
14
 
15
 
16
+using namespace std;
17
 
18
 ///// Some helper macros to define creatures with certain abilities.
19
 #define DEFINE_CREATURE_CTORS_2(CLASSNAME,ABILITY0,ability0,ABILITY1,ability1) \
20
@@ -454,9 +455,9 @@
21
     }
22
 	}
23
 
24
-	ostrstream msg;
25
-	msg << "Explosion hits " << hit << " objects." << ends;
26
-	locator->message_enq(msg.str());
27
+	stringstream msg;
28
+	msg << "Explosion hits " << hit << " objects.";
29
+	locator->message_enq(Utils::strdup(msg.str().c_str()));
30
 
31
 	kill_self();
32
 	Physical::act();
33
@@ -1001,7 +1002,7 @@
34
   if (other && (other->get_class_id() != A_AltarOfSin) &&
35
       (intel = other->get_intel())) {
36
     LocatorP locator = get_locator();
37
-    ostrstream str;
38
+    stringstream str;
39
     
40
     // Turned into a frog/baby seal.
41
     if (Utils::coin_flip() && other->is_moving() && 
42
@@ -1014,8 +1015,8 @@
43
       
44
       str << intel->get_name() << " attacks the Altar of Sin and is "
45
           << "turned into a " << (doFrog ? "frog" : "baby-seal")
46
-          << "." << ends;
47
-      locator->message_enq(str.str());
48
+          << ".";
49
+      locator->message_enq(Utils::strdup(str.str().c_str()));
50
   
51
       other->set_intel(NULL);
52
       if (!other->get_mapped()) {
53
@@ -1047,8 +1048,8 @@
54
     // Lose all health.
55
     else {
56
       str << "BLASPHMER!  " << intel->get_name() << 
57
-          " loses health for daring to attack the Altar of Sin." << ends;
58
-      locator->message_enq(str.str());
59
+          " loses health for daring to attack the Altar of Sin.";
60
+      locator->message_enq(Utils::strdup(str.str().c_str()));
61
       
62
       int damage = other->get_health();
63
       other->corporeal_attack(this,damage);
64
@@ -1075,8 +1076,8 @@
65
       (intel = other->get_intel()) && intel->is_human()) {
66
     int lives = intel->get_lives();
67
     LocatorP locator = get_locator();
68
-    ostrstream msg;
69
-    ostrstream arenaMsg;
70
+    stringstream msg;
71
+    stringstream arenaMsg;
72
 
73
     // Choose different blessings to give.
74
     int n = 0;
75
@@ -1112,8 +1113,8 @@
76
         }
77
         else {
78
           intel->set_lives(lives + 1);
79
-          msg << intel->get_name() << " sells soul for an extra life." << ends;
80
-          arenaMsg << "You Sold Your Soul For an Extra Life" << ends;
81
+          msg << intel->get_name() << " sells soul for an extra life.";
82
+          arenaMsg << "You Sold Your Soul For an Extra Life";
83
         }
84
         break;
85
     
86
@@ -1123,8 +1124,8 @@
87
         mod = new DoubleSpeed();
88
         assert(mod);          
89
         modList->append_unique(mod);
90
-        msg << intel->get_name() << " sells soul for Double Speed." << ends;
91
-        arenaMsg << "Double Speed" << ends;
92
+        msg << intel->get_name() << " sells soul for Double Speed.";
93
+        arenaMsg << "Double Speed";
94
         break;
95
 
96
         
97
@@ -1138,9 +1139,8 @@
98
         mod = new DoubleJump();
99
         assert(mod);          
100
         modList->append_unique(mod);
101
-        msg << intel->get_name() << " sells soul for extra jumping powers." 
102
-            << ends;
103
-        arenaMsg << "Extra Jumping Powers" << ends;
104
+        msg << intel->get_name() << " sells soul for extra jumping powers.";
105
+        arenaMsg << "Extra Jumping Powers";
106
         break;
107
         
108
 
109
@@ -1157,8 +1157,8 @@
110
         // So max health takes effect immediately.
111
         other->heal();
112
         
113
-        msg << intel->get_name() << " sells soul for Double Health." << ends;
114
-        arenaMsg << "Double Health" << ends;
115
+        msg << intel->get_name() << " sells soul for Double Health.";
116
+        arenaMsg << "Double Health";
117
         break;
118
 
119
 
120
@@ -1176,8 +1176,8 @@
121
           // Might as well make sure they can take advantage of it now.  
122
           other->heal();
123
 
124
-          msg << intel->get_name() << " sells soul for Healing Powers." << ends;
125
-          arenaMsg << "Healing Powers" << ends;
126
+          msg << intel->get_name() << " sells soul for Healing Powers.";
127
+          arenaMsg << "Healing Powers";
128
         }
129
         break;
130
 
131
@@ -1193,8 +1193,8 @@
132
           // Already checked that other is a Creature().
133
           ((CreatureP)other)->add_ability(a);
134
 
135
-          msg << intel->get_name() << " sells soul for HellFire Powers." << ends;
136
-          arenaMsg << "HellFire Powers" << ends;    
137
+          msg << intel->get_name() << " sells soul for HellFire Powers.";
138
+          arenaMsg << "HellFire Powers";
139
         }
140
         break;
141
 
142
@@ -1217,8 +1217,8 @@
143
           // Already checked that other is a Creature().
144
           ((CreatureP)other)->add_ability(a);
145
 
146
-          msg << intel->get_name() << " sells soul for Fireballs." << ends;
147
-          arenaMsg << "Fireballs" << ends;    
148
+          msg << intel->get_name() << " sells soul for Fireballs.";
149
+          arenaMsg << "Fireballs";
150
         }
151
         break;
152
         
153
@@ -1241,8 +1241,8 @@
154
           // Already checked that other is a Creature().
155
           ((CreatureP)other)->add_ability(a);
156
 
157
-          msg << intel->get_name() << " sells soul for Flying Powers." << ends;
158
-          arenaMsg << "Flying Powers" << ends;
159
+          msg << intel->get_name() << " sells soul for Flying Powers.";
160
+          arenaMsg << "Flying Powers";
161
         }
162
         break;
163
 
164
@@ -1274,8 +1274,8 @@
165
           // Already checked that other is a Creature().
166
           ((CreatureP)other)->add_ability(a);
167
 
168
-          msg << intel->get_name() << " sells soul for Sticky Powers." << ends;
169
-          arenaMsg << "Sticky Powers" << ends;          
170
+          msg << intel->get_name() << " sells soul for Sticky Powers.";
171
+          arenaMsg << "Sticky Powers";
172
         }
173
         break;
174
 
175
@@ -1285,8 +1285,8 @@
176
       }
177
     } // while
178
       
179
-    locator->message_enq(msg.str());
180
-    locator->arena_message_enq(arenaMsg.str(),other);
181
+    locator->message_enq(Utils::strdup(msg.str().c_str()));
182
+    locator->arena_message_enq(Utils::strdup(arenaMsg.str().c_str()),other);
183
 
184
     kill_self();
185
     turnTaken = True;
186
@@ -1534,7 +1534,7 @@
14
                                                  void *closure) {
187
                                                  void *closure) {
15
   // notThis is used to prevent transmogifying into the same class an object
188
   // notThis is used to prevent transmogifying into the same class an object
16
   // already is.
189
   // already is.
17
-  ClassId notThis = (ClassId)closure;
190
-  ClassId notThis = (ClassId)closure;
18
+  ClassId notThis = (intptr_t)closure;
191
+  ClassId notThis = (long)closure;
19
   if (pc->classId == notThis) {
192
   if (pc->classId == notThis) {
20
     return False;
193
     return False;
21
   }
194
   }
195
@@ -2087,10 +2087,9 @@
196
 		PhysicalP seal = new Seal(w,l,pos);
197
 		assert(seal);
198
 
199
-		char sealStr[20];
200
-		ostrstream str(sealStr,20);
201
-		str << "seal-" << sealsNum << ends;
202
-		NeutralP sealIntel = new SealIntel(w,l,sealStr,homeId);
203
+		stringstream str;
204
+		str << "seal-" << sealsNum;
205
+		NeutralP sealIntel = new SealIntel(w,l,Utils::strdup(str.str().c_str()),homeId);
206
 		seal->set_intel(sealIntel);
207
 		l->register_neutral(sealIntel);
208
 		seals[sealsNum] = sealIntel->get_intel_id();
(-)games/xevil/files/patch-cmn::area.cpp (-4 / +9 lines)
Lines 1-12 Link Here
1
--- cmn/area.cpp.orig	Wed Mar 19 10:04:22 2003
1
--- cmn/area.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ cmn/area.cpp	Sat Oct 25 21:39:50 2003
2
+++ cmn/area.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -34,7 +34,8 @@
3
@@ -34,12 +34,13 @@
4
 extern "C" {
4
 extern "C" {
5
 #include <limits.h> // For INT_MAX
5
 #include <limits.h> // For INT_MAX
6
 }
6
 }
7
-#include <iostream.h>
7
-#include <iostream.h>
8
+#include <iostream>
8
+#include <iostream>
9
+using namespace std;
10
 #include "utils.h"
9
 #include "utils.h"
11
 #include "coord.h"
10
 #include "coord.h"
12
 #include "area.h"
11
 #include "area.h"
12
 
13
 
14
+using namespace std;
15
 
16
 Size Area::operator - (const Area &other) const {
17
   assert ((shape == AR_RECT) && (other.shape == AR_RECT));
(-)games/xevil/files/patch-cmn::game.cpp (-5 / +570 lines)
Lines 1-12 Link Here
1
--- cmn/game.cpp.orig	Sat Mar 22 22:20:00 2003
1
--- cmn/game.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ cmn/game.cpp	Sat Oct 25 21:40:23 2003
2
+++ cmn/game.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -34,7 +34,8 @@
3
@@ -31,16 +31,17 @@
4
 #include "stdafx.h"
5
 extern "C" {
6
 #include <string.h>
7
+#include <stdlib.h>
4
 }
8
 }
5
 
9
 
6
 #if X11
10
 #if X11
7
-#include <strstream.h>
11
-#include <strstream.h>
8
+#include <strstream>
12
+#include <sstream>
9
+using namespace std;
10
 #endif
13
 #endif
11
 #if WIN32
14
 #if WIN32
12
 #include <strstrea.h>
15
 #include <strstrea.h>
16
 #endif
17
 
18
-#include <iomanip.h>
19
+#include <iomanip>
20
 
21
 #include "utils.h"
22
 #include "coord.h"
23
@@ -123,7 +124,7 @@
24
 #define SOUNDONOFF_DEFAULT       True 
25
 
26
 
27
-char *Game::wittySayings[Game::WITTY_SAYINGS_NUM] = {
28
+const char *Game::wittySayings[Game::WITTY_SAYINGS_NUM] = {
29
     "If it moves it's a threat.  If it doesn't move it's a potential threat.",
30
     "Happy, happy.  Joy, joy.",
31
     "For the mother country!!!",
32
@@ -271,11 +272,19 @@
33
     "Prepare to Qualify.",
34
     "I got a bad feeling about this drop.",
35
     "Cowboys never quit!",
36
+    "The voices say I'm not crazy, so I'm OK!",
37
+    "Cure Sars!?!",
38
+    "Ha Ha Ha, Loser!",
39
+    "It's all fun and games until someone loses an eye.",
40
+    "Eye for an eye, tooth for a tooth.",
41
+    "Mo-o-m!",
42
+    "Timmy's touching me!",
43
+    "I'm not touching you! See? I'm not touching you!"
44
 };
45
 
46
 
47
 
48
-char *Game::intelNames[Game::INTEL_NAMES_NUM] = {
49
+const char *Game::intelNames[Game::INTEL_NAMES_NUM] = {
50
   "Dr. Pain",
51
   "Steve",
52
   "hardts",
53
@@ -350,6 +359,9 @@
54
   "Stan",
55
   "Mr. Hat",
56
   "Cid",
57
+  "Mr. Hankey",
58
+  "Michael Jackson",
59
+  "O.J. Simpson"
60
 };
61
 
62
 
63
@@ -793,7 +805,7 @@
64
 
65
   // Just for tracing in the debugger.
66
   char* version = Utils::get_OS_info();
67
-  delete version;
68
+  delete [] version;
69
 
70
   noUi = False;
71
   noNewLevel = False;
72
@@ -1056,7 +1068,7 @@
73
 
74
 Game::~Game() {
75
   if (oneItem) {
76
-    delete oneItem;
77
+    delete [] oneItem;
78
   }
79
 
80
   delete ui;
81
@@ -1500,13 +1512,13 @@
82
 
83
     if (mask & UIconnectServer) {
84
       delete role;
85
-      ostrstream portName;
86
-      portName << settings.connectPort << ends;
87
+      stringstream portName;
88
+      portName << settings.connectPort;
89
       IViewportInfo* vInfo = Ui::get_viewport_info();
90
-      ClientP client = new Client(settings.connectHostname,portName.str(),
91
+      ClientP client = new Client(settings.connectHostname,
92
+                                  Utils::strdup(portName.str().c_str()),
93
                                   0,settings.humanName,vInfo,
94
                                   Connection::ADJUST_SKIP,&locator);
95
-      delete portName.str();
96
       assert(client);
97
       role = client;
98
       ui->set_role_type(role->get_type());
99
@@ -1544,10 +1556,9 @@
100
       }
101
 
102
       delete role;
103
-      ostrstream portName;
104
-      portName << settings.serverPort << ends;
105
-      role = new Server(settings.localHuman,portName.str(),&locator);
106
-      delete portName.str();
107
+      stringstream portName;
108
+      portName << settings.serverPort;
109
+      role = new Server(settings.localHuman,portName.str().c_str(),&locator);
110
       assert(role);
111
       restartEnd = RE_RESTART;
112
       ui->set_role_type(role->get_type());
113
@@ -1573,9 +1584,9 @@
114
     ui->set_style(styleType);
115
   }
116
 
117
-  ostrstream str;
118
+  stringstream str;
119
   styleNext->describe(str);
120
-  locator.message_enq(str.str());
121
+  locator.message_enq(Utils::strdup(str.str().c_str()));
122
 }
123
 
124
 
125
@@ -1589,9 +1600,9 @@
126
     human->reincarnate();
127
     obj->set_intel(human);
128
       
129
-    ostrstream msg;
130
-    msg << human->get_name() << " is back from the dead." << ends;
131
-    locator.message_enq(msg.str());
132
+    stringstream msg;
133
+    msg << human->get_name() << " is back from the dead.";
134
+    locator.message_enq(Utils::strdup(msg.str().c_str()));
135
   }
136
 }
137
 
138
@@ -1615,7 +1626,7 @@
139
 void Game::new_level_check(int enemiesPlaying) {
140
   assert(state == gameOn);
141
 
142
-  ostrstream str;
143
+  stringstream str;
144
   Boolean lStrChanged = False;
145
   int val = style->new_level_check(enemiesPlaying,&world,&locator,
146
                                    level,lStrChanged,str,timer,
147
@@ -1645,11 +1656,8 @@
148
   // if str has anything in it.  Fucking Linux compilers.
149
   if (lStrChanged) {
150
     if (ui) {
151
-      ui->set_level(str.str());
152
+      ui->set_level(str.str().c_str());
153
     }
154
-    // Ok to delete even if ui is NULL, str.str() will allocate the memory to
155
-    // kill off.
156
-    delete str.str();
157
   }
158
 }  
159
 
160
@@ -1841,7 +1849,7 @@
161
 
162
 
163
 
164
-char *Game::choose_ranking(int kills) {
165
+const char *Game::choose_ranking(int kills) {
166
   // Figure out the ranking set, they are listed in order.
167
   int setNum = 0;
168
   assert(kills >= 0 && rankingSets[0].killsMin == 0);
169
@@ -1876,7 +1884,7 @@
170
   if (showMessages) {
171
     for (int n = 0; n < locator.humans_registered(); n++) {
172
       HumanP human = locator.get_human(n);
173
-      ostrstream msg;
174
+      stringstream msg;
175
 
176
       // Soups are only taken into account if you have unlimited lives.
177
       int totalKills;
178
@@ -1894,11 +1902,11 @@
179
         totalKills = human->get_human_kills() + human->get_enemy_kills();
180
       }
181
 
182
-      char *ranking = choose_ranking(totalKills);
183
+      const char *ranking = choose_ranking(totalKills);
184
       msg << totalKills << (totalKills == 1 ? "Kill" : " Kills") 
185
-        << ", Rank: " << ranking << ends;
186
+        << ", Rank: " << ranking;
187
       IntelId humanIntelId = human->get_intel_id();
188
-      locator.arena_message_enq(msg.str(),&humanIntelId,10000);
189
+      locator.arena_message_enq(Utils::strdup(msg.str().c_str()),&humanIntelId,10000);
190
     }
191
   }
192
 }
193
@@ -1919,8 +1927,8 @@
194
   // Will clean out non-persistent teams.
195
   locator.level_reset();
196
 
197
-  ostrstream lStr;       // For level box on the side of the ui->
198
-  ostrstream lTitleStr;  // For Ui title screen.
199
+  stringstream lStr;       // For level box on the side of the ui->
200
+  stringstream lTitleStr;  // For Ui title screen.
201
   Boolean doBonus;
202
 
203
   // Possibly increment level count number.
204
@@ -1960,7 +1968,7 @@
205
   if (doBonus) {
206
     delete levelTitleStored; // If it already exists.
207
     // Store levelTitle string for later use.
208
-    levelTitleStored = lTitleStr.str();
209
+    levelTitleStored = Utils::strdup(lTitleStr.str().c_str());
210
 
211
     // Tell user about the bonus.
212
     award_bonuses_now();
213
@@ -1970,13 +1978,12 @@
214
   }
215
   // Go to getBearings state.
216
   else {
217
-    get_bearings(lTitleStr.str());
218
+    get_bearings(Utils::strdup(lTitleStr.str().c_str()));
219
   }
220
   
221
   if (ui) {
222
-    ui->set_level(lStr.str());
223
+    ui->set_level(lStr.str().c_str());
224
   }
225
-  delete lStr.str();
226
 
227
   // Will pass in more info later.
228
   role->new_level(this,&world,&locator);
229
@@ -1997,7 +2004,7 @@
230
       continue;
231
     }
232
 
233
-    char* awardMsg = NULL;
234
+    const char* awardMsg = NULL;
235
     int count = 0;
236
     while (!awardMsg && count < AWARD_BONUS_TRIES) {
237
       count++;
238
@@ -2184,9 +2191,9 @@
239
   
240
   // Moved resetting world rooms to new_level(); 
241
 
242
-  ostrstream msg;
243
-  msg << wittySayings[Utils::choose(WITTY_SAYINGS_NUM)] << ends;
244
-  locator.message_enq(msg.str());
245
+  stringstream msg;
246
+  msg << wittySayings[Utils::choose(WITTY_SAYINGS_NUM)];
247
+  locator.message_enq(Utils::strdup(msg.str().c_str()));
248
 
249
   /* Don't need to call Ui::set_* because the new values originally came 
250
      from ui-> */
251
@@ -2242,41 +2249,39 @@
252
           { // Right keys.
253
             right[n][which] = 0;
254
             
255
-            ostrstream strm;
256
+            stringstream strm;
257
             if (which == 0)
258
-              strm << "right_" << keysNames[n] << ends;
259
+              strm << "right_" << keysNames[n];
260
             else
261
-              strm << "right_" << keysNames[n] << "_2" << ends;
262
-            char *option = strm.str();
263
+              strm << "right_" << keysNames[n] << "_2";
264
+            const string & option = strm.str();
265
             
266
             // Should we free value??
267
-            char *value = XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option);
268
+            char *value = XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option.c_str());
269
             if (value) {
270
               KeySym keysym = XStringToKeysym(value);
271
               if (keysym != NoSymbol)
272
                 right[n][which] = keysym;
273
             }
274
-            delete option;
275
 	      }
276
 	      
277
 	      { // Left Keys.
278
             left[n][which] = 0;
279
             
280
-            ostrstream strm;
281
+            stringstream strm;
282
             if (which == 0)
283
-              strm << "left_" << keysNames[n] << ends;
284
+              strm << "left_" << keysNames[n];
285
             else
286
-              strm << "left_" << keysNames[n] << "_2" << ends;
287
-            char *option = strm.str();
288
+              strm << "left_" << keysNames[n] << "_2";
289
+            const string & option = strm.str();
290
             
291
             // Should we free value??
292
-            char *value = XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option);
293
+            char *value = XGetDefault(ui->get_dpy(0),XEVIL_CLASS,option.c_str());
294
             if (value) {
295
               KeySym keysym = XStringToKeysym(value);
296
               if (keysym != NoSymbol)
297
                 left[n][which] = keysym;
298
             }
299
-            delete option;
300
 	      }
301
 	    }
302
 
303
@@ -2291,10 +2296,10 @@
304
 void Game::parse_args(int *argc,char **argv) {
305
   // Create a bunch of "-name<x>" strings for comparing with command-line 
306
   // args.
307
-  ostrstream dashName[Locator::HUMANS_MAX];
308
+  stringstream dashName[Locator::HUMANS_MAX];
309
   int n;
310
   for (n = 0; n < Locator::HUMANS_MAX; n++) {
311
-    dashName[n] << "-name" << n << ends;
312
+    dashName[n] << "-name" << n;
313
   }
314
 
315
   // Defaults
316
@@ -2351,7 +2356,7 @@
317
     // Check "-name<x>" arguments.
318
     else {
319
       for (int j = 0; j < Locator::HUMANS_MAX; j++) {
320
-        if ((! strcmp(dashName[j].str(),argv[n])) && (n + 1 < *argc)) {
321
+        if ((! strcmp(dashName[j].str().c_str(),argv[n])) && (n + 1 < *argc)) {
322
           humanNames[j] = Utils::strdup(argv[n+1]);
323
           n++;
324
         }
325
@@ -2728,12 +2733,6 @@
326
       n++;
327
     }
328
   } // for
329
-  
330
-  
331
-  // Delete memory for "-name" strings.
332
-  for (n = 0; n < Locator::HUMANS_MAX; n++) {
333
-    delete dashName[n].str();
334
-  }
335
 }
336
 
337
 
338
@@ -2741,15 +2740,15 @@
339
 char **Game::display_names(int *argc,char **argv) {
340
 
341
 #if X11
342
-  ostrstream dashDisplay[UI_VIEWPORTS_MAX][2];
343
+  stringstream dashDisplay[UI_VIEWPORTS_MAX][2];
344
   char **displayNames = new charP [UI_VIEWPORTS_MAX];
345
 
346
   int n;
347
   for (n = 0; n < UI_VIEWPORTS_MAX; n++) {
348
     displayNames[n] = new char [Xvars::DISPLAY_NAME_LENGTH];
349
     strcpy(displayNames[n],"");
350
-    dashDisplay[n][0] << "-display" << n << ends;
351
-    dashDisplay[n][1] << "-d" << n << ends;
352
+    dashDisplay[n][0] << "-display" << n;
353
+    dashDisplay[n][1] << "-d" << n;
354
   }
355
 
356
   // Loop through all command line arguments.
357
@@ -2765,7 +2764,7 @@
358
     // Set display name for one viewport.
359
     for (int m = 0; m < UI_VIEWPORTS_MAX; m++) {
360
       for (int which = 0; which < 2; which++) {
361
-        if (!strcmp(argv[n],dashDisplay[m][which].str())) {
362
+        if (!strcmp(argv[n],dashDisplay[m][which].str().c_str())) {
363
           assert(strlen(argv[n+1]) < Xvars::DISPLAY_NAME_LENGTH);
364
           strcpy(displayNames[m],argv[n+1]);
365
         }
366
@@ -2773,11 +2772,6 @@
367
     }
368
   }
369
 
370
-  for (n = 0; n < UI_VIEWPORTS_MAX; n++) {
371
-    for (int which = 0; which < 2; which++) {
372
-      delete dashDisplay[n][which].str();
373
-    }
374
-  }
375
   return displayNames;
376
 #endif
377
 
378
@@ -2890,7 +2884,7 @@
379
   assert(role->get_type() != R_CLIENT);
380
 
381
   // Choose random name if -name was not specified for this player.
382
-  char *nameNonPc = 
383
+  const char *nameNonPc = 
384
     Utils::strlen(humanNames[h]) ? 
385
     humanNames[h] :
386
     intelNames[intelNamesIndices[h % INTEL_NAMES_NUM]];
387
@@ -2954,13 +2948,12 @@
388
   
389
   // Put message in the status bar when the game starts up.
390
   // Use \n in string for locator.message_enq.
391
-  ostrstream msg;
392
+  stringstream msg;
393
   msg 
394
     << "XEvil(TM) " << VERSION 
395
     << "  http://www.xevil.com  satan@xevil.com  " << XETP::versionStr << "\n"
396
-    << "Copyright(C) 1994,2000 Steve Hardt and Michael Judge"
397
-    << ends;
398
-  locator.message_enq(msg.str());
399
+    << "Copyright(C) 1994,2000 Steve Hardt and Michael Judge";
400
+  locator.message_enq(Utils::strdup(msg.str().c_str()));
401
 
402
 
403
   // Print message to standard out.  Doesn't really do anything on Windows.
404
@@ -3075,11 +3068,10 @@
405
   IntelOptions ops;
406
   ITmask opMask = intel_options_for(ops,obj->get_class_id());
407
 
408
-  ostrstream name;
409
-  name << "Machine-" << (enemyNameCount++) << ends;
410
-  EnemyP enemy = new Enemy(&world,&locator,name.str(),&ops,opMask);
411
+  stringstream name;
412
+  name << "Machine-" << (enemyNameCount++);
413
+  EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),&ops,opMask);
414
   assert(enemy);
415
-  delete name.str();
416
   locator.register_enemy(enemy);
417
 
418
   if (addToLocator) {
419
@@ -3235,14 +3227,13 @@
420
   switch (Utils::choose(8)) {
421
     case 0: { // A bunch of Heros and an Alien.
422
     	for (int n = 0; n < 10; n++) {
423
-        ostrstream name;
424
-        name << "Enemy-" << n << ends;
425
+        stringstream name;
426
+        name << "Enemy-" << n;
427
         IntelOptions ops;
428
         ops.harmless = True;
429
-        EnemyP enemy = new Enemy(&world,&locator,name.str(),
430
+        EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),
431
 			         &ops,ITharmless);
432
         assert(enemy);
433
-        delete name.str();
434
         locator.register_enemy(enemy);
435
 
436
         Pos pos = world.empty_rect(Hero::get_size_max());
437
@@ -3268,16 +3259,15 @@
438
     
439
     case 1: { // Hero, FThrower, and a bunch of Frogs (does not mean Frenchmen).
440
 	    for (int n = 0; n < 15; n++) {
441
-	      ostrstream name;
442
-	      name << "Enemy-" << n << ends;
443
+	      stringstream name;
444
+	      name << "Enemy-" << n;
445
 	      IntelOptions ops;
446
 	      ops.psychotic = Utils::coin_flip();
447
-	      EnemyP enemy = new Enemy(&world,&locator,name.str(),
448
+	      EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),
449
 					     &ops,ITpsychotic);
450
 	      assert(enemy);
451
-	      delete name.str();
452
 	      locator.register_enemy(enemy);
453
-	      
454
+
455
 	      Pos pos = world.empty_rect(Frog::get_size_max());
456
 	      PhysicalP obj = new Frog(&world,&locator,pos);
457
 	      assert(obj);
458
@@ -3304,15 +3294,14 @@
459
     case 2: { // A bunch of Enforcers.
460
       for (int n = 0; n < 10; n++)
461
 	      {
462
-	        ostrstream name;
463
-	        name << "Enemy-" << n << ends;
464
+	        stringstream name;
465
+	        name << "Enemy-" << n;
466
 	        IntelOptions ops;
467
 	        ops.classFriends = False;
468
 	        ops.psychotic = True;
469
-	        EnemyP enemy = new Enemy(&world,&locator,name.str(),
470
+	        EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),
471
 					       &ops,ITclassFriends|ITpsychotic);
472
 	        assert(enemy);
473
-	        delete name.str();
474
 	        locator.register_enemy(enemy);
475
 	        
476
 	        Pos pos = world.empty_rect(Enforcer::get_size_max());
477
@@ -3327,14 +3316,13 @@
478
 
479
     case 3: { // A bunch of Ninjas and a chainsaw.
480
       for (int n = 0; n < 10; n++) {
481
-	      ostrstream name;
482
-	      name << "Enemy-" << n << ends;
483
+	      stringstream name;
484
+	      name << "Enemy-" << n;
485
 	      IntelOptions ops;
486
 	      ops.classFriends = False;
487
-	      EnemyP enemy = new Enemy(&world,&locator,name.str(),
488
+	      EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),
489
 					     &ops,ITclassFriends);
490
 	      assert(enemy);
491
-	      delete name.str();
492
 	      locator.register_enemy(enemy);
493
 	      
494
 	      Pos pos = world.empty_rect(Ninja::get_size_max());
495
@@ -3373,12 +3361,11 @@
496
       }	    
497
 
498
       for (int m = 0; m < 10; m++) {
499
-        ostrstream name;
500
-        name << "Enemy-" << m << ends;
501
-        EnemyP enemy = new Enemy(&world,&locator,name.str(),
502
+        stringstream name;
503
+        name << "Enemy-" << m;
504
+        EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),
505
                                  NULL,ITnone);
506
         assert(enemy);
507
-        delete name.str();
508
         locator.register_enemy(enemy);
509
         
510
         Pos pos = world.empty_rect(Hero::get_size_max());
511
@@ -3414,14 +3401,13 @@
512
     case 5: { // Ninjas and ChopperBoys.
513
       int n;
514
       for (n = 0; n < 10; n++) {
515
-	      ostrstream name;
516
-	      name << "Enemy-" << n << ends;
517
+	      stringstream name;
518
+	      name << "Enemy-" << n;
519
 	      IntelOptions ops;
520
 	      ops.classFriends = False;
521
-	      EnemyP enemy = new Enemy(&world,&locator,name.str(),
522
+	      EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),
523
 					     &ops,ITclassFriends);
524
 	      assert(enemy);
525
-	      delete name.str();
526
 	      locator.register_enemy(enemy);
527
 	        
528
 	      PhysicalP obj;
529
@@ -3458,11 +3444,10 @@
530
       // and the scenario isn't set up yet.
531
 
532
       for (n = 0; n < 9; n++) {
533
-        ostrstream name;
534
-        name << "Dog-" << n << ends;
535
-        EnemyP intel = new Enemy(&world,&locator,name.str(),NULL,ITnone);
536
+        stringstream name;
537
+        name << "Dog-" << n;
538
+        EnemyP intel = new Enemy(&world,&locator,name.str().c_str(),NULL,ITnone);
539
         assert(intel);
540
-        delete name.str();
541
         locator.register_enemy(intel);
542
 
543
         Pos pos = world.empty_rect(Dog::get_size_max());
544
@@ -3473,13 +3458,12 @@
545
   	  }
546
 
547
       for (n = 0; n < 3; n++) {
548
-        ostrstream name;
549
-        name << "Enemy-" << n << ends;
550
+        stringstream name;
551
+        name << "Enemy-" << n;
552
         IntelOptions ops;
553
         ops.harmless = True;
554
-        EnemyP enemy = new Enemy(&world,&locator,name.str(),&ops,ITharmless);
555
+        EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),&ops,ITharmless);
556
         assert(enemy);
557
-        delete name.str();
558
         locator.register_enemy(enemy);
559
 
560
         PhysicalP obj;
561
@@ -3510,13 +3494,12 @@
562
         Segmented::create_and_add_composite(ret,&world,&locator,Dragon::SEGMENTS_NUM,pos,
563
                                             Dragon::create,NULL);
564
         for (int m = 0; m < ret.length(); m++) {
565
-          ostrstream name;
566
-          name << "Enemy-" << n << ends;
567
+          stringstream name;
568
+          name << "Enemy-" << n;
569
           IntelOptions ops;
570
           ops.harmless = True;
571
-          EnemyP enemy = new Enemy(&world,&locator,name.str(),&ops,ITharmless);
572
+          EnemyP enemy = new Enemy(&world,&locator,name.str().c_str(),&ops,ITharmless);
573
           assert(enemy);
574
-          delete name.str();
575
           locator.register_enemy(enemy);
576
           PhysicalP p = (PhysicalP)ret.get(m);
577
           p->set_intel(enemy);
(-)games/xevil/files/patch-cmn::game.h (-4 / +43 lines)
Lines 1-12 Link Here
1
--- cmn/game.h.dist	Sat Mar 22 20:44:32 2003
1
--- cmn/game.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ cmn/game.h	Sat Oct 25 21:40:54 2003
2
+++ cmn/game.h	2012-05-27 06:53:11.000000000 +0900
3
@@ -35,7 +35,8 @@
3
@@ -35,7 +35,7 @@
4
 extern "C" {
4
 extern "C" {
5
 #include <time.h>
5
 #include <time.h>
6
 }
6
 }
7
-#include <iostream.h>
7
-#include <iostream.h>
8
+#include <iostream>
8
+#include <iostream>
9
+using namespace std;
10
 #include "utils.h"
9
 #include "utils.h"
11
 #include "ui.h"
10
 #include "ui.h"
12
 #include "world.h"
11
 #include "world.h"
12
@@ -136,7 +136,7 @@
13
 struct RankingSet {
14
   enum {RANKING_SET_MAX = 8}; // Max number of rankings in a set.
15
   int killsMin; // Min number of kills to get this rank.
16
-  char *rankings[RANKING_SET_MAX + 1]; // Extra for NULL.
17
+  const char *rankings[RANKING_SET_MAX + 1]; // Extra for NULL.
18
 };
19
 
20
 
21
@@ -268,8 +268,8 @@
22
   
23
 private:
24
   enum { 
25
-    WITTY_SAYINGS_NUM = 147,
26
-    INTEL_NAMES_NUM  = 74,
27
+    WITTY_SAYINGS_NUM = 155,
28
+    INTEL_NAMES_NUM  = 77,
29
     RANKING_SETS_NUM = 12,
30
   };
31
 
32
@@ -306,7 +306,7 @@
33
   static Boolean potential_enemy_filter(const PhysicalContext* pc,void*);
34
   /* EFFECTS: Filter those classes whose potentialEnemy flag is True. */
35
 
36
-  char *choose_ranking(int kills);
37
+  const char *choose_ranking(int kills);
38
   /* EFFECTS: Choose a rank for the player at the end of game based on the
39
      number of kills. */
40
   
41
@@ -412,8 +412,8 @@
42
   SoundName currentSoundName;
43
   //keeps track of current sound track being played: can be 0
44
 
45
-  static char *wittySayings[WITTY_SAYINGS_NUM];
46
-  static char *intelNames[INTEL_NAMES_NUM];
47
+  static const char *wittySayings[WITTY_SAYINGS_NUM];
48
+  static const char *intelNames[INTEL_NAMES_NUM];
49
   static DifficultyLevel difficultyLevels[DIFFICULTY_LEVELS_NUM];
50
   static RankingSet rankingSets[RANKING_SETS_NUM];
51
 
(-)games/xevil/files/patch-cmn::game_style.cpp (-9 / +899 lines)
Lines 1-21 Link Here
1
--- cmn/game_style.cpp.orig	2003-03-22 20:47:42.000000000 +0100
1
--- cmn/game_style.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ cmn/game_style.cpp	2007-07-31 15:57:08.000000000 +0200
2
+++ cmn/game_style.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -34,7 +34,8 @@
3
@@ -33,15 +33,9 @@
4
 #include <string.h>
4
 }
5
 }
5
 
6
 
6
 #if X11
7
-#if X11
7
-#include <strstream.h>
8
-#include <strstream.h>
8
+#include <strstream>
9
-#endif
9
+using namespace std;
10
-
11
-#if WIN32
12
-#include <strstrea.h>
13
-#endif
14
+#include <sstream>
15
 
16
-#include <iomanip.h>
17
+#include <iomanip>
18
 #include "utils.h"
19
 #include "coord.h"
20
 #include "world.h"
21
@@ -109,13 +103,13 @@
22
   /* DEFAULT: True */
23
 
24
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
25
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
26
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
27
                               IPhysicalManagerP) = 0;
28
 
29
   virtual void setup_world(WorldP,LocatorP,const DifficultyLevel &) = 0;
30
   virtual void new_level(int level,WorldP world,LocatorP locator,
31
                          const DifficultyLevel &dLevel,
32
-                         ostrstream &lStr,ostrstream &lTitleStr,
33
+                         stringstream &lStr,stringstream &lTitleStr,
34
                          IPhysicalManagerP manager,int humansNum) = 0;
35
   /* EFFECTS: These two functions start a new level in a scenario.  setup_world() should
36
      just setup the map and size of the world.  new_level() is called after world.reset()
37
@@ -158,13 +152,13 @@
38
   virtual ScenarioType get_scenario_type() {return EXTERMINATE;}
39
 
40
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
41
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
42
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
43
                               IPhysicalManagerP);
44
 
45
   virtual void setup_world(WorldP,LocatorP,const DifficultyLevel &);
46
   virtual void new_level(int level,WorldP world,LocatorP locator,
47
                          const DifficultyLevel &dLevel,
48
-                         ostrstream &lStr,ostrstream &lTitleStr,
49
+                         stringstream &lStr,stringstream &lTitleStr,
50
                          IPhysicalManagerP manager,int humansNum);
51
 
52
 
53
@@ -183,13 +177,13 @@
54
   virtual Boolean can_refill_game_objects();
55
 
56
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
57
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
58
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
59
                               IPhysicalManagerP);
60
 
61
   virtual void setup_world(WorldP,LocatorP,const DifficultyLevel &);
62
   virtual void new_level(int level,WorldP world,LocatorP locator,
63
                          const DifficultyLevel &dLevel,
64
-                         ostrstream &lStr,ostrstream &lTitleStr,
65
+                         stringstream &lStr,stringstream &lTitleStr,
66
                          IPhysicalManagerP manager,int humansNum);
67
 
68
   virtual void new_level_set_timer(Timer &timer);
69
@@ -209,7 +203,7 @@
70
   virtual ScenarioType get_scenario_type() {return HIVE;}
71
 
72
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
73
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
74
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
75
                               IPhysicalManagerP);
76
 
77
   virtual Boolean award_bonus();
78
@@ -218,7 +212,7 @@
79
   virtual void setup_world(WorldP,LocatorP,const DifficultyLevel &);
80
   virtual void new_level(int level,WorldP world,LocatorP locator,
81
                          const DifficultyLevel &dLevel,
82
-                         ostrstream &lStr,ostrstream &lTitleStr,
83
+                         stringstream &lStr,stringstream &lTitleStr,
84
                          IPhysicalManagerP manager,int humansNum);
85
 
86
   virtual void refill_enemies(Boolean enemiesRefill,WorldP,LocatorP,IPhysicalManagerP);
87
@@ -242,13 +236,13 @@
88
   virtual ScenarioType get_scenario_type() {return CAPTURE_THE_FLAG;}
89
 
90
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
91
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
92
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
93
                               IPhysicalManagerP);
94
 
95
   virtual void setup_world(WorldP,LocatorP,const DifficultyLevel &);
96
   virtual void new_level(int level,WorldP world,LocatorP locator,
97
                          const DifficultyLevel &dLevel,
98
-                         ostrstream &lStr,ostrstream &lTitleStr,
99
+                         stringstream &lStr,stringstream &lTitleStr,
100
                          IPhysicalManagerP manager,int humansNum);
101
 
102
   virtual void refill_enemies(Boolean enemiesRefill,WorldP,LocatorP,IPhysicalManagerP);
103
@@ -269,7 +263,7 @@
104
   virtual void setup_world(WorldP,LocatorP,const DifficultyLevel &);
105
   virtual void new_level(int level,WorldP world,LocatorP locator,
106
                          const DifficultyLevel &dLevel,
107
-                         ostrstream &lStr,ostrstream &lTitleStr,
108
+                         stringstream &lStr,stringstream &lTitleStr,
109
                          IPhysicalManagerP manager,int humansNum);
110
 
111
   virtual Boolean advance_level();  
112
@@ -292,7 +286,7 @@
113
   
114
   virtual Boolean (*get_team())(LocatorP,PhysicalP,PhysicalP) = 0;
115
   
116
-  virtual void set_level_strings(int level,ostrstream &lStr,ostrstream &lTitleStr) = 0;
117
+  virtual void set_level_strings(int level,stringstream &lStr,stringstream &lTitleStr) = 0;
118
   /* EFFECTS: Called in new_level() to set the appropriate messages. */
119
 
120
   
121
@@ -311,7 +305,7 @@
122
   virtual ScenarioType get_scenario_type() {return SEALS;}
123
 
124
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
125
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
126
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
127
                               IPhysicalManagerP);
128
 
129
   virtual Boolean award_bonus();
130
@@ -323,7 +317,7 @@
131
 #endif
132
   virtual Boolean (*get_team())(LocatorP,PhysicalP,PhysicalP);
133
 
134
-  virtual void set_level_strings(int level,ostrstream &lStr,ostrstream &lTitleStr);
135
+  virtual void set_level_strings(int level,stringstream &lStr,stringstream &lTitleStr);
136
 
137
 
138
 private:
139
@@ -342,7 +336,7 @@
140
   virtual ScenarioType get_scenario_type() {return ANTI_SEALS;}
141
 
142
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
143
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
144
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
145
                               IPhysicalManagerP);
146
 
147
 
148
@@ -351,7 +345,7 @@
149
 #endif
150
   virtual Boolean (*get_team())(LocatorP,PhysicalP,PhysicalP);
151
 
152
-  virtual void set_level_strings(int level,ostrstream &lStr,ostrstream &lTitleStr);
153
+  virtual void set_level_strings(int level,stringstream &lStr,stringstream &lTitleStr);
154
 
155
 
156
 private:
157
@@ -369,13 +363,13 @@
158
   virtual SoundName get_midisoundtrack(){return SoundNames::FIRE_SOUNDTRACK;}
159
 
160
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
161
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
162
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
163
                               IPhysicalManagerP);
164
 
165
   virtual void setup_world(WorldP,LocatorP,const DifficultyLevel &);
166
   virtual void new_level(int level,WorldP world,LocatorP locator,
167
                          const DifficultyLevel &dLevel,
168
-                         ostrstream &lStr,ostrstream &lTitleStr,
169
+                         stringstream &lStr,stringstream &lTitleStr,
170
                          IPhysicalManagerP manager,int humansNum);
171
 
172
   virtual Boolean award_bonus();
173
@@ -391,13 +385,13 @@
174
   virtual ScenarioType get_scenario_type() {return KILL_THE_DRAGON;}
175
 
176
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
177
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
178
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
179
                               IPhysicalManagerP);
180
 
181
   virtual void setup_world(WorldP,LocatorP,const DifficultyLevel &);
182
   virtual void new_level(int level,WorldP world,LocatorP locator,
183
                          const DifficultyLevel &dLevel,
184
-                         ostrstream &lStr,ostrstream &lTitleStr,
185
+                         stringstream &lStr,stringstream &lTitleStr,
186
                          IPhysicalManagerP manager,int humansNum);
187
 
188
   virtual SoundName get_midisoundtrack(){return SoundNames::FIRE_SOUNDTRACK;}
189
@@ -419,13 +413,13 @@
190
   virtual Pos human_initial_pos(WorldP,LocatorP,const Size &s);
191
 
192
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
193
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
194
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
195
                               IPhysicalManagerP);
196
 
197
   virtual void setup_world(WorldP,LocatorP,const DifficultyLevel &);
198
   virtual void new_level(int level,WorldP world,LocatorP locator,
199
                          const DifficultyLevel &dLevel,
200
-                         ostrstream &lStr,ostrstream &lTitleStr,
201
+                         stringstream &lStr,stringstream &lTitleStr,
202
                          IPhysicalManagerP manager,int humansNum);
203
 
204
   virtual void refill_enemies(Boolean enemiesRefill,WorldP,LocatorP,IPhysicalManagerP);
205
@@ -447,13 +441,13 @@
206
   virtual ScenarioType get_scenario_type() {return THE_POUND;}
207
 
208
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
209
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
210
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
211
                               IPhysicalManagerP);
212
 
213
   virtual void setup_world(WorldP,LocatorP,const DifficultyLevel &);
214
   virtual void new_level(int level,WorldP world,LocatorP locator,
215
                          const DifficultyLevel &dLevel,
216
-                         ostrstream &lStr,ostrstream &lTitleStr,
217
+                         stringstream &lStr,stringstream &lTitleStr,
218
                          IPhysicalManagerP manager,int humansNum);
219
 };
220
 
221
@@ -466,13 +460,13 @@
222
   virtual ScenarioType get_scenario_type() {return JAPAN_TOWN;}
223
 
224
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
225
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
226
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
227
                               IPhysicalManagerP);
228
 
229
   virtual void setup_world(WorldP,LocatorP,const DifficultyLevel &);
230
   virtual void new_level(int level,WorldP world,LocatorP locator,
231
                          const DifficultyLevel &dLevel,
232
-                         ostrstream &lStr,ostrstream &lTitleStr,
233
+                         stringstream &lStr,stringstream &lTitleStr,
234
                          IPhysicalManagerP manager,int humansNum);
235
 
236
   virtual void filter_weapons_and_other_items(LocatorP,int &weaponsNum,
237
@@ -581,7 +575,7 @@
238
 
239
 
240
 int GameStyle::new_level_check(int,WorldP,LocatorP,
241
-                                  int,Boolean &,ostrstream &,Timer &timer,
242
+                                  int,Boolean &,stringstream &,Timer &timer,
243
                                   IPhysicalManagerP) {  
244
   // A timer-based level.
245
   if (timer.ready()) {
246
@@ -791,8 +785,8 @@
247
 
248
 
249
 
250
-void Normal::describe(ostrstream &str) {
251
-  str << "Complete each level/scenario to proceed to the next one." << ends;
252
+void Normal::describe(stringstream &str) {
253
+  str << "Complete each level/scenario to proceed to the next one.";
254
 }
255
 
256
 
257
@@ -852,7 +846,7 @@
258
 
259
 
260
 int Normal::new_level_check(int enemiesPlaying,WorldP w,LocatorP l,
261
-                             int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
262
+                             int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
263
                              IPhysicalManagerP manager) {
264
   GameStyleP delegate = get_delegate();
265
   return delegate->new_level_check(enemiesPlaying,w,l,level,lStrChanged,levelStr,timer,manager);
266
@@ -876,7 +870,7 @@
267
 
268
 void Normal::new_level(int level,WorldP world,LocatorP locator,
269
                        const DifficultyLevel &dLevel,
270
-                       ostrstream &lStr,ostrstream &lTitleStr,
271
+                       stringstream &lStr,stringstream &lTitleStr,
272
                        IPhysicalManagerP manager,int humansNum) {
273
   // Choose which delegate to use.
274
   if (level % NORMAL_SCENARIOS_FREQUENCY == 0) {
275
@@ -934,11 +928,10 @@
276
 
277
 
278
 
279
-void Levels::describe(ostrstream &str) {
280
+void Levels::describe(stringstream &str) {
281
   str << "Human player(s) fights through increasing levels of "
282
 	    << "difficulty." << "\n" 
283
-	    << "To complete a level you must kill all enemy players." 
284
-	    << ends;
285
+	    << "To complete a level you must kill all enemy players.";
286
 }
287
 
288
 
289
@@ -969,7 +962,7 @@
290
 
291
 
292
 int Levels::new_level_check(int enemiesPlaying,WorldP,LocatorP,
293
-                              int,Boolean &,ostrstream &,Timer &,
294
+                              int,Boolean &,stringstream &,Timer &,
295
                               IPhysicalManagerP) {
296
   if (enemiesPlaying == 0) {
297
     return 1;
298
@@ -983,7 +976,7 @@
299
 
300
 void Levels::new_level(int level,WorldP world,LocatorP locator,
301
                        const DifficultyLevel &dLevel,
302
-                       ostrstream &lStr,ostrstream &lTitleStr,
303
+                       stringstream &lStr,stringstream &lTitleStr,
304
                        IPhysicalManagerP manager,int) {
305
   world->reset();  
306
 
307
@@ -991,8 +984,8 @@
308
   clean_physicals(False,world,locator,manager);
309
 
310
 
311
-  lTitleStr << "[" << level << "] Kill All Machines" << ends;
312
-  lStr << "Level: " << level << ends;
313
+  lTitleStr << "[" << level << "] Kill All Machines";
314
+  lStr << "Level: " << level;
315
 
316
   enemiesNum += dLevel.enemiesIncr;
317
   enemiesNum = Utils::minimum(enemiesNum,dLevel.enemiesMax);
318
@@ -1037,8 +1030,8 @@
319
 
320
 
321
 
322
-void KillKillKill::describe(ostrstream &str) {
323
-  str << "Every human and machine for him/her/itself." << ends;
324
+void KillKillKill::describe(stringstream &str) {
325
+  str << "Every human and machine for him/her/itself.";
326
 }
327
 
328
 
329
@@ -1095,15 +1088,15 @@
330
 
331
 void KillKillKill::new_level(int level,WorldP world,LocatorP locator,
332
                              const DifficultyLevel &,
333
-                             ostrstream &lStr,ostrstream &lTitleStr,
334
+                             stringstream &lStr,stringstream &lTitleStr,
335
                              IPhysicalManagerP manager,int) {
336
   world->reset();
337
 
338
   // Don't wipe out the Enemies.
339
   clean_physicals(True,world,locator,manager);
340
 
341
-  lTitleStr << "Level: " << level << ends;
342
-  lStr << "Level: " << level << ends;
343
+  lTitleStr << "Level: " << level;
344
+  lStr << "Level: " << level;
345
 
346
   // Only create enemies first time or if enemiesRefill is set.
347
   if (justReset) {
348
@@ -1152,9 +1145,9 @@
349
 
350
 
351
 
352
-void Duel::describe(ostrstream &str) {
353
+void Duel::describe(stringstream &str) {
354
   str << "Human vs. human battle to the death." 
355
-	    << "\n" << "Each human has 3 lives." << ends;
356
+	    << "\n" << "Each human has 3 lives.";
357
 }
358
 
359
 
360
@@ -1207,13 +1200,13 @@
361
 
362
 void Duel::new_level(int level,WorldP world,LocatorP locator,
363
                      const DifficultyLevel &,
364
-                     ostrstream &lStr,ostrstream &lTitleStr,
365
+                     stringstream &lStr,stringstream &lTitleStr,
366
                      IPhysicalManagerP manager,int) {
367
   world->reset();
368
   clean_physicals(False,world,locator,manager);
369
 
370
-  lTitleStr << "Level: " << level << ends;
371
-  lStr << "Level: " << level << ends;
372
+  lTitleStr << "Level: " << level;
373
+  lStr << "Level: " << level;
374
 
375
   // Only create enemies first time.
376
   if (justReset) {
377
@@ -1256,9 +1249,9 @@
378
 
379
 
380
 
381
-void ExtendedDuel::describe(ostrstream &str) {
382
+void ExtendedDuel::describe(stringstream &str) {
383
   str << "Human vs. human battle to the death." 
384
-	    << "\n" << "Unlimited lives." << ends;
385
+	    << "\n" << "Unlimited lives.";
386
 }
387
 
388
 
389
@@ -1318,13 +1311,13 @@
390
 
391
 void ExtendedDuel::new_level(int level,WorldP world,LocatorP locator,
392
                              const DifficultyLevel &,
393
-                             ostrstream &lStr,ostrstream &lTitleStr,
394
+                             stringstream &lStr,stringstream &lTitleStr,
395
                              IPhysicalManagerP manager,int) {
396
   world->reset();
397
   clean_physicals(False,world,locator,manager);
398
 
399
-  lTitleStr << "Level: " << level << ends;
400
-  lStr << "Level: " << level << ends;
401
+  lTitleStr << "Level: " << level;
402
+  lStr << "Level: " << level;
403
 
404
   // Only create enemies first time.
405
   if (justReset) {
406
@@ -1367,8 +1360,8 @@
407
 
408
 
409
 
410
-void Training::describe(ostrstream &str) {
411
-  str << "No enemies.  Useful for learning the controls." << ends;
412
+void Training::describe(stringstream &str) {
413
+  str << "No enemies.  Useful for learning the controls.";
414
 }
415
 
416
 
417
@@ -1392,13 +1385,13 @@
418
 
419
 void Training::new_level(int level,WorldP world,LocatorP locator,
420
                         const DifficultyLevel &,
421
-                        ostrstream &lStr,ostrstream &lTitleStr,
422
+                        stringstream &lStr,stringstream &lTitleStr,
423
                         IPhysicalManagerP manager,int) {
424
   world->reset();
425
   clean_physicals(False,world,locator,manager);
426
 
427
-  lTitleStr << "Level: " << level << ends;
428
-  lStr << "Level: " << level << ends;
429
+  lTitleStr << "Level: " << level;
430
+  lStr << "Level: " << level;
431
 }
432
 
433
 
434
@@ -1428,10 +1421,10 @@
435
 
436
 
437
 
438
-void Scenarios::describe(ostrstream &str) {
439
+void Scenarios::describe(stringstream &str) {
440
   str << "A number of different scenarios." << "\n"
441
 	    << "You must complete each scenario to continue on to the "
442
-	    << "next one." << ends;
443
+	    << "next one.";
444
 }
445
 
446
 
447
@@ -1499,7 +1492,7 @@
448
 
449
 int Scenarios::new_level_check(int enemiesPlaying,WorldP w,LocatorP l,
450
                              int level,Boolean &lStrChanged,
451
-                               ostrstream &levelStr,Timer &timer,
452
+                               stringstream &levelStr,Timer &timer,
453
                              IPhysicalManagerP manager) {
454
   assert(scenario);
455
   return scenario->new_level_check(enemiesPlaying,w,l,level,
456
@@ -1534,7 +1527,7 @@
457
 
458
 void Scenarios::new_level(int level,WorldP world,LocatorP locator,
459
                        const DifficultyLevel &dLevel,
460
-                       ostrstream &lStr,ostrstream &lTitleStr,
461
+                       stringstream &lStr,stringstream &lTitleStr,
462
                        IPhysicalManagerP manager,int humansNum) {
463
   // Works even if scenario is NULL.
464
   if (!scenario || scenario->advance_level()) {
465
@@ -1804,7 +1797,7 @@
466
 
467
 
468
 int Exterminate::new_level_check(int enemiesPlaying,WorldP,LocatorP,
469
-                                 int,Boolean &,ostrstream &,Timer &,
470
+                                 int,Boolean &,stringstream &,Timer &,
471
                                  IPhysicalManagerP) {
472
   if (enemiesPlaying == 0) {
473
     return 1;
474
@@ -1822,10 +1815,10 @@
475
 
476
 void Exterminate::new_level(int level,WorldP,LocatorP,
477
                             const DifficultyLevel &dLevel,
478
-                            ostrstream &lStr,ostrstream &lTitleStr,
479
+                            stringstream &lStr,stringstream &lTitleStr,
480
                             IPhysicalManagerP manager,int) {
481
-  lTitleStr << "[" << level << "] EXTERMINATE" << ends;
482
-  lStr << "[" << level << "] EXTERMINATE\nKill all machines." << ends;
483
+  lTitleStr << "[" << level << "] EXTERMINATE";
484
+  lStr << "[" << level << "] EXTERMINATE\nKill all machines.";
485
 
486
   // Doesn't increment like LEVELS game style
487
   enemiesNum = dLevel.enemiesIncr;
488
@@ -1852,7 +1845,7 @@
489
 
490
 int Bonus::new_level_check(int,WorldP,LocatorP locator,
491
                            int level,Boolean &lStrChanged,
492
-                           ostrstream &levelStr,Timer &timer,
493
+                           stringstream &levelStr,Timer &timer,
494
                            IPhysicalManagerP) {
495
   // Ran out of time.
496
   if (timer.ready()) {
497
@@ -1873,13 +1866,13 @@
498
   if (remaining != frogsRemaining) {
499
     frogsRemaining = remaining;
500
     levelStr << "[" << level << "] BONUS LEVEL\nfrogs remaining: " 
501
-	      << remaining << ends;
502
+	      << remaining;
503
     lStrChanged = True;
504
     if (remaining > 0) {
505
-	    ostrstream arenaStr;
506
+	    stringstream arenaStr;
507
 	    arenaStr << remaining << " Frog" << 
508
-	      (remaining > 1 ? "s" : "") << " Remaining" << ends;
509
-	    locator->arena_message_enq(arenaStr.str());
510
+	      (remaining > 1 ? "s" : "") << " Remaining";
511
+	    locator->arena_message_enq(Utils::strdup(arenaStr.str().c_str()));
512
     }
513
 
514
     // Will only be called once per level.
515
@@ -1907,7 +1900,7 @@
516
 
517
 void Bonus::new_level(int level,WorldP world,LocatorP locator,
518
                       const DifficultyLevel &,
519
-                      ostrstream &lStr,ostrstream &lTitleStr,
520
+                      stringstream &lStr,stringstream &lTitleStr,
521
                       IPhysicalManagerP manager,int) {
522
   // Create frogs
523
   for (int n = 0; n < SCENARIO_BONUS_FROGS; n++) {
524
@@ -1940,9 +1933,9 @@
525
   frogsRemaining = SCENARIO_BONUS_FROGS;
526
 
527
   lTitleStr << "[" << level << "] Bonus Level: Kill " 
528
-		  << (int)SCENARIO_BONUS_FROGS << " Frogs"  << ends;
529
+		  << (int)SCENARIO_BONUS_FROGS << " Frogs";
530
   lStr << "[" << level << "] BONUS LEVEL\nfrogs remaining: " 
531
-	     << (int)SCENARIO_BONUS_FROGS << ends;
532
+	     << (int)SCENARIO_BONUS_FROGS;
533
 }
534
 
535
 
536
@@ -1960,7 +1953,7 @@
537
 
538
 
539
 int Hive::new_level_check(int,WorldP,LocatorP locator,
540
-                          int,Boolean &,ostrstream &,Timer &,
541
+                          int,Boolean &,stringstream &,Timer &,
542
                           IPhysicalManagerP) {
543
   PhysicalP xit = locator->lookup(xitId);
544
   assert(xit); // The Xit should never be destroyed.
545
@@ -1987,7 +1980,7 @@
546
 
547
 void Hive::new_level(int level,WorldP world,LocatorP locator,
548
                      const DifficultyLevel &,
549
-                     ostrstream &lStr,ostrstream &lTitleStr,
550
+                     stringstream &lStr,stringstream &lTitleStr,
551
                      IPhysicalManagerP manager,int) {
552
 	// Aliens are created in Game::clock.
553
 
554
@@ -2012,8 +2005,8 @@
555
     locator->add(egg);
556
   }
557
   
558
-  lTitleStr << "[" << level << "] HIVE" << ends;
559
-  lStr << "[" << level << "] HIVE.\nFind the exit." << ends;
560
+  lTitleStr << "[" << level << "] HIVE";
561
+  lStr << "[" << level << "] HIVE.\nFind the exit.";
562
 }
563
 
564
 
565
@@ -2073,7 +2066,7 @@
566
 
567
 
568
 int CaptureTheFlag::new_level_check(int,WorldP,LocatorP locator,
569
-                                    int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &,
570
+                                    int level,Boolean &lStrChanged,stringstream &levelStr,Timer &,
571
                                     IPhysicalManagerP manager) {
572
   int fRemaining = 0;
573
   for (int n = 0; n < SCENARIO_FLAG_FLAGS; n++) {
574
@@ -2091,19 +2084,19 @@
575
     flagsRemaining = fRemaining;
576
     levelStr <<  "[" <<  level <<  "] COLLECT " 
577
 	     <<  (int)SCENARIO_FLAG_FLAGS 
578
-	     << " FLAGS\nremaining: "<<  flagsRemaining <<   ends;
579
+	     << " FLAGS\nremaining: "<<  flagsRemaining;
580
     lStrChanged = True;
581
 
582
-    ostrstream arenaStr;
583
+    stringstream arenaStr;
584
     if (fRemaining != 0) {
585
       arenaStr << flagsRemaining << " Flag" <<
586
-	      (flagsRemaining > 1 ? "s" : "") << " Remaining" << ends;
587
+	      (flagsRemaining > 1 ? "s" : "") << " Remaining";
588
     }
589
     else {
590
-      arenaStr << "All Flags Collected" << ends;
591
+      arenaStr << "All Flags Collected";
592
     }
593
       
594
-    locator->arena_message_enq(arenaStr.str());
595
+    locator->arena_message_enq(Utils::strdup(arenaStr.str().c_str()));
596
   }
597
 
598
   if (fRemaining == 0) { // All flags are gone, so end level.
599
@@ -2124,7 +2117,7 @@
600
 
601
 void CaptureTheFlag::new_level(int level,WorldP world,LocatorP locator,
602
                                const DifficultyLevel &,
603
-                               ostrstream &lStr,ostrstream &lTitleStr,
604
+                               stringstream &lStr,stringstream &lTitleStr,
605
                                IPhysicalManagerP,int) {
606
   for (int n = 0; n < SCENARIO_FLAG_FLAGS; n++) {
607
 	  Pos pos = world->empty_accessible_rect(Flag::get_size_max());
608
@@ -2136,9 +2129,9 @@
609
   flagsRemaining = SCENARIO_FLAG_FLAGS;
610
 
611
   lTitleStr << "[" << level << "] Capture The Flag: " 
612
-		  << (int)SCENARIO_FLAG_FLAGS << " Flags" << ends;
613
+		  << (int)SCENARIO_FLAG_FLAGS << " Flags";
614
   lStr << "[" << level << "] COLLECT " << (int)SCENARIO_FLAG_FLAGS 
615
-	     << " FLAGS.\nremaining: " << (int)SCENARIO_FLAG_FLAGS << ends;
616
+	     << " FLAGS.\nremaining: " << (int)SCENARIO_FLAG_FLAGS;
617
 }
618
 
619
 
620
@@ -2169,7 +2162,7 @@
621
 
622
 void GenericSeals::new_level(int level,WorldP world,LocatorP locator,
623
                          const DifficultyLevel &,
624
-                         ostrstream &lStr,ostrstream &lTitleStr,
625
+                         stringstream &lStr,stringstream &lTitleStr,
626
                          IPhysicalManagerP,int) {
627
   // Add a team for each human in the game.
628
   // Don't use locator->humans_registered() because they may not have been
629
@@ -2298,7 +2291,7 @@
630
 
631
 
632
 int Seals::new_level_check(int,WorldP,LocatorP locator,
633
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &,
634
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &,
635
                               IPhysicalManagerP) {  
636
   int lemOut,lemSafe,lemActive,lemDead;
637
   compute_out_safe_active_dead(locator,lemOut,lemSafe,lemActive,lemDead);
638
@@ -2312,10 +2305,10 @@
639
 
640
     // Only update arena string if sealsSafe has changed.
641
     if (lemSafe != sealsSafe && lemSafe != SCENARIO_SEALS_NEED) {
642
-      ostrstream arenaStr;
643
+      stringstream arenaStr;
644
       arenaStr << "Save " << (SCENARIO_SEALS_NEED - lemSafe)
645
-               << " More Baby Seals" << ends;
646
-      locator->arena_message_enq(arenaStr.str());
647
+               << " More Baby Seals";
648
+      locator->arena_message_enq(Utils::strdup(arenaStr.str().c_str()));
649
     }
650
 
651
     sealsSafe = lemSafe;
652
@@ -2324,18 +2317,17 @@
653
     levelStr << "[" << level << "] SAVE " 
654
             << (int)SCENARIO_SEALS_NEED << " BABY SEALS\n" 
655
             << "out: " << sealsOut << " safe: " << sealsSafe
656
-            << " dead: " << lemDead
657
-            << ends;
658
+            << " dead: " << lemDead;
659
     lStrChanged = True;
660
 
661
     // New level if enough seals are safe or too many are dead.
662
     if (lemDead > (SCENARIO_SEALS_SEALS - SCENARIO_SEALS_NEED)
663
 	      || lemSafe >= SCENARIO_SEALS_NEED) {
664
       if (lemSafe < SCENARIO_SEALS_NEED) {
665
-	      ostrstream msg;
666
+	      stringstream msg;
667
 	      msg << "YOU FAILED TO SAVE " << (int)SCENARIO_SEALS_NEED
668
-	          << " BABY SEALS. TRY THIS LEVEL AGAIN." << ends;
669
-	      locator->arena_message_enq(msg.str());
670
+	          << " BABY SEALS. TRY THIS LEVEL AGAIN.";
671
+	      locator->arena_message_enq(Utils::strdup(msg.str().c_str()));
672
       }
673
       else {
674
         locator->arena_message_enq(Utils::strdup("Good work.  Go to the next level."));
675
@@ -2365,11 +2357,10 @@
676
 
677
 
678
   
679
-void Seals::set_level_strings(int level,ostrstream &lStr,ostrstream &lTitleStr) {
680
-  lTitleStr << "[" << level << "] SAVE THE BABY SEALS" << ends;
681
+void Seals::set_level_strings(int level,stringstream &lStr,stringstream &lTitleStr) {
682
+  lTitleStr << "[" << level << "] SAVE THE BABY SEALS";
683
   lStr << "[" << level << "] SAVE "<< 
684
-	  (int)SCENARIO_SEALS_NEED << " BABY SEALS\n" 
685
-	     << "out: 0 safe: 0 dead: 0" << ends;
686
+	  (int)SCENARIO_SEALS_NEED << " BABY SEALS\n" << "out: 0 safe: 0 dead: 0";
687
 }
688
 
689
 
690
@@ -2430,7 +2421,7 @@
691
 
692
 
693
 int AntiSeals::new_level_check(int,WorldP,LocatorP locator,
694
-                                  int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &,
695
+                                  int level,Boolean &lStrChanged,stringstream &levelStr,Timer &,
696
                                   IPhysicalManagerP) {  
697
   // level not over by default.
698
   int ret = -1;
699
@@ -2441,15 +2432,13 @@
700
 
701
   // Failure
702
   if (lemSafe > SCENARIO_ANTI_SEALS_MAX_SLIPPAGE) {
703
-	  ostrstream msg;
704
 #if 0
705
     // Not enough space on screen, need two lines.
706
 	  msg << "YOU LET TOO MANY OF THE FAT BASTARDS GET AWAY\n"
707
 	      << "Try this level again" << ends;
708
 #else
709
-	  msg << "YOU LET TOO MANY OF THE FAT BASTARDS GET AWAY" << ends;
10
 #endif
710
 #endif
711
-	  locator->arena_message_enq(msg.str());
712
+	  locator->arena_message_enq(Utils::strdup("YOU LET TOO MANY OF THE FAT BASTARDS GET AWAY"));
713
 
714
     // start new level
715
     ret = 1;
716
@@ -2473,13 +2462,11 @@
717
       }
718
       // Update UI
719
       else if (lemSafe == sealsSafe) {  // o.w. the "one got away" message takes priority
720
-        ostrstream arenaStr;
721
-        arenaStr << "Kill "
722
-          << lemToKill << " More Baby Seals" << ends;
723
-        locator->arena_message_enq(arenaStr.str());
724
+        stringstream arenaStr;
725
+        arenaStr << "Kill " << lemToKill << " More Baby Seals";
726
+        locator->arena_message_enq(Utils::strdup(arenaStr.str().c_str()));
727
 
728
-        levelStr << "[" << level << "] KILL " 
729
-                << lemToKill << " BABY SEALS" << ends;
730
+        levelStr << "[" << level << "] KILL " << lemToKill << " BABY SEALS";
731
         lStrChanged = True;
732
       }
733
     }  // lemDead != sealsDead
734
@@ -2502,10 +2489,10 @@
735
 
736
 
737
   
738
-void AntiSeals::set_level_strings(int level,ostrstream &lStr,ostrstream &lTitleStr) {
739
-  lTitleStr << "[" << level << "] KILL THE BABY SEALS" << ends;
740
+void AntiSeals::set_level_strings(int level,stringstream &lStr,stringstream &lTitleStr) {
741
+  lTitleStr << "[" << level << "] KILL THE BABY SEALS";
742
   lStr << "[" << level << "] KILL "<< 
743
-	  (int)SCENARIO_SEALS_SEALS << " BABY SEALS" << ends;
744
+	  (int)SCENARIO_SEALS_SEALS << " BABY SEALS";
745
 }
746
 
747
 
748
@@ -2552,7 +2539,7 @@
749
 
750
 
751
 int KillTheFireDemon::new_level_check(int enemiesPlaying,WorldP,LocatorP locator,
752
-                                   int,Boolean &,ostrstream &,Timer &,
753
+                                   int,Boolean &,stringstream &,Timer &,
754
                                    IPhysicalManagerP) {
755
   if (enemiesPlaying == 0) {
756
     locator->arena_message_enq(Utils::strdup("Take That, You Mother-Fucking Spawn From Hell"));
757
@@ -2572,12 +2559,12 @@
758
 
759
 void KillTheFireDemon::new_level(int level,WorldP,LocatorP,
760
                                  const DifficultyLevel &,
761
-                                 ostrstream &lStr,ostrstream &lTitleStr,
762
+                                 stringstream &lStr,stringstream &lTitleStr,
763
                                  IPhysicalManagerP manager,int) {
764
   manager->create_enemy(manager->enemy_physical(A_FireDemon));
765
 
766
-  lTitleStr << "[" << level << "] FIRE DEMON" << ends;
767
-  lStr << "[" << level << "] Kill the Fire Demon." << ends;
768
+  lTitleStr << "[" << level << "] FIRE DEMON";
769
+  lStr << "[" << level << "] Kill the Fire Demon.";
770
 }
771
 
772
 
773
@@ -2594,7 +2581,7 @@
774
 
775
 
776
 int KillTheDragon::new_level_check(int enemiesPlaying,WorldP,LocatorP locator,
777
-                                   int,Boolean &,ostrstream &,Timer &,
778
+                                   int,Boolean &,stringstream &,Timer &,
779
                                    IPhysicalManagerP) {
780
   if (enemiesPlaying == 0) {
781
     locator->arena_message_enq(Utils::strdup("The Infernal Worm has been vanquished"));
782
@@ -2614,7 +2601,7 @@
783
 
784
 void KillTheDragon::new_level(int level,WorldP w,LocatorP l,
785
                                  const DifficultyLevel &,
786
-                                 ostrstream &lStr,ostrstream &lTitleStr,
787
+                                 stringstream &lStr,stringstream &lTitleStr,
788
                                  IPhysicalManagerP manager,int) {
789
   const PhysicalContext *cx = &Dragon::creatureContext.movingContext.physicalContext;
790
   Pos pos = w->empty_rect(cx->sizeMax);
791
@@ -2628,8 +2615,8 @@
792
     manager->create_enemy(p,False);
793
   }
794
 
795
-  lTitleStr << "[" << level << "] Dragon" << ends;
796
-  lStr << "[" << level << "] Kill the Dragon." << ends;
797
+  lTitleStr << "[" << level << "] Dragon";
798
+  lStr << "[" << level << "] Kill the Dragon.";
799
 }
11
 
800
 
12
 #if WIN32
801
 
13
@@ -2680,7 +2681,7 @@
802
@@ -2667,7 +2654,7 @@
803
 
804
 
805
 int ZigZag::new_level_check(int,WorldP world,LocatorP locator,
806
-                            int,Boolean &,ostrstream &,Timer &,
807
+                            int,Boolean &,stringstream &,Timer &,
808
                             IPhysicalManagerP) {
809
   PhysicalP xit = locator->lookup(xitId);
810
   assert(xit); // The Xit should never be destroyed.
811
@@ -2680,7 +2667,7 @@
14
     HumanP human = locator->get_human(n);
812
     HumanP human = locator->get_human(n);
15
     if (human) {
813
     if (human) {
16
       // previous depth
814
       // previous depth
17
-      int depthOld = (int)human->get_data();
815
-      int depthOld = (int)human->get_data();
18
+      intptr_t depthOld = (intptr_t)human->get_data();
816
+      long depthOld = (long)human->get_data();
19
       Id id = human->get_id();
817
       Id id = human->get_id();
20
 
818
 
21
       // Get physical for intelligence
819
       // Get physical for intelligence
820
@@ -2697,9 +2684,9 @@
821
 	        human->set_data((void *)depth);
822
 
823
           // Use 1-based counting for the User.
824
-	        ostrstream str;
825
-	        str << "Depth " << (depth + 1) << ends;
826
-	        locator->arena_message_enq(str.str(),p);
827
+	        stringstream str;
828
+	        str << "Depth " << (depth + 1);
829
+	        locator->arena_message_enq(Utils::strdup(str.str().c_str()),p);
830
         }
831
       }
832
   	}
833
@@ -2718,7 +2705,7 @@
834
 
835
 void ZigZag::new_level(int level,WorldP world,LocatorP locator,
836
                        const DifficultyLevel &,
837
-                       ostrstream &lStr,ostrstream &lTitleStr,
838
+                       stringstream &lStr,stringstream &lTitleStr,
839
                        IPhysicalManagerP,int) {
840
   Rooms worldRooms = world->get_rooms();
841
   RoomIndex upperRight(0,worldRooms.acrossMax - 1);
842
@@ -2731,9 +2718,8 @@
843
   xitId = p->get_id();
844
 
845
   // 1-based counting of depth for the user.
846
-  lTitleStr << "[" << level << "] ZIG-ZAG: Depth " 
847
-		  << worldRooms.downMax << ends;
848
-  lStr << "[" << level << "] ZIG-ZAG.\nFind the exit." << ends;
849
+  lTitleStr << "[" << level << "] ZIG-ZAG: Depth " << worldRooms.downMax;
850
+  lStr << "[" << level << "] ZIG-ZAG.\nFind the exit.";
851
 }
852
 
853
 
854
@@ -2761,7 +2747,7 @@
855
 
856
 
857
 int ThePound::new_level_check(int enemiesPlaying,WorldP,LocatorP locator,
858
-                              int,Boolean &,ostrstream &,Timer &,
859
+                              int,Boolean &,stringstream &,Timer &,
860
                               IPhysicalManagerP) {
861
   if (enemiesPlaying == 0) {
862
     locator->arena_message_enq(Utils::strdup("Killed the Mutts"));
863
@@ -2781,7 +2767,7 @@
864
 
865
 void ThePound::new_level(int level,WorldP,LocatorP locator,
866
                          const DifficultyLevel &,
867
-                         ostrstream &lStr,ostrstream &lTitleStr,
868
+                         stringstream &lStr,stringstream &lTitleStr,
869
                          IPhysicalManagerP manager,int) {
870
   locator->add_team(Scenarios::dog_team,NULL);
871
 
872
@@ -2789,8 +2775,8 @@
873
     manager->create_enemy(manager->enemy_physical(A_Dog));
874
   }
875
 
876
-  lTitleStr << "[" << level << "] The Pound" << ends;
877
-  lStr << "[" << level << "] The Pound" << ends;
878
+  lTitleStr << "[" << level << "] The Pound";
879
+  lStr << "[" << level << "] The Pound";
880
 }
881
 
882
 
883
@@ -2801,7 +2787,7 @@
884
 
885
 
886
 int JapanTown::new_level_check(int enemiesPlaying,WorldP,LocatorP locator,
887
-                              int,Boolean &,ostrstream &,Timer &,
888
+                              int,Boolean &,stringstream &,Timer &,
889
                               IPhysicalManagerP) {
890
   if (enemiesPlaying == 0) {
891
     locator->arena_message_enq(Utils::strdup("Damn Ninjas.  Worse than roaches."));
892
@@ -2821,7 +2807,7 @@
893
 
894
 void JapanTown::new_level(int level,WorldP,LocatorP locator,
895
                          const DifficultyLevel &,
896
-                         ostrstream &lStr,ostrstream &lTitleStr,
897
+                         stringstream &lStr,stringstream &lTitleStr,
898
                          IPhysicalManagerP manager,int) {
899
   locator->add_team(JapanTown::ninja_team,NULL);
900
 
901
@@ -2829,8 +2815,8 @@
902
     manager->create_enemy(manager->enemy_physical(A_Ninja));
903
   }
904
 
905
-  lTitleStr << "[" << level << "] Japan-Town" << ends;
906
-  lStr << "[" << level << "] Japan-Town" << ends;
907
+  lTitleStr << "[" << level << "] Japan-Town";
908
+  lStr << "[" << level << "] Japan-Town";
909
 }
910
 
911
 
(-)games/xevil/files/patch-cmn::game_style.h (-8 / +197 lines)
Lines 1-12 Link Here
1
--- cmn/game_style.h.dist	Sat Mar 22 20:22:30 2003
1
--- cmn/game_style.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ cmn/game_style.h	Sat Oct 25 21:41:50 2003
2
+++ cmn/game_style.h	2012-05-27 06:53:11.000000000 +0900
3
@@ -31,7 +31,8 @@
3
@@ -30,12 +30,7 @@
4
 	#endif
4
 #endif 
5
 #endif 
5
 
6
 
6
 #if X11
7
-#if X11
7
-#include <strstream.h>
8
-#include <strstream.h>
8
+#include <strstream>
9
-#endif
10
-#if WIN32
11
-#include <strstrea.h>
12
-#endif
13
+#include <sstream>
14
 
15
 #include "utils.h"
16
 #include "coord.h"
17
@@ -44,6 +39,8 @@
18
 #include "intel.h"
19
 
20
 
9
+using namespace std;
21
+using namespace std;
10
 #endif
22
+
11
 #if WIN32
23
 #define SCENARIO_SEALS_TRAPDOORS 2
12
 #include <strstrea.h>
24
 #define SCENARIO_BONUS_FROGS 12
25
 #define SCENARIO_FLAG_FLAGS 15
26
@@ -91,7 +88,7 @@
27
   
28
   virtual GameStyle *clone() = 0;
29
   
30
-  virtual void describe(ostrstream &) = 0;
31
+  virtual void describe(stringstream &) = 0;
32
   /* EFFECTS: Write a two-line description of the style to the stream. */
33
 
34
   virtual GameStyleType get_type() = 0;
35
@@ -137,7 +134,7 @@
36
 
37
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
38
                               int level,
39
-                              Boolean &lStrChanged,ostrstream &levelStr,
40
+                              Boolean &lStrChanged,stringstream &levelStr,
41
                               Timer &timer,
42
                               IPhysicalManagerP);
43
   /* MODIFIES: lStrChanged */
44
@@ -166,7 +163,7 @@
45
 
46
   virtual void new_level(int level,WorldP,LocatorP,
47
                          const DifficultyLevel &dLevel,
48
-                         ostrstream &levelStr,ostrstream &levelTitleStr,
49
+                         stringstream &levelStr,stringstream &levelTitleStr,
50
                          IPhysicalManagerP,int humansNum) = 0;
51
   /* MODIFIES: level */
52
   /* EFFECTS: Start a new level.  Use levelStr levelTitleStr to 
53
@@ -249,7 +246,7 @@
54
 
55
   virtual GameStyleP clone();
56
 
57
-  virtual void describe(ostrstream &);
58
+  virtual void describe(stringstream &);
59
   
60
   virtual GameStyleType get_type();
61
 
62
@@ -269,7 +266,7 @@
63
 
64
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
65
                               int level,Boolean &lStrChanged,
66
-                              ostrstream &levelStr,Timer &timer,
67
+                              stringstream &levelStr,Timer &timer,
68
                               IPhysicalManagerP);
69
 
70
   virtual Boolean advance_level();
71
@@ -277,7 +274,7 @@
72
   virtual Boolean award_bonus();
73
 
74
   virtual void new_level(int level,WorldP,LocatorP,const DifficultyLevel &dLevel,
75
-                         ostrstream &levelStr,ostrstream &levelTitleStr,
76
+                         stringstream &levelStr,stringstream &levelTitleStr,
77
                          IPhysicalManagerP,int humansNum);
78
 
79
   virtual void new_level_set_timer(Timer &timer);
80
@@ -305,7 +302,7 @@
81
   
82
   virtual GameStyleP clone();
83
 
84
-  virtual void describe(ostrstream &);
85
+  virtual void describe(stringstream &);
86
   
87
   virtual GameStyleType get_type();
88
 
89
@@ -314,11 +311,11 @@
90
   virtual void reset(WorldP,LocatorP,const DifficultyLevel &,int enemiesNumNext);
91
 
92
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
93
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
94
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
95
                               IPhysicalManagerP);
96
 
97
   virtual void new_level(int level,WorldP,LocatorP,const DifficultyLevel &dLevel,
98
-                         ostrstream &levelStr,ostrstream &levelTitleStr,
99
+                         stringstream &levelStr,stringstream &levelTitleStr,
100
                          IPhysicalManagerP,int humansNum);
101
 
102
   virtual void new_level_set_timer(Timer &timer);
103
@@ -340,7 +337,7 @@
104
 
105
   virtual GameStyleP clone();
106
 
107
-  virtual void describe(ostrstream &);
108
+  virtual void describe(stringstream &);
109
 
110
   virtual GameStyleType get_type();
111
 
112
@@ -355,7 +352,7 @@
113
   virtual Boolean game_over_check(int humansPlaying,int enemiesPlaying);
114
 
115
   virtual void new_level(int level,WorldP,LocatorP,const DifficultyLevel &dLevel,
116
-                         ostrstream &levelStr,ostrstream &levelTitleStr,
117
+                         stringstream &levelStr,stringstream &levelTitleStr,
118
                          IPhysicalManagerP,int humansNum);
119
 
120
   virtual void refill_enemies(Boolean enemiesRefill,WorldP,LocatorP,IPhysicalManagerP);
121
@@ -376,7 +373,7 @@
122
   
123
   virtual GameStyleP clone();
124
 
125
-  virtual void describe(ostrstream &);
126
+  virtual void describe(stringstream &);
127
 
128
   virtual GameStyleType get_type();
129
 
130
@@ -389,7 +386,7 @@
131
   virtual Boolean game_over_check(int humansPlaying,int enemiesPlaying);
132
 
133
   virtual void new_level(int level,WorldP,LocatorP,const DifficultyLevel &dLevel,
134
-                         ostrstream &levelStr,ostrstream &levelTitleStr,
135
+                         stringstream &levelStr,stringstream &levelTitleStr,
136
                          IPhysicalManagerP,int humansNum);
137
 
138
   virtual void refill_enemies(Boolean enemiesRefill,WorldP,LocatorP,IPhysicalManagerP);
139
@@ -408,7 +405,7 @@
140
   
141
   virtual GameStyleP clone();
142
 
143
-  virtual void describe(ostrstream &);
144
+  virtual void describe(stringstream &);
145
 
146
   virtual GameStyleType get_type();
147
 
148
@@ -423,7 +420,7 @@
149
   virtual Boolean game_over_check(int humansPlaying,int enemiesPlaying);
150
 
151
   virtual void new_level(int level,WorldP,LocatorP,const DifficultyLevel &dLevel,
152
-                         ostrstream &levelStr,ostrstream &levelTitleStr,
153
+                         stringstream &levelStr,stringstream &levelTitleStr,
154
                          IPhysicalManagerP,int humansNum);
155
 
156
   virtual void refill_enemies(Boolean enemiesRefill,WorldP,LocatorP,IPhysicalManagerP);
157
@@ -442,7 +439,7 @@
158
 
159
   virtual GameStyleP clone();
160
 
161
-  virtual void describe(ostrstream &);
162
+  virtual void describe(stringstream &);
163
 
164
   virtual GameStyleType get_type();
165
 
166
@@ -451,7 +448,7 @@
167
   virtual void reset(WorldP,LocatorP,const DifficultyLevel &dLevel,int);
168
 
169
   virtual void new_level(int level,WorldP,LocatorP,const DifficultyLevel &dLevel,
170
-                         ostrstream &levelStr,ostrstream &levelTitleStr,
171
+                         stringstream &levelStr,stringstream &levelTitleStr,
172
                          IPhysicalManagerP,int humansNum);
173
 
174
   virtual void refill_enemies(Boolean enemiesRefill,WorldP,LocatorP,IPhysicalManagerP);
175
@@ -466,7 +463,7 @@
176
 
177
   virtual GameStyleP clone();
178
 
179
-  virtual void describe(ostrstream &);
180
+  virtual void describe(stringstream &);
181
 
182
   virtual GameStyleType get_type();
183
 
184
@@ -485,7 +482,7 @@
185
   virtual void reset(WorldP,LocatorP,const DifficultyLevel &,int enemiesNumNext);
186
 
187
   virtual int new_level_check(int enemiesPlaying,WorldP,LocatorP,
188
-                              int level,Boolean &lStrChanged,ostrstream &levelStr,Timer &timer,
189
+                              int level,Boolean &lStrChanged,stringstream &levelStr,Timer &timer,
190
                               IPhysicalManagerP);
191
 
192
   virtual Boolean advance_level();
193
@@ -493,7 +490,7 @@
194
   virtual Boolean award_bonus();
195
 
196
   virtual void new_level(int level,WorldP,LocatorP,const DifficultyLevel &dLevel,
197
-                         ostrstream &levelStr,ostrstream &levelTitleStr,
198
+                         stringstream &levelStr,stringstream &levelTitleStr,
199
                          IPhysicalManagerP manager,int humansNum);
200
 
201
   virtual void new_level_set_timer(Timer &timer);
(-)games/xevil/files/patch-cmn::intel.cpp (-5 / +102 lines)
Lines 1-12 Link Here
1
--- cmn/intel.cpp.orig	Wed Mar 19 09:49:22 2003
1
--- cmn/intel.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ cmn/intel.cpp	Sat Oct 25 21:42:14 2003
2
+++ cmn/intel.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -35,7 +35,8 @@
3
@@ -35,7 +35,7 @@
4
   #include <string.h>
4
   #include <string.h>
5
 }
5
 }
6
 #if X11
6
 #if X11
7
-#include <strstream.h>
7
-#include <strstream.h>
8
+#include <strstream>
8
+#include <sstream>
9
+using namespace std;
10
 #endif
9
 #endif
11
 #if WIN32
10
 #if WIN32
12
 #include <strstrea.h>
11
 #include <strstrea.h>
12
@@ -50,6 +50,7 @@
13
 #include "xdata.h"
14
 
15
 
16
+using namespace std;
17
 
18
 // Defines
19
 #define FIGHT_RANGE 40 // made it smaller for Dogs 45  // [50-40]
20
@@ -212,7 +213,7 @@
21
 
22
 
23
 
24
-Intel::Intel(WorldP w,LocatorP l,char *name,
25
+Intel::Intel(WorldP w,LocatorP l,const char *name,
26
 	           const IntelOptions *ops,ITmask opMask) {
27
   intelStatusChanged = True;
28
   living = True;
29
@@ -755,7 +756,7 @@
30
 
31
 
32
 
33
-Human::Human(WorldP w,LocatorP l,char *name,int lves,
34
+Human::Human(WorldP w,LocatorP l,const char *name,int lves,
35
              int *sharedLves,ColorNum cNum)
36
 : Intel(w,l,name,NULL,ITnone) {
37
   lives = lves;
38
@@ -931,7 +932,7 @@
39
 
40
 
41
 
42
-Machine::Machine(WorldP w,LocatorP l,char *name,const IntelOptions *ops,
43
+Machine::Machine(WorldP w,LocatorP l,const char *name,const IntelOptions *ops,
44
 		 ITmask opMask) 
45
 : Intel(w,l,name,ops,opMask)
46
 {
47
@@ -1829,7 +1830,7 @@
48
 
49
 
50
 
51
-Enemy::Enemy(WorldP w,LocatorP l,char *name,
52
+Enemy::Enemy(WorldP w,LocatorP l,const char *name,
53
 	const IntelOptions *ops,ITmask opMask)
54
     :Machine(w,l,name,ops,opMask) {}
55
   
56
@@ -1854,7 +1855,7 @@
57
 
58
 
59
 
60
-Neutral::Neutral(WorldP w,LocatorP l,char *name,
61
+Neutral::Neutral(WorldP w,LocatorP l,const char *name,
62
 	const IntelOptions *ops,ITmask opMask)
63
 	  :Machine(w,l,name,ops,opMask) {}
64
   
65
@@ -1867,7 +1868,7 @@
66
 
67
 
68
 
69
-SealIntel::SealIntel(WorldP w,LocatorP l,char *name,const Id &home_id)
70
+SealIntel::SealIntel(WorldP w,LocatorP l,const char *name,const Id &home_id)
71
 :Neutral(w,l,name,NULL,ITnone)
72
 {
73
 //  Timer oTimer(LADDER_JUMP_TIME);
74
@@ -1906,7 +1907,7 @@
75
 
76
 
77
 
78
-DoppelIntel::DoppelIntel(WorldP w,LocatorP l,char *name,
79
+DoppelIntel::DoppelIntel(WorldP w,LocatorP l,const char *name,
80
 	  const IntelOptions *ops,ITmask opMask,IntelP master)
81
 		:Neutral(w,l,name,ops,opMask) {
82
   assert(master);
83
@@ -2073,7 +2074,7 @@
84
 
85
 
86
 
87
-Pet::Pet(WorldP w,LocatorP l,char *name,
88
+Pet::Pet(WorldP w,LocatorP l,const char *name,
89
 	const IntelOptions *ops,ITmask opMask,IntelP master)
90
 	  :DoppelIntel(w,l,name,ops,opMask,master) {
91
 	mode = Heel;
92
@@ -2095,7 +2096,7 @@
93
 	char buffer[80];
94
 	ostrstream str(buffer,80);
95
 	str << "mode changing from:" << Pet::mode_string(prev) <<
96
-		" to: " << Pet::mode_string(curr) << endl << ends;
97
+		" to: " << Pet::mode_string(curr) << endl;
98
 #if WIN32
99
 	TRACE(buffer);
100
 #endif
101
@@ -2308,7 +2309,7 @@
102
 
103
 
104
 
105
-char *Pet::mode_string(int mode) {
106
+const char *Pet::mode_string(int mode) {
107
 	switch (mode) {
108
 		case Heel:		
109
 			return "Heel";
(-)games/xevil/files/patch-cmn::locator.h (-18 / +11 lines)
Lines 1-27 Link Here
1
--- cmn/locator.h.orig	Sat Mar 22 20:35:30 2003
1
--- cmn/locator.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ cmn/locator.h	Fri Oct  6 13:44:36 2006
2
+++ cmn/locator.h	2012-05-27 06:53:11.000000000 +0900
3
@@ -47,7 +47,8 @@
3
@@ -47,7 +47,7 @@
4
 
4
 
5
 
5
 
6
 // Include Files
6
 // Include Files
7
-#include <iostream.h>
7
-#include <iostream.h>
8
+#include <iostream>
8
+#include <iostream>
9
+using namespace std;
10
 
9
 
11
 #include "utils.h"
10
 #include "utils.h"
12
 #include "coord.h"
11
 #include "coord.h"
13
@@ -108,12 +109,12 @@
12
@@ -96,6 +96,8 @@
13
 #define OL_RECENT_SOUNDS_MAX 30
14
 
14
 
15
   
15
 
16
   // Only valid if mapped || flash.
16
+class OLgridEntry;
17
-  OLgridEntry *gridEntry; 
17
+class OLshadowEntry;
18
+  class OLgridEntry *gridEntry; 
18
 
19
   // Set by OLgridEntry::insert.  Not nec. valid.
19
 // An entry for one object in the list of all objects currently in the game.
20
   GLoc gloc; 
20
 class OLentry {
21
 #if X11
22
   // Only valid if mapped || flash.
23
-  OLshadowEntry *shadowEntry; 
24
+  class OLshadowEntry *shadowEntry; 
25
   // Set by OLshadowEntry::insert.  Not nec. valid.
26
   GLoc shadowGloc; 
27
 #endif
(-)games/xevil/files/patch-cmn::physical.cpp (-6 / +172 lines)
Lines 1-25 Link Here
1
--- cmn/physical.cpp.orig	2000-01-19 20:38:14.000000000 +0100
1
--- cmn/physical.cpp.orig	2012-05-27 06:52:30.000000000 +0900
2
+++ cmn/physical.cpp	2007-07-31 15:54:01.000000000 +0200
2
+++ cmn/physical.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -33,10 +33,11 @@
3
@@ -33,10 +33,10 @@
4
 // Include Files
4
 // Include Files
5
 #include "xdata.h"
5
 #include "xdata.h"
6
 #include "physical.h"
6
 #include "physical.h"
7
-#include <iostream.h>
7
-#include <iostream.h>
8
+#include <iostream>
8
+#include <iostream>
9
+using namespace std;
10
 
9
 
11
 #if X11
10
 #if X11
12
-#include <strstream.h>
11
-#include <strstream.h>
13
+#include <strstream>
12
+#include <sstream>
14
 #endif
13
 #endif
15
 #if WIN32
14
 #if WIN32
16
 #include <strstrea.h>
15
 #include <strstrea.h>
16
@@ -54,6 +54,7 @@
17
 
18
 #include "bitmaps/transform/transform.bitmaps"
19
 
20
+using namespace std;
21
 
22
 // Defines
23
 #define VEL_SMALL 1
24
@@ -523,9 +524,9 @@
25
       
26
     if (heat == 0 && heatNext > 0) {
27
       LocatorP l = get_locator();
28
-      ostrstream str;
29
-      str << get_class_name() << " is on fire." << ends;
30
-      locator->message_enq(str.str());
31
+      stringstream str;
32
+      str << get_class_name() << " is on fire.";
33
+      locator->message_enq(Utils::strdup(str.str().c_str()));
34
     }
35
   }
36
   previousHeatWasSecondary = secondary;
17
@@ -1844,7 +1845,7 @@
37
@@ -1844,7 +1845,7 @@
18
   }
38
   }
19
 
39
 
20
   // Use the pixmap resource id as the base.
40
   // Use the pixmap resource id as the base.
21
-  u_int cmnBitsId = (unsigned int)mc->pixmapBits[baseDir][animNum];
41
-  u_int cmnBitsId = (unsigned int)mc->pixmapBits[baseDir][animNum];
22
+  u_int cmnBitsId = (unsigned intptr_t)mc->pixmapBits[baseDir][animNum];
42
+  u_int cmnBitsId = (unsigned long)mc->pixmapBits[baseDir][animNum];
23
 
43
 
24
   // It is ok to call OneTransform::compute_key() even if there is no 
44
   // It is ok to call OneTransform::compute_key() even if there is no 
25
   // transformation, will just return 0x0.  
45
   // transformation, will just return 0x0.  
46
@@ -2556,17 +2557,17 @@
47
 
48
 void Item::die() {
49
   LocatorP locator = get_locator();
50
-  ostrstream msg;
51
+  stringstream msg;
52
   switch (dieMessage) {
53
   case NONE:
54
     break;
55
   case USED:
56
-    msg << get_class_name() << " has been used." << ends;
57
-    locator->message_enq(msg.str());
58
+    msg << get_class_name() << " has been used.";
59
+    locator->message_enq(Utils::strdup(msg.str().c_str()));
60
     break;
61
   case DESTROYED:
62
-    msg << get_class_name() << " is destroyed." << ends;
63
-    locator->message_enq(msg.str());
64
+    msg << get_class_name() << " is destroyed.";
65
+    locator->message_enq(Utils::strdup(msg.str().c_str()));
66
     break;
67
   };
68
 
69
@@ -2650,10 +2651,8 @@
70
   // Prevent non-biologicals from picking up drugs.
71
 
72
   if (p->is_creature() && !((CreatureP)p)->biological()) {
73
-    ostrstream msg;
74
-    msg << "Non-Biological Creatures Cannot Use Drugs" << ends;
75
     LocatorP locator = get_locator();
76
-    locator->arena_message_enq(msg.str(),p);
77
+    locator->arena_message_enq(Utils::strdup("Non-Biological Creatures Cannot Use Drugs"), p);
78
     kill_self();
79
   }
80
   else {
81
@@ -2673,13 +2672,11 @@
82
     assert(context->odChance >= 0);
83
     if (context->odChance && Utils::choose(context->odChance) == 0) {
84
       p->kill_self();
85
-      ostrstream msg;
86
-      msg << p->get_class_name() << " dies from crack overdose." << ends;
87
-      locator->message_enq(msg.str());
88
+      stringstream msg;
89
+      msg << p->get_class_name() << " dies from crack overdose.";
90
+      locator->message_enq(Utils::strdup(msg.str().c_str()));
91
       
92
-      ostrstream arenaMsg;
93
-      arenaMsg << "You Died From Drug Overdose" << ends;
94
-      locator->arena_message_enq(arenaMsg.str(),p);
95
+      locator->arena_message_enq(Utils::strdup("You Died From Drug Overdose"),p);
96
 
97
       set_quiet_death(); // so doesn't report "has been used" message.
98
     }    
99
@@ -2693,9 +2690,7 @@
100
   }
101
   else {
102
     // Shouldn't get here, should kill self when picking it up.
103
-    ostrstream msg;
104
-    msg << "Non-Biological Creatures Cannot Use Drugs" << ends;
105
-    locator->arena_message_enq(msg.str(),p);
106
+    locator->arena_message_enq(Utils::strdup("Non-Biological Creatures Cannot Use Drugs"),p);
107
   }
108
   
109
   kill_self();
110
@@ -4334,14 +4329,14 @@
111
   if (!get_quiet_death() && !alive() && 
112
       (corpseTimer.ready() || (get_health() < - cc->corpseHealth))) {
113
     LocatorP locator = get_locator();
114
-    ostrstream msg;
115
+    stringstream msg;
116
     if (corpseTimer.ready()) {
117
-	    msg << get_class_name() << " corpse has decomposed." << ends;
118
-	    locator->message_enq(msg.str());
119
+	    msg << get_class_name() << " corpse has decomposed.";
120
+	    locator->message_enq(Utils::strdup(msg.str().c_str()));
121
     }
122
     else {
123
-      msg << get_class_name() << " corpse has been destroyed." << ends;
124
-      locator->message_enq(msg.str());
125
+      msg << get_class_name() << " corpse has been destroyed.";
126
+      locator->message_enq(Utils::strdup(msg.str().c_str()));
127
     }
128
     set_delete_me();
129
   }
130
@@ -4399,9 +4394,9 @@
131
     set_vel_next(velNew);
132
     set_stance_next(CO_air);
133
     
134
-    ostrstream msg;
135
-    msg << get_class_name() << " has died." << ends;
136
-    locator->message_enq(msg.str());
137
+    stringstream msg;
138
+    msg << get_class_name() << " has died.";
139
+    locator->message_enq(Utils::strdup(msg.str().c_str()));
140
     
141
     set_no_death_delete();
142
   }
143
@@ -6072,10 +6067,10 @@
144
     }
145
     // If User is already holding the max number of weapons.
146
     else if (weaponsNum >= PH_WEAPONS_MAX) {
147
-      ostrstream msg;
148
-      msg << "Can only hold " << PH_WEAPONS_MAX << " weapons" << ends;          
149
+      stringstream msg;
150
+      msg << "Can only hold " << PH_WEAPONS_MAX << " weapons";
151
       LocatorP locator = cre->get_locator();
152
-      locator->arena_message_enq(msg.str(),cre);
153
+      locator->arena_message_enq(Utils::strdup(msg.str().c_str()),cre);
154
       destroyOther = True;
155
     }
156
     // Actually pick it up.
157
@@ -6124,15 +6119,14 @@
158
   else {
159
     LocatorP locator = cre->get_locator();
160
     if (itemsNum == PH_ITEMS_MAX) {
161
-      ostrstream msg;
162
-      msg << "Can only hold " << PH_ITEMS_MAX << " items" << ends;          
163
-      locator->arena_message_enq(msg.str(),cre);
164
+      stringstream msg;
165
+      msg << "Can only hold " << PH_ITEMS_MAX << " items";
166
+      locator->arena_message_enq(Utils::strdup(msg.str().c_str()),cre);
167
     }
168
     else if (itemClassCount >= ITEM_CLASS_MAX) {
169
-      ostrstream msg;
170
-      msg << "Can only hold " << ITEM_CLASS_MAX 
171
-        << " of any one item" << ends;
172
-      locator->arena_message_enq(msg.str(),cre);
173
+      stringstream msg;
174
+      msg << "Can only hold " << ITEM_CLASS_MAX << " of any one item";
175
+      locator->arena_message_enq(Utils::strdup(msg.str().c_str()),cre);
176
     }
177
 
178
     other->set_quiet_death();
179
@@ -6661,9 +6655,9 @@
180
         ((ItemP)p)->use(cre);
181
       }
182
       else {
183
-        ostrstream str;
184
-        str << "Cannot use " << p->get_class_name() << ends;
185
-        locator->arena_message_enq(str.str(),cre);
186
+        stringstream str;
187
+        str << "Cannot use " << p->get_class_name();
188
+        locator->arena_message_enq(Utils::strdup(str.str().c_str()),cre);
189
       }
190
     }
191
     break;        
(-)games/xevil/files/patch-cmn::role.cpp (-5 / +467 lines)
Lines 1-15 Link Here
1
--- cmn/role.cpp.orig	Wed Jan 19 12:54:34 2000
1
--- cmn/role.cpp.orig	2012-05-27 06:52:30.000000000 +0900
2
+++ cmn/role.cpp	Sat Oct 25 21:43:43 2003
2
+++ cmn/role.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -29,9 +29,10 @@
3
@@ -29,9 +29,9 @@
4
 
4
 
5
 #include "stdafx.h"
5
 #include "stdafx.h"
6
 
6
 
7
-#include <iostream.h>
7
-#include <iostream.h>
8
+#include <iostream>
8
+#include <iostream>
9
+using namespace std;
10
 #if X11
9
 #if X11
11
-#include <strstream.h>
10
-#include <strstream.h>
12
+#include <strstream>
11
+#include <sstream>
13
 #include <time.h>
12
 #include <time.h>
14
 #endif
13
 #endif
15
 #if WIN32
14
 #if WIN32
15
@@ -266,43 +266,39 @@
16
 
17
 
18
 void Role::error(const char *msg1,const char *msg2,const char *msg3) {
19
-  ostrstream str;
20
+  stringstream str;
21
 
22
   if (msg2 == NULL) {
23
-    str << msg1 << ends;
24
+    str << msg1;
25
   }
26
   else if (msg3 == NULL) {
27
-    str << msg1 << msg2 << ends;
28
+    str << msg1 << msg2;
29
   }
30
   else {
31
-    str << msg1 << msg2 << msg3 << ends;
32
+    str << msg1 << msg2 << msg3;
33
   }
34
 
35
   // Call one argument version.
36
-  _error(str.str());
37
-
38
-  delete str.str();
39
+  _error(str.str().c_str());
40
 }
41
 
42
 
43
 
44
 void Role::message(const char *msg1,const char *msg2,const char *msg3) {
45
-  ostrstream str;
46
+  stringstream str;
47
 
48
   if (msg2 == NULL) {
49
-    str << msg1 << ends;
50
+    str << msg1;
51
   }
52
   else if (msg3 == NULL) {
53
-    str << msg1 << msg2 << ends;
54
+    str << msg1 << msg2;
55
   }
56
   else {
57
-    str << msg1 << msg2 << msg3 << ends;
58
+    str << msg1 << msg2 << msg3;
59
   }
60
 
61
   // Call one argument version.
62
-  _message(str.str());
63
-
64
-  delete str.str();
65
+  _message(str.str().c_str());
66
 }
67
 
68
 
69
@@ -605,11 +601,11 @@
70
   // Display message that we are looking up IP address.
71
   // Assumes that caller will call Client::connect_server after a turn or two, 
72
   // so the message will be displayed on the Ui.
73
-  ostrstream str;
74
-  str << "Looking up IP address for server " << serverName << ends;
75
+  stringstream str;
76
+  str << "Looking up IP address for server " << serverName;
77
   // Display for a long time.
78
-  errLocator->arena_message_enq(str.str(),NULL,1000000); 
79
-  errLocator->message_enq(Utils::strdup(str.str()));
80
+  errLocator->arena_message_enq(Utils::strdup(str.str().c_str()),NULL,1000000);
81
+  errLocator->message_enq(Utils::strdup(str.str().c_str()));
82
   // Probably would be better to use Role::message(), but we want it to stay
83
   // up for a long time.  Should add argument to Role::message().
84
 
85
@@ -663,12 +659,10 @@
86
     }
87
   }
88
   if (n == CLIENT_PORT_TRIES) {
89
-    ostrstream str;
90
+    stringstream str;
91
     str << "Could not bind local UDP port to any of " 
92
-        << clientPortBase << "-" << (clientPortBase + CLIENT_PORT_TRIES - 1) 
93
-        << ends;
94
-    error(str.str());
95
-    delete str.str();
96
+        << clientPortBase << "-" << (clientPortBase + CLIENT_PORT_TRIES - 1);
97
+    error(str.str().c_str());
98
     return;    
99
   }
100
   //  cout << "UDP port seems to be" << client.sin_port << endl;
101
@@ -703,22 +697,19 @@
102
 
103
   // Inform user of failed connection
104
   if (!ok()) {
105
-    strstream msg;
106
+    stringstream msg;
107
     msg << "Could not connect to " << serverName << " on port " <<
108
-      port << "." << ends;
109
-    error(msg.str());
110
-    delete(msg.str());
111
+      port << ".";
112
+    error(msg.str().c_str());
113
     delete tcpOut;
114
     return;
115
   }
116
 
117
   // Inform user of successful connection
118
-  strstream msg;
119
+  stringstream msg;
120
   msg << hostName << " connected to " << serverName << " on port " <<
121
-    port << ends;
122
-  message(msg.str());
123
-  delete msg.str();
124
-
125
+    port;
126
+  message(msg.str().c_str());
127
   
128
   // Create TCP and UDP streams.
129
   tcpIn = new NetInStream(tcpSock,False);
130
@@ -967,11 +958,11 @@
131
   Role::_error(msg);
132
 
133
   if (errorLocator) {
134
-    ostrstream str2;
135
-    str2 << "ERROR: " << msg << ends;
136
-    errorLocator->arena_message_enq(str2.str(),NULL,ROLE_FAILED_TIME);
137
+    stringstream str2;
138
+    str2 << "ERROR: " << msg;
139
+    errorLocator->arena_message_enq(Utils::strdup(str2.str().c_str()),NULL,ROLE_FAILED_TIME);
140
     // Don't delete str2.str(), give memory to the Locator.
141
-    errorLocator->message_enq(Utils::strdup(str2.str()));
142
+    errorLocator->message_enq(Utils::strdup(str2.str().c_str()));
143
   }
144
 #if WIN32
145
   // Only the client can afford to block on error messages.
146
@@ -986,11 +977,9 @@
147
   Role::_error(msg);
148
 
149
   if (errorLocator) {
150
-    ostrstream str2;
151
-    str2 << msg << ends;
152
-    errorLocator->arena_message_enq(str2.str());
153
+    errorLocator->arena_message_enq(Utils::strdup(msg));
154
     // Don't delete str2.str(), give memory to the Locator.
155
-    errorLocator->message_enq(Utils::strdup(str2.str()));
156
+    errorLocator->message_enq(Utils::strdup(msg));
157
   }
158
 }
159
 
160
@@ -1256,10 +1245,9 @@
161
   if (turn > turnMax) {
162
     turnMax = turn;
163
     if (echoPingPong) {
164
-      ostrstream str;
165
-      str << "PONG the server with turn " << turnMax << ends;
166
-      message(str.str());
167
-      delete str.str();
168
+      stringstream str;
169
+      str << "PONG the server with turn " << turnMax;
170
+      message(str.str().c_str());
171
     }
172
     // Tell server so it can free turn windows to send more data.
173
     XETP::send_pong(udpOut,turnMax);
174
@@ -1365,10 +1353,9 @@
175
         }
176
       }
177
       else {
178
-        ostrstream str;
179
-        str << "No context for classId " << classId << ends;
180
-        error(str.str());
181
-        delete str.str();
182
+        stringstream str;
183
+        str << "No context for classId " << classId;
184
+        error(str.str().c_str());
185
       }
186
     }
187
   }
188
@@ -1582,9 +1569,9 @@
189
     return Utils::strdup(clientName);
190
   }
191
 
192
-  ostrstream str;
193
-  str << '\"' << intel->get_name() << "\"@" << clientName << ends;
194
-  return str.str();
195
+  stringstream str;
196
+  str << '\"' << intel->get_name() << "\"@" << clientName;
197
+  return Utils::strdup(str.str().c_str());
198
 }
199
 
200
 
201
@@ -1695,11 +1682,10 @@
202
       }
203
     
204
 #ifdef SKIP_MESSAGES
205
-      ostrstream msg;
206
+      stringstream msg;
207
       msg << "Average delay is " << avg << " out of " 
208
-        << delaysNum << " samples." << ends;
209
+        << delaysNum << " samples.";
210
       server->message(msg.str());
211
-      delete msg.str();
212
 #endif
213
 
214
 #if 0
215
@@ -1723,10 +1709,9 @@
216
 //            server->error("Client has reached maximum skip value.");
217
 //          }
218
 #ifdef SKIP_MESSAGES
219
-        ostrstream msg;
220
-        msg << "Increasing skip to " << skip << ends;
221
+        stringstream msg;
222
+        msg << "Increasing skip to " << skip;
223
         server->message(msg.str());
224
-        delete msg.str();
225
 #endif
226
       }
227
       // We have moved back into our target range, can send more data now.
228
@@ -1734,10 +1719,9 @@
229
         skip--;
230
 
231
 #ifdef SKIP_MESSAGES
232
-        ostrstream msg;
233
-        msg << "Decreasing skip to " << skip << ends;
234
+        stringstream msg;
235
+        msg << "Decreasing skip to " << skip;
236
         server->message(msg.str());
237
-        delete msg.str();
238
 #endif
239
       }
240
 
241
@@ -1777,7 +1761,7 @@
242
 
243
 
244
 
245
-Server::Server(Boolean lHuman,char *portName,LocatorP errLocator) {
246
+Server::Server(Boolean lHuman,const char *portName,LocatorP errLocator) {
247
   // Hack, using errLocator for more than reporting errors.
248
   errLocator->set_remember_deleted(True);
249
   errLocator->set_remember_sounds(True); 
250
@@ -1843,19 +1827,17 @@
251
 
252
   // Give address to both the TCP and UDP sockets.
253
   if (bind(tcpSock, (CMN_SOCKADDR *)&serverAddr, sizeof(serverAddr)) < 0) {
254
-    ostrstream str;
255
+    stringstream str;
256
     str << "Couldn't bind socket name to TCP socket on port " 
257
-        << port << "."  << ends;
258
-    error(str.str());
259
-    delete str.str();
260
+        << port << ".";
261
+    error(str.str().c_str());
262
     return;
263
   }
264
   if (bind(udpSock, (CMN_SOCKADDR *)&serverAddr, sizeof(serverAddr)) < 0) {
265
-    ostrstream str;
266
+    stringstream str;
267
     str << "Couldn't bind socket name to UDP socket on port " 
268
-        << port << "."  << ends;
269
-    error(str.str());
270
-    delete str.str();
271
+        << port << ".";
272
+    error(str.str().c_str());
273
     return;
274
   }
275
 
276
@@ -1868,10 +1850,9 @@
277
   assert(udpIn);
278
 
279
   // Message to server log.
280
-  strstream msg;
281
-  msg << "Set up server on port " << port << ends;
282
-  message(msg.str());
283
-  delete(msg.str());
284
+  stringstream msg;
285
+  msg << "Set up server on port " << port;
286
+  message(msg.str().c_str());
287
 
288
   running = True;
289
 }
290
@@ -1951,10 +1932,9 @@
291
     localHumanId = hId;
292
 
293
     // Log the human's name.
294
-    strstream msg;
295
-    msg << "Player 0 \"" << human->get_name() << '\"' << "@SERVER" << ends;
296
-    message(msg.str());
297
-    delete(msg.str());
298
+    stringstream msg;
299
+    msg << "Player 0 \"" << human->get_name() << '\"' << "@SERVER";
300
+    message(msg.str().c_str());
301
 
302
     return;
303
   }
304
@@ -1985,12 +1965,11 @@
305
 
306
   // Log all the players in the game, some code duplication for the
307
   // local human.
308
-  ostrstream str;
309
+  stringstream str;
310
   char* fullName = cn->get_full_client_name();
311
-  str << "Player " << num << " " << fullName << ends;
312
-  message(str.str());
313
+  str << "Player " << num << " " << fullName;
314
+  message(str.str().c_str());
315
   delete fullName;
316
-  delete str.str();
317
   
318
   // Send assign_intel via TCP
319
   OutStreamP out = cn->get_tcp_out_stream();
320
@@ -2007,13 +1986,12 @@
321
     // anyway.
322
     for (m = 0; m < connections.length() && m != n; m++) {
323
       char* fullName = cn->get_full_client_name();
324
-      ostrstream str;
325
-      str << fullName << " has joined the game" << ends;
326
+      stringstream str;
327
+      str << fullName << " has joined the game";
328
       delete fullName;
329
 
330
       OutStreamP out = cn->get_udp_out_stream();
331
-      XETP::send_arena_message(out,timeMS,str.str());
332
-      delete str.str();
333
+      XETP::send_arena_message(out,timeMS,str.str().c_str());
334
     }
335
     cn->creation_message_sent();
336
   }
337
@@ -2101,13 +2079,12 @@
338
           // Give the connection some slack when it is first starting up.
339
           turn - cn->get_start_turn() >= MINIMUM_CUTOFF) {
340
         char* fullName = cn->get_full_client_name();
341
-        ostrstream str;
342
+        stringstream str;
343
         str << fullName
344
             << " has not responded in "
345
-            << diff << " turns.  Disconnect." << ends;
346
-        message(str.str());
347
+            << diff << " turns.  Disconnect.";
348
+        message(str.str().c_str());
349
         delete fullName;
350
-        delete str.str();
351
         tooOld = True;
352
       }
353
     }
354
@@ -2147,11 +2124,10 @@
355
           diff == NO_ACTIVITY_WARN_2 ||
356
           diff == NO_ACTIVITY_WARN_3) {
357
         if (echoPingPong) {
358
-          ostrstream str;
359
+          stringstream str;
360
           str << "Haven't heard from " << cn->get_client_name()
361
-              << " in " << diff << " turns, sending PING." << ends;
362
-          message(str.str());
363
-          delete str.str();
364
+              << " in " << diff << " turns, sending PING.";
365
+          message(str.str().c_str());
366
         }
367
         XETP::send_ping(cn->get_udp_out_stream());
368
       }
369
@@ -2311,7 +2287,11 @@
370
   for (m = 0; m < followers.length(); m++) {
371
     PhysicalP q = (PhysicalP)followers.get(m);
372
     netData = q->get_net_data();
373
-    assert(!netData->get_sent_flag());
374
+    // This line was aborting network games, often in the pound scenario.
375
+    // Without it, the server seems to continue without error.
376
+    // I tried replacing it with a warning, but there is so much of it
377
+    // that it is nearly impossible to see anything else. -Brandon
378
+//  assert(!netData->get_sent_flag());
379
     netData->set_sent_flag(True);
380
   }
381
 
382
@@ -2713,9 +2693,9 @@
383
   // Careful to set the propagate flag to False so the message doesn't get
384
   // sent to the clients.
385
   if (errorLocator) {
386
-    ostrstream str2;
387
-    str2 << "SERVER: " << msg << ends;
388
-    errorLocator->arena_message_enq(str2.str(),NULL,ROLE_FAILED_TIME,False);
389
+    stringstream str2;
390
+    str2 << "SERVER: " << msg;
391
+    errorLocator->arena_message_enq(Utils::strdup(str2.str().c_str()),NULL,ROLE_FAILED_TIME,False);
392
     // Don't delete str2.str(), give memory to the Locator.
393
 
394
     // Could do a regular message_enq(), but would have to deal with the
395
@@ -2728,10 +2708,9 @@
396
 void Server::display_chat_message(LocatorP l,const char* sender,
397
                                   const char* msg) {
398
   // Log the chat message, then let Role handle it.
399
-  strstream logMsg;
400
-  logMsg << '<' << sender << '>' << msg << ends;
401
-  message(logMsg.str());
402
-  delete logMsg.str();
403
+  stringstream logMsg;
404
+  logMsg << '<' << sender << '>' << msg;
405
+  message(logMsg.str().c_str());
406
 
407
   Role::display_chat_message(l,sender,msg);
408
 }
409
@@ -2851,12 +2830,11 @@
410
   udpAddr->sin_port = htons(udpPort);
411
 
412
   // Log the connection.
413
-  strstream msg;
414
+  stringstream msg;
415
   msg << clientName <<
416
 	" connected (TCP port " << ntohs(tcpAddr.sin_port) << 
417
-    ", UDP port " << udpPort << ")" << ends;
418
-  message(msg.str());
419
-  delete(msg.str());
420
+    ", UDP port " << udpPort << ")";
421
+  message(msg.str().c_str());
422
 
423
   Connection* cn =   
424
     new Connection(this,errorLocator,
425
@@ -2874,7 +2852,7 @@
426
   XETP::send_reset(out,manager->get_game_style_type());
427
 
428
   // Say hello to the new client.
429
-  ostrstream greeting;
430
+  stringstream greeting;
431
   greeting << "Welcome to " << hostName << ".";
432
 
433
   if (get_humans_num() == 1) {
434
@@ -2884,10 +2862,8 @@
435
     greeting << " There are now " 
436
              << get_humans_num() << " players.";
437
   }
438
-  greeting << ends;
439
   int timeMS = quantaToMS(UI_ARENA_MESSAGE_TIME,manager);  
440
-  XETP::send_arena_message(out,timeMS,greeting.str());
441
-  delete greeting.str();
442
+  XETP::send_arena_message(out,timeMS,greeting.str().c_str());
443
 
444
   manager->humans_num_incremented();
445
 }
446
@@ -2918,18 +2894,16 @@
447
       Connection* cm = get_connection(m);
448
 
449
       char* fullName = cn->get_full_client_name();
450
-      ostrstream str;
451
+      stringstream str;
452
       str << fullName << " has disconnected";
453
       if (intel) {
454
         str << ", " << kills << " human kills";
455
       }
456
-      str << ends;
457
       XETP::send_arena_message(cm->get_udp_out_stream(),
458
-                               timeMS,str.str());
459
+                               timeMS,str.str().c_str());
460
 
461
 
462
       delete fullName;
463
-      delete str.str();
464
     }
465
   }
466
 
467
@@ -3262,8 +3236,8 @@
468
 void Server::send_udp_server_pong(IGameManager* manager,LocatorP locator,
469
                                   CMN_SOCKET udpSock,
470
                                   CMN_SOCKADDR_IN* destAddr) {
471
-  static char* unknownString = "<unknown>";
472
-  static char* serverString = "<server>";
473
+  static const char* unknownString = "<unknown>";
474
+  static const char* serverString = "<server>";
475
 
476
 
477
   // Temporary stream.
(-)games/xevil/files/patch-cmn::streams.cpp (-4 / +27 lines)
Lines 1-12 Link Here
1
--- cmn/streams.cpp.orig	Wed Jan 19 12:54:32 2000
1
--- cmn/streams.cpp.orig	2012-05-27 06:52:30.000000000 +0900
2
+++ cmn/streams.cpp	Sat Oct 25 21:44:08 2003
2
+++ cmn/streams.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -31,7 +31,8 @@
3
@@ -31,12 +31,13 @@
4
 #include "utils.h"
4
 #include "utils.h"
5
 #include "neth.h" // needed for recv, send, recvfrom, sendto
5
 #include "neth.h" // needed for recv, send, recvfrom, sendto
6
 
6
 
7
-#include <iostream.h>
7
-#include <iostream.h>
8
+#include <iostream>
8
+#include <iostream>
9
+using namespace std;
10
 
9
 
11
 #include "streams.h"
10
 #include "streams.h"
12
 #include "xetp.h" // yuck, need this for XETP::versionStr
11
 #include "xetp.h" // yuck, need this for XETP::versionStr
12
 
13
 
14
+using namespace std;
15
 
16
 Checksum GenericStream::compute_checksum(u_char *data,int len) {
17
   Checksum c = 0;
18
@@ -205,7 +206,7 @@
19
   
20
 
21
 
22
-Boolean NetOutStream::write(void *buf,int size) {
23
+Boolean NetOutStream::write(const void *buf,int size) {
24
   if (!isAlive) {
25
     return False;
26
   }
27
@@ -518,7 +519,7 @@
28
 
29
 
30
 
31
-Boolean UDPOutStream::write(void *buf,int size) {
32
+Boolean UDPOutStream::write(const void *buf,int size) {
33
   if (!isAlive) {
34
     return False;
35
   }
(-)games/xevil/files/patch-cmn::utils.cpp (-17 / +71 lines)
Lines 1-39 Link Here
1
--- cmn/utils.cpp.orig	2003-03-19 10:05:12.000000000 +0100
1
--- cmn/utils.cpp.orig	2012-05-27 06:52:30.000000000 +0900
2
+++ cmn/utils.cpp	2007-07-31 15:43:42.000000000 +0200
2
+++ cmn/utils.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -30,16 +30,17 @@
3
@@ -30,16 +30,16 @@
4
 
4
 
5
 // Include Files
5
 // Include Files
6
 #include "stdafx.h"
6
 #include "stdafx.h"
7
-#include <iostream.h>
7
-#include <iostream.h>
8
-#include <limits.h>
9
-#include <string.h>
10
-#include <ctype.h>
11
-#include <fstream.h>
12
+#include <iostream>
8
+#include <iostream>
13
+#include <climits>
9
 #include <limits.h>
14
+#include <cstring>
10
 #include <string.h>
15
+#include <cctype>
11
 #include <ctype.h>
12
-#include <fstream.h>
16
+#include <fstream>
13
+#include <fstream>
17
+using namespace std;
18
 #if WIN32
14
 #if WIN32
19
 #include <strstrea.h>
15
 #include <strstrea.h>
20
 #endif
16
 #endif
21
 #if X11
17
 #if X11
22
-#include <strstream.h>
18
-#include <strstream.h>
23
+#include <strstream>
19
+#include <sstream>
24
 #endif
20
 #endif
25
 
21
 
26
 #ifdef WIN32
22
 #ifdef WIN32
27
@@ -605,7 +606,7 @@
23
@@ -422,10 +422,8 @@
24
 
25
 
26
 char* Utils::get_OS_info() {
27
-  ostrstream ret;
28
-
29
-
30
 #ifdef WIN32
31
+  stringstream ret;
32
   OSVERSIONINFO osInfo;
33
   osInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
34
   Boolean set = False;
35
@@ -465,12 +463,11 @@
36
           Utils::strcmp(osInfo.szCSDVersion," ")) {
37
         ret << '(' << osInfo.szCSDVersion << ')';
38
       }
39
-      ret << ends;
40
     }
41
   }
42
 
43
   if (!set) {
44
-    ret << "Unknown Win32" << ends;
45
+    ret << "Unknown Win32";
46
   }
47
 #endif
48
 
49
@@ -494,20 +491,15 @@
50
         if (buffer[strLen - 1] == '\n') {
51
           buffer[strLen - 1] = '\0';
52
         }
53
-        ret << buffer << ends;
54
-        set = True;
55
+        return strdup(buffer);
56
       }
57
     }
58
     pclose(fp);
59
   }
60
 
61
-  if (!set) {
62
-    ret << "Unknown UNIX" << ends;
63
-  }
64
+  return strdup("Unknown UNIX");
65
 #endif
66
 
67
-
68
-  return ret.str();
69
 }
70
 
71
 
72
@@ -605,7 +597,7 @@
28
   // Not tested.
73
   // Not tested.
29
   out->write_int(len);
74
   out->write_int(len);
30
   for (int n = 0; n < len; n++) {
75
   for (int n = 0; n < len; n++) {
31
-    out->write_int((int)data[n]);
76
-    out->write_int((int)data[n]);
32
+    out->write_int((intptr_t)data[n]);
77
+    out->write_int((long)data[n]);
33
   }
78
   }
34
 }
79
 }
35
 
80
 
36
@@ -761,7 +762,7 @@
81
@@ -761,7 +753,7 @@
37
 
82
 
38
 
83
 
39
 private:
84
 private:
Lines 42-53 Link Here
42
   /* MODIFIES: index */
87
   /* MODIFIES: index */
43
   /* EFFECTS: Internal helper function.  Return the Bucket containing key
88
   /* EFFECTS: Internal helper function.  Return the Bucket containing key
44
      or NULL if not found.  Set index to the bucket list for key whether
89
      or NULL if not found.  Set index to the bucket list for key whether
45
@@ -944,7 +945,7 @@
90
@@ -944,7 +936,7 @@
46
 // Pretty crappy hash function, I know.
91
 // Pretty crappy hash function, I know.
47
 // Careful if bucketsNum is a power of 2.
92
 // Careful if bucketsNum is a power of 2.
48
 int HashTable::defaultHash(void* key,int bucketsNum) {
93
 int HashTable::defaultHash(void* key,int bucketsNum) {
49
-  return ((unsigned int)key) % bucketsNum;
94
-  return ((unsigned int)key) % bucketsNum;
50
+  return ((unsigned intptr_t)key) % bucketsNum;
95
+  return ((unsigned long)key) % bucketsNum;
51
 }
96
 }
52
 
97
 
53
 
98
 
99
@@ -1024,7 +1016,7 @@
100
 #endif
101
 
102
 #if X11
103
-  cout << str << endl;
104
+  std::cout << str << std::endl;
105
 #endif
106
 }
107
 
(-)games/xevil/files/patch-cmn::world.cpp (-4 / +11 lines)
Lines 1-12 Link Here
1
--- cmn/world.cpp.orig	Wed Jan 19 21:15:08 2000
1
--- cmn/world.cpp.orig	2012-05-27 06:52:30.000000000 +0900
2
+++ cmn/world.cpp	Sat Oct 25 21:45:40 2003
2
+++ cmn/world.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -35,7 +35,8 @@
3
@@ -35,7 +35,7 @@
4
 #endif
4
 #endif
5
 
5
 
6
 // Include Files.
6
 // Include Files.
7
-#include <iostream.h>
7
-#include <iostream.h>
8
+#include <iostream>
8
+#include <iostream>
9
+using namespace std;
10
 
9
 
11
 #include "utils.h"
10
 #include "utils.h"
12
 #include "coord.h"
11
 #include "coord.h"
12
@@ -48,6 +48,7 @@
13
 // For PhysMover.
14
 #include "actual.h"
15
 
16
+using namespace std;
17
 
18
 // Defines.
19
 #define HANGING_PERCENT 0.40 // The % of the edge hanging off the corner.
(-)games/xevil/files/patch-cmn::xetp.cpp (-7 / +33 lines)
Lines 1-24 Link Here
1
--- cmn/xetp.cpp.orig	2000-01-19 12:54:30.000000000 +0100
1
--- cmn/xetp.cpp.orig	2012-05-27 06:52:30.000000000 +0900
2
+++ cmn/xetp.cpp	2007-07-31 15:51:31.000000000 +0200
2
+++ cmn/xetp.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -29,9 +29,10 @@
3
@@ -29,9 +29,9 @@
4
 
4
 
5
 #include "stdafx.h"
5
 #include "stdafx.h"
6
 
6
 
7
-#include <iostream.h>
7
-#include <iostream.h>
8
+#include <iostream>
8
+#include <iostream>
9
+using namespace std;
10
 #if X11
9
 #if X11
11
-#include <strstream.h>
10
-#include <strstream.h>
12
+#include <strstream>
11
+#include <sstream>
13
 #endif
12
 #endif
14
 #if WIN32
13
 #if WIN32
15
 #include <strstrea.h>
14
 #include <strstrea.h>
16
@@ -159,7 +160,7 @@
15
@@ -53,6 +53,8 @@
16
 #include "xetp.h"
17
 
18
 
19
+using namespace std;
20
+
21
 
22
 void XETP::check_sizes() {
23
   XETPBasic::check_sizes();
24
@@ -159,7 +161,7 @@
17
   for (n = 0; n < physicals.length(); n++) {
25
   for (n = 0; n < physicals.length(); n++) {
18
     PhysicalP p = (PhysicalP)physicals.get(n);
26
     PhysicalP p = (PhysicalP)physicals.get(n);
19
     // computing object_length twice, but who cares.
27
     // computing object_length twice, but who cares.
20
-    _send_object(out,p,turn,(TickType)tickTypes.get(n),
28
-    _send_object(out,p,turn,(TickType)tickTypes.get(n),
21
+    _send_object(out,p,turn,(intptr_t)tickTypes.get(n),
29
+    _send_object(out,p,turn,(long)tickTypes.get(n),
22
                  compute_object_length(p));
30
                  compute_object_length(p));
23
   }
31
   }
24
   
32
   
33
@@ -274,7 +276,7 @@
34
 
35
 
36
 
37
-void XETP::send_message(OutStreamP out,char *msg) {
38
+void XETP::send_message(OutStreamP out,const char *msg) {
39
   assert(msg);
40
   u_int len = strlen(msg);
41
   
42
@@ -293,7 +295,7 @@
43
 
44
 
45
 
46
-void XETP::send_arena_message(OutStreamP out,int time,char *msg) {
47
+void XETP::send_arena_message(OutStreamP out,int time,const char *msg) {
48
   assert(msg);
49
   u_int len = sizeof(int) +  // time
50
     strlen(msg);             // string body
(-)games/xevil/files/patch-cmn__coord.h (+11 lines)
Line 0 Link Here
1
--- cmn/coord.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ cmn/coord.h	2012-05-27 06:53:11.000000000 +0900
3
@@ -619,7 +619,7 @@
4
   int enemiesInitial; // enemies on first level
5
   int enemiesIncr; // this many more enemies each level
6
   int enemiesMax; // maximum number of enemies (for levels)
7
-  char *name; // of this difficulty level
8
+  const char *name; // of this difficulty level
9
 };
10
 enum {DIFF_TRIVIAL,DIFF_NORMAL,DIFF_HARD,DIFF_BEND_OVER,
11
       DIFFICULTY_LEVELS_NUM, DIFF_NONE=DIFFICULTY_LEVELS_NUM};
(-)games/xevil/files/patch-cmn__intel.h (+83 lines)
Line 0 Link Here
1
--- cmn/intel.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ cmn/intel.h	2012-05-27 06:53:11.000000000 +0900
3
@@ -123,7 +123,7 @@
4
 // Class Definitions.
5
 class Intel {
6
  public:
7
-  Intel(WorldP w,LocatorP l,char *name,
8
+  Intel(WorldP w,LocatorP l,const char *name,
9
        	const IntelOptions *ops,ITmask opMask); 
10
   /* EFFECTS: Create a new intel with the options specified in opMakse that are
11
      in ops.  ops will never be referenced if opMask is ITnone.  lives now
12
@@ -293,7 +293,7 @@
13
 // Simply buffers input from a user interface.
14
 class Human: public Intel {
15
  public: 
16
-  Human(WorldP w,LocatorP l,char *name,int lives,
17
+  Human(WorldP w,LocatorP l,const char *name,int lives,
18
         int *sharedLives,ColorNum colorNum);
19
   /* NOTE: Uses all default options.  intelOptions should be meaningless for 
20
      a human. If "sharedLives" is non-null, ignore "lives" and share the lives. */
21
@@ -346,7 +346,7 @@
22
 
23
 class Machine: public Intel {
24
 public:
25
-  Machine(WorldP w,LocatorP l,char *name,
26
+  Machine(WorldP w,LocatorP l,const char *name,
27
 	  const IntelOptions *ops,ITmask opMask);
28
 	  
29
   virtual IntelId get_master_intel_id();
30
@@ -464,7 +464,7 @@
31
 
32
 class Enemy: public Machine {
33
 public:
34
-  Enemy(WorldP w,LocatorP l,char *name,
35
+  Enemy(WorldP w,LocatorP l,const char *name,
36
 	const IntelOptions *ops,ITmask opMask);
37
 
38
   static void set_reflexes_time(int time) {reflexesTime = time;}
39
@@ -491,7 +491,7 @@
40
 
41
 class Neutral: public Machine {
42
 public:
43
-  Neutral(WorldP w,LocatorP l,char *name,
44
+  Neutral(WorldP w,LocatorP l,const char *name,
45
 	const IntelOptions *ops,ITmask opMask);
46
 	  
47
   virtual Boolean is_enemy();
48
@@ -502,7 +502,7 @@
49
 
50
 class SealIntel: public Neutral {
51
 public:
52
-  SealIntel(WorldP w,LocatorP l,char *name,const Id &homeId);
53
+  SealIntel(WorldP w,LocatorP l,const char *name,const Id &homeId);
54
   
55
   virtual Boolean is_seal_intel();
56
 
57
@@ -522,7 +522,7 @@
58
 
59
 class DoppelIntel: public Neutral {
60
 public:
61
-	DoppelIntel(WorldP w,LocatorP l,char *name,
62
+	DoppelIntel(WorldP w,LocatorP l,const char *name,
63
     const IntelOptions *ops,ITmask opMask,
64
 	  IntelP master = NULL);
65
 	
66
@@ -572,7 +572,7 @@
67
 // in choose_strategy() and go_get_em().
68
 class Pet: public DoppelIntel {
69
 public:
70
-  Pet(WorldP w,LocatorP l,char *name,
71
+  Pet(WorldP w,LocatorP l,const char *name,
72
 	    const IntelOptions *ops,ITmask opMask,
73
 	    IntelP master = NULL);
74
     
75
@@ -583,7 +583,7 @@
76
 	IT_WEAPON_{some dir}, or to come back to him if command is IT_WEAPON_CENTER. 
77
 	This will also set p to be the new master. */
78
 
79
-	static char *mode_string(int mode);
80
+	static const char *mode_string(int mode);
81
 	/* NOTE: For debugging. */
82
 
83
 
(-)games/xevil/files/patch-cmn__locator.cpp (+10 lines)
Line 0 Link Here
1
--- cmn/locator.cpp.orig	2012-05-27 06:52:30.000000000 +0900
2
+++ cmn/locator.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -50,6 +50,7 @@
4
 
5
 #include "bitmaps/locator/locator.bitmaps" // for arrows
6
 
7
+using namespace std;
8
 
9
 // When we reach this, start deleting objects.
10
 #define OL_LIST_WARN ((int)(OL_LIST_MAX * 0.9))
(-)games/xevil/files/patch-cmn__role.h (+11 lines)
Line 0 Link Here
1
--- cmn/role.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ cmn/role.h	2012-05-27 06:53:11.000000000 +0900
3
@@ -539,7 +539,7 @@
4
 
5
 
6
 public:
7
-  Server(Boolean localHuman,char *portName,LocatorP);
8
+  Server(Boolean localHuman,const char *portName,LocatorP);
9
   /* EFFECTS: Create a server that listens for connections on given port.
10
      If NULL is passed in, use XETP::DEFAULT_PORT. */
11
 
(-)games/xevil/files/patch-cmn__streams.h (+29 lines)
Line 0 Link Here
1
--- cmn/streams.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ cmn/streams.h	2012-05-27 06:53:11.000000000 +0900
3
@@ -97,7 +97,7 @@
4
 public:
5
   OutStream(Boolean ownSock) : GenericStream(ownSock) {}
6
 
7
-  virtual Boolean write(void *buf,int size) = 0;
8
+  virtual Boolean write(const void *buf,int size) = 0;
9
   /* EFFECTS: Write size number of bytes into buf.  Return True if
10
      successful. */
11
 
12
@@ -171,7 +171,7 @@
13
 
14
   virtual Boolean alive();
15
   
16
-  virtual Boolean write(void *buf,int size);
17
+  virtual Boolean write(const void *buf,int size);
18
 
19
   virtual void write_char(u_char);
20
 
21
@@ -253,7 +253,7 @@
22
 
23
   virtual void done_packet();
24
 
25
-  virtual Boolean write(void *buf,int size);
26
+  virtual Boolean write(const void *buf,int size);
27
 
28
   void flush();
29
 
(-)games/xevil/files/patch-cmn__utils.h (+28 lines)
Line 0 Link Here
1
--- cmn/utils.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ cmn/utils.h	2012-05-27 06:53:11.000000000 +0900
3
@@ -159,7 +159,7 @@
4
 
5
 typedef int GameStyleType;
6
 // Possible values of GameStyleType.
7
-enum {SCENARIOS,LEVELS_ONLY,KILL,DUEL,EXTENDED,TRAINING,LEVELS};
8
+enum {SCENARIOS,LEVELS_ONLY,KILL,DUEL,EXTENDED,TRAINING,LEVELS,NUM_GAME_STYLES};
9
 
10
 
11
 
12
@@ -237,13 +237,13 @@
13
   /* EFFECTS: Wrapper for C library strcmp().  Return 0 if strings are the
14
      same. */
15
 
16
-  static char* strchr(const char* cs,int c)
17
+  static const char* strchr(const char* cs,int c)
18
     {return ::strchr(cs,c);}
19
 
20
-  static char* strrchr(const char* cs,int c)
21
+  static const char* strrchr(const char* cs,int c)
22
     {return ::strrchr(cs,c);}
23
 
24
-  static char* strstr(const char* cs,const char* ct)
25
+  static const char* strstr(const char* cs,const char* ct)
26
     {return ::strstr(cs,ct);}
27
 
28
   static void strcpy(char* s,const char* ct)
(-)games/xevil/files/patch-cmn__xetp.h (+14 lines)
Line 0 Link Here
1
--- cmn/xetp.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ cmn/xetp.h	2012-05-27 06:53:11.000000000 +0900
3
@@ -83,9 +83,9 @@
4
   static void send_rooms_known(OutStreamP,const Rooms &,
5
                                int worldVersion,Boolean *map);
6
 
7
-  static void send_message(OutStreamP,char *msg);
8
+  static void send_message(OutStreamP,const char *msg);
9
 
10
-  static void send_arena_message(OutStreamP,int timeMS,char *msg);
11
+  static void send_arena_message(OutStreamP,int timeMS,const char *msg);
12
 
13
   static void send_command(OutStreamP,const IntelId &,ITcommand);
14
 
(-)games/xevil/files/patch-cmn__xetp_basic.cpp (+11 lines)
Line 0 Link Here
1
--- cmn/xetp_basic.cpp.orig	2012-05-27 06:52:30.000000000 +0900
2
+++ cmn/xetp_basic.cpp	2012-05-27 06:53:11.000000000 +0900
3
@@ -33,7 +33,7 @@
4
 #include "xetp_basic.h"
5
 
6
 
7
-char *XETPBasic::versionStr = "XETP1.00";
8
+const char *XETPBasic::versionStr = "XETP1.00";
9
 // 0.10 released with special RedHat version
10
 // 0.12 for 2.0b5
11
 // 0.15 for 2.0b6
(-)games/xevil/files/patch-cmn__xetp_basic.h (+11 lines)
Line 0 Link Here
1
--- cmn/xetp_basic.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ cmn/xetp_basic.h	2012-05-27 06:53:11.000000000 +0900
3
@@ -52,7 +52,7 @@
4
   // All values are big-endian
5
   enum {HEADER_LENGTH = 3};  // 8
6
   enum {VERSION_LENGTH = 8};  // streams.h depends on this value.
7
-  static char *versionStr;
8
+  static const char *versionStr;
9
 
10
   // The ':' syntax gives the size in bytes of each component.  :String means
11
   // use Utils::string_read(), Utils::string_write(), etc.
(-)games/xevil/files/patch-x11::l_agreement_dlg.cpp (-5 / +3 lines)
Lines 1-12 Link Here
1
--- x11/l_agreement_dlg.cpp.orig	Wed Jan 19 12:55:04 2000
1
--- x11/l_agreement_dlg.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ x11/l_agreement_dlg.cpp	Sat Oct 25 21:46:33 2003
2
+++ x11/l_agreement_dlg.cpp	2012-05-27 06:52:59.000000000 +0900
3
@@ -31,7 +31,8 @@
3
@@ -31,7 +31,6 @@
4
 #include <X11/Xatom.h>
4
 #include <X11/Xatom.h>
5
 }
5
 }
6
 
6
 
7
-#include <strstream.h>
7
-#include <strstream.h>
8
+#include <strstream>
9
+using namespace std;
10
 
8
 
11
 #include "xdata.h"
9
 #include "xdata.h"
12
 #include "panel.h"
10
 #include "panel.h"
(-)games/xevil/files/patch-x11::main.cpp (-4 / +26 lines)
Lines 1-12 Link Here
1
--- x11/main.cpp.orig	Sat Mar 22 20:52:14 2003
1
--- x11/main.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ x11/main.cpp	Sat Oct 25 21:47:04 2003
2
+++ x11/main.cpp	2012-05-27 06:52:58.000000000 +0900
3
@@ -33,7 +33,8 @@
3
@@ -25,6 +25,7 @@
4
 #include "utils.h"
5
 
6
 extern "C" {
7
+#include <stdlib.h>
8
 #include <X11/Xutil.h>
9
 
10
 #ifdef OPENWOUND_XOS_STRLEN_HACK
11
@@ -33,13 +34,13 @@
4
 #include <X11/Xos.h>
12
 #include <X11/Xos.h>
5
 }
13
 }
6
 
14
 
7
-#include <iostream.h>
15
-#include <iostream.h>
8
+#include <iostream>
16
+#include <iostream>
9
+using namespace std;
10
 
17
 
11
 #include "utils.h"
18
 #include "utils.h"
12
 #include "neth.h"
19
 #include "neth.h"
20
 #include "game.h"
21
 
22
-
23
+GameP g_game;
24
 
25
 class TurnStarter: public ITurnStarter {
26
 public:
27
@@ -68,6 +69,7 @@
28
   Utils::seed_random();
29
 
30
   GameP game = new Game(&argc,argv);
31
+	g_game = game;
32
 
33
   //  assert (clock() != -1);
34
 
(-)games/xevil/files/patch-x11::panel.cpp (-5 / +43 lines)
Lines 1-14 Link Here
1
--- x11/panel.cpp.orig	Sat Mar 22 20:50:44 2003
1
--- x11/panel.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ x11/panel.cpp	Sat Oct 25 21:47:34 2003
2
+++ x11/panel.cpp	2012-05-27 06:52:58.000000000 +0900
3
@@ -31,8 +31,9 @@
3
@@ -31,13 +31,14 @@
4
 #include <X11/Xutil.h>
4
 #include <X11/Xutil.h>
5
 #include <X11/keysym.h>
5
 #include <X11/keysym.h>
6
 }
6
 }
7
-#include <iostream.h>
7
-#include <iostream.h>
8
-#include <strstream.h>
8
-#include <strstream.h>
9
+#include <iostream>
9
+#include <iostream>
10
+#include <strstream>
10
+#include <sstream>
11
+using namespace std;
12
 
11
 
13
 #include "utils.h"
12
 #include "utils.h"
14
 #include "xdata.h"
13
 #include "xdata.h"
14
 #include "panel.h"
15
 
16
+using namespace std;
17
 
18
 #define PANEL_BORDER 1
19
 #define PANEL_MARGAIN 2
20
@@ -311,15 +312,14 @@
21
 
22
 
23
 void WritePanel::update_message() {
24
-  ostrstream tmp;
25
+  stringstream tmp;
26
   if (active) {
27
-    tmp << prompt << value << "_" << ends;
28
+    tmp << prompt << value << "_";
29
   }
30
   else {
31
-    tmp << prompt << value << ends;
32
+    tmp << prompt << value;
33
   }
34
-  set_message(tmp.str());
35
-  delete tmp.str(); 
36
+  set_message(tmp.str().c_str());
37
 }
38
 
39
 
40
@@ -524,9 +524,8 @@
41
     return;
42
   }
43
 
44
-  ostrstream tmp;
45
-  tmp << "CHAT <<" << value << "\nEnter to send, Esc to cancel." << ends;
46
-  TextPanel::set_message(tmp.str());
47
-  delete tmp.str(); 
48
+  stringstream tmp;
49
+  tmp << "CHAT <<" << value << "\nEnter to send, Esc to cancel.";
50
+  TextPanel::set_message(tmp.str().c_str());
51
 }
52
 
(-)games/xevil/files/patch-x11::serverping.cpp (-5 / +102 lines)
Lines 1-14 Link Here
1
--- x11/serverping.cpp.orig	Sat Mar 22 21:55:12 2003
1
--- x11/serverping.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ x11/serverping.cpp	Sat Oct 25 21:48:03 2003
2
+++ x11/serverping.cpp	2012-05-27 07:12:12.000000000 +0900
3
@@ -25,8 +25,9 @@
3
@@ -25,14 +25,15 @@
4
 // code and should be reasonably easy to compile on Windows.
4
 // code and should be reasonably easy to compile on Windows.
5
 
5
 
6
 
6
 
7
-#include <iostream.h>
7
-#include <iostream.h>
8
-#include <strstream.h>
8
-#include <strstream.h>
9
+#include <iostream>
9
+#include <iostream>
10
+#include <strstream>
10
+#include <sstream>
11
+using namespace std;
12
 #include "utils.h"
11
 #include "utils.h"
13
 #include "streams.h"
12
 #include "streams.h"
14
 #include "xetp_basic.h"
13
 #include "xetp_basic.h"
14
 #include "neth.h"
15
 #include "id.h"
16
 
17
+using namespace std;
18
 
19
 
20
 class ServerPing {
21
@@ -113,7 +114,7 @@
22
 
23
 
24
   char* sString = argv[argc - 1];
25
-  char* port = Utils::strchr(sString,':');
26
+  const char* port = Utils::strchr(sString,':');
27
   // server:port
28
   if (port) {
29
     serverName = new char[port - sString + 1];
30
@@ -140,10 +141,9 @@
31
     error("Error opening client UDP socket.");
32
   }
33
   
34
-  ostrstream str;
35
-  str << "Looking up IP address for server " << serverName << ends;
36
-  message(str.str());
37
-  delete str.str();
38
+  stringstream str;
39
+  str << "Looking up IP address for server " << serverName;
40
+  message(str.str().c_str());
41
 
42
   // Create server address.
43
   memset((void *)&serverAddr,'\0',sizeof(serverAddr));
44
@@ -171,10 +171,9 @@
45
   client.sin_addr.s_addr = htonl(INADDR_ANY);
46
   client.sin_port = htons((u_short)clientPort);
47
   if (bind(udpSock,(CMN_SOCKADDR *)&client,sizeof(client)) < 0) {
48
-    ostrstream str;
49
-    str << "Could not bind local UDP port " << clientPort << ends;
50
-    error(str.str());
51
-    delete str.str();
52
+    stringstream str;
53
+    str << "Could not bind local UDP port " << clientPort;
54
+    error(str.str().c_str());
55
     return;
56
   }
57
 
58
@@ -197,11 +196,10 @@
59
   // Send "count" number of SERVER_PINGs.
60
   for (int tries = 0; tries < count; tries++) {
61
     // Send the ping.
62
-    ostrstream msg;
63
+    stringstream msg;
64
     msg << "Sending XETP::SERVER_PING to " 
65
-        << serverName << ':' << serverPort << ends;
66
-    message(msg.str());
67
-    delete msg.str();
68
+        << serverName << ':' << serverPort;
69
+    message(msg.str().c_str());
70
     XETPBasic::send_server_ping(udpOut);
71
     // Don't buffer the ping.
72
     udpOut->flush();
73
@@ -248,11 +246,10 @@
74
   }
75
 
76
   // If we get here, we failed to reach the server.
77
-  ostrstream msg;
78
+  stringstream msg;
79
   msg << "No return from " << serverName << ':' << serverPort << " after " 
80
-      << count << " tries." << ends;
81
-  error(msg.str());
82
-  delete msg.str();
83
+      << count << " tries.";
84
+  error(msg.str().c_str());
85
 }
86
 
87
 
88
@@ -271,12 +268,9 @@
89
 
90
 
91
 void ServerPing::error(const char* msg1,const char* msg2) {
92
-  ostrstream str;
93
-  str << msg1 << msg2 << ends;
94
-  error(str.str());
95
-
96
-  // Will never get here, but WTF.
97
-  delete str.str();
98
+  stringstream str;
99
+  str << msg1 << msg2;
100
+  error(str.str().c_str());
101
 }
102
 
103
 
104
@@ -355,6 +349,7 @@
105
 
106
 
107
 
108
+int
109
 main(int argc,char** argv) {
110
   ServerPing ping(argc,argv);
111
   ping.go();
(-)games/xevil/files/patch-x11::ui.cpp (-31 / +277 lines)
Lines 1-131 Link Here
1
--- x11/ui.cpp.orig	2003-03-19 10:05:38.000000000 +0100
1
--- x11/ui.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ x11/ui.cpp	2007-07-31 16:05:35.000000000 +0200
2
+++ x11/ui.cpp	2012-05-27 06:52:59.000000000 +0900
3
@@ -40,8 +40,9 @@
3
@@ -30,6 +30,7 @@
4
 #include "utils.h"
5
 extern "C" {
6
 #include <string.h>
7
+#include <stdlib.h>
8
 #include <X11/Xutil.h>
9
 #ifdef OPENWOUND_XOS_STRLEN_HACK
10
 #define _strings_h
11
@@ -40,8 +41,8 @@
4
 #include <X11/Xatom.h>
12
 #include <X11/Xatom.h>
5
 }
13
 }
6
 
14
 
7
-#include <iostream.h>
15
-#include <iostream.h>
8
-#include <strstream.h>
16
-#include <strstream.h>
9
+#include <iostream>
17
+#include <iostream>
10
+#include <strstream>
18
+#include <sstream>
11
+using namespace std;
12
 
19
 
13
 #include "coord.h"
20
 #include "coord.h"
14
 #include "area.h"
21
 #include "area.h"
15
@@ -930,7 +931,7 @@
22
@@ -59,6 +60,7 @@
23
 #include "panel.h"
24
 #include "viewport.h"
25
 
26
+using namespace std;
27
 
28
 // Defines
29
 #define DEFAULT_BIG_FONT_NAME "-*-helvetica-*-r-*-*-18-*-*-*-*-*-*-*"
30
@@ -226,20 +228,6 @@
31
   for (int d = 0; d < xvars.dpyMax; d++) {
32
     xvars.alloc_named_color(d,"steelblue");
33
   }
34
-  
35
-  // Run the license agreement.
36
-  // Note: The license agreement will not be run if the user runs
37
-  // "xevil -server -no_ui".
38
-  // Must be after init_x().
39
-  Boolean reduceDraw = Viewport::get_reduce_draw();
40
-  Boolean accepted = 
41
-    LAgreement::check_accepted(largeViewport,smoothScroll,reduceDraw,
42
-                               xvars,0,argc,argv);
43
-  Viewport::set_reduce_draw(reduceDraw);
44
-  if (!accepted) {
45
-    // Should probably let game.cpp call exit.
46
-    exit(1);
47
-  }
48
 
49
   // Ick, this should be in init_x(), but we need to call init_x() before
50
   // running the License Agreement to get this information.
51
@@ -461,21 +449,27 @@
52
     }
53
   }
54
 
55
-  if (down) {
56
-    // Restart game if space pressed.
57
-    // This doesn't always work, the otherInput flag might get cleared 
58
-    // before it is used.
59
-    if (keycode == XKeysymToKeycode(xvars.dpy[dpyNum],XK_space)) {
60
-      otherInput = True;
61
+    // If function keys are assigned to movement, weapon or item functions,
62
+    // then this code will not get executed.
63
+  if (down && !found) {
64
+    // Pause Game
65
+    if (keycode == XKeysymToKeycode(xvars.dpy[dpyNum],XK_F1)) {
66
+      settingsChanges |= UIpause;
67
+      settings.pause = True;
68
     }
69
-
70
-    if (!found) {
71
-      // Undocumented pause key feature.
72
-      // Don't do pause if XK_F1 is used for something else.
73
-      if (keycode == XKeysymToKeycode(xvars.dpy[dpyNum],XK_F1)) {
74
-        settingsChanges |= UIpause;
75
-        settings.pause = True;
76
-      }
77
+    // New Game
78
+    if (keycode == XKeysymToKeycode(xvars.dpy[dpyNum],XK_F2)) {
79
+      settingsChanges |= UInewGame;
80
+    }
81
+    // Change game style
82
+    if (keycode == XKeysymToKeycode(xvars.dpy[dpyNum],XK_F3)) {
83
+      settingsChanges |= UIstyle;
84
+      settings.style = (settings.style + 1) % NUM_GAME_STYLES;
85
+
86
+        // Avoid the LEVELS_ONLY option. There was no button before
87
+	// I got here. Avoiding the ability to set it until I
88
+	// discover why
89
+      settings.style += (settings.style == LEVELS_ONLY) ? 1 : 0;
90
     }
91
   }
92
 }
93
@@ -865,7 +859,7 @@
94
       char *msg;
95
       if (msg = locator->message_deq()) {
96
         set_message(msg);
97
-        delete msg;
98
+        delete [] msg;
99
         messageTimer.set(MESSAGE_TIME);
100
       }
101
     }
102
@@ -930,7 +924,7 @@
16
   UiP ui = (UiP)closure;
103
   UiP ui = (UiP)closure;
17
   ui->settingsChanges |= UIenemiesRefill;
104
   ui->settingsChanges |= UIenemiesRefill;
18
   // SGI compiler says you can't cast void* to Boolean.
105
   // SGI compiler says you can't cast void* to Boolean.
19
-  Boolean val = (Boolean)(int)value;
106
-  Boolean val = (Boolean)(int)value;
20
+  Boolean val = (Boolean)(intptr_t)value;
107
+  Boolean val = (Boolean)(long)value;
21
   ui->settings.enemiesRefill = val;
108
   ui->settings.enemiesRefill = val;
22
 }
109
 }
23
 
110
 
24
@@ -939,7 +940,7 @@
111
@@ -939,7 +933,7 @@
25
 void Ui::menu_controls_CB(void* value,Viewport* vPort,void* closure) {
112
 void Ui::menu_controls_CB(void* value,Viewport* vPort,void* closure) {
26
   UiP ui = (UiP)closure;
113
   UiP ui = (UiP)closure;
27
   int dpyNum = vPort->get_dpy_num();
114
   int dpyNum = vPort->get_dpy_num();
28
-  Boolean val = (Boolean)(int)value;
115
-  Boolean val = (Boolean)(int)value;
29
+  Boolean val = (Boolean)(intptr_t)value;
116
+  Boolean val = (Boolean)(long)value;
30
   if (val) {
117
   if (val) {
31
     XMapWindow(ui->xvars.dpy[dpyNum],ui->xdata.controls[dpyNum]);
118
     XMapWindow(ui->xvars.dpy[dpyNum],ui->xdata.controls[dpyNum]);
32
   }
119
   }
33
@@ -955,7 +956,7 @@
120
@@ -955,13 +949,13 @@
34
                                 Viewport* vPort,void* closure) {
121
                                 Viewport* vPort,void* closure) {
35
   UiP ui = (UiP)closure;
122
   UiP ui = (UiP)closure;
36
   int dpyNum = vPort->get_dpy_num();
123
   int dpyNum = vPort->get_dpy_num();
37
-  Boolean active = (Boolean)(int)value;
124
-  Boolean active = (Boolean)(int)value;
38
+  Boolean active = (Boolean)(intptr_t)value;
125
+  Boolean active = (Boolean)(long)value;
39
 
126
 
40
   if (active) {
127
   if (active) {
41
     ui->lControls[dpyNum].input = ui->lControls[dpyNum].key = 
128
     ui->lControls[dpyNum].input = ui->lControls[dpyNum].key = 
42
@@ -994,7 +995,7 @@
129
       ui->lControls[dpyNum].which = 0;
130
       
131
-    ostrstream str;
132
+    stringstream str;
133
     str << "There are 2 sets of controls for the players on the right and" 
134
         << "\n"
135
         << "left sides of the keyboard, respectively." << "\n"
136
@@ -979,10 +973,9 @@
137
         << " player enter the " 
138
         << (ui->lControls[dpyNum].which ? "second" : "first") 
139
         << " key for <" << ui->keysNames[ui->lControls[dpyNum].key] 
140
-        << ">." << ends;
141
+        << ">.";
142
     
143
-    ui->learnControls[dpyNum]->set_message(str.str());
144
-    delete str.str();
145
+    ui->learnControls[dpyNum]->set_message(str.str().c_str());
146
     XMapWindow(ui->xvars.dpy[dpyNum],ui->xdata.learnControls[dpyNum]);
147
   }
148
   else {
149
@@ -994,7 +987,7 @@
43
 
150
 
44
 void Ui::menu_scenarios_CB(void* value,Viewport*,void* closure) {
151
 void Ui::menu_scenarios_CB(void* value,Viewport*,void* closure) {
45
   UiP ui = (UiP)closure;
152
   UiP ui = (UiP)closure;
46
-  Boolean val = (Boolean)(int)value;
153
-  Boolean val = (Boolean)(int)value;
47
+  Boolean val = (Boolean)(intptr_t)value;
154
+  Boolean val = (Boolean)(long)value;
48
   if (val) {
155
   if (val) {
49
     ui->settingsChanges |= UIstyle;
156
     ui->settingsChanges |= UIstyle;
50
     ui->settings.style = SCENARIOS;
157
     ui->settings.style = SCENARIOS;
51
@@ -1005,7 +1006,7 @@
158
@@ -1005,7 +998,7 @@
52
 
159
 
53
 void Ui::menu_levels_CB(void* value,Viewport*,void* closure) {
160
 void Ui::menu_levels_CB(void* value,Viewport*,void* closure) {
54
   UiP ui = (UiP)closure;
161
   UiP ui = (UiP)closure;
55
-  Boolean val = (Boolean)(int)value;
162
-  Boolean val = (Boolean)(int)value;
56
+  Boolean val = (Boolean)(intptr_t)value;
163
+  Boolean val = (Boolean)(long)value;
57
   if (val) {
164
   if (val) {
58
     ui->settingsChanges |= UIstyle;
165
     ui->settingsChanges |= UIstyle;
59
     ui->settings.style = LEVELS;
166
     ui->settings.style = LEVELS;
60
@@ -1016,7 +1017,7 @@
167
@@ -1016,7 +1009,7 @@
61
 
168
 
62
 void Ui::menu_kill_CB(void* value,Viewport*,void* closure) {
169
 void Ui::menu_kill_CB(void* value,Viewport*,void* closure) {
63
   UiP ui = (UiP)closure;
170
   UiP ui = (UiP)closure;
64
-  Boolean val = (Boolean)(int)value;
171
-  Boolean val = (Boolean)(int)value;
65
+  Boolean val = (Boolean)(intptr_t)value;
172
+  Boolean val = (Boolean)(long)value;
66
   if (val) {
173
   if (val) {
67
     ui->settingsChanges |= UIstyle;
174
     ui->settingsChanges |= UIstyle;
68
     ui->settings.style = KILL;
175
     ui->settings.style = KILL;
69
@@ -1027,7 +1028,7 @@
176
@@ -1027,7 +1020,7 @@
70
 
177
 
71
 void Ui::menu_duel_CB(void* value,Viewport*,void* closure) {
178
 void Ui::menu_duel_CB(void* value,Viewport*,void* closure) {
72
   UiP ui = (UiP)closure;
179
   UiP ui = (UiP)closure;
73
-  Boolean val = (Boolean)(int)value;
180
-  Boolean val = (Boolean)(int)value;
74
+  Boolean val = (Boolean)(intptr_t)value;
181
+  Boolean val = (Boolean)(long)value;
75
   if (val) {
182
   if (val) {
76
     ui->settingsChanges |= UIstyle;
183
     ui->settingsChanges |= UIstyle;
77
     ui->settings.style = DUEL;
184
     ui->settings.style = DUEL;
78
@@ -1038,7 +1039,7 @@
185
@@ -1038,7 +1031,7 @@
79
 
186
 
80
 void Ui::menu_extended_CB(void* value,Viewport*,void* closure) {
187
 void Ui::menu_extended_CB(void* value,Viewport*,void* closure) {
81
   UiP ui = (UiP)closure;
188
   UiP ui = (UiP)closure;
82
-  Boolean val = (Boolean)(int)value;
189
-  Boolean val = (Boolean)(int)value;
83
+  Boolean val = (Boolean)(intptr_t)value;
190
+  Boolean val = (Boolean)(long)value;
84
   if (val) {
191
   if (val) {
85
     ui->settingsChanges |= UIstyle;
192
     ui->settingsChanges |= UIstyle;
86
     ui->settings.style = EXTENDED;
193
     ui->settings.style = EXTENDED;
87
@@ -1049,7 +1050,7 @@
194
@@ -1049,7 +1042,7 @@
88
 
195
 
89
 void Ui::menu_training_CB(void* value,Viewport*,void* closure) {
196
 void Ui::menu_training_CB(void* value,Viewport*,void* closure) {
90
   UiP ui = (UiP)closure;
197
   UiP ui = (UiP)closure;
91
-  Boolean val = (Boolean)(int)value;
198
-  Boolean val = (Boolean)(int)value;
92
+  Boolean val = (Boolean)(intptr_t)value;
199
+  Boolean val = (Boolean)(long)value;
93
   if (val) {
200
   if (val) {
94
     ui->settingsChanges |= UIstyle;
201
     ui->settingsChanges |= UIstyle;
95
     ui->settings.style = TRAINING;
202
     ui->settings.style = TRAINING;
96
@@ -1070,7 +1071,7 @@
203
@@ -1070,7 +1063,7 @@
97
 void Ui::menu_cooperative_CB(void* value,Viewport*,void* closure) {
204
 void Ui::menu_cooperative_CB(void* value,Viewport*,void* closure) {
98
   UiP ui = (UiP)closure;
205
   UiP ui = (UiP)closure;
99
   ui->settingsChanges |= UIcooperative;
206
   ui->settingsChanges |= UIcooperative;
100
-  Boolean val = (Boolean)(int)value;
207
-  Boolean val = (Boolean)(int)value;
101
+  Boolean val = (Boolean)(intptr_t)value;
208
+  Boolean val = (Boolean)(long)value;
102
   ui->settings.cooperative = val;
209
   ui->settings.cooperative = val;
103
 }
210
 }
104
 
211
 
105
@@ -1079,7 +1080,7 @@
212
@@ -1079,7 +1072,7 @@
106
 void Ui::menu_help_CB(void* value,Viewport* vPort,void* closure) {
213
 void Ui::menu_help_CB(void* value,Viewport* vPort,void* closure) {
107
   UiP ui = (UiP)closure;
214
   UiP ui = (UiP)closure;
108
   int dpyNum = vPort->get_dpy_num();
215
   int dpyNum = vPort->get_dpy_num();
109
-  Boolean active = (Boolean)(int)value;
216
-  Boolean active = (Boolean)(int)value;
110
+  Boolean active = (Boolean)(intptr_t)value;
217
+  Boolean active = (Boolean)(long)value;
111
 
218
 
112
   if (active) {
219
   if (active) {
113
     XMapWindow(ui->xvars.dpy[dpyNum],ui->xdata.help[dpyNum]);
220
     XMapWindow(ui->xvars.dpy[dpyNum],ui->xdata.help[dpyNum]);
114
@@ -1094,7 +1095,7 @@
221
@@ -1094,7 +1087,7 @@
115
 void Ui::status_weapon_CB(void* value,Viewport* vPort,void*) {
222
 void Ui::status_weapon_CB(void* value,Viewport* vPort,void*) {
116
   // Some mouse controls.
223
   // Some mouse controls.
117
   //  UiP ui = (UiP)closure;
224
   //  UiP ui = (UiP)closure;
118
-  int button = (int)value;
225
-  int button = (int)value;
119
+  intptr_t button = (intptr_t)value;
226
+  long button = (long)value;
120
 
227
 
121
   switch (button) {
228
   switch (button) {
122
   case Button1:
229
   case Button1:
123
@@ -1113,7 +1114,7 @@
230
@@ -1113,7 +1106,7 @@
124
 
231
 
125
 void Ui::status_item_CB(void* value,Viewport* vPort,void*) {
232
 void Ui::status_item_CB(void* value,Viewport* vPort,void*) {
126
   //  UiP ui = (UiP)closure;
233
   //  UiP ui = (UiP)closure;
127
-  int button = (int)value;
234
-  int button = (int)value;
128
+  intptr_t button = (intptr_t)value;
235
+  long button = (long)value;
129
 
236
 
130
   switch (button) {
237
   switch (button) {
131
   case Button1:
238
   case Button1:
239
@@ -1167,14 +1160,14 @@
240
     return;
241
   }
242
 
243
-  ostrstream str;
244
+  stringstream str;
245
   str << (ui->lControls[dpyNum].input ? "Left" : "Right") 
246
       << " player: The "
247
       << (ui->lControls[dpyNum].which ? "second" : "first") << " key for <" 
248
       << ui->keysNames[ui->lControls[dpyNum].key] << "> is "
249
       << XKeysymToString(XKeycodeToKeysym(ui->xvars.dpy[dpyNum],
250
 					  event->xkey.keycode,0))
251
-      << "." << "\n" << "\n";
252
+      << ".\n\n";
253
   ui->keycodes[dpyNum][ui->lControls[dpyNum].input]
254
     [ui->lControls[dpyNum].key][ui->lControls[dpyNum].which] =
255
       event->xkey.keycode;
256
@@ -1222,21 +1215,18 @@
257
       << " player enter the " 
258
       << (ui->lControls[dpyNum].which ? "second" : "first") 
259
       << " key for <" << keysNames[ui->lControls[dpyNum].key] 
260
-	<< ">." << ends;
261
+	<< ">.";
262
 
263
   // Add message in front of str.str().
264
-  ostrstream fullStr;
265
+  stringstream fullStr;
266
   if (ui->lControls[dpyNum].input == UI_KEYS_LEFT) {
267
     fullStr << "You may dismiss this dialog now if you only want to" << "\n"
268
-           << "set the controls for one player." 
269
-            << "\n" << "\n";
270
+           << "set the controls for one player.\n\n";
271
   }
272
-  fullStr << str.str() << ends;
273
-  delete str.str();
274
+  fullStr << str.str();
275
  
276
 
277
-  ui->learnControls[dpyNum]->set_message(fullStr.str());
278
-  delete fullStr.str();
279
+  ui->learnControls[dpyNum]->set_message(fullStr.str().c_str());
280
 
281
   ui->controls_redraw(dpyNum);
282
 }
283
@@ -1537,7 +1527,7 @@
284
   Line::set_text_columns(HELP_COLS);
285
   Page page(NULL,helpMessage);
286
   const PtrList& lines = page.get_lines();
287
-  ostrstream message;
288
+  stringstream message;
289
   for (int n = 0; n < lines.length(); n++) {
290
     Line* line = (Line*)lines.get(n);
291
     char* text = line->alloc_text();
292
@@ -1545,7 +1535,6 @@
293
     message << text << '\n';
294
     delete [] text;
295
   }
296
-  message << ends;
297
 
298
 
299
   for (int dpyNum = 0; dpyNum < xvars.dpyMax; dpyNum++) {
300
@@ -1564,10 +1553,8 @@
301
       new TextPanel(dpyNum,xvars,xdata.help[dpyNum],pos,size);
302
     assert(help[dpyNum]);    
303
 
304
-    help[dpyNum]->set_message(message.str());
305
+    help[dpyNum]->set_message(message.str().c_str());
306
   } // dpyNum
307
-
308
-  delete message.str();
309
 }
310
 
311
 
312
@@ -1621,7 +1608,7 @@
313
   // Loop through all keys.
314
   for (int n = 0; n < UI_KEYS_MAX; n++) {
315
     // String for right side.
316
-    strstream str0;
317
+    stringstream str0;
318
     str0 << keysNames[n] << ":  " << XKeysymToString(keymaps[0][n][0][0]);
319
     if (keymaps[0][n][0][1] && strlen(XKeysymToString(keymaps[0][n][0][1])))
320
       str0 << ", " << XKeysymToString(keymaps[0][n][0][1]);
321
@@ -1631,10 +1618,9 @@
322
 	      && strlen(XKeysymToString(keymaps[0][n][1][1])))
323
 	    str0 << ", " << XKeysymToString(keymaps[0][n][1][1]);
324
 	}
325
-    str0 << ends;
326
     
327
     // String for left side.
328
-    strstream str1;
329
+    stringstream str1;
330
     str1 << keysNames[n] << ":  " << XKeysymToString(keymaps[1][n][0][0]);
331
     if (keymaps[1][n][0][1] && strlen(XKeysymToString(keymaps[1][n][0][1]))) {
332
       str1 << ", " << XKeysymToString(keymaps[1][n][0][1]);
333
@@ -1645,7 +1631,6 @@
334
 	      && strlen(XKeysymToString(keymaps[1][n][1][1])))
335
 	    str1 << ", " << XKeysymToString(keymaps[1][n][1][1]);
336
 	}
337
-    str1 << ends;
338
     
339
     // Draw key on left side.
340
     if (n != IT_CHAT) {  // Chat meaningless for left player.
341
@@ -1653,16 +1638,14 @@
342
                   xvars.fontSize[dpyNum].width,
343
                   xvars.font[dpyNum]->max_bounds.ascent 
344
                   + p * xvars.fontSize[dpyNum].height,
345
-                  str1.str(),strlen(str1.str()));
346
+                  str1.str().c_str(),str1.str().length());
347
     }
348
     // Draw on right side.
349
     XDrawString(xvars.dpy[dpyNum],xdata.controls[dpyNum],xvars.gc[dpyNum],
350
                 xvars.fontSize[dpyNum].width * (CONTROLS_COLS / 2 + 1),
351
                 xvars.font[dpyNum]->max_bounds.ascent 
352
                 + (p++) * xvars.fontSize[dpyNum].height,
353
-                str0.str(),strlen(str0.str()));
354
-    delete str0.str();
355
-    delete str1.str();
356
+                str0.str().c_str(),str0.str().length());
357
   }
358
   p++;
359
   
360
@@ -1693,7 +1676,7 @@
361
 
362
 
363
 
364
-char *Ui::keysNames[UI_KEYS_MAX] = {
365
+const char *Ui::keysNames[UI_KEYS_MAX] = {
366
   "center",
367
   "right",
368
   "down_right",
369
@@ -1752,7 +1735,7 @@
370
 
371
 
372
 
373
-char* Ui::helpMessage = 
374
+const char* Ui::helpMessage = 
375
 "For full instructions, including NETWORK PLAY, see "
376
 "http://www.xevil.com/docs/instructions.html\n"
377
 "\n"
(-)games/xevil/files/patch-x11::viewport.cpp (-7 / +280 lines)
Lines 1-21 Link Here
1
--- x11/viewport.cpp.orig	2000-01-19 12:54:14.000000000 +0100
1
--- x11/viewport.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ x11/viewport.cpp	2007-07-31 15:59:37.000000000 +0200
2
+++ x11/viewport.cpp	2012-05-27 06:52:59.000000000 +0900
3
@@ -44,7 +44,8 @@
3
@@ -44,8 +44,9 @@
4
 #include <X11/Xos.h>
4
 #include <X11/Xos.h>
5
 #include <X11/keysym.h>
5
 #include <X11/keysym.h>
6
 }
6
 }
7
-#include <strstream.h>
7
-#include <strstream.h>
8
+#include <strstream>
8
+#include <sstream>
9
+using namespace std;
10
 
9
 
10
+using namespace std;
11
 
11
 
12
 #define TICK_BORDER_WIDTH 5 // border width big enough for a tick mark.
12
 #define TICK_BORDER_WIDTH 5 // border width big enough for a tick mark.
13
@@ -1632,7 +1633,7 @@
13
 #define TICK_WIDTH 3
14
@@ -60,14 +61,14 @@
15
 #define COL_SHIFT 4
16
 
17
 // Number of characters across for each menu button.
18
-#define QUIT_LINE_LENGTH 5
19
-#define NEW_GAME_LINE_LENGTH 9
20
+#define QUIT_LINE_LENGTH 4
21
+#define NEW_GAME_LINE_LENGTH 13
22
 #define HUMANS_NUM_LINE_LENGTH 9
23
 #define ENEMIES_NUM_LINE_LENGTH 11
24
 #define ENEMIES_REFILL_LINE_LENGTH 13
25
 #define CONTROLS_LINE_LENGTH 13
26
 #define LEARN_CONTROLS_LINE_LENGTH 12
27
-#define STYLE_LINE_LENGTH 11
28
+#define STYLE_LINE_LENGTH 16
29
 #define SCENARIOS_LINE_LENGTH 9
30
 #define LEVELS_LINE_LENGTH 6
31
 #define KILL_LINE_LENGTH 16
32
@@ -1056,20 +1057,18 @@
33
 
34
 void Viewport::set_menu_humans_num(int val) {
35
   assert(menusNum > menuHumansNum);
36
-  ostrstream str;
37
-  str << val << ends;
38
-  ((WritePanel *)menus[menuHumansNum])->set_value(str.str());
39
-  delete str.str();
40
+  stringstream str;
41
+  str << val;
42
+  ((WritePanel *)menus[menuHumansNum])->set_value(str.str().c_str());
43
 }
44
  
45
 
46
 
47
 void Viewport::set_menu_enemies_num(int val) {
48
   assert(menusNum > menuEnemiesNum);
49
-  ostrstream str;
50
-  str << val << ends;
51
-  ((WritePanel *)menus[menuEnemiesNum])->set_value(str.str());
52
-  delete str.str();
53
+  stringstream str;
54
+  str << val;
55
+  ((WritePanel *)menus[menuEnemiesNum])->set_value(str.str().c_str());
56
 }
57
 
58
 
59
@@ -1128,10 +1127,9 @@
60
 
61
 void Viewport::set_quanta(Quanta quanta) {
62
   assert(menusNum > menuQuanta);
63
-  ostrstream str;
64
-  str << quanta << ends;
65
-  ((WritePanel *)menus[menuQuanta])->set_value(str.str());
66
-  delete str.str();  
67
+  stringstream str;
68
+  str << quanta;
69
+  ((WritePanel *)menus[menuQuanta])->set_value(str.str().c_str());
70
 } 
71
 
72
 
73
@@ -1144,33 +1142,27 @@
74
 
75
 
76
 void Viewport::set_humans_playing(int val) {  
77
-  ostrstream msg;
78
+  stringstream msg;
79
   if (val == 1) {
80
-    msg << "1 Human" << ends;
81
+    msg << "1 Human";
82
   }
83
   else {
84
-    msg << val << " Humans" << ends;
85
+    msg << val << " Humans";
86
   }
87
-  char *msg_str = msg.str();
88
-  
89
-  humansPlaying->set_message(msg_str);
90
-  delete msg_str;
91
+  humansPlaying->set_message(msg.str().c_str());
92
 }
93
 
94
 
95
 
96
 void Viewport::set_enemies_playing(int val) {  
97
-  ostrstream msg;
98
+  stringstream msg;
99
   if (val == 1) {
100
-    msg << "1 Enemy" << ends; 
101
+    msg << "1 Enemy";
102
   }
103
   else {
104
-    msg << val << " Enemies" << ends; 
105
+    msg << val << " Enemies";
106
   }
107
-  char *msg_str = msg.str();
108
-  
109
-  enemiesPlaying->set_message(msg_str);
110
-  delete msg_str;
111
+  enemiesPlaying->set_message(msg.str().c_str());
112
 }
113
 
114
 
115
@@ -1632,7 +1624,7 @@
14
   // Would be much better to put the radio-button logic in the Panel classes.
116
   // Would be much better to put the radio-button logic in the Panel classes.
15
   if (pClosure->radio) {
117
   if (pClosure->radio) {
16
     // SGI compiler says you can't cast void* to Boolean.
118
     // SGI compiler says you can't cast void* to Boolean.
17
-    Boolean bValue = (Boolean)(int)value;
119
-    Boolean bValue = (Boolean)(int)value;
18
+    Boolean bValue = (Boolean)(intptr_t)value;
120
+    Boolean bValue = (Boolean)(long)value;
19
     if (!bValue) {
121
     if (!bValue) {
20
       ((TogglePanel*)panel)->set_value(True);
122
       ((TogglePanel*)panel)->set_value(True);
21
     }
123
     }
124
@@ -1701,7 +1693,7 @@
125
       pos.y += xvars.fontSize[dpyNum].height;
126
       
127
       for (int n = 0; n < DIFFICULTY_LEVELS_NUM; n++) {
128
-        ostrstream str;
129
+        stringstream str;
130
         str << "[" << n;
131
         if (n == DIFF_NORMAL) {
132
           str << ",space]  ";
133
@@ -1709,10 +1701,9 @@
134
         else {
135
           str << "]        ";
136
         }
137
-        str << difficultyLevels[n].name << ends;
138
+        str << difficultyLevels[n].name;
139
         pos.y += xvars.fontSize[dpyNum].height;
140
-        draw_string(pos,str.str());
141
-        delete str.str();
142
+        draw_string(pos,str.str().c_str());
143
       }
144
       
145
       XSetForeground(xvars.dpy[dpyNum],xvars.gc[dpyNum],
146
@@ -1733,7 +1724,7 @@
147
 
148
 
149
 
150
-void Viewport::draw_string(const Pos &pos,char *msg) {
151
+void Viewport::draw_string(const Pos &pos,const char *msg) {
152
   XDrawString(xvars.dpy[dpyNum],arena,
153
               xvars.gc[dpyNum],
154
               pos.x,pos.y + xvars.font[dpyNum]->max_bounds.ascent,
155
@@ -1930,7 +1921,7 @@
156
       new ButtonPanel(dpyNum,xvars,toplevel,
157
                       pos,newGameUnit,
158
                       Viewport::panel_callback,panelClosures.get(menuNewGame),
159
-                      "New Game");
160
+                      "New Game (F2)");
161
     assert(p);
162
     p->set_background(menuBg,False);
163
     pos.x += newGameUnit.width;
164
@@ -2016,7 +2007,7 @@
165
       new TextPanel(dpyNum,xvars,toplevel,
166
                     pos,styleUnit,
167
                     NULL,NULL,
168
-                    "Game style:");
169
+                    "Game style: (F3)");
170
     assert(p);
171
     //      p->set_background(menuBg,False);
172
     pos.x += styleUnit.width;
173
@@ -2194,33 +2185,24 @@
174
   }
175
 
176
   const IntelStatus *status = intel->get_intel_status();
177
+  statuses[statusName]->set_message(status->name);
178
+
179
+  statuses[statusClassName]->set_message(status->className);
180
   
181
-  ostrstream name;
182
-  name << status->name << ends;
183
-  statuses[statusName]->set_message(name.str());
184
-  delete name.str();
185
-
186
-  ostrstream className;
187
-  className << status->className << ends;
188
-  statuses[statusClassName]->set_message(className.str());
189
-  delete className.str();
190
-  
191
-  ostrstream health;
192
+  stringstream health;
193
   if (status->health == -1) {
194
-    health << "Dead" << ends;
195
+    health << "Dead";
196
   }
197
   else {
198
-    health << status->health << " Health" << ends; 
199
+    health << status->health << " Health";
200
   }
201
-  statuses[statusHealth]->set_message(health.str());
202
-  delete health.str();
203
+  statuses[statusHealth]->set_message(health.str().c_str());
204
   
205
-  ostrstream mass;
206
-  mass << status->mass << " Mass" << ends;
207
-  statuses[statusMass]->set_message(mass.str());
208
-  delete mass.str();
209
+  stringstream mass;
210
+  mass << status->mass << " Mass";
211
+  statuses[statusMass]->set_message(mass.str().c_str());
212
   
213
-  ostrstream weapon;
214
+  stringstream weapon;
215
   if (status->weaponClassId == A_None) {
216
     weapon << "No Weapon";
217
   }
218
@@ -2230,62 +2212,56 @@
219
   if (status->ammo != PH_AMMO_UNLIMITED) {
220
     weapon << " (" << status->ammo << ")";
221
   }
222
-  weapon << ends;
223
   statuses[statusWeapon]->
224
     set_foreground(status->weaponReady ? 
225
                    xvars.green[dpyNum] : xvars.red[dpyNum],False);
226
-  statuses[statusWeapon]->set_message(weapon.str());
227
-  delete weapon.str();
228
+  statuses[statusWeapon]->set_message(weapon.str().c_str());
229
   
230
-  ostrstream item;
231
+  stringstream item;
232
   if (status->itemClassId == A_None) {
233
     item << "No Item";
234
   }
235
   else {
236
     item << status->item << " (" << status->itemCount << ")";
237
   }
238
-  item << ends;
239
-  statuses[statusItem]->set_message(item.str());
240
-  delete item.str();
241
+  statuses[statusItem]->set_message(item.str().c_str());
242
   
243
-  ostrstream livesHKills;
244
+  stringstream livesHKills;
245
   if (styleInfo->get_game_style_type() == EXTENDED) {
246
     // Takes soups into account.
247
     livesHKills << (status->humanKills - status->soups) 
248
-                << " Human Kills" << ends;
249
+                << " Human Kills";
250
   }
251
   else {
252
     if (status->lives == IT_INFINITE_LIVES) {
253
       // Does this case ever happen?  I don't think so.
254
-      livesHKills << "Unlimited Lives" << ends;
255
+      livesHKills << "Unlimited Lives";
256
     }
257
     else {
258
       if (status->lives == 1) {
259
-        livesHKills << "1 Life" << ends;
260
+        livesHKills << "1 Life";
261
       }
262
       else {
263
-        livesHKills << status->lives << " Lives" << ends;
264
+        livesHKills << status->lives << " Lives";
265
       }
266
     }
267
   }
268
-  statuses[statusLivesHKills]->set_message(livesHKills.str());
269
-  delete livesHKills.str();
270
+  statuses[statusLivesHKills]->set_message(livesHKills.str().c_str());
271
   
272
-  ostrstream killsMKills;
273
+  stringstream killsMKills;
274
   if (styleInfo->get_game_style_type() == EXTENDED) {
275
-    killsMKills << status->enemyKills << " Machine Kills" << ends;
276
+    killsMKills << status->enemyKills << " Machine Kills";
277
   }
278
   else {
279
     int kills = status->humanKills + status->enemyKills;
280
     if (kills == 1) {
281
-      killsMKills << "1 Kill" << ends;
282
+      killsMKills << "1 Kill";
283
     }
284
     else {
285
-      killsMKills << kills << " Kills" << ends;
286
+      killsMKills << kills << " Kills";
287
     }
288
   }
289
-  statuses[statusKillsMKills]->set_message(killsMKills.str());
290
-  delete killsMKills.str();
291
+  statuses[statusKillsMKills]->set_message(killsMKills.str().c_str());
292
 }
293
 
294
 
(-)games/xevil/files/patch-x11::xdata.cpp (-4 / +93 lines)
Lines 1-12 Link Here
1
--- x11/xdata.cpp.orig	Wed Jan 19 12:54:14 2000
1
--- x11/xdata.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ x11/xdata.cpp	Sat Oct 25 21:49:26 2003
2
+++ x11/xdata.cpp	2012-05-27 06:52:59.000000000 +0900
3
@@ -30,7 +30,8 @@
3
@@ -1,4 +1,5 @@
4
 /* 
5
+ * WK - note to self - search for xpmcreate
6
  * XEvil(TM) Copyright (C) 1994,2000 Steve Hardt and Michael Judge
7
  * http://www.xevil.com
8
  * satan@xevil.com
9
@@ -30,11 +31,12 @@
4
 #include "xdata.h"
10
 #include "xdata.h"
5
 #include "area.h"
11
 #include "area.h"
6
 
12
 
7
-#include <iostream.h>
13
-#include <iostream.h>
8
+#include <iostream>
14
+#include <iostream>
9
+using namespace std;
10
 #include <X11/Xutil.h>
15
 #include <X11/Xutil.h>
11
 #include <X11/xpm.h>
16
 #include <X11/xpm.h>
12
 #include <X11/Xatom.h>
17
 #include <X11/Xatom.h>
18
 
19
+using namespace std;
20
 
21
 
22
 // Means always allocate some color, even if it's really, really bad.
23
@@ -47,9 +49,16 @@
24
                                      int dpyNum,const Size& size,
25
                                      const char* title,
26
                                      long eventMask) {
27
+
28
+  // Get Size of screen, so we can center Window
29
+  XWindowAttributes root_window_attributes;
30
+  XGetWindowAttributes(dpy[dpyNum],root[dpyNum], &root_window_attributes);
31
+  int left = (root_window_attributes.width - size.width) / 2;
32
+  int top = (root_window_attributes.height - size.height) / 3;
33
+
34
   // Creates with 0 border width.
35
   Window toplevel = 
36
-    XCreateSimpleWindow(dpy[dpyNum],root[dpyNum],0,0,
37
+    XCreateSimpleWindow(dpy[dpyNum],root[dpyNum],left,top,
38
                         size.width,size.height,
39
                         0,windowBorder[dpyNum],
40
                         windowBg[dpyNum]);
41
@@ -90,7 +99,9 @@
42
 
43
   XClassHint class_hints;
44
   class_hints.res_name = argv[0];
45
-  class_hints.res_class = "XEvil";
46
+
47
+  static char res_class[] = "XEvil";
48
+  class_hints.res_class = res_class;
49
 
50
   XSetWMProperties(dpy[dpyNum],toplevel,
51
                    &windowName,&iconName,argv,argc,
52
@@ -185,14 +196,14 @@
53
 
54
 
55
 Boolean Xvars::load_pixmap(Drawable* pixmap,Drawable* mask,
56
-                           int dpyNum,char** xpmBits) {
57
+                           int dpyNum, const char** xpmBits) {
58
   return load_pixmap(pixmap,mask,dpyNum,xpmBits,is_stretched());
59
 }
60
 
61
 
62
 
63
 Boolean Xvars::load_pixmap(Drawable* pixmap,Drawable* mask,
64
-                           int dpyNum,char** xpmBits,Boolean fullSize) {
65
+                           int dpyNum, const char** xpmBits,Boolean fullSize) {
66
   // Just load XPM as is.
67
   if (fullSize) {
68
     XpmAttributes attr;
69
@@ -200,9 +211,9 @@
70
     attr.closeness = XPM_CLOSENESS;
71
     attr.alloc_close_colors = True;
72
 
73
-    int val = 
74
+  int val = 
75
       XpmCreatePixmapFromData(dpy[dpyNum],root[dpyNum],
76
-                              xpmBits,
77
+                              const_cast<char **> (xpmBits),
78
                               pixmap,mask,
79
                               &attr);
80
     XpmFreeAttributes(&attr);
81
@@ -212,7 +223,7 @@
82
       ret = False;
83
     }
84
 
85
-    return ret; 
86
+    return ret;
87
   }
88
 
89
 
90
@@ -231,9 +242,8 @@
91
 
92
   // Perhaps should use XpmReturnAllocPixels, neither gives the transparent 
93
   // value.
94
-  int val = 
95
-    XpmCreateImageFromData(dpy[dpyNum],
96
-                           xpmBits,
97
+  int val = XpmCreateImageFromData(dpy[dpyNum],
98
+                           const_cast<char **> (xpmBits),
99
                            &srcImage,(mask ? &srcMask : (XImage**)NULL),
100
                            &attr);
101
   srcSize.width = attr.width;
(-)games/xevil/files/patch-x11__draw.cpp (+100 lines)
Line 0 Link Here
1
--- x11/draw.cpp.orig	2012-05-27 06:52:29.000000000 +0900
2
+++ x11/draw.cpp	2012-05-27 06:52:59.000000000 +0900
3
@@ -34,6 +34,7 @@
4
 // in Xvars instead.
5
 #include "viewport.h"  
6
 
7
+using namespace std;
8
 
9
 
10
 // Draw functions for World
11
@@ -327,7 +328,7 @@
12
       Boolean val = 
13
         xvars.load_pixmap(&xdata.blockPixmaps[dpyNum][n],
14
                           mask,dpyNum,
15
-                          (char**)blocksBits[n]);
16
+                          (const char**)blocksBits[n]);
17
       if (!val) {
18
         cerr << "Failed to load block " << n << endl;
19
       }
20
@@ -352,7 +353,7 @@
21
       Boolean val = 
22
         xvars.load_pixmap(&xdata.posterPixmaps[dpyNum][n],
23
                           &xdata.posterMasks[dpyNum][n],
24
-                          dpyNum,(char**)posters[n].id);
25
+                          dpyNum,(const char**)posters[n].id);
26
       if (!val) {
27
         cerr << "Failed to load poster " << n << endl;
28
       }
29
@@ -363,7 +364,7 @@
30
     for (n = 0; n < W_ALL_DOORS_NUM; n++) {
31
       Boolean val = 
32
         xvars.load_pixmap(&xdata.doorPixmaps[dpyNum][n],NULL,dpyNum,
33
-                          (char**)doorPixmapBits[n]);
34
+                          (const char**)doorPixmapBits[n]);
35
       if (!val) {
36
         cerr << "Failed to load door block " << n << endl;
37
       }
38
@@ -376,7 +377,7 @@
39
         xvars.load_pixmap(&xdata.moverSquarePixmaps[dpyNum][n],
40
                           &xdata.moverSquareMasks[dpyNum][n],
41
                           dpyNum,
42
-                          (char**)moverSquarePixmapBits[n]);
43
+                          (const char**)moverSquarePixmapBits[n]);
44
       if (!val) {
45
         cerr << "Failed to mover square " << n << endl;
46
       }
47
@@ -400,7 +401,7 @@
48
         xvars.load_pixmap(&xdata.moverPixmaps[dpyNum][n],
49
                           &xdata.moverMasks[dpyNum][n],
50
                           dpyNum,
51
-                          (char**)moverPixmapBits[n]);
52
+                          (const char**)moverPixmapBits[n]);
53
       if (!val) {
54
         cerr << "Failed to load mover " << n << endl;
55
       }
56
@@ -411,7 +412,7 @@
57
     for (n = 0; n < W_ALL_BACKGROUNDS_NUM; n++) {
58
       Boolean val = 
59
         xvars.load_pixmap(&xdata.backgroundPixmaps[dpyNum][n],NULL,dpyNum,
60
-                          (char**)backgrounds[n].id);
61
+                          (const char**)backgrounds[n].id);
62
       if (!val) {
63
         cerr << "Failed to load background " << n << endl;
64
       }
65
@@ -422,7 +423,7 @@
66
     for (n = 0; n < W_ALL_OUTSIDES_NUM; n++) {
67
       Boolean val = 
68
         xvars.load_pixmap(&xdata.outsidePixmaps[dpyNum][n],NULL,dpyNum,
69
-                          (char**)outsides[n].id);
70
+                          (const char**)outsides[n].id);
71
       if (!val) {
72
         cerr << "Failed to load outside " << n << endl;
73
       }
74
@@ -689,7 +690,7 @@
75
           assert(tickPixmapBits[tt][hp] != PH_AUTO_GEN);
76
           xvars.load_pixmap(&xdata.tickPixmaps[dpyNum][tt][hp],
77
                             &xdata.tickMasks[dpyNum][tt][hp],
78
-                            dpyNum,(char**)tickPixmapBits[tt][hp]);
79
+                            dpyNum,(const char**)tickPixmapBits[tt][hp]);
80
         }
81
       }
82
     }
83
@@ -1020,7 +1021,7 @@
84
   for (dpyNum = 0; dpyNum < xvars.dpyMax; dpyNum++) {
85
     Boolean val = xvars.load_pixmap(&xdata.pixmap[dpyNum],
86
                                     &xdata.mask[dpyNum],
87
-                                    dpyNum,(char**)fireBits);
88
+                                    dpyNum,(const char**)fireBits);
89
     if (!val) {
90
       cerr << "Failed to load fire graphics." << endl;
91
     }
92
@@ -1292,7 +1293,7 @@
93
         Boolean val = 
94
           xvars.load_pixmap(&movingXdata.pixmaps[dpyNum][n][m],
95
                             &movingXdata.masks[dpyNum][n][m],
96
-                            dpyNum,(char**)mc.pixmapBits[n][m]);
97
+                            dpyNum,(const char**)mc.pixmapBits[n][m]);
98
         if (!val) {
99
           cerr << "load_pixmap() failed for "
100
                << mc.physicalContext.className 
(-)games/xevil/files/patch-x11__ui.h (+20 lines)
Line 0 Link Here
1
--- x11/ui.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ x11/ui.h	2012-05-27 06:52:59.000000000 +0900
3
@@ -338,7 +338,7 @@
4
 
5
 
6
   // Variables.
7
-  static char *keysNames[UI_KEYS_MAX];
8
+  static const char *keysNames[UI_KEYS_MAX];
9
 
10
   char **argv;  // Warning: Exposing the rep.
11
   int argc;
12
@@ -402,7 +402,7 @@
13
   // The callbacks to export to the Viewport.
14
   static ViewportCallback viewportCallbacks[VIEWPORT_CB_NUM];
15
 
16
-  static char* helpMessage;
17
+  static const char* helpMessage;
18
 };
19
 
20
 #endif
(-)games/xevil/files/patch-x11__viewport.h (+11 lines)
Line 0 Link Here
1
--- x11/viewport.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ x11/viewport.h	2012-05-27 06:52:59.000000000 +0900
3
@@ -348,7 +348,7 @@
4
   /* NOTE: Will draw everything if redrawArena is true, else just what has
5
      changed. */
6
 
7
-  void draw_string(const Pos &pos,char *msg);
8
+  void draw_string(const Pos &pos,const char *msg);
9
   /* EFFECTS: Draw string msg using current GC on arena with upper left of
10
      character at position pos. */
11
 
(-)games/xevil/files/patch-x11__xdata.h (+28 lines)
Line 0 Link Here
1
--- x11/xdata.h.orig	2012-05-27 06:52:31.000000000 +0900
2
+++ x11/xdata.h	2012-05-27 06:52:58.000000000 +0900
3
@@ -74,7 +74,7 @@
4
 
5
 typedef XEvent *CMN_EVENTDATA;
6
 
7
-typedef char *CMN_COLOR;
8
+typedef const char *CMN_COLOR;
9
 
10
 
11
 
12
@@ -132,14 +132,14 @@
13
      transformations.  Use scratch for all scratch calculations. */
14
 
15
   Boolean load_pixmap(Drawable* pixmap,Drawable* mask,
16
-                      int dpyNum,char** xpmBits);
17
+                      int dpyNum, const char** xpmBits);
18
   /* MODIFIES: pixmap, mask */
19
   /* EFFECTS: Load an XPM pixmap and mask from xpmBits.  Only load mask if 
20
      non-NULL.  Reduce pixmap size by a factor of 2 if 
21
      !xvars.is_stretched(). */
22
 
23
   Boolean load_pixmap(Drawable* pixmap,Drawable* mask,
24
-                      int dpyNum,char** xpmBits,Boolean fullSize);
25
+                      int dpyNum, const char** xpmBits,Boolean fullSize);
26
   /* EFFECTS: Same as above load_pixmap() except caller explicitly 
27
      specifies whether pixmap is fullSize or reduced by a factor of 2. */
28
   /* NOTE: This method can be called before Xvars::stretch is set. */
(-)games/xevil/pkg-descr (-3 lines)
Lines 8-14 Link Here
8
Remover", while a good one might achieve a prestigious title such as
8
Remover", while a good one might achieve a prestigious title such as
9
"VP of Hell Marketing" or even "Lead Software Engineer of Hell".
9
"VP of Hell Marketing" or even "Lead Software Engineer of Hell".
10
10
11
The XEvil 2.X Instruction Manual is located in
12
/usr/X11R6/share/doc/xevil/instructions
13
14
WWW: http://www.xevil.com/
11
WWW: http://www.xevil.com/
(-)games/xevil/pkg-plist (-10 lines)
Lines 1-10 Link Here
1
bin/xevil
2
%%PORTDOCS%%%%DOCSDIR%%/instructions/UNIXSetControls.gif
3
%%PORTDOCS%%%%DOCSDIR%%/instructions/UNIXShowControls.gif
4
%%PORTDOCS%%%%DOCSDIR%%/instructions/UNIXmenu.gif
5
%%PORTDOCS%%%%DOCSDIR%%/instructions/instructions.html
6
%%PORTDOCS%%%%DOCSDIR%%/instructions/keysdlg.gif
7
%%PORTDOCS%%%%DOCSDIR%%/instructions/optionsdlg.gif
8
%%PORTDOCS%%%%DOCSDIR%%/readme.txt
9
%%PORTDOCS%%@dirrm %%DOCSDIR%%/instructions
10
%%PORTDOCS%%@dirrm %%DOCSDIR%%

Return to bug 172010