1
This commit is contained in:
parent
7577b16ca3
commit
a234f2c2e5
@ -35,6 +35,15 @@ void Android::Initialize()
|
||||
{
|
||||
auto context = std::make_shared<BattleDataContext>();
|
||||
SetBattleContext(context);
|
||||
context->ForceInit
|
||||
(
|
||||
App::Instance()->AllocTempHeroUniId(),
|
||||
meta,
|
||||
App::Instance()->AllocTempWeaponUniId(),
|
||||
GetCurrWeapon()->meta,
|
||||
0,
|
||||
nullptr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -675,3 +675,27 @@ void App::FreeIMMsgQueue()
|
||||
}
|
||||
im_msg_mutex_->unlock();
|
||||
}
|
||||
|
||||
long long App::AllocTempHeroUniId()
|
||||
{
|
||||
if (curr_uniid_ < 1000) {
|
||||
curr_uniid_ = 1000;
|
||||
}
|
||||
if (curr_uniid_ > 100000000) {
|
||||
curr_uniid_ = 1001;
|
||||
}
|
||||
++curr_uniid_;
|
||||
return -curr_uniid_;
|
||||
}
|
||||
|
||||
long long App::AllocTempWeaponUniId()
|
||||
{
|
||||
if (curr_uniid_ < 1000) {
|
||||
curr_uniid_ = 1000;
|
||||
}
|
||||
if (curr_uniid_ > 100000000) {
|
||||
curr_uniid_ = 1000;
|
||||
}
|
||||
++curr_uniid_;
|
||||
return -curr_uniid_;
|
||||
}
|
||||
|
@ -38,6 +38,8 @@ public:
|
||||
bool HasFlag(int flag);
|
||||
void SetFlag(int flag);
|
||||
void UnSetFlag(int flag);
|
||||
long long AllocTempHeroUniId();
|
||||
long long AllocTempWeaponUniId();
|
||||
|
||||
private:
|
||||
void QuickExecute(int delta_time);
|
||||
@ -100,6 +102,8 @@ private:
|
||||
|
||||
std::map<long long, a8::XParams> context_hash_;
|
||||
|
||||
long long curr_uniid_ = 0;
|
||||
|
||||
public:
|
||||
int msgnode_size_ = 0 ;
|
||||
int working_msgnode_size_ = 0;
|
||||
|
@ -15,6 +15,8 @@
|
||||
#include "obstacle.h"
|
||||
#include "ability.h"
|
||||
#include "entityfactory.h"
|
||||
#include "app.h"
|
||||
|
||||
|
||||
Car::Car():Creature()
|
||||
{
|
||||
@ -54,6 +56,15 @@ void Car::Initialize()
|
||||
{
|
||||
auto context = std::make_shared<BattleDataContext>();
|
||||
SetBattleContext(context);
|
||||
context->ForceInit
|
||||
(
|
||||
App::Instance()->AllocTempHeroUniId(),
|
||||
hero_meta_,
|
||||
App::Instance()->AllocTempWeaponUniId(),
|
||||
GetCurrWeapon()->meta,
|
||||
0,
|
||||
nullptr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "bullet.h"
|
||||
#include "explosion.h"
|
||||
#include "roomobstacle.h"
|
||||
#include "app.h"
|
||||
|
||||
Hero::Hero():Creature()
|
||||
{
|
||||
@ -51,6 +52,15 @@ void Hero::Initialize()
|
||||
{
|
||||
auto context = std::make_shared<BattleDataContext>();
|
||||
SetBattleContext(context);
|
||||
context->ForceInit
|
||||
(
|
||||
App::Instance()->AllocTempHeroUniId(),
|
||||
meta,
|
||||
App::Instance()->AllocTempWeaponUniId(),
|
||||
GetCurrWeapon()->meta,
|
||||
0,
|
||||
nullptr
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user