- fix gcc warning (and so some memleak).
This commit is contained in:
parent
49fdea25f9
commit
8c0c15db03
7 changed files with 10 additions and 14 deletions
|
@ -116,7 +116,7 @@ public:
|
|||
void Load();
|
||||
|
||||
/// Draw icon
|
||||
virtual void DrawIcon(const PixelPos &pos, const int player = -1) const;
|
||||
void DrawIcon(const PixelPos &pos, const int player = -1) const;
|
||||
/// Draw grayscale icon
|
||||
void DrawGrayscaleIcon(const PixelPos &pos, const int player = -1) const;
|
||||
/// Draw cooldown spell
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#define LUA_CALLBACK_HEADER_FILE
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
typedef int lua_Object; // from tolua++.h
|
||||
struct lua_State;
|
||||
|
@ -41,7 +42,7 @@ public:
|
|||
~LuaCallback();
|
||||
void pushPreamble();
|
||||
void pushInteger(int value);
|
||||
void pushIntegers(int count, int *array);
|
||||
void pushIntegers(const std::vector<int> &values);
|
||||
void pushString(const std::string &eventId);
|
||||
void run(int results = 0);
|
||||
bool popBoolean();
|
||||
|
|
|
@ -187,7 +187,6 @@ static void EvaluateMissileLocation(const SpellActionMissileLocation &location,
|
|||
/*
|
||||
hardcoded, will be done with Lua when it's possible
|
||||
*/
|
||||
const Vec2i &spellPos = target ? target->tilePos : goalPos;
|
||||
if (this->Missile->Class == MissileClassDeathCoil) {
|
||||
const Vec2i offset(2, 2);
|
||||
std::vector<CUnit *> table;
|
||||
|
|
|
@ -297,7 +297,7 @@ static Target *SelectTargetUnitsOfAutoCast(CUnit &caster, const SpellType &spell
|
|||
return NULL;
|
||||
case TargetPosition: {
|
||||
if (autocast->PositionAutoCast && table.empty() == false) {
|
||||
int count = 0;
|
||||
size_t count = 0;
|
||||
for (size_t i = 0; i != table.size(); ++i) {
|
||||
if (PassCondition(caster, spell, table[i], pos, spell.Condition)
|
||||
&& PassCondition(caster, spell, table[i], pos, autocast->Condition)) {
|
||||
|
@ -309,13 +309,13 @@ static Target *SelectTargetUnitsOfAutoCast(CUnit &caster, const SpellType &spell
|
|||
std::sort(table.begin(), table.begin() + count,
|
||||
AutoCastPrioritySort(caster, autocast->PriorytyVar, autocast->ReverseSort));
|
||||
}
|
||||
int *array = new int[count + 1];
|
||||
std::vector<int> array(count + 1);
|
||||
for (size_t i = 1; i != count + 1; ++i) {
|
||||
array[i] = UnitNumber(*table[i - 1]);
|
||||
}
|
||||
array[0] = UnitNumber(caster);
|
||||
autocast->PositionAutoCast->pushPreamble();
|
||||
autocast->PositionAutoCast->pushIntegers(count + 1, array);
|
||||
autocast->PositionAutoCast->pushIntegers(array);
|
||||
autocast->PositionAutoCast->run(2);
|
||||
Vec2i resPos(autocast->PositionAutoCast->popInteger(), autocast->PositionAutoCast->popInteger());
|
||||
if (Map.Info.IsPointOnMap(resPos)) {
|
||||
|
|
|
@ -80,13 +80,12 @@ void LuaCallback::pushInteger(int value)
|
|||
**
|
||||
** @param value the integer to push on the stack
|
||||
*/
|
||||
void LuaCallback::pushIntegers(int count, int *array)
|
||||
void LuaCallback::pushIntegers(const std::vector<int> &values)
|
||||
{
|
||||
lua_newtable(luastate);
|
||||
int c = lua_gettop(luastate);
|
||||
for (int i = 0; i < count; ++i) {
|
||||
for (size_t i = 0; i < values.size(); ++i) {
|
||||
lua_pushnumber(luastate, i + 1);
|
||||
lua_pushnumber(luastate, array[i]);
|
||||
lua_pushnumber(luastate, values[i]);
|
||||
lua_settable(luastate, -3);
|
||||
}
|
||||
arguments++;
|
||||
|
|
|
@ -2139,8 +2139,6 @@ void DrawPieMenu()
|
|||
CursorStartScreenPos.x - UI.PieMenu.G->Width / 2,
|
||||
CursorStartScreenPos.y - UI.PieMenu.G->Height / 2);
|
||||
}
|
||||
CPlayer &player = *Selected[0]->Player;
|
||||
|
||||
for (int i = 0; i < (int)UI.ButtonPanel.Buttons.size() && i < 9; ++i) {
|
||||
if (buttons[i].Pos != -1) {
|
||||
int x = CursorStartScreenPos.x - ICON_SIZE_X / 2 + UI.PieMenu.X[i];
|
||||
|
|
|
@ -426,9 +426,8 @@ void SaveMapPNG(const char *name)
|
|||
PNG_COLOR_TYPE_RGB, PNG_INTERLACE_NONE, PNG_COMPRESSION_TYPE_DEFAULT,
|
||||
PNG_FILTER_TYPE_DEFAULT);
|
||||
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
png_write_info(png_ptr, info_ptr);
|
||||
|
||||
const SDL_PixelFormat *fmt = Map.TileGraphic->Surface->format;
|
||||
SDL_Surface *mapImage = SDL_CreateRGBSurface(SDL_SWSURFACE,
|
||||
imageWidth, imageHeight, 32, RMASK, GMASK, BMASK, 0);
|
||||
|
||||
|
|
Loading…
Reference in a new issue