ViewVC Help
View File | Revision Log | View Changeset | Root Listing
root/Oni2/Daodan/MSVC/Flatline_Server.c
(Generate patch)

Comparing Daodan/MSVC/Flatline_Server.c (file contents):
Revision 582 by gumby, Wed Jan 19 04:35:43 2011 UTC vs.
Revision 583 by gumby, Sat Jan 22 16:28:52 2011 UTC

# Line 77 | Line 77 | player_info* FLrServer_AddPlayer(int ip,
77                          PlayerList[playerlist_slot]->Chr = &(ONgGameState->CharacterStorage)[player_slot];
78                          //PlayerList[playerlist_slot]->Chr->Flags = chr_dontaim | chr_unkillable; //&= 0xFFBFFFFF; //WTF
79                          if(!is_bot) PlayerList[playerlist_slot]->Chr->Flags &= 0xFFBFFFFF; //WTF, magic number.
80 <                        sprintf(PlayerList[playerlist_slot]->Chr->Name, "%.31s", name);        
80 >                        sprintf_s(PlayerList[playerlist_slot]->Chr->Name, 32, "%s", name);              
81 >                        sprintf_s(PlayerList[playerlist_slot]->name, 32, "%s", name);          
82                          UDPServer_SendToAll( (char*)&new_char, sizeof(new_player) + FLATLINE_HEADER );
83                          
84                  }
# Line 90 | Line 91 | player_info* FLrServer_AddPlayer(int ip,
91                  
92                  PlayerList[playerlist_slot]->ip = ip;
93                  PlayerList[playerlist_slot]->list_slot = playerlist_slot;
94 <                sprintf(PlayerList[playerlist_slot]->name,"%.31s",name);
94 >                sprintf_s(PlayerList[playerlist_slot]->name, 32, "%s", name);          
95                  
96                  MultiplayerStatus.PleaseUpdateAllPlayers = 1;
97  
# Line 150 | Line 151 | void FLsPingAll()
151          ping.id = PK_PING;
152          lastPingTime = ping.ping = GetTickCount();
153          UDPServer_SendToAll(&ping, FLATLINE_HEADER + 4);
154 + }
155 +
156 + void FLsUpdateName( int index, char* name )
157 + {
158 +        flatline_packet message;
159 +        int message_size;      
160 +
161 +        char message_buffer[1024];
162 +        sprintf(message_buffer,"%s changed their name to %s", PlayerList[index]->name, name);
163 +        COrMessage_Print(message_buffer, "name_change", 0);
164 +        
165 +        sprintf_s(PlayerList[index]->name, 32, "%s", name);
166 +        sprintf_s(PlayerList[index]->Chr->Name, 32, "%s", name);
167 +
168 +        message.id = CHANGE_NAME;
169 +        message.data[0] = index;
170 +        message_size = sprintf(message.data + 1, "%s", name);
171 +
172 +        UDPServer_SendToAll(&message, message_size + 2 + FLATLINE_HEADER);
173   }

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)