1 | /* |
1 | /* |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
2 | * This file is part of Deliantra, the Roguelike Realtime MMORPG. |
3 | * |
3 | * |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
4 | * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
5 | * Copyright (©) 2002 Mark Wedel & Crossfire Development Team |
6 | * Copyright (©) 1992 Frank Tore Johansen |
6 | * Copyright (©) 1992 Frank Tore Johansen |
7 | * |
7 | * |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
8 | * Deliantra is free software: you can redistribute it and/or modify it under |
9 | * the terms of the Affero GNU General Public License as published by the |
9 | * the terms of the Affero GNU General Public License as published by the |
… | |
… | |
265 | type = 0; |
265 | type = 0; |
266 | } |
266 | } |
267 | |
267 | |
268 | switch (type) |
268 | switch (type) |
269 | { |
269 | { |
|
|
270 | case RANGED: |
270 | case BOW: |
271 | case BOW: |
271 | case WAND: |
272 | case WAND: |
272 | case ROD: |
273 | case ROD: |
273 | case HORN: |
274 | case HORN: |
274 | if (slot [body_range].info != -1) |
275 | if (slot [body_range].info != -1) |
… | |
… | |
917 | case KW_is_buildable: GET_FLAG (this, FLAG_IS_BUILDABLE); break; |
918 | case KW_is_buildable: GET_FLAG (this, FLAG_IS_BUILDABLE); break; |
918 | case KW_destroy_on_death: GET_FLAG (this, FLAG_DESTROY_ON_DEATH); break; |
919 | case KW_destroy_on_death: GET_FLAG (this, FLAG_DESTROY_ON_DEATH); break; |
919 | case KW_treasure_env: GET_FLAG (this, FLAG_TREASURE_ENV); break; |
920 | case KW_treasure_env: GET_FLAG (this, FLAG_TREASURE_ENV); break; |
920 | case KW_precious: GET_FLAG (this, FLAG_PRECIOUS); break; |
921 | case KW_precious: GET_FLAG (this, FLAG_PRECIOUS); break; |
921 | case KW_random_speed: GET_FLAG (this, FLAG_RANDOM_SPEED); break; |
922 | case KW_random_speed: GET_FLAG (this, FLAG_RANDOM_SPEED); break; |
|
|
923 | case KW_is_quad: GET_FLAG (this, FLAG_IS_QUAD); break; |
922 | |
924 | |
923 | case KW_armour: f.get (resist[ATNR_PHYSICAL]); break; |
925 | case KW_armour: f.get (resist[ATNR_PHYSICAL]); break; |
924 | case KW_resist_physical: f.get (resist[ATNR_PHYSICAL]); break; |
926 | case KW_resist_physical: f.get (resist[ATNR_PHYSICAL]); break; |
925 | case KW_resist_magic: f.get (resist[ATNR_MAGIC]); break; |
927 | case KW_resist_magic: f.get (resist[ATNR_MAGIC]); break; |
926 | case KW_resist_fire: f.get (resist[ATNR_FIRE]); break; |
928 | case KW_resist_fire: f.get (resist[ATNR_FIRE]); break; |
… | |
… | |
1080 | |
1082 | |
1081 | archetype *arch = archetype::find (f.get_str ()); |
1083 | archetype *arch = archetype::find (f.get_str ()); |
1082 | |
1084 | |
1083 | if (!arch) |
1085 | if (!arch) |
1084 | { |
1086 | { |
1085 | LOG (llevError, "object refering to nonexistant archetype '%s'.\n", f.get_str ()); |
1087 | LOG (llevError, "object referring to nonexistent archetype '%s'.\n", f.get_str ()); |
1086 | arch = archetype::find (shstr_earthwall); |
1088 | arch = archetype::find (shstr_earthwall); |
1087 | } |
1089 | } |
1088 | |
1090 | |
1089 | assert (arch); //D maybe use exception handling of sorts? |
1091 | assert (arch); //D maybe use exception handling of sorts? |
1090 | |
1092 | |
… | |
… | |
1112 | * override values and in c_wiz to mutate values. |
1114 | * override values and in c_wiz to mutate values. |
1113 | */ |
1115 | */ |
1114 | int |
1116 | int |
1115 | set_variable (object *op, char *buf) |
1117 | set_variable (object *op, char *buf) |
1116 | { |
1118 | { |
1117 | object_thawer f (buf, (AV *)0); |
1119 | object_thawer f (format ("%s\nend", buf), (AV *)0); |
1118 | |
1120 | |
1119 | return op->parse_kv (f); |
1121 | return op->parse_kv (f); |
1120 | } |
1122 | } |
1121 | |
1123 | |
1122 | // compare *op against *arch and output differences |
1124 | // compare *op against *arch and output differences |
… | |
… | |
1464 | #endif |
1466 | #endif |
1465 | |
1467 | |
1466 | // save body locations. gcc's memcmp does an abysmal job when used |
1468 | // save body locations. gcc's memcmp does an abysmal job when used |
1467 | for (int i = 0; i < NUM_BODY_LOCATIONS; i++) |
1469 | for (int i = 0; i < NUM_BODY_LOCATIONS; i++) |
1468 | if (expect_false (op->slot[i].info != arch->slot[i].info)) |
1470 | if (expect_false (op->slot[i].info != arch->slot[i].info)) |
1469 | f.put (body_locations[i].save_name, op->slot[i].info); |
1471 | f.put (body_locations[i].kw, op->slot[i].info); |
1470 | } |
1472 | } |
1471 | |
1473 | |
1472 | /* |
1474 | /* |
1473 | * Dumps all variables in an object to a file. |
1475 | * Dumps all variables in an object to a file. |
1474 | * If bit 0 of flag is set, unpaid objects will be saved. As of now, |
1476 | * If bit 0 of flag is set, unpaid objects will be saved. As of now, |