shared_ptr -> std::shared_ptr
This is one of the first commits in a plan to remove all `using namespace std;` lines in the entire codebase as it is considered anti-pattern today.
This commit is contained in:
@@ -75,7 +75,7 @@ void AbstractContainerScreen::render(int xm, int ym, float a)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<Inventory> inventory = minecraft->player->inventory;
|
std::shared_ptr<Inventory> inventory = minecraft->player->inventory;
|
||||||
if (inventory->getCarried() != NULL)
|
if (inventory->getCarried() != NULL)
|
||||||
{
|
{
|
||||||
glTranslatef(0, 0, 32);
|
glTranslatef(0, 0, 32);
|
||||||
@@ -128,7 +128,7 @@ void AbstractContainerScreen::renderSlot(Slot *slot)
|
|||||||
#if 0
|
#if 0
|
||||||
int x = slot->x;
|
int x = slot->x;
|
||||||
int y = slot->y;
|
int y = slot->y;
|
||||||
shared_ptr<ItemInstance> item = slot->getItem();
|
std::shared_ptr<ItemInstance> item = slot->getItem();
|
||||||
|
|
||||||
if (item == NULL)
|
if (item == NULL)
|
||||||
{
|
{
|
||||||
@@ -218,7 +218,7 @@ void AbstractContainerScreen::removed()
|
|||||||
if (minecraft->player == NULL) return;
|
if (minecraft->player == NULL) return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AbstractContainerScreen::slotsChanged(shared_ptr<Container> container)
|
void AbstractContainerScreen::slotsChanged(std::shared_ptr<Container> container)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ protected:
|
|||||||
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
|
virtual void keyPressed(wchar_t eventCharacter, int eventKey);
|
||||||
public:
|
public:
|
||||||
virtual void removed();
|
virtual void removed();
|
||||||
virtual void slotsChanged(shared_ptr<Container> container);
|
virtual void slotsChanged(std::shared_ptr<Container> container);
|
||||||
virtual bool isPauseScreen();
|
virtual bool isPauseScreen();
|
||||||
virtual void tick();
|
virtual void tick();
|
||||||
};
|
};
|
||||||
@@ -3,11 +3,11 @@
|
|||||||
#include "..\Minecraft.World\net.minecraft.world.entity.projectile.h"
|
#include "..\Minecraft.World\net.minecraft.world.entity.projectile.h"
|
||||||
#include "..\Minecraft.World\Mth.h"
|
#include "..\Minecraft.World\Mth.h"
|
||||||
|
|
||||||
void ArrowRenderer::render(shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a)
|
void ArrowRenderer::render(std::shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a)
|
||||||
{
|
{
|
||||||
// 4J - original version used generics and thus had an input parameter of type Arrow rather than shared_ptr<Entity> we have here -
|
// 4J - original version used generics and thus had an input parameter of type Arrow rather than std::shared_ptr<Entity> we have here -
|
||||||
// do some casting around instead
|
// do some casting around instead
|
||||||
shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(_arrow);
|
std::shared_ptr<Arrow> arrow = dynamic_pointer_cast<Arrow>(_arrow);
|
||||||
bindTexture(TN_ITEM_ARROWS); // 4J - was L"/item/arrows.png"
|
bindTexture(TN_ITEM_ARROWS); // 4J - was L"/item/arrows.png"
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|||||||
@@ -4,5 +4,5 @@
|
|||||||
class ArrowRenderer : public EntityRenderer
|
class ArrowRenderer : public EntityRenderer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void render(shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a);
|
virtual void render(std::shared_ptr<Entity> _arrow, double x, double y, double z, float rot, float a);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ int BlazeModel::modelVersion()
|
|||||||
return 8;
|
return 8;
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlazeModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
void BlazeModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||||
{
|
{
|
||||||
setupAnim(time, r, bob, yRot, xRot, scale);
|
setupAnim(time, r, bob, yRot, xRot, scale);
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ private:
|
|||||||
public:
|
public:
|
||||||
BlazeModel();
|
BlazeModel();
|
||||||
int modelVersion();
|
int modelVersion();
|
||||||
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
||||||
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0);
|
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ BlazeRenderer::BlazeRenderer() : MobRenderer(new BlazeModel(), 0.5f)
|
|||||||
this->modelVersion = ((BlazeModel *) model)->modelVersion();
|
this->modelVersion = ((BlazeModel *) model)->modelVersion();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BlazeRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
void BlazeRenderer::render(std::shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
||||||
{
|
{
|
||||||
// 4J - original version used generics and thus had an input parameter of type Blaze rather than shared_ptr<Entity> we have here -
|
// 4J - original version used generics and thus had an input parameter of type Blaze rather than std::shared_ptr<Entity> we have here -
|
||||||
// do some casting around instead
|
// do some casting around instead
|
||||||
shared_ptr<Blaze> mob = dynamic_pointer_cast<Blaze>(_mob);
|
std::shared_ptr<Blaze> mob = dynamic_pointer_cast<Blaze>(_mob);
|
||||||
|
|
||||||
int modelVersion = ((BlazeModel *) model)->modelVersion();
|
int modelVersion = ((BlazeModel *) model)->modelVersion();
|
||||||
if (modelVersion != this->modelVersion)
|
if (modelVersion != this->modelVersion)
|
||||||
|
|||||||
@@ -10,5 +10,5 @@ private:
|
|||||||
public:
|
public:
|
||||||
BlazeRenderer();
|
BlazeRenderer();
|
||||||
|
|
||||||
virtual void render(shared_ptr<Entity> mob, double x, double y, double z, float rot, float a);
|
virtual void render(std::shared_ptr<Entity> mob, double x, double y, double z, float rot, float a);
|
||||||
};
|
};
|
||||||
@@ -42,7 +42,7 @@ BoatModel::BoatModel() : Model()
|
|||||||
cubes[4]->compile(1.0f/16.0f);
|
cubes[4]->compile(1.0f/16.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoatModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
void BoatModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,5 +7,5 @@ class BoatModel : public Model
|
|||||||
public:
|
public:
|
||||||
ModelPart *cubes[5];
|
ModelPart *cubes[5];
|
||||||
BoatModel();
|
BoatModel();
|
||||||
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
||||||
};
|
};
|
||||||
@@ -10,11 +10,11 @@ BoatRenderer::BoatRenderer() : EntityRenderer()
|
|||||||
model = new BoatModel();
|
model = new BoatModel();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BoatRenderer::render(shared_ptr<Entity> _boat, double x, double y, double z, float rot, float a)
|
void BoatRenderer::render(std::shared_ptr<Entity> _boat, double x, double y, double z, float rot, float a)
|
||||||
{
|
{
|
||||||
// 4J - original version used generics and thus had an input parameter of type Boat rather than shared_ptr<Entity> we have here -
|
// 4J - original version used generics and thus had an input parameter of type Boat rather than std::shared_ptr<Entity> we have here -
|
||||||
// do some casting around instead
|
// do some casting around instead
|
||||||
shared_ptr<Boat> boat = dynamic_pointer_cast<Boat>(_boat);
|
std::shared_ptr<Boat> boat = dynamic_pointer_cast<Boat>(_boat);
|
||||||
|
|
||||||
glPushMatrix();
|
glPushMatrix();
|
||||||
|
|
||||||
|
|||||||
@@ -9,5 +9,5 @@ protected:
|
|||||||
public:
|
public:
|
||||||
BoatRenderer();
|
BoatRenderer();
|
||||||
|
|
||||||
virtual void render(shared_ptr<Entity> boat, double x, double y, double z, float rot, float a);
|
virtual void render(std::shared_ptr<Entity> boat, double x, double y, double z, float rot, float a);
|
||||||
};
|
};
|
||||||
@@ -33,7 +33,7 @@ BookModel::BookModel()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void BookModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
void BookModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||||
{
|
{
|
||||||
setupAnim(time, r, bob, yRot, xRot, scale);
|
setupAnim(time, r, bob, yRot, xRot, scale);
|
||||||
|
|
||||||
|
|||||||
@@ -11,6 +11,6 @@ public:
|
|||||||
ModelPart *seam;
|
ModelPart *seam;
|
||||||
|
|
||||||
BookModel();
|
BookModel();
|
||||||
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
||||||
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0);
|
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ float Camera::za = 0.0f;
|
|||||||
float Camera::xa2 = 0.0f;
|
float Camera::xa2 = 0.0f;
|
||||||
float Camera::za2 = 0.0f;
|
float Camera::za2 = 0.0f;
|
||||||
|
|
||||||
void Camera::prepare(shared_ptr<Player> player, bool mirror)
|
void Camera::prepare(std::shared_ptr<Player> player, bool mirror)
|
||||||
{
|
{
|
||||||
glGetFloat(GL_MODELVIEW_MATRIX, modelview);
|
glGetFloat(GL_MODELVIEW_MATRIX, modelview);
|
||||||
glGetFloat(GL_PROJECTION_MATRIX, projection);
|
glGetFloat(GL_PROJECTION_MATRIX, projection);
|
||||||
@@ -88,12 +88,12 @@ void Camera::prepare(shared_ptr<Player> player, bool mirror)
|
|||||||
ya = cosf(xRot * PI / 180.0f);
|
ya = cosf(xRot * PI / 180.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
TilePos *Camera::getCameraTilePos(shared_ptr<Mob> player, double alpha)
|
TilePos *Camera::getCameraTilePos(std::shared_ptr<Mob> player, double alpha)
|
||||||
{
|
{
|
||||||
return new TilePos(getCameraPos(player, alpha));
|
return new TilePos(getCameraPos(player, alpha));
|
||||||
}
|
}
|
||||||
|
|
||||||
Vec3 *Camera::getCameraPos(shared_ptr<Mob> player, double alpha)
|
Vec3 *Camera::getCameraPos(std::shared_ptr<Mob> player, double alpha)
|
||||||
{
|
{
|
||||||
double xx = player->xo + (player->x - player->xo) * alpha;
|
double xx = player->xo + (player->x - player->xo) * alpha;
|
||||||
double yy = player->yo + (player->y - player->yo) * alpha + player->getHeadHeight();
|
double yy = player->yo + (player->y - player->yo) * alpha + player->getHeadHeight();
|
||||||
@@ -106,7 +106,7 @@ Vec3 *Camera::getCameraPos(shared_ptr<Mob> player, double alpha)
|
|||||||
return Vec3::newTemp(xt, yt, zt);
|
return Vec3::newTemp(xt, yt, zt);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Camera::getBlockAt(Level *level, shared_ptr<Mob> player, float alpha)
|
int Camera::getBlockAt(Level *level, std::shared_ptr<Mob> player, float alpha)
|
||||||
{
|
{
|
||||||
Vec3 *p = Camera::getCameraPos(player, alpha);
|
Vec3 *p = Camera::getCameraPos(player, alpha);
|
||||||
TilePos tp = TilePos(p);
|
TilePos tp = TilePos(p);
|
||||||
|
|||||||
@@ -24,9 +24,9 @@ private:
|
|||||||
public:
|
public:
|
||||||
static float xa, ya, za, xa2, za2;
|
static float xa, ya, za, xa2, za2;
|
||||||
|
|
||||||
static void prepare(shared_ptr<Player> player, bool mirror);
|
static void prepare(std::shared_ptr<Player> player, bool mirror);
|
||||||
|
|
||||||
static TilePos *getCameraTilePos(shared_ptr<Mob> player, double alpha);
|
static TilePos *getCameraTilePos(std::shared_ptr<Mob> player, double alpha);
|
||||||
static Vec3 *getCameraPos(shared_ptr<Mob> player, double alpha);
|
static Vec3 *getCameraPos(std::shared_ptr<Mob> player, double alpha);
|
||||||
static int getBlockAt(Level *level, shared_ptr<Mob> player, float alpha);
|
static int getBlockAt(Level *level, std::shared_ptr<Mob> player, float alpha);
|
||||||
};
|
};
|
||||||
@@ -18,10 +18,10 @@ ChestRenderer::~ChestRenderer()
|
|||||||
delete largeChestModel;
|
delete largeChestModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChestRenderer::render(shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled)
|
void ChestRenderer::render(std::shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha, bool useCompiled)
|
||||||
{
|
{
|
||||||
// 4J Convert as we aren't using a templated class
|
// 4J Convert as we aren't using a templated class
|
||||||
shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(_chest);
|
std::shared_ptr<ChestTileEntity> chest = dynamic_pointer_cast<ChestTileEntity>(_chest);
|
||||||
|
|
||||||
int data;
|
int data;
|
||||||
|
|
||||||
|
|||||||
@@ -14,5 +14,5 @@ public:
|
|||||||
ChestRenderer();
|
ChestRenderer();
|
||||||
~ChestRenderer();
|
~ChestRenderer();
|
||||||
|
|
||||||
void render(shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param
|
void render(std::shared_ptr<TileEntity> _chest, double x, double y, double z, float a, bool setColor, float alpha=1.0f, bool useCompiled = true); // 4J added setColor param
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ ChickenModel::ChickenModel() : Model()
|
|||||||
wing1->compile(1.0f/16.0f);
|
wing1->compile(1.0f/16.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChickenModel::render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
void ChickenModel::render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled)
|
||||||
{
|
{
|
||||||
setupAnim(time, r, bob, yRot, xRot, scale);
|
setupAnim(time, r, bob, yRot, xRot, scale);
|
||||||
if (young)
|
if (young)
|
||||||
|
|||||||
@@ -6,6 +6,6 @@ public:
|
|||||||
ModelPart *head, *hair, *body, *leg0, *leg1, *wing0,* wing1, *beak, *redThing;
|
ModelPart *head, *hair, *body, *leg0, *leg1, *wing0,* wing1, *beak, *redThing;
|
||||||
|
|
||||||
ChickenModel();
|
ChickenModel();
|
||||||
virtual void render(shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
virtual void render(std::shared_ptr<Entity> entity, float time, float r, float bob, float yRot, float xRot, float scale, bool usecompiled);
|
||||||
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0);
|
virtual void setupAnim(float time, float r, float bob, float yRot, float xRot, float scale, unsigned int uiBitmaskOverrideAnim=0);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,15 +7,15 @@ ChickenRenderer::ChickenRenderer(Model *model, float shadow) : MobRenderer(model
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChickenRenderer::render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
void ChickenRenderer::render(std::shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a)
|
||||||
{
|
{
|
||||||
MobRenderer::render(_mob, x, y, z, rot, a);
|
MobRenderer::render(_mob, x, y, z, rot, a);
|
||||||
}
|
}
|
||||||
|
|
||||||
float ChickenRenderer::getBob(shared_ptr<Mob> _mob, float a)
|
float ChickenRenderer::getBob(std::shared_ptr<Mob> _mob, float a)
|
||||||
{
|
{
|
||||||
// 4J - dynamic cast required because we aren't using templates/generics in our version
|
// 4J - dynamic cast required because we aren't using templates/generics in our version
|
||||||
shared_ptr<Chicken> mob = dynamic_pointer_cast<Chicken>(_mob);
|
std::shared_ptr<Chicken> mob = dynamic_pointer_cast<Chicken>(_mob);
|
||||||
|
|
||||||
float flap = mob->oFlap+(mob->flap-mob->oFlap)*a;
|
float flap = mob->oFlap+(mob->flap-mob->oFlap)*a;
|
||||||
float flapSpeed = mob->oFlapSpeed+(mob->flapSpeed-mob->oFlapSpeed)*a;
|
float flapSpeed = mob->oFlapSpeed+(mob->flapSpeed-mob->oFlapSpeed)*a;
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ class ChickenRenderer : public MobRenderer
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ChickenRenderer(Model *model, float shadow);
|
ChickenRenderer(Model *model, float shadow);
|
||||||
virtual void render(shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a);
|
virtual void render(std::shared_ptr<Entity> _mob, double x, double y, double z, float rot, float a);
|
||||||
protected:
|
protected:
|
||||||
virtual float getBob(shared_ptr<Mob> _mob, float a);
|
virtual float getBob(std::shared_ptr<Mob> _mob, float a);
|
||||||
};
|
};
|
||||||
@@ -204,10 +204,10 @@ void Chunk::rebuild()
|
|||||||
|
|
||||||
LevelChunk::touchedSky = false;
|
LevelChunk::touchedSky = false;
|
||||||
|
|
||||||
// unordered_set<shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
// unordered_set<std::shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
||||||
// renderableTileEntities.clear();
|
// renderableTileEntities.clear();
|
||||||
|
|
||||||
vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
|
vector<std::shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
|
||||||
|
|
||||||
int r = 1;
|
int r = 1;
|
||||||
|
|
||||||
@@ -402,7 +402,7 @@ void Chunk::rebuild()
|
|||||||
Tile *tile = Tile::tiles[tileId];
|
Tile *tile = Tile::tiles[tileId];
|
||||||
if (currentLayer == 0 && tile->isEntityTile())
|
if (currentLayer == 0 && tile->isEntityTile())
|
||||||
{
|
{
|
||||||
shared_ptr<TileEntity> et = region->getTileEntity(x, y, z);
|
std::shared_ptr<TileEntity> et = region->getTileEntity(x, y, z);
|
||||||
if (TileEntityRenderDispatcher::instance->hasRenderer(et))
|
if (TileEntityRenderDispatcher::instance->hasRenderer(et))
|
||||||
{
|
{
|
||||||
renderableTileEntities.push_back(et);
|
renderableTileEntities.push_back(et);
|
||||||
@@ -554,10 +554,10 @@ void Chunk::rebuild()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
unordered_set<std::shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||||
|
|
||||||
AUTO_VAR(endIt, oldTileEntities.end());
|
AUTO_VAR(endIt, oldTileEntities.end());
|
||||||
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||||
{
|
{
|
||||||
newTileEntities.erase(*it);
|
newTileEntities.erase(*it);
|
||||||
}
|
}
|
||||||
@@ -566,7 +566,7 @@ void Chunk::rebuild()
|
|||||||
|
|
||||||
EnterCriticalSection(globalRenderableTileEntities_cs);
|
EnterCriticalSection(globalRenderableTileEntities_cs);
|
||||||
endIt = newTileEntities.end();
|
endIt = newTileEntities.end();
|
||||||
for( unordered_set<shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
||||||
{
|
{
|
||||||
globalRenderableTileEntities->push_back(*it);
|
globalRenderableTileEntities->push_back(*it);
|
||||||
}
|
}
|
||||||
@@ -574,12 +574,12 @@ void Chunk::rebuild()
|
|||||||
// 4J - All these new things added to globalRenderableTileEntities
|
// 4J - All these new things added to globalRenderableTileEntities
|
||||||
|
|
||||||
AUTO_VAR(endItRTE, renderableTileEntities.end());
|
AUTO_VAR(endItRTE, renderableTileEntities.end());
|
||||||
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
for( vector<std::shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
||||||
{
|
{
|
||||||
oldTileEntities.erase(*it);
|
oldTileEntities.erase(*it);
|
||||||
}
|
}
|
||||||
// 4J - oldTileEntities is now the removed items
|
// 4J - oldTileEntities is now the removed items
|
||||||
vector<shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin();
|
vector<std::shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin();
|
||||||
while( it != globalRenderableTileEntities->end() )
|
while( it != globalRenderableTileEntities->end() )
|
||||||
{
|
{
|
||||||
if( oldTileEntities.find(*it) != oldTileEntities.end() )
|
if( oldTileEntities.find(*it) != oldTileEntities.end() )
|
||||||
@@ -656,10 +656,10 @@ void Chunk::rebuild_SPU()
|
|||||||
|
|
||||||
LevelChunk::touchedSky = false;
|
LevelChunk::touchedSky = false;
|
||||||
|
|
||||||
// unordered_set<shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
// unordered_set<std::shared_ptr<TileEntity> > oldTileEntities(renderableTileEntities.begin(),renderableTileEntities.end()); // 4J removed this & next line
|
||||||
// renderableTileEntities.clear();
|
// renderableTileEntities.clear();
|
||||||
|
|
||||||
vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
|
vector<std::shared_ptr<TileEntity> > renderableTileEntities; // 4J - added
|
||||||
|
|
||||||
// List<TileEntity> newTileEntities = new ArrayList<TileEntity>();
|
// List<TileEntity> newTileEntities = new ArrayList<TileEntity>();
|
||||||
// newTileEntities.clear();
|
// newTileEntities.clear();
|
||||||
@@ -750,7 +750,7 @@ void Chunk::rebuild_SPU()
|
|||||||
{
|
{
|
||||||
if (currentLayer == 0 && Tile::tiles[tileId]->isEntityTile())
|
if (currentLayer == 0 && Tile::tiles[tileId]->isEntityTile())
|
||||||
{
|
{
|
||||||
shared_ptr<TileEntity> et = region.getTileEntity(x, y, z);
|
std::shared_ptr<TileEntity> et = region.getTileEntity(x, y, z);
|
||||||
if (TileEntityRenderDispatcher::instance->hasRenderer(et))
|
if (TileEntityRenderDispatcher::instance->hasRenderer(et))
|
||||||
{
|
{
|
||||||
renderableTileEntities.push_back(et);
|
renderableTileEntities.push_back(et);
|
||||||
@@ -883,10 +883,10 @@ void Chunk::rebuild_SPU()
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
unordered_set<shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
unordered_set<std::shared_ptr<TileEntity> > newTileEntities(renderableTileEntities.begin(),renderableTileEntities.end());
|
||||||
|
|
||||||
AUTO_VAR(endIt, oldTileEntities.end());
|
AUTO_VAR(endIt, oldTileEntities.end());
|
||||||
for( unordered_set<shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = oldTileEntities.begin(); it != endIt; it++ )
|
||||||
{
|
{
|
||||||
newTileEntities.erase(*it);
|
newTileEntities.erase(*it);
|
||||||
}
|
}
|
||||||
@@ -895,7 +895,7 @@ void Chunk::rebuild_SPU()
|
|||||||
|
|
||||||
EnterCriticalSection(globalRenderableTileEntities_cs);
|
EnterCriticalSection(globalRenderableTileEntities_cs);
|
||||||
endIt = newTileEntities.end();
|
endIt = newTileEntities.end();
|
||||||
for( unordered_set<shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
for( unordered_set<std::shared_ptr<TileEntity> >::iterator it = newTileEntities.begin(); it != endIt; it++ )
|
||||||
{
|
{
|
||||||
globalRenderableTileEntities.push_back(*it);
|
globalRenderableTileEntities.push_back(*it);
|
||||||
}
|
}
|
||||||
@@ -903,12 +903,12 @@ void Chunk::rebuild_SPU()
|
|||||||
// 4J - All these new things added to globalRenderableTileEntities
|
// 4J - All these new things added to globalRenderableTileEntities
|
||||||
|
|
||||||
AUTO_VAR(endItRTE, renderableTileEntities.end());
|
AUTO_VAR(endItRTE, renderableTileEntities.end());
|
||||||
for( vector<shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
for( vector<std::shared_ptr<TileEntity> >::iterator it = renderableTileEntities.begin(); it != endItRTE; it++ )
|
||||||
{
|
{
|
||||||
oldTileEntities.erase(*it);
|
oldTileEntities.erase(*it);
|
||||||
}
|
}
|
||||||
// 4J - oldTileEntities is now the removed items
|
// 4J - oldTileEntities is now the removed items
|
||||||
vector<shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin();
|
vector<std::shared_ptr<TileEntity> >::iterator it = globalRenderableTileEntities->begin();
|
||||||
while( it != globalRenderableTileEntities->end() )
|
while( it != globalRenderableTileEntities->end() )
|
||||||
{
|
{
|
||||||
if( oldTileEntities.find(*it) != oldTileEntities.end() )
|
if( oldTileEntities.find(*it) != oldTileEntities.end() )
|
||||||
@@ -941,7 +941,7 @@ void Chunk::rebuild_SPU()
|
|||||||
#endif // _PS3_
|
#endif // _PS3_
|
||||||
|
|
||||||
|
|
||||||
float Chunk::distanceToSqr(shared_ptr<Entity> player) const
|
float Chunk::distanceToSqr(std::shared_ptr<Entity> player) const
|
||||||
{
|
{
|
||||||
float xd = (float) (player->x - xm);
|
float xd = (float) (player->x - xm);
|
||||||
float yd = (float) (player->y - ym);
|
float yd = (float) (player->y - ym);
|
||||||
@@ -949,7 +949,7 @@ float Chunk::distanceToSqr(shared_ptr<Entity> player) const
|
|||||||
return xd * xd + yd * yd + zd * zd;
|
return xd * xd + yd * yd + zd * zd;
|
||||||
}
|
}
|
||||||
|
|
||||||
float Chunk::squishedDistanceToSqr(shared_ptr<Entity> player)
|
float Chunk::squishedDistanceToSqr(std::shared_ptr<Entity> player)
|
||||||
{
|
{
|
||||||
float xd = (float) (player->x - xm);
|
float xd = (float) (player->x - xm);
|
||||||
float yd = (float) (player->y - ym) * 2;
|
float yd = (float) (player->y - ym) * 2;
|
||||||
|
|||||||
@@ -52,7 +52,7 @@ public:
|
|||||||
|
|
||||||
int id;
|
int id;
|
||||||
//public:
|
//public:
|
||||||
// vector<shared_ptr<TileEntity> > renderableTileEntities; // 4J - removed
|
// vector<std::shared_ptr<TileEntity> > renderableTileEntities; // 4J - removed
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LevelRenderer::rteMap *globalRenderableTileEntities;
|
LevelRenderer::rteMap *globalRenderableTileEntities;
|
||||||
@@ -71,8 +71,8 @@ public:
|
|||||||
#ifdef __PS3__
|
#ifdef __PS3__
|
||||||
void rebuild_SPU();
|
void rebuild_SPU();
|
||||||
#endif // __PS3__
|
#endif // __PS3__
|
||||||
float distanceToSqr(shared_ptr<Entity> player) const;
|
float distanceToSqr(std::shared_ptr<Entity> player) const;
|
||||||
float squishedDistanceToSqr(shared_ptr<Entity> player);
|
float squishedDistanceToSqr(std::shared_ptr<Entity> player);
|
||||||
void reset();
|
void reset();
|
||||||
void _delete();
|
void _delete();
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -49,92 +49,92 @@ public:
|
|||||||
~ClientConnection();
|
~ClientConnection();
|
||||||
void tick();
|
void tick();
|
||||||
INetworkPlayer *getNetworkPlayer();
|
INetworkPlayer *getNetworkPlayer();
|
||||||
virtual void handleLogin(shared_ptr<LoginPacket> packet);
|
virtual void handleLogin(std::shared_ptr<LoginPacket> packet);
|
||||||
virtual void handleAddEntity(shared_ptr<AddEntityPacket> packet);
|
virtual void handleAddEntity(std::shared_ptr<AddEntityPacket> packet);
|
||||||
virtual void handleAddExperienceOrb(shared_ptr<AddExperienceOrbPacket> packet);
|
virtual void handleAddExperienceOrb(std::shared_ptr<AddExperienceOrbPacket> packet);
|
||||||
virtual void handleAddGlobalEntity(shared_ptr<AddGlobalEntityPacket> packet);
|
virtual void handleAddGlobalEntity(std::shared_ptr<AddGlobalEntityPacket> packet);
|
||||||
virtual void handleAddPainting(shared_ptr<AddPaintingPacket> packet);
|
virtual void handleAddPainting(std::shared_ptr<AddPaintingPacket> packet);
|
||||||
virtual void handleSetEntityMotion(shared_ptr<SetEntityMotionPacket> packet);
|
virtual void handleSetEntityMotion(std::shared_ptr<SetEntityMotionPacket> packet);
|
||||||
virtual void handleSetEntityData(shared_ptr<SetEntityDataPacket> packet);
|
virtual void handleSetEntityData(std::shared_ptr<SetEntityDataPacket> packet);
|
||||||
virtual void handleAddPlayer(shared_ptr<AddPlayerPacket> packet);
|
virtual void handleAddPlayer(std::shared_ptr<AddPlayerPacket> packet);
|
||||||
virtual void handleTeleportEntity(shared_ptr<TeleportEntityPacket> packet);
|
virtual void handleTeleportEntity(std::shared_ptr<TeleportEntityPacket> packet);
|
||||||
virtual void handleMoveEntity(shared_ptr<MoveEntityPacket> packet);
|
virtual void handleMoveEntity(std::shared_ptr<MoveEntityPacket> packet);
|
||||||
virtual void handleRotateMob(shared_ptr<RotateHeadPacket> packet);
|
virtual void handleRotateMob(std::shared_ptr<RotateHeadPacket> packet);
|
||||||
virtual void handleMoveEntitySmall(shared_ptr<MoveEntityPacketSmall> packet);
|
virtual void handleMoveEntitySmall(std::shared_ptr<MoveEntityPacketSmall> packet);
|
||||||
virtual void handleRemoveEntity(shared_ptr<RemoveEntitiesPacket> packet);
|
virtual void handleRemoveEntity(std::shared_ptr<RemoveEntitiesPacket> packet);
|
||||||
virtual void handleMovePlayer(shared_ptr<MovePlayerPacket> packet);
|
virtual void handleMovePlayer(std::shared_ptr<MovePlayerPacket> packet);
|
||||||
|
|
||||||
Random *random;
|
Random *random;
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
virtual void handleChunkVisibilityArea(shared_ptr<ChunkVisibilityAreaPacket> packet);
|
virtual void handleChunkVisibilityArea(std::shared_ptr<ChunkVisibilityAreaPacket> packet);
|
||||||
|
|
||||||
virtual void handleChunkVisibility(shared_ptr<ChunkVisibilityPacket> packet);
|
virtual void handleChunkVisibility(std::shared_ptr<ChunkVisibilityPacket> packet);
|
||||||
virtual void handleChunkTilesUpdate(shared_ptr<ChunkTilesUpdatePacket> packet);
|
virtual void handleChunkTilesUpdate(std::shared_ptr<ChunkTilesUpdatePacket> packet);
|
||||||
virtual void handleBlockRegionUpdate(shared_ptr<BlockRegionUpdatePacket> packet);
|
virtual void handleBlockRegionUpdate(std::shared_ptr<BlockRegionUpdatePacket> packet);
|
||||||
virtual void handleTileUpdate(shared_ptr<TileUpdatePacket> packet);
|
virtual void handleTileUpdate(std::shared_ptr<TileUpdatePacket> packet);
|
||||||
virtual void handleDisconnect(shared_ptr<DisconnectPacket> packet);
|
virtual void handleDisconnect(std::shared_ptr<DisconnectPacket> packet);
|
||||||
virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects);
|
virtual void onDisconnect(DisconnectPacket::eDisconnectReason reason, void *reasonObjects);
|
||||||
void sendAndDisconnect(shared_ptr<Packet> packet);
|
void sendAndDisconnect(std::shared_ptr<Packet> packet);
|
||||||
void send(shared_ptr<Packet> packet);
|
void send(std::shared_ptr<Packet> packet);
|
||||||
virtual void handleTakeItemEntity(shared_ptr<TakeItemEntityPacket> packet);
|
virtual void handleTakeItemEntity(std::shared_ptr<TakeItemEntityPacket> packet);
|
||||||
virtual void handleChat(shared_ptr<ChatPacket> packet);
|
virtual void handleChat(std::shared_ptr<ChatPacket> packet);
|
||||||
virtual void handleAnimate(shared_ptr<AnimatePacket> packet);
|
virtual void handleAnimate(std::shared_ptr<AnimatePacket> packet);
|
||||||
virtual void handleEntityActionAtPosition(shared_ptr<EntityActionAtPositionPacket> packet);
|
virtual void handleEntityActionAtPosition(std::shared_ptr<EntityActionAtPositionPacket> packet);
|
||||||
virtual void handlePreLogin(shared_ptr<PreLoginPacket> packet);
|
virtual void handlePreLogin(std::shared_ptr<PreLoginPacket> packet);
|
||||||
void close();
|
void close();
|
||||||
virtual void handleAddMob(shared_ptr<AddMobPacket> packet);
|
virtual void handleAddMob(std::shared_ptr<AddMobPacket> packet);
|
||||||
virtual void handleSetTime(shared_ptr<SetTimePacket> packet);
|
virtual void handleSetTime(std::shared_ptr<SetTimePacket> packet);
|
||||||
virtual void handleSetSpawn(shared_ptr<SetSpawnPositionPacket> packet);
|
virtual void handleSetSpawn(std::shared_ptr<SetSpawnPositionPacket> packet);
|
||||||
virtual void handleRidePacket(shared_ptr<SetRidingPacket> packet);
|
virtual void handleRidePacket(std::shared_ptr<SetRidingPacket> packet);
|
||||||
virtual void handleEntityEvent(shared_ptr<EntityEventPacket> packet);
|
virtual void handleEntityEvent(std::shared_ptr<EntityEventPacket> packet);
|
||||||
private:
|
private:
|
||||||
shared_ptr<Entity> getEntity(int entityId);
|
std::shared_ptr<Entity> getEntity(int entityId);
|
||||||
wstring GetDisplayNameByGamertag(wstring gamertag);
|
wstring GetDisplayNameByGamertag(wstring gamertag);
|
||||||
public:
|
public:
|
||||||
virtual void handleSetHealth(shared_ptr<SetHealthPacket> packet);
|
virtual void handleSetHealth(std::shared_ptr<SetHealthPacket> packet);
|
||||||
virtual void handleSetExperience(shared_ptr<SetExperiencePacket> packet);
|
virtual void handleSetExperience(std::shared_ptr<SetExperiencePacket> packet);
|
||||||
virtual void handleRespawn(shared_ptr<RespawnPacket> packet);
|
virtual void handleRespawn(std::shared_ptr<RespawnPacket> packet);
|
||||||
virtual void handleExplosion(shared_ptr<ExplodePacket> packet);
|
virtual void handleExplosion(std::shared_ptr<ExplodePacket> packet);
|
||||||
virtual void handleContainerOpen(shared_ptr<ContainerOpenPacket> packet);
|
virtual void handleContainerOpen(std::shared_ptr<ContainerOpenPacket> packet);
|
||||||
virtual void handleContainerSetSlot(shared_ptr<ContainerSetSlotPacket> packet);
|
virtual void handleContainerSetSlot(std::shared_ptr<ContainerSetSlotPacket> packet);
|
||||||
virtual void handleContainerAck(shared_ptr<ContainerAckPacket> packet);
|
virtual void handleContainerAck(std::shared_ptr<ContainerAckPacket> packet);
|
||||||
virtual void handleContainerContent(shared_ptr<ContainerSetContentPacket> packet);
|
virtual void handleContainerContent(std::shared_ptr<ContainerSetContentPacket> packet);
|
||||||
virtual void handleSignUpdate(shared_ptr<SignUpdatePacket> packet);
|
virtual void handleSignUpdate(std::shared_ptr<SignUpdatePacket> packet);
|
||||||
virtual void handleTileEntityData(shared_ptr<TileEntityDataPacket> packet);
|
virtual void handleTileEntityData(std::shared_ptr<TileEntityDataPacket> packet);
|
||||||
virtual void handleContainerSetData(shared_ptr<ContainerSetDataPacket> packet);
|
virtual void handleContainerSetData(std::shared_ptr<ContainerSetDataPacket> packet);
|
||||||
virtual void handleSetEquippedItem(shared_ptr<SetEquippedItemPacket> packet);
|
virtual void handleSetEquippedItem(std::shared_ptr<SetEquippedItemPacket> packet);
|
||||||
virtual void handleContainerClose(shared_ptr<ContainerClosePacket> packet);
|
virtual void handleContainerClose(std::shared_ptr<ContainerClosePacket> packet);
|
||||||
virtual void handleTileEvent(shared_ptr<TileEventPacket> packet);
|
virtual void handleTileEvent(std::shared_ptr<TileEventPacket> packet);
|
||||||
virtual void handleTileDestruction(shared_ptr<TileDestructionPacket> packet);
|
virtual void handleTileDestruction(std::shared_ptr<TileDestructionPacket> packet);
|
||||||
virtual bool canHandleAsyncPackets();
|
virtual bool canHandleAsyncPackets();
|
||||||
virtual void handleGameEvent(shared_ptr<GameEventPacket> gameEventPacket);
|
virtual void handleGameEvent(std::shared_ptr<GameEventPacket> gameEventPacket);
|
||||||
virtual void handleComplexItemData(shared_ptr<ComplexItemDataPacket> packet);
|
virtual void handleComplexItemData(std::shared_ptr<ComplexItemDataPacket> packet);
|
||||||
virtual void handleLevelEvent(shared_ptr<LevelEventPacket> packet);
|
virtual void handleLevelEvent(std::shared_ptr<LevelEventPacket> packet);
|
||||||
virtual void handleAwardStat(shared_ptr<AwardStatPacket> packet);
|
virtual void handleAwardStat(std::shared_ptr<AwardStatPacket> packet);
|
||||||
virtual void handleUpdateMobEffect(shared_ptr<UpdateMobEffectPacket> packet);
|
virtual void handleUpdateMobEffect(std::shared_ptr<UpdateMobEffectPacket> packet);
|
||||||
virtual void handleRemoveMobEffect(shared_ptr<RemoveMobEffectPacket> packet);
|
virtual void handleRemoveMobEffect(std::shared_ptr<RemoveMobEffectPacket> packet);
|
||||||
virtual bool isServerPacketListener();
|
virtual bool isServerPacketListener();
|
||||||
virtual void handlePlayerInfo(shared_ptr<PlayerInfoPacket> packet);
|
virtual void handlePlayerInfo(std::shared_ptr<PlayerInfoPacket> packet);
|
||||||
virtual void handleKeepAlive(shared_ptr<KeepAlivePacket> packet);
|
virtual void handleKeepAlive(std::shared_ptr<KeepAlivePacket> packet);
|
||||||
virtual void handlePlayerAbilities(shared_ptr<PlayerAbilitiesPacket> playerAbilitiesPacket);
|
virtual void handlePlayerAbilities(std::shared_ptr<PlayerAbilitiesPacket> playerAbilitiesPacket);
|
||||||
virtual void handleSoundEvent(shared_ptr<LevelSoundPacket> packet);
|
virtual void handleSoundEvent(std::shared_ptr<LevelSoundPacket> packet);
|
||||||
virtual void handleCustomPayload(shared_ptr<CustomPayloadPacket> customPayloadPacket);
|
virtual void handleCustomPayload(std::shared_ptr<CustomPayloadPacket> customPayloadPacket);
|
||||||
virtual Connection *getConnection();
|
virtual Connection *getConnection();
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
virtual void handleServerSettingsChanged(shared_ptr<ServerSettingsChangedPacket> packet);
|
virtual void handleServerSettingsChanged(std::shared_ptr<ServerSettingsChangedPacket> packet);
|
||||||
virtual void handleTexture(shared_ptr<TexturePacket> packet);
|
virtual void handleTexture(std::shared_ptr<TexturePacket> packet);
|
||||||
virtual void handleTextureAndGeometry(shared_ptr<TextureAndGeometryPacket> packet);
|
virtual void handleTextureAndGeometry(std::shared_ptr<TextureAndGeometryPacket> packet);
|
||||||
virtual void handleUpdateProgress(shared_ptr<UpdateProgressPacket> packet);
|
virtual void handleUpdateProgress(std::shared_ptr<UpdateProgressPacket> packet);
|
||||||
|
|
||||||
// 4J Added
|
// 4J Added
|
||||||
static int HostDisconnectReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
static int HostDisconnectReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||||
static int ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
static int ExitGameAndSaveReturned(void *pParam,int iPad,C4JStorage::EMessageResult result);
|
||||||
virtual void handleTextureChange(shared_ptr<TextureChangePacket> packet);
|
virtual void handleTextureChange(std::shared_ptr<TextureChangePacket> packet);
|
||||||
virtual void handleTextureAndGeometryChange(shared_ptr<TextureAndGeometryChangePacket> packet);
|
virtual void handleTextureAndGeometryChange(std::shared_ptr<TextureAndGeometryChangePacket> packet);
|
||||||
virtual void handleUpdateGameRuleProgressPacket(shared_ptr<UpdateGameRuleProgressPacket> packet);
|
virtual void handleUpdateGameRuleProgressPacket(std::shared_ptr<UpdateGameRuleProgressPacket> packet);
|
||||||
virtual void handleXZ(shared_ptr<XZPacket> packet);
|
virtual void handleXZ(std::shared_ptr<XZPacket> packet);
|
||||||
|
|
||||||
void displayPrivilegeChanges(shared_ptr<MultiplayerLocalPlayer> player, unsigned int oldPrivileges);
|
void displayPrivilegeChanges(std::shared_ptr<MultiplayerLocalPlayer> player, unsigned int oldPrivileges);
|
||||||
};
|
};
|
||||||
@@ -43,7 +43,7 @@ class ConsoleSoundEngine
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
ConsoleSoundEngine() : m_bIsPlayingStreamingCDMusic(false),m_bIsPlayingStreamingGameMusic(false), m_bIsPlayingEndMusic(false),m_bIsPlayingNetherMusic(false){};
|
ConsoleSoundEngine() : m_bIsPlayingStreamingCDMusic(false),m_bIsPlayingStreamingGameMusic(false), m_bIsPlayingEndMusic(false),m_bIsPlayingNetherMusic(false){};
|
||||||
virtual void tick(shared_ptr<Mob> *players, float a) =0;
|
virtual void tick(std::shared_ptr<Mob> *players, float a) =0;
|
||||||
virtual void destroy()=0;
|
virtual void destroy()=0;
|
||||||
virtual void play(int iSound, float x, float y, float z, float volume, float pitch) =0;
|
virtual void play(int iSound, float x, float y, float z, float volume, float pitch) =0;
|
||||||
virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) =0;
|
virtual void playStreaming(const wstring& name, float x, float y , float z, float volume, float pitch, bool bMusicDelay=true) =0;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ void SoundEngine::init(Options *pOptions)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void SoundEngine::tick(shared_ptr<Mob> *players, float a)
|
void SoundEngine::tick(std::shared_ptr<Mob> *players, float a)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
void SoundEngine::destroy() {}
|
void SoundEngine::destroy() {}
|
||||||
@@ -622,7 +622,7 @@ static float fVal=0.0f;
|
|||||||
static S32 running = AIL_ms_count();
|
static S32 running = AIL_ms_count();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void SoundEngine::tick(shared_ptr<Mob> *players, float a)
|
void SoundEngine::tick(std::shared_ptr<Mob> *players, float a)
|
||||||
{
|
{
|
||||||
#ifdef __DISABLE_MILES__
|
#ifdef __DISABLE_MILES__
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -103,7 +103,7 @@ public:
|
|||||||
virtual void updateSystemMusicPlaying(bool isPlaying);
|
virtual void updateSystemMusicPlaying(bool isPlaying);
|
||||||
virtual void updateSoundEffectVolume(float fVal);
|
virtual void updateSoundEffectVolume(float fVal);
|
||||||
virtual void init(Options *);
|
virtual void init(Options *);
|
||||||
virtual void tick(shared_ptr<Mob> *players, float a); // 4J - updated to take array of local players rather than single one
|
virtual void tick(std::shared_ptr<Mob> *players, float a); // 4J - updated to take array of local players rather than single one
|
||||||
virtual void add(const wstring& name, File *file);
|
virtual void add(const wstring& name, File *file);
|
||||||
virtual void addMusic(const wstring& name, File *file);
|
virtual void addMusic(const wstring& name, File *file);
|
||||||
virtual void addStreaming(const wstring& name, File *file);
|
virtual void addStreaming(const wstring& name, File *file);
|
||||||
|
|||||||
@@ -365,7 +365,7 @@ void CMinecraftApp::HandleButtonPresses(int iPad)
|
|||||||
// ProfileManager.WriteToProfile(iPad,true);
|
// ProfileManager.WriteToProfile(iPad,true);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::LoadInventoryMenu(int iPad,shared_ptr<LocalPlayer> player,bool bNavigateBack)
|
bool CMinecraftApp::LoadInventoryMenu(int iPad,std::shared_ptr<LocalPlayer> player,bool bNavigateBack)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -388,7 +388,7 @@ bool CMinecraftApp::LoadInventoryMenu(int iPad,shared_ptr<LocalPlayer> player,bo
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::LoadCreativeMenu(int iPad,shared_ptr<LocalPlayer> player,bool bNavigateBack)
|
bool CMinecraftApp::LoadCreativeMenu(int iPad,std::shared_ptr<LocalPlayer> player,bool bNavigateBack)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -411,7 +411,7 @@ bool CMinecraftApp::LoadCreativeMenu(int iPad,shared_ptr<LocalPlayer> player,boo
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::LoadCrafting2x2Menu(int iPad,shared_ptr<LocalPlayer> player)
|
bool CMinecraftApp::LoadCrafting2x2Menu(int iPad,std::shared_ptr<LocalPlayer> player)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -437,7 +437,7 @@ bool CMinecraftApp::LoadCrafting2x2Menu(int iPad,shared_ptr<LocalPlayer> player)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,shared_ptr<LocalPlayer> player, int x, int y, int z)
|
bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,std::shared_ptr<LocalPlayer> player, int x, int y, int z)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -463,7 +463,7 @@ bool CMinecraftApp::LoadCrafting3x3Menu(int iPad,shared_ptr<LocalPlayer> player,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::LoadEnchantingMenu(int iPad,shared_ptr<Inventory> inventory, int x, int y, int z, Level *level)
|
bool CMinecraftApp::LoadEnchantingMenu(int iPad,std::shared_ptr<Inventory> inventory, int x, int y, int z, Level *level)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -489,7 +489,7 @@ bool CMinecraftApp::LoadEnchantingMenu(int iPad,shared_ptr<Inventory> inventory,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::LoadFurnaceMenu(int iPad,shared_ptr<Inventory> inventory, shared_ptr<FurnaceTileEntity> furnace)
|
bool CMinecraftApp::LoadFurnaceMenu(int iPad,std::shared_ptr<Inventory> inventory, std::shared_ptr<FurnaceTileEntity> furnace)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -514,7 +514,7 @@ bool CMinecraftApp::LoadFurnaceMenu(int iPad,shared_ptr<Inventory> inventory, sh
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::LoadBrewingStandMenu(int iPad,shared_ptr<Inventory> inventory, shared_ptr<BrewingStandTileEntity> brewingStand)
|
bool CMinecraftApp::LoadBrewingStandMenu(int iPad,std::shared_ptr<Inventory> inventory, std::shared_ptr<BrewingStandTileEntity> brewingStand)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -540,7 +540,7 @@ bool CMinecraftApp::LoadBrewingStandMenu(int iPad,shared_ptr<Inventory> inventor
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CMinecraftApp::LoadContainerMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<Container> container)
|
bool CMinecraftApp::LoadContainerMenu(int iPad,std::shared_ptr<Container> inventory, std::shared_ptr<Container> container)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -574,7 +574,7 @@ bool CMinecraftApp::LoadContainerMenu(int iPad,shared_ptr<Container> inventory,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::LoadTrapMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<DispenserTileEntity> trap)
|
bool CMinecraftApp::LoadTrapMenu(int iPad,std::shared_ptr<Container> inventory, std::shared_ptr<DispenserTileEntity> trap)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -599,7 +599,7 @@ bool CMinecraftApp::LoadTrapMenu(int iPad,shared_ptr<Container> inventory, share
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::LoadSignEntryMenu(int iPad,shared_ptr<SignTileEntity> sign)
|
bool CMinecraftApp::LoadSignEntryMenu(int iPad,std::shared_ptr<SignTileEntity> sign)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -615,7 +615,7 @@ bool CMinecraftApp::LoadSignEntryMenu(int iPad,shared_ptr<SignTileEntity> sign)
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::LoadRepairingMenu(int iPad,shared_ptr<Inventory> inventory, Level *level, int x, int y, int z)
|
bool CMinecraftApp::LoadRepairingMenu(int iPad,std::shared_ptr<Inventory> inventory, Level *level, int x, int y, int z)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -634,7 +634,7 @@ bool CMinecraftApp::LoadRepairingMenu(int iPad,shared_ptr<Inventory> inventory,
|
|||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CMinecraftApp::LoadTradingMenu(int iPad, shared_ptr<Inventory> inventory, shared_ptr<Merchant> trader, Level *level)
|
bool CMinecraftApp::LoadTradingMenu(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<Merchant> trader, Level *level)
|
||||||
{
|
{
|
||||||
bool success = true;
|
bool success = true;
|
||||||
|
|
||||||
@@ -1272,7 +1272,7 @@ void CMinecraftApp::ActionGameSettings(int iPad,eGameSetting eVal)
|
|||||||
PlayerList *players = MinecraftServer::getInstance()->getPlayerList();
|
PlayerList *players = MinecraftServer::getInstance()->getPlayerList();
|
||||||
for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3)
|
for(AUTO_VAR(it3, players->players.begin()); it3 != players->players.end(); ++it3)
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> decorationPlayer = *it3;
|
std::shared_ptr<ServerPlayer> decorationPlayer = *it3;
|
||||||
decorationPlayer->setShowOnMaps((app.GetGameHostOption(eGameHostOption_Gamertags)!=0)?true:false);
|
decorationPlayer->setShowOnMaps((app.GetGameHostOption(eGameHostOption_Gamertags)!=0)?true:false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2240,7 +2240,7 @@ unsigned int CMinecraftApp::GetGameSettingsDebugMask(int iPad,bool bOverridePlay
|
|||||||
}
|
}
|
||||||
if(iPad < 0) iPad = 0;
|
if(iPad < 0) iPad = 0;
|
||||||
|
|
||||||
shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad];
|
std::shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad];
|
||||||
|
|
||||||
if(bOverridePlayer || player==NULL)
|
if(bOverridePlayer || player==NULL)
|
||||||
{
|
{
|
||||||
@@ -2260,7 +2260,7 @@ void CMinecraftApp::SetGameSettingsDebugMask(int iPad, unsigned int uiVal)
|
|||||||
GameSettingsA[iPad]->uiDebugBitmask=uiVal;
|
GameSettingsA[iPad]->uiDebugBitmask=uiVal;
|
||||||
|
|
||||||
// update the value so the network server can use it
|
// update the value so the network server can use it
|
||||||
shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad];
|
std::shared_ptr<Player> player = Minecraft::GetInstance()->localplayers[iPad];
|
||||||
|
|
||||||
if(player)
|
if(player)
|
||||||
{
|
{
|
||||||
@@ -2427,7 +2427,7 @@ void CMinecraftApp::HandleXuiActions(void)
|
|||||||
eTMSAction eTMS;
|
eTMSAction eTMS;
|
||||||
LPVOID param;
|
LPVOID param;
|
||||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
shared_ptr<MultiplayerLocalPlayer> player;
|
std::shared_ptr<MultiplayerLocalPlayer> player;
|
||||||
|
|
||||||
// are there any global actions to deal with?
|
// are there any global actions to deal with?
|
||||||
eAction = app.GetGlobalXuiAction();
|
eAction = app.GetGlobalXuiAction();
|
||||||
|
|||||||
@@ -125,18 +125,18 @@ public:
|
|||||||
bool GetGameStarted() {return m_bGameStarted;}
|
bool GetGameStarted() {return m_bGameStarted;}
|
||||||
void SetGameStarted(bool bVal) { if(bVal) DebugPrintf("SetGameStarted - true\n"); else DebugPrintf("SetGameStarted - false\n"); m_bGameStarted = bVal; m_bIsAppPaused = !bVal;}
|
void SetGameStarted(bool bVal) { if(bVal) DebugPrintf("SetGameStarted - true\n"); else DebugPrintf("SetGameStarted - false\n"); m_bGameStarted = bVal; m_bIsAppPaused = !bVal;}
|
||||||
int GetLocalPlayerCount(void);
|
int GetLocalPlayerCount(void);
|
||||||
bool LoadInventoryMenu(int iPad,shared_ptr<LocalPlayer> player, bool bNavigateBack=false);
|
bool LoadInventoryMenu(int iPad,std::shared_ptr<LocalPlayer> player, bool bNavigateBack=false);
|
||||||
bool LoadCreativeMenu(int iPad,shared_ptr<LocalPlayer> player,bool bNavigateBack=false);
|
bool LoadCreativeMenu(int iPad,std::shared_ptr<LocalPlayer> player,bool bNavigateBack=false);
|
||||||
bool LoadEnchantingMenu(int iPad,shared_ptr<Inventory> inventory, int x, int y, int z, Level *level);
|
bool LoadEnchantingMenu(int iPad,std::shared_ptr<Inventory> inventory, int x, int y, int z, Level *level);
|
||||||
bool LoadFurnaceMenu(int iPad,shared_ptr<Inventory> inventory, shared_ptr<FurnaceTileEntity> furnace);
|
bool LoadFurnaceMenu(int iPad,std::shared_ptr<Inventory> inventory, std::shared_ptr<FurnaceTileEntity> furnace);
|
||||||
bool LoadBrewingStandMenu(int iPad,shared_ptr<Inventory> inventory, shared_ptr<BrewingStandTileEntity> brewingStand);
|
bool LoadBrewingStandMenu(int iPad,std::shared_ptr<Inventory> inventory, std::shared_ptr<BrewingStandTileEntity> brewingStand);
|
||||||
bool LoadContainerMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<Container> container);
|
bool LoadContainerMenu(int iPad,std::shared_ptr<Container> inventory, std::shared_ptr<Container> container);
|
||||||
bool LoadTrapMenu(int iPad,shared_ptr<Container> inventory, shared_ptr<DispenserTileEntity> trap);
|
bool LoadTrapMenu(int iPad,std::shared_ptr<Container> inventory, std::shared_ptr<DispenserTileEntity> trap);
|
||||||
bool LoadCrafting2x2Menu(int iPad,shared_ptr<LocalPlayer> player);
|
bool LoadCrafting2x2Menu(int iPad,std::shared_ptr<LocalPlayer> player);
|
||||||
bool LoadCrafting3x3Menu(int iPad,shared_ptr<LocalPlayer> player, int x, int y, int z);
|
bool LoadCrafting3x3Menu(int iPad,std::shared_ptr<LocalPlayer> player, int x, int y, int z);
|
||||||
bool LoadSignEntryMenu(int iPad,shared_ptr<SignTileEntity> sign);
|
bool LoadSignEntryMenu(int iPad,std::shared_ptr<SignTileEntity> sign);
|
||||||
bool LoadRepairingMenu(int iPad,shared_ptr<Inventory> inventory, Level *level, int x, int y, int z);
|
bool LoadRepairingMenu(int iPad,std::shared_ptr<Inventory> inventory, Level *level, int x, int y, int z);
|
||||||
bool LoadTradingMenu(int iPad, shared_ptr<Inventory> inventory, shared_ptr<Merchant> trader, Level *level);
|
bool LoadTradingMenu(int iPad, std::shared_ptr<Inventory> inventory, std::shared_ptr<Merchant> trader, Level *level);
|
||||||
|
|
||||||
bool GetTutorialMode() { return m_bTutorialMode;}
|
bool GetTutorialMode() { return m_bTutorialMode;}
|
||||||
void SetTutorialMode(bool bSet) {m_bTutorialMode=bSet;}
|
void SetTutorialMode(bool bSet) {m_bTutorialMode=bSet;}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void AddEnchantmentRuleDefinition::addAttribute(const wstring &attributeName, co
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddEnchantmentRuleDefinition::enchantItem(shared_ptr<ItemInstance> item)
|
bool AddEnchantmentRuleDefinition::enchantItem(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
bool enchanted = false;
|
bool enchanted = false;
|
||||||
if (item != NULL)
|
if (item != NULL)
|
||||||
|
|||||||
@@ -19,5 +19,5 @@ public:
|
|||||||
|
|
||||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||||
|
|
||||||
bool enchantItem(shared_ptr<ItemInstance> item);
|
bool enchantItem(std::shared_ptr<ItemInstance> item);
|
||||||
};
|
};
|
||||||
@@ -94,13 +94,13 @@ void AddItemRuleDefinition::addAttribute(const wstring &attributeName, const wst
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AddItemRuleDefinition::addItemToContainer(shared_ptr<Container> container, int slotId)
|
bool AddItemRuleDefinition::addItemToContainer(std::shared_ptr<Container> container, int slotId)
|
||||||
{
|
{
|
||||||
bool added = false;
|
bool added = false;
|
||||||
if(Item::items[m_itemId] != NULL)
|
if(Item::items[m_itemId] != NULL)
|
||||||
{
|
{
|
||||||
int quantity = min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
int quantity = min(m_quantity, Item::items[m_itemId]->getMaxStackSize());
|
||||||
shared_ptr<ItemInstance> newItem = shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
|
std::shared_ptr<ItemInstance> newItem = std::shared_ptr<ItemInstance>(new ItemInstance(m_itemId,quantity,m_auxValue) );
|
||||||
newItem->set4JData(m_dataTag);
|
newItem->set4JData(m_dataTag);
|
||||||
|
|
||||||
for(AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); ++it)
|
for(AUTO_VAR(it, m_enchantments.begin()); it != m_enchantments.end(); ++it)
|
||||||
|
|||||||
@@ -26,5 +26,5 @@ public:
|
|||||||
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
virtual GameRuleDefinition *addChild(ConsoleGameRules::EGameRuleType ruleType);
|
||||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||||
|
|
||||||
bool addItemToContainer(shared_ptr<Container> container, int slotId);
|
bool addItemToContainer(std::shared_ptr<Container> container, int slotId);
|
||||||
};
|
};
|
||||||
@@ -74,7 +74,7 @@ void CollectItemRuleDefinition::populateGameRule(GameRulesInstance::EGameRulesIn
|
|||||||
GameRuleDefinition::populateGameRule(type, rule);
|
GameRuleDefinition::populateGameRule(type, rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
bool statusChanged = false;
|
bool statusChanged = false;
|
||||||
if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
|
if(item != NULL && item->id == m_itemId && item->getAuxValue() == m_auxValue && item->get4JData() == m_4JDataValue)
|
||||||
@@ -94,7 +94,7 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIns
|
|||||||
|
|
||||||
if(rule->getConnection() != NULL)
|
if(rule->getConnection() != NULL)
|
||||||
{
|
{
|
||||||
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0)));
|
rule->getConnection()->send( std::shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId, m_itemId, m_auxValue, this->m_4JDataValue,NULL,0)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -102,7 +102,7 @@ bool CollectItemRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIns
|
|||||||
return statusChanged;
|
return statusChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring CollectItemRuleDefinition::generateXml(shared_ptr<ItemInstance> item)
|
wstring CollectItemRuleDefinition::generateXml(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
|
// 4J Stu - This should be kept in sync with the GameRulesDefinition.xsd
|
||||||
wstring xml = L"";
|
wstring xml = L"";
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ public:
|
|||||||
|
|
||||||
void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
|
void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
|
||||||
|
|
||||||
bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item);
|
bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item);
|
||||||
|
|
||||||
static wstring generateXml(shared_ptr<ItemInstance> item);
|
static wstring generateXml(std::shared_ptr<ItemInstance> item);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
//static wstring generateXml(CollectItemRuleDefinition *ruleDef);
|
//static wstring generateXml(CollectItemRuleDefinition *ruleDef);
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ bool CompleteAllRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, int
|
|||||||
return statusChanged;
|
return statusChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompleteAllRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
bool CompleteAllRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
bool statusChanged = CompoundGameRuleDefinition::onCollectItem(rule,item);
|
bool statusChanged = CompoundGameRuleDefinition::onCollectItem(rule,item);
|
||||||
if(statusChanged) updateStatus(rule);
|
if(statusChanged) updateStatus(rule);
|
||||||
@@ -51,7 +51,7 @@ void CompleteAllRuleDefinition::updateStatus(GameRule *rule)
|
|||||||
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
auxValue = m_lastRuleStatusChanged->getAuxValue();
|
||||||
m_lastRuleStatusChanged = NULL;
|
m_lastRuleStatusChanged = NULL;
|
||||||
}
|
}
|
||||||
rule->getConnection()->send( shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData))));
|
rule->getConnection()->send( std::shared_ptr<UpdateGameRuleProgressPacket>( new UpdateGameRuleProgressPacket(getActionType(), this->m_descriptionId,icon, auxValue, 0,&data,sizeof(PacketData))));
|
||||||
}
|
}
|
||||||
app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal);
|
app.DebugPrintf("Updated CompleteAllRule - Completed %d of %d\n", progress, goal);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
virtual void getChildren(vector<GameRuleDefinition *> *children);
|
virtual void getChildren(vector<GameRuleDefinition *> *children);
|
||||||
|
|
||||||
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);
|
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);
|
||||||
virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item);
|
virtual bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item);
|
||||||
|
|
||||||
static wstring generateDescriptionString(const wstring &description, void *data, int dataLength);
|
static wstring generateDescriptionString(const wstring &description, void *data, int dataLength);
|
||||||
|
|
||||||
|
|||||||
@@ -91,7 +91,7 @@ bool CompoundGameRuleDefinition::onUseTile(GameRule *rule, int tileId, int x, in
|
|||||||
return statusChanged;
|
return statusChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item)
|
bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
bool statusChanged = false;
|
bool statusChanged = false;
|
||||||
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
for(AUTO_VAR(it, rule->m_parameters.begin()); it != rule->m_parameters.end(); ++it)
|
||||||
@@ -109,7 +109,7 @@ bool CompoundGameRuleDefinition::onCollectItem(GameRule *rule, shared_ptr<ItemIn
|
|||||||
return statusChanged;
|
return statusChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompoundGameRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
void CompoundGameRuleDefinition::postProcessPlayer(std::shared_ptr<Player> player)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
for(AUTO_VAR(it, m_children.begin()); it != m_children.end(); ++it)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -18,6 +18,6 @@ public:
|
|||||||
virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
|
virtual void populateGameRule(GameRulesInstance::EGameRulesInstanceType type, GameRule *rule);
|
||||||
|
|
||||||
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);
|
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z);
|
||||||
virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item);
|
virtual bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item);
|
||||||
virtual void postProcessPlayer(shared_ptr<Player> player);
|
virtual void postProcessPlayer(std::shared_ptr<Player> player);
|
||||||
};
|
};
|
||||||
@@ -116,7 +116,7 @@ void ConsoleSchematicFile::load(DataInputStream *dis)
|
|||||||
for (int i = 0; i < tileEntityTags->size(); i++)
|
for (int i = 0; i < tileEntityTags->size(); i++)
|
||||||
{
|
{
|
||||||
CompoundTag *teTag = tileEntityTags->get(i);
|
CompoundTag *teTag = tileEntityTags->get(i);
|
||||||
shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
|
std::shared_ptr<TileEntity> te = TileEntity::loadStatic(teTag);
|
||||||
|
|
||||||
if(te == NULL)
|
if(te == NULL)
|
||||||
{
|
{
|
||||||
@@ -433,7 +433,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||||||
{
|
{
|
||||||
for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it)
|
for(AUTO_VAR(it, m_tileEntities.begin()); it != m_tileEntities.end();++it)
|
||||||
{
|
{
|
||||||
shared_ptr<TileEntity> te = *it;
|
std::shared_ptr<TileEntity> te = *it;
|
||||||
|
|
||||||
double targetX = te->x;
|
double targetX = te->x;
|
||||||
double targetY = te->y + destinationBox->y0;
|
double targetY = te->y + destinationBox->y0;
|
||||||
@@ -444,7 +444,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||||||
Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ);
|
Vec3 *pos = Vec3::newTemp(targetX,targetY,targetZ);
|
||||||
if( chunkBox->containsIncludingLowerBound(pos) )
|
if( chunkBox->containsIncludingLowerBound(pos) )
|
||||||
{
|
{
|
||||||
shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
|
std::shared_ptr<TileEntity> teCopy = chunk->getTileEntity( (int)targetX & 15, (int)targetY & 15, (int)targetZ & 15 );
|
||||||
|
|
||||||
if ( teCopy != NULL )
|
if ( teCopy != NULL )
|
||||||
{
|
{
|
||||||
@@ -495,11 +495,11 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||||||
}
|
}
|
||||||
|
|
||||||
CompoundTag *eTag = it->second;
|
CompoundTag *eTag = it->second;
|
||||||
shared_ptr<Entity> e = EntityIO::loadStatic(eTag, NULL);
|
std::shared_ptr<Entity> e = EntityIO::loadStatic(eTag, NULL);
|
||||||
|
|
||||||
if( e->GetType() == eTYPE_PAINTING )
|
if( e->GetType() == eTYPE_PAINTING )
|
||||||
{
|
{
|
||||||
shared_ptr<Painting> painting = dynamic_pointer_cast<Painting>(e);
|
std::shared_ptr<Painting> painting = dynamic_pointer_cast<Painting>(e);
|
||||||
|
|
||||||
double tileX = painting->xTile;
|
double tileX = painting->xTile;
|
||||||
double tileZ = painting->zTile;
|
double tileZ = painting->zTile;
|
||||||
@@ -512,7 +512,7 @@ void ConsoleSchematicFile::applyTileEntities(LevelChunk *chunk, AABB *chunkBox,
|
|||||||
}
|
}
|
||||||
else if( e->GetType() == eTYPE_ITEM_FRAME )
|
else if( e->GetType() == eTYPE_ITEM_FRAME )
|
||||||
{
|
{
|
||||||
shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e);
|
std::shared_ptr<ItemFrame> frame = dynamic_pointer_cast<ItemFrame>(e);
|
||||||
|
|
||||||
double tileX = frame->xTile;
|
double tileX = frame->xTile;
|
||||||
double tileZ = frame->zTile;
|
double tileZ = frame->zTile;
|
||||||
@@ -678,12 +678,12 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||||||
{
|
{
|
||||||
for (int zc = zc0; zc <= zc1; zc++)
|
for (int zc = zc0; zc <= zc1; zc++)
|
||||||
{
|
{
|
||||||
vector<shared_ptr<TileEntity> > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize);
|
vector<std::shared_ptr<TileEntity> > *tileEntities = getTileEntitiesInRegion(level->getChunk(xc, zc), xStart, yStart, zStart, xStart + xSize, yStart + ySize, zStart + zSize);
|
||||||
for(AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); ++it)
|
for(AUTO_VAR(it, tileEntities->begin()); it != tileEntities->end(); ++it)
|
||||||
{
|
{
|
||||||
shared_ptr<TileEntity> te = *it;
|
std::shared_ptr<TileEntity> te = *it;
|
||||||
CompoundTag *teTag = new CompoundTag();
|
CompoundTag *teTag = new CompoundTag();
|
||||||
shared_ptr<TileEntity> teCopy = te->clone();
|
std::shared_ptr<TileEntity> teCopy = te->clone();
|
||||||
|
|
||||||
// Adjust the tileEntity position to schematic coords from world co-ords
|
// Adjust the tileEntity position to schematic coords from world co-ords
|
||||||
teCopy->x -= xStart;
|
teCopy->x -= xStart;
|
||||||
@@ -698,12 +698,12 @@ void ConsoleSchematicFile::generateSchematicFile(DataOutputStream *dos, Level *l
|
|||||||
tag.put(L"TileEntities", tileEntitiesTag);
|
tag.put(L"TileEntities", tileEntitiesTag);
|
||||||
|
|
||||||
AABB *bb = AABB::newTemp(xStart,yStart,zStart,xEnd,yEnd,zEnd);
|
AABB *bb = AABB::newTemp(xStart,yStart,zStart,xEnd,yEnd,zEnd);
|
||||||
vector<shared_ptr<Entity> > *entities = level->getEntities(nullptr, bb);
|
vector<std::shared_ptr<Entity> > *entities = level->getEntities(nullptr, bb);
|
||||||
ListTag<CompoundTag> *entitiesTag = new ListTag<CompoundTag>(L"entities");
|
ListTag<CompoundTag> *entitiesTag = new ListTag<CompoundTag>(L"entities");
|
||||||
|
|
||||||
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
|
for(AUTO_VAR(it, entities->begin()); it != entities->end(); ++it)
|
||||||
{
|
{
|
||||||
shared_ptr<Entity> e = *it;
|
std::shared_ptr<Entity> e = *it;
|
||||||
|
|
||||||
bool mobCanBeSaved = false;
|
bool mobCanBeSaved = false;
|
||||||
if(bSaveMobs)
|
if(bSaveMobs)
|
||||||
@@ -1005,12 +1005,12 @@ void ConsoleSchematicFile::setBlocksAndData(LevelChunk *chunk, byteArray blockDa
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
vector<shared_ptr<TileEntity> > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1)
|
vector<std::shared_ptr<TileEntity> > *ConsoleSchematicFile::getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1)
|
||||||
{
|
{
|
||||||
vector<shared_ptr<TileEntity> > *result = new vector<shared_ptr<TileEntity> >;
|
vector<std::shared_ptr<TileEntity> > *result = new vector<std::shared_ptr<TileEntity> >;
|
||||||
for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it)
|
for (AUTO_VAR(it, chunk->tileEntities.begin()); it != chunk->tileEntities.end(); ++it)
|
||||||
{
|
{
|
||||||
shared_ptr<TileEntity> te = it->second;
|
std::shared_ptr<TileEntity> te = it->second;
|
||||||
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
|
if (te->x >= x0 && te->y >= y0 && te->z >= z0 && te->x < x1 && te->y < y1 && te->z < z1)
|
||||||
{
|
{
|
||||||
result->push_back(te);
|
result->push_back(te);
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ public:
|
|||||||
} XboxSchematicInitParam;
|
} XboxSchematicInitParam;
|
||||||
private:
|
private:
|
||||||
int m_xSize, m_ySize, m_zSize;
|
int m_xSize, m_ySize, m_zSize;
|
||||||
vector<shared_ptr<TileEntity> > m_tileEntities;
|
vector<std::shared_ptr<TileEntity> > m_tileEntities;
|
||||||
vector< pair<Vec3 *, CompoundTag *> > m_entities;
|
vector< pair<Vec3 *, CompoundTag *> > m_entities;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -83,7 +83,7 @@ private:
|
|||||||
void load_tags(DataInputStream *dis);
|
void load_tags(DataInputStream *dis);
|
||||||
|
|
||||||
static void getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP);
|
static void getBlocksAndData(LevelChunk *chunk, byteArray *data, int x0, int y0, int z0, int x1, int y1, int z1, int &blocksP, int &dataP, int &blockLightP, int &skyLightP);
|
||||||
static vector<shared_ptr<TileEntity> > *getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1);
|
static vector<std::shared_ptr<TileEntity> > *getTileEntitiesInRegion(LevelChunk *chunk, int x0, int y0, int z0, int x1, int y1, int z1);
|
||||||
|
|
||||||
void chunkCoordToSchematicCoord(AABB *destinationBox, int chunkX, int chunkZ, ESchematicRotation rot, int &schematicX, int &schematicZ);
|
void chunkCoordToSchematicCoord(AABB *destinationBox, int chunkX, int chunkZ, ESchematicRotation rot, int &schematicX, int &schematicZ);
|
||||||
void schematicCoordToChunkCoord(AABB *destinationBox, double schematicX, double schematicZ, ESchematicRotation rot, double &chunkX, double &chunkZ);
|
void schematicCoordToChunkCoord(AABB *destinationBox, double schematicX, double schematicZ, ESchematicRotation rot, double &chunkX, double &chunkZ);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ GameRuleDefinition *GameRule::getGameRuleDefinition()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void GameRule::onUseTile(int tileId, int x, int y, int z) { m_definition->onUseTile(this,tileId,x,y,z); }
|
void GameRule::onUseTile(int tileId, int x, int y, int z) { m_definition->onUseTile(this,tileId,x,y,z); }
|
||||||
void GameRule::onCollectItem(shared_ptr<ItemInstance> item) { m_definition->onCollectItem(this,item); }
|
void GameRule::onCollectItem(std::shared_ptr<ItemInstance> item) { m_definition->onCollectItem(this,item); }
|
||||||
|
|
||||||
void GameRule::write(DataOutputStream *dos)
|
void GameRule::write(DataOutputStream *dos)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public:
|
|||||||
|
|
||||||
// All the hooks go here
|
// All the hooks go here
|
||||||
void onUseTile(int tileId, int x, int y, int z);
|
void onUseTile(int tileId, int x, int y, int z);
|
||||||
void onCollectItem(shared_ptr<ItemInstance> item);
|
void onCollectItem(std::shared_ptr<ItemInstance> item);
|
||||||
|
|
||||||
// 4J-JEV: For saving.
|
// 4J-JEV: For saving.
|
||||||
//CompoundTag *toTags(unordered_map<GameRuleDefinition *, int> *map);
|
//CompoundTag *toTags(unordered_map<GameRuleDefinition *, int> *map);
|
||||||
|
|||||||
@@ -53,8 +53,8 @@ public:
|
|||||||
|
|
||||||
// Here we should have functions for all the hooks, with a GameRule* as the first parameter
|
// Here we should have functions for all the hooks, with a GameRule* as the first parameter
|
||||||
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z) { return false; }
|
virtual bool onUseTile(GameRule *rule, int tileId, int x, int y, int z) { return false; }
|
||||||
virtual bool onCollectItem(GameRule *rule, shared_ptr<ItemInstance> item) { return false; }
|
virtual bool onCollectItem(GameRule *rule, std::shared_ptr<ItemInstance> item) { return false; }
|
||||||
virtual void postProcessPlayer(shared_ptr<Player> player) { }
|
virtual void postProcessPlayer(std::shared_ptr<Player> player) { }
|
||||||
|
|
||||||
vector<GameRuleDefinition *> *enumerate();
|
vector<GameRuleDefinition *> *enumerate();
|
||||||
unordered_map<GameRuleDefinition *, int> *enumerateMap();
|
unordered_map<GameRuleDefinition *, int> *enumerateMap();
|
||||||
|
|||||||
@@ -130,7 +130,7 @@ void UpdatePlayerRuleDefinition::addAttribute(const wstring &attributeName, cons
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UpdatePlayerRuleDefinition::postProcessPlayer(shared_ptr<Player> player)
|
void UpdatePlayerRuleDefinition::postProcessPlayer(std::shared_ptr<Player> player)
|
||||||
{
|
{
|
||||||
if(m_bUpdateHealth)
|
if(m_bUpdateHealth)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -29,5 +29,5 @@ public:
|
|||||||
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
|
virtual void writeAttributes(DataOutputStream *dos, UINT numAttributes);
|
||||||
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
virtual void addAttribute(const wstring &attributeName, const wstring &attributeValue);
|
||||||
|
|
||||||
virtual void postProcessPlayer(shared_ptr<Player> player);
|
virtual void postProcessPlayer(std::shared_ptr<Player> player);
|
||||||
};
|
};
|
||||||
@@ -78,7 +78,7 @@ bool XboxStructureActionPlaceContainer::placeContainerInLevel(StructurePiece *st
|
|||||||
}
|
}
|
||||||
|
|
||||||
level->setTile( worldX, worldY, worldZ, m_tile );
|
level->setTile( worldX, worldY, worldZ, m_tile );
|
||||||
shared_ptr<Container> container = dynamic_pointer_cast<Container>(level->getTileEntity( worldX, worldY, worldZ ));
|
std::shared_ptr<Container> container = dynamic_pointer_cast<Container>(level->getTileEntity( worldX, worldY, worldZ ));
|
||||||
|
|
||||||
app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ);
|
app.DebugPrintf("XboxStructureActionPlaceContainer - placing a container at (%d,%d,%d)\n", worldX, worldY, worldZ);
|
||||||
if ( container != NULL )
|
if ( container != NULL )
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ bool XboxStructureActionPlaceSpawner::placeSpawnerInLevel(StructurePiece *struct
|
|||||||
}
|
}
|
||||||
|
|
||||||
level->setTile( worldX, worldY, worldZ, m_tile );
|
level->setTile( worldX, worldY, worldZ, m_tile );
|
||||||
shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>(level->getTileEntity( worldX, worldY, worldZ ));
|
std::shared_ptr<MobSpawnerTileEntity> entity = dynamic_pointer_cast<MobSpawnerTileEntity>(level->getTileEntity( worldX, worldY, worldZ ));
|
||||||
|
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ);
|
wprintf(L"XboxStructureActionPlaceSpawner - placing a %ls spawner at (%d,%d,%d)\n", m_entityId.c_str(), worldX, worldY, worldZ);
|
||||||
|
|||||||
@@ -316,7 +316,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(minecraft->user->name) ) );
|
connection->send( std::shared_ptr<PreLoginPacket>( new PreLoginPacket(minecraft->user->name) ) );
|
||||||
|
|
||||||
// Tick connection until we're ready to go. The stages involved in this are:
|
// Tick connection until we're ready to go. The stages involved in this are:
|
||||||
// (1) Creating the ClientConnection sends a prelogin packet to the server
|
// (1) Creating the ClientConnection sends a prelogin packet to the server
|
||||||
@@ -403,7 +403,7 @@ bool CGameNetworkManager::StartNetworkGame(Minecraft *minecraft, LPVOID lpParame
|
|||||||
// Open the socket on the server end to accept incoming data
|
// Open the socket on the server end to accept incoming data
|
||||||
Socket::addIncomingSocket(socket);
|
Socket::addIncomingSocket(socket);
|
||||||
|
|
||||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) );
|
connection->send( std::shared_ptr<PreLoginPacket>( new PreLoginPacket(convStringToWstring( ProfileManager.GetGamertag(idx) )) ) );
|
||||||
|
|
||||||
createdConnections.push_back( connection );
|
createdConnections.push_back( connection );
|
||||||
|
|
||||||
@@ -1134,7 +1134,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||||||
PlayerList *players = pServer->getPlayers();
|
PlayerList *players = pServer->getPlayers();
|
||||||
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
|
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> servPlayer = *it;
|
std::shared_ptr<ServerPlayer> servPlayer = *it;
|
||||||
if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() )
|
if( servPlayer->connection->isLocal() && !servPlayer->connection->isGuest() )
|
||||||
{
|
{
|
||||||
servPlayer->connection->connection->getSocket()->setPlayer(NULL);
|
servPlayer->connection->connection->getSocket()->setPlayer(NULL);
|
||||||
@@ -1202,7 +1202,7 @@ int CGameNetworkManager::ChangeSessionTypeThreadProc( void* lpParam )
|
|||||||
PlayerList *players = pServer->getPlayers();
|
PlayerList *players = pServer->getPlayers();
|
||||||
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
|
for(AUTO_VAR(it, players->players.begin()); it < players->players.end(); ++it)
|
||||||
{
|
{
|
||||||
shared_ptr<ServerPlayer> servPlayer = *it;
|
std::shared_ptr<ServerPlayer> servPlayer = *it;
|
||||||
if( servPlayer->getXuid() == localPlayerXuid )
|
if( servPlayer->getXuid() == localPlayerXuid )
|
||||||
{
|
{
|
||||||
servPlayer->connection->connection->getSocket()->setPlayer( g_NetworkManager.GetLocalPlayerByUserIndex(index) );
|
servPlayer->connection->connection->getSocket()->setPlayer( g_NetworkManager.GetLocalPlayerByUserIndex(index) );
|
||||||
@@ -1391,7 +1391,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
|
|||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
Socket *socket = NULL;
|
Socket *socket = NULL;
|
||||||
shared_ptr<MultiplayerLocalPlayer> mpPlayer = pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()];
|
std::shared_ptr<MultiplayerLocalPlayer> mpPlayer = pMinecraft->localplayers[pNetworkPlayer->GetUserIndex()];
|
||||||
if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL)
|
if( localPlayer && mpPlayer != NULL && mpPlayer->connection != NULL)
|
||||||
{
|
{
|
||||||
// If we already have a MultiplayerLocalPlayer here then we are doing a session type change
|
// If we already have a MultiplayerLocalPlayer here then we are doing a session type change
|
||||||
@@ -1428,7 +1428,7 @@ void CGameNetworkManager::CreateSocket( INetworkPlayer *pNetworkPlayer, bool loc
|
|||||||
|
|
||||||
if( connection->createdOk )
|
if( connection->createdOk )
|
||||||
{
|
{
|
||||||
connection->send( shared_ptr<PreLoginPacket>( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) );
|
connection->send( std::shared_ptr<PreLoginPacket>( new PreLoginPacket( pNetworkPlayer->GetOnlineName() ) ) );
|
||||||
pMinecraft->addPendingLocalConnection(idx, connection);
|
pMinecraft->addPendingLocalConnection(idx, connection);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -60,10 +60,10 @@ void ChangeStateConstraint::tick(int iPad)
|
|||||||
{
|
{
|
||||||
// Send update settings packet to server
|
// Send update settings packet to server
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
std::shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
player->connection->send( std::shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -101,10 +101,10 @@ void ChangeStateConstraint::tick(int iPad)
|
|||||||
{
|
{
|
||||||
// Send update settings packet to server
|
// Send update settings packet to server
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
std::shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
player->connection->send( std::shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -125,10 +125,10 @@ void ChangeStateConstraint::tick(int iPad)
|
|||||||
{
|
{
|
||||||
// Send update settings packet to server
|
// Send update settings packet to server
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
std::shared_ptr<MultiplayerLocalPlayer> player = minecraft->localplayers[iPad];
|
||||||
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
if(player != NULL && player->connection && player->connection->getNetworkPlayer() != NULL)
|
||||||
{
|
{
|
||||||
player->connection->send( shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
player->connection->send( std::shared_ptr<PlayerInfoPacket>( new PlayerInfoPacket( player->connection->getNetworkPlayer()->GetSmallId(), -1, playerPrivs) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ bool CompleteUsingItemTask::isCompleted()
|
|||||||
return bIsCompleted;
|
return bIsCompleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CompleteUsingItemTask::completeUsingItem(shared_ptr<ItemInstance> item)
|
void CompleteUsingItemTask::completeUsingItem(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
if(!hasBeenActivated() && !isPreCompletionEnabled()) return;
|
if(!hasBeenActivated() && !isPreCompletionEnabled()) return;
|
||||||
for(int i=0;i<m_iValidItemsCount;i++)
|
for(int i=0;i<m_iValidItemsCount;i++)
|
||||||
|
|||||||
@@ -16,5 +16,5 @@ public:
|
|||||||
CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion = false);
|
CompleteUsingItemTask(Tutorial *tutorial, int descriptionId, int itemIds[], unsigned int itemIdsLength, bool enablePreCompletion = false);
|
||||||
virtual ~CompleteUsingItemTask();
|
virtual ~CompleteUsingItemTask();
|
||||||
virtual bool isCompleted();
|
virtual bool isCompleted();
|
||||||
virtual void completeUsingItem(shared_ptr<ItemInstance> item);
|
virtual void completeUsingItem(std::shared_ptr<ItemInstance> item);
|
||||||
};
|
};
|
||||||
@@ -40,7 +40,7 @@ CraftTask::~CraftTask()
|
|||||||
delete[] m_auxValues;
|
delete[] m_auxValues;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CraftTask::onCrafted(shared_ptr<ItemInstance> item)
|
void CraftTask::onCrafted(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
#ifndef _CONTENT_PACKAGE
|
#ifndef _CONTENT_PACKAGE
|
||||||
wprintf(L"CraftTask::onCrafted - %ls\n", item->toString().c_str() );
|
wprintf(L"CraftTask::onCrafted - %ls\n", item->toString().c_str() );
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public:
|
|||||||
~CraftTask();
|
~CraftTask();
|
||||||
|
|
||||||
virtual bool isCompleted() { return bIsCompleted; }
|
virtual bool isCompleted() { return bIsCompleted; }
|
||||||
virtual void onCrafted(shared_ptr<ItemInstance> item);
|
virtual void onCrafted(std::shared_ptr<ItemInstance> item);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int *m_items;
|
int *m_items;
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ DiggerItemHint::DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descri
|
|||||||
tutorial->addMessage(IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL, true);
|
tutorial->addMessage(IDS_TUTORIAL_HINT_ATTACK_WITH_TOOL, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
int DiggerItemHint::startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile)
|
||||||
{
|
{
|
||||||
if(item != NULL)
|
if(item != NULL)
|
||||||
{
|
{
|
||||||
@@ -46,7 +46,7 @@ int DiggerItemHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DiggerItemHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity)
|
int DiggerItemHint::attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity)
|
||||||
{
|
{
|
||||||
if(item != NULL)
|
if(item != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -13,6 +13,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int items[], unsigned int itemsLength);
|
DiggerItemHint(eTutorial_Hint id, Tutorial *tutorial, int descriptionId, int items[], unsigned int itemsLength);
|
||||||
virtual int startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile);
|
virtual int startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile);
|
||||||
virtual int attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity);
|
virtual int attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity);
|
||||||
};
|
};
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "stdafx.h"
|
#include "stdafx.h"
|
||||||
#include "PickupTask.h"
|
#include "PickupTask.h"
|
||||||
|
|
||||||
void PickupTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
void PickupTask::onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
||||||
{
|
{
|
||||||
if(item->id == m_itemId)
|
if(item->id == m_itemId)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ public:
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
virtual bool isCompleted() { return bIsCompleted; }
|
virtual bool isCompleted() { return bIsCompleted; }
|
||||||
virtual void onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
virtual void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int m_itemId;
|
int m_itemId;
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ bool ProcedureCompoundTask::isCompleted()
|
|||||||
return allCompleted;
|
return allCompleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcedureCompoundTask::onCrafted(shared_ptr<ItemInstance> item)
|
void ProcedureCompoundTask::onCrafted(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
AUTO_VAR(itEnd, m_taskSequence.end());
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
||||||
@@ -222,7 +222,7 @@ bool ProcedureCompoundTask::AllowFade()
|
|||||||
return allowFade;
|
return allowFade;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
|
void ProcedureCompoundTask::useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
AUTO_VAR(itEnd, m_taskSequence.end());
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
||||||
@@ -232,7 +232,7 @@ void ProcedureCompoundTask::useItemOn(Level *level, shared_ptr<ItemInstance> ite
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcedureCompoundTask::useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
void ProcedureCompoundTask::useItem(std::shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
AUTO_VAR(itEnd, m_taskSequence.end());
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
||||||
@@ -242,7 +242,7 @@ void ProcedureCompoundTask::useItem(shared_ptr<ItemInstance> item, bool bTestUse
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProcedureCompoundTask::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
void ProcedureCompoundTask::onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
||||||
{
|
{
|
||||||
AUTO_VAR(itEnd, m_taskSequence.end());
|
AUTO_VAR(itEnd, m_taskSequence.end());
|
||||||
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
for(AUTO_VAR(it, m_taskSequence.begin()); it < itEnd; ++it)
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ public:
|
|||||||
virtual int getDescriptionId();
|
virtual int getDescriptionId();
|
||||||
virtual int getPromptId();
|
virtual int getPromptId();
|
||||||
virtual bool isCompleted();
|
virtual bool isCompleted();
|
||||||
virtual void onCrafted(shared_ptr<ItemInstance> item);
|
virtual void onCrafted(std::shared_ptr<ItemInstance> item);
|
||||||
virtual void handleUIInput(int iAction);
|
virtual void handleUIInput(int iAction);
|
||||||
virtual void setAsCurrentTask(bool active = true);
|
virtual void setAsCurrentTask(bool active = true);
|
||||||
virtual bool ShowMinimumTime();
|
virtual bool ShowMinimumTime();
|
||||||
@@ -26,9 +26,9 @@ public:
|
|||||||
virtual void setShownForMinimumTime();
|
virtual void setShownForMinimumTime();
|
||||||
virtual bool AllowFade();
|
virtual bool AllowFade();
|
||||||
|
|
||||||
virtual void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false);
|
virtual void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false);
|
||||||
virtual void useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
virtual void useItem(std::shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
||||||
virtual void onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
virtual void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
||||||
virtual void onStateChange(eTutorial_State newState);
|
virtual void onStateChange(eTutorial_State newState);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ TakeItemHint::TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], u
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TakeItemHint::onTake(shared_ptr<ItemInstance> item)
|
bool TakeItemHint::onTake(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
if(item != NULL)
|
if(item != NULL)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,5 +15,5 @@ public:
|
|||||||
TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], unsigned int itemsLength);
|
TakeItemHint(eTutorial_Hint id, Tutorial *tutorial, int items[], unsigned int itemsLength);
|
||||||
~TakeItemHint();
|
~TakeItemHint();
|
||||||
|
|
||||||
virtual bool onTake( shared_ptr<ItemInstance> item );
|
virtual bool onTake( std::shared_ptr<ItemInstance> item );
|
||||||
};
|
};
|
||||||
@@ -1681,7 +1681,7 @@ void Tutorial::showTutorialPopup(bool show)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly)
|
void Tutorial::useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
||||||
{
|
{
|
||||||
@@ -1690,7 +1690,7 @@ void Tutorial::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
void Tutorial::useItemOn(std::shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
||||||
{
|
{
|
||||||
@@ -1699,7 +1699,7 @@ void Tutorial::useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
|
void Tutorial::completeUsingItem(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
for(AUTO_VAR(it, activeTasks[m_CurrentState].begin()); it < activeTasks[m_CurrentState].end(); ++it)
|
||||||
{
|
{
|
||||||
@@ -1718,7 +1718,7 @@ void Tutorial::completeUsingItem(shared_ptr<ItemInstance> item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
void Tutorial::startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile)
|
||||||
{
|
{
|
||||||
int hintNeeded = -1;
|
int hintNeeded = -1;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
||||||
@@ -1754,7 +1754,7 @@ void Tutorial::destroyBlock(Tile *tile)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
void Tutorial::attack(std::shared_ptr<Player> player, std::shared_ptr<Entity> entity)
|
||||||
{
|
{
|
||||||
int hintNeeded = -1;
|
int hintNeeded = -1;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
||||||
@@ -1772,7 +1772,7 @@ void Tutorial::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::itemDamaged(shared_ptr<ItemInstance> item)
|
void Tutorial::itemDamaged(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
int hintNeeded = -1;
|
int hintNeeded = -1;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
||||||
@@ -1803,7 +1803,7 @@ void Tutorial::handleUIInput(int iAction)
|
|||||||
currentTask[m_CurrentState]->handleUIInput(iAction);
|
currentTask[m_CurrentState]->handleUIInput(iAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
|
void Tutorial::createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake)
|
||||||
{
|
{
|
||||||
int hintNeeded = -1;
|
int hintNeeded = -1;
|
||||||
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
for(AUTO_VAR(it, hints[m_CurrentState].begin()); it < hints[m_CurrentState].end(); ++it)
|
||||||
@@ -1821,7 +1821,7 @@ void Tutorial::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::onCrafted(shared_ptr<ItemInstance> item)
|
void Tutorial::onCrafted(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
|
for(unsigned int state = 0; state < e_Tutorial_State_Max; ++state)
|
||||||
{
|
{
|
||||||
@@ -1833,7 +1833,7 @@ void Tutorial::onCrafted(shared_ptr<ItemInstance> item)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
void Tutorial::onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux)
|
||||||
{
|
{
|
||||||
if( !m_hintDisplayed )
|
if( !m_hintDisplayed )
|
||||||
{
|
{
|
||||||
@@ -1860,7 +1860,7 @@ void Tutorial::onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Tutorial::onSelectedItemChanged(shared_ptr<ItemInstance> item)
|
void Tutorial::onSelectedItemChanged(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
// We only handle this if we are in a state that allows changing based on the selected item
|
// We only handle this if we are in a state that allows changing based on the selected item
|
||||||
// Menus and states like riding in a minecart will NOT allow this
|
// Menus and states like riding in a minecart will NOT allow this
|
||||||
|
|||||||
@@ -151,19 +151,19 @@ public:
|
|||||||
|
|
||||||
void showTutorialPopup(bool show);
|
void showTutorialPopup(bool show);
|
||||||
|
|
||||||
void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly=false);
|
void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly=false);
|
||||||
void useItemOn(shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
void useItemOn(std::shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
||||||
void completeUsingItem(shared_ptr<ItemInstance> item);
|
void completeUsingItem(std::shared_ptr<ItemInstance> item);
|
||||||
void startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile);
|
void startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile);
|
||||||
void destroyBlock(Tile *tile);
|
void destroyBlock(Tile *tile);
|
||||||
void attack(shared_ptr<Player> player, shared_ptr<Entity> entity);
|
void attack(std::shared_ptr<Player> player, std::shared_ptr<Entity> entity);
|
||||||
void itemDamaged(shared_ptr<ItemInstance> item);
|
void itemDamaged(std::shared_ptr<ItemInstance> item);
|
||||||
|
|
||||||
void handleUIInput(int iAction);
|
void handleUIInput(int iAction);
|
||||||
void createItemSelected(shared_ptr<ItemInstance> item, bool canMake);
|
void createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake);
|
||||||
void onCrafted(shared_ptr<ItemInstance> item);
|
void onCrafted(std::shared_ptr<ItemInstance> item);
|
||||||
void onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux);
|
||||||
void onSelectedItemChanged(shared_ptr<ItemInstance> item);
|
void onSelectedItemChanged(std::shared_ptr<ItemInstance> item);
|
||||||
void onLookAt(int id, int iData=0);
|
void onLookAt(int id, int iData=0);
|
||||||
void onLookAtEntity(eINSTANCEOF type);
|
void onLookAtEntity(eINSTANCEOF type);
|
||||||
void onEffectChanged(MobEffect *effect, bool bRemoved=false);
|
void onEffectChanged(MobEffect *effect, bool bRemoved=false);
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ TutorialHint::TutorialHint(eTutorial_Hint id, Tutorial *tutorial, int descriptio
|
|||||||
tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients);
|
tutorial->addMessage(descriptionId, type != e_Hint_NoIngredients);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TutorialHint::startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile)
|
int TutorialHint::startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile)
|
||||||
{
|
{
|
||||||
int returnVal = -1;
|
int returnVal = -1;
|
||||||
switch(m_type)
|
switch(m_type)
|
||||||
@@ -59,7 +59,7 @@ int TutorialHint::destroyBlock(Tile *tile)
|
|||||||
return returnVal;
|
return returnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TutorialHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity)
|
int TutorialHint::attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
switch(m_type)
|
switch(m_type)
|
||||||
@@ -71,7 +71,7 @@ int TutorialHint::attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entit
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TutorialHint::createItemSelected(shared_ptr<ItemInstance> item, bool canMake)
|
int TutorialHint::createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake)
|
||||||
{
|
{
|
||||||
int returnVal = -1;
|
int returnVal = -1;
|
||||||
switch(m_type)
|
switch(m_type)
|
||||||
@@ -86,7 +86,7 @@ int TutorialHint::createItemSelected(shared_ptr<ItemInstance> item, bool canMake
|
|||||||
return returnVal;
|
return returnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
int TutorialHint::itemDamaged(shared_ptr<ItemInstance> item)
|
int TutorialHint::itemDamaged(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
int returnVal = -1;
|
int returnVal = -1;
|
||||||
switch(m_type)
|
switch(m_type)
|
||||||
@@ -100,7 +100,7 @@ int TutorialHint::itemDamaged(shared_ptr<ItemInstance> item)
|
|||||||
return returnVal;
|
return returnVal;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TutorialHint::onTake( shared_ptr<ItemInstance> item )
|
bool TutorialHint::onTake( std::shared_ptr<ItemInstance> item )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,12 +40,12 @@ public:
|
|||||||
|
|
||||||
eTutorial_Hint getId() { return m_id; }
|
eTutorial_Hint getId() { return m_id; }
|
||||||
|
|
||||||
virtual int startDestroyBlock(shared_ptr<ItemInstance> item, Tile *tile);
|
virtual int startDestroyBlock(std::shared_ptr<ItemInstance> item, Tile *tile);
|
||||||
virtual int destroyBlock(Tile *tile);
|
virtual int destroyBlock(Tile *tile);
|
||||||
virtual int attack(shared_ptr<ItemInstance> item, shared_ptr<Entity> entity);
|
virtual int attack(std::shared_ptr<ItemInstance> item, std::shared_ptr<Entity> entity);
|
||||||
virtual int createItemSelected(shared_ptr<ItemInstance> item, bool canMake);
|
virtual int createItemSelected(std::shared_ptr<ItemInstance> item, bool canMake);
|
||||||
virtual int itemDamaged(shared_ptr<ItemInstance> item);
|
virtual int itemDamaged(std::shared_ptr<ItemInstance> item);
|
||||||
virtual bool onTake( shared_ptr<ItemInstance> item );
|
virtual bool onTake( std::shared_ptr<ItemInstance> item );
|
||||||
virtual bool onLookAt(int id, int iData=0);
|
virtual bool onLookAt(int id, int iData=0);
|
||||||
virtual bool onLookAtEntity(eINSTANCEOF type);
|
virtual bool onLookAtEntity(eINSTANCEOF type);
|
||||||
virtual int tick();
|
virtual int tick();
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ bool TutorialMode::destroyBlock(int x, int y, int z, int face)
|
|||||||
int t = minecraft->level->getTile(x, y, z);
|
int t = minecraft->level->getTile(x, y, z);
|
||||||
tutorial->destroyBlock(Tile::tiles[t]);
|
tutorial->destroyBlock(Tile::tiles[t]);
|
||||||
}
|
}
|
||||||
shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
|
std::shared_ptr<ItemInstance> item = minecraft->player->getSelectedItem();
|
||||||
int damageBefore;
|
int damageBefore;
|
||||||
if(item != NULL)
|
if(item != NULL)
|
||||||
{
|
{
|
||||||
@@ -78,7 +78,7 @@ void TutorialMode::tick()
|
|||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TutorialMode::useItemOn(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly, bool *pbUsedItem)
|
bool TutorialMode::useItemOn(std::shared_ptr<Player> player, Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly, bool *pbUsedItem)
|
||||||
{
|
{
|
||||||
bool haveItem = false;
|
bool haveItem = false;
|
||||||
int itemCount = 0;
|
int itemCount = 0;
|
||||||
@@ -110,7 +110,7 @@ bool TutorialMode::useItemOn(shared_ptr<Player> player, Level *level, shared_ptr
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TutorialMode::attack(shared_ptr<Player> player, shared_ptr<Entity> entity)
|
void TutorialMode::attack(std::shared_ptr<Player> player, std::shared_ptr<Entity> entity)
|
||||||
{
|
{
|
||||||
if(!tutorial->m_allTutorialsComplete)
|
if(!tutorial->m_allTutorialsComplete)
|
||||||
tutorial->attack(player, entity);
|
tutorial->attack(player, entity);
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ public:
|
|||||||
virtual void startDestroyBlock(int x, int y, int z, int face);
|
virtual void startDestroyBlock(int x, int y, int z, int face);
|
||||||
virtual bool destroyBlock(int x, int y, int z, int face);
|
virtual bool destroyBlock(int x, int y, int z, int face);
|
||||||
virtual void tick();
|
virtual void tick();
|
||||||
virtual bool useItemOn(shared_ptr<Player> player, Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL);
|
virtual bool useItemOn(std::shared_ptr<Player> player, Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, int face, Vec3 *hit, bool bTestUseOnly=false, bool *pbUsedItem=NULL);
|
||||||
virtual void attack(shared_ptr<Player> player, shared_ptr<Entity> entity);
|
virtual void attack(std::shared_ptr<Player> player, std::shared_ptr<Entity> entity);
|
||||||
|
|
||||||
virtual bool isInputAllowed(int mapping);
|
virtual bool isInputAllowed(int mapping);
|
||||||
|
|
||||||
|
|||||||
@@ -52,12 +52,12 @@ public:
|
|||||||
bool TaskReminders() { return m_bTaskReminders;}
|
bool TaskReminders() { return m_bTaskReminders;}
|
||||||
virtual bool ShowMinimumTime() { return m_bShowMinimumTime;}
|
virtual bool ShowMinimumTime() { return m_bShowMinimumTime;}
|
||||||
|
|
||||||
virtual void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false) { }
|
virtual void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false) { }
|
||||||
virtual void useItem(shared_ptr<ItemInstance> item,bool bTestUseOnly=false) { }
|
virtual void useItem(std::shared_ptr<ItemInstance> item,bool bTestUseOnly=false) { }
|
||||||
virtual void completeUsingItem(shared_ptr<ItemInstance> item) { }
|
virtual void completeUsingItem(std::shared_ptr<ItemInstance> item) { }
|
||||||
virtual void handleUIInput(int iAction) { }
|
virtual void handleUIInput(int iAction) { }
|
||||||
virtual void onCrafted(shared_ptr<ItemInstance> item) { }
|
virtual void onCrafted(std::shared_ptr<ItemInstance> item) { }
|
||||||
virtual void onTake(shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { }
|
virtual void onTake(std::shared_ptr<ItemInstance> item, unsigned int invItemCountAnyAux, unsigned int invItemCountThisAux) { }
|
||||||
virtual void onStateChange(eTutorial_State newState) { }
|
virtual void onStateChange(eTutorial_State newState) { }
|
||||||
virtual void onEffectChanged(MobEffect *effect, bool bRemoved=false) { }
|
virtual void onEffectChanged(MobEffect *effect, bool bRemoved=false) { }
|
||||||
};
|
};
|
||||||
@@ -16,7 +16,7 @@ bool UseItemTask::isCompleted()
|
|||||||
return bIsCompleted;
|
return bIsCompleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UseItemTask::useItem(shared_ptr<ItemInstance> item,bool bTestUseOnly)
|
void UseItemTask::useItem(std::shared_ptr<ItemInstance> item,bool bTestUseOnly)
|
||||||
{
|
{
|
||||||
if(bTestUseOnly) return;
|
if(bTestUseOnly) return;
|
||||||
|
|
||||||
|
|||||||
@@ -16,5 +16,5 @@ public:
|
|||||||
UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId,
|
UseItemTask(const int itemId, Tutorial *tutorial, int descriptionId,
|
||||||
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true );
|
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true );
|
||||||
virtual bool isCompleted();
|
virtual bool isCompleted();
|
||||||
virtual void useItem(shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
virtual void useItem(std::shared_ptr<ItemInstance> item, bool bTestUseOnly=false);
|
||||||
};
|
};
|
||||||
@@ -25,7 +25,7 @@ bool UseTileTask::isCompleted()
|
|||||||
return bIsCompleted;
|
return bIsCompleted;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UseTileTask::useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
|
void UseTileTask::useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z,bool bTestUseOnly)
|
||||||
{
|
{
|
||||||
if(bTestUseOnly) return;
|
if(bTestUseOnly) return;
|
||||||
|
|
||||||
|
|||||||
@@ -20,5 +20,5 @@ public:
|
|||||||
UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId,
|
UseTileTask(const int tileId, Tutorial *tutorial, int descriptionId,
|
||||||
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true);
|
bool enablePreCompletion = false, vector<TutorialConstraint *> *inConstraints = NULL, bool bShowMinimumTime = false, bool bAllowFade = true, bool bTaskReminders = true);
|
||||||
virtual bool isCompleted();
|
virtual bool isCompleted();
|
||||||
virtual void useItemOn(Level *level, shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false);
|
virtual void useItemOn(Level *level, std::shared_ptr<ItemInstance> item, int x, int y, int z, bool bTestUseOnly=false);
|
||||||
};
|
};
|
||||||
@@ -704,11 +704,11 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||||||
// Determine appropriate context sensitive tool tips, based on what is carried on the pointer and what is under the pointer.
|
// Determine appropriate context sensitive tool tips, based on what is carried on the pointer and what is under the pointer.
|
||||||
|
|
||||||
// What are we carrying on pointer.
|
// What are we carrying on pointer.
|
||||||
shared_ptr<LocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
std::shared_ptr<LocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||||
shared_ptr<ItemInstance> carriedItem = nullptr;
|
std::shared_ptr<ItemInstance> carriedItem = nullptr;
|
||||||
if(player != NULL) carriedItem = player->inventory->getCarried();
|
if(player != NULL) carriedItem = player->inventory->getCarried();
|
||||||
|
|
||||||
shared_ptr<ItemInstance> slotItem = nullptr;
|
std::shared_ptr<ItemInstance> slotItem = nullptr;
|
||||||
Slot *slot = NULL;
|
Slot *slot = NULL;
|
||||||
int slotIndex = 0;
|
int slotIndex = 0;
|
||||||
if(bPointerIsOverSlot)
|
if(bPointerIsOverSlot)
|
||||||
@@ -889,7 +889,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||||||
|
|
||||||
if((eSectionUnderPointer==eSectionInventoryUsing)||(eSectionUnderPointer==eSectionInventoryInventory))
|
if((eSectionUnderPointer==eSectionInventoryUsing)||(eSectionUnderPointer==eSectionInventoryInventory))
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||||
ArmorRecipes::_eArmorType eArmourType=ArmorRecipes::GetArmorType(item->id);
|
ArmorRecipes::_eArmorType eArmourType=ArmorRecipes::GetArmorType(item->id);
|
||||||
|
|
||||||
if(eArmourType==ArmorRecipes::eArmorType_None)
|
if(eArmourType==ArmorRecipes::eArmorType_None)
|
||||||
@@ -952,7 +952,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||||||
else if((eSectionUnderPointer==eSectionFurnaceUsing)||(eSectionUnderPointer==eSectionFurnaceInventory))
|
else if((eSectionUnderPointer==eSectionFurnaceUsing)||(eSectionUnderPointer==eSectionFurnaceInventory))
|
||||||
{
|
{
|
||||||
// Get the info on this item.
|
// Get the info on this item.
|
||||||
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||||
bool bValidFuel = FurnaceTileEntity::isFuel(item);
|
bool bValidFuel = FurnaceTileEntity::isFuel(item);
|
||||||
bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL;
|
bool bValidIngredient = FurnaceRecipes::getInstance()->getResult(item->getItem()->id) != NULL;
|
||||||
|
|
||||||
@@ -962,7 +962,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||||||
if(!isSlotEmpty(eSectionFurnaceIngredient,0))
|
if(!isSlotEmpty(eSectionFurnaceIngredient,0))
|
||||||
{
|
{
|
||||||
// is it the same as this item
|
// is it the same as this item
|
||||||
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
|
std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
|
||||||
if(IngredientItem->id == item->id)
|
if(IngredientItem->id == item->id)
|
||||||
{
|
{
|
||||||
buttonY = eToolTipQuickMoveIngredient;
|
buttonY = eToolTipQuickMoveIngredient;
|
||||||
@@ -991,7 +991,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||||||
if(!isSlotEmpty(eSectionFurnaceFuel,0))
|
if(!isSlotEmpty(eSectionFurnaceFuel,0))
|
||||||
{
|
{
|
||||||
// is it the same as this item
|
// is it the same as this item
|
||||||
shared_ptr<ItemInstance> fuelItem = getSlotItem(eSectionFurnaceFuel,0);
|
std::shared_ptr<ItemInstance> fuelItem = getSlotItem(eSectionFurnaceFuel,0);
|
||||||
if(fuelItem->id == item->id)
|
if(fuelItem->id == item->id)
|
||||||
{
|
{
|
||||||
buttonY = eToolTipQuickMoveFuel;
|
buttonY = eToolTipQuickMoveFuel;
|
||||||
@@ -1002,7 +1002,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||||||
if(!isSlotEmpty(eSectionFurnaceIngredient,0))
|
if(!isSlotEmpty(eSectionFurnaceIngredient,0))
|
||||||
{
|
{
|
||||||
// is it the same as this item
|
// is it the same as this item
|
||||||
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
|
std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionFurnaceIngredient,0);
|
||||||
if(IngredientItem->id == item->id)
|
if(IngredientItem->id == item->id)
|
||||||
{
|
{
|
||||||
buttonY = eToolTipQuickMoveIngredient;
|
buttonY = eToolTipQuickMoveIngredient;
|
||||||
@@ -1044,7 +1044,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||||||
else if((eSectionUnderPointer==eSectionBrewingUsing)||(eSectionUnderPointer==eSectionBrewingInventory))
|
else if((eSectionUnderPointer==eSectionBrewingUsing)||(eSectionUnderPointer==eSectionBrewingInventory))
|
||||||
{
|
{
|
||||||
// Get the info on this item.
|
// Get the info on this item.
|
||||||
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||||
int iId=item->id;
|
int iId=item->id;
|
||||||
|
|
||||||
// valid ingredient?
|
// valid ingredient?
|
||||||
@@ -1062,7 +1062,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||||||
if(!isSlotEmpty(eSectionBrewingIngredient,0))
|
if(!isSlotEmpty(eSectionBrewingIngredient,0))
|
||||||
{
|
{
|
||||||
// is it the same as this item
|
// is it the same as this item
|
||||||
shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionBrewingIngredient,0);
|
std::shared_ptr<ItemInstance> IngredientItem = getSlotItem(eSectionBrewingIngredient,0);
|
||||||
if(IngredientItem->id == item->id)
|
if(IngredientItem->id == item->id)
|
||||||
{
|
{
|
||||||
buttonY = eToolTipQuickMoveIngredient;
|
buttonY = eToolTipQuickMoveIngredient;
|
||||||
@@ -1104,7 +1104,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||||||
else if((eSectionUnderPointer==eSectionEnchantUsing)||(eSectionUnderPointer==eSectionEnchantInventory))
|
else if((eSectionUnderPointer==eSectionEnchantUsing)||(eSectionUnderPointer==eSectionEnchantInventory))
|
||||||
{
|
{
|
||||||
// Get the info on this item.
|
// Get the info on this item.
|
||||||
shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
std::shared_ptr<ItemInstance> item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||||
int iId=item->id;
|
int iId=item->id;
|
||||||
|
|
||||||
// valid enchantable tool?
|
// valid enchantable tool?
|
||||||
@@ -1199,7 +1199,7 @@ void IUIScene_AbstractContainerMenu::onMouseTick()
|
|||||||
SetPointerOutsideMenu( false );
|
SetPointerOutsideMenu( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<ItemInstance> item = nullptr;
|
std::shared_ptr<ItemInstance> item = nullptr;
|
||||||
if(bPointerIsOverSlot && bSlotHasItem) item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
if(bPointerIsOverSlot && bSlotHasItem) item = getSlotItem(eSectionUnderPointer, iNewSlotIndex);
|
||||||
overrideTooltips(eSectionUnderPointer, item, bIsItemCarried, bSlotHasItem, bCarriedIsSameAsSlot, iSlotStackSizeRemaining, buttonA, buttonX, buttonY, buttonRT);
|
overrideTooltips(eSectionUnderPointer, item, bIsItemCarried, bSlotHasItem, bCarriedIsSameAsSlot, iSlotStackSizeRemaining, buttonA, buttonX, buttonY, buttonRT);
|
||||||
|
|
||||||
@@ -1410,7 +1410,7 @@ bool IUIScene_AbstractContainerMenu::handleKeyDown(int iPad, int iAction, bool b
|
|||||||
bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex);
|
bool bSlotHasItem = !isSlotEmpty(m_eCurrSection, currentIndex);
|
||||||
if ( bSlotHasItem )
|
if ( bSlotHasItem )
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> item = getSlotItem(m_eCurrSection, currentIndex);
|
std::shared_ptr<ItemInstance> item = getSlotItem(m_eCurrSection, currentIndex);
|
||||||
if( Minecraft::GetInstance()->localgameModes[iPad] != NULL )
|
if( Minecraft::GetInstance()->localgameModes[iPad] != NULL )
|
||||||
{
|
{
|
||||||
Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails;
|
Tutorial::PopupMessageDetails *message = new Tutorial::PopupMessageDetails;
|
||||||
@@ -1569,7 +1569,7 @@ int IUIScene_AbstractContainerMenu::getCurrentIndex(ESceneSection eSection)
|
|||||||
return currentIndex + getSectionStartOffset(eSection);
|
return currentIndex + getSectionStartOffset(eSection);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IUIScene_AbstractContainerMenu::IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB)
|
bool IUIScene_AbstractContainerMenu::IsSameItemAs(std::shared_ptr<ItemInstance> itemA, std::shared_ptr<ItemInstance> itemB)
|
||||||
{
|
{
|
||||||
if(itemA == NULL || itemB == NULL) return false;
|
if(itemA == NULL || itemB == NULL) return false;
|
||||||
|
|
||||||
@@ -1583,7 +1583,7 @@ int IUIScene_AbstractContainerMenu::GetEmptyStackSpace(Slot *slot)
|
|||||||
|
|
||||||
if(slot != NULL && slot->hasItem())
|
if(slot != NULL && slot->hasItem())
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> item = slot->getItem();
|
std::shared_ptr<ItemInstance> item = slot->getItem();
|
||||||
if ( item->isStackable() )
|
if ( item->isStackable() )
|
||||||
{
|
{
|
||||||
int iCount = item->GetCount();
|
int iCount = item->GetCount();
|
||||||
|
|||||||
@@ -201,15 +201,15 @@ protected:
|
|||||||
virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y) = 0;
|
virtual void setSectionSelectedSlot(ESceneSection eSection, int x, int y) = 0;
|
||||||
virtual void setFocusToPointer(int iPad) = 0;
|
virtual void setFocusToPointer(int iPad) = 0;
|
||||||
virtual void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot) = 0;
|
virtual void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot) = 0;
|
||||||
virtual shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot) = 0;
|
virtual std::shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot) = 0;
|
||||||
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0;
|
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot) = 0;
|
||||||
virtual void adjustPointerForSafeZone() = 0;
|
virtual void adjustPointerForSafeZone() = 0;
|
||||||
|
|
||||||
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||||
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) { return false; }
|
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT) { return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool IsSameItemAs(shared_ptr<ItemInstance> itemA, shared_ptr<ItemInstance> itemB);
|
bool IsSameItemAs(std::shared_ptr<ItemInstance> itemA, std::shared_ptr<ItemInstance> itemB);
|
||||||
int GetEmptyStackSpace(Slot *slot);
|
int GetEmptyStackSpace(Slot *slot);
|
||||||
wstring GetItemDescription(Slot *slot, vector<wstring> &unformattedStrings);
|
wstring GetItemDescription(Slot *slot, vector<wstring> &unformattedStrings);
|
||||||
|
|
||||||
|
|||||||
@@ -245,15 +245,15 @@ void IUIScene_AnvilMenu::updateItemName()
|
|||||||
ByteArrayOutputStream baos;
|
ByteArrayOutputStream baos;
|
||||||
DataOutputStream dos(&baos);
|
DataOutputStream dos(&baos);
|
||||||
dos.writeUTF(m_itemName);
|
dos.writeUTF(m_itemName);
|
||||||
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())));
|
Minecraft::GetInstance()->localplayers[getPad()]->connection->send(std::shared_ptr<CustomPayloadPacket>(new CustomPayloadPacket(CustomPayloadPacket::SET_ITEM_NAME_PACKET, baos.toByteArray())));
|
||||||
}
|
}
|
||||||
|
|
||||||
void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items)
|
void IUIScene_AnvilMenu::refreshContainer(AbstractContainerMenu *container, vector<std::shared_ptr<ItemInstance> > *items)
|
||||||
{
|
{
|
||||||
slotChanged(container, RepairMenu::INPUT_SLOT, container->getSlot(0)->getItem());
|
slotChanged(container, RepairMenu::INPUT_SLOT, container->getSlot(0)->getItem());
|
||||||
}
|
}
|
||||||
|
|
||||||
void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr<ItemInstance> item)
|
void IUIScene_AnvilMenu::slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
if (slotIndex == RepairMenu::INPUT_SLOT)
|
if (slotIndex == RepairMenu::INPUT_SLOT)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ class RepairMenu;
|
|||||||
class IUIScene_AnvilMenu : public virtual IUIScene_AbstractContainerMenu, public net_minecraft_world_inventory::ContainerListener
|
class IUIScene_AnvilMenu : public virtual IUIScene_AbstractContainerMenu, public net_minecraft_world_inventory::ContainerListener
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
shared_ptr<Inventory> m_inventory;
|
std::shared_ptr<Inventory> m_inventory;
|
||||||
RepairMenu *m_repairMenu;
|
RepairMenu *m_repairMenu;
|
||||||
wstring m_itemName;
|
wstring m_itemName;
|
||||||
|
|
||||||
@@ -39,7 +39,7 @@ protected:
|
|||||||
void updateItemName();
|
void updateItemName();
|
||||||
|
|
||||||
// ContainerListenr
|
// ContainerListenr
|
||||||
void refreshContainer(AbstractContainerMenu *container, vector<shared_ptr<ItemInstance> > *items);
|
void refreshContainer(AbstractContainerMenu *container, vector<std::shared_ptr<ItemInstance> > *items);
|
||||||
void slotChanged(AbstractContainerMenu *container, int slotIndex, shared_ptr<ItemInstance> item);
|
void slotChanged(AbstractContainerMenu *container, int slotIndex, std::shared_ptr<ItemInstance> item);
|
||||||
void setContainerData(AbstractContainerMenu *container, int id, int value);
|
void setContainerData(AbstractContainerMenu *container, int id, int value);
|
||||||
};
|
};
|
||||||
@@ -208,7 +208,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||||||
int iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
int iSlot=iVSlotIndexA[m_iCurrentSlotVIndex];
|
||||||
|
|
||||||
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
||||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
||||||
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
|
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
|
||||||
|
|
||||||
if( pMinecraft->localgameModes[iPad] != NULL)
|
if( pMinecraft->localgameModes[iPad] != NULL)
|
||||||
@@ -244,7 +244,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||||||
iSlot=0;
|
iSlot=0;
|
||||||
}
|
}
|
||||||
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
int iRecipe= CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
||||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
||||||
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
|
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
|
||||||
|
|
||||||
if( pMinecraft->localgameModes[iPad] != NULL )
|
if( pMinecraft->localgameModes[iPad] != NULL )
|
||||||
@@ -272,7 +272,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||||||
{
|
{
|
||||||
for(int j=0;j<pRecipeIngredientsRequired[iRecipe].iIngValA[i];j++)
|
for(int j=0;j<pRecipeIngredientsRequired[iRecipe].iIngValA[i];j++)
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> ingItemInst = nullptr;
|
std::shared_ptr<ItemInstance> ingItemInst = nullptr;
|
||||||
// do we need to remove a specific aux value?
|
// do we need to remove a specific aux value?
|
||||||
if(pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]!=Recipes::ANY_AUX_VALUE)
|
if(pRecipeIngredientsRequired[iRecipe].iIngAuxValA[i]!=Recipes::ANY_AUX_VALUE)
|
||||||
{
|
{
|
||||||
@@ -291,7 +291,7 @@ bool IUIScene_CraftingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||||||
if (ingItemInst->getItem()->hasCraftingRemainingItem())
|
if (ingItemInst->getItem()->hasCraftingRemainingItem())
|
||||||
{
|
{
|
||||||
// replace item with remaining result
|
// replace item with remaining result
|
||||||
m_pPlayer->inventory->add( shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) );
|
m_pPlayer->inventory->add( std::shared_ptr<ItemInstance>( new ItemInstance(ingItemInst->getItem()->getCraftingRemainingItem()) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -624,7 +624,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||||||
|
|
||||||
// for (int i = 0; i < iRecipeC; i++)
|
// for (int i = 0; i < iRecipeC; i++)
|
||||||
// {
|
// {
|
||||||
// shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL);
|
// std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(NULL);
|
||||||
// if (pTempItemInst != NULL)
|
// if (pTempItemInst != NULL)
|
||||||
// {
|
// {
|
||||||
// wstring itemstring=pTempItemInst->toString();
|
// wstring itemstring=pTempItemInst->toString();
|
||||||
@@ -761,7 +761,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||||||
if(iHSlotBrushControl<=m_iCraftablesMaxHSlotC)
|
if(iHSlotBrushControl<=m_iCraftablesMaxHSlotC)
|
||||||
{
|
{
|
||||||
bool bFound=false;
|
bool bFound=false;
|
||||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr);
|
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[i].pRecipy->assemble(nullptr);
|
||||||
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
|
//int iIcon=pTempItemInst->getItem()->getIcon(pTempItemInst->getAuxValue());
|
||||||
int iID=pTempItemInst->getItem()->id;
|
int iID=pTempItemInst->getItem()->id;
|
||||||
int iBaseType;
|
int iBaseType;
|
||||||
@@ -835,7 +835,7 @@ void IUIScene_CraftingMenu::CheckRecipesAvailable()
|
|||||||
|
|
||||||
while((iIndex<m_iCraftablesMaxHSlotC) && CanBeMadeA[iIndex].iCount!=0)
|
while((iIndex<m_iCraftablesMaxHSlotC) && CanBeMadeA[iIndex].iCount!=0)
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].pRecipy->assemble(nullptr);
|
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[iIndex].iRecipeA[0]].pRecipy->assemble(nullptr);
|
||||||
assert(pTempItemInst->id!=0);
|
assert(pTempItemInst->id!=0);
|
||||||
unsigned int uiAlpha;
|
unsigned int uiAlpha;
|
||||||
|
|
||||||
@@ -903,7 +903,7 @@ void IUIScene_CraftingMenu::UpdateHighlight()
|
|||||||
{
|
{
|
||||||
iSlot=0;
|
iSlot=0;
|
||||||
}
|
}
|
||||||
shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
|
std::shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
|
||||||
|
|
||||||
// special case for the torch coal/charcoal
|
// special case for the torch coal/charcoal
|
||||||
int id=pTempItemInstAdditional->getDescriptionId();
|
int id=pTempItemInstAdditional->getDescriptionId();
|
||||||
@@ -991,7 +991,7 @@ void IUIScene_CraftingMenu::UpdateVerticalSlots()
|
|||||||
{
|
{
|
||||||
if(i!=1) continue;
|
if(i!=1) continue;
|
||||||
}
|
}
|
||||||
shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].pRecipy->assemble(nullptr);
|
std::shared_ptr<ItemInstance> pTempItemInstAdditional=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iVSlotIndexA[i]]].pRecipy->assemble(nullptr);
|
||||||
|
|
||||||
assert(pTempItemInstAdditional->id!=0);
|
assert(pTempItemInstAdditional->id!=0);
|
||||||
unsigned int uiAlpha;
|
unsigned int uiAlpha;
|
||||||
@@ -1057,7 +1057,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||||||
int iBoxWidth=(m_iContainerType==RECIPE_TYPE_2x2)?2:3;
|
int iBoxWidth=(m_iContainerType==RECIPE_TYPE_2x2)?2:3;
|
||||||
int iRecipe=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
int iRecipe=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot];
|
||||||
bool bCanMakeRecipe = pRecipeIngredientsRequired[iRecipe].bCanMake[getPad()];
|
bool bCanMakeRecipe = pRecipeIngredientsRequired[iRecipe].bCanMake[getPad()];
|
||||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[iRecipe].pRecipy->assemble(nullptr);
|
||||||
|
|
||||||
m_iIngredientsC=pRecipeIngredientsRequired[iRecipe].iIngC;
|
m_iIngredientsC=pRecipeIngredientsRequired[iRecipe].iIngC;
|
||||||
|
|
||||||
@@ -1077,7 +1077,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||||||
iAuxVal = 0xFF;
|
iAuxVal = 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal));
|
std::shared_ptr<ItemInstance> itemInst= std::shared_ptr<ItemInstance>(new ItemInstance(item,pRecipeIngredientsRequired[iRecipe].iIngValA[i],iAuxVal));
|
||||||
|
|
||||||
setIngredientDescriptionItem(getPad(),i,itemInst);
|
setIngredientDescriptionItem(getPad(),i,itemInst);
|
||||||
setIngredientDescriptionRedBox(i,false);
|
setIngredientDescriptionRedBox(i,false);
|
||||||
@@ -1141,7 +1141,7 @@ void IUIScene_CraftingMenu::DisplayIngredients()
|
|||||||
{
|
{
|
||||||
iAuxVal = 0xFF;
|
iAuxVal = 0xFF;
|
||||||
}
|
}
|
||||||
shared_ptr<ItemInstance> itemInst= shared_ptr<ItemInstance>(new ItemInstance(id,1,iAuxVal));
|
std::shared_ptr<ItemInstance> itemInst= std::shared_ptr<ItemInstance>(new ItemInstance(id,1,iAuxVal));
|
||||||
setIngredientSlotItem(getPad(),index,itemInst);
|
setIngredientSlotItem(getPad(),index,itemInst);
|
||||||
// show the ingredients we don't have if we can't make the recipe
|
// show the ingredients we don't have if we can't make the recipe
|
||||||
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
|
if(app.DebugSettingsOn() && app.GetGameSettingsDebugMask(ProfileManager.GetPrimaryPad())&(1L<<eDebugSetting_CraftAnything))
|
||||||
@@ -1218,7 +1218,7 @@ void IUIScene_CraftingMenu::UpdateDescriptionText(bool bCanBeMade)
|
|||||||
//iRecipy=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[0];
|
//iRecipy=CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
|
std::shared_ptr<ItemInstance> pTempItemInst=pRecipeIngredientsRequired[CanBeMadeA[m_iCurrentSlotHIndex].iRecipeA[iSlot]].pRecipy->assemble(nullptr);
|
||||||
int iID=pTempItemInst->getItem()->id;
|
int iID=pTempItemInst->getItem()->id;
|
||||||
int iAuxVal=pTempItemInst->getAuxValue();
|
int iAuxVal=pTempItemInst->getAuxValue();
|
||||||
int iBaseType;
|
int iBaseType;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ protected:
|
|||||||
int m_iCurrentSlotVIndex;
|
int m_iCurrentSlotVIndex;
|
||||||
int m_iRecipeC;
|
int m_iRecipeC;
|
||||||
int m_iContainerType; // 2x2 or 3x3
|
int m_iContainerType; // 2x2 or 3x3
|
||||||
shared_ptr<LocalPlayer> m_pPlayer;
|
std::shared_ptr<LocalPlayer> m_pPlayer;
|
||||||
int m_iGroupIndex;
|
int m_iGroupIndex;
|
||||||
|
|
||||||
int iVSlotIndexA[3]; // index of the v slots currently displayed
|
int iVSlotIndexA[3]; // index of the v slots currently displayed
|
||||||
@@ -96,13 +96,13 @@ protected:
|
|||||||
virtual void hideAllHSlots() = 0;
|
virtual void hideAllHSlots() = 0;
|
||||||
virtual void hideAllVSlots() = 0;
|
virtual void hideAllVSlots() = 0;
|
||||||
virtual void hideAllIngredientsSlots() = 0;
|
virtual void hideAllIngredientsSlots() = 0;
|
||||||
virtual void setCraftHSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
|
virtual void setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
|
||||||
virtual void setCraftVSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
|
virtual void setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha) = 0;
|
||||||
virtual void setCraftingOutputSlotItem(int iPad, shared_ptr<ItemInstance> item) = 0;
|
virtual void setCraftingOutputSlotItem(int iPad, std::shared_ptr<ItemInstance> item) = 0;
|
||||||
virtual void setCraftingOutputSlotRedBox(bool show) = 0;
|
virtual void setCraftingOutputSlotRedBox(bool show) = 0;
|
||||||
virtual void setIngredientSlotItem(int iPad, int index, shared_ptr<ItemInstance> item) = 0;
|
virtual void setIngredientSlotItem(int iPad, int index, std::shared_ptr<ItemInstance> item) = 0;
|
||||||
virtual void setIngredientSlotRedBox(int index, bool show) = 0;
|
virtual void setIngredientSlotRedBox(int index, bool show) = 0;
|
||||||
virtual void setIngredientDescriptionItem(int iPad, int index, shared_ptr<ItemInstance> item) = 0;
|
virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr<ItemInstance> item) = 0;
|
||||||
virtual void setIngredientDescriptionRedBox(int index, bool show) = 0;
|
virtual void setIngredientDescriptionRedBox(int index, bool show) = 0;
|
||||||
virtual void setIngredientDescriptionText(int index, LPCWSTR text) = 0;
|
virtual void setIngredientDescriptionText(int index, LPCWSTR text) = 0;
|
||||||
virtual void setShowCraftHSlot(int iIndex, bool show) = 0;
|
virtual void setShowCraftHSlot(int iIndex, bool show) = 0;
|
||||||
|
|||||||
@@ -12,16 +12,16 @@
|
|||||||
// 4J JEV - Images for each tab.
|
// 4J JEV - Images for each tab.
|
||||||
IUIScene_CreativeMenu::TabSpec **IUIScene_CreativeMenu::specs = NULL;
|
IUIScene_CreativeMenu::TabSpec **IUIScene_CreativeMenu::specs = NULL;
|
||||||
|
|
||||||
vector< shared_ptr<ItemInstance> > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount];
|
vector< std::shared_ptr<ItemInstance> > IUIScene_CreativeMenu::categoryGroups[eCreativeInventoryGroupsCount];
|
||||||
|
|
||||||
#define ITEM(id) list->push_back( shared_ptr<ItemInstance>(new ItemInstance(id, 1, 0)) );
|
#define ITEM(id) list->push_back( std::shared_ptr<ItemInstance>(new ItemInstance(id, 1, 0)) );
|
||||||
#define ITEM_AUX(id, aux) list->push_back( shared_ptr<ItemInstance>(new ItemInstance(id, 1, aux)) );
|
#define ITEM_AUX(id, aux) list->push_back( std::shared_ptr<ItemInstance>(new ItemInstance(id, 1, aux)) );
|
||||||
#define DEF(index) list = &categoryGroups[index];
|
#define DEF(index) list = &categoryGroups[index];
|
||||||
|
|
||||||
|
|
||||||
void IUIScene_CreativeMenu::staticCtor()
|
void IUIScene_CreativeMenu::staticCtor()
|
||||||
{
|
{
|
||||||
vector< shared_ptr<ItemInstance> > *list;
|
vector< std::shared_ptr<ItemInstance> > *list;
|
||||||
|
|
||||||
|
|
||||||
// Building Blocks
|
// Building Blocks
|
||||||
@@ -708,7 +708,7 @@ unsigned int IUIScene_CreativeMenu::TabSpec::getPageCount()
|
|||||||
|
|
||||||
|
|
||||||
// 4J JEV - Item Picker Menu
|
// 4J JEV - Item Picker Menu
|
||||||
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContainer> smp, shared_ptr<Inventory> inv ) : AbstractContainerMenu()
|
IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( std::shared_ptr<SimpleContainer> smp, std::shared_ptr<Inventory> inv ) : AbstractContainerMenu()
|
||||||
{
|
{
|
||||||
inventory = inv;
|
inventory = inv;
|
||||||
creativeContainer = smp;
|
creativeContainer = smp;
|
||||||
@@ -734,7 +734,7 @@ IUIScene_CreativeMenu::ItemPickerMenu::ItemPickerMenu( shared_ptr<SimpleContaine
|
|||||||
containerId = CONTAINER_ID_CREATIVE;
|
containerId = CONTAINER_ID_CREATIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IUIScene_CreativeMenu::ItemPickerMenu::stillValid(shared_ptr<Player> player)
|
bool IUIScene_CreativeMenu::ItemPickerMenu::stillValid(std::shared_ptr<Player> player)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -794,7 +794,7 @@ bool IUIScene_CreativeMenu::handleValidKeyPress(int iPad, int buttonNum, BOOL qu
|
|||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
|
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> newItem = m_menu->getSlot(i)->getItem();
|
std::shared_ptr<ItemInstance> newItem = m_menu->getSlot(i)->getItem();
|
||||||
|
|
||||||
if(newItem != NULL)
|
if(newItem != NULL)
|
||||||
{
|
{
|
||||||
@@ -813,7 +813,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q
|
|||||||
// Drop items.
|
// Drop items.
|
||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
|
|
||||||
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[iPad]->inventory;
|
std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[iPad]->inventory;
|
||||||
if (playerInventory->getCarried() != NULL)
|
if (playerInventory->getCarried() != NULL)
|
||||||
{
|
{
|
||||||
if (buttonNum == 0)
|
if (buttonNum == 0)
|
||||||
@@ -823,7 +823,7 @@ void IUIScene_CreativeMenu::handleOutsideClicked(int iPad, int buttonNum, BOOL q
|
|||||||
}
|
}
|
||||||
if (buttonNum == 1)
|
if (buttonNum == 1)
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> removedItem = playerInventory->getCarried()->remove(1);
|
std::shared_ptr<ItemInstance> removedItem = playerInventory->getCarried()->remove(1);
|
||||||
pMinecraft->localgameModes[iPad]->handleCreativeModeItemDrop(removedItem);
|
pMinecraft->localgameModes[iPad]->handleCreativeModeItemDrop(removedItem);
|
||||||
if (playerInventory->getCarried()->count == 0) playerInventory->setCarried(nullptr);
|
if (playerInventory->getCarried()->count == 0) playerInventory->setCarried(nullptr);
|
||||||
}
|
}
|
||||||
@@ -894,9 +894,9 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
|
|||||||
if (buttonNum == 0)
|
if (buttonNum == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
|
std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
|
||||||
shared_ptr<ItemInstance> carried = playerInventory->getCarried();
|
std::shared_ptr<ItemInstance> carried = playerInventory->getCarried();
|
||||||
shared_ptr<ItemInstance> clicked = m_menu->getSlot(currentIndex)->getItem();
|
std::shared_ptr<ItemInstance> clicked = m_menu->getSlot(currentIndex)->getItem();
|
||||||
if (clicked != NULL)
|
if (clicked != NULL)
|
||||||
{
|
{
|
||||||
playerInventory->setCarried(ItemInstance::clone(clicked));
|
playerInventory->setCarried(ItemInstance::clone(clicked));
|
||||||
@@ -928,7 +928,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
|
|||||||
quickKeyHeld = FALSE;
|
quickKeyHeld = FALSE;
|
||||||
}
|
}
|
||||||
m_menu->clicked(currentIndex, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, pMinecraft->localplayers[getPad()]);
|
m_menu->clicked(currentIndex, buttonNum, quickKeyHeld?AbstractContainerMenu::CLICK_QUICK_MOVE:AbstractContainerMenu::CLICK_PICKUP, pMinecraft->localplayers[getPad()]);
|
||||||
shared_ptr<ItemInstance> newItem = m_menu->getSlot(currentIndex)->getItem();
|
std::shared_ptr<ItemInstance> newItem = m_menu->getSlot(currentIndex)->getItem();
|
||||||
// call this function to synchronize multiplayer item bar
|
// call this function to synchronize multiplayer item bar
|
||||||
pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(newItem, currentIndex - (int)m_menu->slots->size() + 9 + InventoryMenu::USE_ROW_SLOT_START);
|
pMinecraft->localgameModes[getPad()]->handleCreativeModeItemAdd(newItem, currentIndex - (int)m_menu->slots->size() + 9 + InventoryMenu::USE_ROW_SLOT_START);
|
||||||
|
|
||||||
@@ -941,7 +941,7 @@ void IUIScene_CreativeMenu::handleSlotListClicked(ESceneSection eSection, int bu
|
|||||||
m_iCurrSlotX = m_creativeSlotX;
|
m_iCurrSlotX = m_creativeSlotX;
|
||||||
m_iCurrSlotY = m_creativeSlotY;
|
m_iCurrSlotY = m_creativeSlotY;
|
||||||
|
|
||||||
shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
|
std::shared_ptr<Inventory> playerInventory = pMinecraft->localplayers[getPad()]->inventory;
|
||||||
playerInventory->setCarried(nullptr);
|
playerInventory->setCarried(nullptr);
|
||||||
m_bCarryingCreativeItem = false;
|
m_bCarryingCreativeItem = false;
|
||||||
}
|
}
|
||||||
@@ -970,14 +970,14 @@ bool IUIScene_CreativeMenu::CanHaveFocus( ESceneSection eSection )
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IUIScene_CreativeMenu::getEmptyInventorySlot(shared_ptr<ItemInstance> item, int &slotX)
|
bool IUIScene_CreativeMenu::getEmptyInventorySlot(std::shared_ptr<ItemInstance> item, int &slotX)
|
||||||
{
|
{
|
||||||
bool sameItemFound = false;
|
bool sameItemFound = false;
|
||||||
bool emptySlotFound = false;
|
bool emptySlotFound = false;
|
||||||
// Jump to the slot with this item already on it, if we can stack more
|
// Jump to the slot with this item already on it, if we can stack more
|
||||||
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
|
for(unsigned int i = TabSpec::MAX_SIZE; i < TabSpec::MAX_SIZE + 9; ++i)
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> slotItem = m_menu->getSlot(i)->getItem();
|
std::shared_ptr<ItemInstance> slotItem = m_menu->getSlot(i)->getItem();
|
||||||
if( slotItem != NULL && slotItem->sameItem(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() ))
|
if( slotItem != NULL && slotItem->sameItem(item) && (slotItem->GetCount() + item->GetCount() <= item->getMaxStackSize() ))
|
||||||
{
|
{
|
||||||
sameItemFound = true;
|
sameItemFound = true;
|
||||||
@@ -1020,7 +1020,7 @@ int IUIScene_CreativeMenu::getSectionStartOffset(ESceneSection eSection)
|
|||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
bool IUIScene_CreativeMenu::overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||||
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT)
|
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT)
|
||||||
{
|
{
|
||||||
bool _override = false;
|
bool _override = false;
|
||||||
|
|||||||
@@ -74,21 +74,21 @@ public:
|
|||||||
class ItemPickerMenu : public AbstractContainerMenu
|
class ItemPickerMenu : public AbstractContainerMenu
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
shared_ptr<SimpleContainer> creativeContainer;
|
std::shared_ptr<SimpleContainer> creativeContainer;
|
||||||
shared_ptr<Inventory> inventory;
|
std::shared_ptr<Inventory> inventory;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ItemPickerMenu( shared_ptr<SimpleContainer> creativeContainer, shared_ptr<Inventory> inventory );
|
ItemPickerMenu( std::shared_ptr<SimpleContainer> creativeContainer, std::shared_ptr<Inventory> inventory );
|
||||||
|
|
||||||
virtual bool stillValid(shared_ptr<Player> player);
|
virtual bool stillValid(std::shared_ptr<Player> player);
|
||||||
bool isOverrideResultClick(int slotNum, int buttonNum);
|
bool isOverrideResultClick(int slotNum, int buttonNum);
|
||||||
protected:
|
protected:
|
||||||
// 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative
|
// 4J Stu - Brought forward from 1.2 to fix infinite recursion bug in creative
|
||||||
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, shared_ptr<Player> player) { } // do nothing
|
virtual void loopClick(int slotIndex, int buttonNum, bool quickKeyHeld, std::shared_ptr<Player> player) { } // do nothing
|
||||||
} *itemPickerMenu;
|
} *itemPickerMenu;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
static vector< shared_ptr<ItemInstance> > categoryGroups[eCreativeInventoryGroupsCount];
|
static vector< std::shared_ptr<ItemInstance> > categoryGroups[eCreativeInventoryGroupsCount];
|
||||||
// 4J JEV - Tabs
|
// 4J JEV - Tabs
|
||||||
static TabSpec **specs;
|
static TabSpec **specs;
|
||||||
|
|
||||||
@@ -112,11 +112,11 @@ protected:
|
|||||||
virtual void handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld);
|
virtual void handleOutsideClicked(int iPad, int buttonNum, BOOL quickKeyHeld);
|
||||||
virtual void handleAdditionalKeyPress(int iAction);
|
virtual void handleAdditionalKeyPress(int iAction);
|
||||||
virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld);
|
virtual void handleSlotListClicked(ESceneSection eSection, int buttonNum, BOOL quickKeyHeld);
|
||||||
bool getEmptyInventorySlot(shared_ptr<ItemInstance> item, int &slotX);
|
bool getEmptyInventorySlot(std::shared_ptr<ItemInstance> item, int &slotX);
|
||||||
int getSectionStartOffset(ESceneSection eSection);
|
int getSectionStartOffset(ESceneSection eSection);
|
||||||
virtual bool IsSectionSlotList( ESceneSection eSection );
|
virtual bool IsSectionSlotList( ESceneSection eSection );
|
||||||
virtual bool CanHaveFocus( ESceneSection eSection );
|
virtual bool CanHaveFocus( ESceneSection eSection );
|
||||||
|
|
||||||
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
virtual bool overrideTooltips(ESceneSection sectionUnderPointer, std::shared_ptr<ItemInstance> itemUnderPointer, bool bIsItemCarried, bool bSlotHasItem, bool bCarriedIsSameAsSlot, int iSlotStackSizeRemaining,
|
||||||
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT);
|
EToolTipItem &buttonA, EToolTipItem &buttonX, EToolTipItem &buttonY, EToolTipItem &buttonRT);
|
||||||
};
|
};
|
||||||
@@ -16,7 +16,7 @@ IUIScene_TradingMenu::IUIScene_TradingMenu()
|
|||||||
m_bHasUpdatedOnce = false;
|
m_bHasUpdatedOnce = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<Merchant> IUIScene_TradingMenu::getMerchant()
|
std::shared_ptr<Merchant> IUIScene_TradingMenu::getMerchant()
|
||||||
{
|
{
|
||||||
return m_merchant;
|
return m_merchant;
|
||||||
}
|
}
|
||||||
@@ -70,9 +70,9 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||||||
if(!activeRecipe->isDeprecated())
|
if(!activeRecipe->isDeprecated())
|
||||||
{
|
{
|
||||||
// Do we have the ingredients?
|
// Do we have the ingredients?
|
||||||
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
std::shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
||||||
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
std::shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||||
int buyBMatches = player->inventory->countMatches(buyBItem);
|
int buyBMatches = player->inventory->countMatches(buyBItem);
|
||||||
if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) )
|
if( (buyAItem != NULL && buyAMatches >= buyAItem->count) && (buyBItem == NULL || buyBMatches >= buyBItem->count) )
|
||||||
@@ -84,7 +84,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||||||
player->inventory->removeResources(buyBItem);
|
player->inventory->removeResources(buyBItem);
|
||||||
|
|
||||||
// Add the item we have purchased
|
// Add the item we have purchased
|
||||||
shared_ptr<ItemInstance> result = activeRecipe->getSellItem()->copy();
|
std::shared_ptr<ItemInstance> result = activeRecipe->getSellItem()->copy();
|
||||||
if(!player->inventory->add( result ) )
|
if(!player->inventory->add( result ) )
|
||||||
{
|
{
|
||||||
player->drop(result);
|
player->drop(result);
|
||||||
@@ -92,7 +92,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||||||
|
|
||||||
// Send a packet to the server
|
// Send a packet to the server
|
||||||
int actualShopItem = m_activeOffers.at(selectedShopItem).second;
|
int actualShopItem = m_activeOffers.at(selectedShopItem).second;
|
||||||
player->connection->send( shared_ptr<TradeItemPacket>( new TradeItemPacket(m_menu->containerId, actualShopItem) ) );
|
player->connection->send( std::shared_ptr<TradeItemPacket>( new TradeItemPacket(m_menu->containerId, actualShopItem) ) );
|
||||||
|
|
||||||
updateDisplay();
|
updateDisplay();
|
||||||
}
|
}
|
||||||
@@ -149,7 +149,7 @@ bool IUIScene_TradingMenu::handleKeyDown(int iPad, int iAction, bool bRepeat)
|
|||||||
ByteArrayOutputStream rawOutput;
|
ByteArrayOutputStream rawOutput;
|
||||||
DataOutputStream output(&rawOutput);
|
DataOutputStream output(&rawOutput);
|
||||||
output.writeInt(actualShopItem);
|
output.writeInt(actualShopItem);
|
||||||
Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return handled;
|
return handled;
|
||||||
@@ -203,7 +203,7 @@ void IUIScene_TradingMenu::updateDisplay()
|
|||||||
ByteArrayOutputStream rawOutput;
|
ByteArrayOutputStream rawOutput;
|
||||||
DataOutputStream output(&rawOutput);
|
DataOutputStream output(&rawOutput);
|
||||||
output.writeInt(firstValidTrade);
|
output.writeInt(firstValidTrade);
|
||||||
Minecraft::GetInstance()->getConnection(getPad())->send(shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
Minecraft::GetInstance()->getConnection(getPad())->send(std::shared_ptr<CustomPayloadPacket>( new CustomPayloadPacket(CustomPayloadPacket::TRADER_SELECTION_PACKET, rawOutput.toByteArray())));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -248,8 +248,8 @@ void IUIScene_TradingMenu::updateDisplay()
|
|||||||
wstring offerDescription = GetItemDescription(activeRecipe->getSellItem(), unformattedStrings);
|
wstring offerDescription = GetItemDescription(activeRecipe->getSellItem(), unformattedStrings);
|
||||||
setOfferDescription(offerDescription, unformattedStrings);
|
setOfferDescription(offerDescription, unformattedStrings);
|
||||||
|
|
||||||
shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
std::shared_ptr<ItemInstance> buyAItem = activeRecipe->getBuyAItem();
|
||||||
shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
std::shared_ptr<ItemInstance> buyBItem = activeRecipe->getBuyBItem();
|
||||||
|
|
||||||
setRequest1Item(buyAItem);
|
setRequest1Item(buyAItem);
|
||||||
setRequest2Item(buyBItem);
|
setRequest2Item(buyBItem);
|
||||||
@@ -262,7 +262,7 @@ void IUIScene_TradingMenu::updateDisplay()
|
|||||||
|
|
||||||
bool canMake = true;
|
bool canMake = true;
|
||||||
|
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||||
if(buyAMatches > 0)
|
if(buyAMatches > 0)
|
||||||
{
|
{
|
||||||
@@ -321,10 +321,10 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe)
|
|||||||
{
|
{
|
||||||
if(recipe->isDeprecated()) return false;
|
if(recipe->isDeprecated()) return false;
|
||||||
|
|
||||||
shared_ptr<ItemInstance> buyAItem = recipe->getBuyAItem();
|
std::shared_ptr<ItemInstance> buyAItem = recipe->getBuyAItem();
|
||||||
shared_ptr<ItemInstance> buyBItem = recipe->getBuyBItem();
|
std::shared_ptr<ItemInstance> buyBItem = recipe->getBuyBItem();
|
||||||
|
|
||||||
shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
std::shared_ptr<MultiplayerLocalPlayer> player = Minecraft::GetInstance()->localplayers[getPad()];
|
||||||
int buyAMatches = player->inventory->countMatches(buyAItem);
|
int buyAMatches = player->inventory->countMatches(buyAItem);
|
||||||
if(buyAMatches > 0)
|
if(buyAMatches > 0)
|
||||||
{
|
{
|
||||||
@@ -349,19 +349,19 @@ bool IUIScene_TradingMenu::canMake(MerchantRecipe *recipe)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void IUIScene_TradingMenu::setRequest1Item(shared_ptr<ItemInstance> item)
|
void IUIScene_TradingMenu::setRequest1Item(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void IUIScene_TradingMenu::setRequest2Item(shared_ptr<ItemInstance> item)
|
void IUIScene_TradingMenu::setRequest2Item(std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void IUIScene_TradingMenu::setTradeItem(int index, shared_ptr<ItemInstance> item)
|
void IUIScene_TradingMenu::setTradeItem(int index, std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring IUIScene_TradingMenu::GetItemDescription(shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings)
|
wstring IUIScene_TradingMenu::GetItemDescription(std::shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings)
|
||||||
{
|
{
|
||||||
if(item == NULL) return L"";
|
if(item == NULL) return L"";
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class IUIScene_TradingMenu
|
|||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
MerchantMenu *m_menu;
|
MerchantMenu *m_menu;
|
||||||
shared_ptr<Merchant> m_merchant;
|
std::shared_ptr<Merchant> m_merchant;
|
||||||
vector< pair<MerchantRecipe *,int> > m_activeOffers;
|
vector< pair<MerchantRecipe *,int> > m_activeOffers;
|
||||||
|
|
||||||
int m_validOffersCount;
|
int m_validOffersCount;
|
||||||
@@ -42,17 +42,17 @@ protected:
|
|||||||
|
|
||||||
virtual void setOfferDescription(const wstring &name, vector<wstring> &unformattedStrings) = 0;
|
virtual void setOfferDescription(const wstring &name, vector<wstring> &unformattedStrings) = 0;
|
||||||
|
|
||||||
virtual void setRequest1Item(shared_ptr<ItemInstance> item);
|
virtual void setRequest1Item(std::shared_ptr<ItemInstance> item);
|
||||||
virtual void setRequest2Item(shared_ptr<ItemInstance> item);
|
virtual void setRequest2Item(std::shared_ptr<ItemInstance> item);
|
||||||
virtual void setTradeItem(int index, shared_ptr<ItemInstance> item);
|
virtual void setTradeItem(int index, std::shared_ptr<ItemInstance> item);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void updateDisplay();
|
void updateDisplay();
|
||||||
bool canMake(MerchantRecipe *recipe);
|
bool canMake(MerchantRecipe *recipe);
|
||||||
wstring GetItemDescription(shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings);
|
wstring GetItemDescription(std::shared_ptr<ItemInstance> item, vector<wstring> &unformattedStrings);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
shared_ptr<Merchant> getMerchant();
|
std::shared_ptr<Merchant> getMerchant();
|
||||||
|
|
||||||
virtual int getPad() = 0;
|
virtual int getPad() = 0;
|
||||||
};
|
};
|
||||||
@@ -209,7 +209,7 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
|
|||||||
if( icon != TUTORIAL_NO_ICON )
|
if( icon != TUTORIAL_NO_ICON )
|
||||||
{
|
{
|
||||||
m_iconIsFoil = false;
|
m_iconIsFoil = false;
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(icon,1,iAuxVal));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -238,7 +238,7 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
|
|||||||
{
|
{
|
||||||
iAuxVal = 0;
|
iAuxVal = 0;
|
||||||
}
|
}
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(iconId,1,iAuxVal));
|
||||||
|
|
||||||
temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L"");
|
temp.replace(iconTagStartPos, iconEndPos - iconTagStartPos + closeTag.length(), L"");
|
||||||
}
|
}
|
||||||
@@ -247,63 +247,63 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
|
|||||||
// remove any icon text
|
// remove any icon text
|
||||||
else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*CraftingTableIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::workBench_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::workBench_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*SticksIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*SticksIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::stick_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::stick_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*PlanksIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::wood_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::wood_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*WoodenShovelIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::shovel_wood_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::shovel_wood_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*WoodenHatchetIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::hatchet_wood_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::hatchet_wood_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*WoodenPickaxeIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::pickAxe_wood_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::pickAxe_wood_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*FurnaceIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::furnace_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::furnace_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*WoodenDoorIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::door_wood,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::door_wood,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*TorchIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*TorchIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::torch_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::torch_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*BoatIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*BoatIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::boat_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::boat_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*FishingRodIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::fishingRod_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*FishIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*FishIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::fish_raw_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::fish_raw_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*MinecartIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Item::minecart_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Item::minecart_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*RailIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*RailIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::rail_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::rail_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*PoweredRailIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::goldenRail_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::goldenRail_Id,1,0));
|
||||||
}
|
}
|
||||||
else if(temp.find(L"{*StructuresIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*StructuresIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
@@ -317,7 +317,7 @@ wstring UIComponent_TutorialPopup::_SetIcon(int icon, int iAuxVal, bool isFoil,
|
|||||||
}
|
}
|
||||||
else if(temp.find(L"{*StoneIcon*}")!=wstring::npos)
|
else if(temp.find(L"{*StoneIcon*}")!=wstring::npos)
|
||||||
{
|
{
|
||||||
m_iconItem = shared_ptr<ItemInstance>(new ItemInstance(Tile::rock_Id,1,0));
|
m_iconItem = std::shared_ptr<ItemInstance>(new ItemInstance(Tile::rock_Id,1,0));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ private:
|
|||||||
bool m_lastSceneMovedLeft;
|
bool m_lastSceneMovedLeft;
|
||||||
bool m_bAllowFade;
|
bool m_bAllowFade;
|
||||||
Tutorial *m_tutorial;
|
Tutorial *m_tutorial;
|
||||||
shared_ptr<ItemInstance> m_iconItem;
|
std::shared_ptr<ItemInstance> m_iconItem;
|
||||||
bool m_iconIsFoil;
|
bool m_iconIsFoil;
|
||||||
//int m_iLocalPlayerC;
|
//int m_iLocalPlayerC;
|
||||||
|
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ void UIControl_EnchantmentBook::tickBook()
|
|||||||
{
|
{
|
||||||
UIScene_EnchantingMenu *m_containerScene = (UIScene_EnchantingMenu *)m_parentScene;
|
UIScene_EnchantingMenu *m_containerScene = (UIScene_EnchantingMenu *)m_parentScene;
|
||||||
EnchantmentMenu *menu = m_containerScene->getMenu();
|
EnchantmentMenu *menu = m_containerScene->getMenu();
|
||||||
shared_ptr<ItemInstance> current = menu->getSlot(0)->getItem();
|
std::shared_ptr<ItemInstance> current = menu->getSlot(0)->getItem();
|
||||||
if (!ItemInstance::matches(current, last))
|
if (!ItemInstance::matches(current, last))
|
||||||
{
|
{
|
||||||
last = current;
|
last = current;
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ private:
|
|||||||
//BOOL m_bDirty;
|
//BOOL m_bDirty;
|
||||||
//float m_fScale,m_fAlpha;
|
//float m_fScale,m_fAlpha;
|
||||||
//int m_iPad;
|
//int m_iPad;
|
||||||
shared_ptr<ItemInstance> last;
|
std::shared_ptr<ItemInstance> last;
|
||||||
|
|
||||||
//float m_fScreenWidth,m_fScreenHeight;
|
//float m_fScreenWidth,m_fScreenHeight;
|
||||||
//float m_fRawWidth,m_fRawHeight;
|
//float m_fRawWidth,m_fRawHeight;
|
||||||
|
|||||||
@@ -597,7 +597,7 @@ void UIScene::customDraw(IggyCustomDrawCallbackRegion *region)
|
|||||||
app.DebugPrintf("Handling custom draw for scene with no override!\n");
|
app.DebugPrintf("Handling custom draw for scene with no override!\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations)
|
void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations)
|
||||||
{
|
{
|
||||||
if (item!= NULL)
|
if (item!= NULL)
|
||||||
{
|
{
|
||||||
@@ -608,7 +608,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
|
|||||||
//Make sure that pMinecraft->player is the correct player so that player specific rendering
|
//Make sure that pMinecraft->player is the correct player so that player specific rendering
|
||||||
// eg clock and compass, are rendered correctly
|
// eg clock and compass, are rendered correctly
|
||||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player;
|
std::shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player;
|
||||||
if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad];
|
if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad];
|
||||||
|
|
||||||
// Setup GDraw, normal game render states and matrices
|
// Setup GDraw, normal game render states and matrices
|
||||||
@@ -688,7 +688,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
|
|||||||
|
|
||||||
//Make sure that pMinecraft->player is the correct player so that player specific rendering
|
//Make sure that pMinecraft->player is the correct player so that player specific rendering
|
||||||
// eg clock and compass, are rendered correctly
|
// eg clock and compass, are rendered correctly
|
||||||
shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player;
|
std::shared_ptr<MultiplayerLocalPlayer> oldPlayer = pMinecraft->player;
|
||||||
if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad];
|
if( iPad >= 0 && iPad < XUSER_MAX_COUNT ) pMinecraft->player = pMinecraft->localplayers[iPad];
|
||||||
|
|
||||||
_customDrawSlotControl(customDrawRegion, iPad, item, fAlpha, isFoil, bDecorations, false);
|
_customDrawSlotControl(customDrawRegion, iPad, item, fAlpha, isFoil, bDecorations, false);
|
||||||
@@ -701,7 +701,7 @@ void UIScene::customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iP
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer)
|
void UIScene::_customDrawSlotControl(CustomDrawData *region, int iPad, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer)
|
||||||
{
|
{
|
||||||
Minecraft *pMinecraft=Minecraft::GetInstance();
|
Minecraft *pMinecraft=Minecraft::GetInstance();
|
||||||
|
|
||||||
|
|||||||
@@ -187,7 +187,7 @@ public:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
//void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, int iID, int iCount, int iAuxVal, float fAlpha, bool isFoil, bool bDecorations);
|
//void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, int iID, int iCount, int iAuxVal, float fAlpha, bool isFoil, bool bDecorations);
|
||||||
void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations);
|
void customDrawSlotControl(IggyCustomDrawCallbackRegion *region, int iPad, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations);
|
||||||
|
|
||||||
bool m_cacheSlotRenders;
|
bool m_cacheSlotRenders;
|
||||||
bool m_needsCacheRendered;
|
bool m_needsCacheRendered;
|
||||||
@@ -196,14 +196,14 @@ private:
|
|||||||
typedef struct _CachedSlotDrawData
|
typedef struct _CachedSlotDrawData
|
||||||
{
|
{
|
||||||
CustomDrawData *customDrawRegion;
|
CustomDrawData *customDrawRegion;
|
||||||
shared_ptr<ItemInstance> item;
|
std::shared_ptr<ItemInstance> item;
|
||||||
float fAlpha;
|
float fAlpha;
|
||||||
bool isFoil;
|
bool isFoil;
|
||||||
bool bDecorations;
|
bool bDecorations;
|
||||||
} CachedSlotDrawData;
|
} CachedSlotDrawData;
|
||||||
vector<CachedSlotDrawData *> m_cachedSlotDraw;
|
vector<CachedSlotDrawData *> m_cachedSlotDraw;
|
||||||
|
|
||||||
void _customDrawSlotControl(CustomDrawData *region, int iPad, shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer);
|
void _customDrawSlotControl(CustomDrawData *region, int iPad, std::shared_ptr<ItemInstance> item, float fAlpha, bool isFoil, bool bDecorations, bool usingCommandBuffer);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// INPUT
|
// INPUT
|
||||||
|
|||||||
@@ -332,7 +332,7 @@ void UIScene_AbstractContainerMenu::customDraw(IggyCustomDrawCallbackRegion *reg
|
|||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return;
|
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return;
|
||||||
|
|
||||||
shared_ptr<ItemInstance> item = nullptr;
|
std::shared_ptr<ItemInstance> item = nullptr;
|
||||||
if(wcscmp((wchar_t *)region->name,L"pointerIcon")==0)
|
if(wcscmp((wchar_t *)region->name,L"pointerIcon")==0)
|
||||||
{
|
{
|
||||||
m_cacheSlotRenders = false;
|
m_cacheSlotRenders = false;
|
||||||
@@ -398,7 +398,7 @@ void UIScene_AbstractContainerMenu::setFocusToPointer(int iPad)
|
|||||||
m_focusSection = eSectionNone;
|
m_focusSection = eSectionNone;
|
||||||
}
|
}
|
||||||
|
|
||||||
shared_ptr<ItemInstance> UIScene_AbstractContainerMenu::getSlotItem(ESceneSection eSection, int iSlot)
|
std::shared_ptr<ItemInstance> UIScene_AbstractContainerMenu::getSlotItem(ESceneSection eSection, int iSlot)
|
||||||
{
|
{
|
||||||
Slot *slot = m_menu->getSlot( getSectionStartOffset(eSection) + iSlot );
|
Slot *slot = m_menu->getSlot( getSectionStartOffset(eSection) + iSlot );
|
||||||
if(slot) return slot->getItem();
|
if(slot) return slot->getItem();
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ protected:
|
|||||||
virtual void setSectionFocus(ESceneSection eSection, int iPad);
|
virtual void setSectionFocus(ESceneSection eSection, int iPad);
|
||||||
void setFocusToPointer(int iPad);
|
void setFocusToPointer(int iPad);
|
||||||
void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot);
|
void SetPointerText(const wstring &description, vector<wstring> &unformattedStrings, bool newSlot);
|
||||||
virtual shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot);
|
virtual std::shared_ptr<ItemInstance> getSlotItem(ESceneSection eSection, int iSlot);
|
||||||
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot);
|
virtual bool isSlotEmpty(ESceneSection eSection, int iSlot);
|
||||||
virtual void adjustPointerForSafeZone();
|
virtual void adjustPointerForSafeZone();
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class InventoryMenu;
|
|||||||
class UIScene_BrewingStandMenu : public UIScene_AbstractContainerMenu, public IUIScene_BrewingMenu
|
class UIScene_BrewingStandMenu : public UIScene_AbstractContainerMenu, public IUIScene_BrewingMenu
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
shared_ptr<BrewingStandTileEntity> m_brewingStand;
|
std::shared_ptr<BrewingStandTileEntity> m_brewingStand;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UIScene_BrewingStandMenu(int iPad, void *initData, UILayer *parentLayer);
|
UIScene_BrewingStandMenu(int iPad, void *initData, UILayer *parentLayer);
|
||||||
|
|||||||
@@ -435,7 +435,7 @@ void UIScene_CraftingMenu::customDraw(IggyCustomDrawCallbackRegion *region)
|
|||||||
Minecraft *pMinecraft = Minecraft::GetInstance();
|
Minecraft *pMinecraft = Minecraft::GetInstance();
|
||||||
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return;
|
if(pMinecraft->localplayers[m_iPad] == NULL || pMinecraft->localgameModes[m_iPad] == NULL) return;
|
||||||
|
|
||||||
shared_ptr<ItemInstance> item = nullptr;
|
std::shared_ptr<ItemInstance> item = nullptr;
|
||||||
int slotId = -1;
|
int slotId = -1;
|
||||||
float alpha = 1.0f;
|
float alpha = 1.0f;
|
||||||
bool decorations = true;
|
bool decorations = true;
|
||||||
@@ -606,21 +606,21 @@ void UIScene_CraftingMenu::hideAllIngredientsSlots()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene_CraftingMenu::setCraftHSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha)
|
void UIScene_CraftingMenu::setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha)
|
||||||
{
|
{
|
||||||
m_hSlotsInfo[iIndex].item = item;
|
m_hSlotsInfo[iIndex].item = item;
|
||||||
m_hSlotsInfo[iIndex].alpha = uiAlpha;
|
m_hSlotsInfo[iIndex].alpha = uiAlpha;
|
||||||
m_hSlotsInfo[iIndex].show = true;
|
m_hSlotsInfo[iIndex].show = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene_CraftingMenu::setCraftVSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha)
|
void UIScene_CraftingMenu::setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha)
|
||||||
{
|
{
|
||||||
m_vSlotsInfo[iIndex].item = item;
|
m_vSlotsInfo[iIndex].item = item;
|
||||||
m_vSlotsInfo[iIndex].alpha = uiAlpha;
|
m_vSlotsInfo[iIndex].alpha = uiAlpha;
|
||||||
m_vSlotsInfo[iIndex].show = true;
|
m_vSlotsInfo[iIndex].show = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene_CraftingMenu::setCraftingOutputSlotItem(int iPad, shared_ptr<ItemInstance> item)
|
void UIScene_CraftingMenu::setCraftingOutputSlotItem(int iPad, std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
m_craftingOutputSlotInfo.item = item;
|
m_craftingOutputSlotInfo.item = item;
|
||||||
m_craftingOutputSlotInfo.alpha = 31;
|
m_craftingOutputSlotInfo.alpha = 31;
|
||||||
@@ -632,7 +632,7 @@ void UIScene_CraftingMenu::setCraftingOutputSlotRedBox(bool show)
|
|||||||
m_slotListCraftingOutput.showSlotRedBox(0,show);
|
m_slotListCraftingOutput.showSlotRedBox(0,show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene_CraftingMenu::setIngredientSlotItem(int iPad, int index, shared_ptr<ItemInstance> item)
|
void UIScene_CraftingMenu::setIngredientSlotItem(int iPad, int index, std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
m_ingredientsSlotsInfo[index].item = item;
|
m_ingredientsSlotsInfo[index].item = item;
|
||||||
m_ingredientsSlotsInfo[index].alpha = 31;
|
m_ingredientsSlotsInfo[index].alpha = 31;
|
||||||
@@ -644,7 +644,7 @@ void UIScene_CraftingMenu::setIngredientSlotRedBox(int index, bool show)
|
|||||||
m_slotListIngredientsLayout.showSlotRedBox(index,show);
|
m_slotListIngredientsLayout.showSlotRedBox(index,show);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UIScene_CraftingMenu::setIngredientDescriptionItem(int iPad, int index, shared_ptr<ItemInstance> item)
|
void UIScene_CraftingMenu::setIngredientDescriptionItem(int iPad, int index, std::shared_ptr<ItemInstance> item)
|
||||||
{
|
{
|
||||||
m_ingredientsInfo[index].item = item;
|
m_ingredientsInfo[index].item = item;
|
||||||
m_ingredientsInfo[index].alpha = 31;
|
m_ingredientsInfo[index].alpha = 31;
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ class UIScene_CraftingMenu : public UIScene, public IUIScene_CraftingMenu
|
|||||||
private:
|
private:
|
||||||
typedef struct _SlotInfo
|
typedef struct _SlotInfo
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> item;
|
std::shared_ptr<ItemInstance> item;
|
||||||
unsigned int alpha;
|
unsigned int alpha;
|
||||||
bool show;
|
bool show;
|
||||||
|
|
||||||
@@ -182,13 +182,13 @@ protected:
|
|||||||
virtual void hideAllHSlots();
|
virtual void hideAllHSlots();
|
||||||
virtual void hideAllVSlots();
|
virtual void hideAllVSlots();
|
||||||
virtual void hideAllIngredientsSlots();
|
virtual void hideAllIngredientsSlots();
|
||||||
virtual void setCraftHSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha);
|
virtual void setCraftHSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha);
|
||||||
virtual void setCraftVSlotItem(int iPad, int iIndex, shared_ptr<ItemInstance> item, unsigned int uiAlpha);
|
virtual void setCraftVSlotItem(int iPad, int iIndex, std::shared_ptr<ItemInstance> item, unsigned int uiAlpha);
|
||||||
virtual void setCraftingOutputSlotItem(int iPad, shared_ptr<ItemInstance> item);
|
virtual void setCraftingOutputSlotItem(int iPad, std::shared_ptr<ItemInstance> item);
|
||||||
virtual void setCraftingOutputSlotRedBox(bool show);
|
virtual void setCraftingOutputSlotRedBox(bool show);
|
||||||
virtual void setIngredientSlotItem(int iPad, int index, shared_ptr<ItemInstance> item);
|
virtual void setIngredientSlotItem(int iPad, int index, std::shared_ptr<ItemInstance> item);
|
||||||
virtual void setIngredientSlotRedBox(int index, bool show);
|
virtual void setIngredientSlotRedBox(int index, bool show);
|
||||||
virtual void setIngredientDescriptionItem(int iPad, int index, shared_ptr<ItemInstance> item);
|
virtual void setIngredientDescriptionItem(int iPad, int index, std::shared_ptr<ItemInstance> item);
|
||||||
virtual void setIngredientDescriptionRedBox(int index, bool show);
|
virtual void setIngredientDescriptionRedBox(int index, bool show);
|
||||||
virtual void setIngredientDescriptionText(int index, LPCWSTR text);
|
virtual void setIngredientDescriptionText(int index, LPCWSTR text);
|
||||||
virtual void setShowCraftHSlot(int iIndex, bool show);
|
virtual void setShowCraftHSlot(int iIndex, bool show);
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ UIScene_CreativeMenu::UIScene_CreativeMenu(int iPad, void *_initData, UILayer *p
|
|||||||
|
|
||||||
InventoryScreenInput *initData = (InventoryScreenInput *)_initData;
|
InventoryScreenInput *initData = (InventoryScreenInput *)_initData;
|
||||||
|
|
||||||
shared_ptr<SimpleContainer> creativeContainer = shared_ptr<SimpleContainer>(new SimpleContainer( 0, TabSpec::MAX_SIZE ));
|
std::shared_ptr<SimpleContainer> creativeContainer = std::shared_ptr<SimpleContainer>(new SimpleContainer( 0, TabSpec::MAX_SIZE ));
|
||||||
itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory);
|
itemPickerMenu = new ItemPickerMenu(creativeContainer, initData->player->inventory);
|
||||||
|
|
||||||
Initialize( initData->iPad, itemPickerMenu, false, -1, eSectionInventoryCreativeUsing, eSectionInventoryCreativeMax, initData->bNavigateBack);
|
Initialize( initData->iPad, itemPickerMenu, false, -1, eSectionInventoryCreativeUsing, eSectionInventoryCreativeMax, initData->bNavigateBack);
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ void UIScene_DebugOverlay::customDraw(IggyCustomDrawCallbackRegion *region)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shared_ptr<ItemInstance> item = shared_ptr<ItemInstance>( new ItemInstance(itemId,1,0) );
|
std::shared_ptr<ItemInstance> item = std::shared_ptr<ItemInstance>( new ItemInstance(itemId,1,0) );
|
||||||
if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,false,false);
|
if(item != NULL) customDrawSlotControl(region,m_iPad,item,1.0f,false,false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ class InventoryMenu;
|
|||||||
class UIScene_FurnaceMenu : public UIScene_AbstractContainerMenu, public IUIScene_FurnaceMenu
|
class UIScene_FurnaceMenu : public UIScene_AbstractContainerMenu, public IUIScene_FurnaceMenu
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
shared_ptr<FurnaceTileEntity> m_furnace;
|
std::shared_ptr<FurnaceTileEntity> m_furnace;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
UIScene_FurnaceMenu(int iPad, void *initData, UILayer *parentLayer);
|
UIScene_FurnaceMenu(int iPad, void *initData, UILayer *parentLayer);
|
||||||
|
|||||||
@@ -161,7 +161,7 @@ void UIScene_HUD::tick()
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance;
|
std::shared_ptr<EnderDragon> boss = EnderDragonRenderer::bossInstance;
|
||||||
// 4J Stu - Don't clear this here as it's wiped for other players
|
// 4J Stu - Don't clear this here as it's wiped for other players
|
||||||
//EnderDragonRenderer::bossInstance = nullptr;
|
//EnderDragonRenderer::bossInstance = nullptr;
|
||||||
m_ticksWithNoBoss = 0;
|
m_ticksWithNoBoss = 0;
|
||||||
@@ -191,7 +191,7 @@ void UIScene_HUD::customDraw(IggyCustomDrawCallbackRegion *region)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
Slot *invSlot = pMinecraft->localplayers[m_iPad]->inventoryMenu->getSlot(InventoryMenu::USE_ROW_SLOT_START + slot);
|
Slot *invSlot = pMinecraft->localplayers[m_iPad]->inventoryMenu->getSlot(InventoryMenu::USE_ROW_SLOT_START + slot);
|
||||||
shared_ptr<ItemInstance> item = invSlot->getItem();
|
std::shared_ptr<ItemInstance> item = invSlot->getItem();
|
||||||
if(item != NULL)
|
if(item != NULL)
|
||||||
{
|
{
|
||||||
unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity);
|
unsigned char ucAlpha=app.GetGameSettings(ProfileManager.GetPrimaryPad(),eGameSetting_InterfaceOpacity);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user