summaryrefslogtreecommitdiff
path: root/games/xevil/files/patch-cmn__actual.cpp
blob: 1b4fdd54e96cefc00643a778fa9cb4825dddee70 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
--- cmn/actual.cpp.orig	2012-05-27 06:52:29.000000000 +0900
+++ cmn/actual.cpp	2012-05-27 06:53:11.000000000 +0900
@@ -32,7 +32,7 @@
 
 // Include Files
 #if X11
-#include <strstream.h>
+#include <sstream>
 #endif
 #if WIN32
 #include <strstrea.h>
@@ -122,6 +122,7 @@
 #include "bitmaps/yeti/yeti.bitmaps"
 
 
+using namespace std;
 
 ///// Some helper macros to define creatures with certain abilities.
 #define DEFINE_CREATURE_CTORS_2(CLASSNAME,ABILITY0,ability0,ABILITY1,ability1) \
@@ -454,9 +455,9 @@
     }
 	}
 
-	ostrstream msg;
-	msg << "Explosion hits " << hit << " objects." << ends;
-	locator->message_enq(msg.str());
+	stringstream msg;
+	msg << "Explosion hits " << hit << " objects.";
+	locator->message_enq(Utils::strdup(msg.str().c_str()));
 
 	kill_self();
 	Physical::act();
@@ -1001,7 +1002,7 @@
   if (other && (other->get_class_id() != A_AltarOfSin) &&
       (intel = other->get_intel())) {
     LocatorP locator = get_locator();
-    ostrstream str;
+    stringstream str;
     
     // Turned into a frog/baby seal.
     if (Utils::coin_flip() && other->is_moving() && 
@@ -1014,8 +1015,8 @@
       
       str << intel->get_name() << " attacks the Altar of Sin and is "
           << "turned into a " << (doFrog ? "frog" : "baby-seal")
-          << "." << ends;
-      locator->message_enq(str.str());
+          << ".";
+      locator->message_enq(Utils::strdup(str.str().c_str()));
   
       other->set_intel(NULL);
       if (!other->get_mapped()) {
@@ -1047,8 +1048,8 @@
     // Lose all health.
     else {
       str << "BLASPHMER!  " << intel->get_name() << 
-          " loses health for daring to attack the Altar of Sin." << ends;
-      locator->message_enq(str.str());
+          " loses health for daring to attack the Altar of Sin.";
+      locator->message_enq(Utils::strdup(str.str().c_str()));
       
       int damage = other->get_health();
       other->corporeal_attack(this,damage);
@@ -1075,8 +1076,8 @@
       (intel = other->get_intel()) && intel->is_human()) {
     int lives = intel->get_lives();
     LocatorP locator = get_locator();
-    ostrstream msg;
-    ostrstream arenaMsg;
+    stringstream msg;
+    stringstream arenaMsg;
 
     // Choose different blessings to give.
     int n = 0;
@@ -1112,8 +1113,8 @@
         }
         else {
           intel->set_lives(lives + 1);
-          msg << intel->get_name() << " sells soul for an extra life." << ends;
-          arenaMsg << "You Sold Your Soul For an Extra Life" << ends;
+          msg << intel->get_name() << " sells soul for an extra life.";
+          arenaMsg << "You Sold Your Soul For an Extra Life";
         }
         break;
     
@@ -1123,8 +1124,8 @@
         mod = new DoubleSpeed();
         assert(mod);          
         modList->append_unique(mod);
-        msg << intel->get_name() << " sells soul for Double Speed." << ends;
-        arenaMsg << "Double Speed" << ends;
+        msg << intel->get_name() << " sells soul for Double Speed.";
+        arenaMsg << "Double Speed";
         break;
 
         
@@ -1138,9 +1139,8 @@
         mod = new DoubleJump();
         assert(mod);          
         modList->append_unique(mod);
-        msg << intel->get_name() << " sells soul for extra jumping powers." 
-            << ends;
-        arenaMsg << "Extra Jumping Powers" << ends;
+        msg << intel->get_name() << " sells soul for extra jumping powers.";
+        arenaMsg << "Extra Jumping Powers";
         break;
         
 
@@ -1157,8 +1157,8 @@
         // So max health takes effect immediately.
         other->heal();
         
-        msg << intel->get_name() << " sells soul for Double Health." << ends;
-        arenaMsg << "Double Health" << ends;
+        msg << intel->get_name() << " sells soul for Double Health.";
+        arenaMsg << "Double Health";
         break;
 
 
@@ -1176,8 +1176,8 @@
           // Might as well make sure they can take advantage of it now.  
           other->heal();
 
-          msg << intel->get_name() << " sells soul for Healing Powers." << ends;
-          arenaMsg << "Healing Powers" << ends;
+          msg << intel->get_name() << " sells soul for Healing Powers.";
+          arenaMsg << "Healing Powers";
         }
         break;
 
@@ -1193,8 +1193,8 @@
           // Already checked that other is a Creature().
           ((CreatureP)other)->add_ability(a);
 
-          msg << intel->get_name() << " sells soul for HellFire Powers." << ends;
-          arenaMsg << "HellFire Powers" << ends;    
+          msg << intel->get_name() << " sells soul for HellFire Powers.";
+          arenaMsg << "HellFire Powers";
         }
         break;
 
@@ -1217,8 +1217,8 @@
           // Already checked that other is a Creature().
           ((CreatureP)other)->add_ability(a);
 
-          msg << intel->get_name() << " sells soul for Fireballs." << ends;
-          arenaMsg << "Fireballs" << ends;    
+          msg << intel->get_name() << " sells soul for Fireballs.";
+          arenaMsg << "Fireballs";
         }
         break;
         
@@ -1241,8 +1241,8 @@
           // Already checked that other is a Creature().
           ((CreatureP)other)->add_ability(a);
 
-          msg << intel->get_name() << " sells soul for Flying Powers." << ends;
-          arenaMsg << "Flying Powers" << ends;
+          msg << intel->get_name() << " sells soul for Flying Powers.";
+          arenaMsg << "Flying Powers";
         }
         break;
 
@@ -1274,8 +1274,8 @@
           // Already checked that other is a Creature().
           ((CreatureP)other)->add_ability(a);
 
-          msg << intel->get_name() << " sells soul for Sticky Powers." << ends;
-          arenaMsg << "Sticky Powers" << ends;          
+          msg << intel->get_name() << " sells soul for Sticky Powers.";
+          arenaMsg << "Sticky Powers";
         }
         break;
 
@@ -1285,8 +1285,8 @@
       }
     } // while
       
-    locator->message_enq(msg.str());
-    locator->arena_message_enq(arenaMsg.str(),other);
+    locator->message_enq(Utils::strdup(msg.str().c_str()));
+    locator->arena_message_enq(Utils::strdup(arenaMsg.str().c_str()),other);
 
     kill_self();
     turnTaken = True;
@@ -1534,7 +1534,7 @@
                                                  void *closure) {
   // notThis is used to prevent transmogifying into the same class an object
   // already is.
-  ClassId notThis = (ClassId)closure;
+  ClassId notThis = (long)closure;
   if (pc->classId == notThis) {
     return False;
   }
@@ -2087,10 +2087,9 @@
 		PhysicalP seal = new Seal(w,l,pos);
 		assert(seal);
 
-		char sealStr[20];
-		ostrstream str(sealStr,20);
-		str << "seal-" << sealsNum << ends;
-		NeutralP sealIntel = new SealIntel(w,l,sealStr,homeId);
+		stringstream str;
+		str << "seal-" << sealsNum;
+		NeutralP sealIntel = new SealIntel(w,l,Utils::strdup(str.str().c_str()),homeId);
 		seal->set_intel(sealIntel);
 		l->register_neutral(sealIntel);
 		seals[sealsNum] = sealIntel->get_intel_id();