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.28 by root, Fri Sep 8 18:26:22 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.28 2006/09/08 18:26:22 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
255 if (mp != oldmap) 255 if (mp != oldmap)
256 retval |= P_NEW_MAP; 256 retval |= P_NEW_MAP;
257 if (newmap) *newmap = mp; 257 if (newmap) *newmap = mp;
258 if (nx) *nx = newx; 258 if (nx) *nx = newx;
259 if (ny) *ny = newy; 259 if (ny) *ny = newy;
260
260 retval |= mp->spaces[newx + mp->width * newy].flags; 261 retval |= mp->spaces[newx + mp->width * newy].flags;
261
262 if (retval & P_SAFE)
263 retval |= P_NO_MAGIC | P_NO_CLERIC; // P_SAFE does imply these
264 262
265 return retval; 263 return retval;
266} 264}
267 265
268 266
704 number_of_entries++; 702 number_of_entries++;
705 if (p) p++; 703 if (p) p++;
706 } 704 }
707 p=shop_string; 705 p=shop_string;
708 strip_endline(p); 706 strip_endline(p);
709 items=(shopitems *) CALLOC(number_of_entries+1, sizeof(shopitems)); 707 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++) { 708 for (i=0; i<number_of_entries; i++) {
712 if (!p) { 709 if (!p) {
713 LOG(llevError, "parse_shop_string: I seem to have run out of string, that shouldn't happen.\n"); 710 LOG(llevError, "parse_shop_string: I seem to have run out of string, that shouldn't happen.\n");
714 break; 711 break;
715 } 712 }
1055 * Return the map object we load into (this can change from the passed 1052 * Return the map object we load into (this can change from the passed
1056 * option if we can't find the original map) 1053 * option if we can't find the original map)
1057 */ 1054 */
1058 1055
1059static mapstruct *load_temporary_map(mapstruct *m) { 1056static mapstruct *load_temporary_map(mapstruct *m) {
1060 int comp;
1061 char buf[MAX_BUF]; 1057 char buf[MAX_BUF];
1062 1058
1063 if (!m->tmpname) { 1059 if (!m->tmpname) {
1064 LOG(llevError, "No temporary filename for map %s\n", m->path); 1060 LOG(llevError, "No temporary filename for map %s\n", m->path);
1065 strcpy(buf, m->path); 1061 strcpy(buf, m->path);
1199 */ 1195 */
1200 1196
1201int 1197int
1202new_save_map (mapstruct * m, int flag) 1198new_save_map (mapstruct * m, int flag)
1203{ 1199{
1204 char filename[MAX_BUF], buf[MAX_BUF], buf_s[MAX_BUF], shop[MAX_BUF]; 1200 char filename[MAX_BUF], buf[MAX_BUF], shop[MAX_BUF];
1205 int i; 1201 int i;
1206 1202
1207 if (flag && !*m->path) 1203 if (flag && !*m->path)
1208 { 1204 {
1209 LOG (llevError, "Tried to save map without path.\n"); 1205 LOG (llevError, "Tried to save map without path.\n");
1413 if (flag && m->spaces) free_all_objects(m); 1409 if (flag && m->spaces) free_all_objects(m);
1414 if (m->name) FREE_AND_CLEAR(m->name); 1410 if (m->name) FREE_AND_CLEAR(m->name);
1415 if (m->spaces) FREE_AND_CLEAR(m->spaces); 1411 if (m->spaces) FREE_AND_CLEAR(m->spaces);
1416 if (m->msg) FREE_AND_CLEAR(m->msg); 1412 if (m->msg) FREE_AND_CLEAR(m->msg);
1417 if (m->maplore) FREE_AND_CLEAR(m->maplore); 1413 if (m->maplore) FREE_AND_CLEAR(m->maplore);
1418 if (m->shopitems) FREE_AND_CLEAR(m->shopitems); 1414 if (m->shopitems) delete [] m->shopitems; m->shopitems = 0;
1419 if (m->shoprace) FREE_AND_CLEAR(m->shoprace); 1415 if (m->shoprace) FREE_AND_CLEAR(m->shoprace);
1420 if (m->buttons) 1416 if (m->buttons)
1421 free_objectlinkpt(m->buttons); 1417 free_objectlinkpt(m->buttons);
1422 m->buttons = NULL; 1418 m->buttons = NULL;
1423 for (i=0; i<4; i++) { 1419 for (i=0; i<4; i++) {
1607 */ 1603 */
1608 1604
1609int calculate_difficulty(mapstruct *m) { 1605int calculate_difficulty(mapstruct *m) {
1610 object *op; 1606 object *op;
1611 archetype *at; 1607 archetype *at;
1612 int x, y, i, diff; 1608 int x, y, i;
1613 long monster_cnt = 0; 1609 long monster_cnt = 0;
1614 double avgexp = 0; 1610 double avgexp = 0;
1615 sint64 total_exp = 0; 1611 sint64 total_exp = 0;
1616 1612
1617 if (MAP_DIFFICULTY (m)) 1613 if (MAP_DIFFICULTY (m))
1807 if (QUERY_FLAG(tmp,FLAG_NO_MAGIC)) 1803 if (QUERY_FLAG(tmp,FLAG_NO_MAGIC))
1808 flags |= P_NO_MAGIC; 1804 flags |= P_NO_MAGIC;
1809 if (QUERY_FLAG(tmp,FLAG_DAMNED)) 1805 if (QUERY_FLAG(tmp,FLAG_DAMNED))
1810 flags |= P_NO_CLERIC; 1806 flags |= P_NO_CLERIC;
1811 if (tmp->type == SAFE_GROUND) 1807 if (tmp->type == SAFE_GROUND)
1812 flags |= P_SAFE | P_NO_CLERIC | P_NO_MAGIC; 1808 flags |= P_SAFE;
1813 1809
1814 if (QUERY_FLAG(tmp,FLAG_BLOCKSVIEW)) 1810 if (QUERY_FLAG(tmp,FLAG_BLOCKSVIEW))
1815 flags |= P_BLOCKSVIEW; 1811 flags |= P_BLOCKSVIEW;
1816 } /* for stack of objects */ 1812 } /* for stack of objects */
1817 1813

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines