mirror of
https://github.com/vcmi/vcmi.git
synced 2025-06-15 00:05:02 +02:00
code review
This commit is contained in:
@ -129,26 +129,26 @@ HeroTypeID CGameState::pickUnusedHeroTypeRandomly(const PlayerColor & owner)
|
||||
throw std::runtime_error("Can not allocate hero. All heroes are already used.");
|
||||
}
|
||||
|
||||
int CGameState::getDate(Date mode) const
|
||||
int CGameState::getDate(int d, Date mode)
|
||||
{
|
||||
int temp;
|
||||
switch (mode)
|
||||
{
|
||||
case Date::DAY:
|
||||
return day;
|
||||
return d;
|
||||
case Date::DAY_OF_WEEK: //day of week
|
||||
temp = (day)%7; // 1 - Monday, 7 - Sunday
|
||||
temp = (d)%7; // 1 - Monday, 7 - Sunday
|
||||
return temp ? temp : 7;
|
||||
case Date::WEEK: //current week
|
||||
temp = ((day-1)/7)+1;
|
||||
temp = ((d-1)/7)+1;
|
||||
if (!(temp%4))
|
||||
return 4;
|
||||
else
|
||||
return (temp%4);
|
||||
case Date::MONTH: //current month
|
||||
return ((day-1)/28)+1;
|
||||
return ((d-1)/28)+1;
|
||||
case Date::DAY_OF_MONTH: //day of month
|
||||
temp = (day)%28;
|
||||
temp = (d)%28;
|
||||
if (temp)
|
||||
return temp;
|
||||
else return 28;
|
||||
@ -156,6 +156,11 @@ int CGameState::getDate(Date mode) const
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CGameState::getDate(Date mode) const
|
||||
{
|
||||
return getDate(day, mode);
|
||||
}
|
||||
|
||||
CGameState::CGameState()
|
||||
{
|
||||
gs = this;
|
||||
|
Reference in New Issue
Block a user