ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/swap.C
(Generate patch)

Comparing deliantra/server/server/swap.C (file contents):
Revision 1.4 by root, Mon Sep 4 11:08:00 2006 UTC vs.
Revision 1.5 by pippijn, Thu Sep 7 10:01:58 2006 UTC

1/* 1/*
2 * static char *rcsid_swap_c = 2 * static char *rcsid_swap_c =
3 * "$Id: swap.C,v 1.4 2006/09/04 11:08:00 root Exp $"; 3 * "$Id: swap.C,v 1.5 2006/09/07 10:01:58 pippijn Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
58 * Keep using it so that old temp files continue 58 * Keep using it so that old temp files continue
59 * to work. 59 * to work.
60 */ 60 */
61 fprintf(fp,"%s:%s:%ld:0:0:%d:0:%d\n", map->path, map->tmpname, 61 fprintf(fp,"%s:%s:%ld:0:0:%d:0:%d\n", map->path, map->tmpname,
62 ( 62 (
63 map->reset_time == -1 63 map->reset_time == (uint32) -1
64 ? (long unsigned) -1 64 ? (long unsigned) -1
65 : map->reset_time-current_time 65 : map->reset_time-current_time
66 ), 66 ),
67 map->difficulty, 67 map->difficulty,
68 map->darkness); 68 map->darkness);
75{ 75{
76 FILE *fp; 76 FILE *fp;
77 mapstruct *map; 77 mapstruct *map;
78 char buf[MAX_BUF],*cp,*cp1; 78 char buf[MAX_BUF],*cp,*cp1;
79 int do_los, darkness, lock; 79 int do_los, darkness, lock;
80 long sec = seconds(); 80 long sec = seconds();
81 81
82 82
83 sprintf(buf,"%s/temp.maps", settings.localdir); 83 sprintf(buf,"%s/temp.maps", settings.localdir);
84 if (!(fp=fopen(buf,"r"))) { 84 if (!(fp=fopen(buf,"r"))) {
85 LOG(llevDebug,"Could not open %s for reading\n", buf); 85 LOG(llevDebug,"Could not open %s for reading\n", buf);
118 * On metalforge, strange behavior was observed with really high 118 * On metalforge, strange behavior was observed with really high
119 * reset times - I don't know how they got to that state, 119 * reset times - I don't know how they got to that state,
120 * but easy enough to do some sanity checking here. 120 * but easy enough to do some sanity checking here.
121 */ 121 */
122 map->reset_time += sec; 122 map->reset_time += sec;
123 if (map->reset_time > (sec + MAP_MAXRESET)) 123 if (map->reset_time > (uint32) (sec + MAP_MAXRESET))
124 map->reset_time = 0; 124 map->reset_time = 0;
125 125
126 } 126 }
127 fclose(fp); 127 fclose(fp);
128} 128}
149 set_map_reset_time(map); 149 set_map_reset_time(map);
150 150
151 /* If it is immediate reset time, don't bother saving it - just get 151 /* If it is immediate reset time, don't bother saving it - just get
152 * rid of it right away. 152 * rid of it right away.
153 */ 153 */
154 if (map->reset_time <= seconds()) { 154 if (map->reset_time <= (uint32) seconds()) {
155 LOG(llevDebug,"Resetting map %s.\n",map->path); 155 LOG(llevDebug,"Resetting map %s.\n",map->path);
156 INVOKE_MAP (RESET, map); 156 INVOKE_MAP (RESET, map);
157 delete_map(map); 157 delete_map(map);
158 return; 158 return;
159 } 159 }
230 * This is very useful if the tmp-disk is very full. 230 * This is very useful if the tmp-disk is very full.
231 */ 231 */
232void flush_old_maps(void) { 232void flush_old_maps(void) {
233 233
234 mapstruct *m, *oldmap; 234 mapstruct *m, *oldmap;
235 long sec; 235 uint32 sec;
236 sec = seconds(); 236 sec = seconds();
237 237
238 m= first_map; 238 m= first_map;
239 while (m) { 239 while (m) {
240 /* There can be cases (ie death) where a player leaves a map and the timeout 240 /* There can be cases (ie death) where a player leaves a map and the timeout

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines