Changeset c941e07 in network-game


Ignore:
Timestamp:
Nov 11, 2014, 1:05:14 AM (10 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
master
Children:
48801af
Parents:
a9a1295
Message:

Only load the db settings once and actually use the loaded settings instead of the hard-coded ones

Location:
server
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • server/DataAccess.cpp

    ra9a1295 rc941e07  
    3131
    3232   mysql_init(&mysql);
    33    connection = mysql_real_connect(&mysql, "localhost", "pythonAdmin", "pyMaster09*", "pythondb", 0, 0, 0);
     33   connection = mysql_real_connect(&mysql, "localhost", username.c_str(), password.c_str(), database.c_str(), 0, 0, 0);
    3434
    3535   if (connection == NULL) {
  • server/server.cpp

    ra9a1295 rc941e07  
    4343// from used to be const. Removed that so I could take a reference
    4444// and use it to send messages
    45 void processMessage(const NETWORK_MSG& clientMsg, struct sockaddr_in& from, MessageProcessor& msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, ofstream& outputLog);
     45void processMessage(const NETWORK_MSG& clientMsg, struct sockaddr_in& from, MessageProcessor& msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, DataAccess& da, ofstream& outputLog);
    4646
    4747Player *findPlayerByName(map<unsigned int, Player*> &m, string name);
     
    256256      if (msgProcessor.receiveMessage(&clientMsg, &from) >= 0)
    257257      {
    258          processMessage(clientMsg, from, msgProcessor, mapPlayers, mapGames, outputLog);
     258         processMessage(clientMsg, from, msgProcessor, mapPlayers, mapGames, da, outputLog);
    259259
    260260         cout << "Finished processing the message" << endl;
     
    281281}
    282282
    283 void processMessage(const NETWORK_MSG &clientMsg, struct sockaddr_in &from, MessageProcessor &msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, ofstream& outputLog)
     283void processMessage(const NETWORK_MSG &clientMsg, struct sockaddr_in &from, MessageProcessor &msgProcessor, map<unsigned int, Player*>& mapPlayers, map<string, Game*>& mapGames, DataAccess& da, ofstream& outputLog)
    284284{
    285285   NETWORK_MSG serverMsg;
    286    DataAccess da;
    287286
    288287   cout << "Inside processMessage" << endl;
Note: See TracChangeset for help on using the changeset viewer.