📄 tree.cpp
字号:
//// pedsim - A microscopic pedestrian simulation system. // Copyright (c) 2003 - 2004 by Christian Gloor// // You can redistribute and/or modify this program under the terms of// the GNU General Public License. See copying.txt for details.// //using namespace std;#include "main.h"#include "tree.h"extern TreeContainer tree;// ----------------------------------------------------// Name: constructor// Description: set intial values// Introduced: chgloor Monday, December 29, 2003 11:10:37// ----------------------------------------------------Ttree::Ttree() { static int staticid = 0; id = staticid++; x = 0; y = 0; vx = 0; vy = 0; energy = 100; dead = false; // well, who knows color = .5f + .5f * rand()/RAND_MAX; size = .3f + .4f * rand()/RAND_MAX; rotation = .0f + 360.0f * rand()/RAND_MAX;};// ----------------------------------------------------// Name: hit// Description: if an tree was hit by an agent // Introduced: chgloor Monday, December 29, 2003 14:06:36// ----------------------------------------------------void Ttree::hit() { energy = energy - 0.1 ; if (energy < 0) { dead = true; }};// ----------------------------------------------------// Name: move// Description: does nothing// Introduced: chgloor Monday, December 29, 2003 11:10:58// Return value: void// ----------------------------------------------------void Ttree::move() {}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -