]> icculus.org git repositories - divverent/nexuiz.git/blob - data/qcsrc/server/miscfunctions.qc
no wpchange needed any more
[divverent/nexuiz.git] / data / qcsrc / server / miscfunctions.qc
1 void() info_player_deathmatch; // needed for the other spawnpoints
2 string ColoredTeamName(float t);
3
4 void move_out_of_solid_expand(entity e, vector by)
5 {
6         float eps = 0.0625;
7         tracebox(e.origin, e.mins - '1 1 1' * eps, e.maxs + '1 1 1' * eps, e.origin + by, MOVE_WORLDONLY, e);
8         if(trace_startsolid)
9                 return;
10         if(trace_fraction < 1)
11         {
12                 // hit something
13                 // adjust origin in the other direction...
14                 e.origin = e.origin - by * (1 - trace_fraction);
15         }
16 }
17
18 void move_out_of_solid(entity e)
19 {
20         vector o, m0, m1;
21
22         o = e.origin;
23         traceline(o, o, MOVE_WORLDONLY, e);
24         if(trace_startsolid)
25         {
26                 dprint("origin is in solid too! (", vtos(o), ")");
27                 return;
28         }
29
30         tracebox(o, e.mins, e.maxs, o, MOVE_WORLDONLY, e);
31         if(!trace_startsolid)
32                 return;
33
34         m0 = e.mins;
35         m1 = e.maxs;
36         e.mins = '0 0 0';
37         e.maxs = '0 0 0';
38         move_out_of_solid_expand(e, '1 0 0' * m0_x); e.mins_x = m0_x;
39         move_out_of_solid_expand(e, '1 0 0' * m1_x); e.maxs_x = m1_x;
40         move_out_of_solid_expand(e, '0 1 0' * m0_y); e.mins_y = m0_y;
41         move_out_of_solid_expand(e, '0 1 0' * m1_y); e.maxs_y = m1_y;
42         move_out_of_solid_expand(e, '0 0 1' * m0_z); e.mins_z = m0_z;
43         move_out_of_solid_expand(e, '0 0 1' * m1_z); e.maxs_z = m1_z;
44         setorigin(e, e.origin);
45
46         tracebox(e.origin, e.mins, e.maxs, e.origin, MOVE_WORLDONLY, e);
47         if(trace_startsolid)
48         {
49                 dprint("could not get out of solid (", vtos(o), ")");
50                 return;
51         }
52 }
53
54 // converts a number to a string with the indicated number of decimals
55 // works for up to 10 decimals!
56 string ftos_decimals(float number, float decimals)
57 {
58         string result;
59         string tmp;
60         float len;
61
62         // if negative, cut off the sign first
63         if(number < 0)
64                 return strcat("-", ftos_decimals(-number, decimals));
65         // it now is always positive!
66
67         // 3.516 -> 352
68         number = floor(number * pow(10, decimals) + 0.5);
69
70         // 352 -> "352"
71         result = ftos(number);
72         len = strlen(result);
73         // does it have a decimal point (should not happen)? If there is one, it is always at len-7)
74                 // if ftos had fucked it up, which should never happen: "34278.000000"
75         if(len >= 7)
76                 if(substring(result, len - 7, 1) == ".")
77                 {
78                         dprint("ftos(integer) has comma? Can't be. Affected result: ", result, "\n");
79                         result = substring(result, 0, len - 7);
80                         len -= 7;
81                 }
82                 // "34278"
83         // is it too short? If yes, insert leading zeroes
84         if(len <= decimals)
85         {
86                 result = strcat(substring("0000000000", 0, decimals - len + 1), result);
87                 len = decimals + 1;
88         }
89         // and now... INSERT THE POINT!
90         tmp = substring(result, len - decimals, decimals);
91         result = strcat(substring(result, 0, len - decimals), ".", tmp);
92         return result;
93 }
94
95 #define FOR_EACH_CLIENT(v) for(v = world; (v = findflags(v, flags, FL_CLIENT)) != world; )
96 #define FOR_EACH_REALCLIENT(v) FOR_EACH_CLIENT(v) if(clienttype(v) == CLIENTTYPE_REAL)
97 string STR_PLAYER = "player";
98 #define FOR_EACH_PLAYER(v) for(v = world; (v = find(v, classname, STR_PLAYER)) != world; )
99 #define FOR_EACH_REALPLAYER(v) FOR_EACH_PLAYER(v) if(clienttype(v) == CLIENTTYPE_REAL)
100
101 // change that to actually calling strcat when running on an engine without
102 // unlimited tempstrings:
103 // string strcat1(string s) = #115; // FRIK_FILE
104 #define strcat1(s) (s)
105
106 float logfile_open;
107 float logfile;
108
109 void(string s) bcenterprint
110 {
111         // TODO replace by MSG_ALL (would show it to spectators too, though)?
112         entity head;
113         FOR_EACH_PLAYER(head)
114                 if(clienttype(head) == CLIENTTYPE_REAL)
115                         centerprint(head, s);
116 }
117
118 void(string s, float check_dangerous) ServerConsoleEcho =
119 {
120         local string ch;
121         if (checkextension("DP_SV_PRINT"))
122                 print(s, "\n");
123         else
124         {
125                 localcmd("echo \"");
126                 if(check_dangerous)
127                 {
128                         while(strlen(s))
129                         {
130                                 ch = substring(s, 0, 1);
131                                 if(ch != "\"" && ch != "\r" && ch != "\n")
132                                         localcmd(ch);
133                                 s = substring(s, 1, strlen(s) - 1);
134                         }
135                 }
136                 else
137                 {
138                         localcmd(s);
139                 }
140                 localcmd("\"\n");
141         }
142 }
143
144 void(string s, float check_dangerous) GameLogEcho =
145 {
146         string fn;
147         float matches;
148
149         if(cvar("sv_eventlog_files"))
150         {
151                 if(!logfile_open)
152                 {
153                         logfile_open = TRUE;
154                         matches = cvar("sv_eventlog_files_counter") + 1;
155                         cvar_set("sv_eventlog_files_counter", ftos(matches));
156                         fn = ftos(matches);
157                         if(strlen(fn) < 8)
158                                 fn = strcat(substring("00000000", 0, 8 - strlen(fn)), fn);
159                         fn = strcat(cvar_string("sv_eventlog_files_nameprefix"), fn, cvar_string("sv_eventlog_files_namesuffix"));
160                         logfile = fopen(fn, FILE_APPEND);
161                 }
162                 if(logfile >= 0)
163                         fputs(logfile, strcat(s, "\n"));
164         }
165         if(cvar("sv_eventlog_console"))
166         {
167                 ServerConsoleEcho(s, check_dangerous);
168         }
169 }
170
171 void() GameLogInit =
172 {
173         logfile_open = 0;
174         // will be opened later
175 }
176
177 void() GameLogClose =
178 {
179         if(logfile_open && logfile >= 0)
180         {
181                 fclose(logfile);
182                 logfile = -1;
183         }
184 }
185
186 float math_mod(float a, float b)
187 {
188         return a - (floor(a / b) * b);
189 }
190
191 void relocate_spawnpoint()
192 {
193         // nudge off the floor
194         setorigin(self, self.origin + '0 0 1');
195
196         tracebox(self.origin, PL_MIN, PL_MAX, self.origin, TRUE, self);
197         if (trace_startsolid)
198         {
199                 objerror("player spawn point in solid, mapper sucks!\n");
200                 return;
201         }
202
203         if(cvar("g_spawnpoints_autodrop"))
204         {
205                 setsize(self, PL_MIN, PL_MAX);
206                 droptofloor();
207         }
208 }
209
210 // NOTE: DO NOT USE THIS FUNCTION TOO OFTEN.
211 // IT WILL MOST PROBABLY DESTROY _ALL_ OTHER TEMP
212 // STRINGS AND TAKE QUITE LONG. haystack and needle MUST
213 // BE CONSTANT OR strzoneD!
214 float(string haystack, string needle, float offset) strstr =
215 {
216         float len, endpos;
217         string found;
218         len = strlen(needle);
219         endpos = strlen(haystack) - len;
220         while(offset <= endpos)
221         {
222                 found = substring(haystack, offset, len);
223                 if(found == needle)
224                         return offset;
225                 offset = offset + 1;
226         }
227         return -1;
228 }
229
230 float NUM_NEAREST_ENTITIES = 4;
231 entity nearest_entity[NUM_NEAREST_ENTITIES];
232 float nearest_length[NUM_NEAREST_ENTITIES];
233 entity(vector point, .string field, string value, vector axismod) findnearest =
234 {
235         entity localhead;
236         float i;
237         float j;
238         float len;
239         vector dist;
240
241         float num_nearest;
242         num_nearest = 0;
243
244         localhead = find(world, field, value);
245         while(localhead)
246         {
247                 if((localhead.items == IT_KEY1 || localhead.items == IT_KEY2) && localhead.target == "###item###")
248                         dist = localhead.oldorigin;
249                 else
250                         dist = localhead.origin;
251                 dist = dist - point;
252                 dist = dist_x * axismod_x * '1 0 0' + dist_y * axismod_y * '0 1 0' + dist_z * axismod_z * '0 0 1';
253                 len = vlen(dist);
254
255                 for(i = 0; i < num_nearest; ++i)
256                 {
257                         if(len < nearest_length[i])
258                                 break;
259                 }
260
261                 // now i tells us where to insert at
262                 //   INSERTION SORT! YOU'VE SEEN IT! RUN!
263                 if(i < NUM_NEAREST_ENTITIES)
264                 {
265                         for(j = NUM_NEAREST_ENTITIES - 1; j >= i; --j)
266                         {
267                                 nearest_length[j + 1] = nearest_length[j];
268                                 nearest_entity[j + 1] = nearest_entity[j];
269                         }
270                         nearest_length[i] = len;
271                         nearest_entity[i] = localhead;
272                         if(num_nearest < NUM_NEAREST_ENTITIES)
273                                 num_nearest = num_nearest + 1;
274                 }
275
276                 localhead = find(localhead, field, value);
277         }
278
279         // now use the first one from our list that we can see
280         for(i = 0; i < num_nearest; ++i)
281         {
282                 traceline(point, nearest_entity[i].origin, TRUE, world);
283                 if(trace_fraction == 1)
284                 {
285                         if(i != 0)
286                         {
287                                 dprint("Nearest point (");
288                                 dprint(nearest_entity[0].netname);
289                                 dprint(") is not visible, using a visible one.\n");
290                         }
291                         return nearest_entity[i];
292                 }
293         }
294
295         if(num_nearest == 0)
296                 return world;
297
298         dprint("Not seeing any location point, using nearest as fallback.\n");
299         /* DEBUGGING CODE:
300         dprint("Candidates were: ");
301         for(j = 0; j < num_nearest; ++j)
302         {
303                 if(j != 0)
304                         dprint(", ");
305                 dprint(nearest_entity[j].netname);
306         }
307         dprint("\n");
308         */
309
310         return nearest_entity[0];
311 }
312
313 void() target_location =
314 {
315         self.classname = "target_location";
316         // location name in netname
317         // eventually support: count, teamgame selectors, line of sight?
318 };
319
320 void() info_location =
321 {
322         self.classname = "target_location";
323         self.message = self.netname;
324 };
325
326 string NearestLocation(vector p)
327 {
328         entity loc;
329         string ret;
330         ret = "somewhere";
331         loc = findnearest(p, classname, "target_location", '1 1 1');
332         if(loc)
333         {
334                 ret = loc.message;
335         }
336         else
337         {
338                 loc = findnearest(p, target, "###item###", '1 1 4');
339                 if(loc)
340                         ret = loc.netname;
341         }
342         return ret;
343 }
344
345 string(string msg) formatmessage =
346 {
347         float p;
348         float n;
349         string msg_save;
350         string escape;
351         string replacement;
352         msg_save = strzone(msg);
353         p = 0;
354         n = 7;
355         while(1)
356         {
357                 if(n < 1)
358                         break; // too many replacements
359                 n = n - 1;
360                 p = strstr(msg_save, "%", p); // NOTE: this destroys msg as it's a tempstring!
361                 if(p < 0)
362                         break;
363                 replacement = substring(msg_save, p, 2);
364                 escape = substring(msg_save, p + 1, 1);
365                 if(escape == "%")
366                         replacement = "%";
367                 else if(escape == "a")
368                         replacement = ftos(floor(self.armorvalue));
369                 else if(escape == "h")
370                         replacement = ftos(floor(self.health));
371                 else if(escape == "l")
372                         replacement = NearestLocation(self.origin);
373                 else if(escape == "y")
374                         replacement = NearestLocation(self.cursor_trace_endpos);
375                 else if(escape == "d")
376                         replacement = NearestLocation(self.death_origin);
377                 else if(escape == "w")
378                 {
379                         float wep;
380                         wep = self.weapon;
381                         if(!wep)
382                                 wep = self.switchweapon;
383                         if(!wep)
384                                 wep = self.cnt;
385                         replacement = W_Name(wep);
386                 }
387                 else if(escape == "W")
388                 {
389                         if(self.items & IT_SHELLS) replacement = "shells";
390                         else if(self.items & IT_NAILS) replacement = "bullets";
391                         else if(self.items & IT_ROCKETS) replacement = "rockets";
392                         else if(self.items & IT_CELLS) replacement = "cells";
393                         else replacement = "batteries"; // ;)
394                 }
395                 else if(escape == "x")
396                 {
397                         replacement = self.cursor_trace_ent.netname;
398                         if(!replacement || !self.cursor_trace_ent)
399                                 replacement = "nothing";
400                 }
401                 else if(escape == "p")
402                 {
403                         if(self.last_selected_player)
404                                 replacement = self.last_selected_player.netname;
405                         else
406                                 replacement = "(nobody)";
407                 }
408                 msg = strcat(substring(msg_save, 0, p), replacement);
409                 msg = strcat(msg, substring(msg_save, p+2, strlen(msg_save) - (p+2)));
410                 strunzone(msg_save);
411                 msg_save = strzone(msg);
412                 p = p + 2;
413         }
414         msg = strcat(msg_save, "");
415         strunzone(msg_save);
416         return msg;
417 }
418
419 /*
420 =============
421 GetCvars
422 =============
423 Called with:
424   0:  sends the request
425   >0: receives a cvar from name=argv(f) value=argv(f+1)
426 */
427 void GetCvars_handleString(float f, .string field, string name)
428 {
429         if(f < 0)
430         {
431                 if(self.field)
432                         strunzone(self.field);
433         }
434         else if(f > 0)
435         {
436                 if(argv(f) == name)
437                 {
438                         if(self.field)
439                                 strunzone(self.field);
440                         self.field = strzone(argv(f + 1));
441                 }
442         }
443         else
444                 stuffcmd(self, strcat("sendcvar ", name, "\n"));
445 }
446 void GetCvars_handleFloat(float f, .float field, string name)
447 {
448         if(f < 0)
449         {
450         }
451         else if(f > 0)
452         {
453                 if(argv(f) == name)
454                         self.field = stof(argv(f + 1));
455         }
456         else
457                 stuffcmd(self, strcat("sendcvar ", name, "\n"));
458 }
459 void GetCvars(float f)
460 {
461         GetCvars_handleFloat(f, autoswitch, "cl_autoswitch");
462         GetCvars_handleFloat(f, cvar_cl_hidewaypoints, "cl_hidewaypoints");
463         GetCvars_handleFloat(f, cvar_cl_zoomfactor, "cl_zoomfactor");
464         GetCvars_handleFloat(f, cvar_cl_zoomspeed, "cl_zoomspeed");
465         GetCvars_handleFloat(f, cvar_cl_playerdetailreduction, "cl_playerdetailreduction");
466         GetCvars_handleFloat(f, cvar_cl_nogibs, "cl_nogibs");
467         GetCvars_handleFloat(f, cvar_scr_centertime, "scr_centertime");
468         GetCvars_handleFloat(f, cvar_cl_shownames, "cl_shownames");
469         GetCvars_handleString(f, cvar_g_nexuizversion, "g_nexuizversion");
470 }
471
472 float fexists(string f)
473 {
474         float fh;
475         fh = fopen(f, FILE_READ);
476         if(fh < 0)
477                 return FALSE;
478         fclose(fh);
479         return TRUE;
480 }
481
482 void backtrace(string msg)
483 {
484         float dev;
485         dev = cvar("developer");
486         cvar_set("developer", "1");
487         dprint("\n");
488         dprint("--- CUT HERE ---\nWARNING: ");
489         dprint(msg);
490         dprint("\n");
491         remove(world); // isn't there any better way to cause a backtrace?
492         dprint("\n--- CUT UNTIL HERE ---\n");
493         cvar_set("developer", ftos(dev));
494 }
495
496 void DistributeFragsAmongTeam(entity p, float targetteam, float factor)
497 {
498         float f;
499         float d;
500         float nTeam;
501         entity head;
502
503         if(!teams_matter)
504                 return;
505
506         //if(p.frags < 0)
507         //{
508         //      p.frags = 0; // do not harm the new team!
509         //      return; // won't distribute negative scores
510         //}
511
512         if(p.frags == -666)
513                 return;
514
515         f = ceil(factor * p.frags);
516         p.frags = p.frags - f;
517
518         nTeam = 0;
519         FOR_EACH_PLAYER(head)
520                 if(head != p)
521                         if(head.team == targetteam)
522                                 nTeam = nTeam + 1;
523
524         if(nTeam == 0)
525                 return;
526
527         FOR_EACH_PLAYER(head)
528                 if(head != p)
529                         if(head.team == targetteam)
530                         {
531                                 d = floor(f / nTeam);
532                                 head.frags = head.frags + d;
533                                 f = f - d;
534                                 nTeam = nTeam - 1;
535                         }
536
537         if(nTeam != 0)
538                 error("nPlayers in team changed!");
539         if(f != 0)
540                 error(strcat("There were ", ftos(f), " frags left. BAD!"));
541 }
542
543 string Team_ColorCode(float teamid)
544 {
545         if(teamid == COLOR_TEAM1)
546                 return "^1";
547         else if(teamid == COLOR_TEAM2)
548                 return "^4";
549         else if(teamid == COLOR_TEAM3)
550                 return "^6";
551         else if(teamid == COLOR_TEAM4)
552                 return "^3";
553         else
554                 return "^7";
555 }
556
557 /*
558 string decolorize(string s)
559 {
560         string out;
561         out = "";
562         while(s != "")
563         {
564                 float n;
565                 string ch1, ch2;
566                 n = 1;
567                 ch1 = substring(s, 0, 1);
568                 ch2 = substring(s, 1, 1);
569                 if(ch1 == "^")
570                 {
571                         n = 2;
572                         if(ch2 == "^")
573                                 out = strcat(out, "^^");
574                         else if(ch2 == "0")
575                                 out = strcat1(out);
576                         else if(ch2 == "1")
577                                 out = strcat1(out);
578                         else if(ch2 == "2")
579                                 out = strcat1(out);
580                         else if(ch2 == "3")
581                                 out = strcat1(out);
582                         else if(ch2 == "4")
583                                 out = strcat1(out);
584                         else if(ch2 == "5")
585                                 out = strcat1(out);
586                         else if(ch2 == "6")
587                                 out = strcat1(out);
588                         else if(ch2 == "7")
589                                 out = strcat1(out);
590                         else if(ch2 == "8")
591                                 out = strcat1(out);
592                         else if(ch2 == "9")
593                                 out = strcat1(out);
594                         else
595                         {
596                                 n = 1;
597                                 out = strcat(out, "^^");
598                         }
599                         s = substring(s, n, strlen(s) - n);
600                 }
601                 else
602                 {
603                         s = substring(s, 1, strlen(s) - 1);
604                         out = strcat(out, ch1);
605                 }
606         }
607         return out;
608 }
609 #define strdecolorize(s) decolorize(s)
610 #define strlennocol(s) strlen(decolorize(s))
611 */
612
613 #define CENTERPRIO_POINT 1
614 #define CENTERPRIO_SPAM 2
615 #define CENTERPRIO_REBALANCE 2
616 #define CENTERPRIO_VOTE 4
617 #define CENTERPRIO_NORMAL 5
618 #define CENTERPRIO_MAPVOTE 9
619 #define CENTERPRIO_ADMIN 99
620 .float centerprint_priority;
621 .float centerprint_expires;
622 void centerprint_atprio(entity e, float prio, string s)
623 {
624         if(intermission_running)
625                 if(prio < CENTERPRIO_MAPVOTE)
626                         return;
627         if(time > e.centerprint_expires)
628                 e.centerprint_priority = 0;
629         if(prio >= e.centerprint_priority)
630         {
631                 e.centerprint_priority = prio;
632                 e.centerprint_expires = time + e.cvar_scr_centertime;
633                 centerprint_builtin(e, s);
634         }
635 }
636 void centerprint_expire(entity e, float prio)
637 {
638         if(prio == e.centerprint_priority)
639         {
640                 e.centerprint_priority = 0;
641                 centerprint_builtin(e, "");
642         }
643 }
644 void centerprint(entity e, string s)
645 {
646         centerprint_atprio(e, CENTERPRIO_NORMAL, s);
647 }
648
649 void VoteNag();
650
651 // decolorizes and team colors the player name when needed
652 string playername(entity p)
653 {
654         string t;
655         if(teams_matter && !intermission_running && p.classname == "player")
656         {
657                 t = Team_ColorCode(p.team);
658                 return strcat(t, strdecolorize(p.netname));
659         }
660         else
661                 return p.netname;
662 }
663
664 // requires that m2>m1 in all coordinates, and that m4>m3
665 float(vector m1, vector m2, vector m3, vector m4) boxesoverlap = {return m2_x >= m3_x && m1_x <= m4_x && m2_y >= m3_y && m1_y <= m4_y && m2_z >= m3_z && m1_z <= m4_z;};
666
667 // requires the same, but is a stronger condition
668 float(vector smins, vector smaxs, vector bmins, vector bmaxs) boxinsidebox = {return smins_x >= bmins_x && smaxs_x <= bmaxs_x && smins_y >= bmins_y && smaxs_y <= bmaxs_y && smins_z >= bmins_z && smaxs_z <= bmaxs_z;};
669
670 float g_pickup_shells;
671 float g_pickup_shells_max;
672 float g_pickup_nails;
673 float g_pickup_nails_max;
674 float g_pickup_rockets;
675 float g_pickup_rockets_max;
676 float g_pickup_cells;
677 float g_pickup_cells_max;
678 float g_pickup_armorshard;
679 float g_pickup_armorshard_max;
680 float g_pickup_armor;
681 float g_pickup_armor_max;
682 float g_pickup_healthshard;
683 float g_pickup_healthshard_max;
684 float g_pickup_health;
685 float g_pickup_health_max;
686 float g_pickup_healthmega;
687 float g_pickup_healthmega_max;
688
689 void readlevelcvars(void)
690 {
691         g_pickup_shells                    = cvar("g_pickup_shells");
692         g_pickup_shells_max                = cvar("g_pickup_shells_max");
693         g_pickup_nails                     = cvar("g_pickup_nails");
694         g_pickup_nails_max                 = cvar("g_pickup_nails_max");
695         g_pickup_rockets                   = cvar("g_pickup_rockets");
696         g_pickup_rockets_max               = cvar("g_pickup_rockets_max");
697         g_pickup_cells                     = cvar("g_pickup_cells");
698         g_pickup_cells_max                 = cvar("g_pickup_cells_max");
699         g_pickup_armorshard                = cvar("g_pickup_armorshard");
700         g_pickup_armorshard_max            = cvar("g_pickup_armorshard_max");
701         g_pickup_armor                     = cvar("g_pickup_armor");
702         g_pickup_armor_max                 = cvar("g_pickup_armor_max");
703         g_pickup_healthshard               = cvar("g_pickup_healthshard");
704         g_pickup_healthshard_max           = cvar("g_pickup_healthshard_max");
705         g_pickup_health                    = cvar("g_pickup_health");
706         g_pickup_health_max                = cvar("g_pickup_health_max");
707         g_pickup_healthmega                = cvar("g_pickup_healthmega");
708         g_pickup_healthmega_max            = cvar("g_pickup_healthmega_max");
709 }
710
711 /*
712 // TODO sound pack system
713 string soundpack;
714
715 string precache_sound_builtin (string s) = #19;
716 void(entity e, float chan, string samp, float vol, float atten) sound_builtin = #8;
717 string precache_sound(string s)
718 {
719         return precache_sound_builtin(strcat(soundpack, s));
720 }
721 void play2(entity e, string filename)
722 {
723         stuffcmd(e, strcat("play2 ", soundpack, filename, "\n"));
724 }
725 void sound(entity e, float chan, string samp, float vol, float atten)
726 {
727         sound_builtin(e, chan, strcat(soundpack, samp), vol, atten);
728 }
729 */
730
731 string precache_sound (string s) = #19;
732 void(entity e, float chan, string samp, float vol, float atten) sound = #8;
733 void play2(entity e, string filename)
734 {
735         stuffcmd(e, strcat("play2 ", filename, "\n"));
736 }