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

Comparing deliantra/server/socket/request.C (file contents):
Revision 1.131 by root, Tue May 20 13:25:55 2008 UTC vs.
Revision 1.136 by root, Sun Aug 10 16:31:18 2008 UTC

1177 1177
1178 int d = pl->blocked_los[ax][ay]; 1178 int d = pl->blocked_los[ax][ay];
1179 1179
1180 if (d > 3) 1180 if (d > 3)
1181 { 1181 {
1182
1183 int need_send = 0, count; 1182 int need_send = 0, count;
1184 1183
1185 /* This block deals with spaces that are not visible for whatever 1184 /* This block deals with spaces that are not visible for whatever
1186 * reason. Still may need to send the head for this space. 1185 * reason. Still may need to send the head for this space.
1187 */ 1186 */
1193 if (lastcell.count != -1) 1192 if (lastcell.count != -1)
1194 need_send = 1; 1193 need_send = 1;
1195 1194
1196 count = -1; 1195 count = -1;
1197 1196
1198 /* properly clear a previously sent big face */
1199 if (lastcell.faces[0] || lastcell.faces[1] || lastcell.faces[2] 1197 if (lastcell.faces[0] || lastcell.faces[1] || lastcell.faces[2]
1200 || lastcell.stat_hp || lastcell.flags || lastcell.player) 1198 || lastcell.stat_hp || lastcell.flags || lastcell.player)
1201 need_send = 1; 1199 need_send = 1;
1202 1200
1201 /* properly clear a previously sent big face */
1203 map_clearcell (&lastcell, count); 1202 map_clearcell (&lastcell, count);
1204 1203
1205 if ((mask & 0xf) || need_send) 1204 if ((mask & 0xf) || need_send)
1206 sl[oldlen + 1] = mask & 0xff; 1205 sl[oldlen + 1] = mask & 0xff;
1207 else 1206 else
1263 { 1262 {
1264 if (op->stats.maxhp > op->stats.hp 1263 if (op->stats.maxhp > op->stats.hp
1265 && op->stats.maxhp > 0 1264 && op->stats.maxhp > 0
1266 && (op->type == PLAYER 1265 && (op->type == PLAYER
1267 || op->type == DOOR // does not work, have maxhp 0 1266 || op->type == DOOR // does not work, have maxhp 0
1268 || QUERY_FLAG (op, FLAG_MONSTER) || QUERY_FLAG (op, FLAG_ALIVE) || QUERY_FLAG (op, FLAG_GENERATOR))) 1267 || QUERY_FLAG (op, FLAG_MONSTER)
1268 || QUERY_FLAG (op, FLAG_ALIVE)
1269 || QUERY_FLAG (op, FLAG_GENERATOR)))
1269 { 1270 {
1270 stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp; 1271 stat_hp = 255 - (op->stats.hp * 255 + 254) / op->stats.maxhp;
1271 stat_width = op->arch->max_x - op->arch->x; //TODO: should be upper-left edge 1272 stat_width = op->arch->max_x - op->arch->x; //TODO: should be upper-left edge
1272 } 1273 }
1273 1274
1274 if (op->msg && op->msg[0] == '@') 1275 if (op->has_dialogue ())
1275 flags |= 1; 1276 flags |= 1;
1276 1277
1277 if (op->type == PLAYER && op != ob) 1278 if (op->type == PLAYER)
1278 player = op->count; 1279 player = op == ob ? pl->ob->count
1280 : op == pl->ob ? ob->count
1281 : op->count;
1279 } 1282 }
1280 1283
1281 if (lastcell.stat_hp != stat_hp) 1284 if (lastcell.stat_hp != stat_hp)
1282 { 1285 {
1283 lastcell.stat_hp = stat_hp; 1286 lastcell.stat_hp = stat_hp;
1487 if (spell->type == SPELL) 1490 if (spell->type == SPELL)
1488 { 1491 {
1489 int flags = 0; 1492 int flags = 0;
1490 1493
1491 /* check if we need to update it */ 1494 /* check if we need to update it */
1492 if (spell->last_sp != SP_level_spellpoint_cost (pl->ob, spell, SPELL_MANA)) 1495 if (spell->cached_sp != SP_level_spellpoint_cost (pl->ob, spell, SPELL_MANA))
1493 { 1496 {
1494 spell->last_sp = SP_level_spellpoint_cost (pl->ob, spell, SPELL_MANA); 1497 spell->cached_sp = SP_level_spellpoint_cost (pl->ob, spell, SPELL_MANA);
1495 flags |= UPD_SP_MANA; 1498 flags |= UPD_SP_MANA;
1496 } 1499 }
1497 1500
1498 if (spell->last_grace != SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE)) 1501 if (spell->cached_grace != SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE))
1499 { 1502 {
1500 spell->last_grace = SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE); 1503 spell->cached_grace = SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE);
1501 flags |= UPD_SP_GRACE; 1504 flags |= UPD_SP_GRACE;
1502 } 1505 }
1503 1506
1504 if (spell->last_eat != spell->stats.dam + SP_level_dam_adjust (pl->ob, spell)) 1507 if (spell->cached_eat != spell->stats.dam + SP_level_dam_adjust (pl->ob, spell))
1505 { 1508 {
1506 spell->last_eat = spell->stats.dam + SP_level_dam_adjust (pl->ob, spell); 1509 spell->cached_eat = spell->stats.dam + SP_level_dam_adjust (pl->ob, spell);
1507 flags |= UPD_SP_DAMAGE; 1510 flags |= UPD_SP_DAMAGE;
1508 } 1511 }
1509 1512
1510 if (flags) 1513 if (flags)
1511 { 1514 {
1513 1516
1514 sl << "updspell " 1517 sl << "updspell "
1515 << uint8 (flags) 1518 << uint8 (flags)
1516 << uint32 (spell->count); 1519 << uint32 (spell->count);
1517 1520
1518 if (flags & UPD_SP_MANA ) sl << uint16 (spell->last_sp); 1521 if (flags & UPD_SP_MANA ) sl << uint16 (spell->cached_sp);
1519 if (flags & UPD_SP_GRACE ) sl << uint16 (spell->last_grace); 1522 if (flags & UPD_SP_GRACE ) sl << uint16 (spell->cached_grace);
1520 if (flags & UPD_SP_DAMAGE) sl << uint16 (spell->last_eat); 1523 if (flags & UPD_SP_DAMAGE) sl << uint16 (spell->cached_eat);
1521 1524
1522 pl->ns->send_packet (sl); 1525 pl->ns->send_packet (sl);
1523 } 1526 }
1524 } 1527 }
1525 } 1528 }
1555 LOG (llevError, "item number %d is a spell with no name.\n", spell->count); 1558 LOG (llevError, "item number %d is a spell with no name.\n", spell->count);
1556 return; 1559 return;
1557 } 1560 }
1558 1561
1559 /* store costs and damage in the object struct, to compare to later */ 1562 /* store costs and damage in the object struct, to compare to later */
1560 spell->last_sp = SP_level_spellpoint_cost (pl->ob, spell, SPELL_MANA); 1563 spell->cached_sp = SP_level_spellpoint_cost (pl->ob, spell, SPELL_MANA);
1561 spell->last_grace = SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE); 1564 spell->cached_grace = SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE);
1562 spell->last_eat = spell->stats.dam + SP_level_dam_adjust (pl->ob, spell); 1565 spell->cached_eat = spell->stats.dam + SP_level_dam_adjust (pl->ob, spell);
1563 1566
1564 /* figure out which skill it uses, if it uses one */ 1567 /* figure out which skill it uses, if it uses one */
1565 if (spell->skill) 1568 if (spell->skill)
1566 { 1569 {
1567 for (i = 1; i < NUM_SKILLS; i++) 1570 for (i = 1; i < NUM_SKILLS; i++)
1583 1586
1584 /* send the current values */ 1587 /* send the current values */
1585 sl << uint32 (spell->count) 1588 sl << uint32 (spell->count)
1586 << uint16 (spell->level) 1589 << uint16 (spell->level)
1587 << uint16 (spell->casting_time) 1590 << uint16 (spell->casting_time)
1588 << uint16 (spell->last_sp) 1591 << uint16 (spell->cached_sp)
1589 << uint16 (spell->last_grace) 1592 << uint16 (spell->cached_grace)
1590 << uint16 (spell->last_eat) 1593 << uint16 (spell->cached_eat)
1591 << uint8 (skill) 1594 << uint8 (skill)
1592 << uint32 (spell->path_attuned) 1595 << uint32 (spell->path_attuned)
1593 << uint32 (spell->face) 1596 << uint32 (spell->face)
1594 << data8 (spell->name) 1597 << data8 (spell->name)
1595 << data16 (spell->msg); 1598 << data16 (spell->msg);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines