[ScryMUD] SVN Commit Info r765 - branches/people/gingon/weather/mud/grrmud/server

scrymud at wanfear.com scrymud at wanfear.com
Thu Dec 16 01:27:57 PST 2004


Author: gingon
Date: 2004-12-16 01:27:56 -0800 (Thu, 16 Dec 2004)
New Revision: 765

Modified:
   branches/people/gingon/weather/mud/grrmud/server/misc.cc
   branches/people/gingon/weather/mud/grrmud/server/room.cc
   branches/people/gingon/weather/mud/grrmud/server/weather.cc
Log:
crash fixes, regen mod works correctly now and being struck by hail will wake peoeple up/break meditation.




Modified: branches/people/gingon/weather/mud/grrmud/server/misc.cc
===================================================================
--- branches/people/gingon/weather/mud/grrmud/server/misc.cc	2004-12-16 07:42:52 UTC (rev 764)
+++ branches/people/gingon/weather/mud/grrmud/server/misc.cc	2004-12-16 09:27:56 UTC (rev 765)
@@ -471,7 +471,7 @@
 //that never regen. I'll be watching the effects of this change closely and
 //will most likely adjust the algorithms based on what I discover.
 void do_regeneration_pcs() {
-   float adj = 1.0, posn_mod, align_mod = 1.0,env_mod;
+   float adj = 1.0, posn_mod, align_mod = 1.0,env_mod = 1.0;
    Cell<critter*> crit_cell;
    pc_list.head(crit_cell);
    critter* crit_ptr;
@@ -479,11 +479,11 @@
    //log("In do_regeneration_pcs\n");
 
    while ((crit_ptr = crit_cell.next())) {
-
-   /*   if(crit_ptr->getCurRoom()){
+      
+      if(crit_ptr->getCurRoom()->getWeather()!= wNONE){
          env_mod = weather_regen_mods[crit_ptr->getCurRoom()->getWeather()] *
             temperature_regen_mods[crit_ptr->getCurRoom()->getTemperature()];
-      }*/
+      }
       //no regen if we're fighting
       if ( crit_ptr->isFighting() ) {
          continue;

Modified: branches/people/gingon/weather/mud/grrmud/server/room.cc
===================================================================
--- branches/people/gingon/weather/mud/grrmud/server/room.cc	2004-12-16 07:42:52 UTC (rev 764)
+++ branches/people/gingon/weather/mud/grrmud/server/room.cc	2004-12-16 09:27:56 UTC (rev 765)
@@ -2847,6 +2847,8 @@
 
 WeatherType room::getWeather(){
 
+   if(!hasWeather()) return wNONE;
+   
    if(getFlag(38)){       //temperate
       return weather.climates[0].weather;
    }else if(getFlag(39)){ //savanah

Modified: branches/people/gingon/weather/mud/grrmud/server/weather.cc
===================================================================
--- branches/people/gingon/weather/mud/grrmud/server/weather.cc	2004-12-16 07:42:52 UTC (rev 764)
+++ branches/people/gingon/weather/mud/grrmud/server/weather.cc	2004-12-16 09:27:56 UTC (rev 765)
@@ -30,6 +30,10 @@
 #include "weather.h"
 #include <string2.h>
 
+//TODO fix critter.isSleeping()
+//TODO make wNONE, cNONE, tNONE valid array indexes
+//TODO make int_to_enum inline funciton
+
 //climate weather base
 const int temperate_weights[] = { 520,130,130,65,55,48,32,20,10,65,48,32,0};
 const int savanah_weights[] = { 520,100,90,32,28,24,16,10,5,5,0,0,0};
@@ -263,6 +267,12 @@
    }
 }
 
+
+
+inline void int_to_enum(void* e,int* i){
+   memcpy(&e,&i,sizeof(int));
+}
+
 void Weather::update(){
 
    int i = 0; 
@@ -309,9 +319,11 @@
       }
       //get our weather
       tmp = weather_prob.get(); 
-   }else tmp = tw;
+      memcpy(&climates[i].weather,&tmp,sizeof(WeatherType));
+   }else climates[i].weather = tw;
    
-   memcpy(&climates[i].weather,&tmp,sizeof(WeatherType));
+   //memcpy(&climates[i].weather,&tmp,sizeof(WeatherType));
+   //int_to_enum(&climates[i].weather, &tmp);
    //we have our new weather, so we can combine weather and temp weights
    combine_weights(tweights,weather_temp_weights[tmp],MAX_TEMP);
    
@@ -415,10 +427,12 @@
                            }else if(pc->isMeditating()){
                               pc->setPosn(POS_REST);
                               pc->show("A stinging sensation breaks your meditation\n");
-                              if(crit_ptr != pc){
-                                    Sprintf(buf, "%S's meditation is disrupted by a large peice of hail !\n",
-                                    pc->getName(crit_ptr->SEE_BIT));
-                                    crit_ptr->show(buf);
+                              while((crit_ptr = rcll.next())){
+                                 if(crit_ptr != pc){
+                                       Sprintf(buf, "%S's meditation is disrupted by a large peice of hail !\n",
+                                       pc->getName(crit_ptr->SEE_BIT));
+                                     crit_ptr->show(buf);
+                                 }
                               }
                            }else{
                               pc->show("A large piece of hail hits you!\n");




More information about the ScryMUD mailing list