… | |
… | |
16 | |
16 | |
17 | You should have received a copy of the GNU General Public License |
17 | You should have received a copy of the GNU General Public License |
18 | along with this program; if not, write to the Free Software |
18 | along with this program; if not, write to the Free Software |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
19 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
20 | |
20 | |
21 | The authors can be reached via e-mail at crossfire-devel@real-time.com |
21 | The authors can be reached via e-mail at <crossfire@schmorp.de> |
22 | */ |
22 | */ |
23 | |
23 | |
24 | #include <global.h> |
24 | #include <global.h> |
25 | #include <object.h> |
25 | #include <object.h> |
26 | #include <tod.h> |
26 | #include <tod.h> |
… | |
… | |
1100 | |
1100 | |
1101 | void |
1101 | void |
1102 | process_events (mapstruct *map) |
1102 | process_events (mapstruct *map) |
1103 | { |
1103 | { |
1104 | object *op; |
1104 | object *op; |
|
|
1105 | |
|
|
1106 | static object *marker; |
|
|
1107 | if (!marker) |
1105 | object *marker = get_object (); |
1108 | marker = get_object (); |
1106 | tag_t tag; |
|
|
1107 | |
1109 | |
1108 | process_players1 (map); |
1110 | process_players1 (map); |
1109 | |
1111 | |
1110 | marker->active_next = active_objects; |
1112 | marker->active_next = active_objects; |
1111 | |
1113 | |
… | |
… | |
1116 | active_objects = marker; |
1118 | active_objects = marker; |
1117 | |
1119 | |
1118 | while (marker->active_next) |
1120 | while (marker->active_next) |
1119 | { |
1121 | { |
1120 | op = marker->active_next; |
1122 | op = marker->active_next; |
1121 | tag = op->count; |
|
|
1122 | |
1123 | |
1123 | /* Move marker forward - swap op and marker */ |
1124 | /* Move marker forward - swap op and marker */ |
1124 | op->active_prev = marker->active_prev; |
1125 | op->active_prev = marker->active_prev; |
1125 | |
1126 | |
1126 | if (op->active_prev) |
1127 | if (op->active_prev) |
… | |
… | |
1213 | LOG (llevDebug, "process_events: calling process_object with removed object %s\n", op->name ? op->name : "null"); |
1214 | LOG (llevDebug, "process_events: calling process_object with removed object %s\n", op->name ? op->name : "null"); |
1214 | } |
1215 | } |
1215 | #endif |
1216 | #endif |
1216 | --op->speed_left; |
1217 | --op->speed_left; |
1217 | process_object (op); |
1218 | process_object (op); |
|
|
1219 | |
1218 | if (was_destroyed (op, tag)) |
1220 | if (op->destroyed ()) |
1219 | continue; |
1221 | continue; |
1220 | } |
1222 | } |
|
|
1223 | |
1221 | if (settings.casting_time == TRUE && op->casting_time > 0) |
1224 | if (settings.casting_time == TRUE && op->casting_time > 0) |
1222 | op->casting_time--; |
1225 | op->casting_time--; |
|
|
1226 | |
1223 | if (op->speed_left <= 0) |
1227 | if (op->speed_left <= 0) |
1224 | op->speed_left += FABS (op->speed); |
1228 | op->speed_left += FABS (op->speed); |
1225 | } |
1229 | } |
1226 | |
1230 | |
1227 | /* Remove marker object from active list */ |
1231 | /* Remove marker object from active list */ |
… | |
… | |
1229 | marker->active_prev->active_next = NULL; |
1233 | marker->active_prev->active_next = NULL; |
1230 | else |
1234 | else |
1231 | active_objects = NULL; |
1235 | active_objects = NULL; |
1232 | |
1236 | |
1233 | process_players2 (map); |
1237 | process_players2 (map); |
1234 | |
|
|
1235 | free_object (marker); |
|
|
1236 | } |
1238 | } |
1237 | |
1239 | |
1238 | void |
1240 | void |
1239 | clean_tmp_files (void) |
1241 | clean_tmp_files (void) |
1240 | { |
1242 | { |
… | |
… | |
1273 | |
1275 | |
1274 | /* clean up everything before exiting */ |
1276 | /* clean up everything before exiting */ |
1275 | void |
1277 | void |
1276 | cleanup (void) |
1278 | cleanup (void) |
1277 | { |
1279 | { |
1278 | LOG (llevDebug, "Cleanup called. freeing data.\n"); |
1280 | LOG (llevDebug, "Cleanup called.\n"); |
1279 | clean_tmp_files (); |
|
|
1280 | write_book_archive (); |
1281 | write_book_archive (); |
1281 | #ifdef MEMORY_DEBUG |
|
|
1282 | free_all_maps (); |
|
|
1283 | free_style_maps (); |
|
|
1284 | free_all_object_data (); |
|
|
1285 | free_all_archs (); |
|
|
1286 | free_all_treasures (); |
|
|
1287 | free_all_images (); |
|
|
1288 | free_all_newserver (); |
|
|
1289 | free_all_recipes (); |
|
|
1290 | free_all_readable (); |
|
|
1291 | free_all_god (); |
|
|
1292 | free_all_anim (); |
|
|
1293 | /* See what the string data that is out there that hasn't been freed. */ |
|
|
1294 | |
1282 | |
1295 | /* LOG(llevDebug, ss_dump_table(0xff));*/ |
1283 | INVOKE_GLOBAL (CLEANUP); |
1296 | #endif |
1284 | |
1297 | exit (0); |
1285 | _exit (0); |
1298 | } |
1286 | } |
1299 | |
1287 | |
1300 | void |
1288 | void |
1301 | leave (player *pl, int draw_exit) |
1289 | leave (player *pl, int draw_exit) |
1302 | { |
1290 | { |