This commit is contained in:
aozhiwei 2021-03-16 16:53:40 +08:00
parent 700578af9c
commit 807d90a745
2 changed files with 17 additions and 13 deletions

View File

@ -4372,14 +4372,18 @@ void Human::DoGetOnWithLoot(Loot* entity)
if (GetCar()) {
GetCar()->GetDown(this);
}
car_ = room->CreateCar(
this,
entity->GetEntityUniId(),
item_meta,
GetPos()
);
car_->GetOn(this);
Car* car = room->CreateCar(
this,
entity->GetEntityUniId(),
item_meta,
GetPos()
);
car->GetOn(this);
room->TakeOnCarObject(entity->GetEntityUniId());
room->NotifyUiUpdate();
#ifdef DEBUG
a8::XPrintf("DoGetOnWithLoot uniid:%d car_uniid:%d\n", {car->GetEntityUniId(), car->car_uniid});
#endif
}
void Human::DoGetOnWithCar(Car* car)

View File

@ -127,14 +127,14 @@ void Room::Update(int delta_time)
elapsed_time_ += delta_time;
while (elapsed_time_ >= 50) {
#ifdef DEBUG
#ifdef DEBUG1
long long begin_tick = a8::XGetTickCount();
long long end_tick = a8::XGetTickCount();
#endif
if (GetFrameNo() % 2 == 0) {
UpdateGas();
}
#ifdef DEBUG
#ifdef DEBUG1
end_tick = a8::XGetTickCount();
if (a8::XGetTickCount() - begin_tick > 1000) {
abort();
@ -144,7 +144,7 @@ void Room::Update(int delta_time)
for (auto& pair : moveable_hash_) {
pair.second->Update(50);
}
#ifdef DEBUG
#ifdef DEBUG1
end_tick = a8::XGetTickCount();
if (a8::XGetTickCount() - begin_tick > 1000) {
abort();
@ -154,7 +154,7 @@ void Room::Update(int delta_time)
if (GetFrameNo() % 2 == 0) {
SyncFrameData();
}
#ifdef DEBUG
#ifdef DEBUG1
end_tick = a8::XGetTickCount();
if (a8::XGetTickCount() - begin_tick > 1000) {
abort();
@ -552,7 +552,7 @@ Car* Room::CreateCar(Human* driver,
MetaData::Equip* item_meta,
const a8::Vec2& pos)
{
Car* car = EntityFactory::Instance()->MakeCar(car_uniid);
Car* car = EntityFactory::Instance()->MakeCar(AllocUniid());
car->car_uniid = car_uniid;
car->meta = item_meta;
car->room = this;
@ -564,8 +564,8 @@ Car* Room::CreateCar(Human* driver,
car->Initialize();
AddToEntityHash(car);
grid_service->AddCar(car);
car->BroadcastFullState(this);
car->RefreshView();
car->BroadcastFullState(this);
return car;
}