1
0
Fork 0
mirror of https://github.com/AquariaOSE/Aquaria.git synced 2025-10-14 18:40:43 +00:00

Misc fixes and cleanups; fixed variadic Lua calls to self.

Script interface:
- entity_msg() will no longer corrupt the Lua stack if sending messages to itself.
- added more info to non-critical Lua errors ("attempt to call a nil value", etc)
- replaced many lua_tostring() with getString(), which does never return NULL.
  This prevents possible crashes when a non-string parameter is passed to functions
  expecting a string.

Misc:
- Removed classes BoxElement, DFSprite, Datafile, and related references.
  They were essentially unused.
- Removed unused Element class member variables.
- Show more lines in the in-game console.
This commit is contained in:
fgenesis 2012-03-14 00:58:59 +01:00
commit 273b608214
15 changed files with 95 additions and 213 deletions

View file

@ -125,12 +125,10 @@ static void Linux_CopyTree(const char *src, const char *dst)
#endif
float titTimer = 0;
const int saveSlotPageSize = 4;
int maxPages = 15;
#ifdef AQUARIA_BUILD_CONSOLE
const int MAX_CONSOLELINES = 14;
const int MAX_CONSOLELINES = 18;
#endif
DSQ *dsq = 0;
@ -2476,7 +2474,7 @@ void DSQ::clickRingEffect(Vector pos, int type, Vector color, float ut)
}
}
Entity *DSQ::getEntityByName(std::string name)
Entity *DSQ::getEntityByName(const std::string& name)
{
Entity *e = 0;
FOR_ENTITIES(i)
@ -4737,61 +4735,6 @@ void DSQ::playVisualEffect(int vfx, Vector position, Entity *target)
}
}
// get the closest, active, in range element to the vector
/*
Element *DSQ::getElementAtVector(const Vector &vec)
{
Element *returnElement = 0;
int smallestDistance = 9999;
for (int i = 0; i < elements.size(); i++)
{
if (elements[i]->isActive() && elements[i]->getTotalInteractions() > 0)
{
int distanceToElementI = elements[i]->getFakeDistanceFromCenterToVector(vec);
if (elements[i]->isVectorInActivationRange(vec) && distanceToElementI < smallestDistance)
{
smallestDistance = distanceToElementI;
returnElement = elements[i];
}
}
}
return returnElement;
}
*/
Element *DSQ::getElementWithType(Element::Type type)
{
for (int i = 0; i < elements.size(); i++)
{
if (elements[i]->getElementType() == type)
{
return elements[i];
}
}
return 0;
}
/*
Element *DSQ::getClosestElementWithType(Element::Type type, Element *e)
{
Element *returnElement = 0;
long smallestDistance = 999999;
for (int i = 0; i < elements.size(); i++)
{
if (elements[i]->isActive() && elements[i]->getElementType() == type)
{
long distanceToElementI = elements[i]->getFakeDistanceFromCenterToVector(e->position);
if (distanceToElementI < smallestDistance)
{
smallestDistance = distanceToElementI;
returnElement = elements[i];
}
}
}
return returnElement;
}
*/
void DSQ::addElement(Element *e)
{
elements.push_back(e);