Reverting/reworking Mike's change on thises/prelords. Zeth says that this is crashing on psp - while sizeof(string) shouldn't eval to 0, I don't fully trust this to evaluate correctly on psp, so I'm reverting out the change. Since these are staticly sized arrays, there's no point in trying to calculate their size programatically. (If they were true dynamic containers, then it would make more sense, but then you'd simply call size() on them anyway.)
While at it, moved the string arrays to be global const declarations - there were two duplicate sets of keywords for lords, and they were being created/destroyed on each call to parseMagicLine. No point in constantly reallocating these strings, we know we're going to contantly reuse them.
This commit is contained in:
@@ -16,32 +16,37 @@ using std::cout;
|
||||
#undef True
|
||||
#endif
|
||||
|
||||
// small sized cards are 40 * 28, use this as a compensation factor
|
||||
const float kCardRatio = 28.0f / 40.0f;
|
||||
// allow a slight fudge factor of 4 pixels when comparing distances (ie ~ 1/10th of a small card's diagonal length)
|
||||
const float kSlopValue = 4.0f;
|
||||
|
||||
struct Left: public Exp
|
||||
{
|
||||
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
|
||||
{
|
||||
return ref->x - test->x > fabs(ref->y - test->y);
|
||||
return (ref->x - test->x) * kCardRatio > fabs(ref->y - test->y) - kSlopValue;
|
||||
}
|
||||
};
|
||||
struct Right: public Exp
|
||||
{
|
||||
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
|
||||
{
|
||||
return test->x - ref->x > fabs(ref->y - test->y);
|
||||
return (test->x - ref->x) * kCardRatio > fabs(ref->y - test->y) - kSlopValue;
|
||||
}
|
||||
};
|
||||
struct Up: public Exp
|
||||
{
|
||||
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
|
||||
{
|
||||
return ref->y - test->y > fabs(ref->x - test->x);
|
||||
return ref->y - test->y > fabs(ref->x - test->x) * kCardRatio - kSlopValue;
|
||||
}
|
||||
};
|
||||
struct Down: public Exp
|
||||
{
|
||||
static inline bool test(CardSelector::Target* ref, CardSelector::Target* test)
|
||||
{
|
||||
return test->y - ref->y > fabs(ref->x - test->x);
|
||||
return test->y - ref->y > fabs(ref->x - test->x) * kCardRatio - kSlopValue;
|
||||
}
|
||||
};
|
||||
struct Diff: public Exp
|
||||
|
||||
Reference in New Issue
Block a user