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.14 by root, Sat Dec 23 13:56:25 2006 UTC vs.
Revision 1.15 by root, Sun Dec 24 12:28:30 2006 UTC

126 LOG (llevError, "Tried to swap out map which was not in memory.\n"); 126 LOG (llevError, "Tried to swap out map which was not in memory.\n");
127 return; 127 return;
128 } 128 }
129 129
130 for_all_players (pl) 130 for_all_players (pl)
131 if (!pl->ob || (!(QUERY_FLAG (pl->ob, FLAG_REMOVED)) && pl->ob->map == map)) 131 if (pl->ob && pl->ob->map == map && !pl->ob->flag [FLAG_REMOVED])
132 { 132 {
133 remove_all_pets (map); /* Give them a chance to follow */ 133 LOG (llevDebug, "Wanted to swap out map with player.\n");
134
135 /* Update the reset time. Only do this is STAND_STILL is not set */
136 if (!map->fixed_resettime)
137 set_map_reset_time (map);
138
139 /* If it is immediate reset time, don't bother saving it - just get
140 * rid of it right away.
141 */
142 if (map->reset_time <= (uint32) time (0))
143 {
144 LOG (llevDebug, "Resetting map %s.\n", map->path);
145 INVOKE_MAP (RESET, map);
146 delete_map (map);
147 return;
148 }
149
150 if (new_save_map (map, 0) == -1)
151 {
152 LOG (llevError, "Failed to swap map %s.\n", map->path);
153 /* need to reset the in_memory flag so that delete map will also
154 * free the objects with it.
155 */
156 map->in_memory = MAP_IN_MEMORY;
157 delete_map (map);
158 }
159 else
160 {
161 INVOKE_MAP (SWAPOUT, map);
162 free_map (map, 1);
163 }
164
165 write_map_log ();
166 return; 134 return;
167 } 135 }
168 136
169 LOG (llevDebug, "Wanted to swap out map with player.\n"); 137 remove_all_pets (map); /* Give them a chance to follow */
138
139 /* Update the reset time. Only do this is STAND_STILL is not set */
140 if (!map->fixed_resettime)
141 set_map_reset_time (map);
142
143 /* If it is immediate reset time, don't bother saving it - just get
144 * rid of it right away.
145 */
146 if (map->reset_time <= (uint32) time (0))
147 {
148 LOG (llevDebug, "Resetting map %s.\n", map->path);
149 INVOKE_MAP (RESET, map);
150 delete_map (map);
151 return;
152 }
153
154 if (new_save_map (map, 0) == -1)
155 {
156 LOG (llevError, "Failed to swap map %s.\n", map->path);
157 /* need to reset the in_memory flag so that delete map will also
158 * free the objects with it.
159 */
160 map->in_memory = MAP_IN_MEMORY;
161 delete_map (map);
162 }
163 else
164 {
165 INVOKE_MAP (SWAPOUT, map);
166 free_map (map, 1);
167 }
168
169 write_map_log ();
170} 170}
171 171
172void 172void
173check_active_maps (void) 173check_active_maps (void)
174{ 174{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines