mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-19 20:41:33 +00:00
Remove optimization off of quest::ChooseRandom on msvc to solve a crash on x64 in release mode
This commit is contained in:
parent
6a416a78a8
commit
8a0d4e37bd
@ -1523,12 +1523,12 @@ XS(XS__addldonpoints) {
|
|||||||
if (items != 2)
|
if (items != 2)
|
||||||
Perl_croak(aTHX_ "Usage: quest::addldonpoints(int points, int theme_id)");
|
Perl_croak(aTHX_ "Usage: quest::addldonpoints(int points, int theme_id)");
|
||||||
|
|
||||||
long points = (long) SvIV(ST(0));
|
long points = (long)SvIV(ST(0));
|
||||||
unsigned long theme_id = (unsigned long) SvUV(ST(1));
|
unsigned long theme_id = (unsigned long)SvUV(ST(1));
|
||||||
|
|
||||||
quest_manager.addldonpoints(points, theme_id);
|
quest_manager.addldonpoints(points, theme_id);
|
||||||
|
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
XS(XS__addldonwin);
|
XS(XS__addldonwin);
|
||||||
@ -1537,8 +1537,8 @@ XS(XS__addldonwin) {
|
|||||||
if (items != 2)
|
if (items != 2)
|
||||||
Perl_croak(aTHX_ "Usage: quest::addldonwin(int wins, int theme_id)");
|
Perl_croak(aTHX_ "Usage: quest::addldonwin(int wins, int theme_id)");
|
||||||
|
|
||||||
long wins = (long) SvIV(ST(0));
|
long wins = (long)SvIV(ST(0));
|
||||||
unsigned long theme_id = (unsigned long) SvUV(ST(1));
|
unsigned long theme_id = (unsigned long)SvUV(ST(1));
|
||||||
|
|
||||||
quest_manager.addldonwin(wins, theme_id);
|
quest_manager.addldonwin(wins, theme_id);
|
||||||
|
|
||||||
@ -1551,8 +1551,8 @@ XS(XS__addldonloss) {
|
|||||||
if (items != 2)
|
if (items != 2)
|
||||||
Perl_croak(aTHX_ "Usage: quest::addldonloss(int losses, int theme_id)");
|
Perl_croak(aTHX_ "Usage: quest::addldonloss(int losses, int theme_id)");
|
||||||
|
|
||||||
long losses = (long) SvIV(ST(0));
|
long losses = (long)SvIV(ST(0));
|
||||||
unsigned long theme_id = (unsigned long) SvUV(ST(1));
|
unsigned long theme_id = (unsigned long)SvUV(ST(1));
|
||||||
|
|
||||||
quest_manager.addldonloss(losses, theme_id);
|
quest_manager.addldonloss(losses, theme_id);
|
||||||
|
|
||||||
@ -1565,7 +1565,7 @@ XS(XS__setnexthpevent) {
|
|||||||
if (items != 1)
|
if (items != 1)
|
||||||
Perl_croak(aTHX_ "Usage: quest::setnexthpevent(int at_mob_percentage)");
|
Perl_croak(aTHX_ "Usage: quest::setnexthpevent(int at_mob_percentage)");
|
||||||
|
|
||||||
int at = (int) SvIV(ST(0));
|
int at = (int)SvIV(ST(0));
|
||||||
|
|
||||||
quest_manager.setnexthpevent(at);
|
quest_manager.setnexthpevent(at);
|
||||||
|
|
||||||
@ -1578,7 +1578,7 @@ XS(XS__setnextinchpevent) {
|
|||||||
if (items != 1)
|
if (items != 1)
|
||||||
Perl_croak(aTHX_ "Usage: quest::setnextinchpevent(int at_mob_percentage)");
|
Perl_croak(aTHX_ "Usage: quest::setnextinchpevent(int at_mob_percentage)");
|
||||||
|
|
||||||
int at = (int) SvIV(ST(0));
|
int at = (int)SvIV(ST(0));
|
||||||
|
|
||||||
quest_manager.setnextinchpevent(at);
|
quest_manager.setnextinchpevent(at);
|
||||||
|
|
||||||
@ -1591,7 +1591,7 @@ XS(XS__sethp) {
|
|||||||
if (items != 1)
|
if (items != 1)
|
||||||
Perl_croak(aTHX_ "Usage: quest::sethp(int mob_health_percentage [0-100])");
|
Perl_croak(aTHX_ "Usage: quest::sethp(int mob_health_percentage [0-100])");
|
||||||
|
|
||||||
int hpperc = (int) SvIV(ST(0));
|
int hpperc = (int)SvIV(ST(0));
|
||||||
|
|
||||||
quest_manager.sethp(hpperc);
|
quest_manager.sethp(hpperc);
|
||||||
|
|
||||||
@ -1604,14 +1604,21 @@ XS(XS__respawn) {
|
|||||||
if (items != 2)
|
if (items != 2)
|
||||||
Perl_croak(aTHX_ "Usage: quest::respawn(int npc_type_id, int grid_id)");
|
Perl_croak(aTHX_ "Usage: quest::respawn(int npc_type_id, int grid_id)");
|
||||||
|
|
||||||
int npc_type_id = (int) SvIV(ST(0));
|
int npc_type_id = (int)SvIV(ST(0));
|
||||||
int grid_id = (int) SvIV(ST(1));
|
int grid_id = (int)SvIV(ST(1));
|
||||||
|
|
||||||
quest_manager.respawn(npc_type_id, grid_id);
|
quest_manager.respawn(npc_type_id, grid_id);
|
||||||
|
|
||||||
XSRETURN_EMPTY;
|
XSRETURN_EMPTY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//64 bit windows seems to optimize something poorly here causing access violations.
|
||||||
|
//If you don't do anything with index before passing it to perl it gets optimized out
|
||||||
|
//Disabling optimization right now for msvc on this function is the best solution.
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma optimize( "", off )
|
||||||
|
#endif
|
||||||
|
|
||||||
XS(XS__ChooseRandom);
|
XS(XS__ChooseRandom);
|
||||||
XS(XS__ChooseRandom) {
|
XS(XS__ChooseRandom) {
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
@ -1620,7 +1627,7 @@ XS(XS__ChooseRandom) {
|
|||||||
|
|
||||||
dXSTARG;
|
dXSTARG;
|
||||||
int index = zone->random.Int(0, items - 1);
|
int index = zone->random.Int(0, items - 1);
|
||||||
SV *RETVAL = ST(index);
|
SV* RETVAL = ST(index);
|
||||||
|
|
||||||
XSprePUSH;
|
XSprePUSH;
|
||||||
PUSHs(RETVAL);
|
PUSHs(RETVAL);
|
||||||
@ -1628,6 +1635,10 @@ XS(XS__ChooseRandom) {
|
|||||||
XSRETURN(1); //return 1 element from the stack (ST(0))
|
XSRETURN(1); //return 1 element from the stack (ST(0))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma optimize( "", on )
|
||||||
|
#endif
|
||||||
|
|
||||||
XS(XS__set_proximity);
|
XS(XS__set_proximity);
|
||||||
XS(XS__set_proximity) {
|
XS(XS__set_proximity) {
|
||||||
dXSARGS;
|
dXSARGS;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user