-
Notifications
You must be signed in to change notification settings - Fork 1
/
cWeather.cpp
2226 lines (2031 loc) · 79 KB
/
cWeather.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#include "uox3.h"
#include "cWeather.hpp"
#include "townregion.h"
#include "cRaces.h"
#include "cServerDefinitions.h"
#include "ssection.h"
#include "cEffects.h"
#include "CPacketSend.h"
#include "scriptc.h"
#include "mapstuff.h"
#include "cScript.h"
#include "CJSMapping.h"
#include "combat.h"
namespace UOX
{
#define EFFECTIVE 2
const UI08 MAXVAL = 0;
const UI08 MINVAL = 1;
const UI08 CURRVAL = 2;
const UI08 TEMP = 0;
const UI08 WIND = 1;
cWeatherAb *Weather = NULL;
// Version History
// 1.0 Abaddon Unknown
// Initial implementation
// Based on a weatherSys structure system
// 2.0 Abaddon 11th April, 2001
// Rewritten system
// Each weather sys is a CWeather class
// PeriodicUpdate for CWeather also updates light level
// cWeatherAb simplified to access CWeather containers
// Replaced a new'd array with a vector of CWeather
CWeather::CWeather()
{
memset( weather, 0, sizeof( WeathPart ) * WEATHNUM );
ColdChance( 5 );
RainChance( 10 );
SnowChance( 1 );
HeatChance( 10 );
StormChance( 1 );
LightMin( 300 );
LightMax( 300 );
CurrentLight( 300 );
MaxTemp( 30 );
MinTemp( 5 );
RainTempDrop( 5 );
StormTempDrop( 10 );
ColdIntensityHigh( 0 );
HeatIntensityHigh( 35 );
StormIntensityHigh( 100 );
SnowIntensityHigh( 100 );
RainIntensityHigh( 100 );
StormIntensityLow( 0 );
SnowIntensityLow( 0 );
RainIntensityLow( 0 );
Temp( 15 );
MaxWindSpeed( 0 );
MinWindSpeed( 0 );
WindSpeed( 0 );
SnowThreshold( 15.0f );
}
CWeather::~CWeather()
{
}
//o---------------------------------------------------------------------------o
//| Function - bool HeatActive( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns true if the weather system is having a heat wave
//o---------------------------------------------------------------------------o
bool CWeather::HeatActive( void ) const
{
return weather[HEAT].Active;
}
//o---------------------------------------------------------------------------o
//| Function - bool ColdActive( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns true if the weather system undergoing a cold snap
//o---------------------------------------------------------------------------o
bool CWeather::ColdActive( void ) const
{
return weather[COLD].Active;
}
//o---------------------------------------------------------------------------o
//| Function - R32 CurrentLight( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the current light level of the system, IF
//| LightMin and LightMax are less than 300
//o---------------------------------------------------------------------------o
R32 CWeather::CurrentLight( void ) const
{
return light[CURRVAL];
}
//o---------------------------------------------------------------------------o
//| Function - void CurrentLight( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the current light value to value
//o---------------------------------------------------------------------------o
void CWeather::CurrentLight( R32 value )
{
light[CURRVAL] = value;
}
//o---------------------------------------------------------------------------o
//| Function - bool PeriodicUpdate( void )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Updates the current light level of the system and the
//| current temperature of the system.
//| Wind is not currently updated
//o---------------------------------------------------------------------------o
bool CWeather::PeriodicUpdate( void )
{
R32 currTemp;
UI08 hour = cwmWorldState->ServerData()->ServerTimeHours();
UI08 minute = cwmWorldState->ServerData()->ServerTimeMinutes();
bool ampm = cwmWorldState->ServerData()->ServerTimeAMPM();
if( StormDelay() && StormBrewing() )
StormActive( true );
else if( StormBrewing() )
StormDelay( true );
if( LightMin() < 300 && LightMax() < 300 )
{
R32 hourIncrement = static_cast<R32>(fabs( ( LightMax() - LightMin() ) / 12.0f )); // we want the amount to subtract from LightMax in the morning / add to LightMin in evening
R32 minuteIncrement = hourIncrement / 60.0f;
R32 tempLight = hourIncrement * (R32)hour + minuteIncrement * (R32)minute;
if( ampm )
CurrentLight( LightMin() + tempLight );
else
CurrentLight( LightMax() - tempLight );
}
R32 effTempMax = EffectiveMaxTemp();
R32 effTempMin = EffectiveMinTemp();
R32 tempHourIncrement = static_cast<R32>(fabs( ( effTempMax - effTempMin ) / 12.0f ));
R32 tempMinuteIncrement = tempHourIncrement / 60.0f;
R32 tempLightChange = tempHourIncrement * (R32)hour + tempMinuteIncrement * (R32)minute;
if( ampm )
currTemp = effTempMax - tempLightChange; // maximum temperature minus time
else
currTemp = effTempMin + tempLightChange; // minimum temperature plus time
if( StormActive() )
{
currTemp -= StormTempDrop();
if ( currTemp < 0 )
currTemp = 0;
}
else if( RainActive() )
{
currTemp -= RainTempDrop();
if ( currTemp < 0 )
currTemp = 0;
}
Temp( currTemp );
return true;
}
//o---------------------------------------------------------------------------o
//| Function - void NewDay( void )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the system up for a new day
//| Heat wave, cold snap are calculated
//o---------------------------------------------------------------------------o
void CWeather::NewDay( void )
{
bool isHeatWave = false, isColdDay = false;
R32 effTempMax = MaxTemp();
R32 effTempMin = MinTemp();
R32 currentTemp;
if( (UI08)RandomNum( 0, 100 ) <= HeatChance() )
{
isHeatWave = true;
currentTemp = RandomNum( (int)effTempMax, (int)HeatIntensityHigh() );
effTempMax = currentTemp;
effTempMin = currentTemp;
}
else if( (UI08)RandomNum( 0, 100 ) <= ColdChance() )
{
isColdDay = true;
currentTemp = RandomNum( (int)ColdIntensityHigh(), (int)effTempMin );
effTempMax = currentTemp;
effTempMin = currentTemp;
}
HeatActive( isHeatWave );
ColdActive( isColdDay );
EffectiveMaxTemp( effTempMax );
EffectiveMinTemp( effTempMin );
}
//o---------------------------------------------------------------------------o
//| Function - void NewHour( void )
//| Date - 16th Feb, 2006
//| Programmer - grimson
//o---------------------------------------------------------------------------o
//| Purpose - Calculates rain, snow and storm changes.
//o---------------------------------------------------------------------------o
void CWeather::NewHour( void )
{
bool isSnowing = false, isRaining = false, isStorm = false;
if( (UI08)RandomNum( 0, 100 ) <= StormChance() )
{
isStorm = true;
}
if( (UI08)RandomNum( 0, 100 ) <= SnowChance() )
{
isSnowing = true;
}
if( (UI08)RandomNum( 0, 100 ) <= RainChance() )
{
isRaining = true;
}
if( !isStorm ) {
StormDelay( false );
StormActive( false );
}
SnowActive( isSnowing );
RainActive( isRaining );
StormBrewing( isStorm );
}
//o---------------------------------------------------------------------------o
//| Function - SI08 Intensity( UI08 weathType ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the intensity of the weather weathType
//o---------------------------------------------------------------------------o
SI08 CWeather::IntensityHigh( UI08 weathType ) const
{
return weather[weathType].IntensityHigh;
}
SI08 CWeather::IntensityLow( UI08 weathType ) const
{
return weather[weathType].IntensityLow;
}
//o---------------------------------------------------------------------------o
//| Function - void Intensity( UI08 weathType, SI08 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the intensity of weather weathType to value
//o---------------------------------------------------------------------------o
void CWeather::IntensityHigh( UI08 weathType, SI08 value )
{
weather[weathType].IntensityHigh = value;
}
void CWeather::IntensityLow( UI08 weathType, SI08 value )
{
weather[weathType].IntensityLow = value;
}
//o---------------------------------------------------------------------------o
//| Function - SI08 Chance( UI08 weathType ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the chance of weather weathType occurring
//o---------------------------------------------------------------------------o
SI08 CWeather::Chance( UI08 weathType ) const
{
return weather[weathType].Chance;
}
//o---------------------------------------------------------------------------o
//| Function - void HeatActive( UI08 weathType, SI08 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the chance of weather weathType occuring to value
//o---------------------------------------------------------------------------o
void CWeather::Chance( UI08 weathType, SI08 value )
{
weather[weathType].Chance = value;
}
//o---------------------------------------------------------------------------o
//| Function - R32 Value( UI08 valType, UI08 valOff ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the value associated with valType and valOff
//| valType is either MAXVAL, MINVAL, or CURRVAL
//| valOff is either WIND, TEMP or EFFECTIVE
//o---------------------------------------------------------------------------o
R32 CWeather::Value( UI08 valType, UI08 valOff ) const
{
return assortVals[valType][valOff];
}
//o---------------------------------------------------------------------------o
//| Function - void Value( UI08 valType, UI08 valOff, R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the value associated with valType and valOff to value
//| valType is either MAXVAL, MINVAL or CURRVAL
//| valOff is either WIND, TEMP or EFFECTIVE
//o---------------------------------------------------------------------------o
void CWeather::Value( UI08 valType, UI08 valOff, R32 value )
{
assortVals[valType][valOff] = value;
}
//o---------------------------------------------------------------------------o
//| Function - SI08 SnowIntensity( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the intensity of the snow (if any)
//o---------------------------------------------------------------------------o
SI08 CWeather::SnowIntensityHigh( void ) const
{
return weather[SNOW].IntensityHigh;
}
SI08 CWeather::SnowIntensityLow( void ) const
{
return weather[SNOW].IntensityLow;
}
//o---------------------------------------------------------------------------o
//| Function - bool RainIntensity( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the intensity of the rain, if any
//o---------------------------------------------------------------------------o
SI08 CWeather::RainIntensityHigh( void ) const
{
return weather[RAIN].IntensityHigh;
}
SI08 CWeather::RainIntensityLow( void ) const
{
return weather[RAIN].IntensityLow;
}
//o---------------------------------------------------------------------------o
//| Function - SI08 StormIntensity( void ) const
//| Date - 16th Feb, 2006
//| Programmer - grimson
//o---------------------------------------------------------------------------o
//| Purpose - Returns the intensity of the storm, if any
//o---------------------------------------------------------------------------o
SI08 CWeather::StormIntensityHigh( void ) const
{
return weather[STORM].IntensityHigh;
}
SI08 CWeather::StormIntensityLow( void ) const
{
return weather[STORM].IntensityLow;
}
//o---------------------------------------------------------------------------o
//| Function - bool HeatIntensity( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the intensity of the heat wave, if any
//o---------------------------------------------------------------------------o
SI08 CWeather::HeatIntensityHigh( void ) const
{
return weather[HEAT].IntensityHigh;
}
//o---------------------------------------------------------------------------o
//| Function - SI08 ColdIntensity( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the intensity of the cold snap, if any
//o---------------------------------------------------------------------------o
SI08 CWeather::ColdIntensityHigh( void ) const
{
return weather[COLD].IntensityHigh;
}
//o---------------------------------------------------------------------------o
//| Function - R32 MaxTemp( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the maximum temperature of the day (non effective)
//o---------------------------------------------------------------------------o
R32 CWeather::MaxTemp( void ) const
{
return Value( MAXVAL, TEMP );
}
//o---------------------------------------------------------------------------o
//| Function - R32 MinTemp( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the minimum temperature of the day (non effective)
//o---------------------------------------------------------------------------o
R32 CWeather::MinTemp( void ) const
{
return Value( MINVAL, TEMP );
}
//o---------------------------------------------------------------------------o
//| Function - R32 Temp( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the current temperature of the day
//o---------------------------------------------------------------------------o
R32 CWeather::Temp( void ) const
{
return Value( CURRVAL, TEMP );
}
//o---------------------------------------------------------------------------o
//| Function - R32 RainTempDrop( void ) const
//| Date - 19th Feb, 2006
//| Programmer - Grimson
//o---------------------------------------------------------------------------o
//| Purpose - Returns the amount the temperature drops when it rains
//o---------------------------------------------------------------------------o
R32 CWeather::RainTempDrop( void ) const
{
return rainTempDrop;
}
//o---------------------------------------------------------------------------o
//| Function - R32 StormTempDrop( void ) const
//| Date - 19th Feb, 2006
//| Programmer - Grimson
//o---------------------------------------------------------------------------o
//| Purpose - Returns the amount the temperature drops when it storms
//o---------------------------------------------------------------------------o
R32 CWeather::StormTempDrop( void ) const
{
return stormTempDrop;
}
//o---------------------------------------------------------------------------o
//| Function - R32 MaxWindSpeed( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the maximum wind speed for the day
//o---------------------------------------------------------------------------o
R32 CWeather::MaxWindSpeed( void ) const
{
return Value( MAXVAL, WIND );
}
//o---------------------------------------------------------------------------o
//| Function - R32 MinWindSpeed( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the minimum wind speed for the day
//o---------------------------------------------------------------------------o
R32 CWeather::MinWindSpeed( void ) const
{
return Value( MINVAL, WIND );
}
//o---------------------------------------------------------------------------o
//| Function - R32 WindSpeed( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the current wind speed
//o---------------------------------------------------------------------------o
R32 CWeather::WindSpeed( void ) const
{
return Value( CURRVAL, WIND );
}
//o---------------------------------------------------------------------------o
//| Function - SI08 RainChance( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the chance of rain for the day
//o---------------------------------------------------------------------------o
SI08 CWeather::RainChance( void ) const
{
return weather[RAIN].Chance;
}
//o---------------------------------------------------------------------------o
//| Function - SI08 SnowChance( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the chance of snow for the day
//o---------------------------------------------------------------------------o
SI08 CWeather::SnowChance( void ) const
{
return weather[SNOW].Chance;
}
//o---------------------------------------------------------------------------o
//| Function - SI08 StormChance( void ) const
//| Date - 16th Feb, 2006
//| Programmer - grimson
//o---------------------------------------------------------------------------o
//| Purpose - Returns the chance of storm for the day
//o---------------------------------------------------------------------------o
SI08 CWeather::StormChance( void ) const
{
return weather[STORM].Chance;
}
//o---------------------------------------------------------------------------o
//| Function - SI08 HeatChance( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the chance of a heat wave for the day
//o---------------------------------------------------------------------------o
SI08 CWeather::HeatChance( void ) const
{
return weather[HEAT].Chance;
}
//o---------------------------------------------------------------------------o
//| Function - SI08 ColdChance( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the chance of a cold snap for the day
//o---------------------------------------------------------------------------o
SI08 CWeather::ColdChance( void ) const
{
return weather[COLD].Chance;
}
//o---------------------------------------------------------------------------o
//| Function - R32 LightMin( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the minimum light level for the day (brightest)
//o---------------------------------------------------------------------------o
R32 CWeather::LightMin( void ) const
{
return light[MINVAL];
}
//o---------------------------------------------------------------------------o
//| Function - R32 LightMax( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the maximum light level for the day (darkest)
//o---------------------------------------------------------------------------o
R32 CWeather::LightMax( void ) const
{
return light[MAXVAL];
}
//o---------------------------------------------------------------------------o
//| Function - bool RainActive( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns true if the weather system is raining
//o---------------------------------------------------------------------------o
bool CWeather::RainActive( void ) const
{
return weather[RAIN].Active;
}
//o---------------------------------------------------------------------------o
//| Function - bool SnowActive( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns true if the weather system is snowing
//o---------------------------------------------------------------------------o
bool CWeather::SnowActive( void ) const
{
return weather[SNOW].Active;
}
//o---------------------------------------------------------------------------o
//| Function - bool StormBrewing( void ) const
//| Date - 16th Feb, 2006
//| Programmer - grimson
//o---------------------------------------------------------------------------o
//| Purpose - Returns true if the weather system is brewing a storm
//o---------------------------------------------------------------------------o
bool CWeather::StormBrewing( void ) const
{
return weather[STORMBREW].Active;
}
//o---------------------------------------------------------------------------o
//| Function - bool StormActive( void ) const
//| Date - 16th Feb, 2006
//| Programmer - grimson
//o---------------------------------------------------------------------------o
//| Purpose - Returns true if the weather system is storming
//o---------------------------------------------------------------------------o
bool CWeather::StormActive( void ) const
{
return weather[STORM].Active;
}
//o---------------------------------------------------------------------------o
//| Function - bool StormDelay( void ) const
//| Date - 17th Feb, 2006
//| Programmer - grimson
//o---------------------------------------------------------------------------o
//| Purpose - Returns true if the storm delay is over
//o---------------------------------------------------------------------------o
bool CWeather::StormDelay( void ) const
{
return stormDelay;
}
//o---------------------------------------------------------------------------o
//| Function - R32 SnowThreshold( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the temperature below which snow kicks in
//o---------------------------------------------------------------------------o
R32 CWeather::SnowThreshold( void ) const
{
return snowThreshold;
}
//o---------------------------------------------------------------------------o
//| Function - void WindSpeed( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the current wind speed
//o---------------------------------------------------------------------------o
void CWeather::WindSpeed( R32 value )
{
Value( CURRVAL, WIND, value );
}
//o---------------------------------------------------------------------------o
//| Function - void MaxWindSpeed( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the maximum wind speed
//o---------------------------------------------------------------------------o
void CWeather::MaxWindSpeed( R32 value )
{
Value( MAXVAL, WIND, value );
}
//o---------------------------------------------------------------------------o
//| Function - void MinWindSpeed( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the minimum wind speed
//o---------------------------------------------------------------------------o
void CWeather::MinWindSpeed( R32 value )
{
Value( MINVAL, WIND, value );
}
//o---------------------------------------------------------------------------o
//| Function - void MaxTemp( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the maximum (noneffective) temperature
//o---------------------------------------------------------------------------o
void CWeather::MaxTemp( R32 value )
{
Value( MAXVAL, TEMP, value );
}
//o---------------------------------------------------------------------------o
//| Function - void MinTemp( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the minimum (noneffective) temperature
//o---------------------------------------------------------------------------o
void CWeather::MinTemp( R32 value )
{
Value( MINVAL, TEMP, value );
}
//o---------------------------------------------------------------------------o
//| Function - void Temp( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the current temperature
//o---------------------------------------------------------------------------o
void CWeather::Temp( R32 value )
{
Value( CURRVAL, TEMP, value );
}
//o---------------------------------------------------------------------------o
//| Function - R32 RainTempDrop( void ) const
//| Date - 19th Feb, 2006
//| Programmer - Grimson
//o---------------------------------------------------------------------------o
//| Purpose - Sets the amount the temperature drops when it rains
//o---------------------------------------------------------------------------o
void CWeather::RainTempDrop( R32 value )
{
rainTempDrop = value;
}
//o---------------------------------------------------------------------------o
//| Function - R32 StormTempDrop( void ) const
//| Date - 19th Feb, 2006
//| Programmer - Grimson
//o---------------------------------------------------------------------------o
//| Purpose - Sets the amount the temperature drops when it storms
//o---------------------------------------------------------------------------o
void CWeather::StormTempDrop( R32 value )
{
stormTempDrop = value;
}
//o---------------------------------------------------------------------------o
//| Function - void SnowIntensity( SI08 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the snow intensity of the system
//o---------------------------------------------------------------------------o
void CWeather::SnowIntensityHigh( SI08 value )
{
weather[SNOW].IntensityHigh = value;
}
void CWeather::SnowIntensityLow( SI08 value )
{
weather[SNOW].IntensityLow = value;
}
//o---------------------------------------------------------------------------o
//| Function - void StormIntensity( SI08 value )
//| Date - 16th Feb, 2006
//| Programmer - grimson
//o---------------------------------------------------------------------------o
//| Purpose - Sets the storm intensity of the system
//o---------------------------------------------------------------------------o
void CWeather::StormIntensityHigh( SI08 value )
{
weather[STORM].IntensityHigh = value;
}
void CWeather::StormIntensityLow( SI08 value )
{
weather[STORM].IntensityLow = value;
}
//o---------------------------------------------------------------------------o
//| Function - void HeatIntensity( SI08 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the heat intensity of the system
//o---------------------------------------------------------------------------o
void CWeather::HeatIntensityHigh( SI08 value )
{
weather[HEAT].IntensityHigh = value;
}
//o---------------------------------------------------------------------------o
//| Function - void RainIntensity( SI08 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the rain intensity of the system
//o---------------------------------------------------------------------------o
void CWeather::RainIntensityHigh( SI08 value )
{
weather[RAIN].IntensityHigh = value;
}
void CWeather::RainIntensityLow( SI08 value )
{
weather[RAIN].IntensityLow = value;
}
//o---------------------------------------------------------------------------o
//| Function - void ColdIntensity( SI08 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the cold intensity of the system
//o---------------------------------------------------------------------------o
void CWeather::ColdIntensityHigh( SI08 value )
{
weather[COLD].IntensityHigh = value;
}
//o---------------------------------------------------------------------------o
//| Function - void RainChance( SI08 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the chance of rain in the system
//o---------------------------------------------------------------------------o
void CWeather::RainChance( SI08 value )
{
weather[RAIN].Chance = value;
}
//o---------------------------------------------------------------------------o
//| Function - void SnowChance( SI08 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the chance of snow in the system
//o---------------------------------------------------------------------------o
void CWeather::SnowChance( SI08 value )
{
weather[SNOW].Chance = value;
}
//o---------------------------------------------------------------------------o
//| Function - void StormChance( SI08 value )
//| Date - 16th Feb, 2006
//| Programmer - Grimson
//o---------------------------------------------------------------------------o
//| Purpose - Sets the chance of a storm brewing in the system
//o---------------------------------------------------------------------------o
void CWeather::StormChance( SI08 value )
{
weather[STORM].Chance = value;
}
//o---------------------------------------------------------------------------o
//| Function - void HeatChance( SI08 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the chance of a heat wave in the system
//o---------------------------------------------------------------------------o
void CWeather::HeatChance( SI08 value )
{
weather[HEAT].Chance = value;
}
//o---------------------------------------------------------------------------o
//| Function - void ColdChance( SI08 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the chance of a cold snap in the system
//o---------------------------------------------------------------------------o
void CWeather::ColdChance( SI08 value )
{
weather[COLD].Chance = value;
}
//o---------------------------------------------------------------------------o
//| Function - void SnowThreshold( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the temperature at which below it snows
//o---------------------------------------------------------------------------o
void CWeather::SnowThreshold( R32 value )
{
snowThreshold = value;
}
//o---------------------------------------------------------------------------o
//| Function - void LightMin( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the minimum (brightest) light value of the system
//o---------------------------------------------------------------------------o
void CWeather::LightMin( R32 value )
{
light[MINVAL] = value;
}
//o---------------------------------------------------------------------------o
//| Function - void LightMax( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the maximum (darkest) light value of the system
//o---------------------------------------------------------------------------o
void CWeather::LightMax( R32 value )
{
light[MAXVAL] = value;
}
//o---------------------------------------------------------------------------o
//| Function - R32 EffectiveMaxTemp( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the effective maximum temperature for the day
//o---------------------------------------------------------------------------o
R32 CWeather::EffectiveMaxTemp( void ) const
{
return Value( MAXVAL, EFFECTIVE );
}
//o---------------------------------------------------------------------------o
//| Function - R32 EffectiveMinTemp( void ) const
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Returns the effective minimum temperature for the day
//o---------------------------------------------------------------------------o
R32 CWeather::EffectiveMinTemp( void ) const
{
return Value( MINVAL, EFFECTIVE );
}
//o---------------------------------------------------------------------------o
//| Function - void EffectiveMaxTemp( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the maximum effective temperature for the day
//o---------------------------------------------------------------------------o
void CWeather::EffectiveMaxTemp( R32 value )
{
Value( MAXVAL, EFFECTIVE, value );
}
//o---------------------------------------------------------------------------o
//| Function - void EffectiveMinTemp( R32 value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets the minimum effective temperature for the day
//o---------------------------------------------------------------------------o
void CWeather::EffectiveMinTemp( R32 value )
{
Value( MINVAL, EFFECTIVE, value );
}
//o---------------------------------------------------------------------------o
//| Function - void RainActive( bool value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets whether rain is falling or not
//o---------------------------------------------------------------------------o
void CWeather::RainActive( bool value )
{
weather[RAIN].Active = value;
}
//o---------------------------------------------------------------------------o
//| Function - void SnowActive( bool value )
//| Date - 11th April, 2001
//| Programmer - Abaddon
//o---------------------------------------------------------------------------o
//| Purpose - Sets whether snow is falling or not
//o---------------------------------------------------------------------------o
void CWeather::SnowActive( bool value )
{
weather[SNOW].Active = value;
}
//o---------------------------------------------------------------------------o
//| Function - void StormBrewing( bool value )
//| Date - 16th Feb, 2006
//| Programmer - Grimson
//o---------------------------------------------------------------------------o
//| Purpose - Sets whether a storm is brewing or not
//o---------------------------------------------------------------------------o