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

Comparing deliantra/server/common/loader.C (file contents):
Revision 1.34 by root, Sun Dec 31 18:10:40 2006 UTC vs.
Revision 1.38 by pippijn, Wed Jan 3 00:21:35 2007 UTC

263static void 263static void
264check_loaded_object (object *op) 264check_loaded_object (object *op)
265{ 265{
266 int ip; 266 int ip;
267 267
268 /* We do some specialized handling to handle legacy cases of name_pl. 268 /* We do some specialised handling to handle legacy cases of name_pl.
269 * If the object doesn't have a name_pl, we just use the object name - 269 * If the object doesn't have a name_pl, we just use the object name -
270 * this isn't perfect (things won't be properly pluralized), but works to 270 * this isn't perfect (things won't be properly pluralised), but works to
271 * that degree (5 heart is still quite understandable). But the case we 271 * that degree (5 heart is still quite understandable). But the case we
272 * also have to catch is if this object is not using the normal name for 272 * also have to catch is if this object is not using the normal name for
273 * the object. In that case, we also want to use the loaded name. 273 * the object. In that case, we also want to use the loaded name.
274 * Otherwise, what happens is that the the plural name will lose 274 * Otherwise, what happens is that the the plural name will lose
275 * information (appear as just 'hearts' and not 'goblins heart') 275 * information (appear as just 'hearts' and not 'goblins heart')
989 case KW_msg: 989 case KW_msg:
990 thawer.get_ml (KW_endmsg, op->msg); 990 thawer.get_ml (KW_endmsg, op->msg);
991 //TODO: allow longer messages 991 //TODO: allow longer messages
992 if (strlen (op->msg) >= HUGE_BUF) 992 if (strlen (op->msg) >= HUGE_BUF)
993 { 993 {
994 LOG (llevDebug, "\n\tError message length >= %d: %d\n>%.80s<\n", HUGE_BUF, strlen (op->msg), &op->msg); 994 LOG (llevDebug, "\tError message length >= %d: %d\n>%.80s<\n", HUGE_BUF, strlen (op->msg), &op->msg);
995 op->msg = "ERROR, please report: string too long, winged.\n"; 995 op->msg = "ERROR, please report: string too long, winged.\n";
996 } 996 }
997 break; 997 break;
998 998
999 case KW_lore: 999 case KW_lore:
1001 //TODO: allow longer messages 1001 //TODO: allow longer messages
1002 /* Just print a warning so we can be reasonably safe 1002 /* Just print a warning so we can be reasonably safe
1003 * about not overflowing the buffer. 1003 * about not overflowing the buffer.
1004 */ 1004 */
1005 if (strlen (op->lore) > (HUGE_BUF / 2)) 1005 if (strlen (op->lore) > (HUGE_BUF / 2))
1006 LOG (llevDebug, "\n\tWarning lore length > %d (max allowed=%d): %d\n>%.80s<\n", 1006 LOG (llevDebug, "\tWarning lore length > %d (max allowed=%d): %d\n>%.80s<\n",
1007 HUGE_BUF / 2, HUGE_BUF, strlen (op->lore), &op->lore); 1007 HUGE_BUF / 2, HUGE_BUF, strlen (op->lore), &op->lore);
1008 break; 1008 break;
1009 1009
1010 case KW_editable: 1010 case KW_editable:
1011 case KW_editor_folder: 1011 case KW_editor_folder:
1057 * 1057 *
1058 */ 1058 */
1059int 1059int
1060load_object (object_thawer &fp, object *op, int map_flags) 1060load_object (object_thawer &fp, object *op, int map_flags)
1061{ 1061{
1062 // cede every 500 objects loaded 1062 coroapi::cede_every (1000); // cede once in a while
1063 {
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 1063
1074 return parse_object (op, fp, map_flags); 1064 return parse_object (op, fp, map_flags);
1075} 1065}
1076 1066
1077/* This takes a buffer, scans it for variables, and sets those variables 1067/* This takes a buffer, scans it for variables, and sets those variables

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines