Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1523


Ignore:
Timestamp:
Jun 3, 2008, 12:06:09 AM (16 years ago)
Author:
scheusso
Message:

some enhanced error handling

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/network/src/network/GameStateManager.cc

    r1516 r1523  
    4444#include <iostream>
    4545#include <zlib.h>
     46#include <assert.h>
    4647
    4748#include "core/CoreIncludes.h"
     
    473474    if(gamestateID == GAMESTATEID_INITIAL){
    474475      temp->setGameStateID(GAMESTATEID_INITIAL);
    475       if(curid!=GAMESTATEID_INITIAL)
     476      if(curid!=GAMESTATEID_INITIAL){
     477        assert(gameStateUsed.find(curid)!=gameStateUsed.end());
    476478        --(gameStateUsed.find(curid)->second);
     479      }
    477480      return;
    478481    }
     
    484487//     deleteUnusedGameState(curid);
    485488    //increase gamestateused
    486     if(curid!=GAMESTATEID_INITIAL)
    487       --(gameStateUsed.find(curid)->second);
    488     ++(gameStateUsed.find(gamestateID)->second);
    489     temp->setGameStateID(gamestateID);
     489    std::map<int, int>::iterator it = gameStateUsed.find(curid);
     490    if(curid!=GAMESTATEID_INITIAL){
     491      if(it!=gameStateUsed.end())
     492        --(it->second);
     493    }
     494    it = gameStateUsed.find(gamestateID);
     495    if(it!=gameStateUsed.end()){
     496      ++(it->second);
     497      temp->setGameStateID(gamestateID);
     498    }
    490499    /*
    491500    GameState *old = clientGameState[clientID];
Note: See TracChangeset for help on using the changeset viewer.