1 | %{ |
1 | %{ |
2 | /* |
2 | /* |
3 | * static char *rcsid_object_c = |
3 | * static char *rcsid_object_c = |
4 | * "$Id: loader.l,v 1.13 2006/08/28 14:05:23 root Exp $"; |
4 | * "$Id: loader.l,v 1.14 2006/08/29 05:03:54 root Exp $"; |
5 | */ |
5 | */ |
6 | |
6 | |
7 | /* |
7 | /* |
8 | CrossFire, A Multiplayer game for X-windows |
8 | CrossFire, A Multiplayer game for X-windows |
9 | |
9 | |
… | |
… | |
1056 | ^range_modifier{S} op->range_modifier = IVAL; |
1056 | ^range_modifier{S} op->range_modifier = IVAL; |
1057 | ^dam_modifier{S} op->dam_modifier = IVAL; |
1057 | ^dam_modifier{S} op->dam_modifier = IVAL; |
1058 | ^duration_modifier{S} op->duration_modifier = IVAL; |
1058 | ^duration_modifier{S} op->duration_modifier = IVAL; |
1059 | ^is_buildable{S} SET_OR_CLEAR_FLAG( op, FLAG_IS_BUILDABLE, IVAL ); |
1059 | ^is_buildable{S} SET_OR_CLEAR_FLAG( op, FLAG_IS_BUILDABLE, IVAL ); |
1060 | |
1060 | |
1061 | ^event_apply{S} { |
1061 | ^event_ { |
1062 | char *yv=yval(); |
1062 | LOG (llevError, "stray event_* in map file, skipping."); |
1063 | if (*yv=='\0') |
|
|
1064 | LOG(llevError,"Event (apply) without val\n"); |
|
|
1065 | else |
|
|
1066 | insert_event(op,EVENT_APPLY,yv,NULL,NULL); |
|
|
1067 | } |
1063 | } |
1068 | |
1064 | |
1069 | ^event_apply_plugin{S} { |
1065 | ^current_weapon_script{S} { LOG (llevError, "stray current_weapon_script in map file, skipping."); } |
1070 | char *yv=yval(); |
|
|
1071 | if (*yv=='\0') |
|
|
1072 | LOG(llevError,"Event (apply) without plugin\n"); |
|
|
1073 | else |
|
|
1074 | insert_event(op,EVENT_APPLY,NULL,yv,NULL); |
|
|
1075 | } |
|
|
1076 | |
|
|
1077 | ^event_apply_options{S} { |
|
|
1078 | char *yv=yval(); |
|
|
1079 | if (*yv=='\0') |
|
|
1080 | LOG(llevError,"Event (apply) without options\n"); |
|
|
1081 | else |
|
|
1082 | insert_event(op,EVENT_APPLY,NULL,NULL,yv); |
|
|
1083 | } |
|
|
1084 | |
|
|
1085 | ^event_attack{S} { |
|
|
1086 | char *yv=yval(); |
|
|
1087 | if (*yv=='\0') |
|
|
1088 | LOG(llevError,"Event (attack) without val\n"); |
|
|
1089 | else |
|
|
1090 | insert_event(op,EVENT_ATTACK,yv,NULL,NULL); |
|
|
1091 | } |
|
|
1092 | |
|
|
1093 | ^event_attack_plugin{S} { |
|
|
1094 | char *yv=yval(); |
|
|
1095 | if (*yv=='\0') |
|
|
1096 | LOG(llevError,"Event (attack) without plugin\n"); |
|
|
1097 | else |
|
|
1098 | insert_event(op,EVENT_ATTACK,NULL,yv,NULL); |
|
|
1099 | } |
|
|
1100 | |
|
|
1101 | ^event_attack_options{S} { |
|
|
1102 | char *yv=yval(); |
|
|
1103 | if (*yv=='\0') |
|
|
1104 | LOG(llevError,"Event (attack) without options\n"); |
|
|
1105 | else |
|
|
1106 | insert_event(op,EVENT_ATTACK,NULL,NULL,yv); |
|
|
1107 | } |
|
|
1108 | ^event_death{S} { |
|
|
1109 | char *yv=yval(); |
|
|
1110 | if (*yv=='\0') |
|
|
1111 | LOG(llevError,"Event (death) without val\n"); |
|
|
1112 | else |
|
|
1113 | insert_event(op,EVENT_DEATH,yv,NULL,NULL); |
|
|
1114 | } |
|
|
1115 | |
|
|
1116 | ^event_death_plugin{S} { |
|
|
1117 | char *yv=yval(); |
|
|
1118 | if (*yv=='\0') |
|
|
1119 | LOG(llevError,"Event (death) without plugin\n"); |
|
|
1120 | else |
|
|
1121 | insert_event(op,EVENT_DEATH,NULL,yv,NULL); |
|
|
1122 | } |
|
|
1123 | |
|
|
1124 | ^event_death_options{S} { |
|
|
1125 | char *yv=yval(); |
|
|
1126 | if (*yv=='\0') |
|
|
1127 | LOG(llevError,"Event (death) without options\n"); |
|
|
1128 | else |
|
|
1129 | insert_event(op,EVENT_DEATH,NULL,NULL,yv); |
|
|
1130 | } |
|
|
1131 | ^event_drop{S} { |
|
|
1132 | char *yv=yval(); |
|
|
1133 | if (*yv=='\0') |
|
|
1134 | LOG(llevError,"Event (drop) without val\n"); |
|
|
1135 | else |
|
|
1136 | insert_event(op,EVENT_DROP,yv,NULL,NULL); |
|
|
1137 | } |
|
|
1138 | |
|
|
1139 | ^event_drop_plugin{S} { |
|
|
1140 | char *yv=yval(); |
|
|
1141 | if (*yv=='\0') |
|
|
1142 | LOG(llevError,"Event (drop) without plugin\n"); |
|
|
1143 | else |
|
|
1144 | insert_event(op,EVENT_DROP,NULL,yv,NULL); |
|
|
1145 | } |
|
|
1146 | |
|
|
1147 | ^event_drop_options{S} { |
|
|
1148 | char *yv=yval(); |
|
|
1149 | if (*yv=='\0') |
|
|
1150 | LOG(llevError,"Event (drop) without options\n"); |
|
|
1151 | else |
|
|
1152 | insert_event(op,EVENT_DROP,NULL,NULL,yv); |
|
|
1153 | } |
|
|
1154 | ^event_pickup{S} { |
|
|
1155 | char *yv=yval(); |
|
|
1156 | if (*yv=='\0') |
|
|
1157 | LOG(llevError,"Event (pickup) without val\n"); |
|
|
1158 | else |
|
|
1159 | insert_event(op,EVENT_PICKUP,yv,NULL,NULL); |
|
|
1160 | } |
|
|
1161 | |
|
|
1162 | ^event_pickup_plugin{S} { |
|
|
1163 | char *yv=yval(); |
|
|
1164 | if (*yv=='\0') |
|
|
1165 | LOG(llevError,"Event (pickup) without plugin\n"); |
|
|
1166 | else |
|
|
1167 | insert_event(op,EVENT_PICKUP,NULL,yv,NULL); |
|
|
1168 | } |
|
|
1169 | |
|
|
1170 | ^event_pickup_options{S} { |
|
|
1171 | char *yv=yval(); |
|
|
1172 | if (*yv=='\0') |
|
|
1173 | LOG(llevError,"Event (pickup) without options\n"); |
|
|
1174 | else |
|
|
1175 | insert_event(op,EVENT_PICKUP,NULL,NULL,yv); |
|
|
1176 | } |
|
|
1177 | ^event_say{S} { |
|
|
1178 | char *yv=yval(); |
|
|
1179 | if (*yv=='\0') |
|
|
1180 | LOG(llevError,"Event (say) without val\n"); |
|
|
1181 | else |
|
|
1182 | insert_event(op,EVENT_SAY,yv,NULL,NULL); |
|
|
1183 | } |
|
|
1184 | |
|
|
1185 | ^event_say_plugin{S} { |
|
|
1186 | char *yv=yval(); |
|
|
1187 | if (*yv=='\0') |
|
|
1188 | LOG(llevError,"Event (say) without plugin\n"); |
|
|
1189 | else |
|
|
1190 | insert_event(op,EVENT_SAY,NULL,yv,NULL); |
|
|
1191 | } |
|
|
1192 | |
|
|
1193 | ^event_say_options{S} { |
|
|
1194 | char *yv=yval(); |
|
|
1195 | if (*yv=='\0') |
|
|
1196 | LOG(llevError,"Event (say) without options\n"); |
|
|
1197 | else |
|
|
1198 | insert_event(op,EVENT_SAY,NULL,NULL,yv); |
|
|
1199 | } |
|
|
1200 | ^event_stop{S} { |
|
|
1201 | char *yv=yval(); |
|
|
1202 | if (*yv=='\0') |
|
|
1203 | LOG(llevError,"Event (stop) without val\n"); |
|
|
1204 | else |
|
|
1205 | insert_event(op,EVENT_STOP,yv,NULL,NULL); |
|
|
1206 | } |
|
|
1207 | |
|
|
1208 | ^event_stop_plugin{S} { |
|
|
1209 | char *yv=yval(); |
|
|
1210 | if (*yv=='\0') |
|
|
1211 | LOG(llevError,"Event (stop) without plugin\n"); |
|
|
1212 | else |
|
|
1213 | insert_event(op,EVENT_STOP,NULL,yv,NULL); |
|
|
1214 | } |
|
|
1215 | |
|
|
1216 | ^event_stop_options{S} { |
|
|
1217 | char *yv=yval(); |
|
|
1218 | if (*yv=='\0') |
|
|
1219 | LOG(llevError,"Event (stop) without options\n"); |
|
|
1220 | else |
|
|
1221 | insert_event(op,EVENT_STOP,NULL,NULL,yv); |
|
|
1222 | } |
|
|
1223 | ^event_time{S} { |
|
|
1224 | char *yv=yval(); |
|
|
1225 | if (*yv=='\0') |
|
|
1226 | LOG(llevError,"Event (time) without val\n"); |
|
|
1227 | else |
|
|
1228 | insert_event(op,EVENT_TIME,yv,NULL,NULL); |
|
|
1229 | } |
|
|
1230 | |
|
|
1231 | ^event_time_plugin{S} { |
|
|
1232 | char *yv=yval(); |
|
|
1233 | if (*yv=='\0') |
|
|
1234 | LOG(llevError,"Event (time) without plugin\n"); |
|
|
1235 | else |
|
|
1236 | insert_event(op,EVENT_TIME,NULL,yv,NULL); |
|
|
1237 | } |
|
|
1238 | |
|
|
1239 | ^event_time_options{S} { |
|
|
1240 | char *yv=yval(); |
|
|
1241 | if (*yv=='\0') |
|
|
1242 | LOG(llevError,"Event (time) without options\n"); |
|
|
1243 | else |
|
|
1244 | insert_event(op,EVENT_TIME,NULL,NULL,yv); |
|
|
1245 | } |
|
|
1246 | ^event_throw{S} { |
|
|
1247 | char *yv=yval(); |
|
|
1248 | if (*yv=='\0') |
|
|
1249 | LOG(llevError,"Event (throw) without val\n"); |
|
|
1250 | else |
|
|
1251 | insert_event(op,EVENT_THROW,yv,NULL,NULL); |
|
|
1252 | } |
|
|
1253 | |
|
|
1254 | ^event_throw_plugin{S} { |
|
|
1255 | char *yv=yval(); |
|
|
1256 | if (*yv=='\0') |
|
|
1257 | LOG(llevError,"Event (throw) without plugin\n"); |
|
|
1258 | else |
|
|
1259 | insert_event(op,EVENT_THROW,NULL,yv,NULL); |
|
|
1260 | } |
|
|
1261 | |
|
|
1262 | ^event_throw_options{S} { |
|
|
1263 | char *yv=yval(); |
|
|
1264 | if (*yv=='\0') |
|
|
1265 | LOG(llevError,"Event (apply) without options\n"); |
|
|
1266 | else |
|
|
1267 | insert_event(op,EVENT_THROW,NULL,NULL,yv); |
|
|
1268 | } |
|
|
1269 | ^event_trigger{S} { |
|
|
1270 | char *yv=yval(); |
|
|
1271 | if (*yv=='\0') |
|
|
1272 | LOG(llevError,"Event (trigger) without val\n"); |
|
|
1273 | else |
|
|
1274 | insert_event(op,EVENT_TRIGGER,yv,NULL,NULL); |
|
|
1275 | } |
|
|
1276 | |
|
|
1277 | ^event_trigger_plugin{S} { |
|
|
1278 | char *yv=yval(); |
|
|
1279 | if (*yv=='\0') |
|
|
1280 | LOG(llevError,"Event (trigger) without plugin\n"); |
|
|
1281 | else |
|
|
1282 | insert_event(op,EVENT_TRIGGER,NULL,yv,NULL); |
|
|
1283 | } |
|
|
1284 | |
|
|
1285 | ^event_trigger_options{S} { |
|
|
1286 | char *yv=yval(); |
|
|
1287 | if (*yv=='\0') |
|
|
1288 | LOG(llevError,"Event (trigger) without options\n"); |
|
|
1289 | else |
|
|
1290 | insert_event(op,EVENT_TRIGGER,NULL,NULL,yv); |
|
|
1291 | } |
|
|
1292 | ^event_close{S} { |
|
|
1293 | char *yv=yval(); |
|
|
1294 | if (*yv=='\0') |
|
|
1295 | LOG(llevError,"Event (close) without val\n"); |
|
|
1296 | else |
|
|
1297 | insert_event(op,EVENT_CLOSE,yv,NULL,NULL); |
|
|
1298 | } |
|
|
1299 | |
|
|
1300 | ^event_close_plugin{S} { |
|
|
1301 | char *yv=yval(); |
|
|
1302 | if (*yv=='\0') |
|
|
1303 | LOG(llevError,"Event (close) without plugin\n"); |
|
|
1304 | else |
|
|
1305 | insert_event(op,EVENT_CLOSE,NULL,yv,NULL); |
|
|
1306 | } |
|
|
1307 | |
|
|
1308 | ^event_close_options{S} { |
|
|
1309 | char *yv=yval(); |
|
|
1310 | if (*yv=='\0') |
|
|
1311 | LOG(llevError,"Event (close) without options\n"); |
|
|
1312 | else |
|
|
1313 | insert_event(op,EVENT_CLOSE,NULL,NULL,yv); |
|
|
1314 | } |
|
|
1315 | ^event_timer{S} { |
|
|
1316 | char *yv=yval(); |
|
|
1317 | if (*yv=='\0') |
|
|
1318 | LOG(llevError,"Event (timer) without val\n"); |
|
|
1319 | else |
|
|
1320 | insert_event(op,EVENT_TIMER,yv,NULL,NULL); |
|
|
1321 | } |
|
|
1322 | |
|
|
1323 | ^event_timer_plugin{S} { |
|
|
1324 | char *yv=yval(); |
|
|
1325 | if (*yv=='\0') |
|
|
1326 | LOG(llevError,"Event (timer) without plugin\n"); |
|
|
1327 | else |
|
|
1328 | insert_event(op,EVENT_TIMER,NULL,yv,NULL); |
|
|
1329 | } |
|
|
1330 | |
|
|
1331 | ^event_timer_options{S} { |
|
|
1332 | char *yv=yval(); |
|
|
1333 | if (*yv=='\0') |
|
|
1334 | LOG(llevError,"Event (timer) without options\n"); |
|
|
1335 | else |
|
|
1336 | insert_event(op,EVENT_TIMER,NULL,NULL,yv); |
|
|
1337 | } |
|
|
1338 | |
|
|
1339 | ^current_weapon_script{S} { char *yv=yval(); |
|
|
1340 | |
|
|
1341 | if (*yv=='\0') LOG(llevError,"Script (current weapon) without val\n"); |
|
|
1342 | else |
|
|
1343 | { |
|
|
1344 | FREE_AND_COPY(op->current_weapon_script, yv); |
|
|
1345 | }; |
|
|
1346 | } |
|
|
1347 | |
1066 | |
1348 | <*>(^{WS}$)|\n {/* ignore empty lines, newlines we don't do above */} |
1067 | <*>(^{WS}$)|\n {/* ignore empty lines, newlines we don't do above */} |
1349 | #.*\n {} |
1068 | #.*\n {} |
1350 | |
1069 | |
1351 | <<EOF>> {/* If we got an error, return the error. Otherwise, return that we got EOF */ |
1070 | <<EOF>> {/* If we got an error, return the error. Otherwise, return that we got EOF */ |
… | |
… | |
1434 | LOG(llevDebug,"Got eof while scanning strings\n"); |
1153 | LOG(llevDebug,"Got eof while scanning strings\n"); |
1435 | return LL_EOF; |
1154 | return LL_EOF; |
1436 | } |
1155 | } |
1437 | |
1156 | |
1438 | retval=lex_load(op, fp, map_flags); |
1157 | retval=lex_load(op, fp, map_flags); |
1439 | if (op->current_weapon_script != NULL) |
|
|
1440 | { |
|
|
1441 | op->current_weapon = find_best_weapon_used_match(op, op->current_weapon_script); |
|
|
1442 | LOG(llevDebug, "CurrentWeapon Loaded !\n"); |
|
|
1443 | }; |
|
|
1444 | |
1158 | |
1445 | /* LOG(llevDebug," load completed, object=%s\n",op->name);*/ |
1159 | /* LOG(llevDebug," load completed, object=%s\n",op->name);*/ |
1446 | return retval; |
1160 | return retval; |
1447 | } |
1161 | } |
1448 | |
1162 | |
… | |
… | |
1921 | if (op->will_apply!=op2->will_apply) |
1635 | if (op->will_apply!=op2->will_apply) |
1922 | FAST_SAVE_LONG(fastbuf,"will_apply ",op->will_apply,11); |
1636 | FAST_SAVE_LONG(fastbuf,"will_apply ",op->will_apply,11); |
1923 | if(op->smoothlevel!=op2->smoothlevel) |
1637 | if(op->smoothlevel!=op2->smoothlevel) |
1924 | FAST_SAVE_LONG(fastbuf,"smoothlevel ",op->smoothlevel,12); |
1638 | FAST_SAVE_LONG(fastbuf,"smoothlevel ",op->smoothlevel,12); |
1925 | |
1639 | |
1926 | if (op->current_weapon_script!=op2->current_weapon_script){ |
|
|
1927 | ADD_STRINGLINE_ENTRY(fastbuf,"current_weapon_script ",op->current_weapon_script,22); |
|
|
1928 | }; |
|
|
1929 | |
|
|
1930 | if(op->weapontype && op->weapontype!=op2->weapontype) { |
1640 | if(op->weapontype && op->weapontype!=op2->weapontype) { |
1931 | FAST_SAVE_LONG(fastbuf,"weapontype ",op->weapontype,11); |
1641 | FAST_SAVE_LONG(fastbuf,"weapontype ",op->weapontype,11); |
1932 | } |
1642 | } |
1933 | if(op->tooltype && op->tooltype!=op2->tooltype) { |
1643 | if(op->tooltype && op->tooltype!=op2->tooltype) { |
1934 | FAST_SAVE_LONG(fastbuf,"tooltype ",op->tooltype,9); |
1644 | FAST_SAVE_LONG(fastbuf,"tooltype ",op->tooltype,9); |