ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/plugins/cfperl/cfperl.xs
(Generate patch)

Comparing deliantra/server/plugins/cfperl/cfperl.xs (file contents):
Revision 1.59 by elmex, Sat Jul 15 11:57:02 2006 UTC vs.
Revision 1.60 by root, Sat Jul 15 21:10:04 2006 UTC

53extern sint64 *levels; // the experience table 53extern sint64 *levels; // the experience table
54 54
55typedef object object_ornull; 55typedef object object_ornull;
56typedef mapstruct mapstruct_ornull; 56typedef mapstruct mapstruct_ornull;
57 57
58typedef double val64;
59#define newSVval64 newSVnv
60#define SvVAL64 SvNV
61
58static f_plug_api gethook; 62static f_plug_api gethook;
59static f_plug_api registerGlobalEvent; 63static f_plug_api registerGlobalEvent;
60static f_plug_api unregisterGlobalEvent; 64static f_plug_api unregisterGlobalEvent;
61static f_plug_api systemDirectory; 65static f_plug_api systemDirectory;
62static f_plug_api object_set_property; 66static f_plug_api object_set_property;
231 case CFAPI_INT: 235 case CFAPI_INT:
232 sv = newSViv (*va_arg (args, int *)); 236 sv = newSViv (*va_arg (args, int *));
233 break; 237 break;
234 238
235 case CFAPI_LONG: 239 case CFAPI_LONG:
236 sv = newSVnv ((double)*va_arg (args, sint64 *)); /* oh, the humanity! */ 240 sv = newSVval64 ((val64)*va_arg (args, sint64 *));
237 break; 241 break;
238 242
239 case CFAPI_DOUBLE: 243 case CFAPI_DOUBLE:
240 sv = newSVnv (*va_arg (args, double *)); 244 sv = newSVnv (*va_arg (args, double *));
241 break; 245 break;
1454 PROTOTYPE: $ 1458 PROTOTYPE: $
1455 1459
1456int random_roll(int min, int max, object *op, int goodbad); 1460int random_roll(int min, int max, object *op, int goodbad);
1457 1461
1458int 1462int
1459exp_to_level (double exp) 1463exp_to_level (val64 exp)
1460 CODE: 1464 CODE:
1465{
1461 int i = 0; 1466 int i = 0;
1462 RETVAL = 0; 1467
1468 RETVAL = settings.max_level;
1469
1463 for (i = 1; i <= settings.max_level; i++) 1470 for (i = 1; i <= settings.max_level; i++)
1464 { 1471 {
1465 if (levels[i] > exp) 1472 if (levels[i] > exp)
1466 { 1473 {
1467 RETVAL = i - 1; 1474 RETVAL = i - 1;
1468 break; 1475 break;
1469 } 1476 }
1470 } 1477 }
1478}
1471 OUTPUT: RETVAL 1479 OUTPUT: RETVAL
1472 1480
1473double 1481val64
1474level_to_min_exp (int level) 1482level_to_min_exp (int level)
1475 CODE: 1483 CODE:
1484 if (level > settings.max_level)
1485 RETVAL = levels[settings.max_level];
1486 else if (level < 1)
1476 RETVAL = 0; 1487 RETVAL = 0;
1477 if (level > settings.max_level)
1478 RETVAL = levels[settings.max_level];
1479 else if (level < 1)
1480 RETVAL = 0;
1481 else 1488 else
1482 RETVAL = levels[level]; 1489 RETVAL = levels[level];
1483 OUTPUT: RETVAL 1490 OUTPUT: RETVAL
1484 1491
1485SV * 1492SV *
1486resistance_to_string (int atnr) 1493resistance_to_string (int atnr)
1487 CODE: 1494 CODE:
1488 if (atnr >= 0 && atnr < NROFATTACKS) 1495 if (atnr >= 0 && atnr < NROFATTACKS)
1489 {
1490 RETVAL = newSVpv (resist_plus[atnr], 0); 1496 RETVAL = newSVpv (resist_plus[atnr], 0);
1491 }
1492 else 1497 else
1493 {
1494 XSRETURN_UNDEF; 1498 XSRETURN_UNDEF;
1495 }
1496 OUTPUT: RETVAL 1499 OUTPUT: RETVAL
1497 1500
1498MODULE = cf PACKAGE = cf::object PREFIX = cf_object_ 1501MODULE = cf PACKAGE = cf::object PREFIX = cf_object_
1499 1502
1500SV * 1503SV *
1510 { 1513 {
1511 case CFAPI_INT: 1514 case CFAPI_INT:
1512 cf_object_set_int_property (obj, idx, SvIV (newval)); 1515 cf_object_set_int_property (obj, idx, SvIV (newval));
1513 break; 1516 break;
1514 case CFAPI_LONG: 1517 case CFAPI_LONG:
1515 cf_object_set_long_property (obj, idx, SvNV (newval)); 1518 cf_object_set_long_property (obj, idx, SvVAL64 (newval));
1516 break; 1519 break;
1517 case CFAPI_DOUBLE: 1520 case CFAPI_DOUBLE:
1518 { 1521 {
1519 int unused_type; 1522 int unused_type;
1520 object_set_property (&unused_type, obj, idx, (double)SvNV (newval)); 1523 object_set_property (&unused_type, obj, idx, (double)SvNV (newval));
1598 1601
1599object *cf_object_clone (object *op, int clonetype = 0) 1602object *cf_object_clone (object *op, int clonetype = 0)
1600 1603
1601int cf_object_pay_item (object *op, object *buyer) 1604int cf_object_pay_item (object *op, object *buyer)
1602 1605
1603int cf_object_pay_amount (object *op, double amount) 1606int cf_object_pay_amount (object *op, val64 amount)
1604 1607
1605int cf_object_cast_spell (object *caster, object *ctoo, int dir, object *spell_ob, char *stringarg = 0) 1608int cf_object_cast_spell (object *caster, object *ctoo, int dir, object *spell_ob, char *stringarg = 0)
1606 1609
1607int cf_object_cast_ability (object *caster, object *ctoo, int dir, object *sp_, char *stringarg = 0) 1610int cf_object_cast_ability (object *caster, object *ctoo, int dir, object *sp_, char *stringarg = 0)
1608 1611
1645 1648
1646void cf_object_pickup (object *op, object *what) 1649void cf_object_pickup (object *op, object *what)
1647 1650
1648object *cf_create_object_by_name (const char *name) 1651object *cf_create_object_by_name (const char *name)
1649 1652
1650void change_exp (object *op, double exp, const char *skill_name = 0, int flag = 0) 1653void change_exp (object *op, val64 exp, const char *skill_name = 0, int flag = 0)
1651 1654
1652void pay_player (object *op, double amount) 1655void pay_player (object *op, val64 amount)
1653 1656
1654double pay_player_arch (object *op, const char *arch, double amount) 1657val64 pay_player_arch (object *op, const char *arch, val64 amount)
1655 1658
1656void player_lvl_adj (object *who, object *skill = 0) 1659void player_lvl_adj (object *who, object *skill = 0)
1657 1660
1658int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL) 1661int kill_object (object *op, int dam = 0, object *hitter = 0, int type = AT_PHYSICAL)
1659 1662
1660int calc_skill_exp (object *who, object *op, object *skill); 1663int calc_skill_exp (object *who, object *op, object *skill);
1661
1662char *cf_object_get_key (object *op, char *keyname)
1663 ALIAS: key = 0
1664
1665void cf_object_set_key (object *op, char *keyname, char *value)
1666 1664
1667void 1665void
1668cf_object_set_resistance (object *op, int rtype, int val) 1666cf_object_set_resistance (object *op, int rtype, int val)
1669 CODE: 1667 CODE:
1670 if (rtype >= 0 && rtype < NROFATTACKS) 1668 if (rtype >= 0 && rtype < NROFATTACKS)
1771partylist *cf_player_get_party (object *op) 1769partylist *cf_player_get_party (object *op)
1772 ALIAS: party = 0 1770 ALIAS: party = 0
1773 1771
1774void cf_player_set_party (object *op, partylist *party) 1772void cf_player_set_party (object *op, partylist *party)
1775 1773
1776void change_skill (object *op, double exp, char *skill_name = 0, int flag = 0) 1774void change_skill (object *op, val64 exp, char *skill_name = 0, int flag = 0)
1777 1775
1778void kill_player (object *op) 1776void kill_player (object *op)
1779 1777
1780MODULE = cf PACKAGE = cf::object::map PREFIX = cf_ 1778MODULE = cf PACKAGE = cf::object::map PREFIX = cf_
1781 1779
2168 ALIAS: message = 0 2166 ALIAS: message = 0
2169 2167
2170 2168
2171MODULE = cf PACKAGE = cf::living PREFIX = cf_living_ 2169MODULE = cf PACKAGE = cf::living PREFIX = cf_living_
2172 2170
2173double 2171val64
2174exp (living *liv, double new_val = 0.) 2172exp (living *liv, val64 new_val = 0)
2175 PROTOTYPE: $;$ 2173 PROTOTYPE: $;$
2176 ALIAS: 2174 ALIAS:
2177 Str = 1 2175 Str = 1
2178 Dex = 2 2176 Dex = 2
2179 Con = 3 2177 Con = 3

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines