All pastes #227617 Raw Edit

Untitled

public cpp v1 · immutable
#227617 ·published 2006-10-29 11:58 UTC
rendered paste body
void parse_input(Game game, char *dataString, BeautyState bState){   char leaveMessage[MAX_STR];   int selectCity = -1;   char gameString[MAX_STR];   int imgX = 0, imgY = 0;   char name[MAX_STR], value[MAX_STR];   int anyLeft = TRUE;   leaveMessage[0] = '\0';   gameString[0] = '\0';   bState->curAmtHunters = 1;   while (anyLeft) {      dataString = nextNameValue(dataString, name, value);      if(DEBUG_MODE){         printf("name is %s value is %s\n", name, value);      }      if(dataString == NULL){         anyLeft = FALSE;      }      if(strcmp(name, "leaveMessage") == 0){         strncpy(leaveMessage, value, MAX_STR);         clean_String(leaveMessage);      } else if (strcmp(name, "selectCity") == 0){         selectCity = atoi(value);      } else if (strcmp(name, "gameString") == 0){         strncpy(gameString, value, MAX_STR);      } else if (strcmp(name, "submit_image.x") == 0){         imgX = atoi(value);      } else if (strcmp(name, "submit_image.y") == 0){         imgY = atoi(value);      } else if (strcmp(name, "amountOfHunters") == 0){         bState->curAmtHunters = atoi(value);      }   }   if((imgX > 0) && (imgY > 0)){      //we need to convert this to a city!      selectCity = getCityNum(imgX, imgY);   }   if(strlen(gameString) > 0){      //now get the game string normal style      getStringGame(game, gameString);   }   //now if move is legal, make the move   if (selectCity >= 0 && checkLegalMove(game, selectCity)){      moveHunter(game, selectCity, leaveMessage);   }}