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.135 by root, Fri Aug 1 16:31:58 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 = ob == op ? pl->ob->count : op->count;
1279 } 1280 }
1280 1281
1281 if (lastcell.stat_hp != stat_hp) 1282 if (lastcell.stat_hp != stat_hp)
1282 { 1283 {
1283 lastcell.stat_hp = stat_hp; 1284 lastcell.stat_hp = stat_hp;
1487 if (spell->type == SPELL) 1488 if (spell->type == SPELL)
1488 { 1489 {
1489 int flags = 0; 1490 int flags = 0;
1490 1491
1491 /* check if we need to update it */ 1492 /* check if we need to update it */
1492 if (spell->last_sp != SP_level_spellpoint_cost (pl->ob, spell, SPELL_MANA)) 1493 if (spell->cached_sp != SP_level_spellpoint_cost (pl->ob, spell, SPELL_MANA))
1493 { 1494 {
1494 spell->last_sp = SP_level_spellpoint_cost (pl->ob, spell, SPELL_MANA); 1495 spell->cached_sp = SP_level_spellpoint_cost (pl->ob, spell, SPELL_MANA);
1495 flags |= UPD_SP_MANA; 1496 flags |= UPD_SP_MANA;
1496 } 1497 }
1497 1498
1498 if (spell->last_grace != SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE)) 1499 if (spell->cached_grace != SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE))
1499 { 1500 {
1500 spell->last_grace = SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE); 1501 spell->cached_grace = SP_level_spellpoint_cost (pl->ob, spell, SPELL_GRACE);
1501 flags |= UPD_SP_GRACE; 1502 flags |= UPD_SP_GRACE;
1502 } 1503 }
1503 1504
1504 if (spell->last_eat != spell->stats.dam + SP_level_dam_adjust (pl->ob, spell)) 1505 if (spell->cached_eat != spell->stats.dam + SP_level_dam_adjust (pl->ob, spell))
1505 { 1506 {
1506 spell->last_eat = spell->stats.dam + SP_level_dam_adjust (pl->ob, spell); 1507 spell->cached_eat = spell->stats.dam + SP_level_dam_adjust (pl->ob, spell);
1507 flags |= UPD_SP_DAMAGE; 1508 flags |= UPD_SP_DAMAGE;
1508 } 1509 }
1509 1510
1510 if (flags) 1511 if (flags)
1511 { 1512 {
1513 1514
1514 sl << "updspell " 1515 sl << "updspell "
1515 << uint8 (flags) 1516 << uint8 (flags)
1516 << uint32 (spell->count); 1517 << uint32 (spell->count);
1517 1518
1518 if (flags & UPD_SP_MANA ) sl << uint16 (spell->last_sp); 1519 if (flags & UPD_SP_MANA ) sl << uint16 (spell->cached_sp);
1519 if (flags & UPD_SP_GRACE ) sl << uint16 (spell->last_grace); 1520 if (flags & UPD_SP_GRACE ) sl << uint16 (spell->cached_grace);
1520 if (flags & UPD_SP_DAMAGE) sl << uint16 (spell->last_eat); 1521 if (flags & UPD_SP_DAMAGE) sl << uint16 (spell->cached_eat);
1521 1522
1522 pl->ns->send_packet (sl); 1523 pl->ns->send_packet (sl);
1523 } 1524 }
1524 } 1525 }
1525 } 1526 }
1555 LOG (llevError, "item number %d is a spell with no name.\n", spell->count); 1556 LOG (llevError, "item number %d is a spell with no name.\n", spell->count);
1556 return; 1557 return;
1557 } 1558 }
1558 1559
1559 /* store costs and damage in the object struct, to compare to later */ 1560 /* 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); 1561 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); 1562 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); 1563 spell->cached_eat = spell->stats.dam + SP_level_dam_adjust (pl->ob, spell);
1563 1564
1564 /* figure out which skill it uses, if it uses one */ 1565 /* figure out which skill it uses, if it uses one */
1565 if (spell->skill) 1566 if (spell->skill)
1566 { 1567 {
1567 for (i = 1; i < NUM_SKILLS; i++) 1568 for (i = 1; i < NUM_SKILLS; i++)
1583 1584
1584 /* send the current values */ 1585 /* send the current values */
1585 sl << uint32 (spell->count) 1586 sl << uint32 (spell->count)
1586 << uint16 (spell->level) 1587 << uint16 (spell->level)
1587 << uint16 (spell->casting_time) 1588 << uint16 (spell->casting_time)
1588 << uint16 (spell->last_sp) 1589 << uint16 (spell->cached_sp)
1589 << uint16 (spell->last_grace) 1590 << uint16 (spell->cached_grace)
1590 << uint16 (spell->last_eat) 1591 << uint16 (spell->cached_eat)
1591 << uint8 (skill) 1592 << uint8 (skill)
1592 << uint32 (spell->path_attuned) 1593 << uint32 (spell->path_attuned)
1593 << uint32 (spell->face) 1594 << uint32 (spell->face)
1594 << data8 (spell->name) 1595 << data8 (spell->name)
1595 << data16 (spell->msg); 1596 << data16 (spell->msg);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines