From: Anders R. <ma...@us...> - 2003-04-19 15:13:51
|
Update of /cvsroot/planeshift/planeshift/src/server In directory sc8-pr-cvs1:/tmp/cvs-serv21669/src/server Modified Files: command.cpp usermanager.cpp weathermanager.cpp Log Message: - Added update of stat bar on every frame update. - Changed the server command setstats to adjuststat and only setting one stat value at a time. Index: command.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/command.cpp,v retrieving revision 1.70 retrieving revision 1.71 diff -C2 -d -r1.70 -r1.71 *** command.cpp 19 Apr 2003 04:49:08 -0000 1.70 --- command.cpp 19 Apr 2003 15:13:41 -0000 1.71 *************** *** 732,741 **** } ! int com_setstats(char *line) { if (!line) { ! CPrintf("Please specify: PlayerName HP HP_rate Mana Mana_rate Fatigue Fatigue_rat.\n"); return 0; } --- 732,742 ---- } ! int com_adjuststat(char *line) { if (!line) { ! CPrintf("Please specify: PlayerName StatValue AdjustMent.\n" ! "Where StatValue = [HP|HP_max|HP_rate|Mana|Mana_max|Mana_rate|Fatigue|Fatigue_max|Fatigue_rate]"); return 0; } *************** *** 743,752 **** csString str(line); csString player(GetWordNumber(str,1)); ! float hitPoints = atof(GetWordNumber(str,2)); ! float hitPoints_rate = atof(GetWordNumber(str,3)); ! float mana = atof(GetWordNumber(str,4)); ! float mana_rate = atof(GetWordNumber(str,5)); ! float fatigue = atof(GetWordNumber(str,6)); ! float fatigue_rate = atof(GetWordNumber(str,7)); int playerID = psserver->GetDatabase()->GetPlayerID(player); --- 744,749 ---- csString str(line); csString player(GetWordNumber(str,1)); ! csString statValue(GetWordNumber(str,2)); ! float adjust = atof(GetWordNumber(str,3)); int playerID = psserver->GetDatabase()->GetPlayerID(player); *************** *** 772,785 **** if (charData) { - CPrintf("Checking %s %d == %d\n",charData->GetCharName().GetData(), - charData->GetPlayerID(),playerID); - if (charData->GetPlayerID() == playerID) { ! CPrintf("Seting %s: %f %f %f %f %f %f\n",player.GetData(), ! hitPoints,hitPoints_rate,mana,mana_rate,fatigue,fatigue_rate); ! charData->AdjustHitPoints(hitPoints); ! charData->AdjustMana(mana); ! charData->AdjustFatigue(fatigue); return 0; } --- 769,817 ---- if (charData) { if (charData->GetPlayerID() == playerID) { ! statValue.strlwr(); ! if (statValue == "hp" || statValue=="hitpoints") ! { ! charData->AdjustHitPoints(adjust); ! } ! else if (statValue == "hp_max" || statValue=="hitpoints_max") ! { ! charData->AdjustHitPointsMax(adjust); ! } ! else if (statValue == "hp_rate" || statValue=="hitpoints_rate") ! { ! charData->AdjustHitPointsRate(adjust); ! } ! else if (statValue == "mana") ! { ! charData->AdjustMana(adjust); ! } ! else if (statValue == "mana_max") ! { ! charData->AdjustManaMax(adjust); ! } ! else if (statValue == "mana_rate") ! { ! charData->AdjustManaRate(adjust); ! } ! else if (statValue == "fatigue") ! { ! charData->AdjustFatigue(adjust); ! } ! else if (statValue == "fatigue_max") ! { ! charData->AdjustFatigueMax(adjust); ! } ! else if (statValue == "fatigue_rate") ! { ! charData->AdjustFatigueRate(adjust); ! } ! else ! { ! CPrintf("Unkown statValue %s\n",statValue.GetData()); ! return 0; ! } ! CPrintf("Adjusted %s: %s with %f\n",player.GetData(),statValue.GetData(),adjust); return 0; } *************** *** 825,829 **** { "list", com_list, "Display all entities' names, #'s, and positions" }, { "sectors", com_sectors, "Display all sectors" }, ! { "setstats", com_setstats, "Set playerID's HP HP_rate Mana Mana_rate Fatigue Fatigue_rate" }, { 0, 0, 0 } }; --- 857,861 ---- { "list", com_list, "Display all entities' names, #'s, and positions" }, { "sectors", com_sectors, "Display all sectors" }, ! { "adjuststat",com_adjuststat,"Adjust player stat [HP|HP_max|HP_rate|Mana|Mana_max|Mana_rate|Fatigue|Fatigue_max|Fatigue_rate]" }, { 0, 0, 0 } }; Index: usermanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/usermanager.cpp,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** usermanager.cpp 19 Apr 2003 04:49:09 -0000 1.54 --- usermanager.cpp 19 Apr 2003 15:13:41 -0000 1.55 *************** *** 479,485 **** { // WARNING WARNING WARNING WARNING WARNING WARNING WARNING ! // TODO: This is called from the event thread, accessing ! // datastruct on in main thread. Need some sync or ! // move this code in main thread. ClientIterator i(*clients); Client * p; --- 479,485 ---- { // WARNING WARNING WARNING WARNING WARNING WARNING WARNING ! // TODO: This is called from the EventManager thread, accessing ! // datastructs common to the MsgHandler thread. ! // Need some sync or move this code into the MsgHandler thread. ClientIterator i(*clients); Client * p; *************** *** 489,496 **** if (charData) { csRef<iDataBuffer> data = charData->GetStatDRData(); psStatDRMessage msg(p->GetClientNum(),p->GetActor()->GetEntity()->GetID(),data); ! msghandler->SendMessage(msg.me); } } --- 489,506 ---- if (charData) { + if (!charData->UpdateStatDRData()) continue; + csRef<iDataBuffer> data = charData->GetStatDRData(); psStatDRMessage msg(p->GetClientNum(),p->GetActor()->GetEntity()->GetID(),data); ! if (p->InGroup()) ! { ! csRef<Group> group = p->GetGroup(); ! group->Broadcast(msg.me); ! } ! else ! { ! msghandler->SendMessage(msg.me); ! } } } Index: weathermanager.cpp =================================================================== RCS file: /cvsroot/planeshift/planeshift/src/server/weathermanager.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** weathermanager.cpp 8 Mar 2003 13:04:44 -0000 1.12 --- weathermanager.cpp 19 Apr 2003 15:13:41 -0000 1.13 *************** *** 123,127 **** msghandler->Broadcast(rain.msg,NetBase::BC_EVERYONE); ! printf("Rain message: Sector %s with %d drops.\n",(const char *)event->sector,event->value); if (event->value) // if this has drops, then queue event to turn off rain { --- 123,127 ---- msghandler->Broadcast(rain.msg,NetBase::BC_EVERYONE); ! // printf("Rain message: Sector %s with %d drops.\n",(const char *)event->sector,event->value); if (event->value) // if this has drops, then queue event to turn off rain { *************** *** 160,164 **** if (event->si->is_raining) { ! printf("Lightning in sector %s.\n",(const char *)event->sector); psWeatherMessage lightning(0,event->type,event->value,event->sector); msghandler->Broadcast(lightning.msg); --- 160,164 ---- if (event->si->is_raining) { ! // printf("Lightning in sector %s.\n",(const char *)event->sector); psWeatherMessage lightning(0,event->type,event->value,event->sector); msghandler->Broadcast(lightning.msg); |