okay so I got everything to work except for my load system every time it loads it fills all the data correctly but it loads it as 640 which is annoying. Ill include a small ammount of source and the text file being read in:
save function:
if(dbMouseX()>=35 && dbMouseX()<=60 && dbMouseY()>=2 && dbMouseY()<=14)
{
//Save button Clicked
vdSaveFileDialog();
filename=vdGetSaveFileDialog();
//save the files info
ofstream file(filename);
file<<filename<<" ";
int x=1;
int y=1;
while(x<=300)
{
y=1;
while(y<=10)
{
file<<dat[x][y]<<" ";
y++;
}
x++;
}
file.close();
}
load function:
if(dbMouseX()>=75 && dbMouseX()<=102 && dbMouseY()>=2 && dbMouseY()<=14)
{
//Load button Clicked
vdOpenFileDialog();
filename=vdGetOpenFileDialog();
//save the files info
ifstream file(filename);
char buffer[256];
int x=1;
int y=1;
int i_buffer;
while(x<=300)
{
y=1;
while(y<=10)
{
file>>i_buffer;
dat[x][y]=i_buffer;
y++;
}
x++;
}
file.close();
}
}
}
map.txt
C:\Documents and Settings\Zephyr\My Documents\map.txt 170 183 2 1 0 1 0 0 0 3 0 186 183 2 2 0 1 0 0 0 3 0 202 183 2 3 0 1 0 0 0 3 0 218 183 2 4 0 1 0 0 0 3 0 234 183 2 5 0 1 0 0 0 3 0 250 183 2 6 0 1 0 0 0 3 0 266 183 2 7 0 1 0 0 0 3 0 282 183 2 8 0 1 0 0 0 3 0 298 183 2 9 0 1 0 0 0 3 0 314 183 2 10 0 1 0 0 0 3 0 330 183 2 11 0 1 0 0 0 3 0 346 183 2 12 0 1 0 0 0 3 0 362 183 2 13 0 1 0 0 0 3 0 378 183 2 14 0 1 0 0 0 3 0 394 183 2 15 0 1 0 0 0 3 0 410 183 2 16 0 1 0 0 0 3 0 426 183 2 17 0 1 0 0 0 3 0 442 183 2 18 0 1 0 0 0 3 0 458 183 2 19 0 1 0 0 0 3 0 474 183 2 20 0 1 0 0 0 3 0 170 199 2 21 0 1 0 0 0 3 0 186 199 2 22 0 0 0 0 0 2 0 202 199 2 23 0 0 0 0 0 2 0 218 199 2 24 0 0 0 0 0 2 0 234 199 2 25 0 0 0 0 0 2 0 250 199 2 26 0 0 0 0 0 2 0 266 199 2 27 0 0 0 0 0 2 0 282 199 2 28 0 0 0 0 0 2 0 298 199 2 29 0 0 0 0 0 2 0 314 199 2 30 0 0 0 0 0 2 0 330 199 2 31 0 0 0 0 0 2 0 346 199 2 32 0 0 0 0 0 2 0 362 199 2 33 0 0 0 0 0 2 0 378 199 2 34 0 0 0 0 0 2 0 394 199 2 35 0 0 0 0 0 2 0 410 199 2 36 0 0 0 0 0 2 0 426 199 2 37 0 0 0 0 0 2 0 442 199 2 38 0 0 0 0 0 2 0 458 199 2 39 0 0 0 0 0 2 0 474 199 2 40 0 1 0 0 0 3 0 170 215 2 41 0 1 0 0 0 3 0 186 215 2 42 0 0 0 0 0 2 0 202 215 2 43 0 0 0 0 0 2 0 218 215 2 44 0 0 0 0 0 2 0 234 215 2 45 0 0 0 0 0 2 0 250 215 2 46 0 0 0 0 0 2 0 266 215 2 47 0 0 0 0 0 2 0 282 215 2 48 0 0 0 0 0 2 0 298 215 2 49 0 0 0 0 0 2 0 314 215 2 50 0 0 0 0 0 2 0 330 215 2 51 0 0 0 0 0 2 0 346 215 2 52 0 0 0 0 0 2 0 362 215 2 53 0 0 0 0 0 2 0 378 215 2 54 0 0 0 0 0 2 0 394 215 2 55 0 0 0 0 0 2 0 410 215 2 56 0 0 0 0 0 2 0 426 215 2 57 0 0 0 0 0 2 0 442 215 2 58 0 0 0 0 0 2 0 458 215 2 59 0 0 0 0 0 2 0 474 215 2 60 0 1 0 0 0 3 0 170 231 2 61 0 1 0 0 0 3 0 186 231 2 62 0 0 0 0 0 2 0 202 231 2 63 0 0 0 0 0 2 0 218 231 2 64 0 0 0 0 0 2 0 234 231 2 65 0 0 0 0 0 2 0 250 231 2 66 0 0 0 0 0 2 0 266 231 2 67 0 0 0 0 0 2 0 282 231 2 68 0 0 0 0 0 2 0 298 231 2 69 0 0 0 0 0 2 0 314 231 2 70 0 0 0 0 0 2 0 330 231 2 71 0 0 0 0 0 2 0 346 231 2 72 0 0 0 0 0 2 0 362 231 2 73 0 0 0 0 0 2 0 378 231 2 74 0 0 0 0 0 2 0 394 231 2 75 0 0 0 0 0 2 0 410 231 2 76 0 0 0 0 0 2 0 426 231 2 77 0 0 0 0 0 2 0 442 231 2 78 0 0 0 0 0 2 0 458 231 2 79 0 0 0 0 0 2 0 474 231 2 80 0 1 0 0 0 3 0 170 247 2 81 0 1 0 0 0 3 0 186 247 2 82 0 0 0 0 0 2 0 202 247 2 83 0 0 0 0 0 2 0 218 247 2 84 0 0 0 0 0 2 0 234 247 2 85 0 0 0 0 0 2 0 250 247 2 86 0 0 0 0 0 2 0 266 247 2 87 0 0 0 0 0 2 0 282 247 2 88 0 0 0 0 0 2 0 298 247 2 89 0 0 0 0 0 2 0 314 247 2 90 0 0 0 0 0 2 0 330 247 2 91 0 0 0 0 0 2 0 346 247 2 92 0 0 0 0 0 2 0 362 247 2 93 0 0 0 0 0 2 0 378 247 2 94 0 0 0 0 0 2 0 394 247 2 95 0 0 0 0 0 2 0 410 247 2 96 0 0 0 0 0 2 0 426 247 2 97 0 0 0 0 0 2 0 442 247 2 98 0 0 0 0 0 2 0 458 247 2 99 0 0 0 0 0 2 0 474 247 2 100 0 1 0 0 0 3 0 170 263 2 101 0 1 0 0 0 3 0 186 263 2 102 0 0 0 0 0 2 0 202 263 2 103 0 0 0 0 0 2 0 218 263 2 104 0 0 0 0 0 2 0 234 263 2 105 0 0 0 0 0 2 0 250 263 2 106 0 0 0 0 0 2 0 266 263 2 107 0 0 0 0 0 2 0 282 263 2 108 0 0 0 0 0 2 0 298 263 2 109 0 0 0 0 0 2 0 314 263 2 110 0 0 0 0 0 2 0 330 263 2 111 0 0 0 0 0 2 0 346 263 2 112 0 0 0 0 0 2 0 362 263 2 113 0 0 0 0 0 2 0 378 263 2 114 0 0 0 0 0 2 0 394 263 2 115 0 0 0 0 0 2 0 410 263 2 116 0 0 0 0 0 2 0 426 263 2 117 0 0 0 0 0 2 0 442 263 2 118 0 0 0 0 0 2 0 458 263 2 119 0 0 0 0 0 2 0 474 263 2 120 0 1 0 0 0 3 0 170 279 2 121 0 1 0 0 0 3 0 186 279 2 122 0 0 0 0 0 2 0 202 279 2 123 0 0 0 0 0 2 0 218 279 2 124 0 0 0 0 0 2 0 234 279 2 125 0 0 0 0 0 2 0 250 279 2 126 0 0 0 0 0 2 0 266 279 2 127 0 0 0 0 0 2 0 282 279 2 128 0 0 0 0 0 2 0 298 279 2 129 0 0 0 0 0 2 0 314 279 2 130 0 0 0 0 0 2 0 330 279 2 131 0 0 0 0 0 2 0 346 279 2 132 0 0 0 0 0 2 0 362 279 2 133 0 0 0 0 0 2 0 378 279 2 134 0 0 0 0 0 2 0 394 279 2 135 0 0 0 0 0 2 0 410 279 2 136 0 0 0 0 0 2 0 426 279 2 137 0 0 0 0 0 2 0 442 279 2 138 0 0 0 0 0 2 0 458 279 2 139 0 0 0 0 0 2 0 474 279 2 140 0 1 0 0 0 3 0 170 295 2 141 0 1 0 0 0 3 0 186 295 2 142 0 0 0 0 0 2 0 202 295 2 143 0 0 0 0 0 2 0 218 295 2 144 0 0 0 0 0 2 0 234 295 2 145 0 0 0 0 0 2 0 250 295 2 146 0 0 0 0 0 2 0 266 295 2 147 0 0 0 0 0 2 0 282 295 2 148 0 0 0 0 0 2 0 298 295 2 149 0 0 0 0 0 2 0 314 295 2 150 0 0 0 0 0 2 0 330 295 2 151 0 0 0 0 0 2 0 346 295 2 152 0 0 0 0 0 2 0 362 295 2 153 0 0 0 0 0 2 0 378 295 2 154 0 0 0 0 0 2 0 394 295 2 155 0 0 0 0 0 2 0 410 295 2 156 0 0 0 0 0 2 0 426 295 2 157 0 0 0 0 0 2 0 442 295 2 158 0 0 0 0 0 2 0 458 295 2 159 0 0 0 0 0 2 0 474 295 2 160 0 1 0 0 0 3 0 170 311 2 161 0 1 0 0 0 3 0 186 311 2 162 0 0 0 0 0 2 0 202 311 2 163 0 0 0 0 0 2 0 218 311 2 164 0 0 0 0 0 2 0 234 311 2 165 0 0 0 0 0 2 0 250 311 2 166 0 0 0 0 0 2 0 266 311 2 167 0 0 0 0 0 2 0 282 311 2 168 0 0 0 0 0 2 0 298 311 2 169 0 0 0 0 0 2 0 314 311 2 170 0 0 0 0 0 2 0 330 311 2 171 0 0 0 0 0 2 0 346 311 2 172 0 0 0 0 0 2 0 362 311 2 173 0 0 0 0 0 2 0 378 311 2 174 0 0 0 0 0 2 0 394 311 2 175 0 0 0 0 0 2 0 410 311 2 176 0 0 0 0 0 2 0 426 311 2 177 0 0 0 0 0 2 0 442 311 2 178 0 0 0 0 0 2 0 458 311 2 179 0 0 0 0 0 2 0 474 311 2 180 0 1 0 0 0 3 0 170 327 2 181 0 1 0 0 0 3 0 186 327 2 182 0 0 0 0 0 2 0 202 327 2 183 0 0 0 0 0 2 0 218 327 2 184 0 0 0 0 0 2 0 234 327 2 185 0 0 0 0 0 2 0 250 327 2 186 0 0 0 0 0 2 0 266 327 2 187 0 0 0 0 0 2 0 282 327 2 188 0 0 0 0 0 2 0 298 327 2 189 0 0 0 0 0 2 0 314 327 2 190 0 0 0 0 0 2 0 330 327 2 191 0 0 0 0 0 2 0 346 327 2 192 0 0 0 0 0 2 0 362 327 2 193 0 0 0 0 0 2 0 378 327 2 194 0 0 0 0 0 2 0 394 327 2 195 0 0 0 0 0 2 0 410 327 2 196 0 0 0 0 0 2 0 426 327 2 197 0 0 0 0 0 2 0 442 327 2 198 0 0 0 0 0 2 0 458 327 2 199 0 0 0 0 0 2 0 474 327 2 200 0 1 0 0 0 3 0 170 343 2 201 0 1 0 0 0 3 0 186 343 2 202 0 0 0 0 0 2 0 202 343 2 203 0 0 0 0 0 2 0 218 343 2 204 0 0 0 0 0 2 0 234 343 2 205 0 0 0 0 0 2 0 250 343 2 206 0 0 0 0 0 2 0 266 343 2 207 0 0 0 0 0 2 0 282 343 2 208 0 0 0 0 0 2 0 298 343 2 209 0 0 0 0 0 2 0 314 343 2 210 0 0 0 0 0 2 0 330 343 2 211 0 0 0 0 0 2 0 346 343 2 212 0 0 0 0 0 2 0 362 343 2 213 0 0 0 0 0 2 0 378 343 2 214 0 0 0 0 0 2 0 394 343 2 215 0 0 0 0 0 2 0 410 343 2 216 0 0 0 0 0 2 0 426 343 2 217 0 0 0 0 0 2 0 442 343 2 218 0 0 0 0 0 2 0 458 343 2 219 0 0 0 0 0 2 0 474 343 2 220 0 1 0 0 0 3 0 170 359 2 221 0 1 0 0 0 3 0 186 359 2 222 0 0 0 0 0 2 0 202 359 2 223 0 0 0 0 0 2 0 218 359 2 224 0 0 0 0 0 2 0 234 359 2 225 0 0 0 0 0 2 0 250 359 2 226 0 0 0 0 0 2 0 266 359 2 227 0 0 0 0 0 2 0 282 359 2 228 0 0 0 0 0 2 0 298 359 2 229 0 0 0 0 0 2 0 314 359 2 230 0 0 0 0 0 2 0 330 359 2 231 0 0 0 0 0 2 0 346 359 2 232 0 0 0 0 0 2 0 362 359 2 233 0 0 0 0 0 2 0 378 359 2 234 0 0 0 0 0 2 0 394 359 2 235 0 0 0 0 0 2 0 410 359 2 236 0 0 0 0 0 2 0 426 359 2 237 0 0 0 0 0 2 0 442 359 2 238 0 0 0 0 0 2 0 458 359 2 239 0 0 0 0 0 2 0 474 359 2 240 0 1 0 0 0 3 0 170 375 2 241 0 1 0 0 0 3 0 186 375 2 242 0 0 0 0 0 2 0 202 375 2 243 0 0 0 0 0 2 0 218 375 2 244 0 0 0 0 0 2 0 234 375 2 245 0 0 0 0 0 2 0 250 375 2 246 0 0 0 0 0 2 0 266 375 2 247 0 0 0 0 0 2 0 282 375 2 248 0 0 0 0 0 2 0 298 375 2 249 0 0 0 0 0 2 0 314 375 2 250 0 0 0 0 0 2 0 330 375 2 251 0 0 0 0 0 2 0 346 375 2 252 0 0 0 0 0 2 0 362 375 2 253 0 0 0 0 0 2 0 378 375 2 254 0 0 0 0 0 2 0 394 375 2 255 0 0 0 0 0 2 0 410 375 2 256 0 0 0 0 0 2 0 426 375 2 257 0 0 0 0 0 2 0 442 375 2 258 0 0 0 0 0 2 0 458 375 2 259 0 0 0 0 0 2 0 474 375 2 260 0 1 0 0 0 3 0 170 391 2 261 0 1 0 0 0 3 0 186 391 2 262 0 0 0 0 0 2 0 202 391 2 263 0 0 0 0 0 2 0 218 391 2 264 0 0 0 0 0 2 0 234 391 2 265 0 0 0 0 0 2 0 250 391 2 266 0 0 0 0 0 2 0 266 391 2 267 0 0 0 0 0 2 0 282 391 2 268 0 0 0 0 0 2 0 298 391 2 269 0 0 0 0 0 2 0 314 391 2 270 0 0 0 0 0 2 0 330 391 2 271 0 0 0 0 0 2 0 346 391 2 272 0 0 0 0 0 2 0 362 391 2 273 0 0 0 0 0 2 0 378 391 2 274 0 0 0 0 0 2 0 394 391 2 275 0 0 0 0 0 2 0 410 391 2 276 0 0 0 0 0 2 0 426 391 2 277 0 0 0 0 0 2 0 442 391 2 278 0 0 0 0 0 2 0 458 391 2 279 0 0 0 0 0 2 0 474 391 2 280 0 1 0 0 0 3 0 170 407 2 281 0 1 0 0 0 3 0 186 407 2 282 0 1 0 0 0 3 0 202 407 2 283 0 1 0 0 0 3 0 218 407 2 284 0 1 0 0 0 3 0 234 407 2 285 0 1 0 0 0 3 0 250 407 2 286 0 1 0 0 0 3 0 266 407 2 287 0 1 0 0 0 3 0 282 407 2 288 0 1 0 0 0 3 0 298 407 2 289 0 1 0 0 0 3 0 314 407 2 290 0 1 0 0 0 3 0 330 407 2 291 0 1 0 0 0 3 0 346 407 2 292 0 1 0 0 0 3 0 362 407 2 293 0 1 0 0 0 3 0 378 407 2 294 0 1 0 0 0 3 0 394 407 2 295 0 1 0 0 0 3 0 410 407 2 296 0 1 0 0 0 3 0 426 407 2 297 0 1 0 0 0 3 0 442 407 2 298 0 1 0 0 0 3 0 458 407 2 299 0 1 0 0 0 3 0 474 407 2 300 0 1 0 0 0 3 0
Show me your combat algorithms(programmers read this NOT in a programming state of mind)