mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Fixed a compile error on MSVC with abs(ui64).
Fixed crash when quest object is removed.
This commit is contained in:
parent
79f8e0ea3c
commit
9207e4f4a4
@ -48,6 +48,13 @@ namespace Colors
|
||||
const SDL_Color Maize = createColor(242, 226, 110); // http://en.wikipedia.org/wiki/Maize_%28color%29
|
||||
}
|
||||
|
||||
//MSVC gives an error when calling abs with ui64 -> we add template that will match calls with unsigned arg and return it
|
||||
template<typename T>
|
||||
typename boost::enable_if_c<boost::is_unsigned<T>::type, T>::type abs(T arg)
|
||||
{
|
||||
return arg;
|
||||
}
|
||||
|
||||
template<typename IntType>
|
||||
std::string makeNumberShort(IntType number) //the output is a string containing at most 5 characters [4 if positive] (eg. intead 10000 it gives 10k)
|
||||
{
|
||||
|
@ -308,14 +308,13 @@ DLL_LINKAGE void RemoveObject::applyGs( CGameState *gs )
|
||||
|
||||
return;
|
||||
}
|
||||
//FIXME: for some reason this code causes crash in Bonus System ?!
|
||||
|
||||
auto quest = dynamic_cast<const CQuest *>(obj);
|
||||
if (quest)
|
||||
{
|
||||
BOOST_FOREACH (auto player, gs->players)
|
||||
BOOST_FOREACH (auto &player, gs->players)
|
||||
{
|
||||
BOOST_FOREACH (auto q, player.second.quests)
|
||||
BOOST_FOREACH (auto &q, player.second.quests)
|
||||
{
|
||||
if (q.obj == obj)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user