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

Comparing deliantra/server/common/map.C (file contents):
Revision 1.25 by root, Mon Sep 4 17:36:12 2006 UTC vs.
Revision 1.27 by root, Fri Sep 8 12:56:42 2006 UTC

1/* 1/*
2 * static char *rcsid_map_c = 2 * static char *rcsid_map_c =
3 * "$Id: map.C,v 1.25 2006/09/04 17:36:12 root Exp $"; 3 * "$Id: map.C,v 1.27 2006/09/08 12:56:42 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
155{ 155{
156 char buf[MAX_BUF]; 156 char buf[MAX_BUF];
157#ifndef WIN32 157#ifndef WIN32
158 char *endbuf; 158 char *endbuf;
159 struct stat statbuf; 159 struct stat statbuf;
160 int mode = 0, i; 160 int mode = 0;
161#endif 161#endif
162 162
163 if (prepend_dir) 163 if (prepend_dir)
164 strcpy (buf, create_pathname(name)); 164 strcpy (buf, create_pathname(name));
165 else 165 else
704 number_of_entries++; 704 number_of_entries++;
705 if (p) p++; 705 if (p) p++;
706 } 706 }
707 p=shop_string; 707 p=shop_string;
708 strip_endline(p); 708 strip_endline(p);
709 items=(shopitems *) CALLOC(number_of_entries+1, sizeof(shopitems)); 709 items = new shopitems [number_of_entries + 1];
710 memset(items, 0, (sizeof(shopitems) * number_of_entries+1));
711 for (i=0; i<number_of_entries; i++) { 710 for (i=0; i<number_of_entries; i++) {
712 if (!p) { 711 if (!p) {
713 LOG(llevError, "parse_shop_string: I seem to have run out of string, that shouldn't happen.\n"); 712 LOG(llevError, "parse_shop_string: I seem to have run out of string, that shouldn't happen.\n");
714 break; 713 break;
715 } 714 }
1055 * Return the map object we load into (this can change from the passed 1054 * Return the map object we load into (this can change from the passed
1056 * option if we can't find the original map) 1055 * option if we can't find the original map)
1057 */ 1056 */
1058 1057
1059static mapstruct *load_temporary_map(mapstruct *m) { 1058static mapstruct *load_temporary_map(mapstruct *m) {
1060 int comp;
1061 char buf[MAX_BUF]; 1059 char buf[MAX_BUF];
1062 1060
1063 if (!m->tmpname) { 1061 if (!m->tmpname) {
1064 LOG(llevError, "No temporary filename for map %s\n", m->path); 1062 LOG(llevError, "No temporary filename for map %s\n", m->path);
1065 strcpy(buf, m->path); 1063 strcpy(buf, m->path);
1199 */ 1197 */
1200 1198
1201int 1199int
1202new_save_map (mapstruct * m, int flag) 1200new_save_map (mapstruct * m, int flag)
1203{ 1201{
1204 char filename[MAX_BUF], buf[MAX_BUF], buf_s[MAX_BUF], shop[MAX_BUF]; 1202 char filename[MAX_BUF], buf[MAX_BUF], shop[MAX_BUF];
1205 int i; 1203 int i;
1206 1204
1207 if (flag && !*m->path) 1205 if (flag && !*m->path)
1208 { 1206 {
1209 LOG (llevError, "Tried to save map without path.\n"); 1207 LOG (llevError, "Tried to save map without path.\n");
1413 if (flag && m->spaces) free_all_objects(m); 1411 if (flag && m->spaces) free_all_objects(m);
1414 if (m->name) FREE_AND_CLEAR(m->name); 1412 if (m->name) FREE_AND_CLEAR(m->name);
1415 if (m->spaces) FREE_AND_CLEAR(m->spaces); 1413 if (m->spaces) FREE_AND_CLEAR(m->spaces);
1416 if (m->msg) FREE_AND_CLEAR(m->msg); 1414 if (m->msg) FREE_AND_CLEAR(m->msg);
1417 if (m->maplore) FREE_AND_CLEAR(m->maplore); 1415 if (m->maplore) FREE_AND_CLEAR(m->maplore);
1418 if (m->shopitems) FREE_AND_CLEAR(m->shopitems); 1416 if (m->shopitems) delete [] m->shopitems; m->shopitems = 0;
1419 if (m->shoprace) FREE_AND_CLEAR(m->shoprace); 1417 if (m->shoprace) FREE_AND_CLEAR(m->shoprace);
1420 if (m->buttons) 1418 if (m->buttons)
1421 free_objectlinkpt(m->buttons); 1419 free_objectlinkpt(m->buttons);
1422 m->buttons = NULL; 1420 m->buttons = NULL;
1423 for (i=0; i<4; i++) { 1421 for (i=0; i<4; i++) {
1607 */ 1605 */
1608 1606
1609int calculate_difficulty(mapstruct *m) { 1607int calculate_difficulty(mapstruct *m) {
1610 object *op; 1608 object *op;
1611 archetype *at; 1609 archetype *at;
1612 int x, y, i, diff; 1610 int x, y, i;
1613 long monster_cnt = 0; 1611 long monster_cnt = 0;
1614 double avgexp = 0; 1612 double avgexp = 0;
1615 sint64 total_exp = 0; 1613 sint64 total_exp = 0;
1616 1614
1617 if (MAP_DIFFICULTY (m)) 1615 if (MAP_DIFFICULTY (m))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines