This is RiskUtility.m in view mode; [Download] [Up]
/* Generated by Interface Builder */ #import "RiskUtility.h" #import <objc/List.h> #import <appkit/Button.h> #import "Country.h" #import "CountryData.h" #import "Card.h" #define COUNTRYFILE "Country.data" #define CARDFILE "Card.data" #define DIRPATH "/tmp/" @implementation RiskUtility - writeCountryData:sender { id countryList; id temp; NXTypedStream *ts; countryList = [[List alloc] init]; //South America temp = [[Country alloc] initName:NM_argentina idNum:ID_argentina shape:SH_argentina shapePts:shapeSize(SH_argentina) neighbors:NE_argentina neighborNum:neighborsSize(NE_argentina)]; [temp setArmyCellPtX:AX_argentina andY:AY_argentina]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_peru idNum:ID_peru shape:SH_peru shapePts:shapeSize(SH_peru) neighbors:NE_peru neighborNum:neighborsSize(NE_peru)]; [temp setArmyCellPtX:AX_peru andY:AY_peru]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_venezuela idNum:ID_venezuela shape:SH_venezuela shapePts:shapeSize(SH_venezuela) neighbors:NE_venezuela neighborNum:neighborsSize(NE_venezuela)]; [temp setArmyCellPtX:AX_venezuela andY:AY_venezuela]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_brazil idNum:ID_brazil shape:SH_brazil shapePts:shapeSize(SH_brazil) neighbors:NE_brazil neighborNum:neighborsSize(NE_brazil)]; [temp setArmyCellPtX:AX_brazil andY:AY_brazil]; [countryList addObject:temp]; // North America temp = [[Country alloc] initName:NM_centralAmerica idNum:ID_centralAmerica shape:SH_centralAmerica shapePts:shapeSize(SH_centralAmerica) neighbors:NE_centralAmerica neighborNum:neighborsSize(NE_centralAmerica)]; [temp setArmyCellPtX:AX_centralAmerica andY:AY_centralAmerica]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_westernUS idNum:ID_westernUS shape:SH_westernUS shapePts:shapeSize(SH_westernUS) neighbors:NE_westernUS neighborNum:neighborsSize(NE_westernUS)]; [temp setArmyCellPtX:AX_westernUS andY:AY_westernUS]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_easternUS idNum:ID_easternUS shape:SH_easternUS shapePts:shapeSize(SH_easternUS) neighbors:NE_easternUS neighborNum:neighborsSize(NE_easternUS)]; [temp setArmyCellPtX:AX_easternUS andY:AY_easternUS]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_alberta idNum:ID_alberta shape:SH_alberta shapePts:shapeSize(SH_alberta) neighbors:NE_alberta neighborNum:neighborsSize(NE_alberta)]; [temp setArmyCellPtX:AX_alberta andY:AY_alberta]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_northwest idNum:ID_northwest shape:NULL shapePts:0 neighbors:NE_northwest neighborNum:neighborsSize(NE_northwest)]; [temp setShape:SH_northwest1 shapePts:shapeSize(SH_northwest1) shape2:SH_northwest2 shape2Pts:shapeSize(SH_northwest2) shape3:SH_northwest3 shape3Pts:shapeSize(SH_northwest3)]; [temp setArmyCellPtX:AX_northwest andY:AY_northwest]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_ontario idNum:ID_ontario shape:SH_ontario shapePts:shapeSize(SH_ontario) neighbors:NE_ontario neighborNum:neighborsSize(NE_ontario)]; [temp setArmyCellPtX:AX_ontario andY:AY_ontario]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_alaska idNum:ID_alaska shape:SH_alaska shapePts:shapeSize(SH_alaska) neighbors:NE_alaska neighborNum:neighborsSize(NE_alaska)]; [temp setArmyCellPtX:AX_alaska andY:AY_alaska]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_quebec idNum:ID_quebec shape:SH_quebec shapePts:shapeSize(SH_quebec) neighbors:NE_quebec neighborNum:neighborsSize(NE_quebec)]; [temp setArmyCellPtX:AX_quebec andY:AY_quebec]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_greenland idNum:ID_greenland shape:NULL shapePts:0 neighbors:NE_greenland neighborNum:neighborsSize(NE_greenland)]; [temp setShape:SH_greenland1 shapePts:shapeSize(SH_greenland1) shape2:SH_greenland2 shape2Pts:shapeSize(SH_greenland2) shape3:SH_greenland3 shape3Pts:shapeSize(SH_greenland3)]; [temp setArmyCellPtX:AX_greenland andY:AY_greenland]; [countryList addObject:temp]; // Europe temp = [[Country alloc] initName:NM_iceland idNum:ID_iceland shape:SH_iceland shapePts:shapeSize(SH_iceland) neighbors:NE_iceland neighborNum:neighborsSize(NE_iceland)]; [temp setArmyCellPtX:AX_iceland andY:AY_iceland]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_britain idNum:ID_britain shape:NULL shapePts:0 neighbors:NE_britain neighborNum:neighborsSize(NE_britain)]; [temp setShape:SH_britain1 shapePts:shapeSize(SH_britain1) shape2:SH_britain2 shape2Pts:shapeSize(SH_britain2) shape3:NULL shape3Pts:0]; [temp setArmyCellPtX:AX_britain andY:AY_britain]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_westernEurope idNum:ID_westernEurope shape:SH_westernEurope shapePts:shapeSize(SH_westernEurope) neighbors:NE_westernEurope neighborNum:neighborsSize(NE_westernEurope)]; [temp setArmyCellPtX:AX_westernEurope andY:AY_westernEurope]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_southernEurope idNum:ID_southernEurope shape:SH_southernEurope shapePts:shapeSize(SH_southernEurope) neighbors:NE_southernEurope neighborNum:neighborsSize(NE_southernEurope)]; [temp setArmyCellPtX:AX_southernEurope andY:AY_southernEurope]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_northernEurope idNum:ID_northernEurope shape:SH_northernEurope shapePts:shapeSize(SH_northernEurope) neighbors:NE_northernEurope neighborNum:neighborsSize(NE_northernEurope)]; [temp setArmyCellPtX:AX_northernEurope andY:AY_northernEurope]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_ukraine idNum:ID_ukraine shape:SH_ukraine shapePts:shapeSize(SH_ukraine) neighbors:NE_ukraine neighborNum:neighborsSize(NE_ukraine)]; [temp setArmyCellPtX:AX_ukraine andY:AY_ukraine]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_scandanavia idNum:ID_scandanavia shape:SH_scandanavia shapePts:shapeSize(SH_scandanavia) neighbors:NE_scandanavia neighborNum:neighborsSize(NE_scandanavia)]; [temp setArmyCellPtX:AX_scandanavia andY:AY_scandanavia]; [countryList addObject:temp]; // Africa temp = [[Country alloc] initName:NM_southAfrica idNum:ID_southAfrica shape:SH_southAfrica shapePts:shapeSize(SH_southAfrica) neighbors:NE_southAfrica neighborNum:neighborsSize(NE_southAfrica)]; [temp setArmyCellPtX:AX_southAfrica andY:AY_southAfrica]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_congo idNum:ID_congo shape:SH_congo shapePts:shapeSize(SH_congo) neighbors:NE_congo neighborNum:neighborsSize(NE_congo)]; [temp setArmyCellPtX:AX_congo andY:AY_congo]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_northAfrica idNum:ID_northAfrica shape:SH_northAfrica shapePts:shapeSize(SH_northAfrica) neighbors:NE_northAfrica neighborNum:neighborsSize(NE_northAfrica)]; [temp setArmyCellPtX:AX_northAfrica andY:AY_northAfrica]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_eastAfrica idNum:ID_eastAfrica shape:SH_eastAfrica shapePts:shapeSize(SH_eastAfrica) neighbors:NE_eastAfrica neighborNum:neighborsSize(NE_eastAfrica)]; [temp setArmyCellPtX:AX_eastAfrica andY:AY_eastAfrica]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_egypt idNum:ID_egypt shape:SH_egypt shapePts:shapeSize(SH_egypt) neighbors:NE_egypt neighborNum:neighborsSize(NE_egypt)]; [temp setArmyCellPtX:AX_egypt andY:AY_egypt]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_madagascar idNum:ID_madagascar shape:SH_madagascar shapePts:shapeSize(SH_madagascar) neighbors:NE_madagascar neighborNum:neighborsSize(NE_madagascar)]; [temp setArmyCellPtX:AX_madagascar andY:AY_madagascar]; [countryList addObject:temp]; // Asia temp = [[Country alloc] initName:NM_middleEast idNum:ID_middleEast shape:SH_middleEast shapePts:shapeSize(SH_middleEast) neighbors:NE_middleEast neighborNum:neighborsSize(NE_middleEast)]; [temp setArmyCellPtX:AX_middleEast andY:AY_middleEast]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_india idNum:ID_india shape:SH_india shapePts:shapeSize(SH_india) neighbors:NE_india neighborNum:neighborsSize(NE_india)]; [temp setArmyCellPtX:AX_india andY:AY_india]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_siam idNum:ID_siam shape:SH_siam shapePts:shapeSize(SH_siam) neighbors:NE_siam neighborNum:neighborsSize(NE_siam)]; [temp setArmyCellPtX:AX_siam andY:AY_siam]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_china idNum:ID_china shape:SH_china shapePts:shapeSize(SH_china) neighbors:NE_china neighborNum:neighborsSize(NE_china)]; [temp setArmyCellPtX:AX_china andY:AY_china]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_afghanistan idNum:ID_afghanistan shape:SH_afghanistan shapePts:shapeSize(SH_afghanistan) neighbors:NE_afghanistan neighborNum:neighborsSize(NE_afghanistan)]; [temp setArmyCellPtX:AX_afghanistan andY:AY_afghanistan]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_ural idNum:ID_ural shape:SH_ural shapePts:shapeSize(SH_ural) neighbors:NE_ural neighborNum:neighborsSize(NE_ural)]; [temp setArmyCellPtX:AX_ural andY:AY_ural]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_siberia idNum:ID_siberia shape:SH_siberia shapePts:shapeSize(SH_siberia) neighbors:NE_siberia neighborNum:neighborsSize(NE_siberia)]; [temp setArmyCellPtX:AX_siberia andY:AY_siberia]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_mongolia idNum:ID_mongolia shape:SH_mongolia shapePts:shapeSize(SH_mongolia) neighbors:NE_mongolia neighborNum:neighborsSize(NE_mongolia)]; [temp setArmyCellPtX:AX_mongolia andY:AY_mongolia]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_irkutsk idNum:ID_irkutsk shape:SH_irkutsk shapePts:shapeSize(SH_irkutsk) neighbors:NE_irkutsk neighborNum:neighborsSize(NE_irkutsk)]; [temp setArmyCellPtX:AX_irkutsk andY:AY_irkutsk]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_yakutsk idNum:ID_yakutsk shape:SH_yakutsk shapePts:shapeSize(SH_yakutsk) neighbors:NE_yakutsk neighborNum:neighborsSize(NE_yakutsk)]; [temp setArmyCellPtX:AX_yakutsk andY:AY_yakutsk]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_kamchatka idNum:ID_kamchatka shape:SH_kamchatka shapePts:shapeSize(SH_kamchatka) neighbors:NE_kamchatka neighborNum:neighborsSize(NE_kamchatka)]; [temp setArmyCellPtX:AX_kamchatka andY:AY_kamchatka]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_japan idNum:ID_japan shape:SH_japan shapePts:shapeSize(SH_japan) neighbors:NE_japan neighborNum:neighborsSize(NE_japan)]; [temp setArmyCellPtX:AX_japan andY:AY_japan]; [countryList addObject:temp]; // Australia temp = [[Country alloc] initName:NM_westernAustralia idNum:ID_westernAustralia shape:SH_westernAustralia shapePts:shapeSize(SH_westernAustralia) neighbors:NE_westernAustralia neighborNum:neighborsSize(NE_westernAustralia)]; [temp setArmyCellPtX:AX_westernAustralia andY:AY_westernAustralia]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_easternAustralia idNum:ID_easternAustralia shape:SH_easternAustralia shapePts:shapeSize(SH_easternAustralia) neighbors:NE_easternAustralia neighborNum:neighborsSize(NE_easternAustralia)]; [temp setArmyCellPtX:AX_easternAustralia andY:AY_easternAustralia]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_newGuinea idNum:ID_newGuinea shape:SH_newGuinea shapePts:shapeSize(SH_newGuinea) neighbors:NE_newGuinea neighborNum:neighborsSize(NE_newGuinea)]; [temp setArmyCellPtX:AX_newGuinea andY:AY_newGuinea]; [countryList addObject:temp]; temp = [[Country alloc] initName:NM_indonesia idNum:ID_indonesia shape:NULL shapePts:0 neighbors:NE_indonesia neighborNum:neighborsSize(NE_indonesia)]; [temp setShape:SH_indonesia1 shapePts:shapeSize(SH_indonesia1) shape2:SH_indonesia2 shape2Pts:shapeSize(SH_indonesia2) shape3:SH_indonesia3 shape3Pts:shapeSize(SH_indonesia3)]; [temp setArmyCellPtX:AX_indonesia andY:AY_indonesia]; [countryList addObject:temp]; ts = NXOpenTypedStreamForFile(DIRPATH COUNTRYFILE, NX_WRITEONLY); NXWriteRootObject(ts, countryList); NXCloseTypedStream(ts); return self; } - writeCardData:sender { id cardList; id temp; NXTypedStream *ts; // read data from tiff files etc... into cardList cardList = [[List alloc] init]; temp = [[Card alloc] initCountry:ID_argentina type:SOLDIER_TYPE imageFile:"Cards/Argentina.tiff"]; [cardList addObject:temp]; [cardButton setImage:[temp image]]; temp = [[Card alloc] initCountry:ID_peru type:SOLDIER_TYPE imageFile:"Cards/Peru.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_venezuela type:SOLDIER_TYPE imageFile:"Cards/Venezuela.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_brazil type:CANNON_TYPE imageFile:"Cards/Brazil.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_centralAmerica type:CANNON_TYPE imageFile:"Cards/CentralAmerica.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_westernUS type:CANNON_TYPE imageFile:"Cards/WesternUS.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_easternUS type:CANNON_TYPE imageFile:"Cards/EasternUS.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_alberta type:CAVALRY_TYPE imageFile:"Cards/Alberta.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_northwest type:CANNON_TYPE imageFile:"Cards/NorthwestTerritory.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_ontario type:CAVALRY_TYPE imageFile:"Cards/Ontario.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_alaska type:SOLDIER_TYPE imageFile:"Cards/Alaska.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_quebec type:CAVALRY_TYPE imageFile:"Cards/Quebec.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_greenland type:CAVALRY_TYPE imageFile:"Cards/Greenland.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_iceland type:SOLDIER_TYPE imageFile:"Cards/Iceland.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_britain type:CANNON_TYPE imageFile:"Cards/GreatBritain.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_westernEurope type:CANNON_TYPE imageFile:"Cards/WesternEurope.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_southernEurope type:CANNON_TYPE imageFile:"Cards/SouthernEurope.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_northernEurope type:CANNON_TYPE imageFile:"Cards/NorthernEurope.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_ukraine type:CAVALRY_TYPE imageFile:"Cards/Ukraine.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_scandanavia type:CAVALRY_TYPE imageFile:"Cards/Scandinavia.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_southAfrica type:CANNON_TYPE imageFile:"Cards/SouthAfrica.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_congo type:SOLDIER_TYPE imageFile:"Cards/Congo.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_northAfrica type:CAVALRY_TYPE imageFile:"Cards/NorthAfrica.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_eastAfrica type:SOLDIER_TYPE imageFile:"Cards/EastAfrica.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_egypt type:SOLDIER_TYPE imageFile:"Cards/Egypt.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_madagascar type:CAVALRY_TYPE imageFile:"Cards/Madagascar.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_middleEast type:SOLDIER_TYPE imageFile:"Cards/MiddleEast.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_india type:CANNON_TYPE imageFile:"Cards/India.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_siam type:SOLDIER_TYPE imageFile:"Cards/Siam.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_china type:SOLDIER_TYPE imageFile:"Cards/China.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_afghanistan type:CAVALRY_TYPE imageFile:"Cards/Afghanistan.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_ural type:CAVALRY_TYPE imageFile:"Cards/Ural.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_siberia type:CAVALRY_TYPE imageFile:"Cards/Siberia.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_mongolia type:SOLDIER_TYPE imageFile:"Cards/Mongolia.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_irkutsk type:CAVALRY_TYPE imageFile:"Cards/Irkutsk.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_yakutsk type:CAVALRY_TYPE imageFile:"Cards/Yakutsk.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_kamchatka type:SOLDIER_TYPE imageFile:"Cards/Kamchatka.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_japan type:CAVALRY_TYPE imageFile:"Cards/Japan.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_westernAustralia type:CANNON_TYPE imageFile:"Cards/WesternAustralia.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_easternAustralia type:CANNON_TYPE imageFile:"Cards/EasternAustralia.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_newGuinea type:SOLDIER_TYPE imageFile:"Cards/NewGuinea.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:ID_indonesia type:CANNON_TYPE imageFile:"Cards/Indonesia.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:-1 type:NIL_TYPE imageFile:"Cards/Joker1.tiff"]; [cardList addObject:temp]; temp = [[Card alloc] initCountry:-1 type:NIL_TYPE imageFile:"Cards/Joker2.tiff"]; [cardList addObject:temp]; // write cardList to .data file ts = NXOpenTypedStreamForFile(DIRPATH CARDFILE, NX_WRITEONLY); NXWriteRootObject(ts, cardList); NXCloseTypedStream(ts); return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.