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 |
|