… | |
… | |
1058 | */ |
1058 | */ |
1059 | int |
1059 | int |
1060 | load_object (object_thawer &fp, object *op, int map_flags) |
1060 | load_object (object_thawer &fp, object *op, int map_flags) |
1061 | { |
1061 | { |
1062 | // cede every 500 objects loaded |
1062 | // cede every 500 objects loaded |
1063 | { |
1063 | coroapi::cede_every (500); |
1064 | static int cede_counter = 0; |
|
|
1065 | |
|
|
1066 | if (++cede_counter >= 500) |
|
|
1067 | { |
|
|
1068 | cede_counter = 0; |
|
|
1069 | if (coroapi::nready ()) |
|
|
1070 | coroapi::cede (); |
|
|
1071 | } |
|
|
1072 | } |
|
|
1073 | |
1064 | |
1074 | return parse_object (op, fp, map_flags); |
1065 | return parse_object (op, fp, map_flags); |
1075 | } |
1066 | } |
1076 | |
1067 | |
1077 | /* This takes a buffer, scans it for variables, and sets those variables |
1068 | /* This takes a buffer, scans it for variables, and sets those variables |
… | |
… | |
1449 | * the only place this is not set is when saving the player. |
1440 | * the only place this is not set is when saving the player. |
1450 | */ |
1441 | */ |
1451 | void |
1442 | void |
1452 | save_object (object_freezer &fp, object *op, int flag) |
1443 | save_object (object_freezer &fp, object *op, int flag) |
1453 | { |
1444 | { |
|
|
1445 | // cede every 500 objects saved |
|
|
1446 | coroapi::cede_every (500); |
|
|
1447 | |
1454 | /* Even if the object does have an owner, it would seem that we should |
1448 | /* Even if the object does have an owner, it would seem that we should |
1455 | * still save it. |
1449 | * still save it. |
1456 | */ |
1450 | */ |
1457 | if (op->owner) |
1451 | if (op->owner) |
1458 | return; |
1452 | return; |