Fix wrong default value for players stepheight

- Also move player specific constants to player.h
This commit is contained in:
BlockMen 2015-12-19 20:20:46 +01:00
parent 0d27cd1c2a
commit 4b2bac6205
5 changed files with 20 additions and 20 deletions

View File

@ -83,24 +83,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
// the main loop (related to TempMods and day/night)
//#define MAP_BLOCKSIZE 32
/*
Old stuff that shouldn't be hardcoded
*/
// Size of player's main inventory
#define PLAYER_INVENTORY_SIZE (8*4)
// Maximum hit points of a player
#define PLAYER_MAX_HP 20
// Maximal breath of a player
#define PLAYER_MAX_BREATH 11
// Number of different files to try to save a player to if the first fails
// (because of a case-insensitive filesystem)
// TODO: Use case-insensitive player names instead of this hack.
#define PLAYER_FILE_ALTERNATE_TRIES 1000
// For screenshots a serial number is appended to the filename + datetimestamp
// if filename + datetimestamp is not unique.
// This is the maximum number of attempts to try and add a serial to the end of

View File

@ -1599,7 +1599,7 @@ void GenericCAO::processMessage(const std::string &data)
if ((m_is_player && !m_is_local_player) && m_prop.nametag == "")
m_prop.nametag = m_name;
if (m_is_player) {
if (m_is_local_player) {
LocalPlayer *player = m_env->getLocalPlayer();
player->stepheight = m_prop.stepheight;
}

View File

@ -787,6 +787,7 @@ PlayerSAO::PlayerSAO(ServerEnvironment *env_, Player *player_, u16 peer_id_,
m_prop.colors.clear();
m_prop.colors.push_back(video::SColor(255, 255, 255, 255));
m_prop.spritediv = v2s16(1,1);
m_prop.stepheight = PLAYER_DEFAULT_STEPHEIGHT;
// end of default appearance
m_prop.is_visible = true;
m_prop.makes_footstep_sound = true;

View File

@ -58,7 +58,7 @@ LocalPlayer::LocalPlayer(IGameDef *gamedef, const char *name):
m_old_node_below_content(CONTENT_AIR),
m_can_jump(false),
m_cao(NULL),
stepheight(0.6 * BS)
stepheight(PLAYER_DEFAULT_STEPHEIGHT)
{
// Initialize hp to 0, so that no hearts will be shown if server
// doesn't support health points

View File

@ -31,6 +31,23 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#define PLAYERNAME_SIZE 20
// Size of player's main inventory
#define PLAYER_INVENTORY_SIZE (8*4)
// Maximum hit points of a player
#define PLAYER_MAX_HP 20
// Maximal breath of a player
#define PLAYER_MAX_BREATH 11
// Default stepheight of a player
#define PLAYER_DEFAULT_STEPHEIGHT 0.6 * BS
// Number of different files to try to save a player to if the first fails
// (because of a case-insensitive filesystem)
// TODO: Use case-insensitive player names instead of this hack.
#define PLAYER_FILE_ALTERNATE_TRIES 1000
#define PLAYERNAME_ALLOWED_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_"
#define PLAYERNAME_ALLOWED_CHARS_USER_EXPL "'a' to 'z', 'A' to 'Z', '0' to '9', '-', '_'"