ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_misc.C
(Generate patch)

Comparing deliantra/server/server/c_misc.C (file contents):
Revision 1.62 by root, Sun Jul 1 05:00:19 2007 UTC vs.
Revision 1.63 by root, Fri Aug 10 05:25:16 2007 UTC

46 new_draw_info (NDI_UNIQUE, 0, op, "Heap checks out OK."); 46 new_draw_info (NDI_UNIQUE, 0, op, "Heap checks out OK.");
47 return 1; 47 return 1;
48} 48}
49#endif 49#endif
50 50
51int
52command_whereabouts (object *op, char *params)
53{
54 //TODO: should obviously not waste space in struct region for this.
55 /*
56 * reset the counter on the region, then use it to store the number of
57 * players there.
58 * I don't know how thread-safe this would be, I suspect not very....
59 */
60 for_all_regions (rgn)
61 rgn->counter = 0;
62
63 for_all_players (pl)
64 if (pl->ob->map)
65 ++pl->ob->region ()->counter;
66
67 /* we only want to print out by places with a 'longname' field... */
68 for_all_regions (rgn)
69 {
70 if (!rgn->longname && rgn->counter > 0)
71 {
72 if (rgn->parent)
73 {
74 rgn->parent->counter += rgn->counter;
75 rgn->counter = 0;
76 }
77 else /*uh oh, we shouldn't be here. */
78 LOG (llevError, "command_whereabouts() Region %s with no longname has no parent", &rgn->name);
79 }
80 }
81
82 new_draw_info_format (NDI_UNIQUE, 0, op, "In the world currently there are:");
83
84 for_all_regions (rgn)
85 if (rgn->counter)
86 new_draw_info_format (NDI_UNIQUE, 0, op, "%u players %s", rgn->counter, &rgn->longname);
87
88 return 1;
89}
90
91typedef struct 51typedef struct
92{ 52{
93 char namebuf[MAX_BUF]; 53 char namebuf[MAX_BUF];
94 int login_order; 54 int login_order;
95} chars_names; 55} chars_names;
96 56
97int 57int
98command_time (object *op, char *params) 58command_time (object *op, char *params)
99{ 59{
100 print_tod (op); 60 print_tod (op);
101 return 1;
102}
103
104int
105command_weather (object *op, char *params)
106{
107#if 0
108 int wx, wy, temp, sky;
109 char buf[MAX_BUF];
110
111 if (settings.dynamiclevel < 1)
112 return 1;
113
114 if (op->map == NULL)
115 return 1;
116
117 if (worldmap_to_weathermap (op->x, op->y, &wx, &wy, op->map) != 0)
118 return 1;
119
120 if (QUERY_FLAG (op, FLAG_WIZ))
121 {
122 /* dump the weather, Dm style! Yo! */
123 new_draw_info_format (NDI_UNIQUE, 0, op, "Real temp: %d", real_world_temperature (op->x, op->y, op->map));
124 new_draw_info_format (NDI_UNIQUE, 0, op, "Base temp: %d", weathermap[wx][wy].temp);
125 new_draw_info_format (NDI_UNIQUE, 0, op, "Humid: %d", weathermap[wx][wy].humid);
126 new_draw_info_format (NDI_UNIQUE, 0, op, "Wind: dir=%d speed=%d", weathermap[wx][wy].winddir, weathermap[wx][wy].windspeed);
127 new_draw_info_format (NDI_UNIQUE, 0, op, "Pressure: %d", weathermap[wx][wy].pressure);
128 new_draw_info_format (NDI_UNIQUE, 0, op, "Avg Elevation: %d", weathermap[wx][wy].avgelev);
129 new_draw_info_format (NDI_UNIQUE, 0, op, "Rainfall: %d Water: %d", weathermap[wx][wy].rainfall, weathermap[wx][wy].water);
130 }
131
132 temp = real_world_temperature (op->x, op->y, op->map);
133 new_draw_info_format (NDI_UNIQUE, 0, op, "It's currently %d degrees " "Centigrade out.", temp);
134
135 /* humid */
136 if (weathermap[wx][wy].humid < 20)
137 new_draw_info (NDI_UNIQUE, 0, op, "It is very dry.");
138 else if (weathermap[wx][wy].humid < 40)
139 new_draw_info (NDI_UNIQUE, 0, op, "It is very comfortable today.");
140 else if (weathermap[wx][wy].humid < 60)
141 new_draw_info (NDI_UNIQUE, 0, op, "It is a bit muggy.");
142 else if (weathermap[wx][wy].humid < 80)
143 new_draw_info (NDI_UNIQUE, 0, op, "It is muggy.");
144 else
145 new_draw_info (NDI_UNIQUE, 0, op, "It is uncomfortably muggy.");
146
147 /* wind */
148 switch (weathermap[wx][wy].winddir)
149 {
150 case 1:
151 sprintf (buf, "north");
152 break;
153 case 2:
154 sprintf (buf, "northeast");
155 break;
156 case 3:
157 sprintf (buf, "east");
158 break;
159 case 4:
160 sprintf (buf, "southeast");
161 break;
162 case 5:
163 sprintf (buf, "south");
164 break;
165 case 6:
166 sprintf (buf, "southwest");
167 break;
168 case 7:
169 sprintf (buf, "west");
170 break;
171 case 8:
172 sprintf (buf, "northwest");
173 break;
174 }
175 if (weathermap[wx][wy].windspeed < 5)
176 new_draw_info_format (NDI_UNIQUE, 0, op, "There is a mild breeze " "coming from the %s.", buf);
177 else if (weathermap[wx][wy].windspeed < 10)
178 new_draw_info_format (NDI_UNIQUE, 0, op, "There is a strong breeze " "coming from the %s.", buf);
179 else if (weathermap[wx][wy].windspeed < 15)
180 new_draw_info_format (NDI_UNIQUE, 0, op, "There is a light wind " "coming from the %s.", buf);
181 else if (weathermap[wx][wy].windspeed < 25)
182 new_draw_info_format (NDI_UNIQUE, 0, op, "There is a strong wind " "coming from the %s.", buf);
183 else if (weathermap[wx][wy].windspeed < 35)
184 new_draw_info_format (NDI_UNIQUE, 0, op, "There is a heavy wind " "coming from the %s.", buf);
185 else
186 new_draw_info_format (NDI_UNIQUE, 0, op, "The wind from the %s is " "incredibly strong!", buf);
187
188 sky = weathermap[wx][wy].sky;
189 if (temp <= 0 && sky > SKY_OVERCAST && sky < SKY_FOG)
190 sky += 10; /*let it snow */
191 switch (sky)
192 {
193 case SKY_CLEAR:
194 new_draw_info (NDI_UNIQUE, 0, op, "There isn''t a cloud in the sky.");
195 break;
196 case SKY_LIGHTCLOUD:
197 new_draw_info (NDI_UNIQUE, 0, op, "There are a few light clouds in the sky.");
198 break;
199 case SKY_OVERCAST:
200 new_draw_info (NDI_UNIQUE, 0, op, "The sky is cloudy and dreary.");
201 break;
202 case SKY_LIGHT_RAIN:
203 new_draw_info (NDI_UNIQUE, 0, op, "It is raining softly.");
204 break;
205 case SKY_RAIN:
206 new_draw_info (NDI_UNIQUE, 0, op, "It is raining.");
207 break;
208 case SKY_HEAVY_RAIN:
209 new_draw_info (NDI_UNIQUE, 0, op, "It is raining heavily.");
210 break;
211 case SKY_HURRICANE:
212 new_draw_info (NDI_UNIQUE, 0, op, "There is a heavy storm! You should go inside!");
213 break;
214 case SKY_FOG:
215 new_draw_info (NDI_UNIQUE, 0, op, "It''s foggy and miserable.");
216 break;
217 case SKY_HAIL:
218 new_draw_info (NDI_UNIQUE, 0, op, "It''s hailing out! Take cover!");
219 break;
220 case SKY_LIGHT_SNOW:
221 new_draw_info (NDI_UNIQUE, 0, op, "Snow is gently falling from the sky.");
222 break;
223 case SKY_SNOW:
224 new_draw_info (NDI_UNIQUE, 0, op, "It''s snowing out.");
225 break;
226 case SKY_HEAVY_SNOW:
227 new_draw_info (NDI_UNIQUE, 0, op, "The snow is falling very heavily now.");
228 break;
229 case SKY_BLIZZARD:
230 new_draw_info (NDI_UNIQUE, 0, op, "A full blown blizzard is in effect. You might want to take cover!");
231 break;
232 }
233#endif
234 return 1;
235}
236
237int
238command_hiscore (object *op, char *params)
239{
240 display_high_score (op, op == NULL ? 9999 : 50, params);
241 return 1; 61 return 1;
242} 62}
243 63
244int 64int
245command_debug (object *op, char *params) 65command_debug (object *op, char *params)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines