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

Comparing deliantra/server/server/main.C (file contents):
Revision 1.37 by root, Sat Dec 9 16:11:09 2006 UTC vs.
Revision 1.42 by root, Wed Dec 13 00:42:04 2006 UTC

158 * simple case at top - no encryption - makes it easier to read. 158 * simple case at top - no encryption - makes it easier to read.
159 */ 159 */
160char * 160char *
161crypt_string (char *str, char *salt) 161crypt_string (char *str, char *salt)
162{ 162{
163#if defined(WIN32) || (defined(__FreeBSD__) && !defined(HAVE_LIBDES)) 163#if (defined(__FreeBSD__) && !defined(HAVE_LIBDES))
164 return (str); 164 return (str);
165#else 165#else
166 static char *c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./"; 166 static char *c = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789./";
167 char s[2]; 167 char s[2];
168 168
194enter_player_savebed (object *op) 194enter_player_savebed (object *op)
195{ 195{
196 maptile *oldmap = op->map; 196 maptile *oldmap = op->map;
197 object *tmp; 197 object *tmp;
198 198
199 tmp = get_object (); 199 tmp = object::create ();
200 200
201 EXIT_PATH (tmp) = op->contr->savebed_map; 201 EXIT_PATH (tmp) = op->contr->savebed_map;
202 EXIT_X (tmp) = op->contr->bed_x; 202 EXIT_X (tmp) = op->contr->bed_x;
203 EXIT_Y (tmp) = op->contr->bed_y; 203 EXIT_Y (tmp) = op->contr->bed_y;
204 enter_exit (op, tmp); 204 enter_exit (op, tmp);
217 EXIT_PATH (tmp) = op->contr->savebed_map; 217 EXIT_PATH (tmp) = op->contr->savebed_map;
218 EXIT_X (tmp) = op->contr->bed_x; 218 EXIT_X (tmp) = op->contr->bed_x;
219 EXIT_Y (tmp) = op->contr->bed_y; 219 EXIT_Y (tmp) = op->contr->bed_y;
220 enter_exit (op, tmp); 220 enter_exit (op, tmp);
221 } 221 }
222 free_object (tmp); 222
223 tmp->destroy ();
223} 224}
224 225
225/* All this really is is a glorified remove_object that also updates 226/* All this really is is a glorified remove_object that also updates
226 * the counts on the map if needed. 227 * the counts on the map if needed.
227 */ 228 */
228void 229void
229leave_map (object *op) 230leave_map (object *op)
230{ 231{
231 maptile *oldmap = op->map; 232 maptile *oldmap = op->map;
232 233
233 remove_ob (op); 234 op->remove ();
234 235
235 if (oldmap) 236 if (oldmap)
236 { 237 {
237 if (!op->contr->hidden) 238 if (!op->contr->hidden)
238 oldmap->players--; 239 oldmap->players--;
298 /* not much we can do in this case. */ 299 /* not much we can do in this case. */
299 LOG (llevInfo, "enter_map: Could not find free spot for player - will dump on top of object (%s: %d, %d)\n", newmap->path, x, y); 300 LOG (llevInfo, "enter_map: Could not find free spot for player - will dump on top of object (%s: %d, %d)\n", newmap->path, x, y);
300 } 301 }
301 } /* end if looking for free spot */ 302 } /* end if looking for free spot */
302 303
303 if (op->map != NULL) 304 if (op->map)
304 if (INVOKE_MAP (LEAVE, op->map, ARG_PLAYER (op->contr))) 305 if (INVOKE_MAP (LEAVE, op->map, ARG_PLAYER (op->contr)))
305 return; 306 return;
306 307
307 if (INVOKE_PLAYER (MAP_CHANGE, op->contr, ARG_MAP (newmap), ARG_INT (x), ARG_INT (y))) 308 if (INVOKE_PLAYER (MAP_CHANGE, op->contr, ARG_MAP (newmap), ARG_INT (x), ARG_INT (y)))
308 return; 309 return;
311 return; 312 return;
312 313
313 /* If it is a player login, he has yet to be inserted anyplace. 314 /* If it is a player login, he has yet to be inserted anyplace.
314 * otherwise, we need to deal with removing the player here. 315 * otherwise, we need to deal with removing the player here.
315 */ 316 */
316 remove_ob (op); 317 op->remove ();
317 318
318 /* remove_ob clears these so they must be reset after the remove_ob call */ 319 /* remove_ob clears these so they must be reset after the remove_ob call */
319 op->x = x; 320 op->x = x;
320 op->y = y; 321 op->y = y;
321 op->map = newmap; 322 op->map = newmap;
338 if (op->type == PLAYER && op->contr->ranges[range_golem] != NULL) 339 if (op->type == PLAYER && op->contr->ranges[range_golem] != NULL)
339 { 340 {
340 int i = find_free_spot (op->contr->ranges[range_golem], newmap, 341 int i = find_free_spot (op->contr->ranges[range_golem], newmap,
341 x, y, 1, SIZEOFFREE); 342 x, y, 1, SIZEOFFREE);
342 343
343 remove_ob (op->contr->ranges[range_golem]); 344 op->contr->ranges[range_golem]->remove ();
344 345
345 if (i == -1) 346 if (i == -1)
346 { 347 {
347 remove_friendly_object (op->contr->ranges[range_golem]); 348 remove_friendly_object (op->contr->ranges[range_golem]);
348 free_object (op->contr->ranges[range_golem]); 349 op->contr->ranges[range_golem]->destroy ();
349 op->contr->ranges[range_golem] = 0; 350 op->contr->ranges[range_golem] = 0;
350 } 351 }
351 else 352 else
352 { 353 {
353 for (object *tmp = op->contr->ranges[range_golem]; tmp != NULL; tmp = tmp->more) 354 for (object *tmp = op->contr->ranges[range_golem]; tmp != NULL; tmp = tmp->more)
776#define PORTAL_DESTINATION_NAME "Town portal destination" /* this one should really be in a header file */ 777#define PORTAL_DESTINATION_NAME "Town portal destination" /* this one should really be in a header file */
777 object *tmp; 778 object *tmp;
778 779
779 /* It may be nice to support other creatures moving across 780 /* It may be nice to support other creatures moving across
780 * exits, but right now a lot of the code looks at op->contr, 781 * exits, but right now a lot of the code looks at op->contr,
781 * so thta is an RFE. 782 * so that is an RFE.
782 */ 783 */
783 if (op->type != PLAYER) 784 if (op->type != PLAYER)
784 return; 785 return;
785 786
786 /* First, lets figure out what map the player is going to go to */ 787 /* First, lets figure out what map the player is going to go to */
892 if (tmp->type == FORCE && tmp->slaying && !strcmp (tmp->slaying, PORTAL_DESTINATION_NAME)) 893 if (tmp->type == FORCE && tmp->slaying && !strcmp (tmp->slaying, PORTAL_DESTINATION_NAME))
893 break; 894 break;
894 } 895 }
895 if (tmp) 896 if (tmp)
896 { 897 {
897 remove_ob (tmp); 898 tmp->remove ();
898 free_object (tmp); 899 tmp->destroy ();
899 } 900 }
900 901
901 strcpy (op->contr->savebed_map, path_combine_and_normalize (exit_ob->map->path, EXIT_PATH (exit_ob))); 902 strcpy (op->contr->savebed_map, path_combine_and_normalize (exit_ob->map->path, EXIT_PATH (exit_ob)));
902 op->contr->bed_x = EXIT_X (exit_ob), op->contr->bed_y = EXIT_Y (exit_ob); 903 op->contr->bed_x = EXIT_X (exit_ob), op->contr->bed_y = EXIT_Y (exit_ob);
903 save_player (op, 1); 904 save_player (op, 1);
1097process_events (maptile *map) 1098process_events (maptile *map)
1098{ 1099{
1099 object *op; 1100 object *op;
1100 1101
1101 static object *marker; 1102 static object *marker;
1103
1102 if (!marker) 1104 if (!marker)
1103 marker = get_object (); 1105 marker = object::create ();
1104 1106
1105 process_players1 (map); 1107 process_players1 (map);
1106 1108
1107 marker->active_next = active_objects; 1109 marker->active_next = active_objects;
1108 1110
1155 { 1157 {
1156 LOG (llevError, "BUG: process_events(): Removed object on list\n"); 1158 LOG (llevError, "BUG: process_events(): Removed object on list\n");
1157 char *dump = dump_object (op); 1159 char *dump = dump_object (op);
1158 LOG (llevError, dump); 1160 LOG (llevError, dump);
1159 free (dump); 1161 free (dump);
1160 free_object (op); 1162 op->destroy ();
1161 continue; 1163 continue;
1162 } 1164 }
1163 1165
1164 if (!op->speed) 1166 if (!op->speed)
1165 { 1167 {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines