… | |
… | |
483 | |
483 | |
484 | sum = weight_adjust_for (this, sum); |
484 | sum = weight_adjust_for (this, sum); |
485 | |
485 | |
486 | if (sum != carrying) |
486 | if (sum != carrying) |
487 | { |
487 | { |
|
|
488 | if (carrying != sum)//D |
|
|
489 | LOG (llevDebug, "updating weight got %ld, expected %ld (%s)\n", |
|
|
490 | (long long)sum, (long long)carrying, debug_desc ()); |
|
|
491 | |
488 | carrying = sum; |
492 | carrying = sum; |
489 | |
493 | |
490 | if (object *pl = visible_to ()) |
494 | if (object *pl = visible_to ()) |
491 | if (pl != this) // player is handled lazily |
495 | if (pl != this) // player is handled lazily |
492 | esrv_update_item (UPD_WEIGHT, pl, this); |
496 | esrv_update_item (UPD_WEIGHT, pl, this); |
… | |
… | |
1031 | } |
1035 | } |
1032 | |
1036 | |
1033 | static struct freed_map : maptile |
1037 | static struct freed_map : maptile |
1034 | { |
1038 | { |
1035 | freed_map () |
1039 | freed_map () |
|
|
1040 | : maptile (3, 3) |
1036 | { |
1041 | { |
1037 | path = "<freed objects map>"; |
1042 | path = "<freed objects map>"; |
1038 | name = "/internal/freed_objects_map"; |
1043 | name = "/internal/freed_objects_map"; |
1039 | width = 3; |
|
|
1040 | height = 3; |
|
|
1041 | no_drop = 1; |
1044 | no_drop = 1; |
1042 | no_reset = 1; |
1045 | no_reset = 1; |
1043 | |
1046 | |
1044 | alloc (); |
|
|
1045 | in_memory = MAP_ACTIVE; |
1047 | in_memory = MAP_ACTIVE; |
1046 | } |
1048 | } |
1047 | |
1049 | |
1048 | ~freed_map () |
1050 | ~freed_map () |
1049 | { |
1051 | { |
… | |
… | |
2226 | find_dir_2 (int x, int y) |
2228 | find_dir_2 (int x, int y) |
2227 | { |
2229 | { |
2228 | int q; |
2230 | int q; |
2229 | |
2231 | |
2230 | if (y) |
2232 | if (y) |
2231 | q = x * 100 / y; |
2233 | q = 128 * x / y; |
2232 | else if (x) |
2234 | else if (x) |
2233 | q = -300 * x; |
2235 | q = 512 * x; // to make it > 309 |
2234 | else |
2236 | else |
2235 | return 0; |
2237 | return 0; |
2236 | |
2238 | |
2237 | if (y > 0) |
2239 | if (y > 0) |
2238 | { |
2240 | { |
2239 | if (q < -242) |
2241 | if (q < -309) return 3; |
2240 | return 3; |
2242 | if (q < -52) return 2; |
2241 | if (q < -41) |
2243 | if (q < 52) return 1; |
2242 | return 2; |
2244 | if (q < 309) return 8; |
2243 | if (q < 41) |
2245 | |
2244 | return 1; |
|
|
2245 | if (q < 242) |
|
|
2246 | return 8; |
|
|
2247 | return 7; |
2246 | return 7; |
2248 | } |
2247 | } |
|
|
2248 | else |
|
|
2249 | { |
|
|
2250 | if (q < -309) return 7; |
|
|
2251 | if (q < -52) return 6; |
|
|
2252 | if (q < 52) return 5; |
|
|
2253 | if (q < 309) return 4; |
2249 | |
2254 | |
2250 | if (q < -242) |
|
|
2251 | return 7; |
2255 | return 3; |
2252 | if (q < -41) |
2256 | } |
2253 | return 6; |
|
|
2254 | if (q < 41) |
|
|
2255 | return 5; |
|
|
2256 | if (q < 242) |
|
|
2257 | return 4; |
|
|
2258 | |
|
|
2259 | return 3; |
|
|
2260 | } |
2257 | } |
2261 | |
2258 | |
2262 | /* |
2259 | /* |
2263 | * dirdiff(dir1, dir2) returns how many 45-degrees differences there is |
2260 | * dirdiff(dir1, dir2) returns how many 45-degrees differences there is |
2264 | * between two directions (which are expected to be absolute (see absdir()) |
2261 | * between two directions (which are expected to be absolute (see absdir()) |
2265 | */ |
2262 | */ |
2266 | int |
2263 | int |
2267 | dirdiff (int dir1, int dir2) |
2264 | dirdiff (int dir1, int dir2) |
2268 | { |
2265 | { |
2269 | int d; |
|
|
2270 | |
|
|
2271 | d = abs (dir1 - dir2); |
2266 | int d = abs (dir1 - dir2); |
2272 | if (d > 4) |
|
|
2273 | d = 8 - d; |
|
|
2274 | |
2267 | |
2275 | return d; |
2268 | return d > 4 ? 8 - d : d; |
2276 | } |
2269 | } |
2277 | |
2270 | |
2278 | /* peterm: |
2271 | /* peterm: |
2279 | * do LOS stuff for ball lightning. Go after the closest VISIBLE monster. |
2272 | * do LOS stuff for ball lightning. Go after the closest VISIBLE monster. |
2280 | * Basically, this is a table of directions, and what directions |
2273 | * Basically, this is a table of directions, and what directions |