1 | /* |
1 | /* |
2 | * static char *rcsid_swap_c = |
2 | * static char *rcsid_swap_c = |
3 | * "$Id: swap.C,v 1.3 2006/08/29 08:01:38 root Exp $"; |
3 | * "$Id: swap.C,v 1.4 2006/09/04 11:08:00 root 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 | |
… | |
… | |
205 | chosen = map, timeout = map->timeout; |
205 | chosen = map, timeout = map->timeout; |
206 | return chosen; |
206 | return chosen; |
207 | } |
207 | } |
208 | |
208 | |
209 | /* |
209 | /* |
210 | * swap_below_max() tries to swap out maps which are still in memory because |
|
|
211 | * of MAP_TIMEOUT until used objects is below MAX_OBJECTS or there are |
|
|
212 | * no more maps to swap. |
|
|
213 | */ |
|
|
214 | |
|
|
215 | void swap_below_max(char *except_level) { |
|
|
216 | mapstruct *map; |
|
|
217 | |
|
|
218 | if(nrofallocobjects - nroffreeobjects < MAX_OBJECTS) |
|
|
219 | return; |
|
|
220 | for(;;) { |
|
|
221 | #ifdef MAX_OBJECTS_LWM |
|
|
222 | if(nrofallocobjects - nroffreeobjects < MAX_OBJECTS_LWM) |
|
|
223 | return; |
|
|
224 | #else |
|
|
225 | if(nrofallocobjects - nroffreeobjects < MAX_OBJECTS) |
|
|
226 | return; |
|
|
227 | #endif |
|
|
228 | if ((map = map_least_timeout(except_level)) == NULL) |
|
|
229 | return; |
|
|
230 | LOG(llevDebug,"Trying to swap out %s before its time.\n", map->path); |
|
|
231 | map->timeout=0; |
|
|
232 | swap_map(map); |
|
|
233 | } |
|
|
234 | } |
|
|
235 | |
|
|
236 | /* |
|
|
237 | * players_on_map(): will be replaced by map->players when I'm satisfied |
210 | * players_on_map(): will be replaced by map->players when I'm satisfied |
238 | * that the variable is always correct. |
211 | * that the variable is always correct. |
239 | * If show_all is true, we show everyone. If not, we don't show hidden |
212 | * If show_all is true, we show everyone. If not, we don't show hidden |
240 | * players (dms) |
213 | * players (dms) |
241 | */ |
214 | */ |