• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Bład przy kompilacji

mldo

New Member
Joined
Jun 29, 2014
Messages
36
Reaction score
0
Jak w temacie: bład przy kompilacji na linux'ie z dodaniem kodu reset z Tematu:, kod błedu:
In file included from actions.cpp:23:
player.h: In member function 'void Player::setResets(int32_t)':
player.h:182: error: comparison of unsigned expression < 0 is always false
make[1]: *** [actions.o] Error 1
make[1]: *** Waiting for unfinished jobs....
cc1plus: warnings being treated as errors
In file included from house.h:27,
from beds.cpp:20:
player.h: In member function 'void Player::setResets(int32_t)':
player.h:182: error: comparison of unsigned expression < 0 is always false
cc1plus: warnings being treated as errors
In file included from party.h:20,
from chat.h:24,
from chat.cpp:18:
player.h: In member function 'void Player::setResets(int32_t)':
player.h:182: error: comparison of unsigned expression < 0 is always false
make[1]: *** [beds.o] Error 1
make[1]: *** [chat.o] Error 1​
Pomocy :d, TFS 0.4// Tibia 8.6
 
Lepiej pokaz linijke 182 z player.h. Tak czy inaczej, kod sprawdza gdzies czy uint*_t jest < 0, a uint nigdy nie bedzie mniejszy od 0.
 
Kod: player.h 182
void setResets(int32_t amount) { resets += amount; if (resets < 0) {resets = 0;} }

zmieniłem resets < 0 na 1, i teraz dalszy bład:
game.cpp: In member function 'bool Game::combatChangeHealth(CombatType_t, Creature*, Creature*, int32_t, MagicEffect_t, Color_t, bool)':
game.cpp:4302: error: no matching function for call to 'min(int64_t, int32_t&)'
game.cpp:4326: error: no matching function for call to 'min(int64_t, int32_t&)'
game.cpp: In member function 'bool Game::combatChangeMana(Creature*, Creature*, int32_t)':
game.cpp:4508: error: no matching function for call to 'min(int64_t, int32_t)'
make[1]: *** [game.o] Error 1
make[1]: *** Waiting for unfinished jobs....
mv -f .deps/iomap.Tpo .deps/iomap.Po
mv -f .deps/iomapserialize.Tpo .deps/iomapserialize.Po

4302: int32_t manaDamage = std::min(target->getMana(), damage);
4326: damage = std::min(target->getHealth(), damage);
4508: int32_t manaLoss = std::min(target->getMana(), -manaChange);
z życiem nic nie ryłem wiec dziwne :(
 
Last edited:
Udało sie skompilować, jednak gdy się loguje wywala bład:
Player.cpp 361 exception occurred, reason:
Network.cpp 1331: exception occurred (Type = 0)(MainWindow = 2998232), reason:
Control.cpp 1325 unknown packet type during game (Type = 0)

Linia:
Player.cpp 361:
WeaponType_t Player::getWeaponType()
{
if(Item* item = getWeapon(false))
return item->getWeaponType();
< ta linia(nic nie ma)
return WEAPON_NONE;
}​
 
zmieniłem w protocolgame.cpp -> wyglad z:
msg->put((uint16_t)std::ceil((float)player->getMana() * 100 / std::max(player->getMaxMana(), 1)));
msg->put((uint16_t)100);
na:
if (player->getPlayerInfo(PLAYERINFO_MAXMANA) > 0)
{
msg->put<uint16_t>(player->getPlayerInfo(PLAYERINFO_MANA) * 100 / player->getPlayerInfo(PLAYERINFO_MAXMANA));
msg->put<uint16_t>(100);
}
else
{
msg->put<uint16_t>(0);
msg->put<uint16_t>(0);
}
jednak na duzej ilosci many/hp nie pokazuje w % tylko liczby np 0,2, 65522
 
Last edited:
To nie jest raport z silnika, tylko z cipsoftowego klienta, nie o ten Player.cpp chodzi, a blad jest gdzies w protocolgame, nie wiem, co tam edytowales, bo nie mam konta na tamtym forum.
 
miałem zrobione %hp, nadal bym chciał mieć ale problem jest i wiesza strasznie przy obrażeniach(nie zmienia sie pasek), jest może temat jak dodać biblioteki, zakres liczb, chciałbym powiększyć ilosc posiadanego zycia, jednak nie wiem jak to zrobic :(
 
Back
Top