summaryrefslogtreecommitdiff
path: root/games/xevil/files/patch-cmn::physical.cpp
blob: b9d29be92103132e5622b0971f3828e63e725c44 (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
--- cmn/physical.cpp.orig	2012-05-27 06:52:30.000000000 +0900
+++ cmn/physical.cpp	2012-05-27 06:53:11.000000000 +0900
@@ -33,10 +33,10 @@
 // Include Files
 #include "xdata.h"
 #include "physical.h"
-#include <iostream.h>
+#include <iostream>
 
 #if X11
-#include <strstream.h>
+#include <sstream>
 #endif
 #if WIN32
 #include <strstrea.h>
@@ -54,6 +54,7 @@
 
 #include "bitmaps/transform/transform.bitmaps"
 
+using namespace std;
 
 // Defines
 #define VEL_SMALL 1
@@ -523,9 +524,9 @@
       
     if (heat == 0 && heatNext > 0) {
       LocatorP l = get_locator();
-      ostrstream str;
-      str << get_class_name() << " is on fire." << ends;
-      locator->message_enq(str.str());
+      stringstream str;
+      str << get_class_name() << " is on fire.";
+      locator->message_enq(Utils::strdup(str.str().c_str()));
     }
   }
   previousHeatWasSecondary = secondary;
@@ -1844,7 +1845,7 @@
   }
 
   // Use the pixmap resource id as the base.
-  u_int cmnBitsId = (unsigned int)mc->pixmapBits[baseDir][animNum];
+  u_int cmnBitsId = (unsigned long)mc->pixmapBits[baseDir][animNum];
 
   // It is ok to call OneTransform::compute_key() even if there is no 
   // transformation, will just return 0x0.  
@@ -2556,17 +2557,17 @@
 
 void Item::die() {
   LocatorP locator = get_locator();
-  ostrstream msg;
+  stringstream msg;
   switch (dieMessage) {
   case NONE:
     break;
   case USED:
-    msg << get_class_name() << " has been used." << ends;
-    locator->message_enq(msg.str());
+    msg << get_class_name() << " has been used.";
+    locator->message_enq(Utils::strdup(msg.str().c_str()));
     break;
   case DESTROYED:
-    msg << get_class_name() << " is destroyed." << ends;
-    locator->message_enq(msg.str());
+    msg << get_class_name() << " is destroyed.";
+    locator->message_enq(Utils::strdup(msg.str().c_str()));
     break;
   };
 
@@ -2650,10 +2651,8 @@
   // Prevent non-biologicals from picking up drugs.
 
   if (p->is_creature() && !((CreatureP)p)->biological()) {
-    ostrstream msg;
-    msg << "Non-Biological Creatures Cannot Use Drugs" << ends;
     LocatorP locator = get_locator();
-    locator->arena_message_enq(msg.str(),p);
+    locator->arena_message_enq(Utils::strdup("Non-Biological Creatures Cannot Use Drugs"), p);
     kill_self();
   }
   else {
@@ -2673,13 +2672,11 @@
     assert(context->odChance >= 0);
     if (context->odChance && Utils::choose(context->odChance) == 0) {
       p->kill_self();
-      ostrstream msg;
-      msg << p->get_class_name() << " dies from crack overdose." << ends;
-      locator->message_enq(msg.str());
+      stringstream msg;
+      msg << p->get_class_name() << " dies from crack overdose.";
+      locator->message_enq(Utils::strdup(msg.str().c_str()));
       
-      ostrstream arenaMsg;
-      arenaMsg << "You Died From Drug Overdose" << ends;
-      locator->arena_message_enq(arenaMsg.str(),p);
+      locator->arena_message_enq(Utils::strdup("You Died From Drug Overdose"),p);
 
       set_quiet_death(); // so doesn't report "has been used" message.
     }    
@@ -2693,9 +2690,7 @@
   }
   else {
     // Shouldn't get here, should kill self when picking it up.
-    ostrstream msg;
-    msg << "Non-Biological Creatures Cannot Use Drugs" << ends;
-    locator->arena_message_enq(msg.str(),p);
+    locator->arena_message_enq(Utils::strdup("Non-Biological Creatures Cannot Use Drugs"),p);
   }
   
   kill_self();
@@ -4334,14 +4329,14 @@
   if (!get_quiet_death() && !alive() && 
       (corpseTimer.ready() || (get_health() < - cc->corpseHealth))) {
     LocatorP locator = get_locator();
-    ostrstream msg;
+    stringstream msg;
     if (corpseTimer.ready()) {
-	    msg << get_class_name() << " corpse has decomposed." << ends;
-	    locator->message_enq(msg.str());
+	    msg << get_class_name() << " corpse has decomposed.";
+	    locator->message_enq(Utils::strdup(msg.str().c_str()));
     }
     else {
-      msg << get_class_name() << " corpse has been destroyed." << ends;
-      locator->message_enq(msg.str());
+      msg << get_class_name() << " corpse has been destroyed.";
+      locator->message_enq(Utils::strdup(msg.str().c_str()));
     }
     set_delete_me();
   }
@@ -4399,9 +4394,9 @@
     set_vel_next(velNew);
     set_stance_next(CO_air);
     
-    ostrstream msg;
-    msg << get_class_name() << " has died." << ends;
-    locator->message_enq(msg.str());
+    stringstream msg;
+    msg << get_class_name() << " has died.";
+    locator->message_enq(Utils::strdup(msg.str().c_str()));
     
     set_no_death_delete();
   }
@@ -6072,10 +6067,10 @@
     }
     // If User is already holding the max number of weapons.
     else if (weaponsNum >= PH_WEAPONS_MAX) {
-      ostrstream msg;
-      msg << "Can only hold " << PH_WEAPONS_MAX << " weapons" << ends;          
+      stringstream msg;
+      msg << "Can only hold " << PH_WEAPONS_MAX << " weapons";
       LocatorP locator = cre->get_locator();
-      locator->arena_message_enq(msg.str(),cre);
+      locator->arena_message_enq(Utils::strdup(msg.str().c_str()),cre);
       destroyOther = True;
     }
     // Actually pick it up.
@@ -6124,15 +6119,14 @@
   else {
     LocatorP locator = cre->get_locator();
     if (itemsNum == PH_ITEMS_MAX) {
-      ostrstream msg;
-      msg << "Can only hold " << PH_ITEMS_MAX << " items" << ends;          
-      locator->arena_message_enq(msg.str(),cre);
+      stringstream msg;
+      msg << "Can only hold " << PH_ITEMS_MAX << " items";
+      locator->arena_message_enq(Utils::strdup(msg.str().c_str()),cre);
     }
     else if (itemClassCount >= ITEM_CLASS_MAX) {
-      ostrstream msg;
-      msg << "Can only hold " << ITEM_CLASS_MAX 
-        << " of any one item" << ends;
-      locator->arena_message_enq(msg.str(),cre);
+      stringstream msg;
+      msg << "Can only hold " << ITEM_CLASS_MAX << " of any one item";
+      locator->arena_message_enq(Utils::strdup(msg.str().c_str()),cre);
     }
 
     other->set_quiet_death();
@@ -6661,9 +6655,9 @@
         ((ItemP)p)->use(cre);
       }
       else {
-        ostrstream str;
-        str << "Cannot use " << p->get_class_name() << ends;
-        locator->arena_message_enq(str.str(),cre);
+        stringstream str;
+        str << "Cannot use " << p->get_class_name();
+        locator->arena_message_enq(Utils::strdup(str.str().c_str()),cre);
       }
     }
     break;