tui enable
in gdb, it’s useful if you have only one screenvoid CCharacter::Die(int Killer, int Weapon, bool SendKillMsg)
{
//my stuff
if(m_ExtraLives && m_pPlayer)
{
// dbg_msg("m_ExtraLives", "called");
Rescue();
m_ExtraLives--;
return;
}
it's working when the player get spiked, but not working when suicide (edited)delete
and the set to 0 and the Respawn()
are all things you do not want.if(pChr->m_ExtraLives && pPlayer)
{
pChr->m_ExtraLives--;
pChr->Rescue();
return;
}
pPlayer->m_LastKill = Server()->Tick();
pPlayer->KillCharacter(WEAPON_SELF);
pPlayer->Respawn();
now it's working like a charmvoid CCharacter::ExtraLives()
{
Rescue();
UnFreeze();
GameServer()->ExtraLiveParticle(this);
m_ExtraLives--;
}
std::vector<int> CCollision::GetMapIndices(vec2 PrevPos, vec2 Pos, unsigned MaxIndices) const
{
std::vector<int> vIndices;
float d = distance(PrevPos, Pos);
int End(d + 1);
if(!d)
{
int Nx = clamp((int)Pos.x / 32, 0, m_Width - 1);
int Ny = clamp((int)Pos.y / 32, 0, m_Height - 1);
int Index = Ny * m_Width + Nx;
if(TileExists(Index))
{
vIndices.push_back(Index);
return vIndices;
}
else
return vIndices;
}
else
{
int LastIndex = 0;
for(int i = 0; i < End; i++)
{
float a = i / d;
vec2 Tmp = mix(PrevPos, Pos, a);
int Nx = clamp((int)Tmp.x / 32, 0, m_Width - 1);
int Ny = clamp((int)Tmp.y / 32, 0, m_Height - 1);
int Index = Ny * m_Width + Nx;
if(TileExists(Index) && LastIndex != Index)
{
if(MaxIndices && vIndices.size() > MaxIndices)
return vIndices;
vIndices.push_back(Index);
LastIndex = Index;
}
}
return vIndices;
}
}
this abominationif(UnfreezeNeeded && UnFreeze())
{
UnfreezeNeeded = false;
}
i just added this to character::Tick() tui enable
in gdb, it’s useful if you have only one screen int CSnapshotStorage::Get(int Tick, int64_t *pTagtime, const CSnapshot **ppData, const CSnapshot **ppAltData) const
Get
is no fun and idk how many snap storages are therevoid CCharacter::RetractAttachedHooks()
{
CPlayer *pPlayer;
CCharacter *pChr;
for(int i; (i < MAX_CLIENTS) && (pPlayer = GameServer()->m_apPlayers[i]) && (pChr = pPlayer->GetCharacter()); i++)
{
if(pChr->Core()->HookedPlayer() == m_pPlayer->GetCID())
{
pChr->m_Core.SetHookedPlayer(-1);
pChr->m_Core.m_HookState = HOOK_RETRACT_START;
}
}
}
i == i // 3 + i % 3
)&
and |
btw (a & b) == c
is fine, a & (b == c)
is fine, but a & b == c
is a syntax error0 & 1 == 0
evaluates to 0
, but in python, it evaluates to True
rustfmt --edition=2021 --verbose lib.rs
Formatting src/lib.rs
Spent 0.001 secs in the parsing phase, and 0.013 secs in the formatting phase
that's all i get xdhi_closure!([a: i32, b: &i32], |arg: i32| -> i32 { arg + a + *b + 1 })
my custom explicit closure syntax xddcan't capture dynamic environment in a fn item
use the `|| { ... }` closure form instead
but i guess i'll just add to docs and call it a day xdd (edited)hi_closure!([a: i32, b: &i32], |arg: i32| -> i32 { arg + a + *b + 1 })
my custom explicit closure syntax xdd struct MyStruct {
a: i32,
}
impl MyStruct {
fn test<F>(&self, a_normal_closure: F) where F: Fn() {
a_normal_closure();
}
}
fn main() {
let a = Rc::new(RefCell::new(MyStruct {a: 1}));
let b = a.clone();
let c = a.borrow_mut();
c.test(|| b.borrow_mut().a += 1);
}