$size = ftell($unitFile); $newID = $size / $defaultBlockSize; //fseek($unitFile, $newID*$defaultBlockSize); //fwrite($unitFile, $charDat); $newChar->changeID($newID); flock($unitFile, LOCK_UN); } // Add game specific infomrationf /// Record locations, controller, etc $newChar->charData[1] = $bldgDat[1]; $newChar->charData[2] = $bldgDat[2]; $newChar->charData[4] = 4; $newChar->charData[18] = 0; $newChar->charData[19] = 500; // Save the new character $newChar->save($unitFile); // Add the unit to the building slot echo 'Save unit ' . $newID . ' in building #' . $postVals[1] . ' queue spot ' . $queueSpot; fseek($unitFile, $postVals[1] * $defaultBlockSize + 4 * ($queueSpot - 1)); fwrite($unitFile, pack('i', $newID)); //$bldgDat[$queueSpot+18] } else { echo 'No available spots'; } // Add character into player's list of available characters - NOT UNTIL COMPLETE WITH IMPORT /* $unitList = new itemSlot($playerDat[19], $slotFile, 40); $unitList->addItem($newID, $slotFile); */ // Add to map if necessary /// Load map data